Created helper for checkbox and radio button groups
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
= row do
|
||||
= row class: 'view-object' do
|
||||
= columns(medium: 12) do
|
||||
%h2=_!workshop.title
|
||||
.workshop-interest
|
||||
@@ -30,15 +30,14 @@
|
||||
- elsif preview.blank? && (f.user_id == current_user.id && f.role.to_sym != :creator) || (!workshop.conference.registered?(u) && workshop.active_facilitator?(current_user))
|
||||
=(link_to (_'actions.workshops.Remove'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'remove'), :class => [:button, :delete])
|
||||
- unless preview.present?
|
||||
.actions
|
||||
=(link_to (_'actions.workshops.Facilitate'), facilitate_workshop_path(workshop.conference.slug, workshop.id), :class => [:button, workshop.needs_facilitators ? :accented : :subdued]) unless workshop.facilitator?(current_user)
|
||||
- if workshop.active_facilitator?(current_user)
|
||||
%h4=_'articles.workshops.headings.add_facilitator','Add a facilitator'
|
||||
= form_tag workshop_add_facilitator_path(workshop.conference.slug, workshop.id), :class => 'add-facilitator flex-form' do
|
||||
.email-field.input-field
|
||||
= email_field_tag :email, nil, required: true
|
||||
= label_tag :email
|
||||
= button_tag :add
|
||||
=(link_to (_'actions.workshops.Facilitate'), facilitate_workshop_path(workshop.conference.slug, workshop.id), :class => [:button, workshop.needs_facilitators ? :accented : :subdued]) unless workshop.facilitator?(current_user)
|
||||
- if workshop.active_facilitator?(current_user)
|
||||
%h4=_'articles.workshops.headings.add_facilitator','Add a facilitator'
|
||||
= form_tag workshop_add_facilitator_path(workshop.conference.slug, workshop.id), :class => 'add-facilitator mini-flex-form' do
|
||||
.email-field.input-field
|
||||
= email_field_tag :email, nil, required: true
|
||||
= label_tag :email
|
||||
= button_tag :add
|
||||
- languages = JSON.parse(workshop.languages || '[]')
|
||||
- if languages.present?
|
||||
= columns(medium: 6) do
|
||||
|
||||
@@ -23,43 +23,12 @@
|
||||
= 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
|
||||
- if !@is_translating && (@workshop.id.blank? || @can_edit)
|
||||
= columns(medium: 6) do
|
||||
%h3=_'articles.workshops.headings.languages','Workshop Language'
|
||||
.input-field-help=_'articles.workshops.paragraphs.languages', :s, 2
|
||||
.check-box-field.vertical.input-field
|
||||
- [:en, :es, :fr].each do |language|
|
||||
= check_box_tag "languages[#{language}]", 1, @languages && @languages.include?(language)
|
||||
= label_tag "languages_#{language}" do
|
||||
= _"languages.#{language}"
|
||||
%h3=_'articles.workshops.headings.theme','Theme'
|
||||
.input-field-help=_'articles.workshops.paragraphs.theme', :s, 2
|
||||
- theme_found = false
|
||||
.check-box-field.vertical.input-field
|
||||
- Workshop.all_themes.each do |theme|
|
||||
- is_selected = (@workshop.theme.to_s == theme.to_s)
|
||||
- theme_found ||= is_selected
|
||||
= radio_button_tag :theme, theme, is_selected
|
||||
= label_tag "theme_#{theme}" do
|
||||
= _"workshop.options.theme.#{theme}"
|
||||
- is_other = (@workshop.theme.present? && !theme_found)
|
||||
= radio_button_tag :theme, :other, is_other
|
||||
= label_tag "theme_other" do
|
||||
.other
|
||||
= text_field_tag :other_theme, (is_other ? @workshop.theme : nil), placeholder: (_"workshop.options.theme.other"), required: is_other
|
||||
= checkboxes :languages, [:en, :es, :fr], @languages, 'languages', vertical: true, heading: 'articles.workshops.headings.languages', help: 'articles.workshops.paragraphs.languages'
|
||||
= radiobuttons :theme, Workshop.all_themes, @workshop.theme, 'workshop.options.theme', vertical: true, heading: 'articles.workshops.headings.theme', help: 'articles.workshops.paragraphs.theme', other: true
|
||||
= columns(medium: 6) do
|
||||
%h3=_'articles.workshops.headings.needs','What do you need?'
|
||||
.input-field-help=_'articles.workshops.paragraphs.needs', :s, 2
|
||||
.check-box-field.vertical.input-field
|
||||
- [:sound, :projector, :tools].each do |need|
|
||||
= check_box_tag "needs[#{need.to_s}]", 1, JSON.parse(@workshop.needs || '[]').include?(need.to_s)
|
||||
= label_tag "needs_#{need}" do
|
||||
= _"workshop.options.needs.#{need.to_s}"
|
||||
%h3=_'articles.workshops.headings.space','Type of space'
|
||||
.input-field-help=_'articles.workshops.paragraphs.space', :s, 2
|
||||
.check-box-field.vertical.input-field
|
||||
- [:meeting_room, :workshop, :outdoor_meeting].each do |space|
|
||||
= radio_button_tag :space, space, @workshop.space == space
|
||||
= label_tag "space_#{space}" do
|
||||
= _"workshop.options.space.#{space}"
|
||||
= checkboxes :needs, [:sound, :projector, :tools], JSON.parse(@workshop.needs || '[]'), 'workshop.options.needs', vertical: true, heading: 'articles.workshops.headings.needs', help: 'articles.workshops.paragraphs.needs'
|
||||
= radiobuttons :space, [:meeting_room, :workshop, :outdoor_meeting], @workshop.space, 'workshop.options.space', vertical: true, heading: 'articles.workshops.headings.space', help: 'articles.workshops.paragraphs.space'
|
||||
|
||||
%h3=_'articles.workshops.headings.needs_facilitators','Looking for help?'
|
||||
.input-field-help=_'articles.workshops.paragraphs.needs_facilitators', :s, 2
|
||||
.check-box-field.vertical.input-field
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
= render 'workshops/show', :workshop => @workshop, :translations_available_for_editing => @translations_available_for_editing, :preview => false
|
||||
= row do
|
||||
= columns(medium: 12) do
|
||||
.actions.right
|
||||
.actions.next-prev
|
||||
= (link_to (_'actions.workshops.Edit'), edit_workshop_path(@this_conference.slug, @workshop.id), :class => [:button, :modify]) if @workshop.can_edit?(current_user)
|
||||
= (link_to (_'actions.workshops.Delete'), delete_workshop_path(@this_conference.slug, @workshop.id), :class => 'button delete') if @workshop.can_delete?(current_user)
|
||||
|
||||
Reference in New Issue
Block a user