Table lugs renamed to orgas

This commit is contained in:
echarp 2015-02-15 17:10:17 +01:00
parent 5ab067edf2
commit ef7df97949
33 changed files with 162 additions and 156 deletions

View File

@ -1,4 +1,4 @@
ActiveAdmin.register Lug do ActiveAdmin.register Orga do
permit_params :name, :url, :city, :department, :region permit_params :name, :url, :city, :department, :region
index do index do

View File

@ -23,7 +23,7 @@ html
margin: 0 margin: 0
padding: 0 padding: 0
background-color: transparent background-color: transparent
h2, nav, .region_selector, .lug_search, .formats, #banner h2, nav, .region_selector, .orga_search, .formats, #banner
display: none display: none
body body

View File

@ -116,7 +116,7 @@ body.events.show main
h2 h2
margin-top: 1em margin-top: 1em
aside#lug-list aside#orga-list
float: right float: right
width: 16em width: 16em
border: 1px solid #96CFFF border: 1px solid #96CFFF

View File

@ -14,7 +14,7 @@
&.event &.event
height: 20em height: 20em
.tags, .lugs .tags, .orgas
#map #map
width: 40% width: 40%
height: 60em height: 60em

View File

@ -4,7 +4,7 @@
body body
font-size: larger font-size: larger
aside#lug-list aside#orga-list
width: auto width: auto
#advises #advises
@ -14,7 +14,7 @@
body.events.index table body.events.index table
width: 100% width: 100%
form#lug_search form#orga_search
right: 0 right: 0
.formats, a#banner .formats, a#banner
margin: 0.6em auto margin: 0.6em auto
@ -40,7 +40,7 @@
main ul main ul
margin-left: 0 margin-left: 0
form#lug_search form#orga_search
font-size: smaller font-size: smaller
/* For small screen width */ /* For small screen width */
@ -59,7 +59,7 @@
h2 h2
font-size: initial font-size: initial
form#lug_search form#orga_search
display: none display: none
body.events.index table body.events.index table

View File

@ -5,7 +5,7 @@ img.favicon
vertical-align: middle vertical-align: middle
+border-radius(3px) +border-radius(3px)
form#lug_search form#orga_search
right: 5% right: 5%
width: 12em width: 12em
position: absolute position: absolute
@ -40,8 +40,8 @@ form#lug_search
span.label span.label
display: none display: none
body.show body.show main
dl, iframe, fieldset dl, iframe, fieldset
min-width: 30em min-width: 30em
vertical-align: top
+inline-block() +inline-block()
vertical-align: top

View File

@ -1,24 +0,0 @@
# Groups life cycle
class LugsController < ApplicationController
before_action :set_lug, only: [:show]
def index
@search = Lug.search params[:q]
@search.sorts = 'name' if @search.sorts.empty?
@lugs = @search.result.page params[:page]
end
def show
@search = Lug.search params[:q]
@events_future = Event.moderated.future.tag @lug.name
@events_past = Event.moderated.past.tag @lug.name
end
private
# Use callbacks to share common setup or constraints between actions.
def set_lug
@lug = Lug.find params[:id]
end
end

View File

@ -0,0 +1,24 @@
# Groups life cycle
class OrgasController < ApplicationController
before_action :set_orga, only: [:show]
def index
@search = Orga.search params[:q]
@search.sorts = 'name' if @search.sorts.empty?
@orgas = @search.result.page params[:page]
end
def show
@search = Orga.search params[:q]
@events_future = Event.moderated.future.tag @orga.name
@events_past = Event.moderated.past.tag @orga.name
end
private
# Use callbacks to share common setup or constraints between actions.
def set_orga
@orga = Orga.find params[:id]
end
end

View File

@ -1,14 +0,0 @@
# Helper for the lug views
module LugsHelper
def set_lug_meta
set_meta_tags \
description: @lug.url,
DC: { title: @lug.name },
geo: {
region: @lug.region,
placename: @lug.city,
position: "#{@lug.city.try :latitude};" \
+ "#{@lug.city.try :longitude}"
}
end
end

View File

@ -0,0 +1,14 @@
# Helper for the orga views
module OrgasHelper
def set_orga_meta
set_meta_tags \
description: @orga.url,
DC: { title: @orga.name },
geo: {
region: @orga.region,
placename: @orga.city,
position: "#{@orga.city.try :latitude};" \
+ "#{@orga.city.try :longitude}"
}
end
end

View File

@ -1,8 +1,8 @@
# This class is linked to events and lugs # This class is linked to events and organisations
# #
# It is mainly used to manage coordinates # It is mainly used to manage coordinates
# #
class City < ActiveRecord::Base class City < ActiveRecord::Base
has_many :events, foreign_key: :city, primary_key: :name has_many :events, foreign_key: :city, primary_key: :name
has_many :lugs, foreign_key: :city, primary_key: :name has_many :orgas, foreign_key: :city, primary_key: :name
end end

