1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

configure disqus_shortname from the UI

This commit is contained in:
Sylvain 2020-06-01 18:31:43 +02:00
parent 59cb17789c
commit 9a0f36c245
15 changed files with 52 additions and 27 deletions

View File

@ -12,7 +12,7 @@
*/
'use strict';
Application.Controllers.controller('ProjectElementsController', ['$scope', '$state', 'Component', 'Licence', 'Theme', 'componentsPromise', 'licencesPromise', 'themesPromise', '_t', 'Member', 'uiTourService', 'settingsPromise',
Application.Controllers.controller('AdminProjectsController', ['$scope', '$state', 'Component', 'Licence', 'Theme', 'componentsPromise', 'licencesPromise', 'themesPromise', '_t', 'Member', 'uiTourService', 'settingsPromise',
function ($scope, $state, Component, Licence, Theme, componentsPromise, licencesPromise, themesPromise, _t, Member, uiTourService, settingsPromise) {
// Materials list (plastic, wood ...)
$scope.components = componentsPromise;
@ -23,6 +23,9 @@ Application.Controllers.controller('ProjectElementsController', ['$scope', '$sta
// Themes list (cooking, sport ...)
$scope.themes = themesPromise;
// Application settings
$scope.allSettings = settingsPromise;
/**
* Saves a new component / Update an existing material to the server (form validation callback)
* @param data {Object} component name

View File

@ -501,14 +501,14 @@ Application.Controllers.controller('EditProjectController', ['$rootScope', '$sco
/**
* Controller used in the public project's details page
*/
Application.Controllers.controller('ShowProjectController', ['$scope', '$state', 'projectPromise', '$location', '$uibModal', 'dialogs', '_t',
function ($scope, $state, projectPromise, $location, $uibModal, dialogs, _t) {
Application.Controllers.controller('ShowProjectController', ['$scope', '$state', 'projectPromise', 'shortnamePromise', '$location', '$uibModal', 'dialogs', '_t',
function ($scope, $state, projectPromise, shortnamePromise, $location, $uibModal, dialogs, _t) {
/* PUBLIC SCOPE */
// Store the project's details
$scope.project = projectPromise;
$scope.projectUrl = $location.absUrl();
$scope.disqusShortname = Fablab.disqusShortname;
$scope.disqusShortname = shortnamePromise.setting.value;
/**
* Test if the provided user has the edition rights on the current project

View File

@ -279,7 +279,8 @@ angular.module('application.router', ['ui.router'])
}
},
resolve: {
projectPromise: ['$stateParams', 'Project', function ($stateParams, Project) { return Project.get({ id: $stateParams.id }).$promise; }]
projectPromise: ['$stateParams', 'Project', function ($stateParams, Project) { return Project.get({ id: $stateParams.id }).$promise; }],
shortnamePromise: ['Setting', function (Setting) { return Setting.get({ name: 'disqus_shortname' }).$promise; }]
}
})
.state('app.logged.projects_edit', {
@ -619,14 +620,14 @@ angular.module('application.router', ['ui.router'])
views: {
'main@': {
templateUrl: '<%= asset_path "admin/projects/index.html.erb" %>',
controller: 'ProjectElementsController'
controller: 'AdminProjectsController'
}
},
resolve: {
componentsPromise: ['Component', function (Component) { return Component.query().$promise; }],
licencesPromise: ['Licence', function (Licence) { return Licence.query().$promise; }],
themesPromise: ['Theme', function (Theme) { return Theme.query().$promise; }],
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display']" }).$promise; }]
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display', 'disqus_shortname']" }).$promise; }]
}
})
.state('app.admin.manage_abuses', {

View File

@ -39,6 +39,9 @@
<uib-tab heading="{{ 'app.admin.projects.licences' | translate }}">
<ng-include src="'<%= asset_path "admin/projects/licences.html" %>'"></ng-include>
</uib-tab>
<uib-tab heading="{{ 'app.admin.projects.settings.title' | translate }}">
<ng-include src="'<%= asset_path "admin/projects/settings.html" %>'"></ng-include>
</uib-tab>
</uib-tabset>
</div>

View File

@ -0,0 +1,19 @@
<div class="panel panel-default m-t-lg">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'app.admin.projects.settings.comments' }}</span>
</div>
<div class="panel-body">
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.projects.settings.disqus' }}</h3>
<p class="alert alert-warning m-h-md" translate>{{ 'app.admin.projects.settings.disqus_info' }}</p>
<div class="col-md-4">
<text-setting name="disqus_shortname"
settings="allSettings"
label="app.admin.projects.settings.shortname"
fa-icon="fa-comments"
placeholder="my-forum">
</text-setting>
</div>
</div>
</div>
</div>

View File

@ -91,7 +91,8 @@ class Setting < ApplicationRecord
feature_tour_display
email_from
base_url_protocol
base_url_host] }
base_url_host
disqus_shortname] }
def value
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
last_value&.value

View File

@ -27,7 +27,6 @@
Fablab.spacesModule = ('<%= Setting.get('spaces_module') %>' === 'true');
Fablab.withoutOnlinePayment = ('<%= Rails.application.secrets.fablab_without_online_payments %>' === 'true');
Fablab.fablabWithoutWallet = ('<%= Rails.application.secrets.fablab_without_wallet %>' === 'true');
Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>";
Fablab.baseHostUrl = "<%= Setting.get('base_url_host') %>";
Fablab.trackingId = "<%= Setting.get('tracking_id') %>";
Fablab.superadminId = parseInt("<%= User.superadmin&.id %>", 10);

View File

@ -138,6 +138,12 @@ en:
description: "Description"
add_a_new_licence: "Add a new licence"
manage_abuses: "Manage the reports"
settings:
title: "Settings"
comments: "Comments"
disqus: "Disqus"
disqus_info: "If you want to enable your members and visitors to comment on projects, you can enable the Disqus forums by setting the following parameter. Visit <a href='https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-' target='_blank'>the Disqus website</a> for more information."
shortname: "Shortname"
#track and monitor the trainings
trainings:
trainings_monitoring: "Trainings monitoring"
@ -1054,6 +1060,7 @@ en:
base_url_protocol: "site protocol"
base_url_host: "site host"
base_url: "site url"
disqus_shortname: "Disqus shortname"
general:
general: "General"
title: "Title"

View File

@ -138,6 +138,12 @@ fr:
description: "Description"
add_a_new_licence: "Ajouter une nouvelle licence"
manage_abuses: "Gérer les signalements"
settings:
title: "Paramètres"
comments: "Commentaires"
disqus: "Disqus"
disqus_info: "Si vous voulez permettre à vos membres et visiteurs de commenter les projets, vous pouvez activer les forums Disqus en définissant le paramètre suivant. Rendez-vous sur <a href='https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-' target='_blank'>le site web de Disqus</a> pour plus d'informations."
shortname: "Nom court"
#track and monitor the trainings
trainings:
trainings_monitoring: "Suivi formations"
@ -1054,6 +1060,7 @@ fr:
base_url_protocol: "protocole du site"
base_url_host: "l'hôte du site"
base_url: "l'url du site"
disqus_shortname: "nom court Disqus"
general:
general: "Général"
title: "Titre"

View File

@ -15,7 +15,6 @@ development:
stripe_api_key: <%= ENV["STRIPE_API_KEY"] %>
stripe_publishable_key: <%= ENV["STRIPE_PUBLISHABLE_KEY"] %>
stripe_currency: <%= ENV["STRIPE_CURRENCY"] %>
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
@ -50,7 +49,6 @@ test:
stripe_api_key: <%= ENV["STRIPE_API_KEY"] %>
stripe_publishable_key: <%= ENV["STRIPE_PUBLISHABLE_KEY"] %>
stripe_currency: usd
disqus_shortname: fablab-sleede
fablab_without_online_payments: false
fablab_without_wallet: false
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
@ -85,7 +83,6 @@ staging:
stripe_api_key: <%= ENV["STRIPE_API_KEY"] %>
stripe_publishable_key: <%= ENV["STRIPE_PUBLISHABLE_KEY"] %>
stripe_currency: <%= ENV["STRIPE_CURRENCY"] %>
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
@ -131,7 +128,6 @@ production:
stripe_api_key: <%= ENV["STRIPE_API_KEY"] %>
stripe_publishable_key: <%= ENV["STRIPE_PUBLISHABLE_KEY"] %>
stripe_currency: <%= ENV["STRIPE_CURRENCY"] %>
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>

View File

@ -111,13 +111,6 @@ See http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-config
When DELIVERY_METHOD is set to **smtp**, configure the SMTP server parameters.
See https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration for more details.
<a name="DISQUS_SHORTNAME"></a>
DISQUS_SHORTNAME
Unique identifier of your [Disqus](http://www.disqus.com) forum.
Disqus forums are used to allow visitors to comment on projects.
See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname- for more information.
<a name="LOG_LEVEL"></a>
LOG_LEVEL

View File

@ -33,9 +33,6 @@ SMTP_ENABLE_STARTTLS_AUTO=true
SMTP_OPENSSL_VERIFY_MODE=
SMTP_TLS=false
# Projects comments
DISQUS_SHORTNAME=
# I18N configuration
RAILS_LOCALE=fr
APP_LOCALE=fr

View File

@ -121,7 +121,8 @@ namespace :fablab do
%w[_ FEATURE_TOUR_DISPLAY feature_tour_display once],
%w[_ DEFAULT_MAIL_FROM email_from],
%w[_ DEFAULT_HOST base_url_host demo.fab-manager.com],
%w[_ DEFAULT_PROTOCOL base_url_protocol https]
%w[_ DEFAULT_PROTOCOL base_url_protocol https],
%w[_ DISQUS_SHORTNAME disqus_shortname]
]
mapping.each do |m|

View File

@ -26,8 +26,6 @@ SMTP_ENABLE_STARTTLS_AUTO=true
SMTP_OPENSSL_VERIFY_MODE=
SMTP_TLS=false
DISQUS_SHORTNAME=
RAILS_LOCALE=fr
APP_LOCALE=fr
MOMENT_LOCALE=fr

View File

@ -236,7 +236,7 @@ configure_env_file()
doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md)
variables=(STRIPE_API_KEY STRIPE_PUBLISHABLE_KEY STRIPE_CURRENCY INVOICE_PREFIX FABLAB_WITHOUT_ONLINE_PAYMENT FABLAB_WITHOUT_WALLET \
USER_CONFIRMATION_NEEDED_TO_SIGN_IN DELIVERY_METHOD SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS DISQUS_SHORTNAME \
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS \
LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT \
SUPERADMIN_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE FULLCALENDAR_LOCALE ELASTICSEARCH_LANGUAGE_ANALYZER TIME_ZONE \
WEEK_STARTING_DAY D3_DATE_FORMAT UIB_DATE_FORMAT EXCEL_DATE_FORMAT OPENLAB_APP_ID OPENLAB_APP_SECRET OPENLAB_DEFAULT)