summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2013-07-08 11:30:35 -0700
committerjessib <jessib@leap.se>2013-07-08 11:30:35 -0700
commitfc3c5994df61de04b8b17b495a638efc0d760126 (patch)
tree644aa93dfd0a6da2ed9b20ba688712fb9082f425 /app/helpers
parentcfb9e1d4c2e954222b77c4dd11e06ae3a0092be5 (diff)
parent3113f8b814417a896ad5340fda88927733f8ab22 (diff)
Merge branch 'master' into feature/disable_account
Conflicts: users/app/controllers/users_controller.rb users/app/helpers/users_helper.rb users/app/views/users/edit.html.haml users/app/views/users/show.html.haml users/config/locales/en.yml
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index de6be79..1e79990 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,2 +1,40 @@
module ApplicationHelper
+
+ #
+ # determine title for the page
+ #
+ def html_title
+ if content_for?(:title)
+ yield(:title)
+ elsif @title
+ [@title, ' - ', APP_CONFIG[:domain]].join
+ else
+ APP_CONFIG[:domain]
+ end
+ end
+
+ #
+ # markup for bootstrap icon
+ #
+ # http://twitter.github.io/bootstrap/base-css.html#icons
+ #
+ def icon(name, color=nil)
+ if color.nil?
+ color_class = nil
+ elsif color == :black
+ color_class = 'icon-black'
+ elsif color == :white
+ color_class = 'icon-white'
+ end
+ "<i class=\"icon-#{name} #{color_class}\"></i> ".html_safe
+ end
+
+ def big_icon(name, color=nil)
+ "<i class=\"big-icon-#{name}\"></i> ".html_safe
+ end
+
+ def format_flash(msg)
+ html_escape(msg).gsub('[b]', '<b>').gsub('[/b]', '</b>').html_safe
+ end
+
end