suite contacts

This commit is contained in:
Nicolas Bally 2017-11-13 22:14:12 +01:00
parent 01f0c18e98
commit 1ff0fc508b
5 changed files with 24 additions and 8 deletions

View File

@ -7,8 +7,8 @@ class Admin::ContactsController < ApplicationController
@contacts = Contact.order("created_at DESC")
if params[:archived]
@contacts = @contacts.where(:archived => true)
if params[:status]
@contacts = @contacts.where(:status => params[:status])
else
@contacts = @contacts.where("archived IS NULL or archived = 0")
end

View File

@ -1,6 +1,9 @@
%tr.vertical_center.contact#contact{:id => contact.id}
%td{:style => "vertical-align:middle;"}
=image_tag "/provenance/#{contact.provenance_id}.png", :style => "width:20px;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,0.5)"
%td
-if contact.urgent
%div{:style => "width:10px;height:10px;border-radius:50%;"}
%td{:style => "vertical-align:middle;"}
-if !contact.readed
%span{:style => "display:inline-block;width:10px;height:10px;border-radius:50%;background:#00B3EC"}
@ -10,10 +13,11 @@
%td
=contact.name
%td
=contact.email
%br
=contact.tel
=contact.cp
=contact.city
%td
=contact.small_comment
%td
-if contact.admin
%span{:style => "background:#{contact.admin.color};padding:5px 10px;color:white"}

View File

@ -1,6 +1,8 @@
= semantic_form_for [:admin, @contact], :remote => true do |f|
.content
=f.inputs do
= f.input :contact_status, :label => "Status :", :collection => ["En cours", "Signés","En attente", "Archivé"]
= f.input :urgent, :label => "Urgent ?"
= f.input :readed, :label => "Lu ?"
= f.input :admin_id, :label => "Géré par ?", :collection => (Admin.where(:contact_role => true).all.map{|u|[ u.username, u.id]}), :as => :select
= f.input :archived, :label => "Archivé ?"
@ -17,6 +19,7 @@
= f.input :city, :label => "Ville"
= f.input :country, :label => "Pays", :as => :string
= f.input :small_comment, :label => "Commentaire court"
= f.input :notes, :label => "Notes"

View File

@ -4,9 +4,11 @@
%h1 Liste des contacts
%p
=link_to "Actifs", admin_contacts_path
-["En cours", "Signés","En attente", "Archivé"].each do |status|
=link_to "Actifs", admin_contacts_path(:status => status)
=link_to "Archivés", admin_contacts_path(:archived => true)
%table.table.table-hover
%thead#Admin_rows_header.rows_header

View File

@ -0,0 +1,7 @@
class AddInfosToContacts < ActiveRecord::Migration
def change
add_column :contacts, :small_comment, :text
add_column :contacts, :contact_status, :string
add_column :contacts, :urgent, :boolean
end
end