Moderation and Administration ergonomy
This commit is contained in:
parent
8e710a7b50
commit
9dc8ad2394
@ -121,7 +121,11 @@ body.admin{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message-item{
|
||||||
|
padding:10px;
|
||||||
|
background: #eeeded;
|
||||||
|
margin-bottom:20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
padding:0px;
|
padding:0px;
|
||||||
|
23
app/controllers/admin/messages_controller.rb
Normal file
23
app/controllers/admin/messages_controller.rb
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
class Admin::MessagesController < ApplicationController
|
||||||
|
layout "admin"
|
||||||
|
before_filter :auth_admin
|
||||||
|
|
||||||
|
|
||||||
|
def index
|
||||||
|
@need = Need.find(params[:need_id])
|
||||||
|
@comments = @need.messages.order(created_at: :desc).page params[:page]
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@message = Message.find(params['id'])
|
||||||
|
if @message.destroy
|
||||||
|
flash[:notice] = "Commentaire supprimé"
|
||||||
|
else
|
||||||
|
flash[:error] = "Impossible de supprimer ce commentaire"
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to :back
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -1,21 +1,87 @@
|
|||||||
class Admin::NeedsController < ApplicationController
|
class Admin::NeedsController < ApplicationController
|
||||||
layout "admin"
|
layout "admin"
|
||||||
before_filter :auth_admin
|
before_filter :auth_admin
|
||||||
before_action :build_category_tree, only:[:new, :update, :create, :edit]
|
before_action :build_category_tree, only:[:new, :update, :create, :edit, :index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
# Get all needs to validate
|
# Get all needs to validate
|
||||||
@needs_to_validate = Need.where(state: 'created').order(created_at: :desc)
|
@needs_to_validate = Need.where(state: 'created').order(created_at: :desc)
|
||||||
|
|
||||||
# Get all controlled needs
|
|
||||||
@needs = Kaminari.paginate_array(Need.shared.order(created_at: :desc))
|
@needs = Need.shared
|
||||||
.page(params[:page])
|
|
||||||
.per(10)
|
# filters default value
|
||||||
|
params[:o] ||= 'created-desc'
|
||||||
|
params[:r] ||= 10
|
||||||
|
|
||||||
|
# Include search in the query
|
||||||
|
if(params[:q] != '')
|
||||||
|
@needs = @needs.search(params[:q])
|
||||||
|
end
|
||||||
|
|
||||||
|
if(params[:c] and params[:c] != '')
|
||||||
|
@category = NeedCategory.find(params[:c])
|
||||||
|
ids = @category.child_ids
|
||||||
|
@needs = @needs.where(category_id: ids)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Include order in the query
|
||||||
|
case params[:o]
|
||||||
|
when 'alpha-asc'
|
||||||
|
@needs = @needs.order(title: :asc)
|
||||||
|
when 'alpha-desc'
|
||||||
|
@needs = @needs.order(title: :desc)
|
||||||
|
when 'wishes-asc'
|
||||||
|
@needs = @needs.with_wishes_count.order('wishes_count ASC')
|
||||||
|
when 'wishes-desc'
|
||||||
|
@needs = @needs.with_wishes_count.order('wishes_count DESC')
|
||||||
|
when 'created-asc'
|
||||||
|
@needs = @needs.order(created_at: :asc)
|
||||||
|
when 'created-desc'
|
||||||
|
@needs = @needs.order(created_at: :desc)
|
||||||
|
when 'comments-asc'
|
||||||
|
@needs = @needs.with_messages_count.order('messages_count ASC')
|
||||||
|
when 'comments-desc'
|
||||||
|
@needs = @needs.with_messages_count.order('messages_count DESC')
|
||||||
|
end
|
||||||
|
|
||||||
|
# Paginate
|
||||||
|
@needs = @needs.page(params[:page]).per(params[:r])
|
||||||
|
|
||||||
|
|
||||||
|
# Define order select options
|
||||||
|
@orders = {
|
||||||
|
"Les plus récents" => 'created-desc',
|
||||||
|
"Les plus populaires" => 'wishes-desc',
|
||||||
|
"Les plus commentés" => 'comments-desc',
|
||||||
|
"Alphabétique (de A à Z)" => 'alpha-asc',
|
||||||
|
"Alphabétique (de Z à A)" => 'alpha-desc'
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@need = Need.new()
|
||||||
|
@comments = @need.messages.order(created_at: :desc).page params[:page]
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@need = Need.new(need_params)
|
||||||
|
|
||||||
|
if @need.update_attributes(need_params)
|
||||||
|
flash[:notice] = "Besoin créé avec succès."
|
||||||
|
@need.validate!
|
||||||
|
redirect_to admin_needs_path
|
||||||
|
else
|
||||||
|
render :action => "new"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
||||||
@need = Need.find(params[:id])
|
@need = Need.find(params[:id])
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@ -61,7 +127,7 @@ class Admin::NeedsController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def need_params
|
def need_params
|
||||||
params.require(:need).permit(:title, :description, :category_id)
|
params.require(:need).permit(:title, :description, :category_id, :author_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_category_tree
|
def build_category_tree
|
||||||
|
22
app/controllers/admin/wishes_controller.rb
Normal file
22
app/controllers/admin/wishes_controller.rb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class Admin::WishesController < ApplicationController
|
||||||
|
layout "admin"
|
||||||
|
before_filter :auth_admin
|
||||||
|
|
||||||
|
|
||||||
|
def index
|
||||||
|
@need = Need.find(params[:need_id])
|
||||||
|
@wishes = @need.wishes.order(created_at: :desc).page params[:page]
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@wish = Wish.find(params[:id])
|
||||||
|
if(@wish.destroy)
|
||||||
|
flash[:notice] = "Intérêt supprimé avec succès."
|
||||||
|
end
|
||||||
|
redirect_to :back
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
@ -7,21 +7,21 @@
|
|||||||
%thead#customer_rows_header.rows_header
|
%thead#customer_rows_header.rows_header
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%th
|
||||||
Société
|
Société
|
||||||
%td
|
%th
|
||||||
Nom
|
Nom
|
||||||
|
|
||||||
%td
|
%th
|
||||||
Ville
|
Ville
|
||||||
%td
|
%th
|
||||||
Email confirmé ?
|
Email confirmé ?
|
||||||
%td
|
%th
|
||||||
Email
|
Email
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%td{:style => "width:100px"}
|
%th{:style => "width:100px"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -32,15 +32,3 @@
|
|||||||
=render @customers
|
=render @customers
|
||||||
|
|
||||||
.pagination= paginate @customers
|
.pagination= paginate @customers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
9
app/views/admin/messages/_message.html.haml
Normal file
9
app/views/admin/messages/_message.html.haml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.white.padding.message-item
|
||||||
|
|
||||||
|
%h4=message.customer.anonyme_nick
|
||||||
|
%p.info="Posté le #{message.created_at.strftime('%d/%m/%Y à %H:%M')}, il y a #{time_ago_in_words(message.created_at)}"
|
||||||
|
|
||||||
|
|
||||||
|
%p= message.content
|
||||||
|
|
||||||
|
=link_to "Supprimer", [:admin, @need, message], class: "btn btn-danger", method: "delete"
|
7
app/views/admin/messages/index.html.haml
Normal file
7
app/views/admin/messages/index.html.haml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
%h1= "Commentaires du besoin #{@need.title}"
|
||||||
|
|
||||||
|
%h4= " #{pluralize(@need.messages.count, 'Commentaire')} pour ce besoin"
|
||||||
|
|
||||||
|
=render collection: @comments, partial: 'message'
|
||||||
|
|
||||||
|
.pagination= paginate @comments
|
@ -2,9 +2,15 @@
|
|||||||
.content
|
.content
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=f.inputs do
|
=f.inputs do
|
||||||
=f.input :title, :label => "Titre : "
|
=f.input :title, :label => "Titre : "
|
||||||
=f.input :category, :as => :select, :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}, label: "Catégorie de besoin"
|
=f.input :category, include_blank: "Toute catégorie", :as => :select, :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 :description, :label => "Description : ", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||||
|
=f.input :author, :label => "Auteur", include_blank: "Administrateur"
|
||||||
|
=f.input :created_at, :label => "Créé le", disabled: true
|
||||||
|
=f.input :updated_at, :label => "Dernière modification le", disabled: true
|
||||||
|
|
||||||
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"
|
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
|
|
||||||
%tr{:id => need.id}
|
%tr{:id => need.id}
|
||||||
%td
|
%td
|
||||||
=need.title
|
=link_to need.title, edit_admin_need_path(need)
|
||||||
%td
|
%td
|
||||||
|
-if need.category
|
||||||
|
=link_to need.category.name, edit_admin_need_category_path(need.category)
|
||||||
|
|
||||||
|
%td
|
||||||
|
-if need.author
|
||||||
=link_to need.author.organisation, edit_admin_customer_path(need.author)
|
=link_to need.author.organisation, edit_admin_customer_path(need.author)
|
||||||
%td
|
-else
|
||||||
Il y a #{time_ago_in_words( need.created_at)}
|
Administrateur
|
||||||
|
|
||||||
|
%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"}
|
%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(:"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(:pencil), edit_admin_need_path(need)
|
||||||
|
22
app/views/admin/needs/_need_to_validate.html.haml
Normal file
22
app/views/admin/needs/_need_to_validate.html.haml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
%tr{:id => need.id}
|
||||||
|
%td
|
||||||
|
=link_to need.title, edit_admin_need_path(need)
|
||||||
|
%td
|
||||||
|
-if need.category
|
||||||
|
=link_to need.category.name, edit_admin_need_category_path(need.category)
|
||||||
|
|
||||||
|
%td
|
||||||
|
-if need.author
|
||||||
|
=link_to need.author.organisation, edit_admin_customer_path(need.author)
|
||||||
|
-else
|
||||||
|
Administrateur
|
||||||
|
%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)
|
||||||
|
-if(need.created?)
|
||||||
|
= 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 ?'}
|
@ -13,39 +13,68 @@
|
|||||||
%thead.rows_header
|
%thead.rows_header
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%th
|
||||||
Titre
|
Titre
|
||||||
%td
|
%th
|
||||||
|
Catégorie
|
||||||
|
%th
|
||||||
Émetteur
|
Émetteur
|
||||||
%td
|
%th
|
||||||
Créé
|
Créé
|
||||||
%td{:style => "width:100px"}
|
%th{:style => "width:100px"}
|
||||||
|
|
||||||
|
|
||||||
%tbody.rows
|
%tbody.rows
|
||||||
|
|
||||||
=render @needs_to_validate
|
=render collection: @needs_to_validate, partial: 'need_to_validate', as: :need
|
||||||
|
%br
|
||||||
|
|
||||||
|
|
||||||
|
%h2 Liste des besoins
|
||||||
|
.row
|
||||||
|
.col-md-2
|
||||||
|
|
||||||
%h2 Liste des besoins
|
= semantic_form_for :search, :html => {id: :search_form, :method => :get } do |f|
|
||||||
|
= f.inputs do
|
||||||
|
=f.input :q, :as => :search, label: "Recherche", input_html: {value: params[:q], :name => 'q' }, placeholder: "Rechercher un besoin"
|
||||||
|
.clear
|
||||||
|
= f.inputs do
|
||||||
|
= f.input :o, as: :order, selected: params[:o], input_html: {:name => 'o' }, label: "Ordre d'affichage", :include_blank => false , :as => :select, :collection => @orders
|
||||||
|
.clear
|
||||||
|
= f.inputs do
|
||||||
|
= f.input :r, as: :result, selected: params[:r], input_html: {:name => 'r' }, label: 'Résultats par page', :include_blank => false , :as => :select, :collection => [10,20,50,100]
|
||||||
|
.clear
|
||||||
|
= 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]}
|
||||||
|
.clear
|
||||||
|
= link_to "Créer un besoin", new_admin_need_path, class:"btn btn-primary"
|
||||||
|
|
||||||
%table.table.admin_table.table-hover.table-striped
|
.col-md-10
|
||||||
|
%table.table.admin_table.table-hover.table-striped
|
||||||
%thead.rows_header
|
%thead.rows_header
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%th
|
||||||
Titre
|
Titre
|
||||||
%td
|
%th
|
||||||
|
Catégorie
|
||||||
|
%th
|
||||||
Émetteur
|
Émetteur
|
||||||
%td
|
|
||||||
Créé
|
%th{style: 'text-align:center' }
|
||||||
%td{:style => "width:100px"}
|
Commentaires/Intérêts
|
||||||
|
%th{:style => "width:100px"}
|
||||||
|
|
||||||
|
|
||||||
%tbody.rows
|
%tbody.rows
|
||||||
|
|
||||||
=render @needs
|
=render @needs
|
||||||
|
|
||||||
|
.pagination.pull-right= paginate @needs
|
||||||
|
|
||||||
.pagination.pull-right= paginate @needs
|
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$('#search_o').change(function(){$('#search_form').submit()})
|
||||||
|
$('#search_r').change(function(){$('#search_form').submit()})
|
||||||
|
$('#search_c').change(function(){$('#search_form').submit()})
|
||||||
|
2
app/views/admin/needs/new.html.haml
Normal file
2
app/views/admin/needs/new.html.haml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
%h1 Créer un nouveau besoin
|
||||||
|
=render :partial => "form"
|
8
app/views/admin/wishes/_wish.html.haml
Normal file
8
app/views/admin/wishes/_wish.html.haml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
%tr{:id => wish.id}
|
||||||
|
%td
|
||||||
|
=link_to wish.customer.organisation, edit_admin_customer_path(wish.customer)
|
||||||
|
%td
|
||||||
|
=wish.created_at
|
||||||
|
%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
|
21
app/views/admin/wishes/index.html.haml
Normal file
21
app/views/admin/wishes/index.html.haml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
%h1= "Utilisateurs intéressés par le besoin #{@need.title}"
|
||||||
|
|
||||||
|
-if @wishes.length > 0
|
||||||
|
%table.table.admin_table.table-hover.table-striped
|
||||||
|
%thead.rows_header
|
||||||
|
|
||||||
|
%tr
|
||||||
|
%th
|
||||||
|
Utilisateur
|
||||||
|
%th
|
||||||
|
Intéressé le
|
||||||
|
%th{:style => "width:100px"}
|
||||||
|
|
||||||
|
|
||||||
|
%tbody.rows
|
||||||
|
|
||||||
|
=render @wishes
|
||||||
|
|
||||||
|
.pagination.pull-right= paginate @wishes
|
||||||
|
-else
|
||||||
|
Aucun intérêt enregistré pour ce besoin pour le moment
|
@ -1,7 +1,7 @@
|
|||||||
= semantic_form_for [:public, @need] do |f|
|
= semantic_form_for [:public, @need] do |f|
|
||||||
=f.inputs do
|
=f.inputs do
|
||||||
= f.input :title, :label => "Titre de votre besoin"
|
= f.input :title, :label => "Titre de votre besoin"
|
||||||
=f.input :category, :as => :select, :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}, label: "Catégorie de 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;"}
|
= f.input :description, :label => "Description", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||||
%br
|
%br
|
||||||
=f.submit "Sauvegarder", :class => "btn btn-primary"
|
=f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
%tr
|
%tr
|
||||||
%th
|
%th
|
||||||
Titre du besoin
|
Titre du besoin
|
||||||
|
%th
|
||||||
|
Catégorie
|
||||||
%th
|
%th
|
||||||
État
|
État
|
||||||
%th{:style => "width:100px"}
|
%th{:style => "width:100px"}
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
%tr{:id => need.id, class: css_class}
|
%tr{:id => need.id, class: css_class}
|
||||||
%td
|
%td
|
||||||
=link_to need.title, public_need_path(need)
|
=link_to need.title, public_need_path(need)
|
||||||
|
%td
|
||||||
|
-if need.category
|
||||||
|
=need.category.name
|
||||||
%td
|
%td
|
||||||
=need.human_state
|
=need.human_state
|
||||||
%td.actions{:style => "width:150px;text-align:right"}
|
%td.actions{:style => "width:150px;text-align:right"}
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
%h4
|
%h4
|
||||||
=link_to need.title.upcase, public_need_path(need)
|
=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}"
|
%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)}"
|
||||||
|
|
||||||
|
|
||||||
-if need.category
|
-if need.category
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
%tr{:id => wish.id}
|
%tr{:id => wish.id}
|
||||||
%td
|
%td
|
||||||
=link_to wish.title, public_need_path(wish)
|
=link_to wish.title, public_need_path(wish)
|
||||||
|
%td
|
||||||
|
-if wish.category
|
||||||
|
=wish.category.name
|
||||||
%td
|
%td
|
||||||
=wish.human_state
|
=wish.human_state
|
||||||
%td{style: 'text-align:center' }
|
%td{style: 'text-align:center' }
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
%tr
|
%tr
|
||||||
%th
|
%th
|
||||||
Titre
|
Titre
|
||||||
|
%th
|
||||||
|
Catégorie
|
||||||
%th
|
%th
|
||||||
État
|
État
|
||||||
%th{style: 'text-align:center'}
|
%th{style: 'text-align:center'}
|
||||||
@ -14,5 +16,3 @@
|
|||||||
%tbody
|
%tbody
|
||||||
|
|
||||||
=render partial: "public/needs/wish", collection: @wishes, as: :wish
|
=render partial: "public/needs/wish", collection: @wishes, as: :wish
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,26 +11,17 @@
|
|||||||
.row.col-md-3
|
.row.col-md-3
|
||||||
.white.side-menu
|
.white.side-menu
|
||||||
= semantic_form_for :search, :html => {id: :search_form, :method => :get } do |f|
|
= semantic_form_for :search, :html => {id: :search_form, :method => :get } do |f|
|
||||||
|
|
||||||
= f.inputs do
|
= f.inputs do
|
||||||
|
|
||||||
=f.input :q, :as => :search, label: "Recherche", input_html: {value: params[:q], :name => 'q' }, placeholder: "Rechercher un besoin"
|
=f.input :q, :as => :search, label: "Recherche", input_html: {value: params[:q], :name => 'q' }, placeholder: "Rechercher un besoin"
|
||||||
|
|
||||||
.clear
|
.clear
|
||||||
|
|
||||||
= f.inputs do
|
= f.inputs do
|
||||||
= f.input :o, as: :order, selected: params[:o], input_html: {:name => 'o' }, label: "Ordre d'affichage", :include_blank => false , :as => :select, :collection => @orders
|
= f.input :o, as: :order, selected: params[:o], input_html: {:name => 'o' }, label: "Ordre d'affichage", :include_blank => false , :as => :select, :collection => @orders
|
||||||
|
|
||||||
.clear
|
.clear
|
||||||
|
|
||||||
= f.inputs do
|
= f.inputs do
|
||||||
= f.input :r, as: :result, selected: params[:r], input_html: {:name => 'r' }, label: 'Résultats par page', :include_blank => false , :as => :select, :collection => [6,12,24,48]
|
= f.input :r, as: :result, selected: params[:r], input_html: {:name => 'r' }, label: 'Résultats par page', :include_blank => false , :as => :select, :collection => [6,12,24,48]
|
||||||
|
|
||||||
.clear
|
.clear
|
||||||
|
|
||||||
= 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 => true , :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
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
|
@ -2,7 +2,12 @@
|
|||||||
.show-need
|
.show-need
|
||||||
%h1= @need.title.upcase
|
%h1= @need.title.upcase
|
||||||
|
|
||||||
|
-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
|
||||||
|
%p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(@need.created_at)}"
|
||||||
|
|
||||||
|
%p.info=i(:"tag") + " " + @need.category_path
|
||||||
|
|
||||||
|
|
||||||
%p.description= @need.description
|
%p.description= @need.description
|
||||||
|
@ -242,11 +242,14 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
resources :need_categories
|
resources :need_categories
|
||||||
resources :needs do
|
resources :needs do
|
||||||
|
resources :messages
|
||||||
|
resources :wishes
|
||||||
member do
|
member do
|
||||||
get :validate
|
get :validate
|
||||||
get :refuse
|
get :refuse
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :customers do
|
resources :customers do
|
||||||
member do
|
member do
|
||||||
get :validate
|
get :validate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user