negos_app/app/views/public/needs/_need_item.html.haml
2015-12-10 20:04:48 +01:00

59 lines
1.9 KiB
Plaintext

.col-md-6
.padding.need-item
%h4
=link_to need.title.upcase, public_need_path(need)
-# -if need.author
-# %p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)} par #{need.author.anonyme_nick}"
-# -else
-# %p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)}"
.top-left-info
-if need.category
=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é
%p.description=truncate(need.description, length: 100)
.counters
.item=i(:"hand-paper-o") + " " + need.wishes.length.to_s
.item=i(:"comment-o") + " " + need.messages.length.to_s
-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