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

82 lines
2.3 KiB
Plaintext
Raw Normal View History

2014-07-01 15:50:39 +02:00
= form_for @event, url: (@moderation ? moderation_path(@moderation) : @event.persisted? ? event_path(@event) : nil) 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
.field.title
2013-12-28 23:45:13 +01:00
= f.label :title
= f.text_field :title, required: true, size: 70,
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, cols: 90
.field.address
.helper
:markdown
#{t '.address_helper'}
2014-08-23 16:59:42 +02:00
= f.label :address
= f.text_field :address, size: 70
.field.city
= f.label :city
= f.text_field :city, required: true, size: 70, 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,
2014-07-01 15:50:39 +02:00
options_from_collection_for_select(Region.all, 'id', 'name', @event.region)
.field.locality
= f.label :locality
= f.select :locality,
2014-01-06 11:22:39 +01:00
options_for_select([[t('attributes.locality_0'), 0], [t('attributes.locality_1'), 1]], @event.locality)
2014-08-23 16:59:42 +02:00
.field.url
.helper
:markdown
#{t '.url_helper'}
= f.label :url
2014-07-18 17:49:59 +02:00
= f.url_field :url, required: true, size: 70, placeholder: 'Ex: http://april.org'
.field.contact
.helper
:markdown
#{t '.contact_helper'}
= f.label :contact
2014-07-18 17:49:59 +02:00
= f.email_field :contact, required: true, size: 70
.field.submitter
.helper
:markdown
#{t '.submitter_helper'}
2013-12-28 23:45:13 +01:00
= f.label :submitter
2014-07-18 17:49:59 +02:00
= f.email_field :submitter, size: 70
.field.tags
.helper
:markdown
#{t '.tags_helper'}
2013-12-28 23:45:13 +01:00
= f.label :tags
= f.text_field :tags, size: 70
2013-12-28 23:45:13 +01:00
.actions
= f.button formaction: :preview do
%em.fa.fa-eye
=t '.visualise'
= f.button do
%em.fa.fa-check
=t '.save'