2014-12-13 15:53:32 +01:00
|
|
|
= form_for @event,
|
|
|
|
url: { action: @event.new_record? ? :create : :update } do |f|
|
|
|
|
- if @event.persisted?
|
2014-10-11 16:12:07 +02:00
|
|
|
= f.hidden_field :lock_version
|
|
|
|
- unless @moderation
|
|
|
|
= hidden_field_tag :secret, params[:secret]
|
|
|
|
|
2013-12-28 23:45:13 +01:00
|
|
|
- if @event.errors.any?
|
2017-05-20 16:02:07 +02:00
|
|
|
#flash-messages
|
2014-05-31 23:13:43 +02:00
|
|
|
- @event.errors.full_messages.each do |msg|
|
2014-09-23 17:50:35 +02:00
|
|
|
%p.flash.alert= msg
|
2013-12-28 23:45:13 +01:00
|
|
|
|
2017-05-22 16:42:21 +02:00
|
|
|
.field.title.required
|
2013-12-28 23:45:13 +01:00
|
|
|
= f.label :title
|
2016-06-25 16:03:08 +02:00
|
|
|
= f.text_field :title, required: true, placeholder: t('.title_helper')
|
2017-05-22 16:42:21 +02:00
|
|
|
.field.start_time.required
|
2014-07-12 13:58:54 +02:00
|
|
|
= f.label :start_time
|
2016-12-17 16:59:11 +01:00
|
|
|
= f.datetime_select :start_time, default: 1.day.from_now
|
2017-05-22 16:42:21 +02:00
|
|
|
.field.end_time.required
|
2014-07-12 13:58:54 +02:00
|
|
|
= f.label :end_time
|
2016-12-17 16:59:11 +01:00
|
|
|
= f.datetime_select :end_time, default: 1.day.from_now
|
2016-09-11 17:40:49 +02:00
|
|
|
|
2015-03-08 23:41:52 +01:00
|
|
|
.field.place_name
|
|
|
|
= f.label :place_name
|
|
|
|
= f.text_field :place_name
|
2017-05-22 16:42:21 +02:00
|
|
|
.helper
|
|
|
|
:markdown
|
|
|
|
#{raw t '.address_helper'}
|
2014-09-26 01:26:33 +02:00
|
|
|
.field.address
|
2014-08-23 16:59:42 +02:00
|
|
|
= f.label :address
|
2014-12-13 15:53:32 +01:00
|
|
|
= f.text_field :address, list: :addresses
|
|
|
|
%datalist#addresses
|
2014-12-14 22:08:35 +01:00
|
|
|
- Event.where('address is not null').group(:address).order('count(address) desc').pluck(:address).each do |address|
|
2014-12-13 15:53:32 +01:00
|
|
|
%option= address
|
2017-05-22 16:42:21 +02:00
|
|
|
.field.city.required
|
2014-07-12 13:58:54 +02:00
|
|
|
= f.label :city
|
2014-11-09 15:23:04 +01:00
|
|
|
= f.text_field :city, required: true, list: :cities
|
2014-07-01 21:25:48 +02:00
|
|
|
%datalist#cities
|
2014-09-26 01:26:33 +02:00
|
|
|
- Event.group(:city).order('count(city) desc').pluck(:city).each do |city|
|
|
|
|
%option= city
|
2017-05-22 16:42:21 +02:00
|
|
|
.field.region.required
|
2014-07-12 13:58:54 +02:00
|
|
|
= f.label :region
|
2017-05-27 17:46:01 +02:00
|
|
|
= render partial: '/regions/selector', locals: { f: f }
|
2014-09-26 01:26:33 +02:00
|
|
|
.field.locality
|
2014-07-12 13:58:54 +02:00
|
|
|
= f.label :locality
|
2015-02-28 17:28:05 +01:00
|
|
|
%span.radios
|
|
|
|
= f.radio_button :locality, 0
|
|
|
|
= f.label 'locality_0' do
|
|
|
|
%em.fa.fa-shield
|
|
|
|
= t 'attributes.locality_0'
|
|
|
|
= f.radio_button :locality, 1
|
|
|
|
= f.label 'locality_1' do
|
|
|
|
%em.fa.fa-globe
|
|
|
|
= t 'attributes.locality_1'
|
2014-08-23 16:59:42 +02:00
|
|
|
|
2017-05-22 16:42:21 +02:00
|
|
|
.field.description.required{ title: t('.description_helper') }
|
|
|
|
= f.label :description
|
|
|
|
/= f.text_area :description, rows: 25, class: :description
|
|
|
|
= f.text_field :description, class: :description
|
|
|
|
|
|
|
|
.field.url{ title: t('.url_helper') }
|
2014-07-12 13:58:54 +02:00
|
|
|
= f.label :url
|
2017-04-22 11:35:37 +02:00
|
|
|
= f.url_field :url, placeholder: 'Ex: http://april.org'
|
2017-05-22 16:42:21 +02:00
|
|
|
.field.contact.required{ title: t('.contact_helper') }
|
2014-07-12 13:58:54 +02:00
|
|
|
= f.label :contact
|
2014-11-09 15:23:04 +01:00
|
|
|
= f.email_field :contact, required: true
|
2017-05-22 16:42:21 +02:00
|
|
|
.field.submitter{ title: t('.submitter_helper') }
|
2013-12-28 23:45:13 +01:00
|
|
|
= f.label :submitter
|
2014-11-09 15:23:04 +01:00
|
|
|
= f.email_field :submitter
|
2017-05-22 16:42:21 +02:00
|
|
|
|
|
|
|
.field.tags{ title: t('.tags_helper') }
|
2017-06-02 13:15:23 +02:00
|
|
|
= f.label :tags, for: 'event_tag_list_tag'
|
2016-12-17 16:59:11 +01:00
|
|
|
= f.text_field :tag_list, value: f.object.tag_list.to_s
|
2014-01-01 21:26:35 +01:00
|
|
|
|
2017-05-22 16:42:21 +02:00
|
|
|
- unless @event.moderated?
|
|
|
|
.field.repeat{ title: t('.rule_helper') }
|
|
|
|
= f.label :repeat
|
|
|
|
= f.number_field :repeat, in: 0..40
|
|
|
|
.field.rule
|
|
|
|
= f.label :rule
|
|
|
|
%span.radios
|
|
|
|
- Event::RULES.each do |rule|
|
|
|
|
= f.radio_button :rule, rule
|
|
|
|
= f.label "rule_#{rule}",
|
|
|
|
t(rule, scope: 'activerecord.attributes.event.rule_values')
|
|
|
|
|
2013-12-28 23:45:13 +01:00
|
|
|
.actions
|
2017-08-26 21:49:54 +02:00
|
|
|
= f.button formaction: url_for(action: @event.new_record? ? :preview_create : :preview) do
|
2014-08-25 23:38:09 +02:00
|
|
|
%em.fa.fa-eye
|
2014-12-13 15:53:32 +01:00
|
|
|
= t '.visualise'
|
2014-10-15 01:09:42 +02:00
|
|
|
|
2014-08-25 23:38:09 +02:00
|
|
|
= f.button do
|
|
|
|
%em.fa.fa-check
|
2014-12-13 15:53:32 +01:00
|
|
|
= t '.save'
|