From 2185129e55789ef478ae8e06c818501c88a1cd9d Mon Sep 17 00:00:00 2001 From: Godwin Date: Sat, 5 Aug 2017 19:19:46 -0700 Subject: [PATCH] Added house rules to housing admin and review --- app/assets/stylesheets/_admin.scss | 12 +++++- app/assets/stylesheets/_application.scss | 37 ------------------- .../conference_administration_controller.rb | 2 + app/helpers/geocoder_helper.rb | 10 ++++- app/helpers/widgets_helper.rb | 8 ++-- .../_hosts_table.html.haml | 31 ++++++++++------ .../registration_steps/_review.html.haml | 10 +++++ app/views/shared/_navbar.html.haml | 2 +- config/locales/en.yml | 4 ++ 9 files changed, 59 insertions(+), 57 deletions(-) diff --git a/app/assets/stylesheets/_admin.scss b/app/assets/stylesheets/_admin.scss index 622af28..c765bc1 100644 --- a/app/assets/stylesheets/_admin.scss +++ b/app/assets/stylesheets/_admin.scss @@ -123,6 +123,7 @@ table, .table { td, .table-td { &.inner-table { padding: 0.5em; + vertical-align: top; table { margin: 0; @@ -133,6 +134,10 @@ table, .table { &.bold { @include font-family(secondary); } + + .rules { + font-size: 0.75em; + } } tbody th { @@ -859,7 +864,7 @@ nav.sub-menu { min-width: 15em; } - .host-notes { + .host-notes, .house-rules { @include font-family(primary); font-size: 0.85em; border: 0.1em solid $light-gray; @@ -876,6 +881,11 @@ nav.sub-menu { } } + .house-rules { + max-height: 30em; + overflow: auto; + } + .guest-notes { position: relative; float: left; diff --git a/app/assets/stylesheets/_application.scss b/app/assets/stylesheets/_application.scss index eceec87..e4c6a6f 100644 --- a/app/assets/stylesheets/_application.scss +++ b/app/assets/stylesheets/_application.scss @@ -153,43 +153,6 @@ table, .table { } } - // td, .table-td { - // &.inner-table { - // padding: 0; - - // table { - // margin: 0; - // width: 100%; - // } - - // tr:first-child { - // td, th { - // border-top: 0; - // } - // } - - // tr:last-child { - // td, th { - // border-bottom: 0; - // } - // } - - // td, th { - // &:first-child { - // border-left: 0 - // } - - // &:last-child { - // border-right: 0 - // } - // } - // } - - // &.bold { - // @include font-family(secondary); - // } - // } - tbody th { width: 0.1rem; } diff --git a/app/controllers/conference_administration_controller.rb b/app/controllers/conference_administration_controller.rb index 82d4529..a84416c 100644 --- a/app/controllers/conference_administration_controller.rb +++ b/app/controllers/conference_administration_controller.rb @@ -479,8 +479,10 @@ class ConferenceAdministrationController < ApplicationController end end + @excel_data[:data] << host_data end + return respond_to do |format| format.xlsx { render xlsx: '../conferences/stats', filename: "housing" } end diff --git a/app/helpers/geocoder_helper.rb b/app/helpers/geocoder_helper.rb index b607da3..ed1507f 100644 --- a/app/helpers/geocoder_helper.rb +++ b/app/helpers/geocoder_helper.rb @@ -85,8 +85,14 @@ module GeocoderHelper end def location_link(location) - return '' unless location.present? && location.address.present? - content_tag(:a, (_!location.address), href: "http://www.google.com/maps/place/#{location.latitude},#{location.longitude}") + return '' unless location.present? + address = if location.is_a?(Location) + location.street + else + location.address + end + return '' unless address.present? + content_tag(:a, (_!address), href: "http://www.google.com/maps/place/#{location.latitude},#{location.longitude}") end def same_city?(location1, location2) diff --git a/app/helpers/widgets_helper.rb b/app/helpers/widgets_helper.rb index b2f2a0a..44fe4c3 100644 --- a/app/helpers/widgets_helper.rb +++ b/app/helpers/widgets_helper.rb @@ -112,20 +112,20 @@ module WidgetsHelper @housing_data[id][:guest_data][guest_id][:errors].each do |error, value| if value.is_a?(Array) value.each do |v| - status_html += content_tag(:li, _("errors.messages.housing.space.#{error.to_s}", vars: v)) + status_html += content_tag(:li, _("errors.messages.housing.space.#{error.to_s}", vars: v).html_safe) end else - status_html += content_tag(:li, _("errors.messages.housing.space.#{error.to_s}", vars: value)) + status_html += content_tag(:li, _("errors.messages.housing.space.#{error.to_s}", vars: value).html_safe) end end @housing_data[id][:guest_data][guest_id][:warnings].each do |error, value| if value.is_a?(Array) value.each do |v| - status_html += content_tag(:li, _("warnings.messages.housing.space.#{error.to_s}", v)) + status_html += content_tag(:li, _("warnings.messages.housing.space.#{error.to_s}", v).html_safe) end else - status_html += content_tag(:li, _("warnings.messages.housing.space.#{error.to_s}", vars: value)) + status_html += content_tag(:li, _("warnings.messages.housing.space.#{error.to_s}", vars: value).html_safe) end end diff --git a/app/views/conference_administration/_hosts_table.html.haml b/app/views/conference_administration/_hosts_table.html.haml index 21ed137..aad077f 100644 --- a/app/views/conference_administration/_hosts_table.html.haml +++ b/app/views/conference_administration/_hosts_table.html.haml @@ -8,15 +8,22 @@ - first_row = true %table.hosts.admin-edit - - @hosts.each do |id, registration| - - unless first_row - %tr.spacer - %td - %tr.host - %th - .name=registration.user.name - .address=registration.housing_data['address'] - - if registration.housing_data['notes'].present? - .host-notes=paragraph(registration.housing_data['notes']) - %td.inner-table{colspan: 2}=host_guests_table(registration) - - first_row = false + - @hosts.sort_by{ |id, registration| registration.user.name }.each do |id, registration| + - if @housing_data[id][:space].map { |k,v| v }.sum > 0 + - unless first_row + %tr.spacer + %td + %tr.host + %th + .name=registration.user.name + .address=location_link(Location.find_location(registration.housing_data['address'], @this_conference.city)) + - if registration.housing_data['notes'].present? + .host-notes=paragraph(registration.housing_data['notes']) + - if registration.housing_data['info'].present? + %div=_'articles.conference_registration.headings.housing.Rules', :t + .house-rules + =richtext(registration.housing_data['info'], 4) + + %td.inner-table{colspan: 2} + =host_guests_table(registration) + - first_row = false diff --git a/app/views/registration_steps/_review.html.haml b/app/views/registration_steps/_review.html.haml index 672081b..d2e2022 100644 --- a/app/views/registration_steps/_review.html.haml +++ b/app/views/registration_steps/_review.html.haml @@ -39,6 +39,16 @@ - if @allow_reopen_attendance .actions.centered = button :reopen_registration, value: :reopen_registration +- if @host + = row do + = columns(medium: 12) do + %h3=_'articles.conferences.headings.housing_info', :t + %p=(_'articles.conference_registration.paragraphs.Housing', :p, vars: { name: @host.user.name, address: location_link(Location.find_location(@host.housing_data['address'], @this_conference.city)), phone: @host.housing_data['phone'], email: @host.user.email}).html_safe + = row do + = columns(medium: 12) do + %h4=_'articles.conference_registration.headings.hosting_info', :t + = richtext @host.housing_data['info'] + = row do = columns(medium: 12) do %h3=_'articles.workshops.headings.Workshops', :t diff --git a/app/views/shared/_navbar.html.haml b/app/views/shared/_navbar.html.haml index b88673e..1a45d77 100644 --- a/app/views/shared/_navbar.html.haml +++ b/app/views/shared/_navbar.html.haml @@ -20,6 +20,6 @@ - locale_translation = language_name(locale, true) - translation_text = (_'translate.content.change_locale', "Read in #{locale_translation}", vars: {language: locale_translation}, locale: locale) %a{href: url, lang: locale, title: translation_text} - %span{aria: {hidden: true}}=_!locale + %span{aria: {hidden: :true}}=_!locale = off_screen translation_text \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 48b0588..ade9d2a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1833,7 +1833,11 @@ en: volunteering_info: Volunteering info additional_details: Additional details companion: Companion + Housing: Housing + housing: + Rules: House Rules paragraphs: + Housing: You are staying at %{address}, your host's name is %{name}. You can contact them by email %{email} or by phone at %{phone}. Please take some time to read their house rules below. pronoun: It is important that communications with you and about you are as respectful as possible. If you do not provide a pronoun organizers may assume he, she, or they based on your name or visual identity.