diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/admin_helper.rb | 37 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/config_helper.rb | 4 | ||||
-rwxr-xr-x | app/helpers/link_to_helper.rb | 38 | ||||
-rw-r--r-- | app/helpers/mailer_helper.rb | 2 |
5 files changed, 57 insertions, 26 deletions
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb new file mode 100644 index 000000000..059cebdfa --- /dev/null +++ b/app/helpers/admin_helper.rb @@ -0,0 +1,37 @@ +module AdminHelper + def icon(name) + content_tag(:i, "", :class => "icon-#{name}") + end + + def eye + icon("eye-open") + end + + def chevron_right + icon("chevron-right") + end + + def chevron_down + icon("chevron-down") + end + + def arrow_right + icon("arrow-right") + end + + def request_both_links(info_request) + link_to(eye, request_path(info_request), :title => "view request on public website") + " " + + link_to(info_request.title, admin_request_show_path(info_request), :title => "view full details") + end + + def public_body_both_links(public_body) + link_to(eye, public_body_path(public_body), :title => "view authority on public website") + " " + + link_to(h(public_body.name), admin_body_show_path(public_body), :title => "view full details") + end + + def user_both_links(user) + link_to(eye, user_path(user), :title => "view user's page on public website") + " " + + link_to(h(user.name), admin_user_show_path(user), :title => "view full details") + end +end + diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 42f9d30f1..e3b1e57ac 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,7 +3,7 @@ # in the application. # # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ require 'languages' diff --git a/app/helpers/config_helper.rb b/app/helpers/config_helper.rb index 73e12172f..026600ff1 100644 --- a/app/helpers/config_helper.rb +++ b/app/helpers/config_helper.rb @@ -1,5 +1,5 @@ module ConfigHelper def site_name - Configuration::site_name + AlaveteliConfiguration::site_name end -end
\ No newline at end of file +end diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 15cce39eb..238a36ce4 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -3,7 +3,7 @@ # - # # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ module LinkToHelper @@ -22,14 +22,6 @@ module LinkToHelper link_to h(info_request.title), request_path(info_request), :class => cls end - def request_admin_link(info_request, name="admin", cls=nil) - link_to name, admin_request_show_url(info_request), :class => cls - end - - def request_both_links(info_request) - link_to(h(info_request.title), request_url(info_request)) + " (" + link_to("admin", admin_request_show_url(info_request)) + ")" - end - def request_details_path(info_request) details_request_path(:url_title => info_request.url_title) end @@ -44,7 +36,7 @@ module LinkToHelper end def outgoing_message_url(outgoing_message, options = {}) - return request_path(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}")) + request_url(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}")) end def outgoing_message_path(outgoing_message) @@ -94,10 +86,6 @@ module LinkToHelper link_to h(public_body.name), public_body_url(public_body) end - def public_body_both_links(public_body) - link_to(h(public_body.name), public_body_url(public_body)) + " (" + link_to("admin", admin_body_show_url(public_body)) + ")" - end - # Users def user_url(user, options = {}) show_user_url(options.merge(:url_name => user.url_name)) @@ -126,10 +114,9 @@ module LinkToHelper def user_admin_link_for_request(request, external_text=nil, internal_text=nil) if request.is_external? - text = external_text ? external_text : (request.external_user_name || _("Anonymous user")) + " (external)" + external_text || (request.external_user_name || _("Anonymous user")) + " (external)" else - text = internal_text ? internal_text : request.user.name - link_to(h(text), admin_user_show_url(request.user)) + link_to(h(internal_text || request.user.name), admin_user_show_url(request.user)) end end @@ -181,10 +168,6 @@ module LinkToHelper link_to name, admin_user_show_url(user), :class => cls end - def user_both_links(user) - link_to(h(user.name), user_url(user)) + " (" + link_to("admin", admin_user_show_url(user)) + ")" - end - # Tracks. feed can be 'track' or 'feed' def do_track_url(track_thing, feed = 'track', options = {}) if track_thing.track_type == 'request_updates' @@ -235,6 +218,9 @@ module LinkToHelper return url end + def search_link(query, variety_postfix = nil, sort_postfix = nil, advanced = nil) + link_to h(query), search_url(query) + end def search_path(query, options = {}) search_url(query, options.merge(:only_path => true)) @@ -255,7 +241,7 @@ module LinkToHelper # TODO: Remove in next release def main_url(relative_path, append = nil) warn "[DEPRECATION] main_url is deprecated. Please remove it from your theme." - url_prefix = "http://" + Configuration::domain + url_prefix = "http://" + AlaveteliConfiguration::domain url = url_prefix + relative_path if !append.nil? begin @@ -299,5 +285,13 @@ module LinkToHelper def year_from_date(date) return date.strftime("%Y").strip end + + #I18n locale switcher + + def locale_switcher(locale, params) + params['locale'] = locale + return url_for(params) + end + end diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb index be2ce47aa..3d4bbac71 100644 --- a/app/helpers/mailer_helper.rb +++ b/app/helpers/mailer_helper.rb @@ -1,5 +1,5 @@ module MailerHelper def contact_from_name_and_email - "#{Configuration::contact_name} <#{Configuration::contact_email}>" + "#{AlaveteliConfiguration::contact_name} <#{AlaveteliConfiguration::contact_email}>" end end |