diff --git a/app/controllers/admin/i_websites_controller.rb b/app/controllers/admin/i_websites_controller.rb index 8b4affb..5e10e70 100644 --- a/app/controllers/admin/i_websites_controller.rb +++ b/app/controllers/admin/i_websites_controller.rb @@ -14,7 +14,7 @@ class Admin::IWebsitesController < ApplicationController def index - @i_websites = IWebsite.order("p_customer_id ASC").all + @i_websites = IWebsite.joins(:p_customer).order("p_customers.name ASC, p_customers.id ASC, i_websites.name ASC").all end diff --git a/app/models/p_customer.rb b/app/models/p_customer.rb index ddbf788..36f4fba 100644 --- a/app/models/p_customer.rb +++ b/app/models/p_customer.rb @@ -14,6 +14,10 @@ class PCustomer < ActiveRecord::Base generate_mlm_token end + before_save do + self.name = self.show_name + end + def self.for_search(search) PCustomer.joins(:particular).where("code LIKE ? or particulars.organisation LIKE ? or particulars.name LIKE ? or particulars.firstname LIKE ?","%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%") end diff --git a/app/views/admin/admin_spaces/_sites.html.haml b/app/views/admin/admin_spaces/_sites.html.haml index fadd66d..d79c9a9 100644 --- a/app/views/admin/admin_spaces/_sites.html.haml +++ b/app/views/admin/admin_spaces/_sites.html.haml @@ -1,2 +1,3 @@ -%li= link_to "Sites", admin_i_websites_path +%li= link_to "Projets", admin_i_websites_path %li= link_to "Hébergements", admin_i_hebergements_path +%li= link_to "To do", admin_i_tasks_path