Moved users into new admin-namespace and made the controller restful. Also moved some logic from the controller into the user-model (dry it up..).

This commit is contained in:
Benjamin Meichsner 2009-01-12 18:26:09 +01:00
parent 47398c6a70
commit 461dfa8531
19 changed files with 242 additions and 94 deletions

View file

@ -0,0 +1,2 @@
module Admin::UsersHelper
end

View file

@ -2,15 +2,15 @@
module ApplicationHelper
def format_time(time = Time.now)
I18n.l time, :format => "%d.%m.%Y %H:%M"
I18n.l(time, :format => "%d.%m.%Y %H:%M") unless time.nil?
end
def format_date(time = Time.now)
I18n.l time.to_date
I18n.l(time.to_date) unless time.nil?
end
def format_datetime(time = Time.now)
I18n.l time
I18n.l(time) unless time.nil?
end
# Creates ajax-controlled-links for pagination
@ -29,9 +29,12 @@ module ApplicationHelper
links = []
per_page_options.each do |per_page|
unless per_page == current
links << link_to_remote(per_page, {:url => {:action => action, :params => {:per_page => per_page}},
:before => "Element.show('loader')",
:success => "Element.hide('loader')"})
links << link_to_remote(
per_page,
{ :url => { :action => action, :params => {:per_page => per_page}},
:before => "Element.show('loader')",
:success => "Element.hide('loader')",
:method => :get } )
else
links << per_page
end
@ -51,7 +54,8 @@ module ApplicationHelper
options = {
:url => {:action => 'list', :params => params.merge({:sort => key, :page => nil, :per_page => per_page})},
:before => "Element.show('loader')",
:success => "Element.hide('loader')"
:success => "Element.hide('loader')",
:method => :get
}
html_options = {
:title => _('Sort by this field'),
@ -86,6 +90,6 @@ module ApplicationHelper
end
def tab_is_active?(tab)
tab[:active].detect {|c| c == controller.controller_name }
tab[:active].detect {|c| c == controller.controller_path }
end
end