Video Negos + Check_enabled + devis on each interest + other
This commit is contained in:
parent
4b8f05b4e2
commit
6da4b9870f
@ -15,7 +15,7 @@
|
||||
|
||||
#= require public/prettify.js
|
||||
#= require public/jquery.jOrgChart.js
|
||||
|
||||
#= require public/jquery.magnific-popup.min
|
||||
|
||||
#= require bootstrap-p
|
||||
|
||||
|
4
app/assets/javascripts/public/jquery.magnific-popup.min.js
vendored
Normal file
4
app/assets/javascripts/public/jquery.magnific-popup.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
351
app/assets/stylesheets/magnific-popup.scss
Normal file
351
app/assets/stylesheets/magnific-popup.scss
Normal file
@ -0,0 +1,351 @@
|
||||
/* Magnific Popup CSS */
|
||||
.mfp-bg {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1042;
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
background: #0b0b0b;
|
||||
opacity: 0.8; }
|
||||
|
||||
.mfp-wrap {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1043;
|
||||
position: fixed;
|
||||
outline: none !important;
|
||||
-webkit-backface-visibility: hidden; }
|
||||
|
||||
.mfp-container {
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box; }
|
||||
|
||||
.mfp-container:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle; }
|
||||
|
||||
.mfp-align-top .mfp-container:before {
|
||||
display: none; }
|
||||
|
||||
.mfp-content {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
z-index: 1045; }
|
||||
|
||||
.mfp-inline-holder .mfp-content,
|
||||
.mfp-ajax-holder .mfp-content {
|
||||
width: 100%;
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-ajax-cur {
|
||||
cursor: progress; }
|
||||
|
||||
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
||||
cursor: -moz-zoom-out;
|
||||
cursor: -webkit-zoom-out;
|
||||
cursor: zoom-out; }
|
||||
|
||||
.mfp-zoom {
|
||||
cursor: pointer;
|
||||
cursor: -webkit-zoom-in;
|
||||
cursor: -moz-zoom-in;
|
||||
cursor: zoom-in; }
|
||||
|
||||
.mfp-auto-cursor .mfp-content {
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-close,
|
||||
.mfp-arrow,
|
||||
.mfp-preloader,
|
||||
.mfp-counter {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none; }
|
||||
|
||||
.mfp-loading.mfp-figure {
|
||||
display: none; }
|
||||
|
||||
.mfp-hide {
|
||||
display: none !important; }
|
||||
|
||||
.mfp-preloader {
|
||||
color: #CCC;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: auto;
|
||||
text-align: center;
|
||||
margin-top: -0.8em;
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
z-index: 1044; }
|
||||
.mfp-preloader a {
|
||||
color: #CCC; }
|
||||
.mfp-preloader a:hover {
|
||||
color: #FFF; }
|
||||
|
||||
.mfp-s-ready .mfp-preloader {
|
||||
display: none; }
|
||||
|
||||
.mfp-s-error .mfp-content {
|
||||
display: none; }
|
||||
|
||||
button.mfp-close,
|
||||
button.mfp-arrow {
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
z-index: 1046;
|
||||
box-shadow: none;
|
||||
touch-action: manipulation; }
|
||||
|
||||
button::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0; }
|
||||
|
||||
.mfp-close {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
opacity: 0.65;
|
||||
padding: 0 0 18px 10px;
|
||||
color: #FFF;
|
||||
font-style: normal;
|
||||
font-size: 28px;
|
||||
font-family: Arial, Baskerville, monospace; }
|
||||
.mfp-close:hover,
|
||||
.mfp-close:focus {
|
||||
opacity: 1; }
|
||||
.mfp-close:active {
|
||||
top: 1px; }
|
||||
|
||||
.mfp-close-btn-in .mfp-close {
|
||||
color: #333; }
|
||||
|
||||
.mfp-image-holder .mfp-close,
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
color: #FFF;
|
||||
right: -6px;
|
||||
text-align: right;
|
||||
padding-right: 6px;
|
||||
width: 100%; }
|
||||
|
||||
.mfp-counter {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
color: #CCC;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap; }
|
||||
|
||||
.mfp-arrow {
|
||||
position: absolute;
|
||||
opacity: 0.65;
|
||||
margin: 0;
|
||||
top: 50%;
|
||||
margin-top: -55px;
|
||||
padding: 0;
|
||||
width: 90px;
|
||||
height: 110px;
|
||||
-webkit-tap-highlight-color: transparent; }
|
||||
.mfp-arrow:active {
|
||||
margin-top: -54px; }
|
||||
.mfp-arrow:hover,
|
||||
.mfp-arrow:focus {
|
||||
opacity: 1; }
|
||||
.mfp-arrow:before,
|
||||
.mfp-arrow:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
margin-top: 35px;
|
||||
margin-left: 35px;
|
||||
border: medium inset transparent; }
|
||||
.mfp-arrow:after {
|
||||
border-top-width: 13px;
|
||||
border-bottom-width: 13px;
|
||||
top: 8px; }
|
||||
.mfp-arrow:before {
|
||||
border-top-width: 21px;
|
||||
border-bottom-width: 21px;
|
||||
opacity: 0.7; }
|
||||
|
||||
.mfp-arrow-left {
|
||||
left: 0; }
|
||||
.mfp-arrow-left:after {
|
||||
border-right: 17px solid #FFF;
|
||||
margin-left: 31px; }
|
||||
.mfp-arrow-left:before {
|
||||
margin-left: 25px;
|
||||
border-right: 27px solid #3F3F3F; }
|
||||
|
||||
.mfp-arrow-right {
|
||||
right: 0; }
|
||||
.mfp-arrow-right:after {
|
||||
border-left: 17px solid #FFF;
|
||||
margin-left: 39px; }
|
||||
.mfp-arrow-right:before {
|
||||
border-left: 27px solid #3F3F3F; }
|
||||
|
||||
.mfp-iframe-holder {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px; }
|
||||
.mfp-iframe-holder .mfp-content {
|
||||
line-height: 0;
|
||||
width: 100%;
|
||||
max-width: 900px; }
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
top: -40px; }
|
||||
|
||||
.mfp-iframe-scaler {
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
padding-top: 56.25%; }
|
||||
.mfp-iframe-scaler iframe {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
||||
background: #000; }
|
||||
|
||||
/* Main image in popup */
|
||||
img.mfp-img {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
line-height: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 40px 0 40px;
|
||||
margin: 0 auto; }
|
||||
|
||||
/* The shadow behind the image */
|
||||
.mfp-figure {
|
||||
line-height: 0; }
|
||||
.mfp-figure:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 40px;
|
||||
bottom: 40px;
|
||||
display: block;
|
||||
right: 0;
|
||||
width: auto;
|
||||
height: auto;
|
||||
z-index: -1;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
||||
background: #444; }
|
||||
.mfp-figure small {
|
||||
color: #BDBDBD;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 14px; }
|
||||
.mfp-figure figure {
|
||||
margin: 0; }
|
||||
|
||||
.mfp-bottom-bar {
|
||||
margin-top: -36px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-title {
|
||||
text-align: left;
|
||||
line-height: 18px;
|
||||
color: #F3F3F3;
|
||||
word-wrap: break-word;
|
||||
padding-right: 36px; }
|
||||
|
||||
.mfp-image-holder .mfp-content {
|
||||
max-width: 100%; }
|
||||
|
||||
.mfp-gallery .mfp-image-holder .mfp-figure {
|
||||
cursor: pointer; }
|
||||
|
||||
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
|
||||
/**
|
||||
* Remove all paddings around the image on small screen
|
||||
*/
|
||||
.mfp-img-mobile .mfp-image-holder {
|
||||
padding-left: 0;
|
||||
padding-right: 0; }
|
||||
.mfp-img-mobile img.mfp-img {
|
||||
padding: 0; }
|
||||
.mfp-img-mobile .mfp-figure:after {
|
||||
top: 0;
|
||||
bottom: 0; }
|
||||
.mfp-img-mobile .mfp-figure small {
|
||||
display: inline;
|
||||
margin-left: 5px; }
|
||||
.mfp-img-mobile .mfp-bottom-bar {
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
top: auto;
|
||||
padding: 3px 5px;
|
||||
position: fixed;
|
||||
box-sizing: border-box; }
|
||||
.mfp-img-mobile .mfp-bottom-bar:empty {
|
||||
padding: 0; }
|
||||
.mfp-img-mobile .mfp-counter {
|
||||
right: 5px;
|
||||
top: 3px; }
|
||||
.mfp-img-mobile .mfp-close {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
padding: 0; } }
|
||||
|
||||
@media all and (max-width: 900px) {
|
||||
.mfp-arrow {
|
||||
-webkit-transform: scale(0.75);
|
||||
transform: scale(0.75); }
|
||||
.mfp-arrow-left {
|
||||
-webkit-transform-origin: 0;
|
||||
transform-origin: 0; }
|
||||
.mfp-arrow-right {
|
||||
-webkit-transform-origin: 100%;
|
||||
transform-origin: 100%; }
|
||||
.mfp-container {
|
||||
padding-left: 6px;
|
||||
padding-right: 6px; } }
|
@ -1,7 +1,7 @@
|
||||
@import "bootstrap";
|
||||
|
||||
@import "fontawesome/font-awesome";
|
||||
|
||||
@import "magnific-popup";
|
||||
|
||||
|
||||
@import "public/grid";
|
||||
|
@ -17,6 +17,16 @@ class Admin::WishesController < ApplicationController
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
def download_devis
|
||||
|
||||
@wish = Wish.find(params[:id])
|
||||
@need = @wish.need
|
||||
|
||||
send_file @wish.devis.file.path, filename: "devis-need-#{@need.id}.#{@wish.devis.file.extension}"
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
@ -4,6 +4,11 @@ class ApplicationController < ActionController::Base
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
|
||||
def check_enabled
|
||||
if !@current_customer.account_validated?
|
||||
redirect_to public_my_account_path
|
||||
end
|
||||
end
|
||||
|
||||
def auth_customer
|
||||
|
||||
|
@ -2,6 +2,7 @@ class Public::AcceptedOffersController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
before_filter :auth_customer
|
||||
before_filter :check_enabled
|
||||
|
||||
def download_devis
|
||||
@accepted_offer = AcceptedOffer.find(params[:id])
|
||||
|
@ -1,4 +1,7 @@
|
||||
class Public::CommentsController < ApplicationController
|
||||
class Public::CommentsController < ApplicationController
|
||||
|
||||
before_filter :auth_customer
|
||||
before_filter :check_enabled
|
||||
|
||||
def create
|
||||
@comment = Comment.new(params.require(:comment).permit(:website, :pseudo, :email, :comment, :commentable_id, :commentable_type))
|
||||
|
@ -3,6 +3,7 @@ class Public::DocumentsController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
before_filter :auth_customer
|
||||
before_filter :check_enabled
|
||||
before_filter :check_owner
|
||||
|
||||
def index
|
||||
|
@ -10,8 +10,8 @@ class Public::MenuItemsController < ApplicationController
|
||||
def archive
|
||||
@menu_item= MenuItem.archived.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
@no_search = true
|
||||
|
@ -2,6 +2,7 @@ class Public::MessagesController < ApplicationController
|
||||
layout "public"
|
||||
before_filter :auth_customer
|
||||
|
||||
|
||||
def index
|
||||
need = Need.find(params[:need_id])
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ class Public::MyAccountController < ApplicationController
|
||||
def index
|
||||
@accepted_offers = current_customer.accepted_offers.order(created_at: :desc).page(params[:page_offers]).per(5)
|
||||
|
||||
@wishes = current_customer.needs.shared.page(params[:page_wishes]).per(5)
|
||||
@wishes = current_customer.wishes.includes(:need).page(params[:page_wishes]).per(5)
|
||||
|
||||
@needs = Kaminari.paginate_array(current_customer.owned_needs.order(created_at: :desc))
|
||||
.page(params[:page_needs])
|
||||
|
@ -3,6 +3,9 @@ class Public::NeedsController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
before_filter :auth_customer
|
||||
before_filter :check_enabled
|
||||
|
||||
|
||||
before_filter :build_category_tree, only:[:index,:new,:create,:edit,:update]
|
||||
before_filter :check_owner, only: [:destroy,:edit,:update]
|
||||
|
||||
@ -120,6 +123,15 @@ class Public::NeedsController < ApplicationController
|
||||
end
|
||||
|
||||
if @need.save
|
||||
|
||||
@wish = Wish.new
|
||||
@wish.customer = current_customer
|
||||
@wish.need = @need
|
||||
@wish.devis = @need.devis
|
||||
@wish.note = @need.note
|
||||
@wish.save
|
||||
|
||||
|
||||
flash[:notice] = "Votre besoin à été créé avec succès."
|
||||
redirect_to public_my_account_path
|
||||
else
|
||||
|
@ -1,7 +1,8 @@
|
||||
class Public::OffersController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
before_filter :auth_customer, :get_need, :check_interest, :get_offer
|
||||
before_filter :auth_customer, :check_enabled, :get_need, :check_interest, :get_offer
|
||||
|
||||
|
||||
|
||||
def accept
|
||||
|
98
app/controllers/public/wishes_controller.rb
Normal file
98
app/controllers/public/wishes_controller.rb
Normal file
@ -0,0 +1,98 @@
|
||||
class Public::WishesController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
before_filter :auth_customer
|
||||
before_filter :check_enabled
|
||||
|
||||
def new
|
||||
@wish = Wish.new
|
||||
@need = Need.find(params[:need_id])
|
||||
@wish.need = @need
|
||||
end
|
||||
|
||||
def edit
|
||||
@wish = Wish.find(params[:id])
|
||||
@need = @wish.need
|
||||
end
|
||||
|
||||
def create
|
||||
@wish = Wish.new
|
||||
@need = Need.find(params[:need_id])
|
||||
|
||||
if (!@need.customers.include?(current_customer))
|
||||
@wish.update_attributes(wishes_params)
|
||||
@wish.customer = current_customer
|
||||
|
||||
@wish.need = Need.find(params[:need_id])
|
||||
if @wish.save
|
||||
admins = Admin.where.not(email: nil)
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_interested(admin, @need, current_customer).deliver
|
||||
end
|
||||
|
||||
flash[:success] = "Intérêt enregistré, merci pour votre participation"
|
||||
redirect_to public_need_path(@need)
|
||||
else
|
||||
|
||||
render 'new'
|
||||
end
|
||||
|
||||
else
|
||||
flash[:error] = "Vous êtes déjà intéressé par ce besoin"
|
||||
redirect_to public_need_path(@need)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@wish = current_customer.wishes.find(params[:id])
|
||||
@need = @wish.need
|
||||
@wish.update_attributes(wishes_params)
|
||||
if @wish.save
|
||||
redirect_to public_need_path(@need)
|
||||
else
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
|
||||
|
||||
@wish = Wish.find(params[:id])
|
||||
@need = @wish.need
|
||||
@need.customers.delete(current_customer)
|
||||
|
||||
admins = Admin.where.not(email: nil)
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_disinterested(admin, @need, current_customer).deliver
|
||||
end
|
||||
flash[:success] = "Vous n'êtes plus intéressé par ce besoin"
|
||||
redirect_to public_need_path(@need)
|
||||
|
||||
|
||||
end
|
||||
|
||||
def download_devis
|
||||
|
||||
@wish = Wish.find(params[:id])
|
||||
@need = @wish.need
|
||||
|
||||
if @wish.customer.id != current_customer.id
|
||||
flash[:error] = "Vous n'êtes pas le propriétaire"
|
||||
return redirect_to :back
|
||||
end
|
||||
|
||||
send_file @wish.devis.file.path, filename: "devis-need-#{@need.id}.#{@wish.devis.file.extension}"
|
||||
end
|
||||
|
||||
|
||||
def wishes_params
|
||||
params.require(:wish).permit(:devis, :note, :need_id)
|
||||
end
|
||||
|
||||
end
|
@ -1,4 +1,4 @@
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: "\"Négos\" <contact@negos-pro.fr>"
|
||||
default from: "\"Négos\" <contact@negos.pro>"
|
||||
layout 'mailer'
|
||||
end
|
||||
|
@ -122,19 +122,19 @@ class CustomerMailer < ApplicationMailer
|
||||
def new_message(customer)
|
||||
@customer = customer
|
||||
|
||||
mail from: "Négos.com <no-reply@negos.pro>", to: customer.email, :subject => "Vous avez un nouveau message privé"
|
||||
mail from: "Négos.com <contact@negos.pro>", to: customer.email, :subject => "Vous avez un nouveau message privé"
|
||||
end
|
||||
|
||||
def password_reset(customer)
|
||||
@customer = customer
|
||||
mail :to => @customer.email, :subject => "Reinitialisation du mot de passe.", :from => "Négos.com <no-reply@negos.pro>"
|
||||
mail :to => @customer.email, :subject => "Reinitialisation du mot de passe.", :from => "Négos.com <contact@negos.pro>"
|
||||
end
|
||||
|
||||
def new_commission(commission)
|
||||
@commission = commission
|
||||
|
||||
if @commission.commission_type_id == 1 or @commission.commission_type_id == 2 or @commission.commission_type_id == 3
|
||||
mail from: "no-reply@negos.pro", to: @commission.customer.email, :subject => "Vous avez reçu une commission sur Négos.com !" do |format|
|
||||
mail from: "contact@negos.pro", to: @commission.customer.email, :subject => "Vous avez reçu une commission sur Négos.com !" do |format|
|
||||
format.html { render layout: false }
|
||||
|
||||
|
||||
|
@ -2,5 +2,9 @@ class Wish < ActiveRecord::Base
|
||||
belongs_to :customer
|
||||
belongs_to :need
|
||||
|
||||
mount_uploader :devis
|
||||
|
||||
validates :devis, :presence => true
|
||||
validates :need, :presence => true
|
||||
validates :customer, :presence => true
|
||||
end
|
||||
|
21
app/uploaders/wish_devis_uploader.rb
Normal file
21
app/uploaders/wish_devis_uploader.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# encoding: utf-8
|
||||
|
||||
class WishDevisUploader < CarrierWave::Uploader::Base
|
||||
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
|
||||
def filename
|
||||
"devis.#{file.extension}" if original_filename.present?
|
||||
end
|
||||
|
||||
def store_dir
|
||||
"#{Rails.root}/private_medias/wishes/#{model.id}/devis/"
|
||||
end
|
||||
|
||||
def extension_white_list
|
||||
%w(pdf)
|
||||
end
|
||||
|
||||
|
||||
end
|
@ -14,6 +14,4 @@
|
||||
= f.input :note, :label => "Informations supplémentaires pour Négos", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||
|
||||
.actions
|
||||
-if @need.devis?
|
||||
= link_to ic(:download) + " Télécharger le devis attaché par l'émetteur", admin_need_download_devis_path(@need), class: "btn btn-default"
|
||||
= f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -13,10 +13,10 @@
|
||||
Administrateur
|
||||
%td
|
||||
Il y a #{time_ago_in_words( need.created_at)}
|
||||
%td
|
||||
-if need.devis?
|
||||
=link_to ic(:download) + " Offre/Devis", admin_need_download_devis_path(need), class: "btn btn-primary btn-sm"
|
||||
|
||||
%td{style: 'text-align:center' }
|
||||
=link_to i(:"hand-paper-o") + " " + need.wishes.length.to_s, admin_need_wishes_path(need)
|
||||
|
||||
=link_to i(:"comment-o") + " " + need.messages.length.to_s, admin_need_messages_path(need)
|
||||
%td.actions{:style => "width:150px;text-align:right"}
|
||||
-if(need.created?)
|
||||
= link_to i(:remove), refuse_admin_need_path(need), title: "Refuser", :data => {:confirm => 'Voulez-vous vraiment refuser ce besoin ?'}
|
||||
|
@ -24,8 +24,8 @@
|
||||
Émetteur
|
||||
%th
|
||||
Créé
|
||||
%th
|
||||
Dévis/Offre
|
||||
%th{style: 'text-align:center' }
|
||||
Commentaires/Intérêts
|
||||
%th{:style => "width:100px"}
|
||||
|
||||
|
||||
|
@ -4,5 +4,15 @@
|
||||
=link_to wish.customer.organisation, edit_admin_customer_path(wish.customer)
|
||||
%td
|
||||
=wish.created_at
|
||||
%td
|
||||
-if wish.devis?
|
||||
= link_to ic(:download) + " Télécharger devis", download_devis_admin_need_wish_path(wish.need, wish), class:"btn btn-primary btn-sm"
|
||||
-else
|
||||
Aucun devis
|
||||
%td
|
||||
-if wish.note?
|
||||
=wish.note
|
||||
-else
|
||||
Aucune note
|
||||
%td.actions{:style => "width:150px;text-align:right"}
|
||||
= link_to i(:"remove"), [:admin, @need, wish], :data => {:confirm => "Voulez-vous vraiment supprimer l'intérêt de cet utilisateur pour ce besoin ?"}, :method => :delete
|
||||
|
@ -9,6 +9,10 @@
|
||||
Utilisateur
|
||||
%th
|
||||
Intéressé le
|
||||
%th
|
||||
Devis
|
||||
%th
|
||||
Informations supplémentaires
|
||||
%th{:style => "width:100px"}
|
||||
|
||||
|
||||
|
@ -38,8 +38,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
%li= link_to "Clients", admin_customers_path
|
||||
- customers_to_validate = Customer.where('account_validated IS NULL ').count
|
||||
- if customers_to_validate > 0
|
||||
%li= link_to content_tag(:span,customers_to_validate , style:"background-color:#D9534F", class: 'badge') + " Clients", admin_customers_path
|
||||
-else
|
||||
%li= link_to "Clients", admin_customers_path
|
||||
- unvalidated_need_count = Need.where(state: 'created').count
|
||||
-if unvalidated_need_count > 0
|
||||
%li= link_to content_tag(:span,unvalidated_need_count , style:"background-color:#D9534F", class: 'badge') + " Besoins", admin_needs_path
|
||||
|
@ -57,3 +57,24 @@
|
||||
|
||||
|
||||
#flashs= bootstrap_flash
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#negos-video').magnificPopup({
|
||||
items: {
|
||||
src: 'http://www.youtube.com/watch?v=0uf7X-fcu1o'
|
||||
},
|
||||
type:'iframe',
|
||||
iframe: {
|
||||
markup: '<div class="mfp-iframe-scaler">'+'<div class="mfp-close"></div>'+'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+'</div>',
|
||||
patterns: {
|
||||
youtube: {
|
||||
index: 'youtube.com/',
|
||||
id: 'v=',
|
||||
src: '//www.youtube.com/embed/%id%?autoplay=1'
|
||||
}
|
||||
},
|
||||
srcAction: 'iframe_src',
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -2,7 +2,7 @@
|
||||
=#render :partial => "public/my_account/menu"
|
||||
|
||||
|
||||
-if !current_customer.enabled
|
||||
-if !current_customer.account_validated?
|
||||
.alert.alert-warning
|
||||
%h1 Vous devez valider votre adresse mail.
|
||||
%p Vous avez du recevoir un message pour valider votre adresse mail. Tant que vous n'aurez pas cliquer sur le lien présent sur ce mail votre compte ne sera pas activé.
|
||||
@ -73,7 +73,7 @@
|
||||
%p
|
||||
Remarque: Vous pouvez signaler/supprimer un intérêt pour un besoin uniquement quand celui-ci est en sondage.
|
||||
-if @wishes.length > 0
|
||||
=render "public/needs/wishes_index", wishes: @wishes
|
||||
=render "public/wishes/index", wishes: @wishes
|
||||
.pagination= paginate @wishes , param_name: 'page_wishes'
|
||||
-else
|
||||
%p
|
||||
|
8
app/views/public/needs/_edit_form.html.haml
Normal file
8
app/views/public/needs/_edit_form.html.haml
Normal file
@ -0,0 +1,8 @@
|
||||
= semantic_form_for [:public, @need] do |f|
|
||||
=f.inputs do
|
||||
= f.input :title, :label => "Titre de votre besoin"
|
||||
= f.input :category, :as => :select, include_blank: "Toute catégorie", :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}, label: "Catégorie de besoin"
|
||||
= f.input :description, :label => "Description", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||
|
||||
%br
|
||||
=f.submit "Sauvegarder", :class => "btn btn-primary"
|
@ -1,11 +1,9 @@
|
||||
= semantic_form_for [:public, @need] do |f|
|
||||
=f.inputs do
|
||||
= f.input :title, :label => "Titre de votre besoin"
|
||||
= f.input :devis, type: :file, :label => "Devis/Offre (Fichier au format PDF)"
|
||||
-if @need.devis?
|
||||
= link_to ic(:download) + " Télécharger le devis actuel", public_need_download_devis_path(@need), class: "btn btn-primary"
|
||||
= f.input :category, :as => :select, include_blank: "Toute catégorie", :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}, label: "Catégorie de besoin"
|
||||
= f.input :description, :label => "Description", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||
= f.input :devis, type: :file, :label => "Devis/Offre (Fichier au format PDF)"
|
||||
= f.input :note, :label => "Informations supplémentaires (visibles uniquement par les administrateurs Négos)", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||
|
||||
%br
|
||||
|
@ -51,10 +51,11 @@
|
||||
.item=i(:"comment-o") + " " + need.messages.length.to_s
|
||||
|
||||
-if(need.verified?)
|
||||
-if(need.customers.include?(current_customer))
|
||||
=link_to i(:"check") + " Intéressé", wish_public_need_path(need) , class: "btn btn-success pull-right"
|
||||
- @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"
|
||||
-else
|
||||
=link_to i(:"hand-paper-o") + " Ça m'intéresse", wish_public_need_path(need) , class: "btn 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"
|
||||
-elsif(need.negociating?)
|
||||
-if(need.customers.include?(current_customer))
|
||||
=link_to "Négociation en cours...", public_need_path(need), class: "btn btn-warning pull-right"
|
||||
|
@ -1,25 +0,0 @@
|
||||
-if(wish.verified?)
|
||||
-class_name="info"
|
||||
-elsif(wish.negociating?)
|
||||
-class_name="warning"
|
||||
-elsif(wish.negociated?)
|
||||
-class_name="success"
|
||||
-elsif(wish.failed?)
|
||||
-class_name="danger"
|
||||
|
||||
%tr{:id => wish.id, class: class_name}
|
||||
%td
|
||||
=link_to wish.title, public_need_path(wish)
|
||||
%td
|
||||
-if wish.category
|
||||
= i(:"tag") + " " + wish.category.name
|
||||
%td
|
||||
=wish.human_state
|
||||
%td{style: 'text-align:center' }
|
||||
=i(:"hand-paper-o") + " " + wish.wishes.length.to_s
|
||||
%td{style: 'text-align:center'}
|
||||
=i(:"comment-o") + " " + wish.messages.length.to_s
|
||||
%td.actions{:style => "width:150px;text-align:right"}
|
||||
=link_to i(:"eye"), public_need_path(wish),title:"Voir la ficher du besoin", class: 'btn btn-primary btn-square'
|
||||
-if wish.verified?
|
||||
=link_to i(:"remove"), wish_public_need_path(wish),title:"Je ne suis plus intéressé", class: 'btn btn-danger btn-square'
|
@ -1,4 +1,4 @@
|
||||
.center.padding.white
|
||||
%h2
|
||||
Modification d'un besoin existant
|
||||
=render :partial => "public/needs/form"
|
||||
=render :partial => "public/needs/edit_form"
|
||||
|
@ -94,10 +94,11 @@
|
||||
.item=i(:"hand-paper-o") + " Aucun utilisateur n'est intéressé par ce besoin"
|
||||
|
||||
-if @need.verified?
|
||||
-if(@need.customers.include?(current_customer))
|
||||
=link_to i(:"check") + " Intéressé", wish_public_need_path(@need) , :class => "btn btn-square btn-lg btn-success pull-right"
|
||||
- @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"
|
||||
-else
|
||||
=link_to i(:"hand-paper-o") + " Ça m'intéresse !", wish_public_need_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"
|
||||
-elsif @need.negociating?
|
||||
|
||||
-elsif @need.negociated?
|
||||
|
@ -3,8 +3,10 @@
|
||||
|
||||
-if current_customer
|
||||
%ul
|
||||
|
||||
%li=link_to ic(:star)+" Besoins", public_needs_path, :class => "btn"
|
||||
-if current_customer.account_validated?
|
||||
%li=link_to ic(:"youtube-play")+" Négos, comment ça marche ?","", :class => "btn", id:"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"
|
||||
|
18
app/views/public/wishes/_form.html.haml
Normal file
18
app/views/public/wishes/_form.html.haml
Normal file
@ -0,0 +1,18 @@
|
||||
= semantic_form_for [:public, @wish.need, @wish] do |f|
|
||||
=f.inputs do
|
||||
|
||||
-if @wish.devis?
|
||||
= link_to ic(:download) + " Voir votre devis actuel", download_devis_public_need_wish_path(@need, @wish), class: "btn btn-primary"
|
||||
%br
|
||||
%br
|
||||
-else
|
||||
= f.input :devis, type: :file, :label => "Devis de votre offre actuelle (Fichier au format PDF)"
|
||||
|
||||
= f.input :note, :label => "Informations supplémentaires (visibles uniquement par les administrateurs Négos)", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||
|
||||
%br
|
||||
|
||||
.div.pull-right
|
||||
=link_to ic(:"arrow-left") + " Revenir sur la page du besoin", public_need_path(@need),:class => "btn btn-default btn-square btn-lg "
|
||||
|
||||
=f.submit " Valider ma prise d'intérêt", :class => "btn btn-success btn-square btn-lg "
|
@ -1,3 +1,4 @@
|
||||
|
||||
%table.table.public-table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
@ -15,4 +16,5 @@
|
||||
|
||||
%tbody
|
||||
|
||||
=render partial: "public/needs/wish", collection: @wishes, as: :wish
|
||||
=render partial: "public/wishes/wish", collection: @wishes, as: :wish
|
||||
|
26
app/views/public/wishes/_wish.html.haml
Executable file
26
app/views/public/wishes/_wish.html.haml
Executable file
@ -0,0 +1,26 @@
|
||||
|
||||
-if(wish.need.verified?)
|
||||
-class_name="info"
|
||||
-elsif(wish.need.negociating?)
|
||||
-class_name="warning"
|
||||
-elsif(wish.need.negociated?)
|
||||
-class_name="success"
|
||||
-elsif(wish.need.failed?)
|
||||
-class_name="danger"
|
||||
|
||||
%tr{:id => wish.need.id, class: class_name}
|
||||
%td
|
||||
=link_to wish.need.title, public_need_path(wish.need)
|
||||
%td
|
||||
-if wish.need.category
|
||||
= i(:"tag") + " " + wish.need.category.name
|
||||
%td
|
||||
=wish.need.human_state
|
||||
%td{style: 'text-align:center' }
|
||||
=i(:"hand-paper-o") + " " + wish.need.wishes.length.to_s
|
||||
%td{style: 'text-align:center'}
|
||||
=i(:"comment-o") + " " + wish.need.messages.length.to_s
|
||||
%td.actions{:style => "width:150px;text-align:right"}
|
||||
=link_to i(:"eye"), public_need_path(wish.need),title:"Voir la fiche du besoin", class: 'btn btn-primary btn-square'
|
||||
-if wish.need.verified?
|
||||
=link_to i(:"edit"), edit_public_need_wish_path(wish.need, wish),title:"Modifier mon intérêt pour ce besoin", class: 'btn btn-primary btn-square'
|
17
app/views/public/wishes/edit.html.haml
Normal file
17
app/views/public/wishes/edit.html.haml
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
.center.padding.white
|
||||
|
||||
%h2
|
||||
Modifier ma prise d'intérêt pour le besoin
|
||||
=link_to @need.title, public_need_path(@need)
|
||||
.alert.alert-success
|
||||
%h2= ic(:check) + " Vous êtes intéressé par ce besoin"
|
||||
Vous êtes actuellement intéressé par ce besoin. Vous pouvez supprimer votre intérêt pour ce besoin en cliquant sur
|
||||
le bouton ci-dessous
|
||||
%br
|
||||
%br
|
||||
=link_to ic(:"remove") + " Je ne suis plus intéressé par ce besoin", public_need_wish_path(@need, @wish), class: "btn btn-danger", method: :delete
|
||||
|
||||
=render :partial => "public/wishes/form"
|
||||
|
||||
|
15
app/views/public/wishes/new.html.haml
Normal file
15
app/views/public/wishes/new.html.haml
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
.center.padding.white
|
||||
|
||||
%h2
|
||||
Je signal mon intérêt pour le besoin
|
||||
=link_to @need.title, public_need_path(@need)
|
||||
.alert.alert-info
|
||||
%h2 Joindre mon devis
|
||||
%p Si vous êtes intéressé par ce besoin, faites nous part de votre offre actuelle en nous fournissant un devis.
|
||||
%p
|
||||
Une fois ce formulaire validé, vous pourrez si besoin revenir sur cette page depuis l'onglet
|
||||
%strong Mon Compte
|
||||
pour faire des modifications.
|
||||
|
||||
=render :partial => "public/wishes/form"
|
@ -105,6 +105,11 @@ Rails.application.routes.draw do
|
||||
resources :needs do
|
||||
get :download_devis
|
||||
resources :messages
|
||||
resources :wishes do
|
||||
member do
|
||||
get :download_devis
|
||||
end
|
||||
end
|
||||
resources :offers do
|
||||
member do
|
||||
get :accept
|
||||
@ -268,7 +273,11 @@ Rails.application.routes.draw do
|
||||
resources :needs do
|
||||
get :download_devis
|
||||
resources :messages
|
||||
resources :wishes
|
||||
resources :wishes do
|
||||
member do
|
||||
get :download_devis
|
||||
end
|
||||
end
|
||||
resources :offers do
|
||||
|
||||
end
|
||||
|
6
db/migrate/20160318165409_add_devis_and_note_to_wish.rb
Normal file
6
db/migrate/20160318165409_add_devis_and_note_to_wish.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AddDevisAndNoteToWish < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :wishes, :note, :text
|
||||
add_column :wishes, :devis, :string
|
||||
end
|
||||
end
|
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160317170901) do
|
||||
ActiveRecord::Schema.define(version: 20160318165409) do
|
||||
|
||||
create_table "accepted_offers", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
@ -567,8 +567,10 @@ ActiveRecord::Schema.define(version: 20160317170901) do
|
||||
create_table "wishes", force: :cascade do |t|
|
||||
t.integer "customer_id", limit: 4
|
||||
t.integer "need_id", limit: 4
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.text "note", limit: 65535
|
||||
t.string "devis", limit: 255
|
||||
end
|
||||
|
||||
add_foreign_key "customer_newsgroups", "customers"
|
||||
|
BIN
public/uploads/devis-16.pdf
Normal file
BIN
public/uploads/devis-16.pdf
Normal file
Binary file not shown.
BIN
public/uploads/devis-16__1_.pdf
Normal file
BIN
public/uploads/devis-16__1_.pdf
Normal file
Binary file not shown.
BIN
public/uploads/devis-16__2_.pdf
Normal file
BIN
public/uploads/devis-16__2_.pdf
Normal file
Binary file not shown.
BIN
public/uploads/devis-16__3_.pdf
Normal file
BIN
public/uploads/devis-16__3_.pdf
Normal file
Binary file not shown.
BIN
public/uploads/devis.pdf
Normal file
BIN
public/uploads/devis.pdf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user