Trouve ton Gull!
This commit is contained in:
parent
f7ecdfdfbf
commit
4559b8dc1a
@ -36,3 +36,7 @@ $(document).on 'page:change ready', ->
|
||||
$(document).on 'page:load', ->
|
||||
# Reload polyfill when turbolinks loads a new page
|
||||
$(this).updatePolyfill()
|
||||
|
||||
$(document).ready ->
|
||||
$("img").error ->
|
||||
$(this).hide()
|
||||
|
@ -7,10 +7,11 @@ table
|
||||
padding: 0.3em 0.6em
|
||||
|
||||
&.list
|
||||
tr:nth-child(odd)
|
||||
background-color: #D1EAFF
|
||||
tr:nth-child(even)
|
||||
background-color: #C9E2F5
|
||||
tbody
|
||||
tr:nth-child(odd)
|
||||
background-color: #D1EAFF
|
||||
tr:nth-child(even)
|
||||
background-color: #C9E2F5
|
||||
th
|
||||
font-size: larger
|
||||
td
|
||||
@ -22,13 +23,19 @@ dl
|
||||
margin: 1em auto
|
||||
max-width: 40em
|
||||
dt
|
||||
clear: left
|
||||
float: left
|
||||
padding: 0.2em 1em
|
||||
.quantity
|
||||
min-width: 50%
|
||||
text-align: right
|
||||
dd
|
||||
padding: 0.2em 1em
|
||||
border-top: 1px solid #999
|
||||
text-align: left
|
||||
&.quantity
|
||||
text-align: right
|
||||
h3
|
||||
display: inline
|
||||
|
||||
.view_link:link, .edit_link:link, .delete_link:link
|
||||
font-size: 0
|
||||
|
6
app/assets/stylesheets/lugs.sass
Normal file
6
app/assets/stylesheets/lugs.sass
Normal file
@ -0,0 +1,6 @@
|
||||
@import "compass"
|
||||
|
||||
img.favicon
|
||||
max-height: 2em
|
||||
vertical-align: middle
|
||||
@include border-radius(3px)
|
@ -1,5 +1,5 @@
|
||||
@media all and (min-width: 1600px)
|
||||
body.events.index table
|
||||
main
|
||||
font-size: larger
|
||||
|
||||
sidebar#lug-list
|
||||
|
@ -5,8 +5,6 @@ h2.warning
|
||||
table.list
|
||||
min-width: 90%
|
||||
margin-top: 15px
|
||||
thead tr
|
||||
background-color: transparent
|
||||
td
|
||||
padding-top: 0.5em
|
||||
padding-bottom: 0.5em
|
||||
|
@ -4,6 +4,9 @@ class EventsController < ApplicationController
|
||||
before_filter :set_mailer_host
|
||||
|
||||
def index
|
||||
# So we can use the search form from the central calendar page
|
||||
@search = Lug.search params[:q]
|
||||
|
||||
@events = Event.moderated
|
||||
if params[:region] && params[:region].present? && params[:region] != 'all'
|
||||
@events = @events.region params[:region]
|
||||
|
30
app/controllers/lugs_controller.rb
Normal file
30
app/controllers/lugs_controller.rb
Normal file
@ -0,0 +1,30 @@
|
||||
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]
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_lug
|
||||
@lug = Lug.find params[:id]
|
||||
|
||||
set_meta_tags title: @lug.name,
|
||||
description: @lug.url,
|
||||
DC: {
|
||||
title: @lug.name
|
||||
},
|
||||
geo: {
|
||||
region: @lug.related_region,
|
||||
placename: @lug.city,
|
||||
position: "#{@lug.related_city.try :latitude};#{@lug.related_city.try :longitude}"
|
||||
}
|
||||
end
|
||||
end
|
@ -54,3 +54,5 @@
|
||||
tag: params[:tag], protocol: 'webcal', format: :ics, tag: params[:tag], region: params[:region])),
|
||||
ical: link_to('iCal', events_url(:rss,
|
||||
tag: params[:tag], format: :ics, tag: params[:tag], region: params[:region]))
|
||||
|
||||
= render '/lugs/search'
|
||||
|
8
app/views/lugs/_search.html.haml
Normal file
8
app/views/lugs/_search.html.haml
Normal file
@ -0,0 +1,8 @@
|
||||
%h2
|
||||
%em.fa.fa-users
|
||||
= title t '.title', entity: Lug.model_name.human
|
||||
|
||||
= search_form_for @search do |f|
|
||||
= f.label :name_cont
|
||||
= f.search_field :name_cont
|
||||
= f.submit
|
30
app/views/lugs/index.html.haml
Normal file
30
app/views/lugs/index.html.haml
Normal file
@ -0,0 +1,30 @@
|
||||
= 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, :related_region_name, Lug.human_attribute_name(:related_region)
|
||||
%th= sort_link @search, :url
|
||||
%th/
|
||||
|
||||
%tbody
|
||||
- @lugs.each do |lug|
|
||||
%tr
|
||||
%td
|
||||
= lug.name
|
||||
%td
|
||||
= lug.city
|
||||
%td
|
||||
= lug.department
|
||||
%td
|
||||
= lug.related_region
|
||||
%td
|
||||
- if lug.url =~ /^http/
|
||||
= image_tag lug.url+'/favicon.ico', alt: '', class: :favicon
|
||||
= link_to lug.url, lug.url
|
||||
%td
|
||||
= link_to t('show'), lug_url(lug, q: params[:q]), class: :view_link
|
||||
|
||||
= paginate @lugs
|
24
app/views/lugs/show.html.haml
Normal file
24
app/views/lugs/show.html.haml
Normal file
@ -0,0 +1,24 @@
|
||||
= render 'search'
|
||||
|
||||
%dl
|
||||
%dt= Lug.human_attribute_name :name
|
||||
%dd
|
||||
%h3
|
||||
= image_tag @lug.url+'/favicon.ico', alt: '', class: :favicon
|
||||
= @lug.name
|
||||
%dt= Lug.human_attribute_name :city
|
||||
%dd= @lug.city
|
||||
%dt= Lug.human_attribute_name :department
|
||||
%dd= @lug.department
|
||||
%dt= Lug.human_attribute_name :related_region
|
||||
%dd= @lug.related_region
|
||||
%dt= Lug.human_attribute_name :url
|
||||
%dd= link_to @lug.url, @lug.url
|
||||
|
||||
%iframe(src="#{@lug.url}" width='1000' height='400' frameborder='none'
|
||||
allowTransparency='true')
|
||||
|
||||
%nav
|
||||
= link_to lugs_path(q: params[:q]), class: :back do
|
||||
%em.fa.fa-arrow-left
|
||||
= Lug.model_name.human.pluralize
|
@ -1,4 +1,4 @@
|
||||
development:
|
||||
developmen:
|
||||
adapter: sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
@ -13,7 +13,8 @@ test:
|
||||
timeout: 5000
|
||||
database: db/test.sqlite3
|
||||
|
||||
production:
|
||||
#production:
|
||||
development:
|
||||
adapter: mysql2
|
||||
encoding: utf8
|
||||
database: adl_fr
|
||||
|
@ -244,10 +244,8 @@ Exemple: `%{daylimit}`"
|
||||
sign_in:
|
||||
title: Identification
|
||||
lugs:
|
||||
index:
|
||||
title: Groupes d'Utilisateurs de Logiciels Libres
|
||||
show:
|
||||
title: Groupe d'Utilisateurs de Logiciels Libres
|
||||
search:
|
||||
title: Trouve ton %{entity}!
|
||||
|
||||
devise:
|
||||
sessions:
|
||||
|
9
config/locales/kaminari.fr.yml
Normal file
9
config/locales/kaminari.fr.yml
Normal file
@ -0,0 +1,9 @@
|
||||
fr:
|
||||
views:
|
||||
pagination:
|
||||
first: "«"
|
||||
last: "»"
|
||||
previous: "‹"
|
||||
next: "›"
|
||||
truncate: "..."
|
||||
|
17
test/controllers/lugs_controller_test.rb
Normal file
17
test/controllers/lugs_controller_test.rb
Normal file
@ -0,0 +1,17 @@
|
||||
require 'test_helper'
|
||||
|
||||
class LugsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@lug = lugs :one
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get show" do
|
||||
get :show, id: @lug
|
||||
assert_response :success
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user