contacts page refactoring
This commit is contained in:
parent
e7d134fa28
commit
155c766a29
|
@ -1,11 +1,7 @@
|
||||||
class ContactController < ApplicationController
|
class ContactsController < ApplicationController
|
||||||
layout :select_layout
|
layout :select_layout
|
||||||
|
|
||||||
def index
|
def index
|
||||||
redirect_to(:action =>"list")
|
|
||||||
end
|
|
||||||
|
|
||||||
def list
|
|
||||||
@contact_pages = Paginator.new(self, Contact.count("customer_id = #{logged_user}"), CDF::CONFIG[:contacts_per_page], params['page'])
|
@contact_pages = Paginator.new(self, Contact.count("customer_id = #{logged_user}"), CDF::CONFIG[:contacts_per_page], params['page'])
|
||||||
@contacts = Contact.find(:all, :conditions=>["customer_id = #{logged_user}"], :order=>['fname'], :limit=>CDF::CONFIG[:contacts_per_page], :offset=>@contact_pages.current.offset)
|
@contacts = Contact.find(:all, :conditions=>["customer_id = #{logged_user}"], :order=>['fname'], :limit=>CDF::CONFIG[:contacts_per_page], :offset=>@contact_pages.current.offset)
|
||||||
|
|
|
@ -118,7 +118,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_main
|
def link_main
|
||||||
link_to(_('Contacts'), :controller => '/contact', :action => 'list')
|
link_to(_('Contacts'), contacts_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def alternator
|
def alternator
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
module ContactHelper
|
|
||||||
def link_import_preview() "/contacts/contact/import_preview" end
|
|
||||||
def link_main_index() "/webmail/folders" end
|
|
||||||
def link_contact_save() "/contacts/contact/save" end
|
|
||||||
def link_contact_import() "/contacts/contact/import" end
|
|
||||||
def link_contact_choose() "/contacts/contact/choose" end
|
|
||||||
|
|
||||||
def link_contact_list
|
|
||||||
link_to(_('List'), :controller => "/contacts/contact", :action => "list")
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_contact_add_one
|
|
||||||
link_to(_('Add one contact'), :controller => "/contacts/contact", :action => "add")
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_contact_add_multiple
|
|
||||||
link_to(_('Add multiple'), :controller => "/contacts/contact", :action => "add_multiple")
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_contact_group_list
|
|
||||||
link_to(_('Groups'), :controller => "/contacts/contact_group", :action => "list")
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_folders
|
|
||||||
link_to(_('Folders'), :controller=>"/webmail", :action=>"messages")
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_send_mail
|
|
||||||
link_to(_('Compose'), :controller=>"/webmail", :action=>"compose")
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_mail_prefs
|
|
||||||
link_to(_('Preferences'), :controller=>"/webmail", :action=>"prefs")
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_mail_filters
|
|
||||||
link_to(_('Filters'), :controller=>"/webmail", :action=>"filters")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
3
app/helpers/contacts_helper.rb
Normal file
3
app/helpers/contacts_helper.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module ContactsHelper
|
||||||
|
|
||||||
|
end
|
|
@ -23,6 +23,44 @@ module NavigationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_import_preview() "/contacts/import_preview" end
|
||||||
|
def link_main_index() "/" end
|
||||||
|
def link_contact_save() "/contacts/save" end
|
||||||
|
def link_contact_import() "/contacts/import" end
|
||||||
|
def link_contact_choose() "/contacts/contact/choose" end
|
||||||
|
|
||||||
|
def link_contact_list
|
||||||
|
link_to(_('List'), :controller => "/contacts/contact", :action => "list")
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_contact_add_one
|
||||||
|
link_to(_('Add one contact'), :controller => "/contacts/contact", :action => "add")
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_contact_add_multiple
|
||||||
|
link_to(_('Add multiple'), :controller => "/contacts/contact", :action => "add_multiple")
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_contact_group_list
|
||||||
|
link_to(_('Groups'), :controller => "/contacts/contact_group", :action => "list")
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_folders
|
||||||
|
link_to(_('Folders'), :controller=>"/webmail", :action=>"messages")
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_send_mail
|
||||||
|
link_to(_('Compose'), :controller=>"/webmail", :action=>"compose")
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_mail_prefs
|
||||||
|
link_to(_('Preferences'), :controller=>"/webmail", :action=>"prefs")
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_mail_filters
|
||||||
|
link_to(_('Filters'), :controller=>"/webmail", :action=>"filters")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def short_fn(folder)
|
def short_fn(folder)
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
letters = CDF::CONFIG[:contact_letters]
|
letters = CDF::CONFIG[:contact_letters]
|
||||||
for letterIndex in 0...letters.size
|
for letterIndex in 0...letters.size
|
||||||
letter = letters[letterIndex] %>
|
letter = letters[letterIndex] %>
|
||||||
<%= link_to(letter, :controller=>"contact", :action=>"listLetter", :id=>letterIndex, :params=>{"mode"=>@mode, "group_id"=>(@group_id ? @group_id : nil)}) %>
|
<%= link_to(letter, :controller=>"contacts", :action=>"listLetter", :id=>letterIndex, :params=>{"mode"=>@mode, "group_id"=>(@group_id ? @group_id : nil)}) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to(_('Show all'), :controller=>"contact", :action=>"list", :id=>(@group_id ? @group_id : nil), :params=>{"mode"=>@mode})%>
|
<%= link_to(_('Show all'), :controller=>"contact", :action=>"list", :id=>(@group_id ? @group_id : nil), :params=>{"mode"=>@mode})%>
|
||||||
</td>
|
</td>
|
|
@ -1,5 +1,6 @@
|
||||||
ActionController::Routing::Routes.draw do |map|
|
ActionController::Routing::Routes.draw do |map|
|
||||||
map.resources :folders, :requirements => {:id => /[^\/]+/}
|
map.resources :folders, :requirements => {:id => /[^\/]+/}
|
||||||
|
map.resources :contacts
|
||||||
|
|
||||||
# Add your own custom routes here.
|
# Add your own custom routes here.
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
|
|
Loading…
Reference in a new issue