suite url
This commit is contained in:
parent
d213ea6535
commit
44f57de50e
@ -30,8 +30,16 @@ class Public::CircuitsController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@circuit = Circuit.find(params[:id])
|
|
||||||
@circuits_active = true
|
@circuits_active = true
|
||||||
|
|
||||||
|
|
||||||
|
if @circuit = Circuit.where(:id => params[:id]).first
|
||||||
|
|
||||||
|
elsif @circuit = Circuit.where(:slug => params[:id]).first
|
||||||
|
|
||||||
|
else
|
||||||
|
redirect_to public_circuits_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,14 +72,14 @@ class Public::MenuItemsController < ApplicationController
|
|||||||
menu_id = 1
|
menu_id = 1
|
||||||
|
|
||||||
@menu_item_lang = @lang.menu_item_langs.joins(:menu_item).where(:menu_items => {:menu_id => menu_id}).find_by_permalink("index")
|
@menu_item_lang = @lang.menu_item_langs.joins(:menu_item).where(:menu_items => {:menu_id => menu_id}).find_by_permalink("index")
|
||||||
@menu_item = @menu_item_lang.menu_item
|
|
||||||
|
|
||||||
if cookies.permanent[:visites_enquete]
|
if @menu_item_lang
|
||||||
cookies.permanent[:visites_enquete] =cookies.permanent[:visites_enquete].to_i + 1
|
@menu_item = @menu_item_lang.menu_item
|
||||||
else
|
else
|
||||||
cookies.permanent[:visites_enquete] = 1
|
redirect_to "/"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
if @menu_item and @menu_item.menu_content and @menu_item.menu_content.class.to_s == "Page"
|
if @menu_item and @menu_item.menu_content and @menu_item.menu_content.class.to_s == "Page"
|
||||||
|
@ -33,8 +33,15 @@ class Public::OrganisateursController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@organisateur = Organisateur.find(params[:id])
|
|
||||||
@organisateurs_active = true
|
@organisateurs_active = true
|
||||||
|
|
||||||
|
if @organisateur = Organisateur.where(:id => params[:id]).first
|
||||||
|
|
||||||
|
elsif @organisateur = Organisateur.where(:slug => params[:id]).first
|
||||||
|
|
||||||
|
else
|
||||||
|
redirect_to public_organisateurs_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,5 +57,9 @@ class Circuit < ApplicationRecord
|
|||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
before_save do
|
||||||
|
self.slug = "#{self.name} #{self.cp} #{self.city}".to_slug if !self.slug
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -41,5 +41,9 @@ class Organisateur < ApplicationRecord
|
|||||||
def member_label
|
def member_label
|
||||||
"#{self.name}"
|
"#{self.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before_save do
|
||||||
|
self.slug = "#{self.name} #{self.cp} #{self.city}".to_slug if !self.slug
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
= f.input :circuit_region, :label => "Région :"
|
= f.input :circuit_region, :label => "Région :"
|
||||||
= f.input :name, :label => "Nom :"
|
= f.input :name, :label => "Nom :"
|
||||||
|
= f.input :slug, :label => "Lien permanent :"
|
||||||
= f.input :website, :label => "Site web :"
|
= f.input :website, :label => "Site web :"
|
||||||
= f.input :description, :label => "Description :"
|
= f.input :description, :label => "Description :"
|
||||||
= f.input :person_civilite, :label => "Civilité :"
|
= f.input :person_civilite, :label => "Civilité :"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
= f.input :name, :label => "Nom :"
|
= f.input :name, :label => "Nom :"
|
||||||
|
= f.input :slug, :label => "Lien permanent :"
|
||||||
= f.input :website, :label => "Site web :"
|
= f.input :website, :label => "Site web :"
|
||||||
= f.input :description, :label => "Description :"
|
= f.input :description, :label => "Description :"
|
||||||
= f.input :person_civilite, :label => "Civilité :"
|
= f.input :person_civilite, :label => "Civilité :"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
=# %h3=circuit.name
|
=# %h3=circuit.name
|
||||||
|
|
||||||
|
|
||||||
=link_to [:public, circuit], :class => "circuit" do
|
=link_to public_circuit_path(:id => circuit.slug), :class => "circuit" do
|
||||||
-img = ""
|
-img = ""
|
||||||
-img = circuit.logo.file.large.medium.url if circuit.logo
|
-img = circuit.logo.file.large.medium.url if circuit.logo
|
||||||
-img = circuit.image_file.file.large.medium.url if circuit.image_file
|
-img = circuit.image_file.file.large.medium.url if circuit.image_file
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
=link_to [:public, organisateur], :class => "organisateur" do
|
=link_to public_organisateur_path(:id => organisateur.slug), :class => "organisateur" do
|
||||||
-img = ""
|
-img = ""
|
||||||
-img = organisateur.logo.file.large.medium.url if organisateur.logo
|
-img = organisateur.logo.file.large.medium.url if organisateur.logo
|
||||||
.img{:style => ("background-image:url('#{img}');" if img)}
|
.img{:style => ("background-image:url('#{img}');" if img)}
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
get "/USER_CREATION/1/104--36-mon-compte.html" => redirect("/fr/mon-compte.html")
|
||||||
|
get "/:lang/mon-compte.html" => "public/my_account#index", :as => :public_my_account
|
||||||
|
|
||||||
|
get "/:lang/se-connecter.html" => "public/p_customer_auths#new", :as => :new_public_p_customer_auth
|
||||||
|
get "/:lang/creer-mon-compte.html" => "public/p_customers#new", :as => :new_public_p_customer
|
||||||
|
post "/:lang/creer-mon-compte.html" => "public/p_customers#create", :as => :public_p_customers
|
||||||
|
get "/:lang/circuits/:id.html" => "public/circuits#show", :as => :public_circuit
|
||||||
|
get "/:lang/circuits.html" => "public/circuits#index", :as => :public_circuits
|
||||||
|
|
||||||
|
|
||||||
|
get "/:lang/organisateurs/:id.html" => "public/organisateurs#show", :as => :public_organisateur
|
||||||
|
get "/:lang/organisateurs.html" => "public/organisateurs#index", :as => :public_organisateurs
|
||||||
|
|
||||||
|
get "/:lang/journees-de-roulage.html" => "public/m_events#index", :as => :public_m_events
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :departement_frances do
|
resources :departement_frances do
|
||||||
member do
|
member do
|
||||||
@ -623,7 +640,7 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
|
|
||||||
namespace :public do
|
namespace :public do
|
||||||
get "my_account" => "my_account#index", :as => :my_account
|
get "my_account" => "my_account#index"
|
||||||
|
|
||||||
|
|
||||||
resources :particulars
|
resources :particulars
|
||||||
@ -1035,7 +1052,7 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
get ':slug.html', to: 'public/m_odrs#show', :as => :public_m_odr
|
get ':slug.html', to: 'public/menu_items#show', :as => :public_m_odr
|
||||||
|
|
||||||
root "public/menu_items#index"
|
root "public/menu_items#index"
|
||||||
|
|
||||||
|
9
db/migrate/20200629091426_add_slug_to_circuits.rb
Normal file
9
db/migrate/20200629091426_add_slug_to_circuits.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
class AddSlugToCircuits < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :circuits, :slug, :string
|
||||||
|
|
||||||
|
Circuit.all.each do |circuit|
|
||||||
|
circuit.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
9
db/migrate/20200629091433_add_slug_to_organisateurs.rb
Normal file
9
db/migrate/20200629091433_add_slug_to_organisateurs.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
class AddSlugToOrganisateurs < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :organisateurs, :slug, :string
|
||||||
|
|
||||||
|
Organisateur.all.each do |organisateur|
|
||||||
|
organisateur.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -10,7 +10,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: 2020_06_25_135439) do
|
ActiveRecord::Schema.define(version: 2020_06_29_091433) do
|
||||||
|
|
||||||
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
@ -230,6 +230,7 @@ ActiveRecord::Schema.define(version: 2020_06_25_135439) do
|
|||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
t.integer "circuit_region_id"
|
t.integer "circuit_region_id"
|
||||||
|
t.string "slug"
|
||||||
t.index ["admin_id"], name: "index_circuits_on_admin_id"
|
t.index ["admin_id"], name: "index_circuits_on_admin_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ ActiveRecord::Schema.define(version: 2020_06_25_135439) do
|
|||||||
t.index ["square_image_file_id"], name: "index_data_files_on_square_image_file_id"
|
t.index ["square_image_file_id"], name: "index_data_files_on_square_image_file_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "departement_frances", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
create_table "departement_frances", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC", force: :cascade do |t|
|
||||||
t.string "num_dep"
|
t.string "num_dep"
|
||||||
t.string "dep_name"
|
t.string "dep_name"
|
||||||
t.string "region_name"
|
t.string "region_name"
|
||||||
@ -1381,6 +1382,7 @@ ActiveRecord::Schema.define(version: 2020_06_25_135439) do
|
|||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
t.integer "circuit_region_id"
|
t.integer "circuit_region_id"
|
||||||
|
t.string "slug"
|
||||||
t.index ["admin_id"], name: "index_organisateurs_on_admin_id"
|
t.index ["admin_id"], name: "index_organisateurs_on_admin_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user