Les événements peuvent maintenant avoir un nom de lieu associé

This commit is contained in:
echarp 2015-03-08 23:41:52 +01:00
parent a2d588fdef
commit 4d0c2ec725
13 changed files with 83 additions and 86 deletions

View File

@ -54,6 +54,8 @@
content: $fa-var-toggle-off
.field.description label:before
content: $fa-var-pencil-square-o
.field.place_name label:before
content: $fa-var-flag
.field.address label:before
content: $fa-var-map-marker
.field.city label:before

View File

@ -109,8 +109,8 @@ class EventsController < ApplicationController
def event_params
params.require(:event)
.permit :lock_version, :title, :start_time, :end_time, :description,
:address, :city, :region_id, :locality, :url, :contact,
:submitter, :tags
:place_name, :address, :city, :region_id, :locality, :url,
:contact, :submitter, :tags
end
# Check that you can only edit an existing event if you know its secret

View File

@ -69,8 +69,8 @@ class ModerationsController < ApplicationController
def moderation_params
params.require(:event)
.permit :lock_version, :title, :start_time, :end_time, :description,
:address, :city, :region_id, :locality, :url, :contact,
:submitter, :tags
:place_name, :address, :city, :region_id, :locality, :url,
:contact, :submitter, :tags
end
# Useful to manage absolute url in mails

View File

@ -26,6 +26,9 @@
= f.label :description
= f.text_area :description, rows: 25
.field.place_name
= f.label :place_name
= f.text_field :place_name
.field.address
.helper
:markdown

View File

@ -6,6 +6,7 @@ xml.events do
xml.title event.title
xml.tag! 'start-time', event.start_time.strftime('%Y/%m/%d %T')
xml.tag! 'end-time', event.end_time.strftime('%Y/%m/%d %T')
xml.place_name event.place_name
xml.address event.address
xml.city event.city
xml.region event.region

View File

@ -38,6 +38,7 @@
start_time: @event.start_time + 1.month,
end_time: @event.end_time + 1.month,
description: @event.description,
place_name: @event.place_name,
address: @event.address,
city: @event.city,
region: @event.region,
@ -62,6 +63,8 @@
%p= display_date
%p.full_address
- if @event.place_name.present?
%span= @event.place_name
- if @event.address.present?
%span= @event.address
%span= link_to @event.city,

View File

@ -1,4 +1,4 @@
json.extract! @event, :id, :title, :description, :start_time, :end_time,
:address, :city, :region, :locality, :url, :contact, :contact,
:submitter, :moderated, :tags, :secret, :decision_time,
:place_name, :address, :city, :region, :locality, :url, :contact,
:contact, :submitter, :moderated, :tags, :secret, :decision_time,
:submission_time, :moderator_mail_id, :submitter_mail_id

View File

@ -2,6 +2,7 @@
#{Event.human_attribute_name(:title).concat(':').ljust 12 } #{@event.title}
#{Event.human_attribute_name(:start_time).concat(':').ljust 12 } #{l @event.start_time, format: :at}
#{Event.human_attribute_name(:end_time).concat(':').ljust 12 } #{l @event.end_time, format: :at}
#{Event.human_attribute_name(:place_name).concat(':').ljust 12 } #{@event.place_name}
#{Event.human_attribute_name(:address).concat(':').ljust 12 } #{@event.address}
#{Event.human_attribute_name(:city).concat(':').ljust 12 } #{@event.city}
#{Event.human_attribute_name(:region).concat(':').ljust 12 } #{@event.region}

View File

@ -54,6 +54,7 @@ en:
start_time: Start
end_time: End
description: Description
place_name: Place name
address: Address
city: City
region: Region

View File

@ -55,6 +55,7 @@ fr:
start_time: Début
end_time: Fin
description: Description
place_name: Nom du lieu
address: Adresse
city: Ville
region: Région

View File

