Travail sur apparence du formulaire de soumission
This commit is contained in:
parent
5aaea40fc8
commit
23d7343de9
|
@ -1,9 +1,11 @@
|
||||||
$(document).ready ->
|
$(document).ready ->
|
||||||
# Setup the graphical editor for event's description
|
# Setup the graphical editor for event's description
|
||||||
tinyMCE.init
|
tinyMCE.init
|
||||||
selector: 'textarea#event_description',
|
|
||||||
menubar : false,
|
|
||||||
schema: 'html5',
|
schema: 'html5',
|
||||||
|
menubar: false,
|
||||||
|
language: 'fr_FR',
|
||||||
|
selector: 'textarea#event_description',
|
||||||
|
content_css: '/assets/application.css',
|
||||||
entity_encoding : 'raw',
|
entity_encoding : 'raw',
|
||||||
add_unload_trigger: true,
|
add_unload_trigger: true,
|
||||||
browser_spellcheck: true,
|
browser_spellcheck: true,
|
||||||
|
|
|
@ -112,7 +112,7 @@ header.top
|
||||||
font-weight: normal
|
font-weight: normal
|
||||||
margin-bottom: 21px
|
margin-bottom: 21px
|
||||||
|
|
||||||
main
|
main, body.mce-content-body
|
||||||
position: relative
|
position: relative
|
||||||
& > *
|
& > *
|
||||||
max-width: 80em
|
max-width: 80em
|
||||||
|
@ -141,6 +141,13 @@ main
|
||||||
hr
|
hr
|
||||||
margin: 10px 20px
|
margin: 10px 20px
|
||||||
|
|
||||||
|
&.mce-content-body
|
||||||
|
margin: 0
|
||||||
|
height: 100%
|
||||||
|
border: solid thin transparent
|
||||||
|
font-size: initial
|
||||||
|
font-family: georgia, serif
|
||||||
|
|
||||||
fieldset
|
fieldset
|
||||||
border: none
|
border: none
|
||||||
margin: 1em auto
|
margin: 1em auto
|
||||||
|
@ -165,10 +172,10 @@ label
|
||||||
+border-radius(0.4em)
|
+border-radius(0.4em)
|
||||||
input, textarea, select, a.button, button, .select2-container ul
|
input, textarea, select, a.button, button, .select2-container ul
|
||||||
color: black
|
color: black
|
||||||
margin: 3px
|
margin: 3px 0
|
||||||
border: 1px solid darkgray
|
border: 1px solid darkgray
|
||||||
outline: none
|
outline: none
|
||||||
padding: 2px 4px
|
padding: 0.2em 0.4em
|
||||||
font-size: inherit
|
font-size: inherit
|
||||||
font-family: inherit
|
font-family: inherit
|
||||||
background-color: white
|
background-color: white
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@import compass
|
@import compass
|
||||||
|
@import awesome_mixins
|
||||||
|
|
||||||
header.calendar-header
|
header.calendar-header
|
||||||
font-size: 1.5em
|
font-size: 1.5em
|
||||||
|
@ -9,7 +10,7 @@ header.calendar-header
|
||||||
&:first-child, &:last-child
|
&:first-child, &:last-child
|
||||||
margin: 0 0.3em
|
margin: 0 0.3em
|
||||||
|
|
||||||
.city:after
|
span.city:after, strong.city:after, em.city:after
|
||||||
content: ':'
|
content: ':'
|
||||||
|
|
||||||
p.full_address
|
p.full_address
|
||||||
|
@ -165,10 +166,8 @@ aside#lug-list
|
||||||
margin: 1px 5px 1px 6.6em
|
margin: 1px 5px 1px 6.6em
|
||||||
line-height: 0.9em
|
line-height: 0.9em
|
||||||
label
|
label
|
||||||
width: 6.3em
|
width: 6.2em
|
||||||
+inline-block()
|
+inline-block()
|
||||||
&:after
|
|
||||||
content: ':'
|
|
||||||
input[type=radio] + label
|
input[type=radio] + label
|
||||||
width: 20em
|
width: 20em
|
||||||
&:after
|
&:after
|
||||||
|
@ -176,11 +175,37 @@ aside#lug-list
|
||||||
.actions
|
.actions
|
||||||
text-align: center
|
text-align: center
|
||||||
input
|
input
|
||||||
margin: 0.4em
|
|
||||||
font-size: x-large
|
font-size: x-large
|
||||||
|
|
||||||
.mce-tinymce
|
.mce-tinymce
|
||||||
+inline-block()
|
+inline-block()
|
||||||
|
|
||||||
|
.field label:before
|
||||||
|
color: gray
|
||||||
|
.field.title label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.start_time label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.end_time label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.description label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.address label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.city label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.region label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.locality label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.contact label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.submitter label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.url label
|
||||||
|
+fa-icon('')
|
||||||
|
.field.tags label
|
||||||
|
+fa-icon('')
|
||||||
|
|
||||||
.description
|
.description
|
||||||
text-align: left
|
text-align: left
|
||||||
|
|
|
@ -8,14 +8,15 @@ class Event < ActiveRecord::Base
|
||||||
class_name: City
|
class_name: City
|
||||||
|
|
||||||
validates :title, presence: true
|
validates :title, presence: true
|
||||||
|
validate :end_after_start
|
||||||
validates :description, presence: true
|
validates :description, presence: true
|
||||||
validates :city, presence: true
|
validates :city, presence: true
|
||||||
validates :related_region, presence: true
|
validates :related_region, presence: true
|
||||||
validates :url, presence: true, format: %r{\Ahttps?:\/\/.*\z}
|
validates :url, presence: true, format: %r{\Ahttps?:\/\/.*\..*\z}
|
||||||
validates :contact, presence: true
|
validates :contact, presence: true
|
||||||
validates :contact, email: true
|
validates :contact, email: true
|
||||||
validates :submitter, email: true
|
validates :submitter, email: true
|
||||||
validate :end_after_start
|
validates :tags, presence: false, format: /\A[\p{Alnum}\s-]*\z/
|
||||||
|
|
||||||
geocoded_by :full_address, lookup: :nominatim
|
geocoded_by :full_address, lookup: :nominatim
|
||||||
# after_validation :geocode, if: -> (obj) { obj.address_changed? }
|
# after_validation :geocode, if: -> (obj) { obj.address_changed? }
|
||||||
|
@ -42,6 +43,11 @@ class Event < ActiveRecord::Base
|
||||||
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
|
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
|
||||||
scope :geo, -> { where 'latitude is not null and longitude is not null' }
|
scope :geo, -> { where 'latitude is not null and longitude is not null' }
|
||||||
|
|
||||||
|
before_validation do
|
||||||
|
# Tags are always downcased
|
||||||
|
self.tags = tags.mb_chars.downcase if tags
|
||||||
|
end
|
||||||
|
|
||||||
before_validation on: :create do
|
before_validation on: :create do
|
||||||
self.submission_time = DateTime.now
|
self.submission_time = DateTime.now
|
||||||
self.decision_time = DateTime.now
|
self.decision_time = DateTime.now
|
||||||
|
|
|
@ -9,64 +9,62 @@
|
||||||
= hidden_field_tag :secret, params[:secret]
|
= hidden_field_tag :secret, params[:secret]
|
||||||
|
|
||||||
.field.title
|
.field.title
|
||||||
.helper
|
|
||||||
:markdown
|
|
||||||
#{t '.title_helper'}
|
|
||||||
= f.label :title
|
= f.label :title
|
||||||
= f.text_field :title, required: true, size: 70
|
= f.text_field :title, required: true, size: 70,
|
||||||
|
placeholder: "#{t '.title_helper'}"
|
||||||
.field.start_time
|
.field.start_time
|
||||||
= f.label :start_time
|
= f.label :start_time
|
||||||
= f.datetime_local_field :start_time, required: true
|
= f.datetime_local_field :start_time, required: true
|
||||||
.field.end_time
|
.field.end_time
|
||||||
= f.label :end_time
|
= f.label :end_time
|
||||||
= f.datetime_local_field :end_time, required: true
|
= f.datetime_local_field :end_time, required: true
|
||||||
.field
|
.field.description
|
||||||
.helper
|
.helper
|
||||||
:markdown
|
:markdown
|
||||||
#{t '.description_helper'}
|
#{t '.description_helper'}
|
||||||
= f.label :description
|
= f.label :description
|
||||||
= f.text_area :description, rows: 25, cols: 90
|
= f.text_area :description, rows: 25, cols: 90
|
||||||
|
|
||||||
.field
|
.field.address
|
||||||
.helper
|
.helper
|
||||||
:markdown
|
:markdown
|
||||||
#{t '.address_helper'}
|
#{t '.address_helper'}
|
||||||
= f.label :address
|
= f.label :address
|
||||||
= f.text_field :address, size: 70
|
= f.text_field :address, size: 70
|
||||||
.field
|
.field.city
|
||||||
= f.label :city
|
= f.label :city
|
||||||
= f.text_field :city, required: true, size: 70, list: :cities
|
= f.text_field :city, required: true, size: 70, list: :cities
|
||||||
%datalist#cities
|
%datalist#cities
|
||||||
- City.connection.select_values('select distinct name from cities join events on name=city group by city order by count(*) desc').each do |name|
|
- Event.group(:city).order('count(city) desc').pluck(:city).each do |city|
|
||||||
%option= name
|
%option= city
|
||||||
.field
|
.field.region
|
||||||
= f.label :region
|
= f.label :region
|
||||||
= f.select :region,
|
= f.select :region,
|
||||||
options_from_collection_for_select(Region.all, 'id', 'name', @event.region)
|
options_from_collection_for_select(Region.all, 'id', 'name', @event.region)
|
||||||
.field
|
.field.locality
|
||||||
= f.label :locality
|
= f.label :locality
|
||||||
= f.select :locality,
|
= f.select :locality,
|
||||||
options_for_select([[t('attributes.locality_0'), 0], [t('attributes.locality_1'), 1]], @event.locality)
|
options_for_select([[t('attributes.locality_0'), 0], [t('attributes.locality_1'), 1]], @event.locality)
|
||||||
|
|
||||||
.field
|
.field.url
|
||||||
.helper
|
.helper
|
||||||
:markdown
|
:markdown
|
||||||
#{t '.url_helper'}
|
#{t '.url_helper'}
|
||||||
= f.label :url
|
= f.label :url
|
||||||
= f.url_field :url, required: true, size: 70, placeholder: 'Ex: http://april.org'
|
= f.url_field :url, required: true, size: 70, placeholder: 'Ex: http://april.org'
|
||||||
.field
|
.field.contact
|
||||||
.helper
|
.helper
|
||||||
:markdown
|
:markdown
|
||||||
#{t '.contact_helper'}
|
#{t '.contact_helper'}
|
||||||
= f.label :contact
|
= f.label :contact
|
||||||
= f.email_field :contact, required: true, size: 70
|
= f.email_field :contact, required: true, size: 70
|
||||||
.field
|
.field.submitter
|
||||||
.helper
|
.helper
|
||||||
:markdown
|
:markdown
|
||||||
#{t '.submitter_helper'}
|
#{t '.submitter_helper'}
|
||||||
= f.label :submitter
|
= f.label :submitter
|
||||||
= f.email_field :submitter, size: 70
|
= f.email_field :submitter, size: 70
|
||||||
.field
|
.field.tags
|
||||||
.helper
|
.helper
|
||||||
:markdown
|
:markdown
|
||||||
#{t '.tags_helper'}
|
#{t '.tags_helper'}
|
||||||
|
|
|
@ -74,6 +74,8 @@ fr:
|
||||||
update:
|
update:
|
||||||
ok: Votre événement a été mis à jour
|
ok: Votre événement a été mis à jour
|
||||||
form:
|
form:
|
||||||
|
title_helper: Décrivez en moins de 5 mots votre événement, sans y
|
||||||
|
indiquer le lieu, la ville ou la date
|
||||||
address_helper: "*Associée à la ville et la région, elle générerera une
|
address_helper: "*Associée à la ville et la région, elle générerera une
|
||||||
carte [OpenStreetMap](http://www.openstreetmap.org), affichée aux côtés de
|
carte [OpenStreetMap](http://www.openstreetmap.org), affichée aux côtés de
|
||||||
l'événement*"
|
l'événement*"
|
||||||
|
|
|
@ -50,7 +50,7 @@ Si vous soumettez souvent un événement régulier dans l'Agenda du Libre, vous
|
||||||
" },
|
" },
|
||||||
|
|
||||||
{ locale: 'fr', key: 'events.form.title_helper',
|
{ locale: 'fr', key: 'events.form.title_helper',
|
||||||
value: '**Décrivez en moins de 5 mots votre événement, sans y indiquer le lieu, la ville ou la date.**' },
|
value: 'Décrivez en moins de 5 mots votre événement, sans y indiquer le lieu, la ville ou la date' },
|
||||||
|
|
||||||
{ locale: 'fr', key: 'events.form.description_helper',
|
{ locale: 'fr', key: 'events.form.description_helper',
|
||||||
value: '**Décrivez de la manière la plus complète possible votre événement.**' },
|
value: '**Décrivez de la manière la plus complète possible votre événement.**' },
|
||||||
|
|
|
@ -12,7 +12,7 @@ one:
|
||||||
contact: test@example.com
|
contact: test@example.com
|
||||||
submitter: test@example.com
|
submitter: test@example.com
|
||||||
moderated: 1
|
moderated: 1
|
||||||
tags: MyString
|
tags: my-string
|
||||||
secret: MyString
|
secret: MyString
|
||||||
decision_time: <%= 2.days.ago %>
|
decision_time: <%= 2.days.ago %>
|
||||||
submission_time: <%= 3.days.ago %>
|
submission_time: <%= 3.days.ago %>
|
||||||
|
@ -31,7 +31,7 @@ two:
|
||||||
contact: test2@example.com
|
contact: test2@example.com
|
||||||
submitter: test2@example.com
|
submitter: test2@example.com
|
||||||
moderated: 1
|
moderated: 1
|
||||||
tags: MyString
|
tags: my-string
|
||||||
secret: MyString
|
secret: MyString
|
||||||
decision_time: 2013-12-28 16:04:56
|
decision_time: 2013-12-28 16:04:56
|
||||||
submission_time: 2013-12-28 16:04:56
|
submission_time: 2013-12-28 16:04:56
|
||||||
|
@ -50,7 +50,7 @@ proposed:
|
||||||
contact: test2@example.com
|
contact: test2@example.com
|
||||||
submitter: test2@example.com
|
submitter: test2@example.com
|
||||||
moderated: 0
|
moderated: 0
|
||||||
tags: MyString
|
tags: my-string
|
||||||
secret: MyString
|
secret: MyString
|
||||||
decision_time: 2013-12-28 16:04:56
|
decision_time: 2013-12-28 16:04:56
|
||||||
submission_time: 2013-12-28 16:04:56
|
submission_time: 2013-12-28 16:04:56
|
||||||
|
|
|
@ -18,7 +18,7 @@ class ModerationMailerTest < ActionMailer::TestCase
|
||||||
event = Event.last
|
event = Event.last
|
||||||
older_event = Event.new event.attributes
|
older_event = Event.new event.attributes
|
||||||
|
|
||||||
event.tags += ', ho'
|
event.tags += ' ho'
|
||||||
event.start_time += 1.day
|
event.start_time += 1.day
|
||||||
event.description = event.description + '
|
event.description = event.description + '
|
||||||
hello world'
|
hello world'
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ModerationMailerPreview < ActionMailer::Preview
|
||||||
event = Event.last
|
event = Event.last
|
||||||
older_event = Event.new event.attributes
|
older_event = Event.new event.attributes
|
||||||
|
|
||||||
event.tags += ', ho'
|
event.tags += ' ho'
|
||||||
event.start_time += 1.day
|
event.start_time += 1.day
|
||||||
event.description = event.description + '
|
event.description = event.description + '
|
||||||
hello world'
|
hello world'
|
||||||
|
|
Loading…
Reference in New Issue