From 2fe1fd2f098d180b2028eb4f69e3d1c95d54e6f2 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 21:08:29 +0300 Subject: [PATCH] OpenFest: Implement WelcomeController#index view --- .../open_fest/application_controller.rb | 8 ++++++ .../layouts/open_fest/application.html.erb | 25 ++++++++++++------- .../views/open_fest/welcome/_event_type.slim | 1 + .../app/views/open_fest/welcome/_track.slim | 6 +++++ .../views/open_fest/welcome/index.html.erb | 2 -- .../app/views/open_fest/welcome/index.slim | 14 +++++++++++ lib/open_fest/config/locales/views.bg.yml | 3 +++ 7 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 lib/open_fest/app/views/open_fest/welcome/_event_type.slim create mode 100644 lib/open_fest/app/views/open_fest/welcome/_track.slim delete mode 100644 lib/open_fest/app/views/open_fest/welcome/index.html.erb create mode 100644 lib/open_fest/app/views/open_fest/welcome/index.slim diff --git a/lib/open_fest/app/controllers/open_fest/application_controller.rb b/lib/open_fest/app/controllers/open_fest/application_controller.rb index a6f561f..a8c4551 100644 --- a/lib/open_fest/app/controllers/open_fest/application_controller.rb +++ b/lib/open_fest/app/controllers/open_fest/application_controller.rb @@ -1,4 +1,12 @@ module OpenFest class ApplicationController < ActionController::Base + before_action :set_current_conference + + private + + #TODO: Make this display a nice 404 message when the conference is not found + def set_current_conference + @current_conference ||= Conference.find(1) + end end end diff --git a/lib/open_fest/app/views/layouts/open_fest/application.html.erb b/lib/open_fest/app/views/layouts/open_fest/application.html.erb index 1cf6ea2..162267d 100644 --- a/lib/open_fest/app/views/layouts/open_fest/application.html.erb +++ b/lib/open_fest/app/views/layouts/open_fest/application.html.erb @@ -1,14 +1,21 @@ - - OpenFest - <%= stylesheet_link_tag "open_fest/application", media: "all" %> - <%= javascript_include_tag "open_fest/application" %> - <%= csrf_meta_tags %> - - + + + <% if content_for? :title %> + <%= yield :title %> | + <% end %> + <%= @current_conference.try :title %> + -<%= yield %> + <%= stylesheet_link_tag "open_fest/application", media: "all" %> + <%= javascript_include_tag "open_fest/application" %> + <%= csrf_meta_tags %> + + - +
+ <%= yield %> +
+ diff --git a/lib/open_fest/app/views/open_fest/welcome/_event_type.slim b/lib/open_fest/app/views/open_fest/welcome/_event_type.slim new file mode 100644 index 0000000..e8646be --- /dev/null +++ b/lib/open_fest/app/views/open_fest/welcome/_event_type.slim @@ -0,0 +1 @@ +=> link_to t('views.welcome.submit_event', event_type: event_type.name.mb_chars.downcase), '#', class: 'btn-link btn-link-large' diff --git a/lib/open_fest/app/views/open_fest/welcome/_track.slim b/lib/open_fest/app/views/open_fest/welcome/_track.slim new file mode 100644 index 0000000..1818ca1 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/welcome/_track.slim @@ -0,0 +1,6 @@ +li + p + strong + = track.name + span<> – + = track.description diff --git a/lib/open_fest/app/views/open_fest/welcome/index.html.erb b/lib/open_fest/app/views/open_fest/welcome/index.html.erb deleted file mode 100644 index e21282d..0000000 --- a/lib/open_fest/app/views/open_fest/welcome/index.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Welcome#index

-

Find me in app/views/open_fest/welcome/index.html.erb

diff --git a/lib/open_fest/app/views/open_fest/welcome/index.slim b/lib/open_fest/app/views/open_fest/welcome/index.slim new file mode 100644 index 0000000..ead199d --- /dev/null +++ b/lib/open_fest/app/views/open_fest/welcome/index.slim @@ -0,0 +1,14 @@ +h1.entry-title = t :home_title, conference: @current_conference.title + += simple_format @current_conference.description + +p = t :what_we_ask + +ul + = render partial: 'track', collection: @current_conference.tracks + +p = t :license_notice + +- if @current_conference.call_for_participation.in_progress? + .centered.large + = render partial: 'event_type', collection: @current_conference.event_types diff --git a/lib/open_fest/config/locales/views.bg.yml b/lib/open_fest/config/locales/views.bg.yml index d60d599..0fae951 100644 --- a/lib/open_fest/config/locales/views.bg.yml +++ b/lib/open_fest/config/locales/views.bg.yml @@ -1,4 +1,7 @@ bg: + views: + welcome: + submit_event: "Предложи %{event_type}" home_title: "%{conference} - зов за лектори" what_we_ask: 'Бихме искали да получим предложенията Ви за лекции и уъркшопи, принадлежащи към следните категории до 30 септември 2014г.:' license_notice: 'Имайте предвид, че презентациите ви впоследствие ще бъдат публикувани с лиценз CC-BY-ND (Creative Commons – Attribution – No derivatives).'