Proposer un événement est fonctionnel
This commit is contained in:
parent
34f9e33fa5
commit
ea6694837b
1
Gemfile
1
Gemfile
@ -52,6 +52,7 @@ gem 'font-awesome-rails'
|
||||
gem 'compass-rails', "~> 2.0.alpha.0"
|
||||
gem 'has_scope'
|
||||
gem 'simple_calendar', github: 'echarp/simple_calendar'
|
||||
gem 'redcarpet'
|
||||
|
||||
group :development do
|
||||
gem 'guard-livereload'
|
||||
|
@ -7,7 +7,7 @@ GIT
|
||||
|
||||
GIT
|
||||
remote: git://github.com/gregbell/active_admin.git
|
||||
revision: 5e4fe269a32e491d8454ed586a5321a6cfc088cd
|
||||
revision: 0f333d3a0236de1b13e1cd8cda35f1406c0ceba8
|
||||
specs:
|
||||
activeadmin (1.0.0.pre)
|
||||
arbre (~> 1.0)
|
||||
@ -188,11 +188,12 @@ GEM
|
||||
actionpack (>= 3.0)
|
||||
activerecord (>= 3.0)
|
||||
polyamorous (~> 0.6.0)
|
||||
rb-fsevent (0.9.3)
|
||||
rb-fsevent (0.9.4)
|
||||
rb-inotify (0.9.3)
|
||||
ffi (>= 0.5.0)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
redcarpet (3.0.0)
|
||||
responders (1.0.0)
|
||||
railties (>= 3.2, < 5)
|
||||
sass (3.2.13)
|
||||
@ -250,6 +251,7 @@ DEPENDENCIES
|
||||
mysql2
|
||||
rails
|
||||
rails-i18n
|
||||
redcarpet
|
||||
sass-rails
|
||||
sdoc
|
||||
simple_calendar!
|
||||
|
@ -25,3 +25,5 @@ guard :minitest do
|
||||
watch(%r{^test/.+_test\.rb})
|
||||
watch(%r{^test/test_helper\.rb}) { 'test' }
|
||||
end
|
||||
|
||||
notification :notifysend
|
||||
|
@ -43,22 +43,22 @@ header.top
|
||||
letter-spacing: 2px
|
||||
h2
|
||||
font-size: 0.8em
|
||||
margin-top: 12px
|
||||
margin-top: 0.9em
|
||||
font-style: italic
|
||||
font-weight: normal
|
||||
padding-bottom: 5px
|
||||
|
||||
ul.countries
|
||||
top: -8px
|
||||
right: 0.6em
|
||||
right: 0.5em
|
||||
position: absolute
|
||||
font-size: 0.7em
|
||||
list-style-type: none
|
||||
li
|
||||
text-align: left
|
||||
line-height: 1.2em
|
||||
line-height: 1.3em
|
||||
img
|
||||
margin-right: 0.6em
|
||||
margin-right: 0.65em
|
||||
vertical-align: middle
|
||||
|
||||
main
|
||||
@ -78,12 +78,14 @@ main
|
||||
margin-left: 2em
|
||||
line-height: 1.3em
|
||||
p
|
||||
margin: 0.9em 0
|
||||
margin: 0.95em 0
|
||||
line-height: 1.3em
|
||||
text-align: justify
|
||||
hr
|
||||
margin: 10px 20px
|
||||
|
||||
footer.bottom nav
|
||||
margin: 29px auto -3px
|
||||
margin: 18px auto -3px
|
||||
font-size: smaller
|
||||
a + a:before
|
||||
color: black
|
||||
|
@ -1,27 +1,28 @@
|
||||
@import "compass"
|
||||
|
||||
form.region_selector
|
||||
width: 98.4%
|
||||
width: 98%
|
||||
position: absolute
|
||||
margin-top: 2.6em
|
||||
label
|
||||
display: none
|
||||
|
||||
main form.region_selector + h2
|
||||
width: 100%
|
||||
margin-top: 1.1em
|
||||
margin-bottom: 2.5em
|
||||
margin-bottom: 2.32em
|
||||
a
|
||||
font-weight: normal
|
||||
&.previous-month
|
||||
margin-right: 0.33em
|
||||
margin-right: 8px
|
||||
&.next-month
|
||||
margin-left: 0.33em
|
||||
margin-left: 8px
|
||||
|
||||
// For whole year calendar
|
||||
main form.region_selector + h2 + h2
|
||||
padding: 1px 0 0
|
||||
padding: 6px 0 0
|
||||
font-size: 1.2em
|
||||
margin-bottom: 19px
|
||||
margin-bottom: 0.8em
|
||||
|
||||
table.calendar + h2
|
||||
margin: 1em
|
||||
@ -32,59 +33,71 @@ table.calendar
|
||||
margin: 0 auto
|
||||
padding: 0
|
||||
border-spacing: 2px
|
||||
th
|
||||
padding: 0 0 5px 0
|
||||
text-transform: capitalize
|
||||
td
|
||||
width: 14% !important
|
||||
height: 4.8em
|
||||
border: 1px solid #89B7E5
|
||||
vertical-align: top
|
||||
background-color: #A1C3E7
|
||||
&.not-current-month
|
||||
border: none
|
||||
background-color: #ededed
|
||||
li
|
||||
color: #555
|
||||
.event
|
||||
a:link, a:visited
|
||||
color: #888
|
||||
&.today
|
||||
border: 1px solid #FFB578
|
||||
background-color: #ffe0c7
|
||||
tr
|
||||
th
|
||||
padding-bottom: 0.35em
|
||||
text-transform: capitalize
|
||||
td
|
||||
width: 14% !important
|
||||
height: 4.8em
|
||||
border: 1px solid #89B7E5
|
||||
vertical-align: top
|
||||
background-color: #A1C3E7
|
||||
&.today
|
||||
border: 1px solid #FFB578
|
||||
background-color: #ffe0c7
|
||||
.day_number
|
||||
color: #544f32
|
||||
font-size: 0.8em
|
||||
margin-top: -1px
|
||||
&.future
|
||||
border-color: rgb(150, 207, 255)
|
||||
background-color: #C6E5FF
|
||||
.day_number
|
||||
font-size: 0.8em
|
||||
margin-top: -1px
|
||||
&.not-current-month
|
||||
border: none
|
||||
background-color: #ededed
|
||||
li
|
||||
color: #555
|
||||
.event
|
||||
a:link, a:visited
|
||||
color: #888
|
||||
|
||||
.day_number
|
||||
color: #544f32
|
||||
font-size: 0.8em
|
||||
float: left
|
||||
color: #727070
|
||||
margin: 0 1px 3px 1px
|
||||
font-size: 0.6em
|
||||
font-weight: bolder
|
||||
line-height: 1.2em
|
||||
letter-spacing: 2px
|
||||
&:hover .day_number
|
||||
color: black
|
||||
|
||||
.day_number
|
||||
float: left
|
||||
color: #727070
|
||||
margin: 0 1px 3px 1px
|
||||
font-size: 0.6em
|
||||
font-weight: bolder
|
||||
line-height: 1.2em
|
||||
letter-spacing: 2px
|
||||
ul
|
||||
clear: left
|
||||
margin-left: 0
|
||||
padding-left: 15px
|
||||
list-style-type: circle
|
||||
li
|
||||
color: #444
|
||||
padding: 0
|
||||
margin-bottom: 5px
|
||||
ul
|
||||
clear: left
|
||||
margin-left: 0
|
||||
padding-left: 15px
|
||||
list-style-type: circle
|
||||
li
|
||||
color: #444
|
||||
margin: 0
|
||||
padding: 0
|
||||
margin-bottom: 5px
|
||||
|
||||
.event
|
||||
font-size: smaller
|
||||
line-height: 1.1em
|
||||
strong:after
|
||||
content: ':'
|
||||
margin-right: -1px
|
||||
a:link, a:visited
|
||||
color: #666
|
||||
font-weight: normal
|
||||
&:hover
|
||||
color: black
|
||||
.event
|
||||
font-size: smaller
|
||||
line-height: 1.1em
|
||||
strong:after
|
||||
content: ':'
|
||||
margin-right: -1px
|
||||
a:link, a:visited
|
||||
color: #666
|
||||
font-weight: normal
|
||||
&:hover
|
||||
color: black
|
||||
|
||||
.formats
|
||||
width: 90%
|
||||
@ -114,3 +127,41 @@ table.calendar
|
||||
li
|
||||
margin-left: 2em
|
||||
line-height: 1.3em
|
||||
|
||||
#advises
|
||||
border: 1px solid #FFB578
|
||||
margin: 10px 100px 20px 100px
|
||||
text-align: left
|
||||
padding-left: 10px
|
||||
padding-right: 10px
|
||||
background-color: #ffe0c7
|
||||
h1
|
||||
font-size: 1.9em
|
||||
text-align: center
|
||||
font-weight: normal
|
||||
a
|
||||
color: #8F4900
|
||||
|
||||
form
|
||||
.field, .actions
|
||||
text-align: left
|
||||
margin-left: 2px
|
||||
margin-bottom: 2px !important
|
||||
*
|
||||
vertical-align: middle
|
||||
p.helper
|
||||
margin: 1px 5px 1px 6.6em
|
||||
line-height: 0.9em
|
||||
label
|
||||
width: 6.3em
|
||||
display: inline-block
|
||||
&:after
|
||||
content: ':'
|
||||
input, textarea, select
|
||||
margin: 3px 0
|
||||
border: 1px solid #868686
|
||||
&:focus
|
||||
background-color: #F0F8FF
|
||||
.actions
|
||||
margin-left: 6.75em
|
||||
margin-bottom: 10px
|
||||
|
@ -1,69 +0,0 @@
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
p, ol, ul, td {
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #eee;
|
||||
padding: 10px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
&:visited {
|
||||
color: #666;
|
||||
}
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
&.field, &.actions {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#notice {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.field_with_errors {
|
||||
padding: 2px;
|
||||
background-color: red;
|
||||
display: table;
|
||||
}
|
||||
|
||||
#error_explanation {
|
||||
width: 450px;
|
||||
border: 2px solid red;
|
||||
padding: 7px;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f0f0f0;
|
||||
h2 {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
padding: 5px 5px 5px 15px;
|
||||
font-size: 12px;
|
||||
margin: -7px;
|
||||
margin-bottom: 0px;
|
||||
background-color: #c00;
|
||||
color: #fff;
|
||||
}
|
||||
ul li {
|
||||
font-size: 12px;
|
||||
list-style: square;
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
class EventsController < InheritedResources::Base
|
||||
before_action :set_event, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@ -28,8 +30,58 @@ class EventsController < InheritedResources::Base
|
||||
end
|
||||
end
|
||||
|
||||
# POST /events
|
||||
# POST /events.json
|
||||
def create
|
||||
@event = Event.new(event_params)
|
||||
# This is a special case, required to handle the region attribute with same foreign key name
|
||||
@event.region = Region.find(params[:event][:region])
|
||||
|
||||
if (params[:visu])
|
||||
logger.info 'XXXXXXXXXXXXXXX'
|
||||
render action: 'new'
|
||||
return
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @event.save
|
||||
format.html { redirect_to @event, notice: 'Event was successfully created.' }
|
||||
format.json { render action: 'show', status: :created, location: @event }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @event.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /events/1
|
||||
# PATCH/PUT /events/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
# This is a special case, required to handle the region attribute with same foreign key name
|
||||
@event.region = Region.find(params[:event][:region])
|
||||
if @event.update(event_params)
|
||||
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: 'edit' }
|
||||
format.json { render json: @event.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def permitted_params
|
||||
params.permit city: [:name, :majname, :postalcode, :inseecode, :regioncode, :latitude, :longitude]
|
||||
end
|
||||
def permitted_params
|
||||
params.permit event: [:title, :start_time, :end_time, :description, :city, :locality, :url, :contact, :submitter, :tags]
|
||||
end
|
||||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_event
|
||||
@event = Event.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def event_params
|
||||
params.require(:event).permit(:title, :start_time, :end_time, :description, :city, :locality, :url, :contact, :submitter, :tags)
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,10 @@
|
||||
class Event < ActiveRecord::Base
|
||||
belongs_to :region, foreign_key: 'region'
|
||||
|
||||
validates_presence_of :region
|
||||
|
||||
default_scope { where moderated: 1 }
|
||||
|
||||
scope :year, -> year {
|
||||
where "end_time >= ? and start_time < ?",
|
||||
"#{year}-1-1", "#{year.to_i+1}-1-1"
|
||||
@ -12,6 +16,12 @@ class Event < ActiveRecord::Base
|
||||
scope :region, -> region { where region: region }
|
||||
scope :tag, -> tag { where "tags like ?", "%#{tag}%" }
|
||||
|
||||
before_validation(on: :create) do
|
||||
self.submission_time = Date.today
|
||||
self.decision_time = Date.today
|
||||
end
|
||||
|
||||
|
||||
def same_day?
|
||||
start_time.to_date == end_time.to_date
|
||||
end
|
||||
|
@ -1,3 +1,8 @@
|
||||
- if @event && params[:visu]
|
||||
%hr/
|
||||
= render file: '/events/show'
|
||||
%hr/
|
||||
|
||||
= form_for @event do |f|
|
||||
- if @event.errors.any?
|
||||
#error_explanation
|
||||
@ -6,59 +11,91 @@
|
||||
- @event.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
:markdown
|
||||
Cette page permet de soumettre un évènement dans l'Agenda du Libre. Celui-ci n'apparaîtra pas automatiquement dans l'Agenda, il sera tout d'abord validé par un modérateur. Un courrier électronique vous sera envoyé à l'adresse e-mail de contact donnée ci-dessous lorsque l'évènement aura été modéré.
|
||||
|
||||
#advises
|
||||
%h1 Recommandations importantes
|
||||
|
||||
:markdown
|
||||
Ces quelques recommandations vous permettront de proposer un évènement qui sera validé plus rapidement, et dont la lisibilité sera meilleure pour les utilisateurs de l'Agenda du Libre.
|
||||
|
||||
* L'évènement doit concerner le **Logiciel Libre**. L'agenda n'a pas vocation à publier d'autres types d'évènements.
|
||||
* Le texte des évènements doit être rédigé en français, en **évitant les fautes de grammaire et d'orthographe**.
|
||||
* Donnez une description **rédigée** de l'évènement, avec des phrases, plutôt qu'un style télégraphique.
|
||||
* Commencez la description de votre évènement par une phrase reprenant les informations principales, telle que : _« L'association [Zorglub](http://www.asso-zorglub.org) organise une conférence sur le thème des **modèles économiques du Logiciel Libre** le samedi 21 mars de 18h à 20h à la médiathèque Champillion de Montpellier. »_
|
||||
* Pensez que le lecteur peut ne pas connaître votre association, le logiciel dont il sera question, etc., donc donnez à chaque fois toutes les informations nécessaires. Rappelez **le principe de l'évènement, le public visé, le lieu exact, la date, l'heure**, même si il est régulier (repas, rencontre régulière, etc.) et que vous avez déjà soumis un évènement du même type dans l'Agenda.
|
||||
* **Égayez au maximum la description** de votre évènement: lien vers le site de votre association, vers le logiciel ou le langage dont il sera question, vers les organismes partenaires, etc. Pour cela, utilisez les balises HTML pour mettre en gras, en italique, faire des paragraphes et des liens.
|
||||
* Ne mettez pas l'intégralité des mots en majuscule, que ce soit dans le titre, le nom de la ville ou la description.
|
||||
* Donnez l'**adresse directe** d'un site Web donnant plus d'informations sur l'évènement. Si l'adresse est la page d'accueil du site de votre organisation, veillez à ce que l'évènement soit clairement visible, et que le lecteur n'ait pas à chercher trop longtemps avant de trouver l'information qu'il cherche.
|
||||
* La description de l'évènement ne doit pas ressembler à une publicité éhontée pour votre entreprise, projet ou logiciel. Le ton d'un communiqué de presse, par exemple, ne convient pas pour l'Agenda du Libre.
|
||||
* Les évènements de type professionnel sont acceptés dès lors qu'ils sont accessibles et ouverts à tous. Les évènements payants sont acceptés si le prix de l'entrée ne réserve pas l'évènement à un public uniquement professionnel.
|
||||
|
||||
L'équipe de modération se réserve le droit de modifier la description de l'évènement pour la rendre plus complète, plus lisible ou plus attrayante.
|
||||
|
||||
Si vous soumettez souvent un évènement régulier dans l'Agenda du Libre, vous pouvez automatiser cette procédure à l'aide d'un [script que nous vous proposons](http://agendadulibre.org/submit-script-doc.php).
|
||||
|
||||
.field
|
||||
%p.helper
|
||||
%strong Décrivez en moins de 5 mots votre évènement, sans y indiquer le lieu, la ville ou la date.
|
||||
= f.label :title
|
||||
= f.text_field :title
|
||||
= f.text_field :title, size: 70
|
||||
.field
|
||||
= f.label :description
|
||||
= f.text_area :description
|
||||
.field
|
||||
= f.label :start_time
|
||||
= f.label Event.human_attribute_name :start_time
|
||||
= f.datetime_select :start_time
|
||||
.field
|
||||
= f.label :end_time
|
||||
= f.label Event.human_attribute_name :end_time
|
||||
= f.datetime_select :end_time
|
||||
.field
|
||||
= f.label :city
|
||||
= f.text_field :city
|
||||
%p.helper
|
||||
%strong Décrivez de la manière la plus complète possible votre évènement.
|
||||
%p.helper
|
||||
%em
|
||||
:escaped
|
||||
Les balises HTML autorisées sont <p>, <b>, <i>, <ul>, <ol>, <li>, <br/>, <a>. Merci d'utiliser ces balises pour formater la description de votre évènement.
|
||||
%p.helper
|
||||
%em
|
||||
:escaped
|
||||
Veillez à utiliser les balises <p> pour formater les paragraphes, et non la balise <br/>.
|
||||
= f.label Event.human_attribute_name :description
|
||||
= f.text_area :description, rows: 29, cols: 80
|
||||
|
||||
.field
|
||||
= f.label :region
|
||||
= f.text_field :region
|
||||
= f.label Event.human_attribute_name :city
|
||||
= f.text_field :city, size: 70
|
||||
.field
|
||||
= f.label :locality
|
||||
= f.number_field :locality
|
||||
= f.label Event.human_attribute_name :region
|
||||
= f.select :region,
|
||||
options_from_collection_for_select(Region.all, 'id', 'name', params[:region])
|
||||
.field
|
||||
= f.label :url
|
||||
= f.text_field :url
|
||||
= f.label Event.human_attribute_name :locality
|
||||
= f.select :locality,
|
||||
options_for_select([[t('attributes.locality_0'), 0], [t('attributes.locality_1'), 1]], params[:locality])
|
||||
.field
|
||||
= f.label :contact
|
||||
= f.text_field :contact
|
||||
%p.helper
|
||||
%em
|
||||
Lien
|
||||
%strong direct
|
||||
vers une page donnant plus d'informations sur l'évènement (lieu précis, horaire précis, programme précis...)
|
||||
= f.label Event.human_attribute_name :url
|
||||
= f.text_field :url, size: 70
|
||||
.field
|
||||
= f.label :contact
|
||||
= f.text_field :contact
|
||||
%p.helper
|
||||
%em Adresse e-mail de contact. Elle sera affichée de manière peu compréhensible par les spammeurs.
|
||||
= f.label Event.human_attribute_name :contact
|
||||
= f.text_field :contact, size: 70
|
||||
.field
|
||||
%p.helper
|
||||
%em Adresse e-mail du soumetteur de l'évènement. Elle ne sera utilisée que par les modérateurs pour contacter la personne ayant proposé l'évènement, pour lui informer de sa validation ou de son rejet. Si cette adresse n'est pas présente, l'adresse de contact sera utilisée
|
||||
= f.label :submitter
|
||||
= f.text_field :submitter
|
||||
.field
|
||||
= f.label :moderated
|
||||
= f.number_field :moderated
|
||||
= f.text_field :submitter, size: 70
|
||||
.field
|
||||
%p.helper
|
||||
%em Tags pour l'évènement. Les tags sont séparés par des espaces. Un tag ne peut contenir que des lettres minuscules, des chiffres et des tirets.
|
||||
%p.helper Dans les tags, indiquez le nom de la ou des associations organisatrices. N'indiquez pas le nom de la ville ou de la région.
|
||||
= f.label :tags
|
||||
= f.text_field :tags
|
||||
.field
|
||||
= f.label :secret
|
||||
= f.text_field :secret
|
||||
.field
|
||||
= f.label :decision_time
|
||||
= f.datetime_select :decision_time
|
||||
.field
|
||||
= f.label :submission_time
|
||||
= f.datetime_select :submission_time
|
||||
.field
|
||||
= f.label :moderator_mail_id
|
||||
= f.text_field :moderator_mail_id
|
||||
.field
|
||||
= f.label :submitter_mail_id
|
||||
= f.text_field :submitter_mail_id
|
||||
= f.text_field :tags, size: 70
|
||||
|
||||
.actions
|
||||
= f.submit 'Save'
|
||||
= f.submit t('.visualise'), name: :visu
|
||||
= f.submit t('.save')
|
||||
|
@ -1,7 +1,5 @@
|
||||
%h1 Editing event
|
||||
%h2=t '.title'
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Show', @event
|
||||
\|
|
||||
= link_to 'Back', events_path
|
||||
|
@ -1,5 +1,3 @@
|
||||
%h1 New event
|
||||
%h2=t '.title'
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Back', events_path
|
||||
|
@ -1,15 +1,17 @@
|
||||
%p#notice= notice
|
||||
|
||||
#lug-list
|
||||
%h1=t '.lug-list'
|
||||
%ul
|
||||
- @event.region.lugs.order(department: :asc).each do |lug|
|
||||
%li
|
||||
= link_to lug.name, lug.url
|
||||
(#{lug.department})
|
||||
- if @event.id
|
||||
#lug-list
|
||||
%h1=t '.lug-list'
|
||||
- if @event.region
|
||||
%ul
|
||||
- @event.region.lugs.order(department: :asc).each do |lug|
|
||||
%li
|
||||
= link_to lug.name, lug.url
|
||||
(#{lug.department})
|
||||
|
||||
%h1 Actions
|
||||
= link_to t('.add_to_calendar'), root_url
|
||||
%h1 Actions
|
||||
= link_to t('.add_to_calendar'), root_url
|
||||
|
||||
%h2
|
||||
%em
|
||||
@ -23,7 +25,7 @@
|
||||
%p
|
||||
- if @event.same_day?
|
||||
Le #{l @event.start_time.to_date, format: :long},
|
||||
de #{l @event.start_time, format: :hours} à #{l @event.end_time, format: :hours}.</p>
|
||||
de #{l @event.start_time, format: :hours} à #{l @event.end_time, format: :hours}.
|
||||
- else
|
||||
Du
|
||||
=l @event.start_time, format: :at
|
||||
@ -34,7 +36,7 @@
|
||||
À
|
||||
%em
|
||||
= link_to(@event.city, "http://fr.wikipedia.org/wiki/#{@event.city}") + ','
|
||||
= link_to @event.region.name, "http://fr.wikipedia.org/wiki/#{@event.region.name}"
|
||||
= link_to @event.region.name, "http://fr.wikipedia.org/wiki/#{@event.region.name}" rescue nil
|
||||
|
||||
%h3 Description
|
||||
=raw @event.description
|
||||
|
@ -4,4 +4,4 @@
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
# Mime::Type.register_alias "text/html", :iphone
|
||||
|
||||
Mime::Type.register "text/xml", :rss
|
||||
#Mime::Type.register "text/xml", :rss
|
||||
|
@ -44,3 +44,7 @@ en:
|
||||
password: Password
|
||||
lastname: Name
|
||||
firstname: First name
|
||||
time:
|
||||
formats:
|
||||
at: "%A %d %B %Y at %Hh%M"
|
||||
hours: "%Hh%M"
|
||||
|
@ -8,6 +8,8 @@ fr:
|
||||
id: ID
|
||||
name: Nom
|
||||
email: Email
|
||||
locality_0: Locale
|
||||
locality_1: Nationale
|
||||
created_at: Créé le
|
||||
updated_at: Modifié le
|
||||
created: Créé il y a %{date}
|
||||
@ -37,11 +39,24 @@ fr:
|
||||
department: Département
|
||||
url: Adresse web
|
||||
city: Cité
|
||||
event:
|
||||
title: Titre
|
||||
start_time: Début
|
||||
end_time: Fin
|
||||
description: Description
|
||||
city: Ville
|
||||
region: Région
|
||||
locality: Portée
|
||||
url: URL
|
||||
contact: Contact
|
||||
submitter: Soumetteur
|
||||
|
||||
helpers:
|
||||
submit:
|
||||
create: "Créer %{model}"
|
||||
update: "Mettre à jour %{model}"
|
||||
event:
|
||||
create: Visualiser
|
||||
|
||||
date:
|
||||
abbr_day_names:
|
||||
@ -80,3 +95,10 @@ fr:
|
||||
show:
|
||||
lug-list: Groupes d'utilisateurs de la région
|
||||
add_to_calendar: Ajouter à mon calendrier
|
||||
new:
|
||||
title: Soumettre un évènement
|
||||
edit:
|
||||
title: Éditer un évènement
|
||||
form:
|
||||
save: Valider
|
||||
visualise: Visualiser
|
||||
|
@ -16,9 +16,43 @@ class EventsControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should preview event" do
|
||||
assert_no_difference('Event.count') do
|
||||
post :create, visu: 'visualise', event: {
|
||||
title: @event.title,
|
||||
start_time: @event.start_time,
|
||||
end_time: @event.end_time,
|
||||
description: @event.description,
|
||||
city: @event.city,
|
||||
region: regions(:region_one),
|
||||
locality: @event.locality,
|
||||
url: @event.url,
|
||||
contact: @event.contact,
|
||||
submitter: @event.submitter,
|
||||
submitter_mail_id: @event.submitter_mail_id,
|
||||
tags: @event.tags
|
||||
}
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create event" do
|
||||
assert_difference('Event.count') do
|
||||
post :create, event: { city: @event.city, contact: @event.contact, contact: @event.contact, decision_time: @event.decision_time, description: @event.description, end_time: @event.end_time, locality: @event.locality, moderated: @event.moderated, moderator_mail_id: @event.moderator_mail_id, region_id: @event.region_id, secret: @event.secret, start_time: @event.start_time, submission_time: @event.submission_time, submitter: @event.submitter, submitter_mail_id: @event.submitter_mail_id, tags: @event.tags, title: @event.title, url: @event.url }
|
||||
post :create, event: {
|
||||
title: @event.title,
|
||||
start_time: @event.start_time,
|
||||
end_time: @event.end_time,
|
||||
description: @event.description,
|
||||
city: @event.city,
|
||||
region: regions(:region_one),
|
||||
locality: @event.locality,
|
||||
url: @event.url,
|
||||
contact: @event.contact,
|
||||
submitter: @event.submitter,
|
||||
submitter_mail_id: @event.submitter_mail_id,
|
||||
tags: @event.tags
|
||||
}
|
||||
end
|
||||
|
||||
assert_redirected_to event_path(assigns(:event))
|
||||
@ -35,7 +69,23 @@ class EventsControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
test "should update event" do
|
||||
patch :update, id: @event, event: { city: @event.city, contact: @event.contact, contact: @event.contact, decision_time: @event.decision_time, description: @event.description, end_time: @event.end_time, locality: @event.locality, moderated: @event.moderated, moderator_mail_id: @event.moderator_mail_id, region_id: @event.region_id, secret: @event.secret, start_time: @event.start_time, submission_time: @event.submission_time, submitter: @event.submitter, submitter_mail_id: @event.submitter_mail_id, tags: @event.tags, title: @event.title, url: @event.url }
|
||||
patch :update, id: @event, event: {
|
||||
title: @event.title,
|
||||
start_time: @event.start_time,
|
||||
end_time: @event.end_time,
|
||||
description: @event.description,
|
||||
city: @event.city,
|
||||
region: regions(:region_one),
|
||||
locality: @event.locality,
|
||||
url: @event.url,
|
||||
contact: @event.contact,
|
||||
moderated: @event.moderated,
|
||||
moderator_mail_id: @event.moderator_mail_id,
|
||||
secret: @event.secret,
|
||||
submission_time: @event.submission_time,
|
||||
submitter: @event.submitter,
|
||||
submitter_mail_id: @event.submitter_mail_id,
|
||||
tags: @event.tags }
|
||||
assert_redirected_to event_path(assigns(:event))
|
||||
end
|
||||
|
||||
|
6
test/fixtures/events.yml
vendored
6
test/fixtures/events.yml
vendored
@ -6,11 +6,10 @@ one:
|
||||
start_time: 2013-12-28 16:04:56
|
||||
end_time: 2013-12-28 16:04:56
|
||||
city: MyString
|
||||
region_id:
|
||||
region: region_one
|
||||
locality: 1
|
||||
url: MyString
|
||||
contact: MyString
|
||||
contact: MyString
|
||||
submitter: MyString
|
||||
moderated: 1
|
||||
tags: MyString
|
||||
@ -26,11 +25,10 @@ two:
|
||||
start_time: 2013-12-28 16:04:56
|
||||
end_time: 2013-12-28 16:04:56
|
||||
city: MyString
|
||||
region_id:
|
||||
region: region_one
|
||||
locality: 1
|
||||
url: MyString
|
||||
contact: MyString
|
||||
contact: MyString
|
||||
submitter: MyString
|
||||
moderated: 1
|
||||
tags: MyString
|
||||
|
4
test/fixtures/regions.yml
vendored
4
test/fixtures/regions.yml
vendored
@ -1,7 +1,7 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
region_one:
|
||||
name: MyString
|
||||
name: Alsace
|
||||
|
||||
region_two:
|
||||
name: MyString
|
||||
name: Aquitaine
|
||||
|
Loading…
Reference in New Issue
Block a user