Need management from admin panel + customer mailing + admin mailing

This commit is contained in:
Nicolas VARROT 2015-12-01 19:07:09 +01:00
parent a867e95951
commit 388d8d5cb6
27 changed files with 617 additions and 391 deletions

View File

@ -42,6 +42,7 @@ group :development, :test do
gem 'web-console', '~> 2.0'
gem 'spring'
end
@ -60,7 +61,6 @@ gem 'acts_as_commentable'
gem 'gravatar_image_tag'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
@ -68,3 +68,5 @@ gem 'wkhtmltopdf-binary'
gem "geocoder"
gem "paranoia", "~> 2.0"
gem 'workflow', '~> 1.2.0'

View File

@ -215,6 +215,7 @@ GEM
wicked_pdf (0.11.0)
rails
wkhtmltopdf-binary (0.9.9.3)
workflow (1.2.0)
PLATFORMS
ruby
@ -251,6 +252,7 @@ DEPENDENCIES
web-console (~> 2.0)
wicked_pdf
wkhtmltopdf-binary
workflow (~> 1.2.0)
BUNDLED WITH
1.10.6

View File

@ -16,32 +16,39 @@
.next,.prev, .page{
display:inline-block;
padding:5px 10px;
margin-right:5px;
font-size:18px;
color:white;
a{
color:black;
}
}
.current{
background:#FE9944;
}
}
.customer_table{
td, th{
vertical-align:middle !important;
}
}
.admin_table{
td, th{
vertical-align:middle !important;
}
}
#admin_nav{
border-radius:0px;
@ -65,26 +72,26 @@ max-width:100%;
html {
height: 100%;
width: 100%;
}
body {
height: 100%;
width: 100%;
}
#tags .tag_label{
i{ display:none;}
&.active{
background:rgba(0,136,204,1);
color:white;
i{ display:inline;}
}
}
@ -97,13 +104,13 @@ display:none;
margin-bottom:5px;
}
.map_content_map img {
.map_content_map img {
max-width: none;
}
#mapCanvas label {
width: auto; display:inline;
}
#mapCanvas label {
width: auto; display:inline;
}
body.admin{
@ -141,7 +148,7 @@ text-decoration:none;
}
#upload_details{
display:none;
.content{
@ -151,9 +158,9 @@ text-decoration:none;
right:0px;
bottom:0px;
overflow:auto;
}
height:400px;
width:800px;
position:absolute;
@ -169,9 +176,9 @@ text-decoration:none;
*border-bottom-width: 2px;
//.border-radius(6px);
//.box-shadow(0 5px 10px rgba(0,0,0,.2));
}
#upload_details::before {
@ -188,21 +195,21 @@ text-decoration:none;
border-bottom: 0;
bottom: -7px;
}
#upload_details::after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
position: absolute;
right: 216px;
@ -213,8 +220,8 @@ text-decoration:none;
}
#toolbar-text{
position:fixed;
z-index:2;
@ -222,10 +229,10 @@ text-decoration:none;
top:52px;
left:0px;
right:330px;
}
#flashs{
position:fixed;
bottom:0px;
@ -236,7 +243,7 @@ text-decoration:none;
z-index:3;
}
form .clearfix:before, form .clearfix:after {
display: inline;
@ -244,11 +251,11 @@ text-decoration:none;
.error{
color:red;
input{
border-color:red;
}
*{
color:red;
}
@ -274,10 +281,10 @@ text-decoration:none;
}
.placeholder{
background:rgba(143,202,70,0.8);
height:10px;
@ -292,7 +299,7 @@ text-decoration:none;
.placeholder{
height:0px;
}
&.active{
background:rgba(143,202,70,0.8);
@ -312,14 +319,14 @@ text-decoration:none;
text-align:right;
}
}
.receptable{
position:relative;
.placeholder{
position:absolute;
top:0px;
@ -332,21 +339,21 @@ text-decoration:none;
}
}
#menu_item_informations{
form{
.preview{
img{
height:50px;
}
}
}
position:fixed;
z-index:3;
overflow:auto;
@ -363,48 +370,48 @@ text-decoration:none;
height:91px;
margin:0px;
}
}
.block_portlets{
min-height:50px;
border:1px dotted rgba(227,227,227,1);
}
.block_portlets_sortable{
border:0px;
}
#menu_item_inspector_container{
.panel{
border-radius:0px;
border-left:0px;
border-right:0px;
}
.accordion{
height:auto;
}
.accordion-group{
border:0px;
border-radius:0px;
}
.accordion-body{
background:white;
}
.accordion-heading{
border-radius:0px;
@ -415,70 +422,70 @@ text-decoration:none;
a{
padding:10px 20px;
color:white;
&:hover{
text-decoration:none;
}
}
}
.inspector_handle{
height:10px;
width:100%;
background:black;
cursor:pointer;
}
.content_type{
display:inline-block;
img{height:50px;cursor:pointer;}
}
}
.btn-toolbar{
display:none;
top:-35px;
}
#column_sliders{
position:relative;
.slider{
position:absolute;
top:0px;
left:0px;
width:100%;
}
.slider-selection{
display:none !important;
}
.slider:not(:first-child){
.slider-track{
background:transparent;
box-shadow:transparent 0px 0px 0px;
}
}
.slider-handle{
z-index:100;
}
}
.html_content_form{
#ace_editor_pre{
@ -487,12 +494,12 @@ text-decoration:none;
height:400px;
background:white;
border:1px solid #353535;
}
&.large{
position:fixed;
@ -502,8 +509,8 @@ text-decoration:none;
right:0px;
background:white;
z-index:2000 !important;
#ace_editor_pre{
position:absolute;
top:10px;
@ -512,29 +519,29 @@ text-decoration:none;
right:10px;
width:inherit;
height:inherit;
}
.action{
position:absolute;
bottom:15px;
right:5px;
}
}
}
.image_square{
display:inline-block;
@ -544,7 +551,7 @@ text-decoration:none;
border : 1px solid rgb(230,230,230);
background:white;
.actions{
display:none;
position:absolute;
@ -562,9 +569,9 @@ text-decoration:none;
background-repeat:no-repeat;
background-size: contain;
}
.image_square:hover .actions{
@ -574,41 +581,41 @@ text-decoration:none;
margin:0px;
}
.image_square:hover .actions:hover{
opacity:1;
}
}
.event_date_form{
background:rgba(143,193,46,0.9);
margin:0px -10px 20px -10px;
padding:10px;
color:black;
p{
line-height:35px;
}
label{
display:inline;
}
}
.field_with_suppr{
display:inline-block;
position:relative;
.suppr{
display:block;
@ -620,7 +627,7 @@ text-decoration:none;
}
}
}
.periodes_form .field, .jockers_form .field{
@ -641,10 +648,10 @@ margin:0.5em;
@media print {
.visible-print { display: inherit !important; }
.hidden-print { display: none !important; }
}
.portlet_placeholder{
@ -734,10 +741,10 @@ min-height:50px;
padding:10px 12px;
}
.portlet_handle{
width:35%;
.cancel_message{
display:none;
}
@ -748,10 +755,10 @@ min-height:50px;
.save{
width:45%;
}
}
}
@ -864,8 +871,8 @@ height:auto !important;
border:50%;
margin-left:1em;
width:1em;
}
@ -883,7 +890,7 @@ height:auto !important;
position:relative;
background:black;
margin-bottom:5px;
.link{
background:rgba(250,250,250,0.5);
text-align:center;
@ -892,18 +899,18 @@ height:auto !important;
bottom:0;
left:0;
right:50%;
opacity:0;
&:hover{
opacity:1;
}
}
.invalid{
a{
@ -911,9 +918,9 @@ height:auto !important;
padding:5px;
&:hover{
background:rgba(250,250,250,0.8)
}
}
}
.valid{
@ -922,11 +929,11 @@ height:auto !important;
padding-top:80px;
font-size:70px;
}
}
a:last-child{
right:0;
left:50%;
}
@ -935,29 +942,29 @@ height:auto !important;
h1{
font-size:2em;
}
h2{
font-size:1.5em;
}
h3{
font-size:1.2em;
}
#customer_rows .danger{
background:rgba(242,222,222,1) !important;
td{
background:rgba(242,222,222,1) !important;
}
}
}

