Schedule maker, stats, and minor fixes

This commit is contained in:
Godwin
2016-07-05 22:40:53 -07:00
parent ee3b874110
commit 26f9dfde89
18 changed files with 913 additions and 184 deletions
@@ -5,3 +5,15 @@
= textarea "info_translations[#{locale.to_s}]", @this_conference._info(locale), label: 'translate.pages.Locale_Translation', vars: { language: _("languages.#{locale}") }, lang: locale, edit_on: :focus
.actions.right
= button_tag :save, value: :save
%h4=_'articles.admin.edit.headings.host_organizations'
- @this_conference.organizations.each do | organization |
%p=organization.name
%h5=_'articles.admin.edit.headings.members'
.details.org-members.inline
- organization.users.each do | user |
= raw_data_set(:h6, user.name) do
= user.email
= form_tag administration_update_path(@this_conference.slug, :edit), class: 'mini-flex-form' do
= hidden_field_tag :org_id, organization.id
= emailfield :email, nil, required: true
= button_tag :add_member, value: :add_member, class: :small
@@ -19,7 +19,7 @@
- if registration.user.present?
%li.guest{id: "guest-#{id}", data: { id: id, 'affected-hosts': @hosts_affected_by_guests[id].join(',') }}
%h4= registration.user.name
.city.on-top-only=registration.city
.city=registration.city
.email.on-top-only=registration.user.email
= button_tag :set_host, type: :button, class: [:small, 'set-host', 'not-on-top']
+98 -18
View File
@@ -1,18 +1,98 @@
.table.workshop-blocks
.table-tr.header
.table-th=_'forms.labels.generic.block_number'
.table-th=_'forms.labels.generic.time'
.table-th=_'forms.labels.generic.length'
.table-th=_'forms.labels.generic.days'
.table-th.form
- @workshop_blocks.each_with_index do | info, block |
- is_new = info['time'].blank?
= form_tag administration_update_path(@this_conference.slug, :schedule), class: ['table-tr', is_new ? 'new' : 'saved'] do
.table-th.center.big= is_new ? '' : (block + 1)
.table-td=time_select info['time'], small: true, label: false
.table-td=length_select info['length'], {small: true, label: false}, 0.5, 2
.table-td=checkboxes :days, @block_days, info['days'].map(&:to_i), 'date.day_names', vertical: true, small: true
.table-td.form
= hidden_field_tag :workshop_block, block
= button_tag :delete_block, value: :delete_block, class: [:small, :delete] if block == @workshop_blocks.length - 2
= button_tag (is_new ? :add_block : :update_block), value: :save_block, class: [:small, :add]
#schedule-preview
- @schedule.each do | day, data |
%h4=date(day, :weekday)
%table.schedule{class: data[:locations].present? ? 'has-locations' : 'no-locations'}
- if data[:locations].present?
%thead
%tr
%th.corner
- data[:locations].each do | id, location |
%th=location.title
%th.status
%tbody
- data[:times].each do | time, time_data |
%tr
- rowspan = (time_data[:length] * 2).to_i
%th=time(time)
- if time_data[:type] == :workshop
- if time_data[:item][:workshops].present?
- data[:locations].each do | id, location |
- if time_data[:item][:workshops][id].present?
- workshop = time_data[:item][:workshops][id][:workshop]
- status = time_data[:item][:workshops][id][:status]
- else
- workshop = status = nil
%td{class: [time_data[:type], workshop.present? ? :filled : nil], rowspan: rowspan}
- if workshop.present?
= form_tag administration_update_path(@this_conference.slug, :schedule), class: 'js-xhr' do
.title=workshop.title
.status
.conflict-score
%span.title Conflict Score:
%span.value="#{status[:conflict_score] * 100.0}%"
- if status[:errors].present?
.errors
- status[:errors].each do | error |
.error=_"errors.messages.schedule.#{error[:name].to_s}", vars: error[:i18nVars]
= hidden_field_tag :id, workshop.id
= button_tag :deschedule, value: :deschedule_workshop, class: [:delete, :small]
- else
.title="Block #{time_data[:item][:block] + 1}"
- else
%td{class: time_data[:type], rowspan: rowspan, colspan: data[:locations].present? ? data[:locations].size : 1}
.title="Block #{time_data[:item][:block] + 1}"
%td.status{rowspan: rowspan}
- if time_data[:status].present? && time_data[:status][:errors].present?
%ul.errors
- time_data[:status][:errors].each do | error |
%li=error.to_json.to_s
- elsif time_data[:type] != :nil
%td{class: time_data[:type], rowspan: rowspan, colspan: data[:locations].present? ? data[:locations].size : 1}
- case time_data[:type]
- when :meal
.title= time_data[:item]['title']
.location= EventLocation.find(time_data[:item]['location'].to_i).title
- when :event
.title= time_data[:item].title
.location= time_data[:item].event_location.title
%td.status{rowspan: rowspan}
- unless request.xhr?
%ul.workshop-list
- @workshops.each do | workshop |
%li{id: "workshop-#{workshop.id}", class: workshop.block.present? ? 'booked' : 'not-booked'}
%h4.title= workshop.title
= form_tag administration_update_path(@this_conference.slug, :schedule), class: 'js-xhr' do
.already-booked
.field-error='This block is already booked'
.workshop-description
.details
= data_set(:h5, 'articles.workshops.headings.interested_count') do
= workshop.interested_count
= data_set(:h5, 'articles.workshops.headings.facilitators') do
- facilitators = []
- workshop.active_facilitators.each do | facilitator |
- facilitators << facilitator.name
= facilitators.join ', '
= data_set(:h5, 'articles.workshops.headings.needs') do
- needs = []
- JSON.parse(workshop.needs || '[]').each do | need |
- needs << (_"workshop.options.needs.#{need}")
= _!(needs.join ', ')
= data_set(:h5, 'articles.workshops.headings.theme') do
= workshop.theme.present? ? (_"workshop.options.theme.#{workshop.theme}") : ''
= data_set(:h5, 'articles.workshops.headings.space') do
= workshop.space.present? ? (_"workshop.options.space.#{workshop.space}") : ''
= data_set(:h5, 'forms.labels.generic.info') do
= link_info_dlg truncate(workshop.info), (richtext workshop.info.html_safe), workshop.title
- if workshop.notes.present? && strip_tags(workshop.notes).length > 0
= data_set(:h5, 'forms.labels.generic.notes') do
= link_info_dlg truncate(workshop.notes), (richtext workshop.notes.html_safe), workshop.title
= hidden_field_tag :id, workshop.id
.flex-inputs
= location_select workshop.event_location_id, small: true, stretch: true
= block_select workshop.block.present? ? "#{workshop.block['day']}:#{workshop.block['block']}" : nil, small: true
.actions.next-prev
= button_tag :deschedule, value: :deschedule_workshop, class: [:delete, 'booked-only']
= button_tag :reschedule, value: :schedule_workshop, class: [:secondary, 'booked-only']
= button_tag :schedule_workshop, value: :schedule_workshop, class: 'not-booked-only'
@@ -0,0 +1,5 @@
.details
= data_set(:h4, 'articles.admin.stats.headings.registrations') do
= @registrations.size
.actions
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, :stats, :format => :xlsx), class: [:button, :download]
@@ -0,0 +1,18 @@
.table.workshop-blocks
.table-tr.header
.table-th=_'forms.labels.generic.block_number'
.table-th=_'forms.labels.generic.time'
.table-th=_'forms.labels.generic.length'
.table-th=_'forms.labels.generic.days'
.table-th.form
- @workshop_blocks.each_with_index do | info, block |
- is_new = info['time'].blank?
= form_tag administration_update_path(@this_conference.slug, :workshop_times), class: ['table-tr', is_new ? 'new' : 'saved'] do
.table-th.center.big= is_new ? '' : (block + 1)
.table-td=time_select info['time'], small: true, label: false
.table-td=length_select info['length'], {small: true, label: false}, 0.5, 2
.table-td=checkboxes :days, @block_days, info['days'].map(&:to_i), 'date.day_names', vertical: true, small: true
.table-td.form
= hidden_field_tag :workshop_block, block
= button_tag :delete_block, value: :delete_block, class: [:small, :delete] if block == @workshop_blocks.length - 2
= button_tag (is_new ? :add_block : :update_block), value: :save_block, class: [:small, :add]
+18
View File
@@ -0,0 +1,18 @@
- key = @excel_data[:key] || 'excel.columns'
%table
%thead
%tr
- @excel_data[:columns].each do |column|
%th=_(@excel_data[:keys][column].present? ? @excel_data[:keys][column] : "#{key}.#{column.to_s}")
%tbody
- @excel_data[:data].each do |row|
%tr
- @excel_data[:columns].each do |column|
%td{class: @excel_data[:column_types][column].present? ? @excel_data[:column_types][column].to_s : nil}=_!row[column]
- format_xls 'table' do
- workbook use_autowidth: true
- format bg_color: '333333'
- format 'td', font_name: 'Calibri', bg_color: 'ffffff', fg_color: '333333'
- format 'th', font_name: 'Calibri', b: true, bg_color: '333333', fg_color: 'ffffff'
- format 'td.date', num_fmt: 22, font_name: 'Courier New', sz: 10