From eefc7f8f62983549e334a3e425d9a7c2b17f8bdc Mon Sep 17 00:00:00 2001 From: Malte Swart Date: Thu, 2 Jul 2015 17:21:09 +0200 Subject: [PATCH] menu: make layout more compact --- app/locales/de.yml | 3 +- app/views/menu/_canteen.html.slim | 22 ++++++++++++++ app/views/menu/show.html.slim | 49 +++++++------------------------ 3 files changed, 35 insertions(+), 39 deletions(-) create mode 100644 app/views/menu/_canteen.html.slim diff --git a/app/locales/de.yml b/app/locales/de.yml index 2885f74b..2961b8e3 100644 --- a/app/locales/de.yml +++ b/app/locales/de.yml @@ -155,7 +155,8 @@ de: feedbacks: Nutzerrückmeldungen data_proposals: Änderungsvorschläge about: Die Mensa - more: "Mehr zu %{name}" + more: "Mehr zur Mensa" + more_with_name: "Mehr zu %{name}" menu: more_actions: "Auch für Fehlerberichte, Korrekturvorschläge ..." diff --git a/app/views/menu/_canteen.html.slim b/app/views/menu/_canteen.html.slim new file mode 100644 index 00000000..cd9e9b06 --- /dev/null +++ b/app/views/menu/_canteen.html.slim @@ -0,0 +1,22 @@ +section + #remote-canteens-show + header.page-header + h2.centered = canteen.name + ul.meals + = render partial: "canteens/day", locals: { day: canteen.days.find_by_date(@date) } + .content + p.action + i class=canteen_state_icon(canteen.fetch_state) + =t :canteen, canteen.fetch_state + ' + = '(' + t(:canteen, :last_update_at) + ' + = timeago_tag canteen.last_fetched_at + ' ) + br + - if @date.to_date == Time.zone.now.to_date + = link_to t(:canteen, :more, name: canteen.name), canteen_path(canteen), title: t(:canteen, :more_with_name, name: canteen.name), class: "btn btn-secondary" + - else + = link_to t(:canteen, :more, name: canteen.name), canteen_path(canteen, date: @date), title: t(:canteen, :more_with_name, name: canteen.name), class: "btn btn-secondary" + br + = t :menu, :more_actions diff --git a/app/views/menu/show.html.slim b/app/views/menu/show.html.slim index c5a54a90..e0f614cf 100644 --- a/app/views/menu/show.html.slim +++ b/app/views/menu/show.html.slim @@ -10,41 +10,14 @@ section = t :today - else = l @date.to_date, format: :with_weekday - -- @canteens.each do |canteen| - .row - .span8 - section - #remote-canteens-show - header.page-header - h2.centered = canteen.name - ul.meals - = render partial: "canteens/day", locals: { day: canteen.days.find_by_date(@date) } - - aside.span4 - section - header - h2=t(:canteen, :about) - .content - address= canteen.address - - if canteen.phone.present? - p.icon-phone#phone - =canteen.phone - - if canteen.email.present? - p.icon-envelope#email - =link_to canteen.email, "mailto:#{obj[:canteen].email}" - h4 - i class=canteen_state_icon(canteen.fetch_state) - =t :canteen, canteen.fetch_state - - unless canteen.fetch_state == :no_fetch_ever_message - p - =t :canteen, :last_update_at - br - = timeago_tag canteen.last_fetched_at - p.action - - if @date.to_date == Time.zone.now.to_date - = link_to t(:canteen, :more, name: canteen.name), canteen_path(canteen), class: "btn btn-secondary" - - else - = link_to t(:canteen, :more, name: canteen.name), canteen_path(canteen, date: @date), class: "btn btn-secondary" - br - = t :menu, :more_actions +.row + .span6 + - pos = 0 + - while pos < @canteens.size + = render partial: "canteen", locals: { canteen: @canteens[pos] } + - pos += 2 + .span6 + - pos = 1 + - while pos < @canteens.size + = render partial: "canteen", locals: { canteen: @canteens[pos] } + - pos += 2