Mise à jour sur les styles du code, afin de mieux suivres les préconisations de rubocop
This commit is contained in:
parent
26522aa4f2
commit
82207028b2
1
Gemfile
1
Gemfile
@ -94,6 +94,7 @@ group :development do
|
||||
gem 'guard-bundler'
|
||||
gem 'guard-minitest'
|
||||
gem 'quiet_assets'
|
||||
gem 'guard-rubocop'
|
||||
gem 'webrick', '>= 1.3.1'
|
||||
# Security checks
|
||||
gem 'brakeman', require: false
|
||||
|
19
Gemfile.lock
19
Gemfile.lock
@ -1,6 +1,6 @@
|
||||
GIT
|
||||
remote: git://github.com/gregbell/active_admin.git
|
||||
revision: 7a2a31067e99e8e484942a3cddc44be1980b1ae6
|
||||
revision: efe5a86968c81fd12244e6c4b6957d93d0a4b7ee
|
||||
specs:
|
||||
activeadmin (1.0.0.pre)
|
||||
arbre (~> 1.0)
|
||||
@ -58,6 +58,7 @@ GEM
|
||||
arbre (1.0.1)
|
||||
activesupport (>= 3.0.0)
|
||||
arel (5.0.1.20140414130214)
|
||||
ast (2.0.0)
|
||||
bcrypt (3.1.7)
|
||||
bourbon (3.2.3)
|
||||
sass (~> 3.2)
|
||||
@ -134,6 +135,9 @@ GEM
|
||||
guard-minitest (2.3.1)
|
||||
guard (~> 2.0)
|
||||
minitest (>= 3.0)
|
||||
guard-rubocop (1.1.0)
|
||||
guard (~> 2.0)
|
||||
rubocop (~> 0.20)
|
||||
haml (4.0.5)
|
||||
tilt
|
||||
haml-rails (0.5.3)
|
||||
@ -185,9 +189,13 @@ GEM
|
||||
multi_json (1.10.1)
|
||||
mysql2 (0.3.16)
|
||||
orm_adapter (0.5.0)
|
||||
parser (2.2.0.pre.3)
|
||||
ast (>= 1.1, < 3.0)
|
||||
slop (~> 3.4, >= 3.4.5)
|
||||
polyamorous (1.0.0)
|
||||
activerecord (>= 3.0)
|
||||
polyglot (0.3.5)
|
||||
powerpack (0.0.9)
|
||||
pry (0.10.0)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
@ -215,6 +223,7 @@ GEM
|
||||
activesupport (= 4.1.4)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (2.0.0)
|
||||
rake (10.3.2)
|
||||
ransack (1.2.3)
|
||||
actionpack (>= 3.0)
|
||||
@ -231,6 +240,13 @@ GEM
|
||||
ref (1.0.5)
|
||||
responders (1.0.0)
|
||||
railties (>= 3.2, < 5)
|
||||
rubocop (0.24.1)
|
||||
json (>= 1.7.7, < 2)
|
||||
parser (>= 2.2.0.pre.3, < 3.0)
|
||||
powerpack (~> 0.0.6)
|
||||
rainbow (>= 1.99.1, < 3.0)
|
||||
ruby-progressbar (~> 1.4)
|
||||
ruby-progressbar (1.5.1)
|
||||
ruby2ruby (2.0.8)
|
||||
ruby_parser (~> 3.1)
|
||||
sexp_processor (~> 4.0)
|
||||
@ -311,6 +327,7 @@ DEPENDENCIES
|
||||
guard-bundler
|
||||
guard-livereload
|
||||
guard-minitest
|
||||
guard-rubocop
|
||||
haml-rails
|
||||
i18n-active_record!
|
||||
jbuilder (~> 2.0)
|
||||
|
@ -34,3 +34,8 @@ guard 'brakeman', run_on_start: true, quiet: true, min_confidence: 10 do
|
||||
watch(%r{^lib/.+\.rb$})
|
||||
watch('Gemfile')
|
||||
end
|
||||
|
||||
guard :rubocop, cli: ['--rails'] do
|
||||
watch(%r{.+\.rb$})
|
||||
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
||||
end
|
||||
|
3
Rakefile
3
Rakefile
@ -1,5 +1,6 @@
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be
|
||||
# available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Managing the new agenda moderators, from active_admin
|
||||
ActiveAdmin.register AdminUser do
|
||||
index do
|
||||
column :email
|
||||
|
@ -1,3 +1,4 @@
|
||||
ActiveAdmin.register City do
|
||||
permit_params :name, :majname, :postalcode, :inseecode, :regioncode, :latitude, :longitude
|
||||
permit_params :name, :majname, :postalcode, :inseecode, :regioncode,
|
||||
:latitude, :longitude
|
||||
end
|
||||
|
@ -1,13 +1,14 @@
|
||||
ActiveAdmin.register_page 'Dashboard' do
|
||||
menu priority: 1, label: proc{ I18n.t('active_admin.dashboard') }
|
||||
menu priority: 1, label: proc { I18n.t('active_admin.dashboard') }
|
||||
|
||||
content title: proc{ I18n.t('active_admin.dashboard') } do
|
||||
content title: proc { I18n.t('active_admin.dashboard') } do
|
||||
columns do
|
||||
column do
|
||||
panel 'Moderateurs' do
|
||||
ul do
|
||||
User.all.map do |user|
|
||||
li link_to("#{user.firstname} #{user.lastname} (#{user.login})", user)
|
||||
li link_to("#{user.firstname} #{user.lastname} (#{user.login})",
|
||||
user)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -23,8 +24,12 @@ ActiveAdmin.register_page 'Dashboard' do
|
||||
end
|
||||
end
|
||||
end
|
||||
panel "ActiveAdmin" do
|
||||
para %(Currently deployed: #{`git describe --tags --abbrev=0`}, #{link_to(`git rev-parse --short HEAD`, "https://gitorious.org/agenda-du-libre-rails/agenda-du-libre-rails/commit/#{`git rev-parse HEAD`}")}).html_safe
|
||||
panel 'ActiveAdmin' do
|
||||
para %(Currently deployed: #{`git describe --tags --abbrev=0`},
|
||||
#{link_to(`git rev-parse --short HEAD`,
|
||||
"https://gitorious.org/agenda-du-libre-rails/agenda-du-libre-rails/commit/
|
||||
#{`git rev-parse HEAD`}")})
|
||||
.html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,4 @@
|
||||
# The top level controller, where can be centralised almost everything
|
||||
class ApplicationController < ActionController::Base
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
|
@ -1,55 +1,19 @@
|
||||
# Event life cycle
|
||||
# This is a central part to this project
|
||||
class EventsController < ApplicationController
|
||||
before_action :set_event, only: [:show, :edit, :update, :cancel, :destroy]
|
||||
before_action :check_secret, only: [:edit, :update, :cancel, :destroy]
|
||||
before_filter :set_mailer_host
|
||||
before_action :set_mailer_host
|
||||
|
||||
def index
|
||||
@events = Event.moderated
|
||||
if params[:region] && params[:region].present? && params[:region] != 'all'
|
||||
@events = @events.region params[:region]
|
||||
end
|
||||
@events = @events.tag(params[:tag]) if params[:tag]
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if params[:year]
|
||||
# Whole year calendar
|
||||
@events = @events.year params[:year].to_i
|
||||
else
|
||||
if params[:start_date]
|
||||
start_date = Date.parse params[:start_date]
|
||||
else
|
||||
start_date = Date.today
|
||||
end
|
||||
@events = @events.month start_date.change day: 1
|
||||
end
|
||||
|
||||
set_meta_tags description: "#{t('layouts.application.subtitle')} - #{start_date ? t('date.month_names')[start_date.month] : ''} #{start_date ? start_date.year.to_s : params[:year]} - #{t '.nb_events', count: @events.size}",
|
||||
keywords: @events.pluck(:tags)
|
||||
.join(' ')
|
||||
.split
|
||||
.group_by { |i| i }
|
||||
.reject { |k, v| v.size < 2 }
|
||||
.collect { |k, v| k },
|
||||
DC: {
|
||||
title: t('layouts.application.title'),
|
||||
subject: t('layouts.application.subtitle'),
|
||||
date: start_date.to_s
|
||||
}
|
||||
}
|
||||
|
||||
format.rss {
|
||||
@events = @events.future_30.includes(:related_city)
|
||||
format.html { set_events }
|
||||
format.rss do
|
||||
@events = @events.future_30.includes :related_city
|
||||
@events = @events.limit params[:daylimit] if params[:daylimit]
|
||||
}
|
||||
|
||||
format.ics {
|
||||
@events = @events.where('start_time > ?', 360.days.ago).order :id
|
||||
}
|
||||
|
||||
format.xml {
|
||||
@events = @events.order :id
|
||||
}
|
||||
end
|
||||
format.ics { @events = @events.last_year.order :id }
|
||||
format.xml { @events = @events.order :id }
|
||||
end
|
||||
end
|
||||
|
||||
@ -64,20 +28,10 @@ class EventsController < ApplicationController
|
||||
# POST /events.json
|
||||
def create
|
||||
@event = Event.new event_params
|
||||
|
||||
if params[:visu]
|
||||
@event.valid?
|
||||
render action: :new
|
||||
return
|
||||
end
|
||||
preview && return if params[:visu]
|
||||
|
||||
respond_to do |format|
|
||||
if @event.save
|
||||
# Send an event creation mail to its author
|
||||
EventMailer.create(@event).deliver
|
||||
# Send a mail to moderators
|
||||
ModerationMailer.create(@event).deliver
|
||||
|
||||
if @event.save && send_creation_mails
|
||||
format.html { redirect_to :root, notice: t('.ok') }
|
||||
format.json { render action: 'show', status: :created, location: @event }
|
||||
else
|
||||
@ -90,19 +44,11 @@ class EventsController < ApplicationController
|
||||
# PATCH/PUT /events/1
|
||||
# PATCH/PUT /events/1.json
|
||||
def update
|
||||
olderEvent = Event.new @event.attributes
|
||||
if params[:visu]
|
||||
@event.attributes = event_params
|
||||
@event.valid?
|
||||
render action: :edit
|
||||
return
|
||||
end
|
||||
preview_update && return if params[:visu]
|
||||
|
||||
@older_event = Event.new @event.attributes
|
||||
respond_to do |format|
|
||||
if @event.update event_params
|
||||
# Send an update mail to moderators
|
||||
ModerationMailer.update(olderEvent, @event, nil).deliver
|
||||
|
||||
if @event.update(event_params) && send_update_mails
|
||||
format.html { redirect_to :root, notice: t('.ok') }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@ -123,43 +69,69 @@ class EventsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_event
|
||||
if params[:secret].present?
|
||||
@event = Event.where secret: params[:secret]
|
||||
else
|
||||
@event = Event.moderated
|
||||
end
|
||||
@event = @event.find params[:id]
|
||||
|
||||
set_meta_tags title: @event.title,
|
||||
description: @event.description,
|
||||
keywords: @event.tags,
|
||||
DC: {
|
||||
title: @event.title,
|
||||
date: @event.start_time.to_s
|
||||
},
|
||||
geo: {
|
||||
region: @event.related_region,
|
||||
placename: @event.city,
|
||||
position: "#{@event.related_city.try :latitude};#{@event.related_city.try :longitude}"
|
||||
}
|
||||
end
|
||||
def set_events
|
||||
@events = Event.moderated
|
||||
@events = @events.region params[:region] \
|
||||
if params[:region].present? && params[:region] != 'all'
|
||||
@events = @events.tag(params[:tag]) if params[:tag]
|
||||
|
||||
# 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, :region, :locality, :url, :contact, :submitter, :tags
|
||||
if params[:year]
|
||||
# Whole year calendar
|
||||
@events = @events.year params[:year].to_i
|
||||
else
|
||||
@events = @events.month params[:start_date].try(:to_date) || Date.today
|
||||
end
|
||||
end
|
||||
|
||||
def check_secret
|
||||
if params[:secret] != @event.secret
|
||||
redirect_to :root, notice: t(:forbidden, scope: [:events, :edit])
|
||||
end
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_event
|
||||
if params[:secret].present?
|
||||
@event = Event.where secret: params[:secret]
|
||||
else
|
||||
@event = Event.moderated
|
||||
end
|
||||
@event = @event.find params[:id]
|
||||
end
|
||||
|
||||
# Useful to manage absolute url in mails
|
||||
def set_mailer_host
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
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, :region,
|
||||
:locality, :url, :contact, :submitter, :tags
|
||||
end
|
||||
|
||||
def check_secret
|
||||
redirect_to :root, notice: t(:forbidden, scope: [:events, :edit]) \
|
||||
unless params[:secret] == @event.secret
|
||||
end
|
||||
|
||||
# Useful to manage absolute url in mails
|
||||
def set_mailer_host
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
end
|
||||
|
||||
def send_creation_mails
|
||||
# Send an event creation mail to its author
|
||||
EventMailer.create(@event).deliver
|
||||
# Send a mail to moderators
|
||||
ModerationMailer.create(@event).deliver
|
||||
end
|
||||
|
||||
def send_update_mails
|
||||
# Send an update mail to moderators
|
||||
ModerationMailer.update(@older_event, @event, nil).deliver
|
||||
end
|
||||
|
||||
def preview
|
||||
@event.valid?
|
||||
render action: :new
|
||||
end
|
||||
|
||||
def preview_update
|
||||
@event.attributes = event_params
|
||||
@event.valid?
|
||||
render action: :edit
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,11 @@
|
||||
# Groups life cycle
|
||||
class LugsController < ApplicationController
|
||||
before_action :set_lug, only: [:show]
|
||||
|
||||
def index
|
||||
@search = Lug.search params[:q]
|
||||
@search.sorts = 'name' if @search.sorts.empty?
|
||||
@lugs = @search.result().page params[:page]
|
||||
@lugs = @search.result.page params[:page]
|
||||
end
|
||||
|
||||
def show
|
||||
@ -12,19 +13,9 @@ class LugsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_lug
|
||||
@lug = Lug.find params[:id]
|
||||
|
||||
set_meta_tags title: @lug.name,
|
||||
description: @lug.url,
|
||||
DC: {
|
||||
title: @lug.name
|
||||
},
|
||||
geo: {
|
||||
region: @lug.related_region,
|
||||
placename: @lug.city,
|
||||
position: "#{@lug.related_city.try :latitude};#{@lug.related_city.try :longitude}"
|
||||
}
|
||||
end
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_lug
|
||||
@lug = Lug.find params[:id]
|
||||
end
|
||||
end
|
||||
|
@ -1,25 +1,15 @@
|
||||
# Geocoding
|
||||
#
|
||||
# Access to OSM controls
|
||||
class MapsController < ApplicationController
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json {
|
||||
events = Event.moderated.future.joins(:related_city).includes(:related_city)
|
||||
|
||||
#@cities_lug = City.joins :lugs
|
||||
|
||||
render json: events.collect { |event|
|
||||
{
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
name: event.title,
|
||||
popupContent: "<a href=\"#{event_url event}\">#{event.city}: #{event.title}</a>",
|
||||
}, geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [event.related_city.longitude, event.related_city.latitude]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
format.json do
|
||||
render json: Event.moderated.future
|
||||
.joins(:related_city).includes(:related_city)
|
||||
.map { |event| event.to_json }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,29 +1,27 @@
|
||||
require 'differ'
|
||||
|
||||
# Event management life cycle
|
||||
class ModerationsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_action :set_moderation, only: [:show, :edit, :update, :validate, :accept, :refuse, :destroy]
|
||||
before_filter :set_mailer_host, only: [:update, :accept, :destroy]
|
||||
before_action :authenticate_user!
|
||||
before_action :set_moderation, :set_mailer_host, only:
|
||||
[:show, :edit, :update, :validate, :accept, :refuse, :destroy]
|
||||
|
||||
def index
|
||||
@events = Event.where moderated: 0
|
||||
@events = Event.unmoderated
|
||||
end
|
||||
|
||||
# PATCH/PUT /moderations/1
|
||||
# PATCH/PUT /moderations/1.json
|
||||
def update
|
||||
olderModeration = Event.new @event.attributes
|
||||
if params[:visu]
|
||||
@moderation.attributes = moderation_params
|
||||
render action: 'edit'
|
||||
return
|
||||
end
|
||||
|
||||
@older_mod = Event.new @event.attributes
|
||||
respond_to do |format|
|
||||
if @moderation.update(moderation_params)
|
||||
# Send an update mail to moderators
|
||||
ModerationMailer.update(olderModeration, @moderation, current_user).deliver
|
||||
|
||||
if @moderation.update(moderation_params) && send_moderation_mails
|
||||
format.html { redirect_to moderations_path, notice: t('.ok') }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@ -37,13 +35,7 @@ class ModerationsController < ApplicationController
|
||||
# PATCH/PUT /accept/1.json
|
||||
def accept
|
||||
respond_to do |format|
|
||||
if @moderation.update(moderated: 1)
|
||||
# Send an acceptation mail to its author
|
||||
EventMailer.accept(@moderation, current_user).deliver
|
||||
|
||||
# Send an acceptation mail to moderators
|
||||
ModerationMailer.accept(@moderation, current_user).deliver
|
||||
|
||||
if @moderation.update(moderated: true) && send_accept_mails
|
||||
format.html { redirect_to moderations_path, notice: t('.ok') }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@ -56,14 +48,7 @@ class ModerationsController < ApplicationController
|
||||
# DELETE /events/1
|
||||
# DELETE /events/1.json
|
||||
def destroy
|
||||
if @moderation.destroy
|
||||
# Send a notification to its author
|
||||
if params[:reason] == 'r_4'
|
||||
@reason = params[:reason_text]
|
||||
else
|
||||
@reason = t("reason_#{params[:reason]}_long", scope: [:moderations, :refuse])
|
||||
end
|
||||
|
||||
if @moderation.destroy && send_destroy_mails
|
||||
EventMailer.destroy(@moderation, current_user, @reason).deliver
|
||||
ModerationMailer.destroy(@moderation, current_user, @reason).deliver
|
||||
end
|
||||
@ -74,20 +59,45 @@ class ModerationsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_moderation
|
||||
@event = Event.find params[:id]
|
||||
@moderation = @event
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def moderation_params
|
||||
params.require(:event)
|
||||
.permit :title, :start_time, :end_time, :description, :city, :region, :locality, :url, :contact, :submitter, :tags
|
||||
end
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_moderation
|
||||
@event = Event.find params[:id]
|
||||
@moderation = @event
|
||||
end
|
||||
|
||||
# Useful to manage absolute url in mails
|
||||
def set_mailer_host
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
# Never trust parameters from the scary internet, only allow the white list
|
||||
# through.
|
||||
def moderation_params
|
||||
params.require(:event)
|
||||
.permit :title, :start_time, :end_time, :description, :city, :region,
|
||||
:locality, :url, :contact, :submitter, :tags
|
||||
end
|
||||
|
||||
# Useful to manage absolute url in mails
|
||||
def set_mailer_host
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
end
|
||||
|
||||
def send_moderation_mails
|
||||
# Send an update mail to moderators
|
||||
ModerationMailer.update(@older_mod, @moderation, current_user).deliver
|
||||
end
|
||||
|
||||
def send_accept_mails
|
||||
# Send an acceptation mail to its author
|
||||
EventMailer.accept(@moderation, current_user).deliver
|
||||
|
||||
# Send an acceptation mail to moderators
|
||||
ModerationMailer.accept(@moderation, current_user).deliver
|
||||
end
|
||||
|
||||
def send_destroy_mails
|
||||
# Send a notification to its author
|
||||
if params[:reason] == 'r_4'
|
||||
@reason = params[:reason_text]
|
||||
else
|
||||
@reason = t "moderations.refuse.reason_#{params[:reason]}_long"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Events, particulary during moderation, can have notes associated to them
|
||||
class NotesController < ApplicationController
|
||||
before_action :set_event, only: [:new, :create]
|
||||
before_filter :set_mailer_host, only: [:create]
|
||||
before_action :set_event, :set_mailer_host, only: [:new, :create]
|
||||
|
||||
# GET /moderations/id/new
|
||||
def new
|
||||
@ -8,21 +8,12 @@ class NotesController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@note = @moderation.notes.new(note_params)
|
||||
@note.author = current_user
|
||||
@note = @moderation.notes.new note_params.merge author: current_user
|
||||
|
||||
respond_to do |format|
|
||||
if @note.save
|
||||
if params[:envoiParMail] == 'oui'
|
||||
# Send an update mail to its author
|
||||
NoteMailer.notify(@note).deliver
|
||||
@note.contents = t '.sendByMailWrap', contents: @note.contents
|
||||
@note.save
|
||||
end
|
||||
NoteMailer.create(@note).deliver
|
||||
|
||||
if @note.save && send_mails
|
||||
format.html { redirect_to moderations_url, notice: t('.ok') }
|
||||
format.json { render action: 'show', status: :created, location: @event }
|
||||
format.json { render action: :show, status: :created, location: @event }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @note.errors, status: :unprocessable_entity }
|
||||
@ -31,19 +22,31 @@ class NotesController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_event
|
||||
@event = Event.find params[:moderation_id]
|
||||
@moderation = @event
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def note_params
|
||||
params.require(:note).permit :contents
|
||||
end
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_event
|
||||
@event = Event.find params[:moderation_id]
|
||||
@moderation = @event
|
||||
end
|
||||
|
||||
# Useful to manage absolute url in mails
|
||||
def set_mailer_host
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
# Never trust parameters from the scary internet, only allow the white list
|
||||
# through.
|
||||
def note_params
|
||||
params.require(:note).permit :contents
|
||||
end
|
||||
|
||||
# Useful to manage absolute url in mails
|
||||
def set_mailer_host
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
end
|
||||
|
||||
def send_mails
|
||||
if params[:envoiParMail] == 'oui'
|
||||
# Send an update mail to its author
|
||||
NoteMailer.notify(@note).deliver
|
||||
@note.contents = t '.sendByMailWrap', contents: @note.contents
|
||||
@note.save
|
||||
end
|
||||
NoteMailer.create(@note).deliver
|
||||
end
|
||||
end
|
||||
|
@ -1,15 +1,17 @@
|
||||
# Manage regions, mostly get stats out of them
|
||||
class RegionsController < InheritedResources::Base
|
||||
def stats
|
||||
@region_events = Event.joins(:related_region).group(:name).count(:name)
|
||||
|
||||
@city_events = Event.group(:city).having('count(city) > 3').order('count(city) desc').count(:city)
|
||||
@city_events = Event.group(:city).having('count(city) > 3')
|
||||
.order('count(city) desc').count :city
|
||||
|
||||
# Used in sqlite
|
||||
#.group('strftime("%Y", start_time)')
|
||||
#.group('strftime("%m", start_time)')
|
||||
# .group('strftime("%Y", start_time)')
|
||||
# .group('strftime("%m", start_time)')
|
||||
@month_events = Event
|
||||
.group('extract(year from start_time)')
|
||||
.group('extract(month from start_time)')
|
||||
.count()
|
||||
.count
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Manage event tags
|
||||
class TagsController < InheritedResources::Base
|
||||
def index
|
||||
@tags = Event
|
||||
@ -5,13 +6,13 @@ class TagsController < InheritedResources::Base
|
||||
.join(' ')
|
||||
.split
|
||||
.group_by { |i| i }
|
||||
.reject { |k, v| v.size < 2 }
|
||||
.collect { |k, v| [k, v.size()] }
|
||||
.reject { |_k, v| v.size < 2 }
|
||||
.map { |k, v| [k, v.size] }
|
||||
.sort
|
||||
end
|
||||
|
||||
def show
|
||||
@eventsFuture = Event.future.tag params[:id]
|
||||
@eventsPast = Event.past.tag params[:id]
|
||||
@events_future = Event.future.tag params[:id]
|
||||
@events_past = Event.past.tag params[:id]
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
# Moderators life cycle
|
||||
class UsersController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_action :authenticate_user!
|
||||
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /users
|
||||
@ -29,7 +30,7 @@ class UsersController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
if @user.save
|
||||
format.html { redirect_to @user, notice: 'User was successfully created.' }
|
||||
format.html { redirect_to @user, notice: 'User successfully created' }
|
||||
format.json { render action: 'show', status: :created, location: @user }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
@ -43,7 +44,7 @@ class UsersController < ApplicationController
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @user.update(user_params)
|
||||
format.html { redirect_to @user, notice: 'User was successfully updated.' }
|
||||
format.html { redirect_to @user, notice: 'User successfully updated' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: 'edit' }
|
||||
@ -63,13 +64,16 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_user
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def user_params
|
||||
params.require(:user).permit(:login, :email, :lastname, :firstname, :password)
|
||||
end
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_user
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list
|
||||
# through.
|
||||
def user_params
|
||||
params.require(:user).permit :login, :email, :lastname, :firstname,
|
||||
:password
|
||||
end
|
||||
end
|
||||
|
@ -1,2 +1,3 @@
|
||||
# Helper for the global application
|
||||
module ApplicationHelper
|
||||
end
|
||||
|
@ -1,2 +1,3 @@
|
||||
# Helper for the city views
|
||||
module CitiesHelper
|
||||
end
|
||||
|
@ -1,2 +1,27 @@
|
||||
# Helper for the event views
|
||||
module EventsHelper
|
||||
def set_events_meta
|
||||
set_meta_tags \
|
||||
description: "#{t 'layouts.application.subtitle'} \
|
||||
- #{t '.nb_events', count: @events.size}",
|
||||
keywords: @events.pluck(:tags)
|
||||
.join(' ').split.group_by { |i| i }
|
||||
.reject { |_k, v| v.size < 2 }.map { |k, _v| k },
|
||||
DC: {
|
||||
title: t('layouts.application.title'),
|
||||
subject: t('layouts.application.subtitle')
|
||||
}
|
||||
end
|
||||
|
||||
def set_event_meta
|
||||
set_meta_tags \
|
||||
keywords: @event.tags,
|
||||
DC: { title: @event.title, date: @event.start_time.to_s },
|
||||
geo: {
|
||||
region: @event.related_region,
|
||||
placename: @event.city,
|
||||
position: "#{@event.related_city.try :latitude};" \
|
||||
+ "#{@event.related_city.try :longitude}"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -1,2 +1,14 @@
|
||||
# Helper for the lug views
|
||||
module LugsHelper
|
||||
def set_lug_meta
|
||||
set_meta_tags \
|
||||
description: @lug.url,
|
||||
DC: { title: @lug.name },
|
||||
geo: {
|
||||
region: @lug.related_region,
|
||||
placename: @lug.city,
|
||||
position: "#{@lug.related_city.try :latitude};" \
|
||||
+ "#{@lug.related_city.try :longitude}"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -1,2 +1,3 @@
|
||||
# Helper for the map views
|
||||
module MapsHelper
|
||||
end
|
||||
|
@ -1,2 +1,3 @@
|
||||
# Helper for the moderation views
|
||||
module ModerationsHelper
|
||||
end
|
||||
|
@ -1,2 +1,3 @@
|
||||
# Helper for the note views
|
||||
module NotesHelper
|
||||
end
|
||||
|
@ -1,2 +1,3 @@
|
||||
# Helper for the region views
|
||||
module RegionsHelper
|
||||
end
|
||||
|
@ -1,2 +1,3 @@
|
||||
# Helper for the user views
|
||||
module UsersHelper
|
||||
end
|
||||
|
@ -1,19 +1,22 @@
|
||||
# Sending mails related to events life cycle
|
||||
class EventMailer < ActionMailer::Base
|
||||
def create(event)
|
||||
@event = event
|
||||
|
||||
mail 'Message-ID' => "<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
to: event.submitter,
|
||||
subject: t('event_mailer.create.subject', subject: event.title)
|
||||
mail 'Message-ID' =>
|
||||
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
to: event.submitter,
|
||||
subject: t('event_mailer.create.subject', subject: event.title)
|
||||
end
|
||||
|
||||
def accept(event, current_user)
|
||||
@event = event
|
||||
@current_user = current_user
|
||||
|
||||
mail 'In-Reply-To' => "<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
to: event.submitter,
|
||||
subject: t('event_mailer.accept.subject', subject: event.title)
|
||||
mail 'In-Reply-To' =>
|
||||
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
to: event.submitter,
|
||||
subject: t('event_mailer.accept.subject', subject: event.title)
|
||||
end
|
||||
|
||||
def destroy(event, current_user, reason)
|
||||
@ -21,8 +24,9 @@ class EventMailer < ActionMailer::Base
|
||||
@current_user = current_user
|
||||
@reason = reason
|
||||
|
||||
mail 'In-Reply-To' => "<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
to: event.submitter,
|
||||
subject: t('event_mailer.destroy.subject', subject: event.title)
|
||||
mail 'In-Reply-To' =>
|
||||
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
to: event.submitter,
|
||||
subject: t('event_mailer.destroy.subject', subject: event.title)
|
||||
end
|
||||
end
|
||||
|
@ -1,26 +1,30 @@
|
||||
# Sending mails related to events' moderation
|
||||
class ModerationMailer < ActionMailer::Base
|
||||
def create(event)
|
||||
@event = event
|
||||
|
||||
mail 'Message-ID' => "<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('moderation_mailer.create.subject', subject: event.title)
|
||||
mail 'Message-ID' =>
|
||||
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('moderation_mailer.create.subject', subject: event.title)
|
||||
end
|
||||
|
||||
def update(olderEvent, event, current_user)
|
||||
@olderEvent = olderEvent
|
||||
def update(older_event, event, current_user)
|
||||
@older_event = older_event
|
||||
@event = event
|
||||
@current_user = current_user
|
||||
|
||||
mail 'In-Reply-To' => "<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('moderation_mailer.update.subject', subject: event.title)
|
||||
mail 'In-Reply-To' =>
|
||||
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('moderation_mailer.update.subject', subject: event.title)
|
||||
end
|
||||
|
||||
def accept(event, current_user)
|
||||
@event = event
|
||||
@current_user = current_user
|
||||
|
||||
mail 'In-Reply-To' => "<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('moderation_mailer.accept.subject', subject: event.title)
|
||||
mail 'In-Reply-To' =>
|
||||
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('moderation_mailer.accept.subject', subject: event.title)
|
||||
end
|
||||
|
||||
def destroy(event, current_user, reason)
|
||||
@ -28,7 +32,8 @@ class ModerationMailer < ActionMailer::Base
|
||||
@current_user = current_user
|
||||
@reason = reason
|
||||
|
||||
mail 'In-Reply-To' => "<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('moderation_mailer.destroy.subject', subject: event.title)
|
||||
mail 'In-Reply-To' =>
|
||||
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('moderation_mailer.destroy.subject', subject: event.title)
|
||||
end
|
||||
end
|
||||
|
@ -1,16 +1,20 @@
|
||||
# Sending mails related to events' notes
|
||||
class NoteMailer < ActionMailer::Base
|
||||
def notify(note)
|
||||
@note = note
|
||||
|
||||
mail 'In-Reply-To' => "<event-#{note.event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
to: note.event.submitter,
|
||||
subject: t('note_mailer.notify.subject', subject: note.event.title)
|
||||
mail 'In-Reply-To' =>
|
||||
"<event-#{note.event.id}@" \
|
||||
+ "#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
to: note.event.submitter,
|
||||
subject: t('note_mailer.notify.subject', subject: note.event.title)
|
||||
end
|
||||
|
||||
def create(note)
|
||||
@note = note
|
||||
|
||||
mail 'In-Reply-To' => "<mod-#{note.event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('note_mailer.create.subject', subject: note.event.title)
|
||||
mail 'In-Reply-To' =>
|
||||
"<mod-#{note.event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||
subject: t('note_mailer.create.subject', subject: note.event.title)
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,7 @@
|
||||
# The new agenda moderators, from active_admin
|
||||
class AdminUser < ActiveRecord::Base
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable,
|
||||
devise :database_authenticatable,
|
||||
:recoverable, :rememberable, :trackable, :validatable
|
||||
end
|
||||
|
@ -1,43 +1,52 @@
|
||||
# This is the central ADL class, where are managed all events
|
||||
class Event < ActiveRecord::Base
|
||||
extend SimpleCalendar
|
||||
|
||||
belongs_to :related_region, foreign_key: 'region', class_name: Region
|
||||
has_many :notes, dependent: :destroy
|
||||
has_one :related_city, foreign_key: :name, primary_key: :city, class_name: City
|
||||
has_one :related_city, foreign_key: :name, primary_key: :city,
|
||||
class_name: City
|
||||
|
||||
validates_presence_of :title, :description, :city, :related_region, :url, :contact
|
||||
validates_format_of :url, with: /\Ahttps?:\/\/.*\z/
|
||||
validates :title, presence: true
|
||||
validates :description, presence: true
|
||||
validates :city, presence: true
|
||||
validates :related_region, presence: true
|
||||
validates :url, presence: true, format: %r{\Ahttps?:\/\/.*\z}
|
||||
validates :contact, presence: true
|
||||
validates :contact, email: true
|
||||
validates :submitter, email: true
|
||||
|
||||
|
||||
scope :moderated, -> { where moderated: true }
|
||||
scope :past, -> { where('end_time < ?', DateTime.now).order(start_time: :desc) }
|
||||
scope :future, -> { where('end_time >= ?', DateTime.now).order(start_time: :asc) }
|
||||
scope :future_30, -> {
|
||||
scope :unmoderated, -> { where moderated: false }
|
||||
scope :last_year, -> { where 'start_time >= ?', 360.days.ago }
|
||||
scope :past, (lambda do
|
||||
where('end_time < ?', DateTime.now).order start_time: :desc
|
||||
end)
|
||||
scope :future, (lambda do
|
||||
where('end_time >= ?', DateTime.now).order start_time: :asc
|
||||
end)
|
||||
scope :future_30, (lambda do
|
||||
where('start_time >= ? and end_time <= ?', DateTime.now, 30.days.from_now)
|
||||
.order :start_time
|
||||
}
|
||||
scope :year, -> year {
|
||||
end)
|
||||
scope :year, (lambda do |year|
|
||||
where '? <= end_time and start_time <= ?',
|
||||
Date.new(year, 1, 1).beginning_of_week, Date.new(year, 12, 31).end_of_week
|
||||
}
|
||||
scope :month, -> start_date {
|
||||
Date.new(year, 1, 1).beginning_of_week, Date.new(year, 12, 31)
|
||||
.end_of_week
|
||||
end)
|
||||
scope :month, (lambda do |start_date|
|
||||
where '? <= end_time and start_time <= ?',
|
||||
start_date.beginning_of_week,
|
||||
start_date.next_month.end_of_week
|
||||
}
|
||||
start_date.beginning_of_month.beginning_of_week,
|
||||
start_date.beginning_of_month.next_month.end_of_week
|
||||
end)
|
||||
scope :region, -> region { where 'region = ? or locality', region }
|
||||
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
|
||||
|
||||
|
||||
before_validation on: :create do
|
||||
self.submission_time = DateTime.now
|
||||
self.decision_time = DateTime.now
|
||||
|
||||
if self.submitter.empty?
|
||||
self.submitter = self.contact
|
||||
end
|
||||
self.submitter = contact if submitter.empty?
|
||||
end
|
||||
|
||||
before_create do
|
||||
@ -47,7 +56,7 @@ class Event < ActiveRecord::Base
|
||||
end
|
||||
|
||||
before_update do
|
||||
if moderated? and moderated_was != moderated
|
||||
if moderated? && moderated_was != moderated
|
||||
self.decision_time = DateTime.now
|
||||
end
|
||||
end
|
||||
@ -55,4 +64,17 @@ class Event < ActiveRecord::Base
|
||||
def same_day?
|
||||
start_time.to_date == end_time.to_date
|
||||
end
|
||||
|
||||
def to_json
|
||||
{ type: 'Feature', properties: {
|
||||
name: title,
|
||||
popupContent: "<a href=\"/#{self.class.name.downcase.pluralize}/#{id}\"" \
|
||||
+ ">#{city}: #{title}</a>"
|
||||
},
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [related_city.longitude, related_city.latitude]
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,6 @@
|
||||
# Groups related to this agenda
|
||||
class Lug < ActiveRecord::Base
|
||||
belongs_to :related_region, foreign_key: 'region', class_name: Region
|
||||
has_one :related_city, foreign_key: :name, primary_key: :city, class_name: City
|
||||
has_one :related_city, foreign_key: :name, primary_key: :city,
|
||||
class_name: City
|
||||
end
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Manages data related to events' moderation
|
||||
class Note < ActiveRecord::Base
|
||||
belongs_to :event
|
||||
belongs_to :author, class_name: User
|
||||
|
@ -1,3 +1,4 @@
|
||||
# This is mostly to group events around a region
|
||||
class Region < ActiveRecord::Base
|
||||
has_many :lugs, foreign_key: :region
|
||||
|
||||
|
@ -1,25 +1,28 @@
|
||||
require 'digest/md5'
|
||||
|
||||
# Moderators, but using a failed pwd mechanism
|
||||
# TODO, migrate to full active_admin
|
||||
class User < ActiveRecord::Base
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, authentication_keys: [:login]
|
||||
#, :registerable, :validatable
|
||||
# :registerable, :validatable
|
||||
|
||||
has_many :notes
|
||||
|
||||
def encrypted_password=(pass)
|
||||
write_attribute :password, pass
|
||||
self[:password] = pass
|
||||
end
|
||||
|
||||
def encrypted_password
|
||||
read_attribute :password
|
||||
self[:password]
|
||||
end
|
||||
|
||||
def self.find_first_by_auth_conditions(warden_conditions)
|
||||
conditions = warden_conditions.dup
|
||||
if login = conditions.delete(:login)
|
||||
where(conditions).where(["login = :value", { value: login }]).first
|
||||
login = conditions.delete(:login)
|
||||
if login.present?
|
||||
where(conditions).where(['login = :value', { value: login }]).first
|
||||
else
|
||||
where(conditions).first
|
||||
end
|
||||
@ -34,7 +37,8 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
protected
|
||||
def password_digest(password)
|
||||
Digest::MD5.hexdigest password
|
||||
end
|
||||
|
||||
def password_digest(password)
|
||||
Digest::MD5.hexdigest password
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
- set_events_meta
|
||||
|
||||
= render '/lugs/search' unless controller.controller_name == 'lugs'
|
||||
|
||||
-# Seems necessary, for the time being, to ensure calendar is changing days correctly
|
||||
|
@ -1,6 +1,8 @@
|
||||
- set_event_meta
|
||||
|
||||
%h2
|
||||
%em.city= @event.city
|
||||
= @event.title
|
||||
= title @event.title
|
||||
|
||||
- if @event.persisted? && request.format == 'text/html' && controller.controller_name == 'events' && controller.action_name == 'show'
|
||||
%sidebar#lug-list
|
||||
@ -47,7 +49,7 @@
|
||||
%h3=t '.description'
|
||||
.description
|
||||
- markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
|
||||
= sanitize markdown.render(@event.description),
|
||||
= description sanitize markdown.render(@event.description),
|
||||
tags: %w(p br table tr th td ul ol li a strong b em i img),
|
||||
attributes: %w(href src width height)
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
- set_lug_meta
|
||||
|
||||
%h2
|
||||
%em.fa.fa-users
|
||||
= title t 'lugs.search.title', entity: Lug.model_name.human
|
||||
= t 'lugs.search.title', entity: Lug.model_name.human
|
||||
|
||||
= render 'search'
|
||||
|
||||
@ -9,7 +11,7 @@
|
||||
%dd
|
||||
%h3
|
||||
= image_tag @lug.url+'/favicon.ico', alt: '', class: :favicon
|
||||
= @lug.name
|
||||
= title @lug.name
|
||||
- if @lug.city.present?
|
||||
%dt= Lug.human_attribute_name :city
|
||||
%dd= @lug.city
|
||||
|
@ -5,7 +5,7 @@
|
||||
- new = render file: '/events/show'
|
||||
|
||||
- former = @event
|
||||
- @event = @olderEvent
|
||||
- @event = @older_event
|
||||
|
||||
- prev = render file: '/events/show'
|
||||
- @event = former
|
||||
|
@ -2,9 +2,9 @@
|
||||
=t '.title'
|
||||
%em= params[:id]
|
||||
|
||||
%p=raw t '.future', count: @eventsFuture.count
|
||||
%p=raw t '.future', count: @events_future.count
|
||||
%ul
|
||||
- @eventsFuture.each do |event|
|
||||
- @events_future.each do |event|
|
||||
%li
|
||||
%div= link_to event.title, event
|
||||
- if event.same_day?
|
||||
@ -18,9 +18,9 @@
|
||||
à
|
||||
= event.city
|
||||
|
||||
%p=raw t '.past', count: @eventsPast.count
|
||||
%p=raw t '.past', count: @events_past.count
|
||||
%ul
|
||||
- @eventsPast.each do |event|
|
||||
- @events_past.each do |event|
|
||||
%li
|
||||
%div= link_to event.title, event
|
||||
- if event.same_day?
|
||||
|
@ -7,17 +7,23 @@ require 'rails/all'
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
module AgendaDuLibreRails
|
||||
# All the specific configuraton for ADL
|
||||
class Application < Rails::Application
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Settings in config/environments/* take precedence over those specified
|
||||
# here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||
# Set Time.zone default to the specified zone and make Active Record
|
||||
# auto-convert to this zone.
|
||||
# Run "rake -D time" for a list of tasks for finding time zone names.
|
||||
# Default is UTC.
|
||||
# config.time_zone = 'Central Time (US & Canada)'
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
# The default locale is :en and all translations from
|
||||
# config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path +=
|
||||
# Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
# config.i18n.default_locale = :de
|
||||
config.i18n.default_locale = :fr
|
||||
|
||||
@ -28,6 +34,6 @@ module AgendaDuLibreRails
|
||||
to: 'moderateurs@agendadulibre.org'
|
||||
}
|
||||
|
||||
#config.quiet_assets = false
|
||||
# config.quiet_assets = false
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
# Settings specified here will take precedence over those in
|
||||
# config/application.rb.
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
|
@ -1,5 +1,6 @@
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
# Settings specified here will take precedence over those in
|
||||
# config/application.rb.
|
||||
|
||||
# Code is not reloaded between requests.
|
||||
config.cache_classes = true
|
||||
@ -16,7 +17,8 @@ Rails.application.configure do
|
||||
|
||||
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
||||
# Add `rack-cache` to your Gemfile before enabling this.
|
||||
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
||||
# For large-scale production use, consider using a caching reverse proxy like
|
||||
# nginx, varnish or squid.
|
||||
# config.action_dispatch.rack_cache = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this).
|
||||
@ -39,7 +41,8 @@ Rails.application.configure do
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and
|
||||
# use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# Set to :debug to see everything in the log.
|
||||
@ -56,14 +59,16 @@ Rails.application.configure do
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
config.action_controller.asset_host = "http://assets%d.agendadulibre.org"
|
||||
config.action_controller.asset_host = 'http://assets%d.agendadulibre.org'
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder
|
||||
# are already added.
|
||||
# config.assets.precompile += %w( search.js )
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to
|
||||
# raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
config.action_mailer.smtp_settings = { openssl_verify_mode: 'none' }
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
# Settings specified here will take precedence over those in
|
||||
# config/application.rb.
|
||||
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
|
@ -5,7 +5,7 @@ ActiveAdmin.setup do |config|
|
||||
# Set the title that is displayed on the main layout
|
||||
# for each of the active admin pages.
|
||||
#
|
||||
config.site_title = "Agenda Du Libre"
|
||||
config.site_title = 'Agenda Du Libre'
|
||||
|
||||
# Set the link url for the title. For example, to take
|
||||
# users to your main site. Defaults to no link.
|
||||
@ -84,7 +84,6 @@ ActiveAdmin.setup do |config|
|
||||
# to return the currently logged in user.
|
||||
config.current_user_method = :current_admin_user
|
||||
|
||||
|
||||
# == Logging Out
|
||||
#
|
||||
# Active Admin displays a logout link on each screen. These
|
||||
@ -103,7 +102,6 @@ ActiveAdmin.setup do |config|
|
||||
# Default:
|
||||
# config.logout_link_method = :get
|
||||
|
||||
|
||||
# == Root
|
||||
#
|
||||
# Set the action to call for the root path. You can set different
|
||||
@ -112,10 +110,10 @@ ActiveAdmin.setup do |config|
|
||||
# Default:
|
||||
# config.root_to = 'dashboard#index'
|
||||
|
||||
|
||||
# == Admin Comments
|
||||
#
|
||||
# This allows your users to comment on any resource registered with Active Admin.
|
||||
# This allows your users to comment on any resource registered with Active
|
||||
# Admin.
|
||||
#
|
||||
# You can completely disable comments:
|
||||
# config.allow_comments = false
|
||||
@ -126,27 +124,23 @@ ActiveAdmin.setup do |config|
|
||||
# You can change the name under which comments are registered:
|
||||
# config.comments_registration_name = 'AdminComment'
|
||||
|
||||
|
||||
# == Batch Actions
|
||||
#
|
||||
# Enable and disable Batch Actions
|
||||
#
|
||||
config.batch_actions = true
|
||||
|
||||
|
||||
# == Controller Filters
|
||||
#
|
||||
# You can add before, after and around filters to all of your
|
||||
# Active Admin resources and pages from here.
|
||||
#
|
||||
# config.before_filter :do_something_awesome
|
||||
|
||||
|
||||
|
||||
# == Setting a Favicon
|
||||
#
|
||||
# config.favicon = '/assets/favicon.ico'
|
||||
|
||||
|
||||
# == Register Stylesheets & Javascripts
|
||||
#
|
||||
# We recommend using the built in Active Admin layout and loading
|
||||
@ -156,13 +150,13 @@ ActiveAdmin.setup do |config|
|
||||
# To load a stylesheet:
|
||||
# config.register_stylesheet 'my_stylesheet.css'
|
||||
#
|
||||
# You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
|
||||
# You can provide an options hash for more control, which is passed along to
|
||||
# stylesheet_link_tag():
|
||||
# config.register_stylesheet 'my_print_stylesheet.css', :media => :print
|
||||
#
|
||||
# To load a javascript file:
|
||||
# config.register_javascript 'my_javascript.js'
|
||||
|
||||
|
||||
# == CSV options
|
||||
#
|
||||
# Set the CSV builder separator
|
||||
@ -171,16 +165,19 @@ ActiveAdmin.setup do |config|
|
||||
# Force the use of quotes
|
||||
# config.csv_options = { :force_quotes => true }
|
||||
|
||||
|
||||
# == Menu System
|
||||
#
|
||||
# You can add a navigation menu to be used in your application, or configure a provided menu
|
||||
# You can add a navigation menu to be used in your application, or configure
|
||||
# a provided menu
|
||||
#
|
||||
# To change the default utility navigation to show a link to your website & a logout btn
|
||||
# To change the default utility navigation to show a link to your website & a
|
||||
# logout btn
|
||||
#
|
||||
# config.namespace :admin do |admin|
|
||||
# admin.build_menu :utility_navigation do |menu|
|
||||
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
|
||||
# menu.add label: "My Great Website",
|
||||
# url: "http://www.mygreatwebsite.com",
|
||||
# html_options: { target: :blank }
|
||||
# admin.add_logout_button_to_menu menu
|
||||
# end
|
||||
# end
|
||||
@ -189,11 +186,12 @@ ActiveAdmin.setup do |config|
|
||||
#
|
||||
# config.namespace :admin do |admin|
|
||||
# admin.build_menu :default do |menu|
|
||||
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
|
||||
# menu.add label: "My Great Website",
|
||||
# url: "http://www.mygreatwebsite.com",
|
||||
# html_options: { target: :blank }
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
# == Download Links
|
||||
#
|
||||
# You can disable download links on resource listing pages,
|
||||
@ -215,7 +213,6 @@ ActiveAdmin.setup do |config|
|
||||
#
|
||||
# end
|
||||
|
||||
|
||||
# == Pagination
|
||||
#
|
||||
# Pagination is enabled by default for all resources.
|
||||
@ -223,11 +220,10 @@ ActiveAdmin.setup do |config|
|
||||
#
|
||||
# config.default_per_page = 30
|
||||
|
||||
|
||||
# == Filters
|
||||
#
|
||||
# By default the index screen includes a “Filters” sidebar on the right
|
||||
# hand side with a filter for each attribute of the registered model.
|
||||
# By default the index screen includes a "Filters" sidebar on the right hand
|
||||
# side with a filter for each attribute of the registered model.
|
||||
# You can enable or disable them for all resources here.
|
||||
#
|
||||
# config.filters = true
|
||||
|
@ -1,7 +1,9 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# You can add backtrace silencers for libraries that you're using but don't
|
||||
# wish to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||
# You can also remove all the silencers if you're trying to debug a problem
|
||||
# that might stem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||
|
@ -4,13 +4,15 @@ Devise.setup do |config|
|
||||
# The secret key used by Devise. Devise uses this key to generate
|
||||
# random tokens. Changing this key will render invalid all existing
|
||||
# confirmation, reset password and unlock tokens in the database.
|
||||
config.secret_key = 'a462883bde2ce796fa8aa481d8946a500ac8a4141ccc5f2fb1988bed8f3595b9cbd713abdca92b2d276d339a4e342768173e1b13b7a45956f6d3bda4653b14b6'
|
||||
config.secret_key = 'a462883bde2ce796fa8aa481d8946a500ac8a4141ccc5f2fb1988b' \
|
||||
+ 'ed8f3595b9cbd713abdca92b2d276d339a4e342768173e1b13b7a45956f6d3bda4653b' \
|
||||
+ '14b6'
|
||||
|
||||
# ==> Mailer Configuration
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
# note that it will be overwritten if you use your own mailer class
|
||||
# with default "from" parameter.
|
||||
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
||||
config.mailer_sender = 'moderateurs@agendadulibre.org'
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
# config.mailer = 'Devise::Mailer'
|
||||
@ -26,39 +28,45 @@ Devise.setup do |config|
|
||||
# just :email. You can configure it to use [:username, :subdomain], so for
|
||||
# authenticating a user, both parameters are required. Remember that those
|
||||
# parameters are used only when authenticating and not when retrieving from
|
||||
# session. If you need permissions, you should implement that in a before filter.
|
||||
# session. If you need permissions, you should implement that in a before
|
||||
# filter.
|
||||
# You can also supply a hash where the value is a boolean determining whether
|
||||
# or not authentication should be aborted when the value is not present.
|
||||
# config.authentication_keys = [ :email ]
|
||||
|
||||
# Configure parameters from the request object used for authentication. Each entry
|
||||
# given should be a request method and it will automatically be passed to the
|
||||
# find_for_authentication method and considered in your model lookup. For instance,
|
||||
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
||||
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
||||
# Configure parameters from the request object used for authentication. Each
|
||||
# entry given should be a request method and it will automatically be passed
|
||||
# to the find_for_authentication method and considered in your model lookup.
|
||||
# For instance, if you set :request_keys to [:subdomain], :subdomain will be
|
||||
# used on authentication.
|
||||
# The same considerations mentioned for authentication_keys also apply to
|
||||
# request_keys.
|
||||
# config.request_keys = []
|
||||
|
||||
# Configure which authentication keys should be case-insensitive.
|
||||
# These keys will be downcased upon creating or modifying a user and when used
|
||||
# to authenticate or find a user. Default is :email.
|
||||
config.case_insensitive_keys = [ :email ]
|
||||
config.case_insensitive_keys = [:email]
|
||||
|
||||
# Configure which authentication keys should have whitespace stripped.
|
||||
# These keys will have whitespace before and after removed upon creating or
|
||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||
config.strip_whitespace_keys = [ :email ]
|
||||
# modifying a user and when used to authenticate or find a user. Default is
|
||||
# :email.
|
||||
config.strip_whitespace_keys = [:email]
|
||||
|
||||
# Tell if authentication through request.params is enabled. True by default.
|
||||
# It can be set to an array that will enable params authentication only for the
|
||||
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
||||
# enable it only for database (email + password) authentication.
|
||||
# It can be set to an array that will enable params authentication only for
|
||||
# the given strategies, for example, `config.params_authenticatable =
|
||||
# [:database]` will enable it only for database (email + password)
|
||||
# authentication.
|
||||
# config.params_authenticatable = true
|
||||
|
||||
# Tell if authentication through HTTP Auth is enabled. False by default.
|
||||
# It can be set to an array that will enable http authentication only for the
|
||||
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
||||
# enable it only for database authentication. The supported strategies are:
|
||||
# :database = Support basic authentication with authentication key + password
|
||||
# given strategies, for example, `config.http_authenticatable = [:database]`
|
||||
# will enable it only for database authentication. The supported strategies
|
||||
# are:
|
||||
# :database = Support basic authentication with authentication key + password
|
||||
# config.http_authenticatable = false
|
||||
|
||||
# If http headers should be returned for AJAX requests. True by default.
|
||||
@ -87,15 +95,17 @@ Devise.setup do |config|
|
||||
|
||||
# ==> Configuration for :database_authenticatable
|
||||
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
||||
# using other encryptors, it sets how many times you want the password re-encrypted.
|
||||
# using other encryptors, it sets how many times you want the password
|
||||
# re-encrypted.
|
||||
#
|
||||
# Limiting the stretches to just one in testing will increase the performance of
|
||||
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
||||
# a value less than 10 in other environments.
|
||||
# Limiting the stretches to just one in testing will increase the performance
|
||||
# of your test suite dramatically. However, it is STRONGLY RECOMMENDED to not
|
||||
# use a value less than 10 in other environments.
|
||||
config.stretches = Rails.env.test? ? 1 : 10
|
||||
|
||||
# Setup a pepper to generate the encrypted password.
|
||||
# config.pepper = 'a5d405c1f73d70b39798058c401d3aedbcea8e19d953ee0d2b038ff093abe0ea94b255d75905563e0d16c4944297f0755481b1f125461f23fda56ee123085b09'
|
||||
# config.pepper =
|
||||
# 'a5d405c1f73d70b39798058c401d3aedbcea8e19d953ee0d2b038ff093abe0ea94b255d759'
|
||||
|
||||
# ==> Configuration for :confirmable
|
||||
# A period that the user is allowed to access the website even without
|
||||
@ -114,9 +124,10 @@ Devise.setup do |config|
|
||||
# config.confirm_within = 3.days
|
||||
|
||||
# If true, requires any email changes to be confirmed (exactly the same way as
|
||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||
# db field (see migrations). Until confirmed new email is stored in
|
||||
# unconfirmed email column, and copied to email column on successful confirmation.
|
||||
# initial account confirmation) to be applied. Requires additional
|
||||
# unconfirmed_email db field (see migrations). Until confirmed new email is
|
||||
# stored in unconfirmed email column, and copied to email column on
|
||||
# successful confirmation.
|
||||
config.reconfirmable = true
|
||||
|
||||
# Defines which key will be used when confirming an account
|
||||
@ -152,7 +163,8 @@ Devise.setup do |config|
|
||||
|
||||
# ==> Configuration for :lockable
|
||||
# Defines which strategy will be used to lock an account.
|
||||
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
||||
# :failed_attempts = Locks an account after a number of failed attempts to
|
||||
# sign in.
|
||||
# :none = No lock strategy. You should handle locking by yourself.
|
||||
# config.lock_strategy = :failed_attempts
|
||||
|
||||
@ -161,7 +173,8 @@ Devise.setup do |config|
|
||||
|
||||
# Defines which strategy will be used to unlock an account.
|
||||
# :email = Sends an unlock link to the user email
|
||||
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
||||
# :time = Re-enables login after a certain amount of time (see :unlock_in
|
||||
# below)
|
||||
# :both = Enables both strategies
|
||||
# :none = No unlock strategy. You should handle unlocking by yourself.
|
||||
# config.unlock_strategy = :both
|
||||
@ -187,19 +200,19 @@ Devise.setup do |config|
|
||||
config.reset_password_within = 6.hours
|
||||
|
||||
# ==> Configuration for :encryptable
|
||||
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
||||
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
||||
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
||||
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
||||
# REST_AUTH_SITE_KEY to pepper).
|
||||
# Allow you to use another encryption algorithm besides bcrypt (default). You
|
||||
# can use :sha1, :sha512 or encryptors from others authentication tools as
|
||||
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to
|
||||
# 20 for default behavior) and :restful_authentication_sha1 (then you should
|
||||
# set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
||||
#
|
||||
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
||||
# config.encryptor = :sha512
|
||||
|
||||
# ==> Scopes configuration
|
||||
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||
# are using only default views.
|
||||
# Turn scoped views on. Before rendering "sessions/new", it will first check
|
||||
# for "users/sessions/new". It's turned off by default because it's slower if
|
||||
# you are using only default views.
|
||||
# config.scoped_views = false
|
||||
|
||||
# Configure the default scope given to Warden. By default it's the first
|
||||
@ -227,20 +240,24 @@ Devise.setup do |config|
|
||||
# ==> OmniAuth
|
||||
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||
# up on your models and hooks.
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET',
|
||||
# :scope => 'user,public_repo'
|
||||
|
||||
# ==> Warden configuration
|
||||
# If you want to use other strategies, that are not supported by Devise, or
|
||||
# change the failure app, you can configure them inside the config.warden block.
|
||||
# change the failure app, you can configure them inside the config.warden
|
||||
# block.
|
||||
#
|
||||
# config.warden do |manager|
|
||||
# manager.intercept_401 = false
|
||||
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
||||
# manager.default_strategies(:scope => :user).unshift
|
||||
# :some_external_strategy
|
||||
# end
|
||||
|
||||
# ==> Mountable engine configurations
|
||||
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
||||
# is mountable, there are some extra configurations to be taken into account.
|
||||
# When using Devise inside an engine, let's call it `MyEngine`, and this
|
||||
# engine is mountable, there are some extra configurations to be taken into
|
||||
# account.
|
||||
# The following options are available, assuming the engine is mounted as:
|
||||
#
|
||||
# mount MyEngine, at: '/my_engine'
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
Mime::Type.register "text/calendar", :ics, [], %w(ical)
|
||||
# Mime::Type.register 'text/richtext', :rtf
|
||||
Mime::Type.register 'text/calendar', :ics, [], %w(ical)
|
||||
|
@ -1,5 +1,6 @@
|
||||
# config/initializers/override_mail_recipient.rb
|
||||
if Rails.env.development?
|
||||
# During development, we don't really send mails to the outside world
|
||||
class OverrideMailRecipient
|
||||
def self.delivering_email(mail)
|
||||
mail.to = 'manu@localhost'
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.config.session_store :cookie_store, key: '_agenda_du_libre_rails_session'
|
||||
Rails.application.config.session_store :cookie_store,
|
||||
key: '_agenda_du_libre_rails_session'
|
||||
|
@ -3,7 +3,8 @@
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
# is enabled by default.
|
||||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format
|
||||
# to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
||||
end
|
||||
|
@ -130,11 +130,14 @@ fr:
|
||||
new:
|
||||
title: Soumettre un événement
|
||||
create:
|
||||
ok: Votre événement a bien été ajouté à la liste des événements en attente de modération. Il apparaîtra en ligne dès qu'un modérateur l'aura validé.
|
||||
ok: Votre événement a bien été ajouté à la liste des événements en
|
||||
attente de modération. Il apparaîtra en ligne dès qu'un modérateur
|
||||
l'aura validé.
|
||||
edit:
|
||||
title: Éditer un événement
|
||||
preview: Prévisualisation de l'événement
|
||||
warning: Attention, cet événement est déjà modéré. Toute modification sera immédiatement visible sur le site.
|
||||
warning: Attention, cet événement est déjà modéré. Toute modification
|
||||
sera immédiatement visible sur le site.
|
||||
forbidden: Vous n'êtes pas authorisé à modifier cet événement
|
||||
edit: Édition de l'événement
|
||||
update:
|
||||
@ -144,7 +147,8 @@ fr:
|
||||
visualise: Visualiser
|
||||
cancel:
|
||||
title: Annulation de l'événement
|
||||
already_moderated: Attention, cet événement est déjà modéré. Cette annulation le fera disparaître de l'Agenda du Libre.
|
||||
already_moderated: Attention, cet événement est déjà modéré. Cette
|
||||
annulation le fera disparaître de l'Agenda du Libre.
|
||||
confirm: Confirmez-vous l'annulation de cet événement?
|
||||
preview: Visualisation de l'événement
|
||||
ok: Oui
|
||||
@ -154,7 +158,11 @@ fr:
|
||||
regions:
|
||||
index:
|
||||
title: Liste des flux
|
||||
quick: Chaque flux liste les évènements pour les 30 prochains jours en cours dans une région donnée. En vous abonnant à un flux régional, vous recevrez des informations sur les évènements de votre région à portée locale, mais également les évènements à portée nationale comme les RMLL.
|
||||
quick: Chaque flux liste les évènements pour les 30 prochains jours en
|
||||
cours dans une région donnée. En vous abonnant à un flux régional, vous
|
||||
recevrez des informations sur les évènements de votre région à portée
|
||||
locale, mais également les évènements à portée nationale comme les
|
||||
RMLL.
|
||||
help: "Quelques fonctionnalités intéressantes:\n
|
||||
\n
|
||||
* Vous pouvez limiter les évènements à un certain tag, en passant le paramètre `tag`. Cela permet par exemple de récupérer un flux des évènements organisés uniquement par votre association, à partir du moment où vous pensez à marquer tous vos évènements avec un tag précis. \n
|
||||
@ -167,10 +175,14 @@ Exemple: `%{daylimit}`"
|
||||
allModeration: Événements en cours de modération
|
||||
regional: Par région
|
||||
city: Par ville
|
||||
city_conditions: Seules les villes où plus de trois événements ont été organisés sont mentionnées.
|
||||
city_conditions: Seules les villes où plus de trois événements ont été
|
||||
organisés sont mentionnées.
|
||||
dates: Par date
|
||||
web: Statistiques Web
|
||||
webalizer: Des statistiques Web générées par Webalizer [sont disponibles](http://agendadulibre.org/stats/). Elles sont protégées par le login *stats*, mot de passe *Cuntipshaf6* pour éviter le *spam de referers*
|
||||
webalizer: Des statistiques Web générées par Webalizer [sont
|
||||
disponibles](http://agendadulibre.org/stats/). Elles sont protégées par
|
||||
le login *stats*, mot de passe *Cuntipshaf6* pour éviter le *spam de
|
||||
referers*
|
||||
tags:
|
||||
index:
|
||||
title: Tags
|
||||
@ -187,7 +199,8 @@ Exemple: `%{daylimit}`"
|
||||
moderations:
|
||||
index:
|
||||
title: Événements à modérer
|
||||
rules: Modérateurs, merci de lire et de tenir compte des [recommandations de modération](/application/rules).
|
||||
rules: Modérateurs, merci de lire et de tenir compte des [recommandations
|
||||
de modération](/application/rules).
|
||||
actions: Actions
|
||||
posted_by: Posté par %{author} le %{date}
|
||||
date: Date
|
||||
@ -196,7 +209,8 @@ Exemple: `%{daylimit}`"
|
||||
edit:
|
||||
moderation: Modération
|
||||
preview: Prévisualisation de l'événement
|
||||
warning: Attention, cet événement est déjà modéré. Toute modification sera immédiatement visible sur le site.
|
||||
warning: Attention, cet événement est déjà modéré. Toute modification
|
||||
sera immédiatement visible sur le site.
|
||||
edit: Édition de l'événement
|
||||
update:
|
||||
ok: Événement mis à jour
|
||||
@ -217,9 +231,26 @@ Exemple: `%{daylimit}`"
|
||||
reason_r_2: Pas assez d'informations
|
||||
reason_r_3: Événement déjà enregistré
|
||||
reason_r_4: Raison spécifique (précisez)
|
||||
reason_r_1_long: Toutefois, l'événement proposé n'a pour l'instant pas retenu l'attention des modérateurs. En effet, l'événement proposé ne concerne pas le Logiciel Libre, ou bien le lien avec le Logiciel Libre n'est pas évident dans la formulation actuelle, ou alors il s'agit d'un événement ou d'une formation payante et coûteuse. Si l'événement concerne vraiment le Logiciel Libre et qu'il ne s'agit pas d'une formation payante, n'hésitez pas à le soumettre à nouveau avec une description plus claire.
|
||||
reason_r_2_long: Votre événement a tout à fait sa place dans l'Agenda du Libre, mais les modérateurs trouvent que la description de celui-ci n'est pas assez complète pour être validée.\n\nLa description doit être compréhensible par un nouveau venu dans le monde du Libre, et doit donc préciser le principe de la rencontre, le public visé, la rôle du ou des Logiciels Libres qui seront exposés, la date et le lieu précis de la rencontre. Même si il s'agit d'une rencontre régulière, n'hésitez pas à répéter à chaque fois ces informations, elles sont importantes.\n\nNous vous invitons donc vivement à soumettre à nouveau cet événement avec une description plus complète.
|
||||
reason_r_3_long: Votre événement a tout à fait sa place dans l'Agenda du Libre, mais il est déjà enregistré dans celui-ci.
|
||||
reason_r_1_long: Toutefois, l'événement proposé n'a pour l'instant pas
|
||||
retenu l'attention des modérateurs. En effet, l'événement proposé ne
|
||||
concerne pas le Logiciel Libre, ou bien le lien avec le Logiciel Libre
|
||||
n'est pas évident dans la formulation actuelle, ou alors il s'agit d'un
|
||||
événement ou d'une formation payante et coûteuse. Si l'événement
|
||||
concerne vraiment le Logiciel Libre et qu'il ne s'agit pas d'une
|
||||
formation payante, n'hésitez pas à le soumettre à nouveau avec une
|
||||
description plus claire.
|
||||
reason_r_2_long: Votre événement a tout à fait sa place dans l'Agenda du
|
||||
Libre, mais les modérateurs trouvent que la description de celui-ci
|
||||
n'est pas assez complète pour être validée.\n\nLa description doit être
|
||||
compréhensible par un nouveau venu dans le monde du Libre, et doit donc
|
||||
préciser le principe de la rencontre, le public visé, la rôle du ou des
|
||||
Logiciels Libres qui seront exposés, la date et le lieu précis de la
|
||||
rencontre. Même si il s'agit d'une rencontre régulière, n'hésitez pas à
|
||||
répéter à chaque fois ces informations, elles sont importantes.\n\nNous
|
||||
vous invitons donc vivement à soumettre à nouveau cet événement avec
|
||||
une description plus complète.
|
||||
reason_r_3_long: Votre événement a tout à fait sa place dans l'Agenda du
|
||||
Libre, mais il est déjà enregistré dans celui-ci.
|
||||
reason: Votre raison
|
||||
destroy:
|
||||
ok: Événement rejeté
|
||||
@ -228,7 +259,8 @@ Exemple: `%{daylimit}`"
|
||||
back: Modération
|
||||
title: Ajout d'une note de modération
|
||||
create:
|
||||
sendByMailWrap: "<p>Demande d'informations complémentaires:</p> <pre>%{contents}</pre>"
|
||||
sendByMailWrap: "<p>Demande d'informations complémentaires:</p>
|
||||
<pre>%{contents}</pre>"
|
||||
ok: La note a bien été ajoutée, merci!
|
||||
form:
|
||||
title: Rédaction du message
|
||||
@ -255,28 +287,38 @@ Exemple: `%{daylimit}`"
|
||||
|
||||
event_mailer:
|
||||
create:
|
||||
subject: "[Agenda du Libre] Votre événement: '%{subject}' est en attente de modération"
|
||||
subject: "[Agenda du Libre] Votre événement: '%{subject}' est en attente
|
||||
de modération"
|
||||
title: Bonjour,
|
||||
body: "Votre événement intitulé '%{subject}',
|
||||
\nqui aura lieu le '%{start_time}' a bien été enregistré dans l'Agenda du Libre.
|
||||
\nqui aura lieu le '%{start_time}' a bien été enregistré dans l'Agenda du
|
||||
Libre.
|
||||
\n\nL'équipe de modération le prendra en charge très prochainement.
|
||||
\n\nPendant la modération et après celle-ci si votre événement est validé, vous pouvez éditer votre événement à l'adresse:"
|
||||
\n\nPendant la modération et après celle-ci si votre événement est validé, vous
|
||||
pouvez éditer votre événement à l'adresse:"
|
||||
delete_link: "et vous pouvez l'annuler en utilisant l'adresse:"
|
||||
signature: "Merci de votre participation!\n\n-- \nAgenda du Libre"
|
||||
accept:
|
||||
subject: "[Agenda du Libre] Événement '%{subject}' modéré"
|
||||
title: Bonjour,
|
||||
body: "L'événement que vous avez soumis a été modéré par %{moderator}. Il est maintenant visible dans l'Agenda à l'adresse:"
|
||||
edit_link: "Vous pouvez modifier cet événement ultérieurement pour y ajouter des précisions en vous rendant à l'adresse:"
|
||||
delete_link: "Vous pouvez également l'annuler en vous rendant à l'adresse:"
|
||||
signature: "Merci de votre contribution à l'Agenda du Libre et à bientôt!\n\n-- \nL'équipe de modération"
|
||||
body: "L'événement que vous avez soumis a été modéré par %{moderator}. Il
|
||||
est maintenant visible dans l'Agenda à l'adresse:"
|
||||
edit_link: "Vous pouvez modifier cet événement ultérieurement pour y
|
||||
ajouter des précisions en vous rendant à l'adresse:"
|
||||
delete_link: "Vous pouvez également l'annuler en vous rendant à
|
||||
l'adresse:"
|
||||
signature: "Merci de votre contribution à l'Agenda du Libre et à
|
||||
bientôt!\n\n-- \nL'équipe de modération"
|
||||
destroy:
|
||||
subject: "[Agenda du Libre] Événement '%{subject}' refusé"
|
||||
title: Bonjour,
|
||||
body: Vous avez soumis l'événement suivant dans l'Agenda du Libre, et nous vous remercions de cette contribution.
|
||||
body: Vous avez soumis l'événement suivant dans l'Agenda du Libre, et
|
||||
nous vous remercions de cette contribution.
|
||||
reminder: "Pour rappel, voici le contenu de votre événement:"
|
||||
reclamation: Pour toute réclamation, n'hésitez pas à contacter l'équipe de modérateurs.
|
||||
signature: "Avec tous nos remerciements pour votre contribution,\n\n-- \nL'équipe de modération"
|
||||
reclamation: Pour toute réclamation, n'hésitez pas à contacter l'équipe
|
||||
de modérateurs.
|
||||
signature: "Avec tous nos remerciements pour votre contribution,\n\n--
|
||||
\nL'équipe de modération"
|
||||
moderation_mailer:
|
||||
create:
|
||||
subject: "[Agenda du Libre] Nouvel événement à modérer: '%{subject}'"
|
||||
@ -286,7 +328,8 @@ Exemple: `%{daylimit}`"
|
||||
update:
|
||||
subject: "[Agenda du Libre] Édition de l'événement '%{subject}'"
|
||||
title: Bonjour,
|
||||
body: "L'événement '%{subject}' a été modifié par %{author}.\n\nModifications apportées:"
|
||||
body: "L'événement '%{subject}' a été modifié par
|
||||
%{author}.\n\nModifications apportées:"
|
||||
submitter: le soumetteur
|
||||
signature: "Bonne journée\n\n-- \nL'équipe de modération"
|
||||
accept:
|
||||
@ -297,7 +340,8 @@ Exemple: `%{daylimit}`"
|
||||
destroy:
|
||||
subject: "[Agenda du Libre] Événement '%{subject}' refusé"
|
||||
title: Bonjour,
|
||||
body: "L'événement '%{subject}' a été rejeté par %{author} pour la raison suivante:\n\n"
|
||||
body: "L'événement '%{subject}' a été rejeté par %{author} pour la raison
|
||||
suivante:\n\n"
|
||||
reminder: "Pour rappel, l'événement:"
|
||||
signature: "-- \nL'équipe des modérateurs de l'Agenda du Libre"
|
||||
note_mailer:
|
||||
@ -310,7 +354,8 @@ Exemple: `%{daylimit}`"
|
||||
\ncomplémentaires sur cet événement:"
|
||||
edit_link: "Nous vous invitons à ajouter ces informations en éditant directement
|
||||
\nl'événement à l'adresse suivante:"
|
||||
signature: "Avec tous nos remerciements pour votre contribution,\n\n-- \nL'équipe des modérateurs de l'Agenda du Libre"
|
||||
signature: "Avec tous nos remerciements pour votre contribution,\n\n--
|
||||
\nL'équipe des modérateurs de l'Agenda du Libre"
|
||||
create:
|
||||
subject: "[Agenda du Libre] Une note a été rajoutée à l'événement '%{subject}'"
|
||||
title: Bonjour,
|
||||
|
@ -1,9 +1,9 @@
|
||||
fr:
|
||||
views:
|
||||
pagination:
|
||||
first: "«"
|
||||
last: "»"
|
||||
previous: "‹"
|
||||
next: "›"
|
||||
truncate: "..."
|
||||
first: '«'
|
||||
last: '»'
|
||||
previous: '‹'
|
||||
next: '›'
|
||||
truncate: '...'
|
||||
|
||||
|
@ -12,30 +12,35 @@ Rails.application.routes.draw do
|
||||
get :validate, :refuse, on: :member
|
||||
put :accept, on: :member
|
||||
end
|
||||
resources :regions, only: [ :index ] do
|
||||
resources :regions, only: [:index] do
|
||||
get 'stats', on: :collection
|
||||
end
|
||||
resources :tags, only: [ :index, :show ]
|
||||
resources :tags, only: [:index, :show]
|
||||
resources :maps, only: [:index]
|
||||
resources :lugs, only: [:index, :show]
|
||||
|
||||
# Manage former php pages
|
||||
get 'showevent.php', to: redirect { |params, request| "events/#{request.params[:id]}" }
|
||||
get 'listevents.php', to: redirect { |params, request| "events?#{request.query_string}" }
|
||||
get 'showevent.php', to: redirect { |_, req| "events/#{req.params[:id]}" }
|
||||
get 'listevents.php', to: redirect { |_, req| "events?#{req.query_string}" }
|
||||
# A mechanism to list "all" events
|
||||
get '(:format)listevents.php', to: redirect { |params, request| "events.#{request.format.to_sym}?#{request.query_string}" }
|
||||
get '(:format)listevents.php',
|
||||
to: redirect { |_, r| "events.#{r.format.to_sym}?#{r.query_string}" }
|
||||
# Respond to rss and ical calls
|
||||
get '(:format)event.php', to: redirect { |params, request| "events.#{request.format.to_sym}?#{request.query_string}" }
|
||||
get '(:format)event.php',
|
||||
to: redirect { |_, r| "events.#{r.format.to_sym}?#{r.query_string}" }
|
||||
# Respond to rss and ical calls
|
||||
get '(:format).php', to: redirect { |params, request| "events.#{request.format.to_sym}?#{request.query_string}" }
|
||||
get '(:format).php',
|
||||
to: redirect { |_, r| "events.#{r.format.to_sym}?#{r.query_string}" }
|
||||
|
||||
devise_for :users, path: '', path_names: {sign_in: 'login', sign_out: 'logout'}
|
||||
devise_for :users,
|
||||
path: '', path_names: { sign_in: 'login', sign_out: 'logout' }
|
||||
devise_for :admin_users, ActiveAdmin::Devise.config
|
||||
ActiveAdmin.routes(self)
|
||||
|
||||
root to: 'events#index'
|
||||
|
||||
# The priority is based upon order of creation: first created -> highest priority.
|
||||
# The priority is based upon order of creation:
|
||||
# first created -> highest priority.
|
||||
# See how all your routes lay out with "rake routes".
|
||||
|
||||
# You can have the root of your site routed with "root"
|
||||
@ -47,7 +52,8 @@ Rails.application.routes.draw do
|
||||
# Example of named route that can be invoked with purchase_url(id: product.id)
|
||||
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
||||
|
||||
# Example resource route (maps HTTP verbs to controller actions automatically):
|
||||
# Example resource route (maps HTTP verbs to controller actions
|
||||
# automatically):
|
||||
# resources :products
|
||||
|
||||
# Example resource route with options:
|
||||
|
@ -1,29 +1,32 @@
|
||||
# Generate tables for active_admin users and associated auth mechanisms
|
||||
class DeviseCreateAdminUsers < ActiveRecord::Migration
|
||||
def migrate(direction)
|
||||
super
|
||||
# Create a default user
|
||||
AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password') if direction == :up
|
||||
AdminUser.create!(email: 'admin@example.com', password: 'password',
|
||||
password_confirmation: 'password') if direction == :up
|
||||
end
|
||||
|
||||
# rubocop:disable Style/MethodLength
|
||||
def change
|
||||
create_table(:admin_users) do |t|
|
||||
## Database authenticatable
|
||||
t.string :email, :null => false, :default => ""
|
||||
t.string :encrypted_password, :null => false, :default => ""
|
||||
t.string :email, null: false, default: ''
|
||||
t.string :encrypted_password, null: false, default: ''
|
||||
|
||||
## Recoverable
|
||||
t.string :reset_password_token
|
||||
t.string :reset_password_token
|
||||
t.datetime :reset_password_sent_at
|
||||
|
||||
## Rememberable
|
||||
t.datetime :remember_created_at
|
||||
|
||||
## Trackable
|
||||
t.integer :sign_in_count, :default => 0, :null => false
|
||||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
@ -32,16 +35,16 @@ class DeviseCreateAdminUsers < ActiveRecord::Migration
|
||||
# t.string :unconfirmed_email # Only if using reconfirmable
|
||||
|
||||
## Lockable
|
||||
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
||||
# Only if lock strategy is :failed_attempts
|
||||
# t.integer :failed_attempts, :default => 0, :null => false
|
||||
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
||||
# t.datetime :locked_at
|
||||
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :admin_users, :email, :unique => true
|
||||
add_index :admin_users, :reset_password_token, :unique => true
|
||||
add_index :admin_users, :email, unique: true
|
||||
add_index :admin_users, :reset_password_token, unique: true
|
||||
# add_index :admin_users, :confirmation_token, :unique => true
|
||||
# add_index :admin_users, :unlock_token, :unique => true
|
||||
end
|
||||
|
@ -1,11 +1,13 @@
|
||||
# Add comments for administrators to internally share about any item
|
||||
class CreateActiveAdminComments < ActiveRecord::Migration
|
||||
# rubocop:disable Style/MethodLength
|
||||
def self.up
|
||||
create_table :active_admin_comments do |t|
|
||||
t.string :namespace
|
||||
t.text :body
|
||||
t.string :resource_id, :null => false
|
||||
t.string :resource_type, :null => false
|
||||
t.references :author, :polymorphic => true
|
||||
t.text :body
|
||||
t.string :resource_id, null: false
|
||||
t.string :resource_type, null: false
|
||||
t.references :author, polymorphic: true
|
||||
t.timestamps
|
||||
end
|
||||
add_index :active_admin_comments, [:namespace]
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Add a translations table, to mange many texts from the database
|
||||
class CreateTranslation < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :translations do |t|
|
||||
|
@ -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.
|
||||
@ -12,7 +13,6 @@
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140403204748) do
|
||||
|
||||
create_table "active_admin_comments", force: true do |t|
|
||||
t.string "namespace"
|
||||
t.text "body"
|
||||
@ -114,5 +114,4 @@ ActiveRecord::Schema.define(version: 20140403204748) do
|
||||
t.string "lastname", default: "", null: false
|
||||
t.string "firstname", default: "", null: false
|
||||
end
|
||||
|
||||
end
|
||||
|
13
db/seeds.rb
13
db/seeds.rb
@ -1,7 +1,9 @@
|
||||
# encoding: utf-8
|
||||
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
# This file should contain all the record creation needed to seed the database
|
||||
# with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the
|
||||
# db with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
@ -11,9 +13,12 @@
|
||||
City.create name: 'Rennes'
|
||||
Region.create name: 'Bretagne'
|
||||
Region.create name: 'Ma première région'
|
||||
User.create login: 'admin@example.com', email: 'admin@example.com', password: 'password'
|
||||
User.create login: 'admin@example.com', email: 'admin@example.com',
|
||||
password: 'password'
|
||||
AdminUser.create email: 'admin@example.com', password: 'password'
|
||||
|
||||
# rubocop:disable all
|
||||
# rubocop:disable Metrics/LineLength, Style/StringLiterals
|
||||
I18n::Backend::ActiveRecord::Translation.create([
|
||||
{ locale: 'fr', key: 'layouts.application.subtitle',
|
||||
value: 'L\'agenda des événements du Logiciel Libre en France' },
|
||||
@ -64,7 +69,7 @@ Si vous soumettez souvent un événement régulier dans l'Agenda du Libre, vous
|
||||
|
||||
{ locale: 'fr', key: 'events.form.tags_helper',
|
||||
value: "*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.*
|
||||
|
||||
|
||||
*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.*" },
|
||||
|
||||
{ locale: 'fr', key: 'application.infos.content',
|
||||
|
@ -2,7 +2,7 @@
|
||||
oldrev, newrev = ARGV
|
||||
|
||||
def run(cmd)
|
||||
exit($?.exitstatus) unless system "umask 002 && #{cmd}"
|
||||
exit($CHILD_STATUS.exitstatus) unless system "umask 002 && #{cmd}"
|
||||
end
|
||||
|
||||
RAILS_ENV = ENV['RAILS_ENV'] || 'production'
|
||||
@ -21,19 +21,22 @@ end
|
||||
if File.file? 'Rakefile'
|
||||
tasks = []
|
||||
|
||||
num_migrations = `git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z db/migrate`.split("\0").size
|
||||
num_migrations =
|
||||
`git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z db/migrate`
|
||||
.split("\0").size
|
||||
# run migrations if new ones have been added
|
||||
tasks << "db:migrate" if num_migrations > 0
|
||||
tasks << 'db:migrate' if num_migrations > 0
|
||||
|
||||
# precompile assets
|
||||
changed_assets = `git diff #{oldrev} #{newrev} --name-only -z app/assets`.split("\0")
|
||||
tasks << "assets:precompile" if changed_assets.size > 0
|
||||
changed_assets = `git diff #{oldrev} #{newrev} --name-only -z app/assets`
|
||||
.split("\0")
|
||||
tasks << 'assets:precompile' if changed_assets.size > 0
|
||||
|
||||
run "#{rake_cmd} #{tasks.join(' ')} RAILS_ENV=#{RAILS_ENV}" if tasks.any?
|
||||
end
|
||||
|
||||
# clear cached assets (unversioned/ignored files)
|
||||
run "git clean -x -f -- public/stylesheets public/javascripts"
|
||||
run 'git clean -x -f -- public/stylesheets public/javascripts'
|
||||
|
||||
# clean unversioned files from vendor/plugins (e.g. old submodules)
|
||||
run "git clean -d -f -- vendor/plugins"
|
||||
run 'git clean -d -f -- vendor/plugins'
|
||||
|
@ -1,5 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Event life cycle
|
||||
class EventsControllerTest < ActionController::TestCase
|
||||
include Devise::TestHelpers
|
||||
|
||||
|
@ -1,16 +1,17 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Free Software groups life cycle
|
||||
class LugsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@lug = lugs :one
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
test 'should get index' do
|
||||
get :index
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get show" do
|
||||
test 'should get show' do
|
||||
get :show, id: @lug
|
||||
assert_response :success
|
||||
end
|
||||
|
@ -1,9 +1,9 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Test the geocoding life cycle
|
||||
class MapsControllerTest < ActionController::TestCase
|
||||
test "should get index" do
|
||||
test 'should get index' do
|
||||
get :index
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,5 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Event management, moderation means refusal, acceptation or demands for more
|
||||
# information
|
||||
class ModerationsControllerTest < ActionController::TestCase
|
||||
include Devise::TestHelpers
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Test the notes life cycle
|
||||
class NotesControllerTest < ActionController::TestCase
|
||||
include Devise::TestHelpers
|
||||
|
||||
@ -9,12 +10,12 @@ class NotesControllerTest < ActionController::TestCase
|
||||
sign_in users(:one)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
test 'should get new' do
|
||||
get :new, moderation_id: @note.event.id
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create note" do
|
||||
test 'should create note' do
|
||||
assert_difference('Note.count') do
|
||||
post :create, moderation_id: @note.event.id, note: {
|
||||
author: @note.author,
|
||||
|
@ -1,5 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Test moderator management controller
|
||||
class UsersControllerTest < ActionController::TestCase
|
||||
include Devise::TestHelpers
|
||||
|
||||
@ -9,18 +10,18 @@ class UsersControllerTest < ActionController::TestCase
|
||||
sign_in users(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
test 'should get index' do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:users)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
test 'should get new' do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create user" do
|
||||
test 'should create user' do
|
||||
assert_difference('User.count') do
|
||||
post :create, user: {
|
||||
email: 'original@example.com',
|
||||
@ -34,17 +35,17 @@ class UsersControllerTest < ActionController::TestCase
|
||||
assert_redirected_to user_path(assigns(:user))
|
||||
end
|
||||
|
||||
test "should show user" do
|
||||
test 'should show user' do
|
||||
get :show, id: @user
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
test 'should get edit' do
|
||||
get :edit, id: @user
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update user" do
|
||||
test 'should update user' do
|
||||
patch :update, id: @user, user: {
|
||||
email: @user.email,
|
||||
firstname: @user.firstname,
|
||||
@ -54,7 +55,7 @@ class UsersControllerTest < ActionController::TestCase
|
||||
assert_redirected_to user_path(assigns(:user))
|
||||
end
|
||||
|
||||
test "should destroy user" do
|
||||
test 'should destroy user' do
|
||||
assert_difference('User.count', -1) do
|
||||
delete :destroy, id: @user
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Test mails related to event life cycle
|
||||
class EventMailerTest < ActionMailer::TestCase
|
||||
setup do
|
||||
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
|
||||
@ -7,7 +8,8 @@ class EventMailerTest < ActionMailer::TestCase
|
||||
|
||||
test 'create' do
|
||||
mail = EventMailer.create Event.last
|
||||
assert_match(/\[Agenda du Libre\] Votre événement: .* est en attente de modération/, mail.subject)
|
||||
assert_match(/Votre événement: .* est en attente de modération/,
|
||||
mail.subject)
|
||||
assert_equal [Event.last.contact], mail.to
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
||||
assert_match(/Bonjour.*/, mail.body.encoded)
|
||||
@ -15,14 +17,14 @@ class EventMailerTest < ActionMailer::TestCase
|
||||
|
||||
test 'accept' do
|
||||
mail = EventMailer.accept Event.last, User.last
|
||||
assert_match(/\[Agenda du Libre\] Événement .* modéré/, mail.subject)
|
||||
assert_match(/Événement .* modéré/, mail.subject)
|
||||
assert_equal [Event.last.contact], mail.to
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
||||
end
|
||||
|
||||
test 'destroy' do
|
||||
mail = EventMailer.destroy Event.last, User.last, 'hello world'
|
||||
assert_match(/\[Agenda du Libre\] Événement .* refusé/, mail.subject)
|
||||
assert_match(/Événement .* refusé/, mail.subject)
|
||||
assert_equal [Event.last.contact], mail.to
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Test mails sent related to event moderation
|
||||
class ModerationMailerTest < ActionMailer::TestCase
|
||||
setup do
|
||||
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
|
||||
@ -7,21 +8,22 @@ class ModerationMailerTest < ActionMailer::TestCase
|
||||
|
||||
test 'create' do
|
||||
mail = ModerationMailer.create Event.unscoped.last
|
||||
assert_match(/\[Agenda du Libre\] Nouvel événement à modérer: .*/, mail.subject)
|
||||
assert_match(/\[Agenda du Libre\] Nouvel événement à modérer: .*/,
|
||||
mail.subject)
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.to
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
||||
end
|
||||
|
||||
test 'update' do
|
||||
event = Event.last
|
||||
olderEvent = Event.new event.attributes
|
||||
older_event = Event.new event.attributes
|
||||
|
||||
event.tags += ', ho'
|
||||
event.start_time += 1.day
|
||||
event.description = event.description + '
|
||||
hello world'
|
||||
|
||||
mail = ModerationMailer.update olderEvent, event, User.last
|
||||
mail = ModerationMailer.update older_event, event, User.last
|
||||
assert_match(/\[Agenda du Libre\] Édition de l'événement .*/, mail.subject)
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.to
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
||||
@ -36,7 +38,8 @@ hello world'
|
||||
end
|
||||
|
||||
test 'destroy' do
|
||||
mail = ModerationMailer.destroy Event.unscoped.last, User.last, 'hello world'
|
||||
mail = ModerationMailer.destroy Event.unscoped.last, User.last,
|
||||
'hello world'
|
||||
assert_match(/\[Agenda du Libre\] Événement .* refusé/, mail.subject)
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.to
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
||||
|
@ -1,5 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Test that some information is sent to submitter and moderators when notes are
|
||||
# added to events
|
||||
class NoteMailerTest < ActionMailer::TestCase
|
||||
setup do
|
||||
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
|
||||
@ -7,15 +9,17 @@ class NoteMailerTest < ActionMailer::TestCase
|
||||
|
||||
test 'notify' do
|
||||
mail = NoteMailer.notify Note.last
|
||||
assert_match(/\[Agenda du Libre\] Demande d'informations sur l'événement .*/, mail.subject)
|
||||
assert_match(/\[Agenda du Libre\] Demande d'informations sur l'événement.*/,
|
||||
mail.subject)
|
||||
assert_equal [Note.last.event.contact], mail.to
|
||||
assert_equal ["moderateurs@agendadulibre.org"], mail.from
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
||||
end
|
||||
|
||||
test 'create' do
|
||||
mail = NoteMailer.create Note.last
|
||||
assert_match(/\[Agenda du Libre\] Une note a été rajoutée à l'événement .*/, mail.subject)
|
||||
assert_match(/\[Agenda du Libre\] Une note a été rajoutée à l'événement.*/,
|
||||
mail.subject)
|
||||
assert_not_equal [Note.last.event.contact], mail.to
|
||||
assert_equal ["moderateurs@agendadulibre.org"], mail.from
|
||||
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,5 @@
|
||||
# Preview all emails at http://localhost:3000/rails/mailers/event_mailer
|
||||
class EventMailerPreview < ActionMailer::Preview
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/event_mailer/create
|
||||
def create
|
||||
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
|
||||
|
@ -12,14 +12,14 @@ class ModerationMailerPreview < ActionMailer::Preview
|
||||
def update
|
||||
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
|
||||
event = Event.last
|
||||
olderEvent = Event.new event.attributes
|
||||
older_event = Event.new event.attributes
|
||||
|
||||
event.tags += ', ho'
|
||||
event.start_time += 1.day
|
||||
event.description = event.description + '
|
||||
hello world'
|
||||
|
||||
ModerationMailer.update olderEvent, event, nil
|
||||
ModerationMailer.update older_event, event, nil
|
||||
end
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/moderation_mailer/accept
|
||||
|
@ -1,33 +1,34 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Test events, which are the application central part
|
||||
class EventTest < ActiveSupport::TestCase
|
||||
test 'basic event' do
|
||||
@event = Event.new(
|
||||
title: 'hello world',
|
||||
start_time: Time.new(),
|
||||
end_time: Time.new() + 1,
|
||||
start_time: Time.new,
|
||||
end_time: Time.new + 1,
|
||||
description: 'et hop!',
|
||||
city: City.first(),
|
||||
related_region: Region.first(),
|
||||
city: City.first,
|
||||
related_region: Region.first,
|
||||
url: 'http://example.com',
|
||||
contact: 'contact@example.com',
|
||||
submitter: 'submitter@example.com'
|
||||
)
|
||||
assert @event.save(), @event.errors.messages
|
||||
assert @event.save, @event.errors.messages
|
||||
|
||||
assert_equal 32, @event.secret.size()
|
||||
assert_equal 32, @event.moderator_mail_id.size()
|
||||
assert_equal 32, @event.submitter_mail_id.size()
|
||||
assert_equal 32, @event.secret.size
|
||||
assert_equal 32, @event.moderator_mail_id.size
|
||||
assert_equal 32, @event.submitter_mail_id.size
|
||||
end
|
||||
|
||||
test 'validations' do
|
||||
@event = Event.new(
|
||||
title: 'hello world',
|
||||
start_time: Time.new(),
|
||||
end_time: Time.new() + 1,
|
||||
start_time: Time.new,
|
||||
end_time: Time.new + 1,
|
||||
description: 'et hop!',
|
||||
city: City.first(),
|
||||
related_region: Region.first(),
|
||||
city: City.first,
|
||||
related_region: Region.first,
|
||||
url: 'http://example.com',
|
||||
contact: 'contact@example.com'
|
||||
)
|
||||
@ -52,16 +53,16 @@ class EventTest < ActiveSupport::TestCase
|
||||
test 'moderation' do
|
||||
@event = Event.new(
|
||||
title: 'hello world',
|
||||
start_time: Time.new(),
|
||||
end_time: Time.new() + 1,
|
||||
start_time: Time.new,
|
||||
end_time: Time.new + 1,
|
||||
description: 'et hop!',
|
||||
city: City.first(),
|
||||
related_region: Region.first(),
|
||||
city: City.first,
|
||||
related_region: Region.first,
|
||||
url: 'http://example.com',
|
||||
contact: 'contact@example.com'
|
||||
)
|
||||
|
||||
assert @event.save(), @event.errors.messages
|
||||
assert @event.save, @event.errors.messages
|
||||
assert !@event.moderated?
|
||||
|
||||
@event.update(moderated: 1)
|
||||
|
@ -1,7 +1,8 @@
|
||||
require 'test_helper'
|
||||
|
||||
# Some tests for moderators
|
||||
class UserTest < ActiveSupport::TestCase
|
||||
test "basic user" do
|
||||
test 'basic user' do
|
||||
@user = User.new(
|
||||
email: 'original@example.com',
|
||||
firstname: 'first',
|
||||
@ -13,7 +14,7 @@ class UserTest < ActiveSupport::TestCase
|
||||
assert_equal 'c3fcd3d76192e4007dfb496cca67e13b', @user.encrypted_password
|
||||
end
|
||||
|
||||
test "the password" do
|
||||
test 'the password' do
|
||||
@user = User.new(
|
||||
email: 'original@example.com',
|
||||
firstname: 'first',
|
||||
|
@ -1,15 +1,20 @@
|
||||
ENV["RAILS_ENV"] ||= "test"
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
ActiveRecord::Migration.check_pending!
|
||||
module ActiveSupport
|
||||
# Standard helper class for almost all tests
|
||||
class TestCase
|
||||
ActiveRecord::Migration.check_pending!
|
||||
|
||||
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
||||
#
|
||||
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
||||
# -- they do not yet inherit this setting
|
||||
fixtures :all
|
||||
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical
|
||||
# order.
|
||||
#
|
||||
# Note: You'll currently still have to declare fixtures explicitly in
|
||||
# integration tests
|
||||
# -- they do not yet inherit this setting
|
||||
fixtures :all
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
# Add more helper methods to be used by all tests here...
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user