View File

@ -17,35 +17,35 @@
#main{
position:relative;
}
.top{
//margin-bottom:10px;
position:relative;
background:rgba(2,43,71,1) ;
background:rgba(2,43,71,1) ;
background-size:100%;
background-size:cover;
#menu{
a{
color:white;
}
.btn-primary{
color:white;
}
background:white;
}
}
.top_home{
@ -56,30 +56,30 @@ position:relative;
position:relative;
#search_form{
margin-top:40px;
}
#specific_search{
color:white;
background:rgba(0,0,0,0.5);
.inner{
padding:10px;
}
}
h1, h2{
text-align:center;
color:white;
width:100%;
padding:0;
margin:0;
}
h1{
font-size:2.3em;
margin-top:400px;
@ -89,13 +89,13 @@ position:relative;
h2{
font-size:1.4em;
img{
width:60px;
display:block;
margin:1em auto;
}
}
}
@ -103,23 +103,23 @@ position:relative;
#menu{
background:rgba(0,0,0,0) !important;
width:100%;
z-index:10;
-webkit-transition: background-color 1000ms linear;
-moz-transition: background-color 1000ms linear;
-o-transition: background-color 1000ms linear;
-ms-transition: background-color 1000ms linear;
transition: background-color 1000ms linear;
a{
color:white;
}
ul{
margin:0;
padding:2px 10px;
@ -130,18 +130,18 @@ position:relative;
display:inline;
display:inline-block;
padding:8px 0px;
}
}
}
.public-table{
td, th{
vertical-align:middle !important;
}
}
.bottom{
background:#323232;
@ -151,44 +151,44 @@ position:relative;
text-align:left;
#nb{
position:absolute;
right:20px;
height:25px;
bottom:20px;
opacity:0.4;
&:hover{
opacity:1;
}
}
ul{
margin-left:0;
list-style:none;
padding:0;
li{
}
}
a,h4{
font-weight:normal;
color:rgb(255, 255, 255);
}
a{
display:block;
padding: .2em 0 0.6em;
}
h4{
padding: .5em 0;
border-bottom: 1px solid #656565;
}
}
.page{
@ -196,20 +196,20 @@ position:relative;
table{
margin:1em auto;
tr:nth-child(even) {
background:rgba(210,222,237,1);
}
td{
padding:5px;
border:1px solid rgba(77,128,186,1);
}
}
}
@ -224,14 +224,14 @@ position:relative;
}
h1{
font-size:45px;
}
h2{
font-size:32px;
}
padding:2em 10px;
}
.annonce_message_li{
@ -242,23 +242,23 @@ position:relative;
border-color:transparent;
.time{
color:white;
}
}
display:block;
text-align:left;
padding:10px 10px;
color:#454340;
img{
float:left;
border-radius:50%;
height:60px;
margin-right:5px;
}
.new{
display:inline-block;
width:10px;
height:10px;
@ -266,27 +266,27 @@ position:relative;
border-radius:50%;
}
.pseudo{
font-weight:bold;
margin-bottom:10px;
}
.time{
font-size:0.8;
color:rgba(120,118,115,1);
float:right;
margin-left:10px;
}
border-radius:0;
border-bottom:1px solid gray;
}
.annonce_message_show{
background:white;min-height:600px;
padding-top:10px;
padding-bottom:10px;
.message_annonce{
color:white;
background:#4F81B8;
@ -294,18 +294,18 @@ position:relative;
margin-bottom:10px;
a{
color:white;
}
}
}
.am{
.badge{
background:#3677AF;
}
}
#categories{
@ -314,7 +314,7 @@ position:relative;
h2{
font-size:1.2em;
font-weight:normal;
}
h3{
font-size:1.1em;
@ -322,7 +322,7 @@ position:relative;
border-bottom:1px solid #DBDBDB;
padding-bottom:10px;
}
ul{
list-style:none;
padding:0;
@ -334,18 +334,18 @@ position:relative;
color:#525252;
}
}
}
}
.customer_dashboard{
.panel{
min-height:260px;
}
}
#annonce_menu{
@ -364,41 +364,41 @@ position:relative;
margin-bottom:5px;
}
.active{
color:orange ;
a{
color:orange;
}
.menu_icon{
background:orange;
color:white;
}
}
.ok{
color:green;
a{
color:green;
}
.menu_icon{
background:green;
color:white;
}
}
}
.next_step{
padding:20px 10px;
text-align:center;
margin-bottom:50px;
@ -417,11 +417,11 @@ position:relative;
border: 1px solid #e5e5e5;
border-radius: 5px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
#new_customer_form_container{
h1{
text-align:center;
}
@ -434,14 +434,14 @@ position:relative;
border: 1px solid #e5e5e5;
border-radius: 5px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.fav{
padding:5px;
&.active, &:hover{
color:#ffcc17;
}
color:#dddddd;
font-size:18px;
@ -452,14 +452,14 @@ position:relative;
padding:20px;
background:white;
margin-bottom:20px;
tr:nth-child(odd){
background:#F7F9FA;
}
td{
border:0 !important;
}
}
@ -491,23 +491,23 @@ height: 100%;
text-align:center;
}
th{
background:rgba(220,240,248,1);
font-weight:normal;
}
.header_tr{
th{
color:white;
background:rgba(58,59,86,1) !important;
}
}
.orange{
background:#c8de84;
//color:black;
}
}
@ -527,24 +527,24 @@ height: 100%;
@media screen and (max-width:740px) {
#annonce{
#corps, #infos{
width:auto;
float:none;
}
#infos{
padding:10px;
}
}
#default_image{
height:300px;
border-radius:0;
}
@ -565,20 +565,20 @@ height: 100%;
padding-left:20px;
}
.fav{
float:none;
position:static;
display:inline;
cursor:pointer;
}
}
}
#menu{
#menu{
text-align:center;
.add_annonce{
display:block;
.btn{
@ -589,20 +589,20 @@ height: 100%;
}
}
ul{
float:none;
}
}
#search_form{ #general_search{
#search_form{ #general_search{
display:block;
.place_search{
float:none;
}
#q, #place, #annonce_cat_id{
@ -613,9 +613,9 @@ height: 100%;
border-radius:8px;
margin:5px auto;
}
#search_button{
float:none;
width:200px;
display:block;
@ -646,6 +646,5 @@ height: 100%;
margin:20px auto;
display:block;
height:200px;
}
}

View File

@ -0,0 +1,56 @@
class Admin::NeedsController < ApplicationController
layout "admin"
def index
@needs_to_validate = Need.where(state: 'created').order(created_at: :desc)
end
def edit
@need = Need.find(params[:id])
end
def update
@need = Need.find(params[:id])
if @need.update_attributes(need_params)
flash[:notice] = "Besoin sauvegardé avec succès."
redirect_to admin_needs_path
else
render :action => "edit"
end
end
def destroy
@need = Need.find(params[:id])
if(@need.destroy)
flash[:notice] = "Besoin supprimé avec succès."
end
redirect_to admin_needs_path
end
def validate
@need = Need.find(params[:id])
if @need.validate!
flash[:notice] = "Besoin validé avec succès"
CustomerMailer.validate_need(@need).deliver
else
flash[:error] = "L'état actuel de ce besoin ne permet sa validation"
end
redirect_to admin_needs_path
end
def refuse
@need = Need.find(params[:id])
if @need.refuse!
flash[:notice] = "Besoin refusé avec succès"
CustomerMailer.refuse_need(@need).deliver
else
flash[:error] = "L'état actuel de ce besoin ne permet son refus"
end
redirect_to admin_needs_path
end
def need_params
params.require(:need).permit(:title, :description)
end
end

View File

@ -2,52 +2,51 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def auth_customer
session[:devise_id] = params[:d] if params[:d]
session[:devise_id] = params[:d] if params[:d]
if !current_customer
session[:before_auth_url] = request.url
session[:before_auth_url] = request.url
redirect_to new_public_customers_auth_path(:p => params[:p], :for_annonce => (true if params[:controller] == "public/annonces"))
end
end
private
def auth_admin
if !current_admin
redirect_to new_admin_admin_auth_path
end
end
private
def current_admin
if cookies[:admin_remember_token]
if @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
@current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
if @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
@current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
else
cookies[:admin_remember_token] =nil
end
end
end
def current_customer
if cookies[:customer_auth_token] and Customer.exists?(:token => cookies[:customer_auth_token])
a_c = Customer.find_by_token(cookies[:customer_auth_token])
@ -55,21 +54,20 @@ class ApplicationController < ActionController::Base
@current_customer = a_c
else
cookies[:customer_auth_token] = nil
nil
end
else
nil
end
end
helper_method :current_admin, :current_customer
end
end

View File

@ -5,7 +5,9 @@ class Public::MyAccountController < ApplicationController
before_filter :auth_customer
def index
@needs = Kaminari.paginate_array(current_customer.needs).page(params[:page]).per(2)
@needs = Kaminari.paginate_array(current_customer.needs.order(created_at: :desc))
.page(params[:page])
.per(5)
end