@ -0,0 +1,6 @@
# Add more data to events, with an optionnal place name
class AddPlaceNameToEvents < ActiveRecord::Migration
def change
add_column :events, :place_name, :string
end
end

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# rubocop:disable all
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@ -11,22 +12,22 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150215172739) do
ActiveRecord::Schema.define(version: 20150301223829) do
create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace", limit: 255
t.text "body"
t.string "resource_id", limit: 255, null: false
t.string "resource_type", limit: 255, null: false
t.integer "author_id"
t.text "body", limit: 65535
t.string "resource_id", limit: 255, null: false
t.string "resource_type", limit: 255, null: false
t.integer "author_id", limit: 4
t.string "author_type", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id"
add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace"
add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree
add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree
add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree
create_table "admin_users", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
@ -34,7 +35,7 @@ ActiveRecord::Schema.define(version: 20150215172739) do
t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.integer "sign_in_count", limit: 4, default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
@ -43,114 +44,91 @@ ActiveRecord::Schema.define(version: 20150215172739) do
t.datetime "updated_at"
end
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree
create_table "cities", force: :cascade do |t|
t.string "name", limit: 255, default: "", null: false
t.string "majname", limit: 255, default: "", null: false
t.integer "postalcode"
t.integer "inseecode"
t.integer "regioncode"
t.integer "postalcode", limit: 4
t.integer "inseecode", limit: 4
t.integer "regioncode", limit: 4
t.float "latitude", limit: 24
t.float "longitude", limit: 24
end
add_index "cities", ["name"], name: "cities_name"
add_index "cities", ["name"], name: "cities_name", using: :btree
create_table "events", force: :cascade do |t|
t.string "title", limit: 255, default: "", null: false
t.text "description", null: false
t.datetime "start_time", null: false
t.datetime "end_time", null: false
t.string "city", limit: 255, default: "", null: false
t.integer "region_id", default: 0, null: false
t.integer "locality", default: 0, null: false
t.string "url", limit: 255, default: "", null: false
t.string "contact", limit: 255, default: "", null: false
t.string "submitter", limit: 255, default: "", null: false
t.integer "moderated", default: 0, null: false
t.string "tags", limit: 255, default: "", null: false
t.string "secret", limit: 255, default: "", null: false
t.datetime "decision_time", null: false
t.datetime "submission_time", null: false
t.string "title", limit: 255, default: "", null: false
t.text "description", limit: 65535, null: false
t.datetime "start_time", null: false
t.datetime "end_time", null: false
t.string "city", limit: 255, default: "", null: false
t.integer "region_id", limit: 4, default: 0, null: false
t.integer "locality", limit: 4, default: 0, null: false
t.string "url", limit: 255, default: "", null: false
t.string "contact", limit: 255, default: "", null: false
t.string "submitter", limit: 255, default: "", null: false
t.integer "moderated", limit: 4, default: 0, null: false
t.string "tags", limit: 255, default: "", null: false
t.string "secret", limit: 255, default: "", null: false
t.datetime "decision_time"
t.datetime "submission_time"
t.string "moderator_mail_id", limit: 32
t.string "submitter_mail_id", limit: 32
t.text "address"
t.float "latitude"
t.float "longitude"
t.integer "lock_version", default: 0, null: false
t.text "address", limit: 65535
t.float "latitude", limit: 24
t.float "longitude", limit: 24
t.integer "lock_version", limit: 4, default: 0, null: false
t.string "place_name", limit: 255
end
add_index "events", ["start_time", "end_time"], name: "events_date"
add_index "events", ["start_time", "end_time"], name: "events_date", using: :btree
create_table "kinds", force: :cascade do |t|
t.string "name", null: false
t.string "icon"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name", limit: 255, null: false
t.string "icon", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "notes", force: :cascade do |t|
t.text "contents", null: false
t.datetime "date", null: false
t.integer "event_id"
t.integer "author_id"
t.text "contents", limit: 65535, null: false
t.datetime "date", null: false
t.integer "event_id", limit: 4
t.integer "author_id", limit: 4
end
create_table "orgas", force: :cascade do |t|
t.integer "region_id", default: 0, null: false
t.integer "department", default: 0, null: false
t.integer "region_id", limit: 4, default: 0, null: false
t.integer "department", limit: 4, default: 0, null: false
t.string "name", limit: 255, default: "", null: false
t.string "url", limit: 255, default: "", null: false
t.string "city", limit: 255, default: "", null: false
t.string "place"
t.string "address"
t.integer "orga_kind_id"
t.integer "kind_id"
t.string "feed"
t.string "contact"
t.string "submitter"
t.boolean "moderated", default: false
t.integer "kind_id", limit: 4
t.string "feed", limit: 255
t.string "contact", limit: 255
t.string "submitter", limit: 255
t.boolean "moderated", limit: 1, default: false
t.datetime "submission_time"
t.datetime "decision_time"
t.string "secret"
t.boolean "deleted", default: false, null: false
t.string "secret", limit: 255
t.boolean "deleted", limit: 1, default: false, null: false
end
add_index "orgas", ["kind_id"], name: "index_orgas_on_kind_id"
add_index "orgas", ["orga_kind_id"], name: "index_orgas_on_orga_kind_id"
add_index "orgas", ["kind_id"], name: "index_orgas_on_kind_id", using: :btree
create_table "regions", force: :cascade do |t|
t.string "name", limit: 255, default: "", null: false
end
create_table "taggings", force: :cascade do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type", limit: 255
t.integer "tagger_id"
t.string "tagger_type", limit: 255
t.string "context", limit: 128
t.datetime "created_at"
end
add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
create_table "tags", force: :cascade do |t|
t.string "name", limit: 255
t.integer "taggings_count", default: 0
end
add_index "tags", ["name"], name: "index_tags_on_name", unique: true
create_table "translations", force: :cascade do |t|
t.string "locale", limit: 255
t.string "key", limit: 255
t.text "value"
t.text "interpolations"
t.boolean "is_proc", default: false
t.text "value", limit: 65535
t.text "interpolations", limit: 65535
t.boolean "is_proc", limit: 1, default: false
end
create_table "users", force: :cascade do |t|

View File

@ -5,6 +5,7 @@ one:
description: MyText
start_time: <%= 2.hours.from_now %>
end_time: <%= 3.hours.from_now %>
place_name: Here and there
city: city_one.name
region: region_one
locality: 1