This commit is contained in:
Nicolas Bally 2018-10-18 00:05:01 +02:00
parent dd935557e1
commit 6036a5cbec
5 changed files with 33 additions and 7 deletions

View File

@ -20,8 +20,14 @@
=f.input :abo_needed, :label => "Abonnement nécessaire ?"
=f.input :abo_price, :label => "Prix de l'abonnement ?"
=f.input :offres_enabled, :label => "Besoins activés ?"
=f.input :needs_enabled, :label => "Offres activées ?"
=f.input :needs_enabled, :label => "Besoins spécifiques activées ?"
=f.input :centrale_enabled, :label => "Centrale d'achats activées ?"
=f.input :offres_enabled, :label => "Offres exclusives activés ?"
=f.input :default_part, :label => "Partie par défaut :", :collection => [["Besoins spécifiques", 1],["Centrale d'achats", 2],["Offres exclusives", 3]], :as => :select
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"

View File

@ -20,7 +20,16 @@
%span
Vous choisissez, nous négocions !
-current_customer.reseauxes.where(:parent_id => nil).each do |reseaux|
=link_to public_reseaux_products_path(:reseaux_id => reseaux.id), :class => "reseauxes" do
-if reseaux.default_part == 3
-reseaux_path = public_reseaux_products_path(:reseaux_id => reseaux.id)
-elsif reseaux.default_part == 2
-reseaux_path = public_needs_path(:type => 2, :reseaux_id => reseaux.id)
-else
-reseaux_path = public_needs_path(:type => 1, :reseaux_id => reseaux.id)
=link_to reseaux_path, :class => "reseauxes" do
.arrow
=ic :"angle-right"
=reseaux.name

View File

@ -3,11 +3,14 @@
.center
-if current_customer.account_validated?
=link_to "Besoins spécifiques", public_needs_path(:type => 1), :class => ("active" if @needs and params[:type].to_i == 1)
=link_to "Centrale d'achats", public_needs_path(:type => 2), :class => ("active" if @needs and params[:type].to_i == 2)
-if @reseaux and @reseaux.needs_enabled
=link_to "Besoins spécifiques", public_needs_path(:type => 1), :class => ("active" if @needs and params[:type].to_i == 1)
-if @reseaux and @reseaux.centrale_enabled
=link_to "Centrale d'achats", public_needs_path(:type => 2), :class => ("active" if @needs and params[:type].to_i == 2)
-if session[:reseaux_id].to_i > 0
=link_to "Offres exclusives", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i), :class => ("active" if @products or @product)
-if @reseaux and @reseaux.offres_enabled
=link_to "Offres exclusives", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i), :class => ("active" if @products or @product)
.clear

View File

@ -0,0 +1,6 @@
class AddCentraleToReseauxes < ActiveRecord::Migration
def change
add_column :reseauxes, :centrale_enabled, :boolean, :default => false
add_column :reseauxes, :default_part, :integer, :default => 1
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20181016180809) do
ActiveRecord::Schema.define(version: 20181017211545) do
create_table "abonnements", force: :cascade do |t|
t.integer "abonnement_type_id", limit: 4
@ -1047,6 +1047,8 @@ ActiveRecord::Schema.define(version: 20181016180809) do
t.boolean "abo_needed", default: false
t.boolean "offres_enabled", default: false
t.boolean "needs_enabled", default: false
t.boolean "centrale_enabled", default: false
t.integer "default_part", limit: 4, default: 1
end
create_table "sessions", force: :cascade do |t|