This commit is contained in:
Nicolas Bally 2019-05-23 20:59:03 +02:00
parent 1d92ba074e
commit 8c96986309
14 changed files with 39 additions and 10 deletions

View File

@ -22,6 +22,8 @@ gem 'bcrypt', '~> 3.1.7'
gem 'unicorn'
gem 'rails_autolink'
gem 'haml-rails'
gem "therubyracer", group: :production

View File

@ -164,6 +164,8 @@ GEM
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails_autolink (1.1.6)
rails (> 3.1)
railties (4.2.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
@ -272,6 +274,7 @@ DEPENDENCIES
paranoia (~> 2.0)
posix-spawn
rails (= 4.2.6)
rails_autolink
rmagick
rubyzip (>= 1.0.0)
rvm-capistrano (= 1.4.1)

View File

@ -6,7 +6,14 @@ class Public::ProductsController < ApplicationController
layout "public"
def show
@product = Product.not_archived.find(params[:id])
if @product.orderable
params[:type] = "2"
else
params[:type] = "1"
end
@product_lang = @product.lang(I18n.locale)
@product_category = @product.product_category
@image_bandeau = @product.product_category.image_file.file.url if @product.product_category and @product.product_category.image_file
@ -19,6 +26,7 @@ class Public::ProductsController < ApplicationController
def index
params[:type] = params[:type] || "1"
@products = true
@reseaux = current_customer.reseauxes.find(params[:reseaux_id])
@reseaux_layout = true

View File

@ -1,5 +1,5 @@
class Abonnement < ActiveRecord::Base
belongs_to :reseaux
has_many :payments, :as => :element
def after_paid

View File

@ -12,6 +12,7 @@ class Reseaux < ActiveRecord::Base
has_many :offer_reseauxes, :dependent => :destroy
has_many :offers, :through => :offer_reseauxes
belongs_to :menu_item
has_many :thing_conversations, :as => :thing, :dependent => :destroy

View File

@ -20,6 +20,7 @@
=f.input :abo_needed, :label => "Abonnement nécessaire ?"
=f.input :abo_price, :label => "Prix de l'abonnement ?"
=f.input :menu_item_id, :label => "Page statique de présentation de l'abonnement :", :collection => MenuItem.all, :include_blank => true, :as => :select
=f.input :needs_enabled, :label => "Besoins spécifiques activées ?"

View File

@ -71,7 +71,7 @@
%li= link_to "Fournisseurs", admin_fournisseurs_path
%li= link_to "Type de documents", admin_product_order_document_types_path
%li=# link_to "Codes de reduction", admin_vourcher_codes_path
%li=link_to "Pages statiques", admin_menu_items_path(:menu_id => 1)
%ul.nav.navbar-nav.navbar-right
%li.dropdown

View File

@ -1,5 +1,10 @@
-@menu_item = MenuItem.where(:slug => "negos-a-propos").first
-if @reseaux
-if @reseaux.menu_item
-@menu_item = @reseaux.menu_item
-else
-@menu_item = MenuItem.where(:slug => "negos-a-propos").first
-else
-@menu_item = MenuItem.where(:slug => "negos-a-propos").first
-if @menu_item
.page.center{:style => "padding-bottom:40px;"}

View File

@ -1,5 +1,6 @@
.center.row.need-container
.intro=raw @reseaux.description
.row.col-md-9.gutter

View File

@ -8,6 +8,6 @@
%h1 Produits exclusifs réservés à ce réseau
.boutique_body.products
=render Product.where(:archived => false, :reseaux_id => @reseaux.id).all
=render Product.where(:archived => false, :reseaux_id => @reseaux.id, :orderable => (params[:type] == "1" ? false : true )).all

View File

@ -16,7 +16,7 @@
.col_description
.product_description
%h1= @product_lang.title
=simple_format @product_lang.description
=auto_link(simple_format(@product_lang.description), :html => { :target => '_blank' })
-nbr_products = ProductOrderProduct.joins(:product_order).where(:product_orders => {:completed_finish => true},:product_id => @product.id).sum("product_order_products.qty")

View File

@ -6,11 +6,12 @@
-if @reseaux and @reseaux.needs_enabled
=link_to "Besoins exclusifs", public_needs_path(:type => 1), :class => ("active" if @needs and params[:type].to_i == 1)
-if @reseaux and @reseaux.centrale_enabled
=link_to "Portail local", public_needs_path(:type => 2), :class => ("active" if @needs and params[:type].to_i == 2)
=link_to "Portail local", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i, :type => 2), :class => ("active" if (@products or @product) and params[:type] == "2")
-if session[:reseaux_id].to_i > 0
-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)
=link_to "Offres exclusives", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i), :class => ("active" if ((@products or @product) and params[:type] == "1"))
.clear

View File

@ -0,0 +1,5 @@
class AddMenuItemToReseauxes < ActiveRecord::Migration
def change
add_column :reseauxes, :menu_item_id, :integer
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: 20181017211545) do
ActiveRecord::Schema.define(version: 20190523185031) do
create_table "abonnements", force: :cascade do |t|
t.integer "abonnement_type_id", limit: 4
@ -1015,6 +1015,7 @@ ActiveRecord::Schema.define(version: 20181017211545) do
t.decimal "step_group", precision: 10, scale: 2
t.decimal "step_stop", precision: 10, scale: 2
t.boolean "constraint_qty"
t.boolean "orderable", default: true
end
add_index "products", ["product_category_id"], name: "index_products_on_product_category_id", using: :btree
@ -1049,6 +1050,7 @@ ActiveRecord::Schema.define(version: 20181017211545) do
t.boolean "needs_enabled", default: false
t.boolean "centrale_enabled", default: false
t.integer "default_part", limit: 4, default: 1
t.integer "menu_item_id", limit: 4
end
create_table "sessions", force: :cascade do |t|