dm_event 4.2.1.5 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23d8fe1df77a2f9988b3e542ff630ada442a532a
4
- data.tar.gz: 1d024244f2d63c430d5842e817946a35033d40b9
3
+ metadata.gz: dea6ef511efd6db0aee3ce60595983c05a8ed4b1
4
+ data.tar.gz: ea0c6813860edba83743ff1798ff539401b888b4
5
5
  SHA512:
6
- metadata.gz: d37f34b6cbdf20ef53dbe02ed83bbd396deaf3f64f11bcdbff58647874a225c1d990d5e8fe1f10711c3b984da800dff77b900c021ca8b86d4eb689ddb96eca3b
7
- data.tar.gz: 00866053024886b52c3d7e548c05735330d56a7724af7eeb1e3f90f5609f90d332d68a01007fabd95bcf26206ab6af9305c32f1d1d0b2150b18398528038a292
6
+ metadata.gz: 308fbd246363d28dbbbc6ae94c82d3ad0e0c0a43b8b685d70b749487bef03033bc49198e06230c702a62aea724de37a3fcbd6b3633420f9e200175456f783e81
7
+ data.tar.gz: 495774ef45baee7b4a6dfdb98da51b9ee1ab2d0dedeb0bbe96079d42813a4046985778a16ad18b131aa365cea7ec01d918449d4f0367e098efd3f68b7bd6c376
@@ -5,7 +5,7 @@ protected
5
5
 
6
6
  #------------------------------------------------------------------------------
7
7
  def authorize_access
8
- unless can?(:manage_events, :all)
8
+ unless can?(:access_event_section, :all)
9
9
  flash[:alert] = "Unauthorized Access!"
10
10
  redirect_to current_account.index_path
11
11
  end
@@ -6,6 +6,8 @@ class DmEvent::Admin::RegistrationsController < DmEvent::Admin::AdminController
6
6
  #------------------------------------------------------------------------------
7
7
  def action_state
8
8
  @registration = Registration.find(params[:id])
9
+ authorize! :manage_event_registrations, @registration.workshop
10
+
9
11
  @state_event = params[:state_event].downcase
10
12
  case @state_event
11
13
  # when 'verify payment'
@@ -32,6 +34,7 @@ class DmEvent::Admin::RegistrationsController < DmEvent::Admin::AdminController
32
34
  #------------------------------------------------------------------------------
33
35
  def destroy
34
36
  registration = Registration.find(params[:id])
37
+ authorize! :manage_event_registrations, registration.workshop
35
38
  registration.destroy
36
39
  redirect_to admin_workshop_url(registration.workshop), notice: 'Registration was successfully deleted.'
37
40
  end
@@ -40,16 +43,18 @@ class DmEvent::Admin::RegistrationsController < DmEvent::Admin::AdminController
40
43
  def edit
41
44
  @registration = Registration.find(params[:id])
42
45
  @workshop = @registration.workshop
46
+ authorize! :manage_event_registrations, @registration.workshop
43
47
  end
44
48
 
45
49
  #------------------------------------------------------------------------------
46
50
  def update
47
51
  @registration = Registration.find(params[:id])
48
52
  @workshop = @registration.workshop
53
+ authorize! :manage_event_registrations, @registration.workshop
49
54
 
50
55
  #--- save without validation, so can update without having to fill in all details
51
56
  payment_comment_text = params[:registration].delete(:payment_comment_text)
52
- @registration.attributes = registration_params
57
+ @registration.attributes = registration_params(@workshop)
53
58
 
54
59
  if @registration.save(:validate => false)
55
60
  if @registration.payment_comment.nil? && payment_comment_text
@@ -70,6 +75,8 @@ class DmEvent::Admin::RegistrationsController < DmEvent::Admin::AdminController
70
75
  def ajax_payment
71
76
  @registration = Registration.find(params[:id])
72
77
  @workshop = @registration.workshop
78
+ authorize! :manage_event_registrations, @registration.workshop
79
+
73
80
  previous_payment = params[:payment_id] ? PaymentHistory.find(params[:payment_id]) : nil
74
81
  @payment_history = @registration.manual_payment(previous_payment,
75
82
  params[:payment_history][:cost],
@@ -98,6 +105,8 @@ class DmEvent::Admin::RegistrationsController < DmEvent::Admin::AdminController
98
105
  #------------------------------------------------------------------------------
99
106
  def ajax_delete_payment
100
107
  @registration = Registration.find(params[:id])
108
+ authorize! :manage_event_registrations, @registration.workshop
109
+
101
110
  if @registration.delete_payment(params[:payment_id])
102
111
  redirect_to edit_admin_registration_path(@registration), notice: 'Payment was deleted'
103
112
  else
@@ -6,20 +6,24 @@ class DmEvent::Admin::WorkshopPricesController < DmEvent::Admin::AdminController
6
6
 
7
7
  #------------------------------------------------------------------------------
8
8
  def index
9
+ authorize! :manage_events, @workshop
9
10
  @workshop_prices = @workshop.workshop_prices
10
11
  end
11
12
 
12
13
  #------------------------------------------------------------------------------
13
14
  def new
15
+ authorize! :manage_events, @workshop
14
16
  @workshop_price = @workshop.workshop_prices.build(price_currency: @workshop.base_currency)
15
17
  end
16
18
 
17
19
  #------------------------------------------------------------------------------
18
20
  def edit
21
+ authorize! :manage_events, @workshop
19
22
  end
20
23
 
21
24
  #------------------------------------------------------------------------------
22
25
  def create
26
+ authorize! :manage_events, @workshop
23
27
  attributes = WorkshopPrice.prepare_prices(workshop_price_params.merge(price_currency: @workshop.base_currency))
24
28
  @workshop_price = @workshop.workshop_prices.new(attributes)
25
29
  if @workshop_price.save
@@ -31,6 +35,7 @@ class DmEvent::Admin::WorkshopPricesController < DmEvent::Admin::AdminController
31
35
 
32
36
  #------------------------------------------------------------------------------
33
37
  def update
38
+ authorize! :manage_events, @workshop
34
39
  attributes = WorkshopPrice.prepare_prices(workshop_price_params.merge(price_currency: @workshop.base_currency))
35
40
  if @workshop_price.update_attributes(attributes)
36
41
  redirect_to admin_workshop_workshop_prices_url(@workshop), notice: 'Price was successfully updated.'
@@ -41,6 +46,7 @@ class DmEvent::Admin::WorkshopPricesController < DmEvent::Admin::AdminController
41
46
 
42
47
  #------------------------------------------------------------------------------
43
48
  def destroy
49
+ authorize! :manage_events, @workshop
44
50
  if @workshop_price.registrations.count == 0
45
51
  @workshop_price.destroy
46
52
  redirect_to admin_workshop_workshop_prices_url(@workshop), notice: 'Price was successfully deleted.'
@@ -9,21 +9,25 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
9
9
 
10
10
  #------------------------------------------------------------------------------
11
11
  def index
12
- @workshops = Workshop.upcoming
13
- @workshops_past = Workshop.past
12
+ authorize! :access_event_section, :all
13
+ @workshops = Workshop.upcoming.select {|w| can?(:list_events, w)}
14
+ @workshops_past = Workshop.past.select {|w| can?(:list_events, w)}
14
15
  end
15
16
 
16
17
  #------------------------------------------------------------------------------
17
18
  def new
19
+ authorize! :manage_events, :all
18
20
  @workshop = Workshop.new
19
21
  end
20
22
 
21
23
  #------------------------------------------------------------------------------
22
24
  def edit
25
+ authorize! :manage_events, @workshop
23
26
  end
24
27
 
25
28
  #------------------------------------------------------------------------------
26
29
  def create
30
+ authorize! :manage_events, :all
27
31
  @workshop = Workshop.new(workshop_params)
28
32
  if @workshop.save
29
33
  redirect_to admin_workshop_url(@workshop), notice: 'Workshop was successfully created.'
@@ -34,6 +38,7 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
34
38
 
35
39
  #------------------------------------------------------------------------------
36
40
  def update
41
+ authorize! :manage_events, @workshop
37
42
  if @workshop.update_attributes(workshop_params)
38
43
  redirect_to admin_workshop_url(@workshop), notice: 'Workshop was successfully updated.'
39
44
  else
@@ -43,18 +48,25 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
43
48
 
44
49
  #------------------------------------------------------------------------------
45
50
  def show
46
- @registrations = @workshop.registrations
47
-
51
+ authorize! :list_events, @workshop
48
52
  respond_to do |format|
49
53
  format.html # show.html.erb
50
- format.json { render json: RegistrationDatatable.new(view_context) }
51
- format.xls { data_export(Registration.csv_columns(@workshop), @registrations, filename: @workshop.slug, expressions: true, format: 'xls') }
52
- format.csv { data_export(Registration.csv_columns(@workshop), @registrations, filename: @workshop.slug, expressions: true, format: 'csv') }
53
- end
54
+ format.json {
55
+ permissions = {
56
+ manage_events: can?(:manage_events, @workshop),
57
+ manage_event_registrations: can?(:manage_event_registrations, @workshop),
58
+ manage_event_finances: can?(:manage_event_finances, @workshop)
59
+ }
60
+ render json: RegistrationDatatable.new(view_context, current_user, permissions)
61
+ }
62
+ format.xls { data_export(Registration.csv_columns(@workshop), @workshop.registrations, filename: @workshop.slug, expressions: true, format: 'xls') if can?(:manage_event_registrations, @workshop)}
63
+ format.csv { data_export(Registration.csv_columns(@workshop), @workshop.registrations, filename: @workshop.slug, expressions: true, format: 'csv') if can?(:manage_event_registrations, @workshop)}
64
+ end
54
65
  end
55
66
 
56
67
  #------------------------------------------------------------------------------
57
68
  def destroy
69
+ authorize! :manage_events, :all
58
70
  @workshop.destroy
59
71
  redirect_to admin_workshops_url, notice: 'Workshop was successfully deleted.'
60
72
  end
@@ -63,6 +75,7 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
63
75
  # to determine which one we're editing
64
76
  #------------------------------------------------------------------------------
65
77
  def edit_system_email
78
+ authorize! :manage_events, @workshop
66
79
  redirect_to(admin_workshop_url(@workshop), error: 'Invalid system email type') if params[:email_type].blank?
67
80
  # [todo] verify that the email_type is one of the Registration.aasm.states
68
81
 
@@ -78,13 +91,15 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
78
91
 
79
92
  #------------------------------------------------------------------------------
80
93
  def financials
94
+ authorize! :manage_event_finances, @workshop
81
95
  @financials = @workshop.financial_details
82
96
  @payments = PaymentHistory.where(owner_type: 'Registration', owner_id: @workshop.registrations.pluck(:id)).includes(:user_profile, owner: [:user_profile])
83
97
  end
84
98
 
85
- # Generate a list of all outstanding balances
99
+ # Generate a list of all outstanding balances across all workshops
86
100
  #------------------------------------------------------------------------------
87
101
  def user_outstanding_balances
102
+ authorize! :manage_events, :all
88
103
  @unpaid = Registration.unpaid.includes(:user_profile, :workshop_price)
89
104
  @unpaid = @unpaid.to_a.delete_if {|i| i.balance_owed.zero?}.group_by {|i| i.full_name}.sort_by {|i| i[0].downcase}
90
105
  end
@@ -92,6 +107,7 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
92
107
  # Handle any additional configuration, such as selecting the attached blog/forum
93
108
  #------------------------------------------------------------------------------
94
109
  def additional_configuration
110
+ authorize! :manage_events, @workshop
95
111
  if put_or_post?
96
112
  if @workshop.valid?
97
113
  new_blog_id = params[:workshop].delete(:cms_blog).to_i
@@ -119,6 +135,7 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
119
135
 
120
136
  #------------------------------------------------------------------------------
121
137
  def send_payment_reminder_emails
138
+ authorize! :manage_event_finances, @workshop
122
139
  status = @workshop.send_payment_reminder_emails(params[:registration_id])
123
140
  msg = "Reminder emails sent ==> Success: #{status[:success]} Failed: #{status[:failed]}"
124
141
  status[:failed] > 0 ? (flash[:warning] = msg) : (flash[:notice] = msg)
@@ -127,6 +144,7 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
127
144
 
128
145
  #------------------------------------------------------------------------------
129
146
  def lost_users
147
+ authorize! :manage_event_registrations, @workshop
130
148
  if put_or_post?
131
149
  @days_ago = params[:lost_users][:days_ago].to_i
132
150
  @days_ago = 60 if @days_ago > 60
@@ -137,6 +155,37 @@ class DmEvent::Admin::WorkshopsController < DmEvent::Admin::AdminController
137
155
  @lost_users = @workshop.lost_users(@days_ago)
138
156
  end
139
157
 
158
+ #------------------------------------------------------------------------------
159
+ def permissions
160
+ authorize! :manage_events, :all
161
+ if put_or_post?
162
+ if params[:user][:user_id]
163
+ user = User.find(params[:user][:user_id])
164
+ if user
165
+ roles = params[:user].delete(:roles)
166
+ [:manage_event, :manage_event_registration, :manage_event_finance].each do |role|
167
+ roles[role].as_boolean ? user.add_role(role, @workshop) : user.remove_role(role, @workshop)
168
+ end
169
+ user.save!
170
+ end
171
+ end
172
+ end
173
+ @event_managers = User.with_role(:event_manager)
174
+ @event_managers_alacarte = User.with_role(:event_manager_alacarte)
175
+ end
176
+
177
+ #------------------------------------------------------------------------------
178
+ def ajax_toggle_permission
179
+ authorize! :manage_events, :all
180
+ user = User.find(params[:user_id])
181
+ role = params[:role].to_sym
182
+ if user && [:manage_event, :manage_event_registration, :manage_event_finance].include?(role)
183
+ user.has_role?(role, @workshop) ? user.remove_role(role, @workshop) : user.add_role(role, @workshop)
184
+ user.save!
185
+ end
186
+ render nothing: true
187
+ end
188
+
140
189
  private
141
190
 
142
191
  #------------------------------------------------------------------------------
@@ -42,7 +42,7 @@ class DmEvent::RegistrationsController < DmEvent::ApplicationController
42
42
  profile_params = params[:registration].delete("user_profile_attributes") if params[:registration]
43
43
  profile_params.delete(:id) if profile_params
44
44
 
45
- @registration = @workshop.registrations.new(registration_params)
45
+ @registration = @workshop.registrations.new(registration_params(@workshop))
46
46
  @registration.registered_locale = I18n.locale
47
47
  @registration.user_profile = current_user ? current_user.user_profile : UserProfile.new
48
48
  @registration.user_profile.assign_attributes(user_profile_direct_params(profile_params)) unless profile_params.blank?
@@ -8,8 +8,10 @@ class RegistrationDatatable
8
8
  delegate :url_helpers, to: 'DmEvent::Engine.routes'
9
9
 
10
10
  #------------------------------------------------------------------------------
11
- def initialize(view)
11
+ def initialize(view, user, permissions)
12
12
  @view = view
13
+ @user = user
14
+ @permissions = permissions
13
15
  end
14
16
 
15
17
  #------------------------------------------------------------------------------
@@ -32,8 +34,8 @@ private
32
34
  "<span style='white-space:nowrap;'>#{registration.receipt_code}</span>",
33
35
  name_and_avatar(registration),
34
36
  present(registration).balance_or_paid,
35
- "<span style='white-space:nowrap;'>#{format_date(registration.created_at)}</span>",
36
- (registration.user_profile.user ? present(registration.user_profile.user).last_access : colored_label('no user', :gray))
37
+ "<span class='date'>#{format_date(registration.created_at)}</span>",
38
+ "<span class='date'>#{(registration.user_profile.user ? present(registration.user_profile.user).last_access : colored_label('no user', :gray))}</span>"
37
39
  ]
38
40
  end
39
41
  end
@@ -46,13 +48,22 @@ private
46
48
  #------------------------------------------------------------------------------
47
49
  def name_and_avatar(registration)
48
50
  # image_tag(registration.user_profile.public_avatar_url(:sq35), width: 25, height: 25) + link_to(registration.full_name, url_helpers.edit_admin_registration_path(I18n.locale, registration))
49
- link_to(registration.full_name, url_helpers.edit_admin_registration_path(I18n.locale, registration))
51
+ if @permissions[:manage_event_registrations]
52
+ link_to(registration.full_name, url_helpers.edit_admin_registration_path(I18n.locale, registration))
53
+ else
54
+ registration.full_name
55
+ end
50
56
  end
51
57
 
52
58
  #------------------------------------------------------------------------------
53
59
  def fetch_registrations
54
60
  @workshop = Workshop.find_by_slug(params[:id])
55
61
  registrations = @workshop.registrations.includes(:workshop_price, :user_profile => [:user => :current_site_profile]).references(:user_profiles).order("#{sort_column} #{sort_direction}")
62
+
63
+ if !@permissions[:manage_event_registrations] && !@permissions[:manage_event_finances]
64
+ # limit to your own registration if can only edit the workshop
65
+ registrations = registrations.where(user_profile_id: @user.user_profile.id)
66
+ end
56
67
  if params[:duplicates].present?
57
68
  #--- grab only registrations that have duplicates (based on the user_profile_id)
58
69
  grouped = registrations.group(:user_profile_id)
@@ -70,10 +81,14 @@ private
70
81
  def registration_actions(registration)
71
82
  actions = ''
72
83
  actions += '<div class="btn-group">'
73
- actions += "<button class='btn btn-xs dropdown-toggle btn-#{registration.current_state} hovertip' data-placement='right' data-toggle='dropdown' title='#{registration.current_state.capitalize} on #{format_date(registration.process_changed_on)}'><i class='caret'></i></button>"
74
- actions += '<ul class="dropdown-menu">'
75
- actions += action_list(registration)
76
- actions += '</ul>'
84
+ if @permissions[:manage_event_registrations]
85
+ actions += "<button class='btn btn-xs dropdown-toggle btn-#{registration.current_state} hovertip' data-placement='right' data-toggle='dropdown' title='#{registration.current_state.capitalize} on #{format_date(registration.process_changed_on)}'><i class='caret'></i></button>"
86
+ actions += '<ul class="dropdown-menu">'
87
+ actions += action_list(registration)
88
+ actions += '</ul>'
89
+ else
90
+ actions += "<button class='btn btn-xs btn-#{registration.current_state} hovertip' data-placement='right' title='#{registration.current_state.capitalize} on #{format_date(registration.process_changed_on)}'></button>"
91
+ end
77
92
  actions += '</div>'
78
93
  end
79
94
 
@@ -1,38 +1,68 @@
1
- # Wrap forum specific CanCan rules. Should be included in the main app's
1
+ # Wrap event specific CanCan rules. Should be included in the main app's
2
2
  # Ability class.
3
3
  # NOTE: When checking abilities, don't check for Class level abilities,
4
4
  # unless you don't care about the instance level. For example, don't
5
5
  # use both styles
6
- # can? :moderate, Forum
7
- # can? :moderate, @forum
6
+ # can? :moderate, Workshop
7
+ # can? :moderate, @workshop
8
8
  # In this case, if you need to check the class level, then use specific
9
- # current_user.has_role? :moderator, Forum
9
+ # current_user.has_role? :moderator, Workshop
10
10
  #------------------------------------------------------------------------------
11
-
12
11
  module DmEvent
13
12
  module Concerns
14
13
  module Ability
15
14
  def dm_event_abilities(user)
16
15
  if user
16
+ # an `event_manager` gets access to all workshops, registration, and finances.
17
17
  if user.has_role?(:event_manager)
18
18
  can :manage_events, :all
19
+ can :manage_event_registrations, :all
20
+ can :manage_event_finances, :all
21
+ can :access_event_section, :all
22
+ can :list_events, :all
23
+ # can :access_media_library, :all
24
+ can :access_admin, :all
25
+ elsif user.has_role?(:event_manager_alacarte)
26
+ # allowed to access the backend event section
27
+ can :access_event_section, :all
19
28
  can :access_admin, :all
29
+
30
+ # can edit a workshop, including workshop prices and email templates
31
+ # (does not include access to registrations or finances)
32
+ manage_event_ids = @user_roles.select {|r| r.name == 'manage_event' && r.resource_type == 'Workshop'}.map(&:resource_id)
33
+ can :manage_events, Workshop, id: manage_event_ids
34
+ # can(:access_media_library, :all) unless manage_event_ids.empty?
35
+
36
+ # can see and manage a workshops registrations
37
+ manage_event_registration_ids = @user_roles.select {|r| r.name == 'manage_event_registration' && r.resource_type == 'Workshop'}.map(&:resource_id)
38
+ can :manage_event_registrations, Workshop, id: manage_event_registration_ids
39
+
40
+ # can see and manage a workshops finances
41
+ manage_event_finance_ids = @user_roles.select {|r| r.name == 'manage_event_finance' && r.resource_type == 'Workshop'}.map(&:resource_id)
42
+ can :manage_event_finances, Workshop, id: manage_event_finance_ids
43
+
44
+ can :list_events, Workshop, id: (manage_event_ids + manage_event_registration_ids + manage_event_finance_ids).uniq
20
45
  end
46
+
21
47
  end
22
48
  end
49
+
50
+ ::Ability.register_abilities(:dm_event_abilities)
51
+
23
52
  end
24
53
  end
25
54
  end
26
55
 
56
+
27
57
  #------------------------------------------------------------------------------
28
58
  # The abilities get basically compiled. So if you use
29
59
  #
30
- # can :moderate, Forum, :id => Forum.with_role(:moderator, user).map(&:id)
60
+ # can :moderate, Workshop, :id => Workshop.with_role(:moderator, user).map(&:id)
31
61
  #
32
- # this will execute the Forum.with_role query once during Ability.new. However
62
+ # this will execute the Workshop.with_role query once during Ability.new. However
33
63
  #
34
- # can :moderate, Forum do |forum|
35
- # user.has_role? :moderator, forum
64
+ # can :moderate, Workshop do |workshop|
65
+ # user.has_role? :moderator, workshop
36
66
  # end
37
67
  #
38
68
  # this will execute the has_role? block on each call to can?
@@ -4,3 +4,4 @@
4
4
  #------------------------------------------------------------------------------
5
5
 
6
6
  UserProfile.send(:include, DmEvent::Concerns::UserProfile)
7
+ Ability.send(:include, DmEvent::Concerns::Ability)
@@ -1,20 +1,22 @@
1
1
  module DmEvent
2
2
  module PermittedParams
3
3
 
4
+ # access to this is protected before the call
4
5
  #------------------------------------------------------------------------------
5
6
  def workshop_params
6
- params.require(:workshop).permit! if can? :manage_events, :all
7
+ params.require(:workshop).permit!
7
8
  end
8
9
 
10
+ # access to this is protected before the call
9
11
  #------------------------------------------------------------------------------
10
12
  def workshop_price_params
11
- params.require(:workshop_price).permit! if can? :manage_events, :all
13
+ params.require(:workshop_price).permit!
12
14
  end
13
15
 
14
16
  #------------------------------------------------------------------------------
15
- def registration_params
17
+ def registration_params(workshop)
16
18
  return nil if params[:registration].nil? || params[:registration].empty?
17
- if can? :manage_events, :all
19
+ if can?(:manage_event_registrations, @workshop)
18
20
  params.require(:registration).permit!
19
21
  else
20
22
  # nested attributes: because field_data can be either a single value or an array of values,
@@ -26,9 +28,10 @@ module DmEvent
26
28
  end
27
29
  end
28
30
 
31
+ # access to this is protected before the call
29
32
  #------------------------------------------------------------------------------
30
33
  def system_email_params
31
- params.require(:system_email).permit! if can? :manage_events, :all
34
+ params.require(:system_email).permit!
32
35
  end
33
36
 
34
37
  end
@@ -165,11 +165,6 @@
165
165
  <% end %>
166
166
  <% end %>
167
167
 
168
- <%= subsection title: 'Payment Reminders' do %>
169
- <%= f.input :preferred_payment_reminder_hold_until, label: 'No reminder until', as: :date_picker, input_wrapper_html: {class: 'col-sm-4'},
170
- hint: 'When sending reminders in batch, this persons reminder will not be sent unless after the specified date' %>
171
- <% end %>
172
-
173
168
  <%= submit_or_cancel cancel_url: admin_workshop_path(@workshop), delete_url: [:admin, @registration], delete_confirm: 'Are you sure you wish to delete this registration? Any associated payments will also be deleted!' %>
174
169
  <% end %>
175
170
  </div>
@@ -211,7 +206,15 @@
211
206
  <% end %>
212
207
 
213
208
  <%= subsection title: 'Payment Reminders' do %>
209
+ <%= simple_form_for @registration, url: admin_registration_path,
210
+ html: { class: 'form-horizontal' }, wrapper: :bs3_horizontal_form, wrapper_mappings: DmAdmin::FormWrapperMappings do |f| %>
211
+ <%= f.input :preferred_payment_reminder_hold_until, label: 'No reminder until', as: :date_picker, input_wrapper_html: {class: 'col-sm-4'},
212
+ hint: 'When sending reminders in batch, this persons reminder will not be sent unless after the specified date' %>
214
213
 
214
+ <%= submit_or_cancel cancel: false %>
215
+ <% end %>
216
+ <hr/>
217
+
215
218
  <table class="table table-condensed table-gradient table-hover" style="margin-bottom: 20px;">
216
219
  <thead>
217
220
  <tr>
@@ -1,58 +1,62 @@
1
- <%= subsection title: 'Registration Statistics' do %>
2
- <% num_registrations = workshop.registrations.count %>
3
- <div class="block progress-statistics">
4
- <% num = workshop.registrations.number_of(:attending) %>
5
- <%= slim_progress_bar(label: 'Attending', value: "#{num} / #{num.percent_of(num_registrations).to_s}%", color: 'success', percentage: num.percent_of(num_registrations)) %>
6
- <% if (num = workshop.registrations.number_of(:pending)) > 0 %>
7
- <%= slim_progress_bar(label: 'Pending', value: "#{num}", color: 'pending', percentage: num.percent_of(num_registrations)) %>
8
- <% end %>
9
- <% num = workshop.registrations.number_of(:accepted) %>
10
- <%= slim_progress_bar(label: 'Accepted', value: "#{num}", color: 'accepted', percentage: num.percent_of(num_registrations)) %>
11
- <% num = workshop.registrations.number_of(:paid) %>
12
- <%= slim_progress_bar(label: 'Paid', value: "#{num}", color: 'paid', percentage: num.percent_of(num_registrations)) %>
13
- <% if (num = workshop.registrations.number_of(:waitlisted)) > 0 %>
14
- <%= slim_progress_bar(label: 'Waitlisted', value: "#{num}", color: 'waitlisted', percentage: num.percent_of(num_registrations)) %>
15
- <% end %>
16
- <% if (num = workshop.registrations.number_of(:reviewing)) > 0 %>
17
- <%= slim_progress_bar(label: 'Reviewing', value: "#{num}", color: 'reviewing', percentage: num.percent_of(num_registrations)) %>
18
- <% end %>
19
- <% if (num = workshop.registrations.number_of(:rejected)) > 0 %>
20
- <%= slim_progress_bar(label: 'Rejected', value: "#{num}", color: 'rejected', percentage: num.percent_of(num_registrations)) %>
21
- <% end %>
22
- <% if (num = workshop.registrations.number_of(:canceled)) > 0 %>
23
- <%= slim_progress_bar(label: 'Canceled', value: "#{num}", color: 'canceled', percentage: num.percent_of(num_registrations)) %>
24
- <% end %>
25
- <% if (num = workshop.registrations.number_of(:refunded)) > 0 %>
26
- <%= slim_progress_bar(label: 'Refunded', value: "#{num}", color: 'refunded', percentage: num.percent_of(num_registrations)) %>
27
- <% end %>
28
- <% if (num = workshop.registrations.number_of(:noshow)) > 0 %>
29
- <%= slim_progress_bar(label: 'No Show', value: "#{num}", color: 'noshow', percentage: num.percent_of(num_registrations)) %>
30
- <% end %>
31
- </div>
32
- <% end %>
33
-
34
- <% unless @workshop.workshop_prices.empty? %>
35
- <%= subsection title: 'Price Distribution' do %>
36
- <% financials = @workshop.financial_details(:summary) %>
37
- <ul class="statistics statistics-small statistics-linear">
38
- <li><%= stat_block_small label: 'Best', number: financials[:summary][:total_possible].format(no_cents_if_whole: true), color_type: :info, icon: 'icon-coin', percent: 100 %></li>
39
- <li><%= stat_block_small label: 'Worst (80%)', number: financials[:summary][:total_possible_worst].format(no_cents_if_whole: true), color_type: :warning, icon: 'icon-coin', percent: 80 %></li>
40
- <li><%= stat_block_small label: 'Paid', number: financials[:summary][:total_paid].format(no_cents_if_whole: true), color_type: :success, icon: 'icon-coin', percent: financials[:summary][:total_paid_percent] %></li>
41
- </ul>
42
- <%= link_to 'Financial Details', financials_admin_workshop_url(@workshop) %>
43
- <hr>
1
+ <% if can?(:manage_event_registrations, @workshop) || can?(:manage_event_finances, @workshop) %>
2
+ <%= subsection title: 'Registration Statistics' do %>
3
+ <% num_registrations = workshop.registrations.count %>
44
4
  <div class="block progress-statistics">
45
- <% num_attending = workshop.registrations.number_of(:attending) %>
46
- <% workshop.registrations.number_of(:for_all_prices).each do |price_id, registration_count| %>
47
- <% if price_id %>
48
- <% price = WorkshopPrice.find_by_id(price_id ) %>
49
- <%= slim_progress_bar(label: price.price_formatted, value: registration_count, color: 'success',
50
- percentage: registration_count.percent_of(num_attending), bottom_label: price.price_description) %>
51
- <% else %>
52
- <%= slim_progress_bar(label: 'no pricing selected', value: registration_count, color: 'noshow',
53
- percentage: registration_count.percent_of(num_attending), bottom_label: '') %>
54
- <% end %>
5
+ <% num = workshop.registrations.number_of(:attending) %>
6
+ <%= slim_progress_bar(label: 'Attending', value: "#{num} / #{num.percent_of(num_registrations).to_s}%", color: 'success', percentage: num.percent_of(num_registrations)) %>
7
+ <% if (num = workshop.registrations.number_of(:pending)) > 0 %>
8
+ <%= slim_progress_bar(label: 'Pending', value: "#{num}", color: 'pending', percentage: num.percent_of(num_registrations)) %>
9
+ <% end %>
10
+ <% num = workshop.registrations.number_of(:accepted) %>
11
+ <%= slim_progress_bar(label: 'Accepted', value: "#{num}", color: 'accepted', percentage: num.percent_of(num_registrations)) %>
12
+ <% num = workshop.registrations.number_of(:paid) %>
13
+ <%= slim_progress_bar(label: 'Paid', value: "#{num}", color: 'paid', percentage: num.percent_of(num_registrations)) %>
14
+ <% if (num = workshop.registrations.number_of(:waitlisted)) > 0 %>
15
+ <%= slim_progress_bar(label: 'Waitlisted', value: "#{num}", color: 'waitlisted', percentage: num.percent_of(num_registrations)) %>
16
+ <% end %>
17
+ <% if (num = workshop.registrations.number_of(:reviewing)) > 0 %>
18
+ <%= slim_progress_bar(label: 'Reviewing', value: "#{num}", color: 'reviewing', percentage: num.percent_of(num_registrations)) %>
19
+ <% end %>
20
+ <% if (num = workshop.registrations.number_of(:rejected)) > 0 %>
21
+ <%= slim_progress_bar(label: 'Rejected', value: "#{num}", color: 'rejected', percentage: num.percent_of(num_registrations)) %>
22
+ <% end %>
23
+ <% if (num = workshop.registrations.number_of(:canceled)) > 0 %>
24
+ <%= slim_progress_bar(label: 'Canceled', value: "#{num}", color: 'canceled', percentage: num.percent_of(num_registrations)) %>
25
+ <% end %>
26
+ <% if (num = workshop.registrations.number_of(:refunded)) > 0 %>
27
+ <%= slim_progress_bar(label: 'Refunded', value: "#{num}", color: 'refunded', percentage: num.percent_of(num_registrations)) %>
28
+ <% end %>
29
+ <% if (num = workshop.registrations.number_of(:noshow)) > 0 %>
30
+ <%= slim_progress_bar(label: 'No Show', value: "#{num}", color: 'noshow', percentage: num.percent_of(num_registrations)) %>
55
31
  <% end %>
56
32
  </div>
57
33
  <% end %>
58
34
  <% end %>
35
+
36
+ <% if can?(:manage_event_finances, @workshop) %>
37
+ <% unless @workshop.workshop_prices.empty? %>
38
+ <%= subsection title: 'Price Distribution' do %>
39
+ <% financials = @workshop.financial_details(:summary) %>
40
+ <ul class="statistics statistics-small statistics-linear">
41
+ <li><%= stat_block_small label: 'Best', number: financials[:summary][:total_possible].format(no_cents_if_whole: true), color_type: :info, icon: 'icon-coin', percent: 100 %></li>
42
+ <li><%= stat_block_small label: 'Worst (80%)', number: financials[:summary][:total_possible_worst].format(no_cents_if_whole: true), color_type: :warning, icon: 'icon-coin', percent: 80 %></li>
43
+ <li><%= stat_block_small label: 'Paid', number: financials[:summary][:total_paid].format(no_cents_if_whole: true), color_type: :success, icon: 'icon-coin', percent: financials[:summary][:total_paid_percent] %></li>
44
+ </ul>
45
+ <%= link_to 'Financial Details', financials_admin_workshop_url(@workshop) %>
46
+ <hr>
47
+ <div class="block progress-statistics">
48
+ <% num_attending = workshop.registrations.number_of(:attending) %>
49
+ <% workshop.registrations.number_of(:for_all_prices).each do |price_id, registration_count| %>
50
+ <% if price_id %>
51
+ <% price = WorkshopPrice.find_by_id(price_id ) %>
52
+ <%= slim_progress_bar(label: price.price_formatted, value: registration_count, color: 'success',
53
+ percentage: registration_count.percent_of(num_attending), bottom_label: price.price_description) %>
54
+ <% else %>
55
+ <%= slim_progress_bar(label: 'no pricing selected', value: registration_count, color: 'noshow',
56
+ percentage: registration_count.percent_of(num_attending), bottom_label: '') %>
57
+ <% end %>
58
+ <% end %>
59
+ </div>
60
+ <% end %>
61
+ <% end %>
62
+ <% end %>
@@ -1,8 +1,8 @@
1
1
  <% content_for :content_title, 'Workshop Dashboard' %>
2
2
  <% content_for :content_title_extra do %>
3
3
  <%= page_header_buttons do %>
4
- <%= link_to('Outstanding Balances', admin_workshop_user_outstanding_balances_path, title: 'Outstanding Balances', class: "btn btn-xs btn-default") %>
5
- <%= link_to(icon_label(:new, 'New'), new_admin_workshop_path, title: 'New Workshop', class: "btn btn-xs btn-default") %>
4
+ <%= link_to('Outstanding Balances', admin_workshop_user_outstanding_balances_path, title: 'Outstanding Balances', class: "btn btn-xs btn-default") if can?(:manage_events, :all) %>
5
+ <%= link_to(icon_label(:new, 'New'), new_admin_workshop_path, title: 'New Workshop', class: "btn btn-xs btn-default") if can?(:manage_events, :all) %>
6
6
  <% end %>
7
7
  <% end %>
8
8
 
@@ -12,49 +12,53 @@
12
12
  <% panel_class = workshop.registration_closed? ? 'panel-default' : 'panel-success' %>
13
13
  <div class="col-md-6">
14
14
  <%= panel title: link_to(workshop.title, [:admin, workshop]), subtitle: present(workshop).start_end_date, class: panel_class do %>
15
- <% financials = workshop.financial_details(:summary) %>
16
- <ul class="statistics">
17
- <li><%= stat_block_small label: 'Projected', number: financials[:summary][:total_possible].format(no_cents_if_whole: true), color_type: :info, icon: 'icon-coin', percent: 100 %></li>
18
- <li><%= stat_block_small label: 'Paid', number: financials[:summary][:total_paid].format(no_cents_if_whole: true), color_type: :success, icon: 'icon-coin', percent: financials[:summary][:total_paid_percent] %></li>
19
- <li><%= stat_block_small label: 'Unpaid', number: financials[:summary][:total_outstanding].format(no_cents_if_whole: true), color_type: :danger, icon: 'icon-coin', percent: 80 %></li>
20
- </ul>
21
-
22
- <div class="separator-reflected" style="margin: 10px 0px;"></div>
23
- <% num_registrations = workshop.registrations.count %>
24
- <div class="block progress-statistics">
25
- <% num = workshop.registrations.number_of(:attending) %>
26
- <%= slim_progress_bar(label: 'Attending', value: "#{num} / #{num.percent_of(num_registrations).to_s}%", color: 'success', percentage: num.percent_of(num_registrations)) %>
27
- </div>
28
- <div class="row">
29
- <div class="col-md-6">
30
- <div class="block well progress-statistics">
31
- <div class="body">
32
- <% num = workshop.registrations.number_of(:accepted) %>
33
- <%= slim_progress_bar(label: 'Accepted', value: "#{num}", color: 'accepted', percentage: num.percent_of(num_registrations)) %>
34
- <% num = workshop.registrations.number_of(:paid) %>
35
- <div class="semi-block">
36
- <%= slim_progress_bar(label: 'Paid', value: "#{num}", color: 'paid', percentage: num.percent_of(num_registrations)) %>
37
- </div>
38
- <% num = workshop.registrations.number_of(:pending) %>
39
- <div class="semi-block">
40
- <%= slim_progress_bar(label: 'Pending', value: "#{num}", color: 'pending', percentage: num.percent_of(num_registrations)) %>
15
+ <% if can? :manage_event_finances, workshop %>
16
+ <% financials = workshop.financial_details(:summary) %>
17
+ <ul class="statistics">
18
+ <li><%= stat_block_small label: 'Projected', number: financials[:summary][:total_possible].format(no_cents_if_whole: true), color_type: :info, icon: 'icon-coin', percent: 100 %></li>
19
+ <li><%= stat_block_small label: 'Paid', number: financials[:summary][:total_paid].format(no_cents_if_whole: true), color_type: :success, icon: 'icon-coin', percent: financials[:summary][:total_paid_percent] %></li>
20
+ <li><%= stat_block_small label: 'Unpaid', number: financials[:summary][:total_outstanding].format(no_cents_if_whole: true), color_type: :danger, icon: 'icon-coin', percent: 80 %></li>
21
+ </ul>
22
+ <% end %>
23
+
24
+ <% if can?(:manage_event_finances, workshop) || can?(:manage_event_registrations, workshop) %>
25
+ <div class="separator-reflected" style="margin: 10px 0px;"></div>
26
+ <% num_registrations = workshop.registrations.count %>
27
+ <div class="block progress-statistics">
28
+ <% num = workshop.registrations.number_of(:attending) %>
29
+ <%= slim_progress_bar(label: 'Attending', value: "#{num} / #{num.percent_of(num_registrations).to_s}%", color: 'success', percentage: num.percent_of(num_registrations)) %>
30
+ </div>
31
+ <div class="row">
32
+ <div class="col-md-6">
33
+ <div class="block well progress-statistics">
34
+ <div class="body">
35
+ <% num = workshop.registrations.number_of(:accepted) %>
36
+ <%= slim_progress_bar(label: 'Accepted', value: "#{num}", color: 'accepted', percentage: num.percent_of(num_registrations)) %>
37
+ <% num = workshop.registrations.number_of(:paid) %>
38
+ <div class="semi-block">
39
+ <%= slim_progress_bar(label: 'Paid', value: "#{num}", color: 'paid', percentage: num.percent_of(num_registrations)) %>
40
+ </div>
41
+ <% num = workshop.registrations.number_of(:pending) %>
42
+ <div class="semi-block">
43
+ <%= slim_progress_bar(label: 'Pending', value: "#{num}", color: 'pending', percentage: num.percent_of(num_registrations)) %>
44
+ </div>
41
45
  </div>
42
46
  </div>
43
47
  </div>
44
- </div>
45
- <div class="col-md-6">
46
- <div class="block well progress-statistics">
47
- <div class="body">
48
- <% num = workshop.registrations.number_of(:waitlisted) %>
49
- <%= slim_progress_bar(label: 'Waitlisted', value: "#{num}", color: 'waitlisted', percentage: num.percent_of(num_registrations)) %>
50
- <% num = workshop.registrations.number_of(:reviewing) %>
51
- <div class="semi-block">
52
- <%= slim_progress_bar(label: 'Reviewing', value: "#{num}", color: 'reviewing', percentage: num.percent_of(num_registrations)) %>
48
+ <div class="col-md-6">
49
+ <div class="block well progress-statistics">
50
+ <div class="body">
51
+ <% num = workshop.registrations.number_of(:waitlisted) %>
52
+ <%= slim_progress_bar(label: 'Waitlisted', value: "#{num}", color: 'waitlisted', percentage: num.percent_of(num_registrations)) %>
53
+ <% num = workshop.registrations.number_of(:reviewing) %>
54
+ <div class="semi-block">
55
+ <%= slim_progress_bar(label: 'Reviewing', value: "#{num}", color: 'reviewing', percentage: num.percent_of(num_registrations)) %>
56
+ </div>
53
57
  </div>
54
58
  </div>
55
59
  </div>
56
60
  </div>
57
- </div>
61
+ <% end %>
58
62
 
59
63
  <% end %>
60
64
  </div>
@@ -71,26 +75,30 @@
71
75
  <th>Projected</th>
72
76
  <th>Paid</th>
73
77
  <th>Unpaid</th>
74
- <th width="150">Date</th>
78
+ <th class="date">Date</th>
75
79
  </tr>
76
80
  </thead>
77
81
  <tbody>
78
82
  <% @workshops_past.each do |workshop| %>
79
83
  <% # TODO very ineffecient to do for each workshop. look at caching values %>
80
- <% financials = workshop.financial_details(:summary) %>
84
+ <% financials = workshop.financial_details(:summary) if can?(:manage_event_finances, workshop) %>
81
85
  <% present workshop do |workshop_presenter| %>
82
86
  <tr class="item" data-item_id="<%= workshop.id %>">
83
87
  <td>
84
88
  <%= link_to workshop.title, [:admin, workshop] %>
85
89
  </td>
86
- <td><%= financials[:summary][:total_possible].format(no_cents_if_whole: true) %></td>
87
- <td><span class="text-success"><%= financials[:summary][:total_paid].format(no_cents_if_whole: true) %></span></td>
90
+ <td><%= can?(:manage_event_finances, workshop) ? financials[:summary][:total_possible].format(no_cents_if_whole: true) : 'n/a' %></td>
91
+ <td><span class="text-success"><%= can?(:manage_event_finances, workshop) ? financials[:summary][:total_paid].format(no_cents_if_whole: true) : 'n/a' %></span></td>
88
92
  <td>
89
- <%= '<span class="text-danger">'.html_safe if financials[:summary][:total_outstanding].positive? %>
90
- <%= financials[:summary][:total_outstanding].format(no_cents_if_whole: true) %>
91
- <%= '</span>'.html_safe if financials[:summary][:total_outstanding].positive? %>
93
+ <% if can?(:manage_event_finances, workshop) %>
94
+ <%= '<span class="text-danger">'.html_safe if financials[:summary][:total_outstanding].positive? %>
95
+ <%= financials[:summary][:total_outstanding].format(no_cents_if_whole: true) %>
96
+ <%= '</span>'.html_safe if financials[:summary][:total_outstanding].positive? %>
97
+ <% else %>
98
+ n/a
99
+ <% end %>
92
100
  </td>
93
- <td><%= workshop_presenter.start_end_date %></td>
101
+ <td class="date"><%= workshop_presenter.start_end_date %></td>
94
102
  </tr>
95
103
  <% end %>
96
104
  <% end %>
@@ -0,0 +1,58 @@
1
+ <% content_for :content_title, "Permissions" %>
2
+ <% content_for :content_subtitle, "#{@workshop.title}" %>
3
+
4
+ <div class="row">
5
+ <div class="col-md-8">
6
+ <%= panel body: false, title: "Permissions" do %>
7
+ <div class="panel-body">
8
+ <p>The users below can be granted different levels of access to this particular workshop.</p>
9
+
10
+ <% @event_managers_alacarte.each do |user| %>
11
+ <div class="row">
12
+ <div class="col-md-12">
13
+ <%= subsection title: user.full_name do %>
14
+ <% manage_event_state = user.has_role?(:manage_event, @workshop) ? 'btn-success active' : 'btn-default' %>
15
+ <% manage_event_registration_state = user.has_role?(:manage_event_registration, @workshop) ? 'btn-success active' : 'btn-default' %>
16
+ <% manage_event_finance_state = user.has_role?(:manage_event_finance, @workshop) ? 'btn-success active' : 'btn-default' %>
17
+ <%= link_to 'Workshop Editing', dm_event.ajax_toggle_permission_admin_workshop_path(@workshop, user.id, :manage_event), class: "permission_btn btn btn-xs #{manage_event_state}", role: 'button', remote: true, method: :patch %>
18
+ <%= link_to 'Manage Registrations', dm_event.ajax_toggle_permission_admin_workshop_path(@workshop, user.id, :manage_event_registration), class: "permission_btn btn btn-xs #{manage_event_registration_state}", role: 'button', remote: true, method: :patch %>
19
+ <%= link_to 'View Finances', dm_event.ajax_toggle_permission_admin_workshop_path(@workshop, user.id, :manage_event_finance), class: "permission_btn btn btn-xs #{manage_event_finance_state}", role: 'button', remote: true, method: :patch %>
20
+ <% end %>
21
+ </div>
22
+ </div>
23
+ <% end %>
24
+ </div>
25
+
26
+ <% end %>
27
+ </div>
28
+ <div class="col-md-4">
29
+ <%= panel body: false, title: "Event Managers" do %>
30
+ <div class="panel-body">
31
+ <p>Current users that can fully manage this event</p>
32
+ </div>
33
+
34
+ <table class="table table-bordered table-condensed table-striped">
35
+ <tbody>
36
+ <% @event_managers.each do |user| %>
37
+ <tr>
38
+ <td><%= user.full_name %></td>
39
+ </tr>
40
+ <% end %>
41
+ </tbody>
42
+ </table>
43
+ <% end %>
44
+ </div>
45
+ </div>
46
+ <script>
47
+ $(document).ready(function() {
48
+ $('.permission_btn').on("ajax:success", function(e, content) {
49
+ if ($(this).is(".active")) {
50
+ $(this).addClass("btn-default");
51
+ $(this).removeClass("active").removeClass("btn-success");
52
+ } else {
53
+ $(this).addClass("active").addClass("btn-success");
54
+ $(this).removeClass("btn-default");
55
+ }
56
+ });
57
+ });
58
+ </script
@@ -5,11 +5,24 @@
5
5
  <div class="btn-group">
6
6
  <button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"><i class="icon-cog"></i> <span class="caret"></span></button>
7
7
  <ul class="dropdown-menu dropdown-menu-right icons-right">
8
- <li><%= link_to label_icon('Edit Workshop', :edit), edit_admin_workshop_url(@workshop) %></li>
9
- <li><%= link_to label_icon('Financial Details', 'icon-coin'), financials_admin_workshop_url(@workshop) %></li>
10
- <li><%= link_to label_icon('Show Duplicates', 'icon-copy'), admin_workshop_url(@workshop, duplicates: '1') %></li>
11
- <li><%= link_to label_icon('Lost Users', 'icon-users'), lost_users_admin_workshop_url(@workshop) %></li>
12
- <li><%= link_to 'Export Registrations (.csv)', admin_workshop_url(@workshop, format: 'csv') %></li>
8
+ <% if can?(:manage_event_registrations, @workshop) %>
9
+ <li class="divider"></li>
10
+ <li><%= link_to label_icon('Show Duplicates', 'icon-copy'), admin_workshop_url(@workshop, duplicates: '1') %></li>
11
+ <li><%= link_to label_icon('Lost Users', 'icon-users'), lost_users_admin_workshop_url(@workshop) %></li>
12
+ <li><%= link_to 'Export Registrations (.csv)', admin_workshop_url(@workshop, format: 'csv') %></li>
13
+ <% end %>
14
+ <% if can?(:manage_events, @workshop) %>
15
+ <li class="divider"></li>
16
+ <li><%= link_to label_icon('Edit Workshop', :edit), edit_admin_workshop_url(@workshop) %></li>
17
+ <% end %>
18
+ <% if can?(:manage_event_finances, @workshop) %>
19
+ <li class="divider"></li>
20
+ <li><%= link_to label_icon('Financial Details', 'icon-coin'), financials_admin_workshop_url(@workshop) %></li>
21
+ <% end %>
22
+ <% if can?(:manage_events, :all) %>
23
+ <li class="divider"></li>
24
+ <li><%= link_to label_icon('Permissions', 'icon-lock'), permissions_admin_workshop_url(@workshop) %></li>
25
+ <% end %>
13
26
 
14
27
  </ul>
15
28
  </div>
@@ -19,7 +32,11 @@
19
32
  <div class="row">
20
33
  <div class="col-md-9">
21
34
  <% toolbar = toolbar_btn(icons(:new), register_new_url(@workshop), target: '_blank', title: 'New Registration', class: "btn btn-link btn-icon") %>
22
- <% title = params[:duplicates].nil? ? 'Registrations' : 'Registrations (Duplicates)'%>
35
+ <% if can?(:manage_event_registrations, @workshop) || can?(:manage_event_finances, @workshop) %>
36
+ <% title = params[:duplicates].nil? ? 'Registrations' : 'Registrations (Duplicates)'%>
37
+ <% else %>
38
+ <% title = 'Registrations (only displaying personal registrations)' %>
39
+ <% end %>
23
40
  <%= panel title: title, toolbar: toolbar, body: false do %>
24
41
  <table id="registration_table" class="table table-striped table-bordered" data-source="<%= dm_event.admin_workshop_url(@workshop, duplicates: params[:duplicates]) %>">
25
42
  <thead>
@@ -28,8 +45,8 @@
28
45
  <th width=50>Receipt</th>
29
46
  <th>Name</th>
30
47
  <th width=25>Balance</th>
31
- <th width=85>Registered</th>
32
- <th width=85>Last Login</th>
48
+ <th class="date">Registered</th>
49
+ <th class="date">Last Login</th>
33
50
  </tr>
34
51
  </thead>
35
52
  <tbody>
@@ -38,10 +55,12 @@
38
55
  <% end %>
39
56
  </div>
40
57
 
41
- <div class="col-md-3">
42
- <%= panel header: false do %>
43
- <%= render partial: 'registration_stats', locals: {workshop: @workshop} %>
44
- <% end %>
45
- </div>
58
+ <% if can?(:manage_event_registrations, @workshop) || can?(:manage_event_finances, @workshop) %>
59
+ <div class="col-md-3">
60
+ <%= panel header: false do %>
61
+ <%= render partial: 'registration_stats', locals: {workshop: @workshop} %>
62
+ <% end %>
63
+ </div>
64
+ <% end %>
46
65
  </div>
47
66
 
@@ -1 +1 @@
1
- ActiveMerchant::Billing::Base.mode = :test unless Rails.env.production?
1
+ ActiveMerchant::Billing::Base.mode = :test unless Rails.env.production?
data/config/routes.rb CHANGED
@@ -8,6 +8,8 @@ DmEvent::Engine.routes.draw do
8
8
  match 'edit_system_email/:email_type', action: 'edit_system_email', as: 'edit_system_email', via: [:get, :post, :patch]
9
9
  get 'financials', action: 'financials'
10
10
  match 'lost_users', action: 'lost_users', via: [:get, :post, :patch]
11
+ match 'permissions', action: 'permissions', via: [:get, :post, :patch]
12
+ patch 'ajax_toggle_permission/:user_id/:role', action: 'ajax_toggle_permission', as: 'ajax_toggle_permission'
11
13
  patch 'send_payment_reminder_emails', action: 'send_payment_reminder_emails'
12
14
  match 'additional_configuration', action: 'additional_configuration', via: [:get, :patch]
13
15
  end
@@ -15,6 +15,5 @@ module DmEvent
15
15
  g.assets false
16
16
  g.helper false
17
17
  end
18
-
19
18
  end
20
- end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm_event
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1.5
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2016-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dm_core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.1.5
19
+ version: 4.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.1.5
26
+ version: 4.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dm_cms
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.2.1.5
33
+ version: 4.2.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.2.1.5
40
+ version: 4.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activemerchant
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -239,6 +239,7 @@ files:
239
239
  - app/views/dm_event/admin/workshops/index.html.erb
240
240
  - app/views/dm_event/admin/workshops/lost_users.html.erb
241
241
  - app/views/dm_event/admin/workshops/new.html.erb
242
+ - app/views/dm_event/admin/workshops/permissions.html.erb
242
243
  - app/views/dm_event/admin/workshops/show.html.erb
243
244
  - app/views/dm_event/admin/workshops/user_outstanding_balances.html.erb
244
245
  - app/views/dm_event/liquid_tags/_funding_project_status.html.erb
@@ -414,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
414
415
  version: '0'
415
416
  requirements: []
416
417
  rubyforge_project:
417
- rubygems_version: 2.5.1
418
+ rubygems_version: 2.4.5
418
419
  signing_key:
419
420
  specification_version: 4
420
421
  summary: Part of MokshaCms, Event Engine