From b245f48fbe334fcd360afbd1f505754eb24bfe08 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Fri, 7 Oct 2016 04:42:01 +0300 Subject: [PATCH] Reimplement conferences listing --- .../management/_record_tables.scss | 10 ++++ .../conferences/_conference.html.slim | 55 ++++++++++++++----- .../management/conferences/index.html.slim | 24 +++----- app/views/management/events/index.html.slim | 3 + config/routes.rb | 2 +- 5 files changed, 62 insertions(+), 32 deletions(-) diff --git a/app/assets/stylesheets/management/_record_tables.scss b/app/assets/stylesheets/management/_record_tables.scss index 634febe..80438a8 100644 --- a/app/assets/stylesheets/management/_record_tables.scss +++ b/app/assets/stylesheets/management/_record_tables.scss @@ -21,3 +21,13 @@ th.action, td.action { .fa-minus-square-o { color: $color-failure; } } } + +.conference-title { + display: inline-block; + @include button-size($padding-base-vertical, $padding-base-horizontal, $font-size-base, $line-height-base, $btn-border-radius-base); +} + +.conference-actions { + float: right; + text-align: right; +} diff --git a/app/views/management/conferences/_conference.html.slim b/app/views/management/conferences/_conference.html.slim index 70974b8..cb02bf4 100644 --- a/app/views/management/conferences/_conference.html.slim +++ b/app/views/management/conferences/_conference.html.slim @@ -1,16 +1,43 @@ tr - td = conference.title - td.hidden-xs.hidden-sm = l conference.start_date.to_date, format: :long - td.hidden-xs.hidden-sm = l conference.end_date.to_date, format: :long - td.action - = render partial: 'management/call_for_participations/status', locals: {conference: conference} + td + .conference-title + = conference.title + .conference-actions + .visible-xs.dropdown + .button.btn.btn-primary.dropdown-toggle type="button" data-toggle="dropdown" + = icon 'ellipsis-v' + ul.dropdown-menu.dropdown-menu-right + li + = link_to management_conference_path(conference) + = icon 'line-chart', t('actions.view.button', model: Conference.model_name.human) + li + = link_to [:management, conference, :events] do + => icon 'file-text', Event.model_name.human(count: 2).mb_chars.capitalize + li + = link_to [:management, conference, :volunteers] do + => icon 'hand-stop-o', t('activerecord.models.volunteer', count: 2).mb_chars.capitalize + li + = link_to [:management, conference, :personal_profiles] do + => icon 'user', t('activerecord.models.personal_profile', count: 2).mb_chars.capitalize + li.divider + li + = link_to edit_management_conference_path(conference) + = icon :edit, t('actions.edit.button', model: Conference.model_name.human) + li + = link_to management_conference_path(conference), class: [conference.events.any? ? 'disabled' : nil], method: :delete, data: {confirm: t('actions.are_you_sure')} + = icon :trash, t('actions.destroy.button', model: Conference.model_name.human) - td = conference.events.count - td.actions - div.btn-group.btn-group-sm - = link_to management_conference_path(conference), title: t('actions.view.button', model: Conference.model_name.human), class: 'btn btn-info' - = icon :eye - = link_to edit_management_conference_path(conference), title: t('actions.edit.button', model: Conference.model_name.human), class: 'btn btn-primary' - = icon :edit - = link_to management_conference_path(conference), title: t('actions.destroy.button', model: Conference.model_name.human), class: ['btn', 'btn-danger', conference.events.any? ? 'disabled' : nil], method: :delete, data: {confirm: t('actions.are_you_sure')} - = icon :trash + .hidden-xs.btn-group + = link_to management_conference_path(conference), class: 'btn btn-success' + = icon 'line-chart', t('actions.view.button', model: Conference.model_name.human) + = link_to [:management, conference, :events], class: 'btn btn-success' do + => icon 'file-text', Event.model_name.human(count: 2).mb_chars.capitalize + = link_to [:management, conference, :volunteers], class: 'btn btn-success' do + => icon 'hand-stop-o', t('activerecord.models.volunteer', count: 2).mb_chars.capitalize + = link_to [:management, conference, :personal_profiles], class: 'btn btn-success' do + => icon 'user', t('activerecord.models.personal_profile', count: 2).mb_chars.capitalize + .hidden-xs.btn-group< + = link_to edit_management_conference_path(conference), title: t('actions.edit.button', model: Conference.model_name.human), class: 'btn btn-warning' + = icon :edit + = link_to management_conference_path(conference), title: t('actions.destroy.button', model: Conference.model_name.human), class: ['btn', 'btn-danger', conference.events.any? ? 'disabled' : nil], method: :delete, data: {confirm: t('actions.are_you_sure')} + = icon :trash diff --git a/app/views/management/conferences/index.html.slim b/app/views/management/conferences/index.html.slim index 9ffc1a0..452992c 100644 --- a/app/views/management/conferences/index.html.slim +++ b/app/views/management/conferences/index.html.slim @@ -1,23 +1,13 @@ - content_for :title = Conference.model_name.human(count: 2).mb_chars.capitalize - -.row - .col-lg-12 +.container + .row + h1.page-header + = Conference.model_name.human(count: 2).mb_chars.titleize .panel.panel-default - .panel-heading - h2.panel-title = Conference.model_name.human(count: 2).mb_chars.capitalize - .panel-body - table.table.table-striped.table-hover.record-table#conferences - thead - tr - th = Conference.human_attribute_name :title - th.hidden-xs.hidden-sm = Conference.human_attribute_name :start_date - th.hidden-xs.hidden-sm = Conference.human_attribute_name :end_date - th.action = Conference.human_attribute_name :call_for_papers_open - th = Conference.human_attribute_name :submissions - th.actions - tbody - = render @conferences + table.table.table-striped.table-hover + tbody + = render @conferences .panel-footer .text-right = link_to new_management_conference_path, class: 'btn btn-primary' diff --git a/app/views/management/events/index.html.slim b/app/views/management/events/index.html.slim index 453e2f3..998493a 100644 --- a/app/views/management/events/index.html.slim +++ b/app/views/management/events/index.html.slim @@ -1,3 +1,6 @@ +- content_for :title + = Event.model_name.human(count: 2).mb_chars.capitalize + .row h1.page-header = Event.model_name.human(count: 2).mb_chars.titleize diff --git a/config/routes.rb b/config/routes.rb index 0d9b598..90673b6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -29,7 +29,7 @@ Rails.application.routes.draw do end namespace :management do - root to: 'home#index' + root to: 'conferences#index' resources :conferences do resources :events