Sha256: a17a8d3b8a2be78ec50f2cb2b80bd0c62ab39d83709c6aa7341d5f7b698acc51
Contents?: true
Size: 1.62 KB
Versions: 3
Compression:
Stored size: 1.62 KB
Contents
module Kea module ApplicationHelper def body_id content_for?(:body_id) ? content_for(:body_id) : [body_class, params[:action]].join('-') end def body_class controller.class.to_s.gsub('Controller', '').underscore.dasherize.gsub('/', '-') end def json_for(target, options = {}) options[:scope] ||= self options[:url_options] ||= url_options serializer = options[:serializer] || target.active_model_serializer serializer.new(target, options).to_json end def cache_json(object, path = nil, options = {}) unless path path = polymorphic_path(object) end content = json_for(object, options) content_for :json_cache, "window.app.cache['#{path}'] = #{content};\n".html_safe end def knockout_template(name, partial: nil, &block) content_for :knockout_templates do if partial content_tag :script, type: "text/html", id: name do render partial: partial end else content_tag :script, type: "text/html", id: name do capture(&block) end end end end def overlay_template(name, partial: nil, &block) content_for :knockout_templates do if partial content_tag :script, type: "text/html", id: name, "data-bind" => "overlayTemplate: '#{name}'" do render partial: partial end else content_tag :script, type: "text/html", id: name, "data-bind" => "overlayTemplate: '#{name}'" do capture(&block) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kea-rails-1.0.7 | app/helpers/kea/application_helper.rb |
kea-rails-1.0.6 | app/helpers/kea/application_helper.rb |
kea-rails-1.0.5 | app/helpers/kea/application_helper.rb |