navigation helpers moved to separate file
This commit is contained in:
parent
de5fc1c44f
commit
69b208f27a
|
@ -1,5 +1,6 @@
|
||||||
# The methods added to this helper will be available to all templates in the application.
|
# The methods added to this helper will be available to all templates in the application.
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
|
include NavigationHelper
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
34
app/helpers/navigation_helper.rb
Normal file
34
app/helpers/navigation_helper.rb
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
module NavigationHelper
|
||||||
|
def link_back_to_messages
|
||||||
|
link_to("«" << _('Back to messages'), :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
|
||||||
|
|
||||||
|
def folder_manage_link(folder)
|
||||||
|
if folder.name == CDF::CONFIG[:mail_trash] or folder.name == CDF::CONFIG[:mail_inbox] or folder.name == CDF::CONFIG[:mail_sent]
|
||||||
|
short_fn(folder)
|
||||||
|
else
|
||||||
|
return short_fn(folder) +
|
||||||
|
(" " + link_to(_('(Delete)'), :controller=>"webmail", :action=>"manage_folders", :params=>{"op"=>_('(Delete)'), "folder_name"=>folder.name}))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def short_fn(folder)
|
||||||
|
if folder.name.include? folder.delim
|
||||||
|
" " + folder.name.split(folder.delim).last
|
||||||
|
else
|
||||||
|
folder.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -7,10 +7,6 @@ module WebmailHelper
|
||||||
link_to(_('Folders'), :controller=>"webmail", :action=>"messages")
|
link_to(_('Folders'), :controller=>"webmail", :action=>"messages")
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_send_mail
|
|
||||||
link_to(_('Compose'), :controller=>"webmail", :action=>"compose")
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_compose_new
|
def link_compose_new
|
||||||
link_to(_('Compose new mail'), :controller=>"webmail", :action=>"compose")
|
link_to(_('Compose new mail'), :controller=>"webmail", :action=>"compose")
|
||||||
end
|
end
|
||||||
|
@ -43,18 +39,6 @@ module WebmailHelper
|
||||||
link_to(_('add/edit'), :controller=>"webmail", :action=>"manage_folders")
|
link_to(_('add/edit'), :controller=>"webmail", :action=>"manage_folders")
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_back_to_messages
|
|
||||||
link_to("«" << _('Back to messages'), :controller=>"webmail", :action=>"messages")
|
|
||||||
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
|
|
||||||
|
|
||||||
def link_filter_add
|
def link_filter_add
|
||||||
link_to(_('Add filter'), :controller=>'webmail', :action=>'filter_add')
|
link_to(_('Add filter'), :controller=>'webmail', :action=>'filter_add')
|
||||||
end
|
end
|
||||||
|
@ -81,22 +65,7 @@ module WebmailHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def short_fn(folder)
|
|
||||||
if folder.name.include? folder.delim
|
|
||||||
" " + folder.name.split(folder.delim).last
|
|
||||||
else
|
|
||||||
folder.name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def folder_manage_link(folder)
|
|
||||||
if folder.name == CDF::CONFIG[:mail_trash] or folder.name == CDF::CONFIG[:mail_inbox] or folder.name == CDF::CONFIG[:mail_sent]
|
|
||||||
short_fn(folder)
|
|
||||||
else
|
|
||||||
return short_fn(folder) +
|
|
||||||
(" " + link_to(_('(Delete)'), :controller=>"webmail", :action=>"manage_folders", :params=>{"op"=>_('(Delete)'), "folder_name"=>folder.name}))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def message_date(datestr)
|
def message_date(datestr)
|
||||||
t = Time.now
|
t = Time.now
|
||||||
|
|
Loading…
Reference in a new issue