diff --git a/app/assets/javascripts/controllers/admin/project_elements.js b/app/assets/javascripts/controllers/admin/project_elements.js
index 06dfd9e61..b977ac821 100644
--- a/app/assets/javascripts/controllers/admin/project_elements.js
+++ b/app/assets/javascripts/controllers/admin/project_elements.js
@@ -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
diff --git a/app/assets/javascripts/controllers/projects.js.erb b/app/assets/javascripts/controllers/projects.js.erb
index a8c2f5481..99cbfd47a 100644
--- a/app/assets/javascripts/controllers/projects.js.erb
+++ b/app/assets/javascripts/controllers/projects.js.erb
@@ -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
diff --git a/app/assets/javascripts/router.js.erb b/app/assets/javascripts/router.js.erb
index 1a94f7cdf..a2f0ffd35 100644
--- a/app/assets/javascripts/router.js.erb
+++ b/app/assets/javascripts/router.js.erb
@@ -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', {
diff --git a/app/assets/templates/admin/projects/index.html.erb b/app/assets/templates/admin/projects/index.html.erb
index 3b01a0f02..94346b3cb 100644
--- a/app/assets/templates/admin/projects/index.html.erb
+++ b/app/assets/templates/admin/projects/index.html.erb
@@ -39,6 +39,9 @@
'">
+
+ '">
+
diff --git a/app/assets/templates/admin/projects/settings.html.erb b/app/assets/templates/admin/projects/settings.html.erb
new file mode 100644
index 000000000..d0ee650a3
--- /dev/null
+++ b/app/assets/templates/admin/projects/settings.html.erb
@@ -0,0 +1,19 @@
+
+
+ {{ 'app.admin.projects.settings.comments' }}
+
+
+
+
{{ 'app.admin.projects.settings.disqus' }}
+
{{ 'app.admin.projects.settings.disqus_info' }}
+
+
+
+
+
+
+
diff --git a/app/models/setting.rb b/app/models/setting.rb
index 9f01c7e04..5ed8b3496 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -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
diff --git a/app/views/application/index.html.erb b/app/views/application/index.html.erb
index 864c762ce..668c507bc 100644
--- a/app/views/application/index.html.erb
+++ b/app/views/application/index.html.erb
@@ -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);
diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml
index e20d9d564..0d6ec98c4 100644
--- a/config/locales/app.admin.en.yml
+++ b/config/locales/app.admin.en.yml
@@ -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 the Disqus website 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"
diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml
index 17b4d4a9d..25d26309a 100644
--- a/config/locales/app.admin.fr.yml
+++ b/config/locales/app.admin.fr.yml
@@ -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 le site web de Disqus 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"
diff --git a/config/secrets.yml b/config/secrets.yml
index 80b31f324..219af62a1 100644
--- a/config/secrets.yml
+++ b/config/secrets.yml
@@ -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"] %>
diff --git a/doc/environment.md b/doc/environment.md
index 43626e1dd..6878f8180 100644
--- a/doc/environment.md
+++ b/doc/environment.md
@@ -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.
-
-
- 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.
LOG_LEVEL
diff --git a/env.example b/env.example
index 18fafe856..94cac4f10 100644
--- a/env.example
+++ b/env.example
@@ -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
diff --git a/lib/tasks/fablab/setup.rake b/lib/tasks/fablab/setup.rake
index ce21668bb..74d64b1dd 100644
--- a/lib/tasks/fablab/setup.rake
+++ b/lib/tasks/fablab/setup.rake
@@ -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|
diff --git a/setup/env.example b/setup/env.example
index a0288c81d..d46a69b6b 100644
--- a/setup/env.example
+++ b/setup/env.example
@@ -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
diff --git a/setup/setup.sh b/setup/setup.sh
index c33f35b4d..4f53814bf 100755
--- a/setup/setup.sh
+++ b/setup/setup.sh
@@ -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)