Browse Source

Fixed broken workshop links and fixed awkward styles

development
Godwin 9 years ago
parent
commit
dfdb44b5ae
  1. 2173
      app/assets/stylesheets/_application.scss
  2. 3
      app/controllers/conferences_controller.rb
  3. 54
      app/helpers/application_helper.rb
  4. 4
      app/models/workshop.rb
  5. 2
      app/views/application/about.html.haml
  6. 12
      app/views/conferences/_contact_info.html.haml
  7. 14
      app/views/workshops/new.html.haml

2173
app/assets/stylesheets/_application.scss

File diff suppressed because it is too large

3
app/controllers/conferences_controller.rb

@ -1037,6 +1037,9 @@ class ConferencesController < ApplicationController
workshop.notes = params[:notes] workshop.notes = params[:notes]
workshop.needs_facilitators = params[:needs_facilitators].present? workshop.needs_facilitators = params[:needs_facilitators].present?
workshop.save workshop.save
# Rouge nil facilitators have been know to be created, just destroy them here now
WorkshopFacilitator.where(:user_id => nil).destroy_all
else else
return do_403 return do_403
end end

54
app/helpers/application_helper.rb

@ -680,16 +680,16 @@ module ApplicationHelper
description_id = nil description_id = nil
html = label_tag(name, nil, id: label_id) html = label_tag(name, nil, id: label_id)
if options[:warning].present?
description_id = "#{name.to_s}-label" unless options[:help].present?
html += content_tag(:div, _(options[:warning], :s, 2), id: description_id, class: 'warning-info')
end
if options[:help].present? if options[:help].present?
description_id = "#{name.to_s}-label" description_id ||= "#{name.to_s}-desc"
html += content_tag(:div, _(options[:help], :s, 2), id: description_id, class: 'input-field-help') html += content_tag(:div, _(options[:help], :s, 2), id: description_id, class: 'input-field-help')
end end
if options[:warning].present?
description_id ||= "#{name.to_s}-desc"
html += content_tag(:div, _(options[:warning], :s, 2), id: description_id, class: 'warning-info')
end
html += content_tag(:div, value.present? ? value.html_safe : '', html += content_tag(:div, value.present? ? value.html_safe : '',
id: name, id: name,
class: 'textarea', class: 'textarea',
@ -698,10 +698,50 @@ module ApplicationHelper
aria: { labeledby: label_id, describedby: description_id } aria: { labeledby: label_id, describedby: description_id }
) )
return content_tag(:div, html, class: ['text-area-field', 'input-field']).html_safe html = content_tag(:div, html, class: ['text-area-field', 'input-field']).html_safe
html += _original_content(options[:original_value], options[:original_lang]) if options[:original_value].present?
return html.html_safe
end
def textfield(name, value, options = {})
html = ''
description_id = nil
if options[:heading].present?
description_id ||= "#{name.to_s}-desc"
html += content_tag(:h3, _(options[:heading]), id: description_id)
end
html += show_errors name
html += label_tag name
html += text_field_tag(name, value,
required: options[:required],
lang: options[:lang],
aria: { describedby: description_id }
)
html = content_tag(:div, html.html_safe,
class: [
'text-field',
'input-field',
options[:big] ? 'big' : nil,
(@errors || {})[name].present? ? 'has-error' : nil
])
html += _original_content(options[:original_value], options[:original_lang]) if options[:original_value].present?
return html.html_safe
end end
private private
def _original_content(value, lang)
content_tag(:div, (
content_tag(:h4, _('translate.content.Translation_of')) +
content_tag(:div, value, class: 'value', lang: lang)
).html_safe, class: 'original-text')
end
def _form_field(type, name, value, options) def _form_field(type, name, value, options)
if type == 'check_box' if type == 'check_box'
self.send(type + '_tag', name, "1", value, options) self.send(type + '_tag', name, "1", value, options)

4
app/models/workshop.rb

@ -31,7 +31,7 @@ class Workshop < ActiveRecord::Base
def active_facilitators def active_facilitators
users = [] users = []
workshop_facilitators.each do |u| workshop_facilitators.each do |u|
users << User.find(u.user_id) unless u.role.to_sym == :requested users << User.find(u.user_id) unless u.role.to_sym == :requested || u.user.nil?
end end
return users return users
end end
@ -78,7 +78,7 @@ class Workshop < ActiveRecord::Base
return 0 unless id return 0 unless id
collaborators = [] collaborators = []
workshop_facilitators.each do |f| workshop_facilitators.each do |f|
collaborators << f.user_id unless f.role.to_sym == :requested collaborators << f.user_id unless f.role.to_sym == :requested || f.user_id.nil?
end end
return 10 unless collaborators.present? return 10 unless collaborators.present?
interested = WorkshopInterest.where("workshop_id=#{id} AND user_id NOT IN (#{collaborators.join ','})") || [] interested = WorkshopInterest.where("workshop_id=#{id} AND user_id NOT IN (#{collaborators.join ','})") || []

