From eceed74020a26252430d33b92e56df691550afa7 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 15 Oct 2014 01:07:40 +0300 Subject: [PATCH] Conference review UI --- .../management/_dashboard.css.scss | 3 + .../management/application.css.scss | 3 +- app/models/event.rb | 2 + .../management/conferences/show.html.slim | 71 +++++++++++++++++++ config/locales/bg.yml | 16 +++++ config/locales/views.bg.yml | 3 +- config/routes.rb | 27 ++++--- 7 files changed, 108 insertions(+), 17 deletions(-) create mode 100644 app/assets/stylesheets/management/_dashboard.css.scss create mode 100644 app/views/management/conferences/show.html.slim diff --git a/app/assets/stylesheets/management/_dashboard.css.scss b/app/assets/stylesheets/management/_dashboard.css.scss new file mode 100644 index 0000000..93486ce --- /dev/null +++ b/app/assets/stylesheets/management/_dashboard.css.scss @@ -0,0 +1,3 @@ +.huge { + font-size: 40px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/management/application.css.scss b/app/assets/stylesheets/management/application.css.scss index 67a1f35..563c000 100644 --- a/app/assets/stylesheets/management/application.css.scss +++ b/app/assets/stylesheets/management/application.css.scss @@ -11,4 +11,5 @@ @import "layout"; @import "navigation"; @import "forms"; -@import "record_tables"; \ No newline at end of file +@import "record_tables"; +@import "dashboard"; \ No newline at end of file diff --git a/app/models/event.rb b/app/models/event.rb index 426c4f5..284707e 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -16,6 +16,8 @@ class Event < ActiveRecord::Base enum state: [:undecided, :approved, :rejected, :backup] + scope :confirmed, -> { where.not confirmed_at: nil } + # XXX: this belongs in a decorator STATE_TO_GLYPH = {undecided: 'question-sign', rejected: 'remove', approved: 'ok', backup: 'retweet'} STATE_TO_CLASS = {undecided: 'warning', rejected: 'danger', approved: 'success', backup: 'info'} diff --git a/app/views/management/conferences/show.html.slim b/app/views/management/conferences/show.html.slim new file mode 100644 index 0000000..59b893b --- /dev/null +++ b/app/views/management/conferences/show.html.slim @@ -0,0 +1,71 @@ +- content_for :title + = @conference.title +.row + .col-lg-12 + h1.page-header + = @conference.title +.row + .col-lg-3.col-md-6 + .panel.panel-primary + .panel-heading + .row + .col-xs-3 + = fa_icon 'bullhorn 5x' + .col-xs-9.text-right + .huge + = @conference.events.count + div + = t Event.model_name.human(count: @conference.events.count) + = link_to management_conference_events_path(@conference) + .panel-footer.text-primary + span.pull-left = t 'views.conference.see_details' + span.pull-right = fa_icon 'arrow-circle-right' + span.clearfix + .col-lg-3.col-md-6 + .panel.panel-danger + .panel-heading + .row + .col-xs-3 + = fa_icon 'thumbs-down 5x' + .col-xs-9.text-right + .huge + = @conference.events.rejected.count + div + = t 'event_states.rejected', count: @conference.events.rejected.count + = link_to rejected_management_conference_events_path(@conference) + .panel-footer.text-danger + span.pull-left = t 'views.conference.see_details' + span.pull-right = fa_icon 'arrow-circle-right' + span.clearfix + .col-lg-3.col-md-6 + .panel.panel-info + .panel-heading + .row + .col-xs-3 + = fa_icon 'thumbs-up 5x' + .col-xs-9.text-right + .huge + = @conference.events.approved.count + div + = t 'event_states.approved', count: @conference.events.approved.count + = link_to approved_management_conference_events_path(@conference) + .panel-footer.text-info + span.pull-left = t 'views.conference.see_details' + span.pull-right = fa_icon 'arrow-circle-right' + span.clearfix + .col-lg-3.col-md-6 + .panel.panel-success + .panel-heading + .row + .col-xs-3 + = fa_icon 'check 5x' + .col-xs-9.text-right + .huge + = @conference.events.approved.confirmed.count + div + = t 'event_states.confirmed', count: @conference.events.approved.confirmed.count + = link_to confirmed_management_conference_events_path(@conference) + .panel-footer.text-success + span.pull-left = t 'views.conference.see_details' + span.pull-right = fa_icon 'arrow-circle-right' + span.clearfix diff --git a/config/locales/bg.yml b/config/locales/bg.yml index e855399..73ccbf9 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -39,6 +39,22 @@ bg: new: title_f: Нова %{model} title_m: Нов %{model} + event_states: + undecided: + one: 'Нерешено' + other: 'Нерешени' + approved: + one: 'Одобрено' + other: 'Одобрени' + rejected: + one: 'Отхвърлено' + other: 'Отхвърлени' + backup: + one: 'В резерв' + other: 'В резерв' + confirmed: + one: 'Потвърдено' + other: 'Потвърдени' event_mailer: acceptance_notification: subject: 'Предложението ви за %{conference} за %{submission_type} „%{title}“ е одобрено' diff --git a/config/locales/views.bg.yml b/config/locales/views.bg.yml index 5d687fc..5377235 100644 --- a/config/locales/views.bg.yml +++ b/config/locales/views.bg.yml @@ -74,4 +74,5 @@ bg: workshop_was_successfully_confirmed: "Уъркшопът беше потвърден успешно" views: conference: - info: Информация за конференция \ No newline at end of file + info: Информация за конференция + see_details: Повече информация \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f0e89ba..a102e58 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -23,7 +23,18 @@ Rails.application.routes.draw do end resources :events do - patch 'state' + member do + patch 'state' + end + + collection do + get 'approved' + get 'rejected' + get 'undecided' + get 'backup' + get 'confirmed' + post 'send_acceptance_notifications' + end end end @@ -32,20 +43,6 @@ Rails.application.routes.draw do post 'toggle_admin' end end - - resources :events do - member do - patch 'state' - end - - collection do - get 'approved' - get 'rejected' - get 'undecided' - get 'backup' - post 'send_acceptance_notifications' - end - end end root 'home#index'