Module: Admin::Atreides::PostsHelper
- Includes:
- Atreides::Extendable
- Defined in:
- app/helpers/admin/atreides/posts_helper.rb
Instance Method Summary collapse
- #edit_videos_for_assoc(resource, list_id = "videos_list", resource_type = "post") ⇒ Object
- #error_messages_for_post ⇒ Object
- #video_for_assoc(video, list_id, resource_type = "post") ⇒ Object
Instance Method Details
#edit_videos_for_assoc(resource, list_id = "videos_list", resource_type = "post") ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/admin/atreides/posts_helper.rb', line 9 def edit_videos_for_assoc(resource, list_id = "videos_list", resource_type="post") if resource and resource.respond_to?(:videos) content_tag(:div, :id => "#{list_id}_container", :class => "videos-list media-list") do content_tag(:ul, :id => list_id) do resource.videos.map do |video| video_for_assoc(video, list_id, resource_type) end.join.html_safe end + sortable_element(list_id, :axis => "x") end end end |
#error_messages_for_post ⇒ Object
3 4 5 6 7 |
# File 'app/helpers/admin/atreides/posts_helper.rb', line 3 def :post, :header_message => ttt(:validation_error_header, :model => @type.to_s), :message => ttt(:validation_error_message) end |
#video_for_assoc(video, list_id, resource_type = "post") ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/admin/atreides/posts_helper.rb', line 22 def video_for_assoc(video, list_id, resource_type="post") # Each video width = 186 height = 124 = video. content_tag(:li, :id => video.dom_id(list_id)) do hidden_field_tag("#{resource_type}[parts_attributes][0][video_ids][]", video.id) + if video.new_record? link_to_function image_tag("atreides/admin/remove.png"), "$('##{video.dom_id(list_id)}').fadeOut(function(){ $(this).remove() })" else link_to(image_tag("atreides/admin/remove.png"), admin_video_path(video, :format => :js, :list_id => list_id), :remote => true, :'data-method' => :delete, :confirm => "Are you sure?") end + content_tag(:div, video.(:width => width, :height => height).html_safe, :id => video.dom_id) + text_area_tag("#{resource_type}[parts_attributes][0][videos_attributes][][caption]", video.) + hidden_field_tag("#{resource_type}[parts_attributes][0][videos_attributes][][id]", video.id) end end |