2
app/views/application/about.html.haml

@ -14,7 +14,7 @@
= columns(medium: 12) do = columns(medium: 12) do
%h3=_'articles.about_bikebike.headings.Who_is_Invited', :t %h3=_'articles.about_bikebike.headings.Who_is_Invited', :t
%p=_'articles.about_bikebike.paragraphs.Who_is_Invited', :p %p=_'articles.about_bikebike.paragraphs.Who_is_Invited', :p
= columns(medium: 12) do = columns(medium: 12, class: 'featured-image-container') do
%h3=_'articles.about_bikebike.headings.Types_of_Workshops', :t %h3=_'articles.about_bikebike.headings.Types_of_Workshops', :t
%figure{style: "background-image: url(#{image_path('columbus_people.jpg')})"} %figure{style: "background-image: url(#{image_path('columbus_people.jpg')})"}
%p=_'articles.about_bikebike.paragraphs.Types_of_Workshops', :p %p=_'articles.about_bikebike.paragraphs.Types_of_Workshops', :p

12
app/views/conferences/_contact_info.html.haml

@ -3,16 +3,8 @@
%p=_'articles.conference_registration.paragraphs.Contact_Info', :s, 2 %p=_'articles.conference_registration.paragraphs.Contact_Info', :s, 2
= columns(medium: 12) do = columns(medium: 12) do
= form_tag register_path(@this_conference.slug) do = form_tag register_path(@this_conference.slug) do
%h3=_'articles.conference_registration.headings.name','What is your name?' = textfield :name, @name, required: true, heading: 'articles.conference_registration.headings.name'
.text-field.input-field{class: @errors[:name].present? ? 'has-error' : nil} = textfield :location, (@registration.city || location(lookup_ip_location)), required: true, heading: 'articles.conference_registration.headings.location'
= show_errors :name
= label_tag :name
= text_field_tag :name, @name, required: true
%h3=_'articles.conference_registration.headings.location','Where are you coming from?'
.text-field.input-field{class: @errors[:location].present? ? 'has-error' : nil}
= show_errors :location
= label_tag :location
= text_field_tag :location, @registration.city || location(lookup_ip_location), required: true
%h3=_'articles.conference_registration.headings.languages','Which languages do you speak?' %h3=_'articles.conference_registration.headings.languages','Which languages do you speak?'
- puts @errors.to_json.to_s - puts @errors.to_json.to_s
.check-box-field.input-field{class: @errors[:languages].present? ? 'has-error' : nil} .check-box-field.input-field{class: @errors[:languages].present? ? 'has-error' : nil}

14
app/views/workshops/new.html.haml

@ -19,18 +19,8 @@
%h2=_@page_title, :t %h2=_@page_title, :t
- else - else
%h2=_@page_title, :t %h2=_@page_title, :t
.text-field.input-field.big = textfield :title, @title, required: true, lang: @translation, big: true, original_value: @is_translating ? @workshop.title! : nil, original_lang: @workshop.locale
= label_tag :title = textarea :info, @info, help: 'articles.workshops.paragraphs.info', lang: @translation, original_value: @is_translating ? richtext(@workshop.info!, 4).html_safe : nil, original_lang: @workshop.locale
= text_field_tag :title, @title, required: true, lang: @translation
- if @is_translating
.original-text
%h4=_'translate.content.Translation_of'
.value=@workshop.title!
= textarea :info, @info, help: 'articles.workshops.paragraphs.info', lang: @translation
- if @is_translating
.original-text
%h4=_'translate.content.Translation_of'
.value=(@workshop.info! || '').html_safe
- if !@is_translating && (@workshop.id.blank? || @can_edit) - if !@is_translating && (@workshop.id.blank? || @can_edit)
= columns(medium: 6) do = columns(medium: 6) do
%h3=_'articles.workshops.headings.languages','Workshop Language' %h3=_'articles.workshops.headings.languages','Workshop Language'

Loading…
Cancel
Save