View File

@ -35,6 +35,12 @@ class Public::NeedsController < ApplicationController
@need.author = current_customer
if @need.save
flash[:notice] = "Votre besoin à été créé avec succès."
# Find all admins with emails
admins = Admin.where.not(email: nil)
admins.each do |admin|
AdminMailer.new_need(admin, @need).deliver
end
redirect_to public_my_account_path
else
render :action => "new"

View File

@ -1,6 +1,13 @@
class AdminMailer < ActionMailer::Base
class AdminMailer < ApplicationMailer
layout "mail"
def password_reset(admin)
@admin = admin
mail :to => admin.email, :subject => "Reinitialisation du mot de passe.", :from => "info@nicolasbally.com"
end
end
def new_need(admin, need)
@need = need
mail to: admin.email, subject: "Nouvelle proposition de besoin"
end
end

View File

@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
default from: "\"Négos\" <contact@negos-pro.fr>"
layout 'mailer'
end

View File

@ -8,46 +8,55 @@ class CustomerMailer < ApplicationMailer
def confirm(customer)
@customer = customer
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Important : Activation de votre compte Négos"
mail to: customer.email, :subject => "Important : Activation de votre compte Négos"
end
def validate_account(customer)
@customer = customer
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Important : Validation de votre compte Négos"
mail to: customer.email, :subject => "Important : Validation de votre compte Négos"
end
def confirm_ins(customer)
@customer = customer
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Confirmation dinscription"
mail to: customer.email, :subject => "Confirmation dinscription"
end
def validate_ins(customer)
@customer = customer
mail from: "contact@negos-pro.fr", to: customer.email, :subject => "Bienvenue chez NEGOS"
mail to: customer.email, :subject => "Bienvenue chez NEGOS"
end
def notify_ins(customer)
@customer = customer
mail from: "contact@negos-pro.fr", to: "daniel@videlier.fr", bcc: "info@nicolasbally.com", :subject => "Nouveau compte client sur Negos"
mail to: "daniel@videlier.fr", bcc: "info@nicolasbally.com", :subject => "Nouveau compte client sur Negos"
end
def validate_need(need)
@need = need
@customer = need.author
mail to: @customer.email, :subject => "Proposition de besoin validée"
end
def refuse_need(need)
@need = need
@customer = need.author
mail to: @customer.email, :subject => "Proposition de besoin refusée"
end
def new_user(customer)
@customer = customer
@parent = @customer.parent
if @parent
#mail from: "no-reply@negos.pro", to: @parent.email, :subject => "Vous avez un nouvel affilié sur Negos.pro !" do |format|
# format.html { render layout: false }
#end
end
end
@ -56,29 +65,29 @@ class CustomerMailer < ApplicationMailer
#
# en.customer.reset_password.subject
#
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é"
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>"
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|
format.html { render layout: false }
end
end
end
end

