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