88 lines
2.4 KiB
Plaintext
88 lines
2.4 KiB
Plaintext
= form_for @event,
|
|
url: { action: @event.new_record? ? :create : :update } do |f|
|
|
- if @event.persisted?
|
|
= f.hidden_field :lock_version
|
|
- unless @moderation
|
|
= hidden_field_tag :secret, params[:secret]
|
|
|
|
- if @event.errors.any?
|
|
#flash_messages
|
|
- @event.errors.full_messages.each do |msg|
|
|
%p.flash.alert= msg
|
|
|
|
.field.title
|
|
= f.label :title
|
|
= f.text_field :title, required: true, placeholder: "#{t '.title_helper'}"
|
|
.field.start_time
|
|
= f.label :start_time
|
|
= f.datetime_local_field :start_time, required: true
|
|
.field.end_time
|
|
= f.label :end_time
|
|
= f.datetime_local_field :end_time, required: true
|
|
.field.description
|
|
.helper
|
|
:markdown
|
|
#{t '.description_helper'}
|
|
= f.label :description
|
|
= f.text_area :description, rows: 25
|
|
|
|
.field.address
|
|
.helper
|
|
:markdown
|
|
#{t '.address_helper'}
|
|
= f.label :address
|
|
= f.text_field :address, list: :addresses
|
|
%datalist#addresses
|
|
- Event.where('address is not null').group(:address).order('count(address) desc').pluck(:address).each do |address|
|
|
%option= address
|
|
.field.city
|
|
= f.label :city
|
|
= f.text_field :city, required: true, list: :cities
|
|
%datalist#cities
|
|
- Event.group(:city).order('count(city) desc').pluck(:city).each do |city|
|
|
%option= city
|
|
.field.region
|
|
= f.label :region
|
|
= f.select :region,
|
|
options_from_collection_for_select(Region.all, 'id', 'name',
|
|
@event.region)
|
|
.field.locality
|
|
= f.label :locality
|
|
= f.select :locality,
|
|
options_for_select([[t('attributes.locality_0'), 0],
|
|
[t('attributes.locality_1'), 1]], @event.locality)
|
|
|
|
.field.url
|
|
.helper
|
|
:markdown
|
|
#{t '.url_helper'}
|
|
= f.label :url
|
|
= f.url_field :url, required: true, placeholder: 'Ex: http://april.org'
|
|
.field.contact
|
|
.helper
|
|
:markdown
|
|
#{t '.contact_helper'}
|
|
= f.label :contact
|
|
= f.email_field :contact, required: true
|
|
.field.submitter
|
|
.helper
|
|
:markdown
|
|
#{t '.submitter_helper'}
|
|
= f.label :submitter
|
|
= f.email_field :submitter
|
|
.field.tags
|
|
.helper
|
|
:markdown
|
|
#{t '.tags_helper'}
|
|
= f.label :tags, for: 's2id_autogen1'
|
|
= f.text_field :tags
|
|
|
|
.actions
|
|
= f.button formaction: :preview do
|
|
%em.fa.fa-eye
|
|
= t '.visualise'
|
|
|
|
= f.button do
|
|
%em.fa.fa-check
|
|
= t '.save'
|