diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 3cd589a..6e60174 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -361,11 +361,6 @@ label[required]::after{ } } -form .checkbox input[type="checkbox"] { - margin-left: 5px; - position: relative; -} - .back-overlay { background-color: $black; background-size: cover; diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 75105b4..b213180 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -70,7 +70,7 @@ class UsersController < ApplicationController def user_params fields_to_permit = %w"gender username email date_of_birth phone - alt_phone active description notifications" + alt_phone active description notifications push_notifications" fields_to_permit += %w"admin registration_number registration_date" if admin? fields_to_permit += %w"organization_id superadmin" if superadmin? diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 12f13ba..638b79f 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -2,6 +2,7 @@ <%= simple_form_for @user do |f| %>
<%= f.input :username %> + <% if admin? %> <%= f.input :email %> <% if @user.unconfirmed_email.present? %> @@ -10,13 +11,7 @@ <% else %> <%= f.input :email, readonly: true %> <% end %> - <%# if current_user.try :superadmin? %> - <%#= f.association :organization, include_blank: false %> - <%#= f.input :superadmin, as: :boolean, label: false, inline_label: true %> - <%# end %> - <%# if current_user.try :admin? %> - <%#= f.input :admin, as: :boolean, label: false, inline_label: true, hint: t(".admin_warning") %> - <%# end %> + <%= f.input :phone %> <%= f.input :alt_phone %> <%= f.input :date_of_birth, @@ -24,10 +19,21 @@ end_year: Date.today.year - 12, include_blank: :true %> <%= f.input :description, as: "text" %> - <%#= f.association :categories, label_method: :fqn, input_html: {style: 'width: 100%'} %> -
- <%= f.label :notifications %> - <%= f.check_box :notifications %> + +
+ +
+ <%= f.label :notifications do %> + <%= f.check_box :notifications %> + <%= t('activerecord.attributes.user.notifications') %> + <% end %> +
+
+ <%= f.label :push_notifications do %> + <%= f.check_box :push_notifications %> + <%= t('activerecord.attributes.user.push_notifications') %> + <% end %> +
diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 9e5d3c3..4bd213c 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -494,8 +494,7 @@ ca: edit: edit_user: Canviar usuari form: - admin_warning: Atenció!!! Estàs atorgant poders a aquest usuari!! - superadmin_warning: Atenció!!! Estàs atorgant PODERS DIVINS a aquest usuari!! + notifications: Notificacions give_time: give_time: Donar Temps a index: diff --git a/config/locales/en.yml b/config/locales/en.yml index f3badbe..dfc6deb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -64,7 +64,8 @@ en: gender: Gender identity_document: Identity Document last_sign_in_at: Last login - notifications: Receive notifications + notifications: Receive email notifications + push_notifications: Receive mobile notifications organization: Organization phone: Phone registration_date: Registration date @@ -494,8 +495,7 @@ en: edit: edit_user: Update user form: - admin_warning: Warning!!! You are giving privileges to this user!! - superadmin_warning: Warning!!! You are giving GOD PRIVILEGES to this user!! + notifications: Notifications give_time: give_time: Give time to index: diff --git a/config/locales/es.yml b/config/locales/es.yml index fac42d8..6518697 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -64,7 +64,8 @@ es: gender: Género identity_document: DNI last_sign_in_at: Fecha último login - notifications: Recibir notificaciones + notifications: Recibir notificaciones por email + push_notifications: Recibir notificaciones en el móbil organization: Organización phone: Teléfono registration_date: Fecha de alta @@ -494,8 +495,7 @@ es: edit: edit_user: Cambiar usuario form: - admin_warning: Atención!!! Estás dando poderes a este usuario!! - superadmin_warning: Atención!!! Estás dando PODERES DIVINOS a este usuario!! + notifications: Notificaciones give_time: give_time: Dar Tiempo a index: diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 24fe72b..456ca46 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -500,8 +500,7 @@ eu: edit: edit_user: Erabiltzailea aldatu form: - admin_warning: Kontuz!!! Erabiltzaile honi boterea ematen ari zara. - superadmin_warning: Kontuz!!! Erabiltzaile honi izugarrizko boterea ematen ari zara. + notifications: Jakinarazpen give_time: give_time: honi denbora eman index: diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index c9b1add..110bc74 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -494,8 +494,7 @@ pt-BR: edit: edit_user: Trocar usuário form: - admin_warning: Atenção!!! Você está dando poderes a este usuário!! - superadmin_warning: Atenção!!! Você está dando PODERES DIVINOS a este usuário!! + notifications: Notificações give_time: give_time: Dar Tempo a index: diff --git a/db/migrate/20180530180546_add_push_notifications_to_users.rb b/db/migrate/20180530180546_add_push_notifications_to_users.rb new file mode 100644 index 0000000..c8ac49f --- /dev/null +++ b/db/migrate/20180530180546_add_push_notifications_to_users.rb @@ -0,0 +1,5 @@ +class AddPushNotificationsToUsers < ActiveRecord::Migration + def change + add_column :users, :push_notifications, :boolean, default: true, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 1144dc5..341743d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180529144243) do +ActiveRecord::Schema.define(version: 20180530180546) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -215,6 +215,7 @@ ActiveRecord::Schema.define(version: 20180529144243) do t.datetime "locked_at" t.string "locale", default: "es" t.boolean "notifications", default: true + t.boolean "push_notifications", default: true, null: false end add_index "users", ["email"], name: "index_users_on_email", using: :btree