This commit is contained in:
Nicolas Bally 2020-06-24 16:11:29 +02:00
parent 93b8f1c3df
commit 44ec541588
10 changed files with 55 additions and 6 deletions

View File

@ -13,7 +13,7 @@ class Public::CircuitsController < ApplicationController
end end
if params[:search][:name].to_s != "" if params[:search][:name].to_s != ""
@circuits = @circuits.where("name LIKE ? or city LIKE ? or cp LIKE ?","#{params[:search][:name]}%","#{params[:search][:name]}%","#{params[:search][:name]}%") @circuits = @circuits.where("name LIKE ? or city LIKE ? or cp LIKE ?","%#{params[:search][:name]}%","%#{params[:search][:name]}%","%#{params[:search][:name]}%")
end end
respond_to do |format| respond_to do |format|

View File

@ -7,6 +7,17 @@ class Public::OrganisateursController < ApplicationController
@organisateurs = Organisateur.order(:name).all @organisateurs = Organisateur.order(:name).all
@organisateurs_active = true @organisateurs_active = true
if params[:search][:circuit_region_id].to_s != ""
@organisateurs = @organisateurs.where(:circuit_region_id => params[:search][:circuit_region_id])
end
if params[:search][:name].to_s != ""
@organisateurs = @organisateurs.where("name LIKE ? or city LIKE ? or cp LIKE ?","%#{params[:search][:name]}%","%#{params[:search][:name]}%","%#{params[:search][:name]}%")
end
respond_to do |format| respond_to do |format|
format.html{ format.html{

View File

@ -98,8 +98,6 @@ class Public::PCustomerAuthsController < ApplicationController
if @edit_p_customer.save if @edit_p_customer.save
redirect_to public_my_account_path, :notice => "Votre mot de passe est à jour."
if params[:for_order].to_s != "" if params[:for_order].to_s != ""
redirect_to particulars_public_p_orders_path(), :notice => "Votre mot de passe est à jour." redirect_to particulars_public_p_orders_path(), :notice => "Votre mot de passe est à jour."
elsif elsif

View File

@ -36,6 +36,7 @@ class Organisateur < ApplicationRecord
belongs_to :image_file belongs_to :image_file
belongs_to :logo, :class_name => "ImageFile" belongs_to :logo, :class_name => "ImageFile"
belongs_to :circuit_region
def member_label def member_label
"#{self.name}" "#{self.name}"

View File

@ -6,6 +6,9 @@
= f.input :logo_id, :label => "Logo :", :as => :qi_image_select = f.input :logo_id, :label => "Logo :", :as => :qi_image_select
= f.input :image_file_id, :label => "Image :" , :as => :qi_image_select = f.input :image_file_id, :label => "Image :" , :as => :qi_image_select
= f.input :circuit_region, :label => "Région :"
= f.input :name, :label => "Nom :" = f.input :name, :label => "Nom :"
= f.input :website, :label => "Site web :" = f.input :website, :label => "Site web :"
= f.input :description, :label => "Description :" = f.input :description, :label => "Description :"

View File

@ -1,6 +1,15 @@
%tr#organisateur_row{:id => organisateur.id} %tr#organisateur_row{:id => organisateur.id}
-tr = {} -tr = {}
-tr[:cp] = capture do
%td
=d = organisateur.cp.to_s[0..1]
-dep = DepartementFrance.where(:num_dep => d).first
-if dep and !organisateur.circuit_region
-organisateur.circuit_region = CircuitRegion.where(:name => dep.region_name).first
- organisateur.save if organisateur.circuit_region
-tr[:actions] = capture do -tr[:actions] = capture do
%td.actions %td.actions
= link_to i(:"trash-o"), [:admin, organisateur], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true = link_to i(:"trash-o"), [:admin, organisateur], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true

View File

@ -3,13 +3,12 @@
-params[:search][:m_event_type_title] = params[:search][:m_event_type_title] || [] -params[:search][:m_event_type_title] = params[:search][:m_event_type_title] || []
.centre_filtre .centre_filtre
=link_to image_tag('https://www.mamotosurcircuit.com/images/interface/btn_inscription.png'), public_my_account_path(), :class => "ins"
%h4 Trouvez votre circuit %h4 Trouvez votre circuit
=form_tag "", :method => "get", :onsubmit => "" do =form_tag "", :method => "get", :onsubmit => "" do
.right{:style => "position:relative;top:10px;"} .right{:style => ""}
=submit_tag "Rechercher", :class => "submit" =submit_tag "Rechercher", :class => "submit"
%p %p
.select.inline_large_input=select_tag "search[circuit_region_id]", options_for_select([["Région",""]]+CircuitRegion.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:circuit_region_id]), :class => "" .select.inline_large_input=select_tag "search[circuit_region_id]", options_for_select([["Région",""]]+CircuitRegion.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:circuit_region_id]), :class => ""

View File

@ -1,3 +1,25 @@
.recherche_filtre
-params[:search] = params[:search] || []
-params[:search][:m_event_type_title] = params[:search][:m_event_type_title] || []
.centre_filtre
%h4 Trouvez votre organisateur
=form_tag "", :method => "get", :onsubmit => "" do
.right{:style => ""}
=submit_tag "Rechercher", :class => "submit"
%p
.select.inline_large_input=select_tag "search[circuit_region_id]", options_for_select([["Région",""]]+CircuitRegion.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:circuit_region_id]), :class => ""
=text_field_tag "search[name]", params[:search][:name],:class => "form-control inline_input", :placeholder => "Nom"
.clear
.center_content .center_content
%center %center
%h1 Organisateurs %h1 Organisateurs

View File

@ -0,0 +1,5 @@
class AddCircuitRegionToOrganisateurs < ActiveRecord::Migration[6.0]
def change
add_column :organisateurs, :circuit_region_id, :integer
end
end

View File

@ -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_24_105128) do ActiveRecord::Schema.define(version: 2020_06_24_140026) 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"
@ -1380,6 +1380,7 @@ ActiveRecord::Schema.define(version: 2020_06_24_105128) do
t.string "affiliation" t.string "affiliation"
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.index ["admin_id"], name: "index_organisateurs_on_admin_id" t.index ["admin_id"], name: "index_organisateurs_on_admin_id"
end end