Moved withdrawn_event check to helper
Signed-off-by: Carlos Coelho <carlos@pencillabs.com>
This commit is contained in:
parent
e268acec23
commit
6beb9f68ab
3 changed files with 13 additions and 5 deletions
|
|
@ -160,9 +160,6 @@ module Admin
|
|||
# get campaigns
|
||||
@campaigns = @conference.get_campaigns
|
||||
|
||||
# get withdrawn events
|
||||
@withdrawn_events = @conference.program.events.where(state: :withdrawn)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: @conference.to_json }
|
||||
|
|
|
|||
11
app/helpers/admin/conference_helper.rb
Normal file
11
app/helpers/admin/conference_helper.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
module Admin
|
||||
module ConferenceHelper
|
||||
def withdrawn_events?(conference)
|
||||
conference.program.events.where(state: :withdrawn).empty?
|
||||
end
|
||||
|
||||
def withdrawn_events_count(conference)
|
||||
conference.program.events.where(state: :withdrawn).count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
- if !@withdrawn_events.empty?
|
||||
- if !withdrawn_events?(@conference)
|
||||
.alert.alert-warning.alert-dismissible{role: 'alert'}
|
||||
%button.close{data: {dismiss: 'alert'}, aria: {label: 'Close'}, type: 'button'}
|
||||
%span{aria: {hidden: 'true'}}
|
||||
×
|
||||
Sadly #{pluralize(@withdrawn_events.count, 'event')} #{'was'.pluralize(@withdrawn_events.count)} withdrawn.
|
||||
Sadly #{pluralize(withdrawn_events_count(@conference), 'event')} #{'was'.pluralize(withdrawn_events_count(@conference))} withdrawn.
|
||||
= link_to 'Click here', admin_conference_program_events_path(@conference.short_title)
|
||||
|
||||
%h1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue