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

configure facebook_app_id from the UI

This commit is contained in:
Sylvain 2020-05-27 12:29:45 +02:00
parent fc13263a89
commit 628a0f3bc3
15 changed files with 51 additions and 30 deletions

View File

@ -1024,7 +1024,7 @@ angular.module('application.router', ['ui.router'])
resolve: {
settingsPromise: ['Setting', function (Setting) {
return Setting.query({
names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', \
names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', \
'privacy_body', 'privacy_dpo', 'about_contacts', 'book_overlapping_slots', 'invoicing_module', \
'home_blogpost', 'machine_explications_alert', 'training_explications_alert', 'slot_duration', \
'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \

View File

@ -72,8 +72,18 @@
</boolean-setting>
</div>
</div>
<p class="alert alert-warning m-t" ng-bind-html="'app.admin.settings.privacy.tracking_id_info_html' | translate"></p>
</div>
</div>
<div class="panel panel-default m-t-md">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'app.admin.settings.privacy.statistics' }}</span>
</div>
<div class="panel-body">
<p class="alert alert-info"><i class="fa fa-info-circle m-r"></i><span translate>{{ 'app.admin.settings.remember_to_refresh_the_page_for_the_changes_to_take_effect' }}</span> </p>
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.privacy.google_analytics' }}</h3>
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.privacy.tracking_id_info_html' | translate"></p>
<div class="col-md-4 col-md-offset-1">
<text-setting name="tracking_id"
settings="allSettings"
@ -83,5 +93,17 @@
</div>
</div>
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.privacy.facebook' }}</h3>
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.privacy.facebook_info_html' | translate"></p>
<div class="col-md-4 col-md-offset-1">
<text-setting name="facebook_app_id"
settings="allSettings"
label="app.admin.settings.privacy.app_id"
placeholder="000000000000000">
</text-setting>
</div>
</div>
</div>
</div>

View File

@ -83,7 +83,8 @@ class Setting < ApplicationRecord
events_in_calendar
spaces_module
plans_module
invoicing_module] }
invoicing_module
facebook_app_id] }
def value
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
last_value&.value

View File

@ -39,7 +39,7 @@ class HealthService
admins: User.admins.count,
availabilities: last_week_availabilities,
reservations: last_week_new_reservations,
plans: Settings.get('plans_module'),
plans: Setting.get('plans_module'),
spaces: Setting.get('spaces_module'),
online_payment: !Rails.application.secrets.fablab_without_online_payments,
invoices: Setting.get('invoicing_module'),

View File

@ -18,7 +18,7 @@
<meta property="og:image:width" content="<%= width%>" />
<meta property="og:image:height" content="<%=height%>" />
<% end %>
<meta property="fb:app_id" content="<%= Rails.application.secrets.facebook_app_id%>" />
<meta property="fb:app_id" content="<%= Setting.get('facebook_app_id') %>" />
<meta property="og:url" content="<%= root_url+'#!/events/'+@event.id.to_s %>" />
<!-- Twitter Cards-->
@ -31,4 +31,4 @@
<% end %>
</head>
</html>
</html>

View File

@ -18,7 +18,7 @@
<meta property="og:image:width" content="<%= width%>" />
<meta property="og:image:height" content="<%=height%>" />
<% end %>
<meta property="fb:app_id" content="<%= Rails.application.secrets.facebook_app_id%>" />
<meta property="fb:app_id" content="<%= Setting.get('facebook_app_id')%>" />
<meta property="og:url" content="<%= root_url+'#!/projects/'+@project.slug %>" />
<!-- Twitter Cards-->
@ -31,4 +31,4 @@
<% end %>
</head>
</html>
</html>

View File

@ -18,7 +18,7 @@
<meta property="og:image:width" content="<%= width%>" />
<meta property="og:image:height" content="<%=height%>" />
<% end %>
<meta property="fb:app_id" content="<%= Rails.application.secrets.facebook_app_id%>" />
<meta property="fb:app_id" content="<%= Setting.get('facebook_app_id') %>" />
<meta property="og:url" content="<%= root_url+'#!/trainings/'+@training.slug %>" />
<!-- Twitter Cards-->
@ -31,4 +31,4 @@
<% end %>
</head>
</html>
</html>

