Added semi-functional administration pages

This commit is contained in:
Godwin
2016-06-22 00:04:57 -07:00
parent e4fc1120e2
commit b719b2c8ef
43 changed files with 4319 additions and 198 deletions
@@ -0,0 +1,7 @@
= columns(medium: 12) do
%h2=_(@page_title)
= columns(medium: 3, large: 2) do
= admin_menu
= columns(medium: 9, large: 10) do
%h3.subtitle=_("menu.submenu.admin.#{@admin_step.titlecase}")
%div{id: "admin-#{@admin_step}"}= render "conferences/admin/#{@admin_step}"
@@ -5,7 +5,7 @@
= form_tag register_path(@this_conference.slug) do
= textfield :name, @name, required: true, heading: 'articles.conference_registration.headings.name', big: true
= textfield :location, (params[:location] || @registration.city || location(lookup_ip_location)), required: true, heading: 'articles.conference_registration.headings.location'
= checkboxes :languages, [:en, :es, :fr], current_user.languages, 'languages', heading: 'articles.conference_registration.headings.languages'
= checkboxes :languages, [:en, :es, :fr], current_user.languages || [I18n.locale], 'languages', heading: 'articles.conference_registration.headings.languages'
.actions.next-prev
= button_tag (params[:step] == :save ? :save : :next), value: :contact_info
= button_tag :previous, value: :prev_contact_info, class: :subdued, formnovalidate: true
+3 -8
View File
@@ -1,8 +1,3 @@
- add_stylesheet :editor
- add_inline_script :pen
- add_inline_script :markdown
- add_inline_script :editor
= columns(medium: 12) do
%h2=_(@page_title)
= columns(medium: 12) do
@@ -15,10 +10,10 @@
- [:bed_space, :floor_space, :tent_space].each do | space |
= numberfield space, @hosting_data['space'][space.to_s] || 0, min: 0, required: true
= fieldset :hosting_dates, heading: 'articles.conference_registration.headings.host.availability', help: 'articles.conference_registration.paragraphs.host.availability' do
= selectfield :first_day, @hosting_data['availability'][0] || @this_conference.start_date, conference_housing_options_list(:before)
= selectfield :last_day, @hosting_data['availability'][1] || @this_conference.start_date, conference_housing_options_list(:after)
= selectfield :first_day, @hosting_data['availability'][0] || @this_conference.start_date, conference_days_options_list(:before)
= selectfield :last_day, @hosting_data['availability'][1] || @this_conference.start_date, conference_days_options_list(:after)
= checkboxes :considerations, [:vegan, :smoking, :pets, :quiet], @hosting_data['considerations'], 'articles.conference_registration.host.considerations', heading: 'articles.conference_registration.headings.host.considerations', help: 'articles.conference_registration.paragraphs.host.considerations', vertical: true
= textarea :notes, @hosting_data['notes'], heading: 'articles.conference_registration.headings.host.notes', help: 'articles.conference_registration.paragraphs.host.notes'
= textarea :notes, @hosting_data['notes'], heading: 'articles.conference_registration.headings.host.notes', help: 'articles.conference_registration.paragraphs.host.notes', edit_on: :focus
.actions.next-prev
= button_tag (params[:step] == :save ? :save : :next), value: :hosting
= button_tag :previous, value: :prev_contact_info, class: :subdued, formnovalidate: true
@@ -0,0 +1,19 @@
= form_tag administration_update_path(@this_conference.slug, :broadcast) do
- if @broadcast_step == :preview || @broadcast_step == :test
= hidden_field_tag :subject, @subject
= hidden_field_tag :body, @body
.test-preview
%h4=@subject
= richtext @body, 4
.actions.right
= button_tag :test, value: :test, class: :secondary if @broadcast_step == :preview
= button_with_confirmation :send, (_'modals.admin.broadcast.confirm', vars: { number: @subscriber_count || 0 }), value: :send, class: :delete if @broadcast_step == :test
= button_tag :edit, value: :edit
- else
= textfield :subject, @subject, required: true, big: true
= textarea :body, @body, heading: 'articles.conference_registration.headings.admin.edit.info', help: 'articles.conference_registration.paragraphs.admin.edit.info', lang: @this_conference.locale, edit_on: :focus
.actions.right
= button_tag :preview, value: :preview
-# I18n.backend.enabled_locales.each do | locale |
-# if locale.to_s != @this_conference.locale.to_s
-#= textarea "info_translations[#{locale.to_s}]", (richtext @this_conference._info(locale)), label: 'translate.pages.Locale_Translation', vars: { language: _("languages.#{locale}") }, lang: locale
@@ -0,0 +1 @@
Sent.
@@ -0,0 +1,7 @@
= form_tag administration_update_path(@this_conference.slug, :edit) do
= textarea :info, @this_conference.info!, heading: 'articles.conference_registration.headings.admin.edit.info', help: 'articles.conference_registration.paragraphs.admin.edit.info', lang: @this_conference.locale, edit_on: :focus
- I18n.backend.enabled_locales.each do | locale |
- if locale.to_s != @this_conference.locale.to_s
= 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
@@ -0,0 +1,36 @@
- if @events.present?
%ul.events.admin-blocks
- @events.each do | event |
%li
%h4.title=event.title
.details
= data_set(:h5, 'forms.labels.generic.event_location', class: :location) do
=event.event_location.present? ? event.event_location.title : ''
= data_set(:h5, 'forms.labels.generic.day', class: :day) do
= date(event.start_time.to_date, :weekday)
= data_set(:h5, 'forms.labels.generic.time', class: :time) do
= time(event.start_time, :short)
= data_set(:h5, 'forms.labels.generic.time_span', class: 'time-span') do
= hours(event.start_time, event.end_time)
= form_tag administration_update_path(@this_conference.slug, :events), class: [:actions, :fill] do
= hidden_field_tag :id, event.id
= button_with_confirmation :delete, (_'modals.admin.generic.delete.confirm', :p, vars: { title: event.title }), value: :delete, class: [:delete, :small]
= button_tag :edit, value: :edit, class: [:small]
%h4=_"articles.admin.locations.headings.#{@event.id.present? ? 'edit' : 'add'}_event", :t
= form_tag administration_update_path(@this_conference.slug, :events) do
= hidden_field_tag :id, @event.id if @event.id.present?
= textfield :title, @event.title!, required: true, big: true, lang: @event.locale
= textarea :info, @event.info!, heading: 'articles.conference_registration.headings.admin.edit.info', help: 'articles.conference_registration.paragraphs.admin.edit.info', lang: @event.locale, edit_on: :focus
.flex-inputs
= location_select @event.event_location_id, small: true, stretch: true
= day_select @day, small: true, format: :weekday
= time_select @time, small: true
= length_select @length, small: true
- I18n.backend.enabled_locales.each do | locale |
- if locale.to_s != @event.locale.to_s
= textfield "title_translations[#{locale.to_s}]", @event._title(locale), big: true, heading: 'translate.pages.Locale_Translation', vars: { language: _("languages.#{locale}") }, label: 'forms.labels.generic.title', lang: locale
= textarea "info_translations[#{locale.to_s}]", @event._info(locale), lang: locale, label: 'forms.labels.generic.info', edit_on: :focus
.actions.next-prev
= button_tag :save, value: :save
= button_tag :cancel, value: :cancel, class: :subdued, formnovalidate: true if @event.id.present?
@@ -0,0 +1,26 @@
- add_inline_script :housing
= form_tag administration_update_path(@this_conference.slug, :housing), id: :hosts, class: 'on-top-target' do
= hidden_field_tag :guest_id
.on-top-controls
= button_tag :close, type: :button, class: ['on-top-close']
%ul
- @hosts.each do | id, registration |
- if registration.user.present?
- widget_data = host_guests_widget(registration)
%li{id: "host-#{id}", class: widget_data[:class]}
%h4=registration.user.name
.email=registration.user.email
.address=registration.housing_data['address']
.guests=widget_data[:html]
#guests
%h4=_'articles.admin.housing.headings.guests', :t
%ul.guests
- @guests.each do | id, registration |
- 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
.email.on-top-only=registration.user.email
= button_tag :set_host, type: :button, class: [:small, 'set-host', 'not-on-top']
@@ -0,0 +1,35 @@
- unless @location.present?
%ul.locations.admin-blocks
- @locations.each do | location |
%li
%h4.title=location.title
.details
= data_set(:h5, 'forms.labels.generic.address', class: :address) do
=location.address
= data_set(:h5, 'articles.workshops.headings.space', class: :space) do
= _"workshop.options.space.#{location.space}"
- amenities = location.amenities.present? ? JSON.parse(location.amenities) : []
- if amenities.present?
= data_set(:h5, 'articles.admin.locations.headings.amenities', class: :amenities) do
%ul.amenities
- amenities.each do | amenity |
%li=_"workshop.options.needs.#{amenity}"
= form_tag administration_update_path(@this_conference.slug, :locations), class: [:actions, :fill] do
= hidden_field_tag :id, location.id
= button_tag :edit, value: :edit, class: :small
= button_with_confirmation :delete, (_'modals.admin.generic.delete.confirm', :p, vars: { title: location.title }), value: :delete, class: [:delete, :small]
%h4=_"articles.admin.locations.headings.#{@location.present? ? 'edit' : 'add'}_location", :t
= form_tag administration_update_path(@this_conference.slug, :locations) do
= hidden_field_tag :id, @location.id if @location.present?
= textfield :title, @location.present? ? @location.title : nil, required: true, big: true
= textfield :address, @location.present? ? @location.address : nil, required: true
= columns(medium: 6) do
= radiobuttons :space, EventLocation.all_spaces, @location.present? ? @location.space : nil, 'workshop.options.space', vertical: true, heading: 'articles.workshops.headings.space'
= columns(medium: 6) do
= checkboxes :needs, EventLocation.all_amenities, @location.present? ? JSON.parse(@location.amenities) : [], 'workshop.options.needs', vertical: true, heading: 'articles.admin.locations.headings.amenities'
.actions.next-prev
- if @location.present?
= button_tag :save, value: :save
= button_tag :cancel, value: :cancel, class: :subdued, formnovalidate: true
- else
= button_tag :create, value: :create
@@ -0,0 +1,30 @@
- if @this_conference.meals.present?
%table.meals
%tr
%th=_'forms.labels.generic.title'
%th=_'forms.labels.generic.info'
%th=_'forms.labels.generic.event_location'
%th=_'forms.labels.generic.day'
%th=_'forms.labels.generic.time'
%th.form
- Hash[@this_conference.meals.map{ |k, v| [k.to_i, v] }].sort.to_h.each do | time, meal |
%tr
%th
=_!(meal['title'] || '')
%td=_!(meal['info'] || '')
%td=_!location_name(meal['location'].to_i)
%td=date(meal['day'], :weekday)
%td=time(meal['time'].to_f)
%td.form
= form_tag administration_update_path(@this_conference.slug, :meals) do
= hidden_field_tag :meal, time
= button_tag :delete, value: :delete, class: [:small, :delete]
= form_tag administration_update_path(@this_conference.slug, :meals) do
.flex-inputs
= location_select nil, small: true, stretch: true
= day_select nil, small: true, format: :weekday
= time_select nil, small: true
= textfield :title, nil, required: true, big: true
= textfield :info, nil
.actions.next-prev
= button_tag :add_meal, value: :add_meal
+12 -11
View File
@@ -1,15 +1,16 @@
= render :partial => 'page_header', :locals => {:page_key => 'Conference_Registration'}
- if (steps = current_registration_steps(@registration))
= row id: 'registration-steps', class: 'flow-steps' do
= columns do
%ul
- current_registration_steps.each do | step |
- text = _"articles.conference_registration.headings.#{step[:name].to_s}"
%li{class: [step[:enabled] ? :enabled : nil, @register_template == step[:name] ? :current : nil]}
- if step[:enabled]
.step= link_to text, register_step_path(@this_conference.slug, step[:name])
- else
.step= text
= registration_step_menu
-#- if (steps = current_registration_steps(@registration))
-# = row id: 'registration-steps', class: 'flow-steps' do
-# = columns do
-# %ul
-# - current_registration_steps.each do | step |
-# - text = _"articles.conference_registration.headings.#{step[:name].to_s}"
-# %li{class: [step[:enabled] ? :enabled : nil, @register_template == step[:name] ? :current : nil]}
-# - if step[:enabled]
-# .step= link_to text, register_step_path(@this_conference.slug, step[:name])
-# - else
-# .step= text
- if @warnings.present?
= row class: 'warnings', tag: :ul do
- @warnings.each do | warning |