33 changed files with 162 additions and 156 deletions
@ -1,4 +1,4 @@
|
||||
ActiveAdmin.register Lug do |
||||
ActiveAdmin.register Orga do |
||||
permit_params :name, :url, :city, :department, :region |
||||
|
||||
index do |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
||||
|
@ -1,4 +1,4 @@
|
||||
# Groups related to this agenda |
||||
class Lug < ActiveRecord::Base |
||||
class Orga < ActiveRecord::Base |
||||
belongs_to :region |
||||
end |
@ -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 |
@ -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' |
@ -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 |
@ -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 |
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
require 'test_helper' |
||||
|
||||
class LugsHelperTest < ActionView::TestCase |
||||
end |
@ -0,0 +1,4 @@
|
||||
require 'test_helper' |
||||
|
||||
class OrgasHelperTest < ActionView::TestCase |
||||
end |
Loading…
Reference in new issue