Skip to content

Commit

Permalink
Added push notifications option in user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
mllocs committed May 13, 2018
1 parent 58af2db commit 1a3f5eb
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 30 deletions.
7 changes: 1 addition & 6 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,6 @@ label[required]::after{
background-color: transparent;
}

form .checkbox input[type="checkbox"] {
margin-left: 5px;
position: relative;
}

.back-overlay {
background-color: $black;
background-size: cover;
Expand Down Expand Up @@ -916,4 +911,4 @@ form .checkbox input[type="checkbox"] {
padding: 1em;
line-height: 1.6em;
}
}
}
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def scoped_users

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?
Expand Down
28 changes: 17 additions & 11 deletions app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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? %>
Expand All @@ -10,24 +11,29 @@
<% 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,
start_year: Date.today.year - 90,
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">
Expand Down
3 changes: 1 addition & 2 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions config/locales/eu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1a3f5eb

Please sign in to comment.