Browse Source

Table lugs renamed to orgas

recurrent
echarp 7 years ago
parent
commit
ef7df97949
  1. 2
      app/admin/orga.rb
  2. 2
      app/assets/stylesheets/all.css.sass
  3. 2
      app/assets/stylesheets/events.css.sass
  4. 2
      app/assets/stylesheets/maps.css.sass
  5. 8
      app/assets/stylesheets/mobile.css.sass
  6. 6
      app/assets/stylesheets/orgas.css.sass
  7. 24
      app/controllers/lugs_controller.rb
  8. 24
      app/controllers/orgas_controller.rb
  9. 14
      app/helpers/lugs_helper.rb
  10. 14
      app/helpers/orgas_helper.rb
  11. 4
      app/models/city.rb
  12. 2
      app/models/orga.rb
  13. 2
      app/models/region.rb
  14. 2
      app/views/events/index.html.haml
  15. 16
      app/views/events/show.html.haml
  16. 4
      app/views/layouts/application.html.haml
  17. 36
      app/views/lugs/index.html.haml
  18. 6
      app/views/orgas/_search.html.haml
  19. 36
      app/views/orgas/index.html.haml
  20. 50
      app/views/orgas/show.html.haml
  21. 4
      config/locales/models/en.yml
  22. 4
      config/locales/models/fr.yml
  23. 6
      config/locales/views/en.yml
  24. 6
      config/locales/views/fr.yml
  25. 2
      config/routes.rb
  26. 6
      db/migrate/20150215151059_rename_table_lug.rb
  27. 18
      db/schema.rb
  28. BIN
      db/schema_cache.dump
  29. 6
      test/controllers/orgas_controller_test.rb
  30. 0
      test/fixtures/orgas.yml
  31. 4
      test/helpers/lugs_helper_test.rb
  32. 4
      test/helpers/orgas_helper_test.rb
  33. 2
      test/models/orga_test.rb

2
app/admin/lug.rb → app/admin/orga.rb

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

2
app/assets/stylesheets/all.css.sass

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

2
app/assets/stylesheets/events.css.sass

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

2
app/assets/stylesheets/maps.css.sass

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

8
app/assets/stylesheets/mobile.css.sass

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

6
app/assets/stylesheets/lugs.css.sass → app/assets/stylesheets/orgas.css.sass

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

24
app/controllers/lugs_controller.rb

@ -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

24
app/controllers/orgas_controller.rb

@ -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

14
app/helpers/lugs_helper.rb

@ -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

14
app/helpers/orgas_helper.rb

@ -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

4
app/models/city.rb

@ -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
#
class City < ActiveRecord::Base
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

2
app/models/lug.rb → app/models/orga.rb

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

2
app/models/region.rb

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

2
app/views/events/index.html.haml

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

16
app/views/events/show.html.haml

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

4
app/views/layouts/application.html.haml

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

36
app/views/lugs/index.html.haml

@ -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

6
app/views/lugs/_search.html.haml → app/views/orgas/_search.html.haml

@ -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')
%em.fa.fa-users
= f.search_field :name_or_city_or_department_or_region_name_or_url_cont,
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
%em.fa.fa-search
%span.label=t '.label'
%span.label= t '.label'

36
app/views/orgas/index.html.haml

@ -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

50
app/views/lugs/show.html.haml → app/views/orgas/show.html.haml

@ -1,52 +1,52 @@
- set_lug_meta
- set_orga_meta
= render 'search'
%h2
= image_tag @lug.url + '/favicon.ico', alt: '', class: :favicon
= title @lug.name
= image_tag @orga.url + '/favicon.ico', alt: '', class: :favicon
= title @orga.name
%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
= 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
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
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
iCal
\/
= link_to maps_path tag: @lug.name do
= link_to maps_path tag: @orga.name do
%em.fa.fa-map-marker
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
GeoJSON
%dl
- if @lug.city.present?
%dt= Lug.human_attribute_name :city
%dd= @lug.city
- if @lug.department.present?
%dt= Lug.human_attribute_name :department
%dd= @lug.department
- if @lug.region.present?
%dt= Lug.human_attribute_name :region
%dd= @lug.region
- if @lug.url.present?
%dt= Lug.human_attribute_name :url
%dd= link_to @lug.url, @lug.url
- if @orga.city.present?
%dt= Orga.human_attribute_name :city
%dd= @orga.city
- if @orga.department.present?
%dt= Orga.human_attribute_name :department
%dd= @orga.department
- if @orga.region.present?
%dt= Orga.human_attribute_name :region
%dd= @orga.region
- if @orga.url.present?
%dt= Orga.human_attribute_name :url
%dd= link_to @orga.url, @orga.url
%iframe(src="#{@lug.url}" width='1280' height='300' frameborder='none'
allowTransparency='true')
%iframe{ src: @orga.url, width: '1280', height: '300', frameborder: 'none',
allowTransparency: 'true' }
- if @events_future.any? || @events_past.any?
%fieldset
@ -82,4 +82,4 @@
= event.title
.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) } }

4
config/locales/models/en.yml

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

4
config/locales/models/fr.yml

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

6
config/locales/views/en.yml

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

6
config/locales/views/fr.yml

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

2
config/routes.rb

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

6
db/migrate/20150215151059_rename_table_lug.rb

@ -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

18
db/schema.rb

@ -12,7 +12,7 @@
#
# 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|
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"
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|
t.text "contents", null: false
t.datetime "date", null: false
@ -100,6 +92,14 @@ ActiveRecord::Schema.define(version: 20150215121248) do
t.integer "author_id"
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|
t.string "name", limit: 255, default: "", null: false
end

BIN
db/schema_cache.dump

Binary file not shown.

6
test/controllers/lugs_controller_test.rb → test/controllers/orgas_controller_test.rb

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

0
test/fixtures/lugs.yml → test/fixtures/orgas.yml vendored

4
test/helpers/lugs_helper_test.rb

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

4
test/helpers/orgas_helper_test.rb

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

2
test/models/lug_test.rb → test/models/orga_test.rb

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