View File

@ -1,4 +1,4 @@
# Groups related to this agenda # Groups related to this agenda
class Lug < ActiveRecord::Base class Orga < ActiveRecord::Base
belongs_to :region belongs_to :region
end end

View File

@ -1,6 +1,6 @@
# This is mostly to group events around a region # This is mostly to group events around a region
class Region < ActiveRecord::Base class Region < ActiveRecord::Base
has_many :lugs has_many :orgas
has_many :events has_many :events
default_scope { order :name } default_scope { order :name }

View File

@ -1,4 +1,4 @@
= render '/lugs/search' = render '/orgas/search'
= render '/regions/selector' = render '/regions/selector'
- if params[:year] - if params[:year]

View File

@ -9,19 +9,19 @@
= title @event.title = title @event.title
- if controller.controller_name == 'events' && controller.action_name == 'show' - if controller.controller_name == 'events' && controller.action_name == 'show'
%aside#lug-list %aside#orga-list
- if @event.region.present? && @event.region.lugs.present? - if @event.region.present? && @event.region.orgas.present?
%h1 %h1
%em.fa.fa-users %em.fa.fa-users
= t '.lug-list' = t '.orga-list'
- if @event.region - if @event.region
%ul %ul
- @event.region.lugs.order(department: :asc).each do |lug| - @event.region.orgas.order(department: :asc).each do |orga|
%li %li
= link_to lug.name, lug = link_to orga.name, orga
(#{lug.department}) (#{orga.department})
= link_to lug.url do = link_to orga.url do
= image_tag lug.url + '/favicon.ico', alt: '', class: :favicon = image_tag orga.url + '/favicon.ico', alt: '', class: :favicon
%h1 %h1
%em.fa.fa-wrench %em.fa.fa-wrench

View File

@ -53,9 +53,9 @@
= link_to tags_path do = link_to tags_path do
%em.fa.fa-tags %em.fa.fa-tags
= t '.tags' = t '.tags'
= link_to lugs_path do = link_to orgas_path do
%em.fa.fa-users %em.fa.fa-users
= Lug.model_name.human.pluralize = Orga.model_name.human.pluralize
= link_to application_infos_path do = link_to application_infos_path do
%em.fa.fa-info %em.fa.fa-info
= t '.infos' = t '.infos'

View File

@ -1,36 +0,0 @@
%h2
%em.fa.fa-users
= title t 'lugs.search.title', entity: Lug.model_name.human
= render 'search'
%table.list.autopagerize_page_element
%thead
%th= sort_link @search, :name
%th= sort_link @search, :city
%th= sort_link @search, :department
%th= sort_link @search, :region_name, Lug.human_attribute_name(:region)
%th= sort_link @search, :url
%th/
%tbody
- @lugs.each do |lug|
%tr
%td
- if lug.url =~ /^http/
= image_tag lug.url + '/favicon.ico', alt: '', class: :favicon
= lug.name
%td
= lug.city
%td
= lug.department
%td
= lug.region
%td
= link_to lug.url, lug.url
%td
= link_to t('show'),
lug_path(lug, q: params[:q], page: params[:page]),
class: :view_link
= paginate @lugs

View File

@ -1,9 +1,9 @@
= search_form_for @search || Lug.search(params[:q]) do |f| = search_form_for @search || Orga.search(params[:q]) do |f|
= f.label :search, t('.label') = f.label :search, t('.label')
%em.fa.fa-users %em.fa.fa-users
= f.search_field :name_or_city_or_department_or_region_name_or_url_cont, = f.search_field :name_or_city_or_department_or_region_name_or_url_cont,
id: :q_search, size: 16, id: :q_search, size: 16,
placeholder: t('.title', entity: Lug.model_name.human) placeholder: t('.title', entity: Orga.model_name.human)
= f.button class: :search do = f.button class: :search do
%em.fa.fa-search %em.fa.fa-search
%span.label=t '.label' %span.label= t '.label'

View File

@ -0,0 +1,36 @@
%h2
%em.fa.fa-users
= title t 'orgas.search.title', entity: Orga.model_name.human
= render 'search'
%table.list.autopagerize_page_element
%thead
%th= sort_link @search, :name
%th= sort_link @search, :city
%th= sort_link @search, :department
%th= sort_link @search, :region_name, Orga.human_attribute_name(:region)
%th= sort_link @search, :url
%th/
%tbody
- @orgas.each do |orga|
%tr
%td
- if orga.url =~ /^http/
= image_tag orga.url + '/favicon.ico', alt: '', class: :favicon
= orga.name
%td
= orga.city
%td
= orga.department
%td
= orga.region
%td
= link_to orga.url, orga.url
%td
= link_to t('show'),
orga_path(orga, q: params[:q], page: params[:page]),
class: :view_link
= paginate @orgas

View File

@ -1,52 +1,52 @@
- set_lug_meta - set_orga_meta
= render 'search' = render 'search'
%h2 %h2
= image_tag @lug.url + '/favicon.ico', alt: '', class: :favicon = image_tag @orga.url + '/favicon.ico', alt: '', class: :favicon
= title @lug.name = title @orga.name
%nav %nav
= link_to lugs_path(q: params[:q], page: params[:page]), class: :back do = link_to orgas_path(q: params[:q], page: params[:page]), class: :back do
%em.fa.fa-arrow-left %em.fa.fa-arrow-left
= Lug.model_name.human.pluralize = Orga.model_name.human.pluralize
\/ \/
= link_to events_path tag: @lug.name do = link_to events_path tag: @orga.name do
%em.fa.fa-calendar %em.fa.fa-calendar
Agenda Agenda
\/ \/
= link_to events_path format: :rss, tag: @lug.name do = link_to events_path format: :rss, tag: @orga.name do
%em.fa.fa-rss %em.fa.fa-rss
RSS RSS
\/ \/
= link_to events_path format: :ics, tag: @lug.name do = link_to events_path format: :ics, tag: @orga.name do
%em.fa.fa-th-list %em.fa.fa-th-list
iCal iCal
\/ \/
= link_to maps_path tag: @lug.name do = link_to maps_path tag: @orga.name do
%em.fa.fa-map-marker %em.fa.fa-map-marker
OpenStreetMap OpenStreetMap
\/ \/
= link_to maps_path format: :json, tag: @lug.name do = link_to maps_path format: :json, tag: @orga.name do
%em.fa.fa-dot-circle-o %em.fa.fa-dot-circle-o
GeoJSON GeoJSON
%dl %dl
- if @lug.city.present? - if @orga.city.present?
%dt= Lug.human_attribute_name :city %dt= Orga.human_attribute_name :city
%dd= @lug.city %dd= @orga.city
- if @lug.department.present? - if @orga.department.present?
%dt= Lug.human_attribute_name :department %dt= Orga.human_attribute_name :department
%dd= @lug.department %dd= @orga.department
- if @lug.region.present? - if @orga.region.present?
%dt= Lug.human_attribute_name :region %dt= Orga.human_attribute_name :region
%dd= @lug.region %dd= @orga.region
- if @lug.url.present? - if @orga.url.present?
%dt= Lug.human_attribute_name :url %dt= Orga.human_attribute_name :url
%dd= link_to @lug.url, @lug.url %dd= link_to @orga.url, @orga.url
%iframe(src="#{@lug.url}" width='1280' height='300' frameborder='none' %iframe{ src: @orga.url, width: '1280', height: '300', frameborder: 'none',
allowTransparency='true') allowTransparency: 'true' }
- if @events_future.any? || @events_past.any? - if @events_future.any? || @events_past.any?
%fieldset %fieldset
@ -82,4 +82,4 @@
= event.title = event.title
.date= display_date event .date= display_date event
.events#map(data-url="#{ maps_path format: :json, tag: @lug.name }") .events#map{ data: { url: maps_path(format: :json, tag: @orga.name) } }

View File

@ -15,7 +15,7 @@ en:
models: models:
event: Event event: Event
user: Modérator user: Modérator
lug: Asso orga: Asso
city: City city: City
region: Region region: Region
admin_user: Admin admin_user: Admin
@ -32,7 +32,7 @@ en:
postalcode: Zip code postalcode: Zip code
inseecode: INSEE code inseecode: INSEE code
regioncode: Region code regioncode: Region code
lug: orga:
region: Region region: Region
department: Department department: Department
url: Web address url: Web address

View File

@ -15,7 +15,7 @@ fr:
models: models:
event: Événement event: Événement
user: Modérateur user: Modérateur
lug: Asso orga: Asso
city: Ville city: Ville
region: Région region: Région
admin_user: Admin admin_user: Admin
@ -32,7 +32,7 @@ fr:
postalcode: Code postal postalcode: Code postal
inseecode: Code INSEE inseecode: Code INSEE
regioncode: Code région regioncode: Code région
lug: orga:
city: Ville city: Ville
department: Département department: Département
region: Région region: Région

View File

@ -42,7 +42,7 @@ en:
calendar_in: This calendar in %{rss}, %{webcal} or %{ical} calendar_in: This calendar in %{rss}, %{webcal} or %{ical}
nb_events: "%{count} events" nb_events: "%{count} events"
show: show:
lug-list: Region's associations orga-list: Region's associations
add_to_calendar: Add to my calendar add_to_calendar: Add to my calendar
copy: Duplicate event copy: Duplicate event
at: At at: At
@ -234,11 +234,11 @@ description."
index: index:
title: Events map title: Events map
events: Events events: Events
lugs: Association orgas: Association
users: users:
sign_in: sign_in:
title: Authentication title: Authentication
lugs: orgas:
search: search:
title: Find your %{entity}! title: Find your %{entity}!
label: Search label: Search

View File

@ -42,7 +42,7 @@ fr:
calendar_in: Ce calendrier en %{rss}, %{webcal} ou %{ical} calendar_in: Ce calendrier en %{rss}, %{webcal} ou %{ical}
nb_events: "%{count} événements" nb_events: "%{count} événements"
show: show:
lug-list: Asso de la région orga-list: Asso de la région
add_to_calendar: Ajouter à mon calendrier add_to_calendar: Ajouter à mon calendrier
copy: Dupliquer événement copy: Dupliquer événement
at: À at: À
@ -236,11 +236,11 @@ description plus complète."
index: index:
title: Carte des événements title: Carte des événements
events: Événements events: Événements
lugs: Asso orgas: Asso
users: users:
sign_in: sign_in:
title: Identification title: Identification
lugs: orgas:
search: search:
title: Trouve ton %{entity}! title: Trouve ton %{entity}!
label: Recherche label: Recherche

View File

@ -19,7 +19,7 @@ Rails.application.routes.draw do
resources :regions, only: [:index] resources :regions, only: [:index]
resources :tags, only: [:index, :show] resources :tags, only: [:index, :show]
resources :maps, only: [:index] resources :maps, only: [:index]
resources :lugs, only: [:index, :show] resources :orgas, only: [:index, :show]
# Manage former php pages # Manage former php pages
get 'showevent.php', to: redirect { |_, req| "events/#{req.params[:id]}" } get 'showevent.php', to: redirect { |_, req| "events/#{req.params[:id]}" }

View File

@ -0,0 +1,6 @@
# Generalisation of the LUG concept to one of event's organiser
class RenameTableLug < ActiveRecord::Migration
def change
rename_table :lugs, :orgas
end
end

View File

@ -12,7 +12,7 @@
# #
# 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: 20150215121248) do ActiveRecord::Schema.define(version: 20150215151059) do
create_table "active_admin_comments", force: :cascade do |t| create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace", limit: 255 t.string "namespace", limit: 255
@ -85,14 +85,6 @@ ActiveRecord::Schema.define(version: 20150215121248) do
add_index "events", ["start_time", "end_time"], name: "events_date" add_index "events", ["start_time", "end_time"], name: "events_date"
create_table "lugs", force: :cascade do |t|
t.integer "region_id", default: 0, null: false
t.integer "department", default: 0, null: false
t.string "name", limit: 255, default: "", null: false
t.string "url", limit: 255, default: "", null: false
t.string "city", limit: 255, default: "", null: false
end
create_table "notes", force: :cascade do |t| create_table "notes", force: :cascade do |t|
t.text "contents", null: false t.text "contents", null: false
t.datetime "date", null: false t.datetime "date", null: false
@ -100,6 +92,14 @@ ActiveRecord::Schema.define(version: 20150215121248) do
t.integer "author_id" t.integer "author_id"
end end
create_table "orgas", force: :cascade do |t|
t.integer "region_id", default: 0, null: false
t.integer "department", default: 0, null: false
t.string "name", limit: 255, default: "", null: false
t.string "url", limit: 255, default: "", null: false
t.string "city", limit: 255, default: "", null: false
end
create_table "regions", force: :cascade do |t| create_table "regions", force: :cascade do |t|
t.string "name", limit: 255, default: "", null: false t.string "name", limit: 255, default: "", null: false
end end

BIN
db/schema_cache.dump Normal file

Binary file not shown.

View File

@ -1,9 +1,9 @@
require 'test_helper' require 'test_helper'
# Free Software groups life cycle # Free Software groups life cycle
class LugsControllerTest < ActionController::TestCase class OrgasControllerTest < ActionController::TestCase
setup do setup do
@lug = lugs :one @orga = orgas :one
end end
test 'should get index' do test 'should get index' do
@ -12,7 +12,7 @@ class LugsControllerTest < ActionController::TestCase
end end
test 'should get show' do test 'should get show' do
get :show, id: @lug get :show, id: @orga
assert_response :success assert_response :success
end end
end end

View File

@ -1,4 +0,0 @@
require 'test_helper'
class LugsHelperTest < ActionView::TestCase
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class OrgasHelperTest < ActionView::TestCase
end

View File

@ -1,6 +1,6 @@
require 'test_helper' require 'test_helper'
class LugTest < ActiveSupport::TestCase class OrgaTest < ActiveSupport::TestCase
# test "the truth" do # test "the truth" do
# assert true # assert true
# end # end