Implement event filtering in the admin interface
This commit is contained in:
parent
90faed37b8
commit
9e27186b3a
|
@ -31,3 +31,9 @@ th.action, td.action {
|
||||||
float: right;
|
float: right;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: $screen-md-min) {
|
||||||
|
#filters {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,9 @@ module Management
|
||||||
class EventsController < ManagementController
|
class EventsController < ManagementController
|
||||||
def index
|
def index
|
||||||
@conference = find_conference
|
@conference = find_conference
|
||||||
@events = @conference.events.order(:title).includes(:proposition, :proposer, :track, :event_type)
|
@filters = params[:filters] || {}
|
||||||
|
@events = EventSearch.new(scope: Event.where(conference: @conference).eager_load(:proposition, :proposer, :track, :event_type), filters: params[:filters]).results
|
||||||
|
# @events = @conference.events.order(:title).includes(:proposition, :proposer, :track, :event_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class EventSearch
|
||||||
|
include SearchObject.module
|
||||||
|
|
||||||
|
option(:title) { |scope, value| scope.where title: value }
|
||||||
|
option(:language) { |scope, value| scope.where language: value }
|
||||||
|
option(:track_id) { |scope, value| scope.where track_id: value }
|
||||||
|
option(:event_type_id) { |scope, value| scope.where event_type_id: value }
|
||||||
|
option(:status) { |scope, value| scope.joins(:proposition).where(propositions: {status: value}) }
|
||||||
|
end
|
|
@ -1,17 +1,20 @@
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
= event.title
|
dl.dl-horizontal
|
||||||
|
dt = Event.human_attribute_name :title
|
||||||
|
dd = event.title
|
||||||
- if event.subtitle.present?
|
- if event.subtitle.present?
|
||||||
br
|
dt = Event.human_attribute_name :subtitle
|
||||||
span.small = event.subtitle
|
dd = event.subtitle
|
||||||
|
dt = EventType.model_name.human.mb_chars.titleize
|
||||||
|
dd = event.event_type.name
|
||||||
|
dt = Event.human_attribute_name :track
|
||||||
|
dd = event.track.name
|
||||||
|
dt = Event.human_attribute_name :language
|
||||||
|
dd = t("locales.#{event.language}")
|
||||||
|
|
||||||
td
|
td
|
||||||
= participant_names_or_emails(event).join(', ')
|
= participant_names_or_emails(event).join(', ')
|
||||||
td
|
|
||||||
= t("locales.#{event.language}")
|
|
||||||
td
|
|
||||||
= event.track.name
|
|
||||||
td
|
|
||||||
= event.event_type.name
|
|
||||||
td.action
|
td.action
|
||||||
.dropdown
|
.dropdown
|
||||||
button class="btn btn-sm dropdown-toggle btn-#{proposition_status_class(event.status)}" type="button" data-toggle="dropdown" title="#{t "status.#{event.status}"}"
|
button class="btn btn-sm dropdown-toggle btn-#{proposition_status_class(event.status)}" type="button" data-toggle="dropdown" title="#{t "status.#{event.status}"}"
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
tr
|
||||||
|
td colspan="20"
|
||||||
|
= t '.no_records_found'
|
|
@ -1,21 +1,82 @@
|
||||||
- content_for :title
|
- content_for :title
|
||||||
= Event.model_name.human(count: 2).mb_chars.capitalize
|
= Event.model_name.human(count: 2).mb_chars.capitalize
|
||||||
|
/.row
|
||||||
|
/ ul.nav.nav-tabs
|
||||||
|
/ = content_tag :li, role: "presentation", class: params[:event_type_id].blank? ? 'active' : nil
|
||||||
|
/ = link_to management_conference_events_path(current_conference)
|
||||||
|
/ = t '.all'
|
||||||
|
/ - current_conference.event_types.each do |event_type|
|
||||||
|
/ = content_tag :li, role: "presentation", class: params[:event_type_id].to_i == event_type.id ? 'active' : nil
|
||||||
|
/ = link_to management_conference_events_path(current_conference, event_type_id: event_type.id)
|
||||||
|
/ = event_type.name
|
||||||
|
/
|
||||||
|
|
||||||
.row
|
.row
|
||||||
|
.col-lg-12
|
||||||
h1.page-header
|
h1.page-header
|
||||||
= Event.model_name.human(count: 2).mb_chars.titleize
|
= Event.model_name.human(count: 2).mb_chars.titleize
|
||||||
|
.row.visible-sm
|
||||||
|
.col-xs-12
|
||||||
|
= link_to t('.filters'), '#filters', aria_expanded: true, aria_controls: 'filters', data: {toggle: 'collapse'}, role: 'button', class: 'btn btn-info'
|
||||||
.row
|
.row
|
||||||
|
.col-md-2.collapse#filters
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
table.table
|
.panel-heading
|
||||||
|
= EventType.model_name.human.mb_chars.titleize
|
||||||
|
.panel-body
|
||||||
|
ul.nav.nav-pills.nav-stacked
|
||||||
|
= content_tag :li, role: "presentation", class: @filters[:event_type_id].blank? ? 'active' : nil
|
||||||
|
= link_to management_conference_events_path(current_conference, filters: @filters.except(:event_type_id))
|
||||||
|
= t '.all'
|
||||||
|
- current_conference.event_types.each do |event_type|
|
||||||
|
= content_tag :li, role: "presentation", class: @filters[:event_type_id].to_i == event_type.id ? 'active' : nil
|
||||||
|
= link_to management_conference_events_path(current_conference, filters: @filters.merge({event_type_id: event_type.id}))
|
||||||
|
= event_type.name
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading
|
||||||
|
= Event.human_attribute_name(:track)
|
||||||
|
.panel-body
|
||||||
|
ul.nav.nav-pills.nav-stacked
|
||||||
|
= content_tag :li, role: "presentation", class: @filters[:track].blank? ? 'active' : nil
|
||||||
|
= link_to management_conference_events_path(current_conference, filters: @filters.except(:track))
|
||||||
|
= t '.all'
|
||||||
|
- current_conference.tracks.each do |track|
|
||||||
|
= content_tag :li, role: "presentation", class: @filters[:track] == track.id.to_s ? 'active' : nil
|
||||||
|
= link_to management_conference_events_path(current_conference, filters: @filters.merge({track: track.id}))
|
||||||
|
= track.name
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading
|
||||||
|
= Event.human_attribute_name(:language)
|
||||||
|
.panel-body
|
||||||
|
ul.nav.nav-pills.nav-stacked
|
||||||
|
= content_tag :li, role: "presentation", class: @filters[:language].blank? ? 'active' : nil
|
||||||
|
= link_to management_conference_events_path(current_conference, filters: @filters.except(:language))
|
||||||
|
= t '.all'
|
||||||
|
- I18n.available_locales.map(&:to_s).each do |language|
|
||||||
|
= content_tag :li, role: "presentation", class: @filters[:language] == language ? 'active' : nil
|
||||||
|
= link_to management_conference_events_path(current_conference, filters: @filters.merge({language: language}))
|
||||||
|
= t("locales.#{language}")
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading
|
||||||
|
= Proposition.human_attribute_name(:status)
|
||||||
|
.panel-body
|
||||||
|
ul.nav.nav-pills.nav-stacked
|
||||||
|
= content_tag :li, role: "presentation", class: @filters[:status].blank? ? 'active' : nil
|
||||||
|
= link_to management_conference_events_path(current_conference, filters: @filters.except(:status))
|
||||||
|
= t '.all'
|
||||||
|
- Proposition.statuses.each do |status_name, status_id|
|
||||||
|
= content_tag :li, role: "presentation", class: @filters[:status] == status_id.to_s ? 'active' : nil
|
||||||
|
= link_to management_conference_events_path(current_conference, filters: @filters.merge({status: status_id}))
|
||||||
|
= t "activerecord.attributes.proposition.statuses.#{status_name}"
|
||||||
|
.col-md-10
|
||||||
|
.panel.panel-default
|
||||||
|
table.table.table-striped.table-hover
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th = Event.human_attribute_name(:title)
|
th = Event.model_name.human.mb_chars.titleize
|
||||||
th = Event.human_attribute_name(:user)
|
th = Event.human_attribute_name(:user)
|
||||||
th = Event.human_attribute_name(:language)
|
|
||||||
th = Track.model_name.human
|
|
||||||
th = Event.human_attribute_name(:type)
|
|
||||||
th.action
|
th.action
|
||||||
= Event.human_attribute_name(:status)
|
= Event.human_attribute_name(:status)
|
||||||
th.actions
|
th.actions
|
||||||
tbody
|
tbody
|
||||||
= render partial: 'event', collection: @events
|
= render(partial: 'event', collection: @events) || render(partial: 'no_records')
|
||||||
|
|
|
@ -3,6 +3,11 @@ bg:
|
||||||
conferences:
|
conferences:
|
||||||
show:
|
show:
|
||||||
cfp_status: 'Състояние на CFP:'
|
cfp_status: 'Състояние на CFP:'
|
||||||
|
events:
|
||||||
|
index:
|
||||||
|
all: "Всички"
|
||||||
|
no_records:
|
||||||
|
no_records_found: 'Не бяха открити записи, които да отговарят на изискванията'
|
||||||
abstract: "Резюме"
|
abstract: "Резюме"
|
||||||
helpers:
|
helpers:
|
||||||
submit:
|
submit:
|
||||||
|
@ -33,6 +38,13 @@ bg:
|
||||||
title: "Преглед на %{model}"
|
title: "Преглед на %{model}"
|
||||||
activerecord:
|
activerecord:
|
||||||
attributes:
|
attributes:
|
||||||
|
proposition:
|
||||||
|
status: Състояние
|
||||||
|
statuses:
|
||||||
|
undecided: Неопределено
|
||||||
|
approved: Одобрено
|
||||||
|
rejected: Отхвърлено
|
||||||
|
backup: Резерва
|
||||||
conference:
|
conference:
|
||||||
description: "Описание"
|
description: "Описание"
|
||||||
email: E-mail
|
email: E-mail
|
||||||
|
|
Loading…
Reference in New Issue