Sha256: 3cd816bb11626ec1ec6dd542af605fec258d2768c69d9ce65551f3572cc39661
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 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 target.active_model_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 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
5 entries across 5 versions & 1 rubygems