Skip to content

Commit

Permalink
Add bootstrap view for notifications view
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoj committed Feb 26, 2019
1 parent 8420f42 commit d85ebdd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def index

def update
subscriptions_form.update!(params[:subscriptions])
flash[:notice] = 'Notifications settings updated'
flash[:success] = 'Notifications settings updated'
rescue ActiveRecord::RecordInvalid
flash[:error] = 'Notifications settings could not be updated due to an error'
ensure
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
:ruby
i = 0

- i = 0
- @subscriptions_form.subscriptions_by_event.each do |event_class, subscriptions|
%li.list-group-item
%h5= event_class.description
%p= Event::Base::EXPLANATION_FOR_NOTIFICATIONS[event_class.to_s]
- subscriptions.each do |subscription|
= fields_for "subscriptions[#{i}]", subscription do |f|
.custom-control.custom-checkbox.custom-control-inline
= f.check_box :channel, { class: 'custom-control-input', data: { eventtype: subscription.eventtype,
receiver_role: subscription.receiver_role } }, EventSubscription.channels.keys[1], EventSubscription.channels.keys[0]
= f.label :channel, EventSubscription::RECEIVER_ROLE_TEXTS[subscription.receiver_role], class: 'custom-control-label'
= f.hidden_field :eventtype
= f.hidden_field :receiver_role
- i += 1
.card.bg-light.mb-2
.card-body
%h5.card-title= event_class.description
%p.card-text= Event::Base::EXPLANATION_FOR_NOTIFICATIONS[event_class.to_s]
.form-inline
- subscriptions.each do |subscription|
= fields_for "subscriptions[#{i}]", subscription do |f|
.form-group.custom-control.custom-checkbox.mr-3
= f.check_box :channel, { class: 'custom-control-input',
data: { eventtype: subscription.eventtype, receiver_role: subscription.receiver_role } },
EventSubscription.channels.keys[1], EventSubscription.channels.keys[0]
= f.label :channel, EventSubscription::RECEIVER_ROLE_TEXTS[subscription.receiver_role], class: 'custom-control-label'
= f.hidden_field :eventtype
= f.hidden_field :receiver_role
- i += 1
7 changes: 7 additions & 0 deletions src/api/app/views/webui2/webui/subscriptions/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
.card.mb-3
= render partial: 'webui/configuration/tabs'
.card-body
%h3.card-title
Events
%p.card-text
Choose default notification settings for events (checked means direct email).
= form_tag(notifications_path, method: :put, id: 'notification_form') do
= render partial: 'subscriptions_form'
%p= submit_tag 'Update'

0 comments on commit d85ebdd

Please sign in to comment.