View File

@ -1030,7 +1030,7 @@ en:
machines_order: "Machines order"
display_machines_sorted_by: "Display machines sorted by"
advanced: "Advanced settings"
customize_home_page_css: "Customise the stylesheet og the home page"
customize_home_page_css: "Customise the stylesheet of the home page"
home_css_notice_html: "You can customize the stylesheet which will apply to the home page, using the <a href=\"https://sass-lang.com/documentation\" target=\"_blank\">SASS</a> syntax. These styles will be automatically subordinated to the <code>.home-page</code> selector to prevent any risk of breaking the application. Meanwhile please be careful, any changes in the home page editor at the top of the page may broke your styles, always refer to the HTML code."
an_error_occurred_saving_the_setting: "An error occurred while saving the setting. Please try again later."
book_overlapping_slots_info: "Allow / prevent the reservation of overlapping slots"
@ -1069,6 +1069,12 @@ en:
users_notified: "Platform users will be notified of the update."
about_analytics: "I agree to share anonymous data with the development team to help improve Fab-manager."
read_more: "Which data do we collect?"
statistics: "Statistics"
google_analytics: "Google Analytics"
facebook: "Facebook"
facebook_info_html: "To enable the statistical tracking of the shares on the Facebook social network, set your App ID here. Refer to <a href='https://developers.facebook.com/docs/apps#register' target='_blank'>this guide</a> to get one."
app_id: "App ID"
facebook_app_id: "Facebook App ID"
analytics:
title: "Application improvement"
intro_analytics_html: "You'll find below a detailed view of all the data, Fab-manager will collect <strong>if permission is granted.</strong>"
@ -1085,7 +1091,7 @@ en:
various_settings: "Various settings"
phone_required: "Phone required"
phone_required_info: "You can define if the phone number should be required to register a new user on Fab-manager."
tracking_id_info_html: "To enable the statistical tracking of the visits using Google Analytics, set your tracking ID here. It is in the form UA-000000-2. Visit <a href='https://analytics.google.com/analytics/web/' target='_blank'>the Google Analytics website</a> to get one.<strong>Warning :</strong> if you enable this feature, remember to write it in your privacy policy, above."
tracking_id_info_html: "To enable the statistical tracking of the visits using Google Analytics, set your tracking ID here. It is in the form UA-000000-2. Visit <a href='https://analytics.google.com/analytics/web/' target='_blank'>the Google Analytics website</a> to get one.<strong>Warning:</strong> if you enable this feature, remember to write it in your privacy policy, above."
tracking_id: "Tracking ID"
open_api_clients:
add_new_client: "Create new API client"

View File

@ -1023,7 +1023,8 @@ fr:
machines_sort_by: "l'ordre d'affichage des machines"
fab_analytics: "Fab Analytics"
phone_required: "téléphone requis"
tracking_id: "ID de suivi"
tracking_id: "l'ID de suivi"
facebook_app_id: "l'App ID Facebook"
book_overlapping_slots: "réservation de créneaux simultanés"
slot_duration: "durée des créneaux"
elements_ordering: "Ordre d'affichage des éléments"
@ -1069,6 +1070,11 @@ fr:
users_notified: "Les utilisateurs de la plateforme seront notifiés de la mise à jour."
about_analytics: "J'accepte de partager des données anonymes avec l'équipe de développement pour aider à améliorer Fab-manager."
read_more: "Quelles informations collectons-nous ?"
statistics: "Statistiques"
google_analytics: "Google Analytics"
facebook: "Facebook"
facebook_info_html: "Pour activer le suivi statistique des partages sur le réseau social Facebook, définissez votre App ID ici. Suivez <a href='https://developers.facebook.com/docs/apps#register' target='_blank'>ce guide</a> pour en obtenir un."
app_id: "App ID"
analytics:
title: "Amélioration de l'application"
intro_analytics_html: "Vous trouverez ci-dessous une vue détaillée de toutes les données de Fab-manager collectera <strong>si l'autorisation lui est accordée.</strong>"

