agenda-libre-ruby/app/views/events/_form.html.haml

95 lines
2.9 KiB
Plaintext
Raw Normal View History

= 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]
2013-12-28 23:45:13 +01:00
- if @event.errors.any?
#flash-messages
2014-05-31 23:13:43 +02:00
- @event.errors.full_messages.each do |msg|
%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
= f.label :start_time
= f.datetime_select :start_time, default: 1.day.from_now
2017-05-22 16:42:21 +02:00
.field.end_time.required
= f.label :end_time
= f.datetime_select :end_time, default: 1.day.from_now
.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'}
.field.address
2014-08-23 16:59:42 +02:00
= f.label :address
= f.text_field :address, list: :addresses
%datalist#addresses
2018-05-23 09:24:42 +02:00
- Event.where('address is not null').group(:address).order('1 desc').count.each do |r|
%option= r[0]
2017-05-22 16:42:21 +02:00
.field.city.required
= f.label :city
= f.text_field :city, required: true, list: :cities
%datalist#cities
2018-05-23 09:24:42 +02:00
- Event.group(:city).order('1 desc').count.each do |r|
%option= r[0]
2017-05-22 16:42:21 +02:00
.field.region.required
= f.label :region
= render partial: '/regions/selector', locals: { f: f }
.field.locality
= f.label :locality
%span.radios
= f.radio_button :locality, 0
= f.label 'locality_0' do
%em.fa.fa-shield-alt
= 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') }
= f.label :url
2017-10-14 21:39:56 +02:00
= f.url_field :url, placeholder: 'Ex: https://april.org'
.field.contact{ title: t('.contact_helper') }
= f.label :contact
= f.email_field :contact
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
= f.email_field :submitter
2017-05-22 16:42:21 +02:00
.field.tags{ title: t('.tags_helper') }
= f.label :tags, for: 'event_tag_list_tag'
= f.text_field :tag_list, value: f.object.tag_list.to_s
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
2018-01-21 23:25:31 +01:00
.field.rule.required
2017-05-22 16:42:21 +02:00
= 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
= f.button formaction: url_for(action: @event.new_record? ? :preview_create : :preview) do
%em.fa.fa-eye
= t '.visualise'
= f.button do
%em.fa.fa-check
= t '.save'