From 1bed2c2a3c82f1f47d09d88e8d81ff2399c072c9 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 31 Aug 2018 12:11:51 +0200 Subject: [PATCH] Partially fixed according to pull request review, added comments to code review --- .../users/settings/account/preferences/index.js | 2 +- app/controllers/client_api/users/users_controller.rb | 2 +- .../users/settings/account/preferences_controller.rb | 4 ++-- app/models/user.rb | 8 ++++---- app/views/layouts/application.html.erb | 2 +- .../settings/account/preferences/index.html.erb | 12 ++++++------ config/locales/en.yml | 10 +++++----- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/users/settings/account/preferences/index.js b/app/assets/javascripts/users/settings/account/preferences/index.js index 22ccda89a..bb29998d3 100644 --- a/app/assets/javascripts/users/settings/account/preferences/index.js +++ b/app/assets/javascripts/users/settings/account/preferences/index.js @@ -72,7 +72,7 @@ function notificationsSettings() { var notification_settings = [ "recent_notification", "assignments_notification", - "popover_v2_toggle" ] + "popovers_enabled" ] for (var i = 0; i < notification_settings.length; i++ ) { var setting = $('[name="' + notification_settings[i] + '"]'); diff --git a/app/controllers/client_api/users/users_controller.rb b/app/controllers/client_api/users/users_controller.rb index 55e7b05c6..0682d73a5 100644 --- a/app/controllers/client_api/users/users_controller.rb +++ b/app/controllers/client_api/users/users_controller.rb @@ -79,7 +79,7 @@ module ClientApi :assignments_email_notification, :recent_notification, :recent_email_notification, :system_message_email_notification, - :popover_v2_toggle) + :popovers_enabled) end def success_response(args = {}) diff --git a/app/controllers/users/settings/account/preferences_controller.rb b/app/controllers/users/settings/account/preferences_controller.rb index dd62c0522..0224594a1 100644 --- a/app/controllers/users/settings/account/preferences_controller.rb +++ b/app/controllers/users/settings/account/preferences_controller.rb @@ -41,8 +41,8 @@ module Users params[:assignments_notification_email] ? true : false @user.system_message_email_notification = params[:system_message_notification_email] ? true : false - @user.popover_v2_toggle = - params[:popover_v2_toggle] ? true : false + @user.popovers_enabled = + params[:popovers_enabled] ? true : false if @user.save respond_to do |format| format.json do diff --git a/app/models/user.rb b/app/models/user.rb index 70dece039..369e3dba9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -43,9 +43,9 @@ class User < ApplicationRecord assignments_email: false, recent: true, recent_email: false, - system_message_email: false, - popover_v2_toggle: true - } + system_message_email: false + }, + popovers_enabled: true ) # Relations @@ -458,7 +458,7 @@ class User < ApplicationRecord assignments_email_notification recent_email_notification system_message_email_notification - popover_v2_toggle ) + popovers_enabled ) # declare notifications getters NOTIFICATIONS_TYPES.each do |name| define_method(name) do diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1768312c3..4171475a5 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -29,7 +29,7 @@ data-atwho-rep-items-url="<%= atwho_rep_items_team_path(current_team) %>" data-atwho-menu-items="<%= atwho_menu_items_team_path(current_team) %>" data-file-max-size-mb="<%= Rails.configuration.x.file_max_size_mb %>" - data-popover_v2_enabled="<%= current_user.popover_v2_toggle %>" + data-popover_v2_enabled="<%= current_user.popovers_enabled %>" <% end %> > diff --git a/app/views/users/settings/account/preferences/index.html.erb b/app/views/users/settings/account/preferences/index.html.erb index 2af9dd426..5a453edf2 100644 --- a/app/views/users/settings/account/preferences/index.html.erb +++ b/app/views/users/settings/account/preferences/index.html.erb @@ -133,8 +133,7 @@ -
-

<%= t('notifications.tips.title') %>

+

<%= t('users.settings.account.preferences.edit.tips.title') %>

-

<%=t 'notifications.tips.text1' %>

-

<%=t 'notifications.tips.text2' %>

+

<%=t 'users.settings.account.preferences.edit.tips.text1' %>

+

<%=t 'users.settings.account.preferences.edit.tips.text2' %>

- <%=t 'notifications.tips.toggle' %> + <%=t 'users.settings.account.preferences.edit.tips.toggle' %>
- <%= check_box_tag :popover_v2_toggle, @user.popover_v2_toggle %> + <%= check_box_tag :popovers_enabled, @user.popovers_enabled %>
<% end %> +
diff --git a/config/locales/en.yml b/config/locales/en.yml index 212fca09e..6a0525513 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1413,6 +1413,11 @@ en: time_zone_label: "Time zone" time_zone_sublabel: "Time zone setting affects all time & date fields throughout application." time_zone_title: "Time zone" + tips: + title: "Help Tips" + text1: "When you place your mouse over specific element of SciNote, we show you a tip with description of this element." + text2: "You may want to turn that off if you feel confident in here." + toggle: "Show Help Tips" update_flash: "Preferences successfully updated." addons: head_title: "Settings | Add-ons" @@ -1801,11 +1806,6 @@ en: notifications: title: "Notifications" - tips: - title: "Help Tips" - text1: "When you place your mouse over specific element of SciNote, we show you a tip with description of this element." - text2: "You may want to turn that off if you feel confident in here." - toggle: "Show Help Tips NO/YES" email_settings: "E-mail notifications" form: assignments: "Assignment"