suite
This commit is contained in:
parent
4738749394
commit
7e9b3c4592
24
app/controllers/public/need_furbish_interests_controller.rb
Normal file
24
app/controllers/public/need_furbish_interests_controller.rb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
class Public::NeedFurbishInterestsController < ApplicationController
|
||||||
|
layout "public"
|
||||||
|
|
||||||
|
before_filter :auth_customer
|
||||||
|
before_filter :check_enabled
|
||||||
|
|
||||||
|
def new
|
||||||
|
@need = Need.find(params[:need_id])
|
||||||
|
@need.need_furbish_interests.create(:customer_id => current_customer.id)
|
||||||
|
|
||||||
|
redirect_to :back
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
|
||||||
|
nfi = current_customer.need_furbish_interests.find(params[:id])
|
||||||
|
nfi.destroy
|
||||||
|
|
||||||
|
redirect_to :back
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -11,7 +11,7 @@ class Customer < ActiveRecord::Base
|
|||||||
|
|
||||||
accepts_nested_attributes_for :particular_send
|
accepts_nested_attributes_for :particular_send
|
||||||
|
|
||||||
|
has_many :need_furbish_interests
|
||||||
|
|
||||||
has_many :thing_conversations, :as => :thing
|
has_many :thing_conversations, :as => :thing
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ class Need < ActiveRecord::Base
|
|||||||
|
|
||||||
belongs_to :reseaux
|
belongs_to :reseaux
|
||||||
|
|
||||||
|
has_many :need_furbish_interests
|
||||||
|
|
||||||
belongs_to :referent_technique, :class_name => "Customer"
|
belongs_to :referent_technique, :class_name => "Customer"
|
||||||
belongs_to :referent_negos, :class_name => "Customer"
|
belongs_to :referent_negos, :class_name => "Customer"
|
||||||
|
|
||||||
|
4
app/models/need_furbish_interest.rb
Normal file
4
app/models/need_furbish_interest.rb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class NeedFurbishInterest < ActiveRecord::Base
|
||||||
|
belongs_to :need
|
||||||
|
belongs_to :customer
|
||||||
|
end
|
@ -130,6 +130,16 @@
|
|||||||
=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é", edit_public_need_wish_path(@need, @wish) , :class => "btn btn-square btn-lg btn-success pull-right"
|
||||||
-else
|
-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 !", 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
|
||||||
|
-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"
|
||||||
|
|
||||||
|
|
||||||
-elsif @need.negociating?
|
-elsif @need.negociating?
|
||||||
|
|
||||||
-elsif @need.negociated?
|
-elsif @need.negociated?
|
||||||
|
@ -30,6 +30,9 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
namespace :public do
|
namespace :public do
|
||||||
|
|
||||||
|
resources :need_furbish_interests
|
||||||
|
|
||||||
|
|
||||||
resources :payments do
|
resources :payments do
|
||||||
member do
|
member do
|
||||||
get :paid_by_ogone
|
get :paid_by_ogone
|
||||||
|
10
db/migrate/20180921093741_create_need_furbish_interests.rb
Normal file
10
db/migrate/20180921093741_create_need_furbish_interests.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class CreateNeedFurbishInterests < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :need_furbish_interests do |t|
|
||||||
|
t.references :need, index: true, foreign_key: true
|
||||||
|
t.references :customer, index: true, foreign_key: true
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
26
db/schema.rb
26
db/schema.rb
@ -11,7 +11,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: 20180827155325) do
|
ActiveRecord::Schema.define(version: 20180921093741) do
|
||||||
|
|
||||||
create_table "abonnements", force: :cascade do |t|
|
create_table "abonnements", force: :cascade do |t|
|
||||||
t.integer "abonnement_type_id", limit: 4
|
t.integer "abonnement_type_id", limit: 4
|
||||||
@ -554,6 +554,16 @@ ActiveRecord::Schema.define(version: 20180827155325) do
|
|||||||
add_index "need_categories", ["need_categories_id"], name: "index_need_categories_on_need_categories_id", using: :btree
|
add_index "need_categories", ["need_categories_id"], name: "index_need_categories_on_need_categories_id", using: :btree
|
||||||
add_index "need_categories", ["parent_id"], name: "index_need_categories_on_parent_id", using: :btree
|
add_index "need_categories", ["parent_id"], name: "index_need_categories_on_parent_id", using: :btree
|
||||||
|
|
||||||
|
create_table "need_furbish_interests", force: :cascade do |t|
|
||||||
|
t.integer "need_id", limit: 4
|
||||||
|
t.integer "customer_id", limit: 4
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "need_furbish_interests", ["customer_id"], name: "index_need_furbish_interests_on_customer_id", using: :btree
|
||||||
|
add_index "need_furbish_interests", ["need_id"], name: "index_need_furbish_interests_on_need_id", using: :btree
|
||||||
|
|
||||||
create_table "needs", force: :cascade do |t|
|
create_table "needs", force: :cascade do |t|
|
||||||
t.string "title", limit: 255
|
t.string "title", limit: 255
|
||||||
t.text "description", limit: 65535
|
t.text "description", limit: 65535
|
||||||
@ -1023,8 +1033,8 @@ ActiveRecord::Schema.define(version: 20180827155325) do
|
|||||||
t.string "name", limit: 255
|
t.string "name", limit: 255
|
||||||
t.text "description", limit: 65535
|
t.text "description", limit: 65535
|
||||||
t.integer "chef_reseau_id", limit: 4
|
t.integer "chef_reseau_id", limit: 4
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.string "token", limit: 255
|
t.string "token", limit: 255
|
||||||
t.integer "parent_id", limit: 4
|
t.integer "parent_id", limit: 4
|
||||||
t.integer "logo_image_file_id", limit: 4
|
t.integer "logo_image_file_id", limit: 4
|
||||||
@ -1032,10 +1042,10 @@ ActiveRecord::Schema.define(version: 20180827155325) do
|
|||||||
t.string "title", limit: 255
|
t.string "title", limit: 255
|
||||||
t.string "baseline", limit: 255
|
t.string "baseline", limit: 255
|
||||||
t.string "sub_domain", limit: 255
|
t.string "sub_domain", limit: 255
|
||||||
t.decimal "abo_price", precision: 10
|
t.decimal "abo_price", precision: 10, scale: 2
|
||||||
t.boolean "abo_needed", default: false
|
t.boolean "abo_needed", default: false
|
||||||
t.boolean "offres_enabled", default: false
|
t.boolean "offres_enabled", default: false
|
||||||
t.boolean "needs_enabled", default: false
|
t.boolean "needs_enabled", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "sessions", force: :cascade do |t|
|
create_table "sessions", force: :cascade do |t|
|
||||||
@ -1143,6 +1153,8 @@ ActiveRecord::Schema.define(version: 20180827155325) do
|
|||||||
add_foreign_key "domain_need_categories", "need_categories"
|
add_foreign_key "domain_need_categories", "need_categories"
|
||||||
add_foreign_key "domain_needs", "domains"
|
add_foreign_key "domain_needs", "domains"
|
||||||
add_foreign_key "domain_needs", "needs"
|
add_foreign_key "domain_needs", "needs"
|
||||||
|
add_foreign_key "need_furbish_interests", "customers"
|
||||||
|
add_foreign_key "need_furbish_interests", "needs"
|
||||||
add_foreign_key "offer_reseauxes", "offers"
|
add_foreign_key "offer_reseauxes", "offers"
|
||||||
add_foreign_key "offer_reseauxes", "reseauxes"
|
add_foreign_key "offer_reseauxes", "reseauxes"
|
||||||
add_foreign_key "product_category_langs", "product_categories"
|
add_foreign_key "product_category_langs", "product_categories"
|
||||||
|
9
test/fixtures/need_furbish_interests.yml
vendored
Normal file
9
test/fixtures/need_furbish_interests.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
need_id:
|
||||||
|
customer_id:
|
||||||
|
|
||||||
|
two:
|
||||||
|
need_id:
|
||||||
|
customer_id:
|
7
test/models/need_furbish_interest_test.rb
Normal file
7
test/models/need_furbish_interest_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class NeedFurbishInterestTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user