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

64 lines
2.2 KiB
Plaintext

- markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
= form_for @event do |f|
- if @event.errors.any?
#error_explanation.error.flash
%h2= "#{pluralize(@event.errors.count, "error")} prohibited this event from being saved:"
- @event.errors.full_messages.each do |msg|
%p= msg
- unless @event.id
= raw markdown.render t '.subtitle'
#advises= raw markdown.render t '.advises'
- else
= hidden_field_tag :secret, params[:secret]
.field
.helper= raw markdown.render t '.title_helper'
= f.label :title
= f.text_field :title, required: true, size: 70
.field
= f.label Event.human_attribute_name :start_time
= f.datetime_select :start_time, required: true
.field
= f.label Event.human_attribute_name :end_time
= f.datetime_select :end_time, required: true
.field
.helper= raw markdown.render t '.description_helper'
= f.label Event.human_attribute_name :description
= f.text_area :description, required: true, rows: 29, cols: 80
.field
= f.label Event.human_attribute_name :city
= f.text_field :city, required: true, size: 70
.field
= f.label Event.human_attribute_name :region
= f.select :region,
options_from_collection_for_select(Region.all, 'id', 'name', @event.region && @event.region.id)
.field
= f.label Event.human_attribute_name :locality
= f.select :locality,
options_for_select([[t('attributes.locality_0'), 0], [t('attributes.locality_1'), 1]], @event.locality)
.field
.helper= raw markdown.render t '.url_helper'
= f.label Event.human_attribute_name :url
= f.text_field :url, required: true, size: 70
.field
.helper= raw markdown.render t '.contact_helper'
= f.label Event.human_attribute_name :contact
= f.text_field :contact, required: true, size: 70
.field
.helper= raw markdown.render t '.submitter_helper'
= f.label :submitter
= f.text_field :submitter, required: true, size: 70
.field
.helper= raw markdown.render t '.tags_helper'
= f.label :tags
= f.text_field :tags, size: 70
.actions
= f.submit t('.visualise'), name: :visu
= f.submit t('.save')