Commit e8dc04bbdb2f831f0bfc0327e2e0cc84df5b4f93
1 parent
efe6219c
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
added helper for the video gallery
Showing
2 changed files
with
20 additions
and
16 deletions
Show diff stats
| @@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
| 1 | +module VideoGalleryHelper | ||
| 2 | + | ||
| 3 | + def list_videos(configure={}) | ||
| 4 | + configure[:recursive] ||= false | ||
| 5 | + configure[:list_type] ||= :folder | ||
| 6 | + if !configure[:contents].blank? | ||
| 7 | + configure[:contents] = configure[:contents].paginate( | ||
| 8 | + :order => "updated_at DESC", | ||
| 9 | + :per_page => 16, | ||
| 10 | + :page => params[:npage] | ||
| 11 | + ) | ||
| 12 | + render :file => 'shared/video_list', :locals => configure | ||
| 13 | + else | ||
| 14 | + content_tag('em', _('(empty folder)')) | ||
| 15 | + end | ||
| 16 | + end | ||
| 17 | + | ||
| 18 | +end | ||
| 0 | \ No newline at end of file | 19 | \ No newline at end of file |
plugins/video/views/content_viewer/_video_gallery.html.erb
| 1 | -<% | ||
| 2 | -def self.list_videos(configure={}) | ||
| 3 | - configure[:recursive] ||= false | ||
| 4 | - configure[:list_type] ||= :folder | ||
| 5 | - if !configure[:contents].blank? | ||
| 6 | - configure[:contents] = configure[:contents].paginate( | ||
| 7 | - :order => "updated_at DESC", | ||
| 8 | - :per_page => 16, | ||
| 9 | - :page => params[:npage] | ||
| 10 | - ) | ||
| 11 | - render :file => 'shared/video_list', :locals => configure | ||
| 12 | - else | ||
| 13 | - content_tag('em', _('(empty folder)')) | ||
| 14 | - end | ||
| 15 | - end | ||
| 16 | -%> | 1 | +<% extend VideoPlugin::VideoGalleryHelper %> |
| 2 | + | ||
| 17 | <% unless video_gallery.body.blank? %> | 3 | <% unless video_gallery.body.blank? %> |
| 18 | <div> | 4 | <div> |
| 19 | <%= video_gallery.body %> | 5 | <%= video_gallery.body %> |