mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
DRY up event export menus
This commit is contained in:
parent
0848df6948
commit
81bad2eb4d
3 changed files with 26 additions and 24 deletions
|
|
@ -25,6 +25,7 @@ module Admin
|
|||
@scheduled_event_distribution = @conference.scheduled_event_distribution
|
||||
@file_name = "events_for_#{@conference.short_title}"
|
||||
@event_export_option = params[:event_export_option]
|
||||
@export_formats = [:pdf, :csv, :xlsx]
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
|
|||
21
app/views/admin/events/_export_menu.haml
Normal file
21
app/views/admin/events/_export_menu.haml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
.btn-group
|
||||
%button.btn.btn-success.dropdown-toggle{ data: { toggle: 'dropdown' } }
|
||||
Export
|
||||
= export_format.upcase
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li
|
||||
= link_to 'All Events',
|
||||
admin_conference_program_events_path(conference_id,
|
||||
format: export_format,
|
||||
event_export_option: 'all')
|
||||
%li
|
||||
= link_to 'Confirmed Events',
|
||||
admin_conference_program_events_path(conference_id,
|
||||
format: export_format,
|
||||
event_export_option: 'confirmed')
|
||||
%li
|
||||
= link_to 'All Events with Comments',
|
||||
admin_conference_program_events_path(conference_id,
|
||||
format: export_format,
|
||||
event_export_option: 'all_with_comments')
|
||||
|
|
@ -13,30 +13,10 @@
|
|||
= link_to 'Add Event', new_admin_conference_program_event_path(@conference.short_title), class: 'button btn btn-default btn-info'
|
||||
|
||||
- if can? :read, Event
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export PDF
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li= link_to 'All Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all')
|
||||
%li= link_to 'Confirmed Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'confirmed')
|
||||
%li= link_to 'All Events with Comments', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all_with_comments')
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export CSV
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li= link_to 'All', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'all')
|
||||
%li= link_to 'Confirmed', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'confirmed')
|
||||
%li= link_to 'All with Comments', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'all_with_comments')
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export XLS
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li= link_to 'All', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'all')
|
||||
%li= link_to 'Confirmed', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'confirmed')
|
||||
%li= link_to 'All with Comments', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'all_with_comments')
|
||||
- @export_formats.each do |export_format|
|
||||
= render 'export_menu',
|
||||
export_format: export_format,
|
||||
conference_id: @conference.short_title
|
||||
|
||||
%p.text-muted
|
||||
All the submissions of your speakers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue