Module: Transit::PackageHelper

Included in:
TransitHelper
Defined in:
app/helpers/transit/package_helper.rb

Instance Method Summary collapse

Instance Method Details

#deliver(obj) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/transit/package_helper.rb', line 15

def deliver(obj)
  if obj.respond_to?(:deliver)
    return obj.deliver
  end
  obj.contexts.ascending(:position).map do |field|
    unless field.media_context?
      render(:partial => "contexts/#{field.class.to_s.underscore}", :format => :html, :locals => { :context => field }).html_safe
    else
      deliver_media_context(field, field.to_backbone)          
    end
  end.join("\n").html_safe
end

#deliver_content(resource, force_edit = false, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'app/helpers/transit/package_helper.rb', line 5

def deliver_content(resource, force_edit = false, &block)
  return capture(resource, &block).html_safe unless force_edit || edit_mode_enabled?
  tpl  = resource.delivery_template
  with_output_buffer do
    concat(form_for([transit, resource], as: tpl, html: { remote: true, id: "transit_edit_#{tpl.to_s}" }) do |dform|
      concat(capture(Transit::Builders::PackageBuilder.new(resource, dform, nil), &block))
    end)
  end
end

#deliver_rss(post) ⇒ Object



28
29
30
# File 'app/helpers/transit/package_helper.rb', line 28

def deliver_rss(post)
  send(:"#{post.class.name.to_s.underscore}_path", post.slug)
end