suite
This commit is contained in:
parent
18c17a83f1
commit
4953ff7ccb
@ -1159,3 +1159,9 @@ height: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.center{
|
||||
padding:0 20px;
|
||||
margin:auto;
|
||||
|
||||
}
|
@ -10,9 +10,16 @@ class Public::NeedsController < ApplicationController
|
||||
before_filter :check_owner, only: [:destroy,:edit,:update]
|
||||
|
||||
def index
|
||||
params[:type] = params[:type] || 1
|
||||
|
||||
params[:type] = params[:type].to_i
|
||||
|
||||
session[:reseaux_id] = nil if params[:no_reseaux]
|
||||
# Get only public needs
|
||||
@needs = Need.shared
|
||||
|
||||
@needs = @needs.where(:need_type => params[:type])
|
||||
|
||||
if session[:reseaux_id].to_i > 0
|
||||
@needs = @needs.where(:reseaux_id => session[:reseaux_id])
|
||||
else
|
||||
@ -79,6 +86,8 @@ class Public::NeedsController < ApplicationController
|
||||
def download_devis
|
||||
@need = Need.find(params[:need_id])
|
||||
|
||||
params[:type] = @need.need_type
|
||||
|
||||
if @need.author.id != current_customer.id
|
||||
flash[:error] = "Vous n'êtes pas le propriétaire"
|
||||
return redirect_to :back
|
||||
@ -90,6 +99,7 @@ class Public::NeedsController < ApplicationController
|
||||
|
||||
def new
|
||||
@need = Need.new()
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
@ -102,10 +112,12 @@ class Public::NeedsController < ApplicationController
|
||||
|
||||
def edit
|
||||
@need = Need.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@need = Need.find(params[:id])
|
||||
params[:type] = @need.need_type
|
||||
@comment = Message.new()
|
||||
@comments = @need.messages.order(created_at: :desc).page params[:page]
|
||||
end
|
||||
@ -122,6 +134,7 @@ class Public::NeedsController < ApplicationController
|
||||
|
||||
def create
|
||||
@need = Need.new(need_params)
|
||||
params[:type] = @need.need_type
|
||||
@need.reseaux_id = session[:reseaux_id]
|
||||
@need.author = current_customer
|
||||
|
||||
@ -151,6 +164,7 @@ class Public::NeedsController < ApplicationController
|
||||
|
||||
def wish
|
||||
@need = Need.find(params[:id])
|
||||
params[:type] = @need.need_type
|
||||
admins = Admin.where.not(email: nil)
|
||||
if (!@need.customers.include?(current_customer))
|
||||
@need.customers << current_customer
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
|
||||
=f.inputs do
|
||||
=f.input :need_type, :label => "Type :", :collection => [["Besoin spécifique", 1],["Centrale d'achat", 2]], :as => :select, :include_blank => false
|
||||
=f.input :reseaux_id, :label => "Réseau :", :collection => Reseaux.where(:parent_id => nil).all, :as => :select, :include_blank => false
|
||||
|
||||
=f.input :title, :label => "Titre : "
|
||||
|
@ -12,6 +12,7 @@
|
||||
%br
|
||||
Choissisez le réseaux sur lequel vous souhaitez vous connecter :
|
||||
.reseauxes_home
|
||||
-if false
|
||||
=link_to public_needs_path(:no_reseaux => true), :class => "reseauxes" do
|
||||
.arrow
|
||||
=ic :"angle-right"
|
||||
|
@ -19,6 +19,7 @@
|
||||
=i(:"tag") + " " + need.category.name
|
||||
-else
|
||||
Non catégorisé
|
||||
-if params[:type].to_i == 1
|
||||
-if need.verified?
|
||||
%span.state.state-info.pull-right
|
||||
=need.human_state
|
||||
@ -46,6 +47,7 @@
|
||||
|
||||
%p.description=need.description
|
||||
|
||||
-if params[:type].to_i == 1
|
||||
.counters
|
||||
.item=i(:"hand-paper-o") + " " + need.wishes.length.to_s
|
||||
.item=i(:"comment-o") + " " + need.messages.length.to_s
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
.row.col-md-3
|
||||
.white.side-menu
|
||||
-if params[:type].to_i == 1
|
||||
=link_to "Proposer un nouveau besoin", new_public_need_path,style:'display:block', class: 'btn btn-primary'
|
||||
%br
|
||||
= semantic_form_for :search, :html => {id: :search_form, :method => :get } do |f|
|
||||
|
@ -1,5 +1,6 @@
|
||||
.center.white.show-need
|
||||
.top-left-info
|
||||
-if params[:type].to_i == 1
|
||||
-if @need.verified?
|
||||
%span.state.state-info.pull-right
|
||||
=@need.human_state
|
||||
@ -23,6 +24,7 @@
|
||||
.content
|
||||
%h1= @need.title.upcase
|
||||
|
||||
-if params[:type].to_i == 1
|
||||
-if @need.author
|
||||
%p.info
|
||||
=i(:"clock-o") + " Proposé par "
|
||||
@ -127,17 +129,17 @@
|
||||
-if @need.verified?
|
||||
- @wish = @need.wishes.where(need_id: @need.id, customer_id: current_customer.id).first
|
||||
-if(@wish)
|
||||
=link_to i(:"check") + " Intéressé", edit_public_need_wish_path(@need, @wish) , :class => "btn btn-square btn-lg btn-success pull-right"
|
||||
=link_to i(:"check") + " Intéressé - Client", edit_public_need_wish_path(@need, @wish) , :class => "btn btn-square btn-lg btn-success pull-right"
|
||||
-else
|
||||
=link_to i(:"hand-paper-o") + " Ça m'intéresse !", new_public_need_wish_path(@need) , :class => "btn btn-square btn-lg btn-primary pull-right"
|
||||
=link_to i(:"hand-paper-o") + " Ça m'intéresse ! - Client", new_public_need_wish_path(@need) , :class => "btn btn-square btn-lg btn-primary pull-right"
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
- @wish_furbish = @need.need_furbish_interests.where(customer_id: current_customer.id).first
|
||||
-if @wish_furbish
|
||||
=link_to i(:"check") + " Interessé en tant que fournisseur", public_need_furbish_interest_path(@wish_furbish) , :class => "btn btn-square btn-lg btn-success pull-right", :method => :delete
|
||||
=link_to i(:"check") + " Interessé - Fournisseur", public_need_furbish_interest_path(@wish_furbish) , :class => "btn btn-square btn-lg btn-success pull-right", :method => :delete
|
||||
-else
|
||||
=link_to i(:"hand-paper-o") + " Ça m'intéresse en tant que fournisseur !", new_public_need_furbish_interest_path(:need_id => @need.id) , :class => "btn btn-square btn-lg btn-primary pull-right"
|
||||
=link_to i(:"hand-paper-o") + " Ça m'intéresse ! - Fournisseur", new_public_need_furbish_interest_path(:need_id => @need.id) , :class => "btn btn-square btn-lg btn-primary pull-right"
|
||||
|
||||
|
||||
-elsif @need.negociating?
|
||||
@ -169,7 +171,9 @@
|
||||
|
||||
|
||||
.clear
|
||||
%br
|
||||
|
||||
-if params[:type].to_i == 1
|
||||
%hr
|
||||
%h2= i(:"comments") + " Fil de discussion"
|
||||
= semantic_form_for [:public, @need, @comment ], :html => {id: :message_form, :method => :post } do |f|
|
||||
|
@ -6,11 +6,18 @@
|
||||
-if !@my_reseauxes
|
||||
-if current_customer.account_validated?
|
||||
%li=link_to ic(:home)+" Accueil", public_my_reseauxes_path, :class => "btn"
|
||||
-if false
|
||||
-if !@reseaux
|
||||
%li=link_to ic(:"youtube-play")+" Présentation Négos","", :class => "btn negos-video"
|
||||
-if current_customer.account_validated?
|
||||
%li=link_to ic(:star)+" Besoins", public_needs_path, :class => "btn"
|
||||
|
||||
|
||||
|
||||
|
||||
- unread_message = ContactMessage.where(contact_id: current_customer.id, read_by_customer: false).count
|
||||
|
||||
|
||||
%li=link_to ic(:comment)+" Nous contacter" + (unread_message > 0 ? " (#{unread_message})" : ""), public_contact_messages_path, :class => "btn"
|
||||
|
||||
%li=link_to ic(:user)+" Mon compte", public_my_account_path, :class => "btn"
|
||||
|
@ -3,10 +3,11 @@
|
||||
.center
|
||||
|
||||
-if current_customer.account_validated?
|
||||
=link_to "Besoins", public_needs_path, :class => ("active" if @needs)
|
||||
=link_to "Besoins spécifiques", public_needs_path(:type => 1), :class => ("active" if @needs and params[:type].to_i == 1)
|
||||
=link_to "Centrale d'achat", 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", 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)
|
||||
.clear
|
||||
|
||||
|
||||
|
5
db/migrate/20181016180809_add_need_type_to_needs.rb
Normal file
5
db/migrate/20181016180809_add_need_type_to_needs.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddNeedTypeToNeeds < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :needs, :need_type, :integer, :default => 1
|
||||
end
|
||||
end
|
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20180921093741) do
|
||||
ActiveRecord::Schema.define(version: 20181016180809) do
|
||||
|
||||
create_table "abonnements", force: :cascade do |t|
|
||||
t.integer "abonnement_type_id", limit: 4
|
||||
@ -579,6 +579,7 @@ ActiveRecord::Schema.define(version: 20180921093741) do
|
||||
t.integer "referent_negos_id", limit: 4
|
||||
t.integer "referent_technique_id", limit: 4
|
||||
t.integer "reseaux_id", limit: 4
|
||||
t.integer "need_type", limit: 4, default: 1
|
||||
end
|
||||
|
||||
add_index "needs", ["author_id"], name: "index_needs_on_author_id", using: :btree
|
||||
|
Loading…
x
Reference in New Issue
Block a user