1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-21 15:54:22 +01:00

configure twitter analytics from the UI

This commit is contained in:
Sylvain 2020-05-27 15:39:39 +02:00
parent 628a0f3bc3
commit c3846e7080
13 changed files with 32 additions and 20 deletions

View File

@ -1030,7 +1030,7 @@ angular.module('application.router', ['ui.router'])
'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \ 'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \
'space_explications_alert', 'booking_window_start', 'booking_window_end', 'events_in_calendar', \ 'space_explications_alert', 'booking_window_start', 'booking_window_end', 'events_in_calendar', \
'booking_move_enable', 'booking_move_delay', 'booking_cancel_enable', \ 'booking_move_enable', 'booking_move_delay', 'booking_cancel_enable', \
'booking_cancel_delay', 'main_color', 'secondary_color', 'spaces_module', \ 'booking_cancel_delay', 'main_color', 'secondary_color', 'spaces_module', 'twitter_analytics', \
'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', \ 'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', \
'reminder_delay', 'visibility_yearly', 'visibility_others', \ 'reminder_delay', 'visibility_yearly', 'visibility_others', \
'display_name_enable', 'machines_sort_by', 'fab_analytics', \ 'display_name_enable', 'machines_sort_by', 'fab_analytics', \

View File

@ -105,5 +105,17 @@
</div> </div>
</div> </div>
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.privacy.twitter' }}</h3>
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.privacy.twitter_info_html' | translate"></p>
<div class="col-md-4 col-md-offset-1">
<text-setting name="twitter_analytics"
settings="allSettings"
label="app.admin.settings.privacy.twitter_analytics"
placeholder="@username">
</text-setting>
</div>
</div>
</div> </div>
</div> </div>

View File

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

View File

@ -23,7 +23,7 @@
<!-- Twitter Cards--> <!-- Twitter Cards-->
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="<%= ENV['TWITTER_NAME'] %>"> <meta name="twitter:site" content="<%= Setting.get('twitter_analytics') %>">
<meta name="twitter:title" content="<%= @event.title %>"> <meta name="twitter:title" content="<%= @event.title %>">
<meta name="twitter:description" content="<%= strip_tags(@event.description) %>"> <meta name="twitter:description" content="<%= strip_tags(@event.description) %>">
<% if @event.event_image %> <% if @event.event_image %>

View File

@ -18,12 +18,12 @@
<meta property="og:image:width" content="<%= width%>" /> <meta property="og:image:width" content="<%= width%>" />
<meta property="og:image:height" content="<%=height%>" /> <meta property="og:image:height" content="<%=height%>" />
<% end %> <% end %>
<meta property="fb:app_id" content="<%= Setting.get('facebook_app_id')%>" /> <meta property="fb:app_id" content="<%= Setting.get('facebook_app_id') %>" />
<meta property="og:url" content="<%= root_url+'#!/projects/'+@project.slug %>" /> <meta property="og:url" content="<%= root_url+'#!/projects/'+@project.slug %>" />
<!-- Twitter Cards--> <!-- Twitter Cards-->
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="<%= ENV['TWITTER_NAME'] %>"> <meta name="twitter:site" content="<%= Setting.get('twitter_analytics') %>">
<meta name="twitter:title" content="<%= @project.name %>"> <meta name="twitter:title" content="<%= @project.name %>">
<meta name="twitter:description" content="<%= strip_tags(@project.description) %>"> <meta name="twitter:description" content="<%= strip_tags(@project.description) %>">
<% if @project.project_image %> <% if @project.project_image %>

View File

@ -23,7 +23,7 @@
<!-- Twitter Cards--> <!-- Twitter Cards-->
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="<%= ENV['TWITTER_NAME'] %>"> <meta name="twitter:site" content="<%= Setting.get('twitter_analytics') %>">
<meta name="twitter:title" content="<%= @training.name %>"> <meta name="twitter:title" content="<%= @training.name %>">
<meta name="twitter:description" content="<%= strip_tags(@training.description) %>"> <meta name="twitter:description" content="<%= strip_tags(@training.description) %>">
<% if @training.training_image %> <% if @training.training_image %>

View File

