Sha256: 5441f6325caef7b840b6334d646af33c60a1c7e89a5b4e203ec9ae5daf8a0b7c
Contents?: true
Size: 1.17 KB
Versions: 14
Compression:
Stored size: 1.17 KB
Contents
module Semantic module Ui module Sass module BreadCrumbs def self.included(base) base.extend(ClassMethods) end module ClassMethods def semantic_breadcrumb(name, url, options = {}) class_name = self.name before_filter options do |controller| name = controller.send :translate_semantic_breadcrumb, name, class_name if name.is_a?(Symbol) controller.send :semantic_breadcrumb, name, url end end end protected def semantic_breadcrumb(name, url = '', options = {}) @breadcrumbs ||= [] name = translate_semantic_breadcrumb(name, self.class.name) if name.is_a?(Symbol) url = eval(url.to_s) if url =~ /_path|_url|@/ @breadcrumbs << {:name => name, :url => url, :options => options} end def translate_semantic_breadcrumb(name, class_name) scope = [:breadcrumbs] namespace = class_name.underscore.split('/') namespace.last.sub!('_controller', '') scope += namespace I18n.t name, :scope => scope end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems