diff --git a/app/helpers/admin/conference_helper.rb b/app/helpers/admin/conference_helper.rb new file mode 100644 index 00000000..5130abac --- /dev/null +++ b/app/helpers/admin/conference_helper.rb @@ -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 diff --git a/app/views/admin/conference/show.html.haml b/app/views/admin/conference/show.html.haml index 7ce1c408..01c17416 100644 --- a/app/views/admin/conference/show.html.haml +++ b/app/views/admin/conference/show.html.haml @@ -1,3 +1,11 @@ +- 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(@conference), 'event')} #{'was'.pluralize(withdrawn_events_count(@conference))} withdrawn. + = link_to 'Click here', admin_conference_program_events_path(@conference.short_title) + %h1 %span.fa.fa-tachometer Dashboard for #{@conference.title} diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 5d8d9be2..41a2d06d 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -13,3 +13,6 @@ # ActiveSupport::Inflector.inflections do |inflect| # inflect.acronym 'RESTful' # end +ActiveSupport::Inflector.inflections do |inflect| + inflect.irregular "was", "were" +end