@ -1024,6 +1024,8 @@ en:
fab_analytics: "Fab Analytics" fab_analytics: "Fab Analytics"
phone_required: "phone required" phone_required: "phone required"
tracking_id: "tracking ID" tracking_id: "tracking ID"
facebook_app_id: "Facebook App ID"
twitter_analytics: "Twitter analytics account"
book_overlapping_slots: "book overlapping slots" book_overlapping_slots: "book overlapping slots"
slot_duration: "slots duration" slot_duration: "slots duration"
elements_ordering: "Elements ordering" elements_ordering: "Elements ordering"
@ -1074,7 +1076,9 @@ en:
facebook: "Facebook" 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." 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" app_id: "App ID"
facebook_app_id: "Facebook App ID" twitter: "Twitter"
twitter_info_html: "To enable the statistical tracking of the shares on the Twitter social network, <a href='https://analytics.twitter.com/' target='_blank'>Twitter analytics</a>, set the name of your Twitter account here."
twitter_analytics: "Twitter account"
analytics: analytics:
title: "Application improvement" 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>" intro_analytics_html: "You'll find below a detailed view of all the data, Fab-manager will collect <strong>if permission is granted.</strong>"

View File

@ -1025,6 +1025,7 @@ fr:
phone_required: "téléphone requis" phone_required: "téléphone requis"
tracking_id: "l'ID de suivi" tracking_id: "l'ID de suivi"
facebook_app_id: "l'App ID Facebook" facebook_app_id: "l'App ID Facebook"
twitter_analytics: "compte Twitter analytics"
book_overlapping_slots: "réservation de créneaux simultanés" book_overlapping_slots: "réservation de créneaux simultanés"
slot_duration: "durée des créneaux" slot_duration: "durée des créneaux"
elements_ordering: "Ordre d'affichage des éléments" elements_ordering: "Ordre d'affichage des éléments"
@ -1075,6 +1076,9 @@ fr:
facebook: "Facebook" 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." 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" app_id: "App ID"
twitter: "Twitter"
twitter_info_html: "Pour activer le suivi statistique des partages sur le réseau social Twitter, <a href='https://analytics.twitter.com/' target='_blank'>Twitter analytics</a>, définissez ici le nom de votre compte Twitter."
twitter_analytics: "Compte Twitter"
analytics: analytics:
title: "Amélioration de l'application" 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>" 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

@ -130,12 +130,6 @@ This is optional, the captcha will be displayed on the sign-up form, only if the
Unique identifier of your [Disqus](http://www.disqus.com) forum. Unique identifier of your [Disqus](http://www.disqus.com) forum.
Disqus forums are used to allow visitors to comment on projects. 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. See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname- for more information.
<a name="TWITTER_NAME"></a>
TWITTER_NAME
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="LOG_LEVEL"></a> <a name="LOG_LEVEL"></a>
LOG_LEVEL LOG_LEVEL

View File

@ -48,9 +48,6 @@ RECAPTCHA_SECRET_KEY=
# Projects comments # Projects comments
DISQUS_SHORTNAME= DISQUS_SHORTNAME=
# Twitter sharing
TWITTER_NAME=Fab_Manager
# I18N configuration # I18N configuration
RAILS_LOCALE=fr RAILS_LOCALE=fr
APP_LOCALE=fr APP_LOCALE=fr

View File

@ -114,7 +114,8 @@ namespace :fablab do
%w[! FABLAB_WITHOUT_SPACES spaces_module true], %w[! FABLAB_WITHOUT_SPACES spaces_module true],
%w[! FABLAB_WITHOUT_PLANS plans_module false], %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] %w[_ FACEBOOK_APP_ID facebook_app_id],
%w[_ TWITTER_NAME twitter_analytics]
] ]
mapping.each do |m| mapping.each do |m|
@ -122,6 +123,7 @@ namespace :fablab do
value = ENV.fetch(m[1], m[3]) value = ENV.fetch(m[1], m[3])
next unless value next unless value
# if the array starts with a "!", invert the boolean value
value = (!str_to_bool(value)).to_s if m[0] == '!' value = (!str_to_bool(value)).to_s if m[0] == '!'
setting.value = value setting.value = value
setting.save setting.save

View File

@ -35,8 +35,6 @@ RECAPTCHA_SECRET_KEY=
DISQUS_SHORTNAME= DISQUS_SHORTNAME=
TWITTER_NAME=Fab_Manager
RAILS_LOCALE=fr RAILS_LOCALE=fr
APP_LOCALE=fr APP_LOCALE=fr
MOMENT_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) 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 \ 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 \ 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 \ SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME \
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 \ 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) WEEK_STARTING_DAY D3_DATE_FORMAT UIB_DATE_FORMAT EXCEL_DATE_FORMAT OPENLAB_APP_ID OPENLAB_APP_SECRET OPENLAB_DEFAULT)