Merge pull request #356 from coopdevs/feature/adds-user-push-notification-attribute
Added push notifications setting
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<%= simple_form_for @user do |f| %>
|
||||
<div class="form-inputs">
|
||||
<%= 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%'} %>
|
||||
<div class="checkbox">
|
||||
<%= f.label :notifications %>
|
||||
<%= f.check_box :notifications %>
|
||||
|
||||
<div class='form-group'>
|
||||
<label><%= t('.notifications') %></label>
|
||||
<div class="checkbox">
|
||||
<%= f.label :notifications do %>
|
||||
<%= f.check_box :notifications %>
|
||||
<%= t('activerecord.attributes.user.notifications') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<%= f.label :push_notifications do %>
|
||||
<%= f.check_box :push_notifications %>
|
||||
<%= t('activerecord.attributes.user.push_notifications') %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddPushNotificationsToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :push_notifications, :boolean, default: true, null: false
|
||||
end
|
||||
end
|
||||
+2
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user