State & offers displayed in public part
This commit is contained in:
parent
d6427259f8
commit
95b1c8b319
@ -55,6 +55,29 @@
|
|||||||
color:rgb(163, 159, 159);
|
color:rgb(163, 159, 159);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.state{
|
||||||
|
position:absolute;
|
||||||
|
top:0px;
|
||||||
|
right:0px;
|
||||||
|
color:white;
|
||||||
|
padding:4px;
|
||||||
|
padding-left:8px;
|
||||||
|
padding-right:8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.state-success{
|
||||||
|
background-color:#5cb85c;
|
||||||
|
}
|
||||||
|
.state-danger{
|
||||||
|
background-color:#d9534f;
|
||||||
|
}
|
||||||
|
.state-info{
|
||||||
|
background-color:#428bca;
|
||||||
|
}
|
||||||
|
.state-warning{
|
||||||
|
background-color:#f0ad4e;
|
||||||
|
}
|
||||||
|
|
||||||
.counters{
|
.counters{
|
||||||
position:absolute;
|
position:absolute;
|
||||||
left:0px;
|
left:0px;
|
||||||
@ -85,7 +108,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
margin-bottom:50px;
|
margin-bottom:30px;
|
||||||
|
|
||||||
h4{
|
h4{
|
||||||
margin-top:0px;
|
margin-top:0px;
|
||||||
margin-bottom:0px;
|
margin-bottom:0px;
|
||||||
|
@ -26,6 +26,10 @@ class Public::NeedsController < ApplicationController
|
|||||||
@needs = @needs.where(category_id: ids)
|
@needs = @needs.where(category_id: ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if(params[:s] and params[:s] != '')
|
||||||
|
@needs = @needs.where(state: params[:s])
|
||||||
|
end
|
||||||
|
|
||||||
# Include order in the query
|
# Include order in the query
|
||||||
case params[:o]
|
case params[:o]
|
||||||
when 'alpha-asc'
|
when 'alpha-asc'
|
||||||
|
@ -106,7 +106,7 @@ class Need < ActiveRecord::Base
|
|||||||
when 'created'
|
when 'created'
|
||||||
"En attente de validation"
|
"En attente de validation"
|
||||||
when 'verified'
|
when 'verified'
|
||||||
"Validé"
|
"En sondage"
|
||||||
when 'refused'
|
when 'refused'
|
||||||
"Refusé"
|
"Refusé"
|
||||||
when 'negociating'
|
when 'negociating'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-css_class = 'warning' if need.created?
|
-css_class = 'warning' if need.created?
|
||||||
-css_class = 'danger' if need.refused?
|
-css_class = 'danger' if need.refused?
|
||||||
-css_class = 'success' if need.verified?
|
-css_class = 'success' if need.verified? or need.negociated? or need.negociating? or need.failed?
|
||||||
-state = 'Validé' if need.verified? or need.negociated? or need.negociating? or need.failed?
|
-state = 'Validé' if need.verified? or need.negociated? or need.negociating? or need.failed?
|
||||||
-state = 'En attente de validation' if need.created?
|
-state = 'En attente de validation' if need.created?
|
||||||
-state = 'Refusée' if need.refused?
|
-state = 'Refusée' if need.refused?
|
||||||
|
@ -4,15 +4,36 @@
|
|||||||
%h4
|
%h4
|
||||||
=link_to need.title.upcase, public_need_path(need)
|
=link_to need.title.upcase, public_need_path(need)
|
||||||
|
|
||||||
-if need.author
|
-# -if need.author
|
||||||
%p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)} par #{need.author.anonyme_nick}"
|
-# %p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)} par #{need.author.anonyme_nick}"
|
||||||
-else
|
-# -else
|
||||||
%p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)}"
|
-# %p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)}"
|
||||||
|
|
||||||
|
.top-left-info
|
||||||
-if need.category
|
-if need.category
|
||||||
.top-left-info
|
|
||||||
=i(:"tag") + " " + need.category_path
|
=i(:"tag") + " " + need.category_path
|
||||||
|
-else
|
||||||
|
Non catégorisé
|
||||||
|
-if need.verified?
|
||||||
|
%span.state.state-info.pull-right
|
||||||
|
=need.human_state
|
||||||
|
-elsif need.negociating?
|
||||||
|
%span.state.state-warning.pull-right
|
||||||
|
=need.human_state
|
||||||
|
-elsif need.failed?
|
||||||
|
%span.state.state-danger.pull-right
|
||||||
|
=need.human_state
|
||||||
|
-elsif need.negociated?
|
||||||
|
%span.state.state-success.pull-right
|
||||||
|
-offers = need.offers.order(price: :asc)
|
||||||
|
-if offers.size > 1
|
||||||
|
Négocié à partir de
|
||||||
|
%strong="#{number_to_currency(offers.first.price, locale: :fr)}"
|
||||||
|
-elsif offers.size == 1
|
||||||
|
Négocié à
|
||||||
|
%strong="#{number_to_currency(offers.first.price, locale: :fr)}"
|
||||||
|
-else
|
||||||
|
Négocié
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -24,9 +45,14 @@
|
|||||||
.item=i(:"hand-paper-o") + " " + need.wishes.length.to_s
|
.item=i(:"hand-paper-o") + " " + need.wishes.length.to_s
|
||||||
.item=i(:"comment-o") + " " + need.messages.length.to_s
|
.item=i(:"comment-o") + " " + need.messages.length.to_s
|
||||||
|
|
||||||
-if(need.customers.include?(current_customer))
|
|
||||||
=link_to i(:"check") + " Intéressé", wish_public_need_path(need) , :class => "btn 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"
|
|
||||||
|
|
||||||
.clear
|
-if(need.customers.include?(current_customer))
|
||||||
|
-if(need.verified? or need.negociating?)
|
||||||
|
=link_to i(:"check") + " Intéressé", wish_public_need_path(need) , class: "btn btn-success pull-right"
|
||||||
|
-elsif(need.negociated?)
|
||||||
|
=link_to "J'en profite!", public_need_path(need), class: "btn 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"
|
||||||
|
|
||||||
|
.clear
|
||||||
|
@ -25,8 +25,11 @@
|
|||||||
= f.inputs do
|
= f.inputs do
|
||||||
= f.input :c, as: :category, selected: params[:c], input_html: {:name => 'c' }, label: 'Filtrer par catégorie', :include_blank => "Toute catégorie" , :as => :select, :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}
|
= f.input :c, as: :category, selected: params[:c], input_html: {:name => 'c' }, label: 'Filtrer par catégorie', :include_blank => "Toute catégorie" , :as => :select, :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}
|
||||||
.clear
|
.clear
|
||||||
|
= f.inputs do
|
||||||
|
= f.input :s, as: :state, selected: params[:s], input_html: {:name => 's' }, label: 'Filter par état', :include_blank => "Tous les états" , :as => :select, :collection => [["En sondage","verified"],["En négociation","negociating"],["Négocié","negociated"],["Négociation échouée","failed"]]
|
||||||
|
.clear
|
||||||
:javascript
|
:javascript
|
||||||
$('#search_o').change(function(){$('#search_form').submit()})
|
$('#search_o').change(function(){$('#search_form').submit()})
|
||||||
$('#search_r').change(function(){$('#search_form').submit()})
|
$('#search_r').change(function(){$('#search_form').submit()})
|
||||||
$('#search_c').change(function(){$('#search_form').submit()})
|
$('#search_c').change(function(){$('#search_form').submit()})
|
||||||
|
$('#search_s').change(function(){$('#search_form').submit()})
|
||||||
|
@ -3,27 +3,36 @@
|
|||||||
%h1= @need.title.upcase
|
%h1= @need.title.upcase
|
||||||
|
|
||||||
-if @need.author
|
-if @need.author
|
||||||
%p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(@need.created_at)} par #{@need.author.anonyme_nick}"
|
%p.info
|
||||||
|
=i(:"clock-o") + " Proposé par "
|
||||||
|
%strong=@need.author.anonyme_nick
|
||||||
|
="il y a #{time_ago_in_words(@need.created_at)}"
|
||||||
-else
|
-else
|
||||||
%p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(@need.created_at)}"
|
%p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(@need.created_at)}"
|
||||||
|
|
||||||
|
|
||||||
|
-if @need.category
|
||||||
%p.info=i(:"tag") + " " + @need.category_path
|
%p.info=i(:"tag") + " " + @need.category_path
|
||||||
|
-else
|
||||||
|
%p.info=i(:"tag") + " Non catégorisé"
|
||||||
|
|
||||||
|
%p.description= @need.description
|
||||||
|
|
||||||
%p.description= @need.description
|
.clear
|
||||||
|
.counters
|
||||||
.clear
|
-if(@need.wishes.length > 0)
|
||||||
.counters
|
.item=i(:"hand-paper-o") + " " + " #{pluralize(@need.wishes.length, 'utilisateur')} #{"intéressé".pluralize(@need.wishes.length)} par ce besoin"
|
||||||
-if(@need.wishes.length > 0)
|
-else
|
||||||
.item=i(:"hand-paper-o") + " " + " #{pluralize(@need.wishes.length, 'Organisation')} #{"intéressé".pluralize(@need.wishes.length)} par ce besoin"
|
.item=i(:"hand-paper-o") + " Aucun utilisateur n'est intéressé par ce besoin"
|
||||||
-else
|
|
||||||
.item=i(:"hand-paper-o") + " Aucune organisation n'est intéressé par ce besoin"
|
|
||||||
|
|
||||||
|
-if @need.verified? or @need.negociating?
|
||||||
-if(@need.customers.include?(current_customer))
|
-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"
|
=link_to i(:"check") + " Intéressé", wish_public_need_path(@need) , :class => "btn btn-square btn-lg btn-success pull-right"
|
||||||
-else
|
-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 !", wish_public_need_path(@need) , :class => "btn btn-square btn-lg btn-primary pull-right"
|
||||||
.clear
|
-elsif @need.negociated
|
||||||
|
|
||||||
|
.clear
|
||||||
|
|
||||||
%hr
|
%hr
|
||||||
= semantic_form_for [:public, @need, @comment ], :html => {id: :message_form, :method => :post } do |f|
|
= semantic_form_for [:public, @need, @comment ], :html => {id: :message_form, :method => :post } do |f|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user