View File

@ -1,15 +1,51 @@
class Need < ActiveRecord::Base
include Workflow
workflow_column :state
max_paginates_per 10
validates :title, :presence => true,
:length => {:within => 4..128}
validates :description, :presence => true, length: {maximum: 65535}
belongs_to :author, class_name: 'Customer'
acts_as_paranoid
validates :title, :presence => true, length: {within: 4..128}
validates :description, presence: true, length: {maximum: 65535}
belongs_to :author, class_name: 'Customer'
# Need's workflow lifecycle
workflow do
state :created do
event :validate, :transitions_to => :verified
event :refuse, :transitions_to => :refused
end
state :refused
state :verified do
event :negociate, :transitions_to => :negociating
end
state :negociating do
event :accept, :transitions_to => :negociated
event :reject, :transitions_to => :failed
end
state :negociated
state :failed
end
# Human state conversion
def human_state
case state
when 'created'
"En attente de validation"
when 'verified'
"Validé"
when 'refused'
"Refusé"
when 'negociating'
"En cours de negociation"
when 'negociated'
"Négociation effecutée"
when 'failed'
"Négociation échouée"
else
"Inconnu"
end
end
end

View File

@ -0,0 +1,9 @@
=semantic_form_for [:admin, @need] do |f|
.content
=f.inputs do
=f.input :title, :label => "Titre : "
=f.input :description, :label => "Description : ", :rows => 5, :input_html => {:style => "height:100px;"}
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"

View File

@ -0,0 +1,13 @@
%tr{:id => need.id}
%td
=need.title
%td
=link_to need.author.organisation, edit_admin_customer_path(need.author)
%td
Il y a #{time_ago_in_words( need.created_at)}
%td.actions{:style => "width:150px;text-align:right"}
= link_to i(:"trash-o"), [:admin, need], :data => {:confirm => 'Voulez-vous vraiment supprimer ce besoin ?'}, :method => :delete
= link_to i(:pencil), edit_admin_need_path(need)
= link_to i(:remove), refuse_admin_need_path(need), title: "Refuser", :data => {:confirm => 'Voulez-vous vraiment refuser ce besoin ?'}
= link_to i(:check), validate_admin_need_path(need), title: "Valider", :data => {:confirm => 'Voulez-vous vraiment valider ce besoin ?'}

View File

@ -0,0 +1,2 @@
%h1 Modifier un besoin
=render :partial => "form"

View File

@ -0,0 +1,22 @@
%h1 Gestion des besoins
-if @needs_to_validate.length > 0
%h2 #{pluralize(@needs_to_validate.length, 'besoin')} à contrôler
%table.table.admin_table.table-hover.table-striped
%thead.rows_header
%tr
%td
Titre
%td
Émetteur
%td
Créé
%td{:style => "width:100px"}
&nbsp;
%tbody.rows
=render @needs_to_validate

View File

@ -0,0 +1,23 @@
%p Bonjour,
%p
Une proposition de besoin vient d'être ajoutée par le client
%strong= @need.author.organisation.to_s
%p
Vous pouvez vous rendre dans la rubrique
=link_to "Gestion des besoins", admin_needs_path
afin de valider ou refuser cette proposition.
%p
Voici quelques informations sur le besoin
%p
%strong Titre :
%br
=@need.title
%p
%strong Description :
%br
=@need.description

View File

@ -0,0 +1,5 @@
%p Bonjour,
%p Nous avons le regret de vous annoncer que votre proposition de besoin "#{@need.title.to_s}" vient d'être refusée.
%p Celle-ci ne respectait pas la charte imposée par notre service.

View File

@ -0,0 +1,7 @@
%p Bonjour,
%p Nous avons le plaisir de vous annoncer que votre proposition de besoin "#{@need.title.to_s}" vient d'être validée.
%p Les autres utilisateurs vont dès à présent pouvoir montrer leurs intérêts pour ce nouveau besoin.
%p Merci !

View File