View File

@ -40,7 +40,6 @@ development:
openlab_base_uri: <%= ENV["OPENLAB_BASE_URI"] %>
navinum_api_login: <%= ENV["NAVINUM_API_LOGIN"] %>
navinum_api_password: <%= ENV["NAVINUM_API_PASSWORD"] %>
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
max_cao_size: <%= ENV["MAX_CAO_SIZE"] %>
@ -81,7 +80,6 @@ test:
openlab_base_uri:
navinum_api_login:
navinum_api_password:
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
max_cao_size: <%= ENV["MAX_CAO_SIZE"] %>
@ -130,7 +128,6 @@ staging:
openlab_base_uri: <%= ENV["OPENLAB_BASE_URI"] %>
navinum_api_login: <%= ENV["NAVINUM_API_LOGIN"] %>
navinum_api_password: <%= ENV["NAVINUM_API_PASSWORD"] %>
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
max_cao_size: <%= ENV["MAX_CAO_SIZE"] %>
@ -182,7 +179,6 @@ production:
openlab_base_uri: <%= ENV["OPENLAB_BASE_URI"] %>
navinum_api_login: <%= ENV["NAVINUM_API_LOGIN"] %>
navinum_api_password: <%= ENV["NAVINUM_API_PASSWORD"] %>
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
max_cao_size: <%= ENV["MAX_CAO_SIZE"] %>

View File

@ -136,12 +136,6 @@ See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
Identifier of the Twitter account for Twitter share project, event or training
It will also be used for [Twitter Card analytics](https://dev.twitter.com/cards/analytics).
<a name="FACEBOOK_APP_ID"></a>
FACEBOOK_APP_ID
This is optional. You can follow [this guide to get your personal App ID](https://developers.facebook.com/docs/apps/register).
If you do so, you'll be able to customize and get statistics about project shares on Facebook.
<a name="LOG_LEVEL"></a>
LOG_LEVEL

View File

@ -51,9 +51,6 @@ DISQUS_SHORTNAME=
# Twitter sharing
TWITTER_NAME=Fab_Manager
# Facebook sharing
FACEBOOK_APP_ID=
# I18N configuration
RAILS_LOCALE=fr
APP_LOCALE=fr

View File

@ -113,7 +113,8 @@ namespace :fablab do
%w[_ EVENTS_IN_CALENDAR events_in_calendar false],
%w[! FABLAB_WITHOUT_SPACES spaces_module true],
%w[! FABLAB_WITHOUT_PLANS plans_module false],
%w[! FABLAB_WITHOUT_INVOICES invoicing_module false]
%w[! FABLAB_WITHOUT_INVOICES invoicing_module false],
%w[_ FACEBOOK_APP_ID facebook_app_id]
]
mapping.each do |m|

View File

@ -37,8 +37,6 @@ DISQUS_SHORTNAME=
TWITTER_NAME=Fab_Manager
FACEBOOK_APP_ID=
RAILS_LOCALE=fr
APP_LOCALE=fr
MOMENT_LOCALE=fr

View File

@ -237,7 +237,7 @@ configure_env_file()
variables=(STRIPE_API_KEY STRIPE_PUBLISHABLE_KEY STRIPE_CURRENCY INVOICE_PREFIX FABLAB_WITHOUT_ONLINE_PAYMENT FABLAB_WITHOUT_WALLET \
USER_CONFIRMATION_NEEDED_TO_SIGN_IN DEFAULT_MAIL_FROM DELIVERY_METHOD DEFAULT_HOST DEFAULT_PROTOCOL SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME \
FACEBOOK_APP_ID LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT FEATURE_TOUR_DISPLAY \
LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT FEATURE_TOUR_DISPLAY \
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)
for variable in "${variables[@]}"; do