summaryrefslogtreecommitdiff
path: root/core/app/helpers
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-04-08 09:12:37 +0200
committerAzul <azul@leap.se>2014-04-08 09:12:37 +0200
commit53808b073f539ba2b442738b6abf97228488e311 (patch)
tree67e344defee90e4d0c5f91f6136f6619e97c4ace /core/app/helpers
parentcb6442c344d6bdaf52c3878b2de2fcf4d85f2648 (diff)
moving all of core into toplevel, tests fail.
Diffstat (limited to 'core/app/helpers')
-rw-r--r--core/app/helpers/core_helper.rb13
-rw-r--r--core/app/helpers/download_helper.rb33
-rw-r--r--core/app/helpers/navigation_helper.rb82
3 files changed, 0 insertions, 128 deletions
diff --git a/core/app/helpers/core_helper.rb b/core/app/helpers/core_helper.rb
deleted file mode 100644
index a6c7479..0000000
--- a/core/app/helpers/core_helper.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Misc. helpers needed throughout.
-#
-module CoreHelper
-
- #
- # insert common buttons (download, login, etc)
- #
- def home_page_buttons(on_user_page = false)
- render 'common/home_page_buttons', {:on_user_page => on_user_page}
- end
-
-end
diff --git a/core/app/helpers/download_helper.rb b/core/app/helpers/download_helper.rb
deleted file mode 100644
index ee0fe73..0000000
--- a/core/app/helpers/download_helper.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-module DownloadHelper
-
- def alternative_client_links(os = nil)
- alternative_clients(os).map do |client|
- link_to(I18n.t("os."+client), client_download_url(client))
- end
- end
-
- def alternative_clients(os = nil)
- available_clients - [os]
- end
-
- def client_download_url(os = nil)
- client_download_domain + client_download_path(os)
- end
-
- def client_download_path(os)
- download_paths[os.to_s] || download_paths['other'] || ''
- end
-
- def available_clients
- APP_CONFIG[:available_clients] || []
- end
-
- def client_download_domain
- APP_CONFIG[:client_download_domain] || ''
- end
-
- def download_paths
- APP_CONFIG[:download_paths] || {}
- end
-
-end
diff --git a/core/app/helpers/navigation_helper.rb b/core/app/helpers/navigation_helper.rb
deleted file mode 100644
index 19cb934..0000000
--- a/core/app/helpers/navigation_helper.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-module NavigationHelper
-
- #
- # used to create a side navigation link.
- #
- # Signature is the same as link_to, except it accepts an :active value in the html_options
- #
- def link_to_navigation(*args)
- if args.last.is_a? Hash
- html_options = args.pop.dup
- active_class = html_options.delete(:active) ? 'active' : nil
- html_options[:class] = [html_options[:class], active_class].join(' ')
- args << html_options
- else
- active_class = nil
- end
- content_tag :li, :class => active_class do
- link_to(*args)
- end
- end
-
- #
- # returns true if params[:action] matches one of the args.
- #
- def action?(*actions)
- actions.detect do |action|
- if action.is_a? String
- action == action_string
- elsif action.is_a? Symbol
- if action == :none
- action_string == nil
- else
- action == action_symbol
- end
- end
- end
- end
-
- #
- # returns true if params[:controller] matches one of the args.
- #
- # for example:
- # controller?(:me, :home)
- # controller?('groups/') <-- matches any controller in namespace 'groups'
- #
- def controller?(*controllers)
- controllers.each do |cntr|
- if cntr.is_a? String
- if cntr.ends_with?('/')
- return true if controller_string.starts_with?(cntr.chop)
- end
- return true if cntr == controller_string
- elsif cntr.is_a? Symbol
- return true if cntr == controller_symbol
- end
- end
- return false
- end
-
- private
-
- def controller_string
- @controller_string ||= params[:controller].to_s.gsub(/^\//, '')
- end
-
- def controller_symbol
- @controller_symbol ||= params[:controller].gsub(/^\//,'').gsub('/','_').to_sym
- end
-
- def action_string
- params[:action]
- end
-
- def action_symbol
- @action_symbol ||= if params[:action].present?
- params[:action].to_sym
- else
- nil
- end
- end
-
-end