@ -9,66 +9,67 @@
= stylesheet_link_tag :admin, :media => :all
= javascript_include_tag "admin"
=javascript_include_tag "https://maps.google.com/maps/api/js?sensor=false&region=FR"
%body.admin
%nav#admin_nav.navbar.navbar-default.navbar-inverse{role: "navigation"}
.container-fluid
.navbar-header
%button.navbar-toggle{"data-target" => "#bs-example-navbar-collapse-1", "data-toggle" => "collapse", type: "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand{href: "/admin"}
%a.navbar-brand{href: "/admin"}
=ic :home
#bs-example-navbar-collapse-1.collapse.navbar-collapse
%ul.nav.navbar-nav
%li= link_to "Comptes utilisateurs", 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 , class: 'badge') + " Gestion des besoins", admin_needs_path
-else
%li= link_to " Gestion des besoins", admin_needs_path
%ul.nav.navbar-nav.navbar-right
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
=current_admin.firstname
=current_admin.name
%b.caret
%ul.dropdown-menu
%li= link_to "Gestion des admins", admin_admins_path
%li.divider
%li=link_to "Se déconnecter", logout_admin_admin_auths_path
.container-fluid
= yield
#flashs= bootstrap_flash

View File

@ -48,13 +48,20 @@
.padding.center.white
%h3
Mes besoins
Mes propositions de besoin
%div.alert.alert-info
%p
Si vous avez un besoin qui ne fait pas encore parti de notre liste, vous pouvez vous-même le proposer à Négos.
%br
Votre proposition sera alors soumise à une courte validation par l'un de nos modérateurs.
%br
Vous serez informer par courriel dès l'acceptation de votre proposition.
-if @needs.length > 0
=render "public/needs/index", needs: @needs
-else
%p
Vous n'avez pas encore créé de besoin
=link_to "Déclarer un besoin", new_public_need_path, :class => "btn btn-primary"
Vous n'avez pas encore proposer de besoin
=link_to "Proposer un besoin", new_public_need_path, :class => "btn btn-primary"
.padding.center.white
%h3
Ma liste de souhait

View File

@ -1,6 +1,5 @@
%table.table.table-striped
%table.table.public-table.table-striped
%thead
%tr
%th
Titre du besoin
@ -10,7 +9,6 @@
Souhaité par
%th{:style => "width:100px"}
&nbsp;
%tbody
=render @needs

View File

@ -1,10 +1,13 @@
%tr{:id => need.id}
-css_class = 'danger' if need.refused?
%tr{:id => need.id, class: css_class}
%td
=need.title
%td
=need.human_state
%td
%td.actions{:style => "width:150px;text-align:right"}
= link_to i(:"trash-o btn btn-default"), [:public, need], :data => {:confirm => 'Voulez-vous vraiment supprimer ce besoin ?'}, method: :delete
-if need.created? or need.refused?
= link_to i(:"trash-o btn btn-default"), [:public, need], :data => {:confirm => 'Voulez-vous vraiment supprimer ce besoin ?'}, method: :delete
= link_to i(:"pencil btn btn-primary"), edit_public_need_path(need)

View File

@ -38,9 +38,11 @@ Rails.application.configure do
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :file
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
config.action_mailer.default_url_options = { host: 'rails-144740.nitrousapp.com', port: 3000}
HOSTNAME="localhost:3000"
end

View File

@ -235,12 +235,16 @@ Rails.application.routes.draw do
end
end
resources :needs do
member do
get :validate
get :refuse
end
end
resources :customers do
member do
get :validate
end
end
resources :categories do

View File

@ -0,0 +1,5 @@
class AddStateFieldToNeeds < ActiveRecord::Migration
def change
add_column :needs, :state, :string
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: 20151130173626) do
ActiveRecord::Schema.define(version: 20151201090113) do
create_table "admins", force: :cascade do |t|
t.string "name", limit: 255
@ -389,6 +389,7 @@ ActiveRecord::Schema.define(version: 20151130173626) do
t.datetime "updated_at", null: false
t.integer "author_id", limit: 4
t.datetime "deleted_at"
t.string "state", limit: 255
end
add_index "needs", ["author_id"], name: "index_needs_on_author_id", using: :btree