modification nombre d'inscrits dans le mail
ajout grandes régions
This commit is contained in:
parent
0c53f506e7
commit
3fecbf7e7f
76
app/controllers/admin/circuit_region_cats_controller.rb
Normal file
76
app/controllers/admin/circuit_region_cats_controller.rb
Normal file
@ -0,0 +1,76 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::CircuitRegionCatsController < ApplicationController
|
||||
layout "admin"
|
||||
before_action :auth_admin
|
||||
|
||||
before_action :admin_space
|
||||
|
||||
def admin_space
|
||||
@admin_space = "default"
|
||||
end
|
||||
|
||||
def index
|
||||
@circuit_region_cats = CircuitRegionCat.all
|
||||
|
||||
@circuit_region_cats = sort_by_sorting(@circuit_region_cats, "id DESC")
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
|
||||
params[:search][:per_page] = params[:search][:per_page] || 100
|
||||
per_page = params[:search][:per_page]
|
||||
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
@circuit_region_cats = @circuit_region_cats.page(page).per(per_page)
|
||||
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@circuit_region_cat = CircuitRegionCat.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@circuit_region_cat = CircuitRegionCat.new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@circuit_region_cat = CircuitRegionCat.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
@circuit_region_cat = CircuitRegionCat.new(params.require(:circuit_region_cat).permit!)
|
||||
|
||||
if @circuit_region_cat.save
|
||||
|
||||
else
|
||||
render action: "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@circuit_region_cat = CircuitRegionCat.find(params[:id])
|
||||
|
||||
|
||||
if @circuit_region_cat.update_attributes(params.require(:circuit_region_cat).permit!)
|
||||
|
||||
else
|
||||
render action: "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@circuit_region_cat = CircuitRegionCat.find(params[:id])
|
||||
@circuit_region_cat.destroy
|
||||
|
||||
end
|
||||
end
|
@ -13,7 +13,7 @@ class Public::PCustomerAuthsController < ApplicationController
|
||||
|
||||
@p_customer.save
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "confirmation-inscription", @p_customer.email, {:arguments => {:nbr_inscrits => PCustomer.count}, :p_customer => @p_customer})
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "confirmation-inscription", @p_customer.email, {:arguments => {:nbr_inscrits => PCustomer.where(:enabled => true, :test_user => false).count}, :p_customer => @p_customer})
|
||||
end
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ class Public::PCustomersController < ApplicationController
|
||||
cookies[:p_customer_auth_token] = @p_customer.auth_token
|
||||
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "confirmer-inscription", @p_customer.email, {:arguments => {:lien => valid_account_public_p_customer_auths_url(:token => @p_customer.mlm_token) }, :p_customer => @p_customer})
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "confirmer-inscription", @p_customer.email, {:arguments => {:lien => "<a href='#{valid_account_public_p_customer_auths_url(:token => @p_customer.mlm_token)}' >#{valid_account_public_p_customer_auths_url(:token => @p_customer.mlm_token)}</a>" }, :p_customer => @p_customer})
|
||||
|
||||
#mail_hist = MailHist.generate_mail(:fr, MailType.find_or_create("new_account"), @p_customer.email, {:arguments => {:email => @p_customer.email}, :p_customer => @p_customer, :element => @p_customer})
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
class CircuitRegion < ApplicationRecord
|
||||
acts_as_csv_import :fields => [:name]
|
||||
|
||||
belongs_to :circuit_region_cat
|
||||
acts_as_sorting :fields => {
|
||||
:name => {:name => "Nom",:reorder => true},
|
||||
:actions => {:name => "Actions"}
|
||||
|
10
app/models/circuit_region_cat.rb
Normal file
10
app/models/circuit_region_cat.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class CircuitRegionCat < ApplicationRecord
|
||||
has_many :circuit_regions, -> { order("name") }
|
||||
acts_as_sorting fields: {
|
||||
name: { name: "Nom", reorder: true },
|
||||
position: { name: "Position", reorder: true },
|
||||
actions: "Actions"
|
||||
}
|
||||
|
||||
|
||||
end
|
@ -0,0 +1,16 @@
|
||||
%tr#circuit_region_cat_row{:id => circuit_region_cat.id}
|
||||
-tr = {}
|
||||
|
||||
-tr[:actions] = capture do
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), [:admin, circuit_region_cat], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_circuit_region_cat_path(circuit_region_cat), :remote => true
|
||||
= link_to i(:eye), admin_circuit_region_cat_path(circuit_region_cat), :remote => true
|
||||
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => circuit_region_cat}
|
||||
|
||||
|
||||
|
||||
|
13
app/views/admin/circuit_region_cats/_form.html.haml
Normal file
13
app/views/admin/circuit_region_cats/_form.html.haml
Normal file
@ -0,0 +1,13 @@
|
||||
=semantic_form_for [:admin, @circuit_region_cat], :remote => true do |f|
|
||||
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :name, :label => "name :"
|
||||
= f.input :position, :label => "position :"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
2
app/views/admin/circuit_region_cats/create.js.erb
Normal file
2
app/views/admin/circuit_region_cats/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#circuit_region_cats_rows').prepend("<%= escape_javascript(render(@circuit_region_cat))%>");
|
||||
close_pane_hover();
|
1
app/views/admin/circuit_region_cats/destroy.js.erb
Normal file
1
app/views/admin/circuit_region_cats/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
||||
$('#circuit_region_cat_row_<%= @circuit_region_cat.id %>').remove();
|
1
app/views/admin/circuit_region_cats/edit.js.erb
Normal file
1
app/views/admin/circuit_region_cats/edit.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
15
app/views/admin/circuit_region_cats/index.html.haml
Normal file
15
app/views/admin/circuit_region_cats/index.html.haml
Normal file
@ -0,0 +1,15 @@
|
||||
.qi_header
|
||||
.right= link_to ic(:plus)+' Ajouter', new_admin_circuit_region_cat_path(), :class => "btn btn-primary btn-ap-add", :remote => true
|
||||
%h1
|
||||
|
||||
|
||||
|
||||
.qi_search_row
|
||||
=form_tag "", :method => "get", :onsubmit => "" do
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @circuit_region_cats}
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @circuit_region_cats}
|
||||
|
||||
|
||||
|
1
app/views/admin/circuit_region_cats/new.js.erb
Normal file
1
app/views/admin/circuit_region_cats/new.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
10
app/views/admin/circuit_region_cats/show.html.haml
Normal file
10
app/views/admin/circuit_region_cats/show.html.haml
Normal file
@ -0,0 +1,10 @@
|
||||
.qi_header
|
||||
%h1
|
||||
|
||||
%span
|
||||
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
=debug @circuit_region_cat
|
2
app/views/admin/circuit_region_cats/update.js.erb
Normal file
2
app/views/admin/circuit_region_cats/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#circuit_region_cat_row_<%= @circuit_region_cat.id %>').replaceWith("<%= escape_javascript(render(@circuit_region_cat))%>");
|
||||
close_pane_hover();
|
@ -2,6 +2,7 @@
|
||||
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :circuit_region_cat, :label => "Grande région :"
|
||||
= f.input :name, :label => "name :"
|
||||
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
.no-mobile.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 => ""
|
||||
|
||||
.select.inline_large_input=select_tag "search[circuit_region_id]", option_groups_from_collection_for_select(CircuitRegionCat.all, :circuit_regions, :name, :id, :name, params[:search][:circuit_region_id]), :class => "", :include_blank => "Région"
|
||||
|
||||
|
||||
|
||||
=text_field_tag "search[name]", params[:search][:name],:class => "form-control inline_input", :placeholder => "Nom"
|
||||
|
@ -8,7 +8,8 @@
|
||||
=form_tag public_m_events_path, :method => "get", :onsubmit => "" do
|
||||
|
||||
%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]", option_groups_from_collection_for_select(CircuitRegionCat.all, :circuit_regions, :name, :id, :name, params[:search][:circuit_region_id]), :class => "", :include_blank => "Région"
|
||||
|
||||
.select.inline_large_input=select_tag "search[circuit_id]", options_for_select([["Circuit",""]]+Circuit.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:circuit_id]), :place_holder => ""
|
||||
|
||||
|
@ -14,8 +14,7 @@
|
||||
.no-mobile.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 => ""
|
||||
|
||||
.select.inline_large_input=select_tag "search[circuit_region_id]", option_groups_from_collection_for_select(CircuitRegionCat.all, :circuit_regions, :name, :id, :name, params[:search][:circuit_region_id]), :class => "", :include_blank => "Région"
|
||||
|
||||
|
||||
=text_field_tag "search[name]", params[:search][:name],:class => "form-control inline_input", :placeholder => "Nom"
|
||||
|
@ -1,11 +1,28 @@
|
||||
Rails.application.routes.draw do
|
||||
|
||||
|
||||
namespace :admin do
|
||||
resources :circuit_region_cats do
|
||||
member do
|
||||
|
||||
end
|
||||
collection do
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
get "/122-journees.html" => redirect("/fr/journees-de-roulage.html")
|
||||
|
||||
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/confirmer-mon-email/:token.html" => "public/p_customer_auths#valid_account", :as => :valid_account_public_p_customer_auths
|
||||
|
||||
|
||||
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
|
||||
|
10
db/migrate/20200722083247_create_circuit_region_cats.rb
Normal file
10
db/migrate/20200722083247_create_circuit_region_cats.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class CreateCircuitRegionCats < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :circuit_region_cats do |t|
|
||||
t.string :name
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class AddCircuitRegionCatToCircuitRegions < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :circuit_regions, :circuit_region_cat_id, :integer
|
||||
|
||||
CircuitRegion.update_all(:circuit_region_cat_id => 1)
|
||||
end
|
||||
end
|
10
db/schema.rb
10
db/schema.rb
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_07_15_113020) do
|
||||
ActiveRecord::Schema.define(version: 2020_07_22_084354) do
|
||||
|
||||
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||
t.string "name"
|
||||
@ -195,10 +195,18 @@ ActiveRecord::Schema.define(version: 2020_07_15_113020) do
|
||||
t.index ["table_row_id"], name: "index_cel_tables_on_table_row_id"
|
||||
end
|
||||
|
||||
create_table "circuit_region_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.integer "position"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
end
|
||||
|
||||
create_table "circuit_regions", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.integer "circuit_region_cat_id"
|
||||
end
|
||||
|
||||
create_table "circuits", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||
|
Loading…
x
Reference in New Issue
Block a user