refinerycms-videos 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ module Admin
2
+ class VideosController < Admin::BaseController
3
+
4
+ crudify :video,
5
+ :title_attribute => 'name', :xhr_paging => true
6
+
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+ class VideosController < ApplicationController
2
+
3
+ before_filter :find_page
4
+
5
+ def index
6
+ @videos = Video.order('position ASC')
7
+
8
+ # you can use meta fields from your model instead (e.g. browser_title)
9
+ # by swapping @page for @video in the line below:
10
+ present(@page)
11
+ end
12
+
13
+ protected
14
+
15
+ def find_page
16
+ @page = Page.where(:link_url => "/videos").first
17
+ end
18
+
19
+ end
@@ -0,0 +1,8 @@
1
+ class Video < ActiveRecord::Base
2
+
3
+ acts_as_indexed :fields => [:name, :youtube_url, :body]
4
+
5
+ validates :name, :presence => true
6
+ validates :youtube_url, :presence => true
7
+
8
+ end
@@ -0,0 +1,28 @@
1
+ <ul>
2
+ <% if Admin::VideosController.searchable? %>
3
+ <li>
4
+ <%= render :partial => "/shared/admin/search",
5
+ :locals => {
6
+ :url => admin_videos_path
7
+ } %>
8
+ </li>
9
+ <% end %>
10
+ <li>
11
+ <%= link_to t('.create_new'), new_admin_video_path,
12
+ :class => "add_icon" %>
13
+ </li>
14
+ <% if !searching? and Admin::VideosController.sortable? and Video.count > 1 %>
15
+ <li>
16
+ <%= link_to t('.reorder', :what => "Videos"),
17
+ admin_videos_path,
18
+ :id => "reorder_action",
19
+ :class => "reorder_icon" %>
20
+
21
+ <%= link_to t('.reorder_done', :what => "Videos"),
22
+ admin_videos_path,
23
+ :id => "reorder_action_done",
24
+ :style => "display: none;",
25
+ :class => "reorder_icon" %>
26
+ </li>
27
+ <% end %>
28
+ </ul>
@@ -0,0 +1,51 @@
1
+ <%= form_for [:admin, @video] do |f| -%>
2
+ <%= render :partial => "/shared/admin/error_messages", :locals => {
3
+ :object => @video,
4
+ :include_object_name => true
5
+ } %>
6
+
7
+ <div class='field'>
8
+ <%= f.label :name -%>
9
+ <%= f.text_field :name, :class => 'larger widest' -%>
10
+ </div>
11
+
12
+ <div class='field'>
13
+ <%= f.label :youtube_url -%>
14
+ <%= f.text_field :youtube_url -%>
15
+ </div>
16
+
17
+ <div class='field'>
18
+ <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
19
+ <ul id='page_parts'>
20
+ <% [:body].each_with_index do |part, part_index| %>
21
+ <li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
22
+ <%= link_to part.to_s.titleize, "##{part}" %>
23
+ </li>
24
+ <% end %>
25
+ </ul>
26
+
27
+ <div id='page_part_editors'>
28
+ <% [:body].each do |part| %>
29
+ <div class='page_part' id='<%= part %>'>
30
+ <%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
31
+ </div>
32
+ <% end %>
33
+ </div>
34
+ </div>
35
+ </div>
36
+
37
+ <%= render :partial => "/shared/admin/form_actions",
38
+ :locals => {
39
+ :f => f,
40
+ :continue_editing => false,
41
+ :delete_title => t('delete', :scope => 'admin.videos.video'),
42
+ :delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @video.name)
43
+ } %>
44
+ <% end -%>
45
+ <% content_for :javascripts do %>
46
+ <script>
47
+ $(document).ready(function(){
48
+ page_options.init(false, '', '');
49
+ });
50
+ </script>
51
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <% if searching? %>
2
+ <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
3
+ <% end %>
4
+ <% if @videos.any? %>
5
+ <div class='pagination_container'>
6
+ <%= render :partial => 'videos' %>
7
+ </div>
8
+ <% else %>
9
+ <p>
10
+ <% unless searching? %>
11
+ <strong>
12
+ <%= t('.no_items_yet') %>
13
+ </strong>
14
+ <% else %>
15
+ <%= t('no_results', :scope => 'shared.admin.search') %>
16
+ <% end %>
17
+ </p>
18
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <ul id='sortable_list'>
2
+ <%= render :partial => 'video', :collection => @videos %>
3
+ </ul>
4
+ <%= render :partial => "/shared/admin/sortable_list",
5
+ :locals => {
6
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
7
+ } %>
@@ -0,0 +1,15 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(video) -%>">
2
+ <span class='title'>
3
+ <%= video.name %>
4
+ <span class="preview">&nbsp;</span>
5
+ </span>
6
+ <span class='actions'>
7
+ <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_video_path(video),
8
+ :title => t('.edit') %>
9
+ <%= link_to refinery_icon_tag("delete.png"), admin_video_path(video),
10
+ :class => "cancel confirm-delete",
11
+ :title => t('.delete'),
12
+ :confirm => t('message', :scope => 'shared.admin.delete', :title => video.name),
13
+ :method => :delete %>
14
+ </span>
15
+ </li>
@@ -0,0 +1,2 @@
1
+ <%= will_paginate @videos %>
2
+ <%= render :partial => "sortable_list" %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,10 @@
1
+ <section id='records'>
2
+ <%= render :partial => 'records' %>
3
+ </section>
4
+ <aside id='actions'>
5
+ <%= render :partial => 'actions' %>
6
+ </aside>
7
+ <%= render :partial => '/shared/admin/make_sortable',
8
+ :locals => {
9
+ :tree => false
10
+ } if !searching? and Admin::VideosController.sortable? and Video.count > 1 %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,5 @@
1
+ <div class="tilevideo" targeturl="<%= video.youtube_url %>">
2
+ <h1><%= video.name %></h1>
3
+ <%= link_to('', video.youtube_url, :class => "ytlink") %>
4
+ <%= raw(video.body) %>
5
+ </div>
@@ -0,0 +1,15 @@
1
+ <% content_for :body_content_title do -%>
2
+ Videos
3
+ <% end -%>
4
+
5
+ <% content_for :body_content_left do %>
6
+ <ul class="videos">
7
+ <% @videos.each do |video| %>
8
+ <li>
9
+ <%= render :partial => 'shared/video', :locals => {:video => video} %>
10
+ </li>
11
+ <% end %>
12
+ </ul>
13
+ <% end %>
14
+
15
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,25 @@
1
+ en:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: image
6
+ plugins:
7
+ videos:
8
+ title: Videos
9
+ admin:
10
+ videos:
11
+ actions:
12
+ create_new: Add New Video
13
+ reorder: Reorder Videos
14
+ reorder_done: Done Reordering Videos
15
+ records:
16
+ title: Videos
17
+ sorry_no_results: Sorry! There are no results found.
18
+ no_items_yet: There are no Videos yet. Click "Add New Video" to add your first video.
19
+ video:
20
+ view_live_html: View this video live <br/><em>(opens in a new window)</em>
21
+ edit: Edit this video
22
+ delete: Remove this video forever
23
+ videos:
24
+ show:
25
+ other: Other Videos
@@ -0,0 +1,25 @@
1
+ fr:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: image
6
+ plugins:
7
+ videos:
8
+ title: Videos
9
+ admin:
10
+ videos:
11
+ actions:
12
+ create_new: Créer un(e) nouve(au/l/lle) Video
13
+ reorder: Réordonner les Videos
14
+ reorder_done: Fin de réordonnancement des Videos
15
+ records:
16
+ title: Videos
17
+ sorry_no_results: "Désolé ! Aucun résultat."
18
+ no_items_yet: 'Il n''y a actuellement aucun(e) Video. Cliquer sur "Créer un(e) nouve(au/l/lle) Video" pour créer votre premi(er/ère) video.'
19
+ video:
20
+ view_live_html: Voir ce(t/tte) video <br/><em>(Ouvre une nouvelle fenêtre)</em>
21
+ edit: Modifier ce(t/tte) video
22
+ delete: Supprimer définitivement ce(t/tte) video
23
+ videos:
24
+ show:
25
+ other: Autres Videos
@@ -0,0 +1,25 @@
1
+ lolcat:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: IMAGE
6
+ plugins:
7
+ videos:
8
+ title: Videos
9
+ admin:
10
+ videos:
11
+ actions:
12
+ create_new: CREATE NEW Video
13
+ reorder: REORDR Videos
14
+ reorder_done: DUN REORDERIN Videos
15
+ records:
16
+ title: Videos
17
+ sorry_no_results: SRY! THAR R NO RESULTS FINDZ.
18
+ no_items_yet: THAR R NO Videos YET. CLICK "CREATE NEW Video" 2 ADD UR FURST video.
19
+ video:
20
+ view_live_html: VIEW DIS video LIV <BR/><EM>(OPENS IN NEW WINDOW)</EM>
21
+ edit: EDIT DIS video
22
+ delete: REMOOV DIS video FOREVR
23
+ videos:
24
+ show:
25
+ other: OTHR Videos
@@ -0,0 +1,21 @@
1
+ nb:
2
+ plugins:
3
+ videos:
4
+ title: Videos
5
+ admin:
6
+ videos:
7
+ actions:
8
+ create_new: Lag en ny Video
9
+ reorder: Endre rekkefølgen på Videos
10
+ reorder_done: Ferdig å endre rekkefølgen Videos
11
+ records:
12
+ title: Videos
13
+ sorry_no_results: Beklager! Vi fant ikke noen resultater.
14
+ no_items_yet: Det er ingen Videos enda. Klikk på "Lag en ny Video" for å legge til din første video.
15
+ video:
16
+ view_live_html: Vis hvordan denne video ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
17
+ edit: Rediger denne video
18
+ delete: Fjern denne video permanent
19
+ videos:
20
+ show:
21
+ other: Andre Videos
@@ -0,0 +1,21 @@
1
+ nl:
2
+ plugins:
3
+ videos:
4
+ title: Videos
5
+ admin:
6
+ videos:
7
+ actions:
8
+ create_new: Maak een nieuwe Video
9
+ reorder: Wijzig de volgorde van de Videos
10
+ reorder_done: Klaar met het wijzingen van de volgorde van de Videos
11
+ records:
12
+ title: Videos
13
+ sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
14
+ no_items_yet: Er zijn nog geen Videos. Druk op 'Maak een nieuwe Video' om de eerste aan te maken.
15
+ video:
16
+ view_live_html: Bekijk deze video op de website <br/><em>(opent een nieuw venster)</em>
17
+ edit: Bewerk deze video
18
+ delete: Verwijder deze video voor eeuwig
19
+ videos:
20
+ show:
21
+ other: Andere Videos
data/config/routes.rb ADDED
@@ -0,0 +1,11 @@
1
+ ::Refinery::Application.routes.draw do
2
+ resources :videos, :only => [:index]
3
+
4
+ scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
5
+ resources :videos, :except => :show do
6
+ collection do
7
+ post :update_positions
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class RefinerycmsVideos < Refinery::Generators::EngineInstaller
2
+
3
+ source_root File.expand_path('../../../', __FILE__)
4
+ engine_name "videos"
5
+
6
+ end
@@ -0,0 +1,21 @@
1
+ require 'refinerycms-base'
2
+
3
+ module Refinery
4
+ module Videos
5
+ class Engine < Rails::Engine
6
+ initializer "static assets" do |app|
7
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
8
+ end
9
+
10
+ config.after_initialize do
11
+ Refinery::Plugin.register do |plugin|
12
+ plugin.name = "videos"
13
+ plugin.activity = {
14
+ :class => Video,
15
+ :title => 'name'
16
+ }
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :videos do
4
+
5
+ # call this task my running: rake refinery:videos:my_task
6
+ # desc "Description of my task below"
7
+ # task :my_task => :environment do
8
+ # # add your logic here
9
+ # end
10
+
11
+ end
12
+
13
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refinerycms-videos
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - James Thompson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-06-20 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Ruby on Rails Videos engine for Refinery CMS
15
+ email:
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/generators/refinerycms_videos_generator.rb
21
+ - lib/refinerycms-videos.rb
22
+ - lib/tasks/videos.rake
23
+ - config/locales/en.yml
24
+ - config/locales/fr.yml
25
+ - config/locales/lolcat.yml
26
+ - config/locales/nb.yml
27
+ - config/locales/nl.yml
28
+ - config/routes.rb
29
+ - app/controllers/admin/videos_controller.rb
30
+ - app/controllers/videos_controller.rb
31
+ - app/models/video.rb
32
+ - app/views/admin/videos/edit.html.erb
33
+ - app/views/admin/videos/index.html.erb
34
+ - app/views/admin/videos/new.html.erb
35
+ - app/views/admin/videos/_actions.html.erb
36
+ - app/views/admin/videos/_form.html.erb
37
+ - app/views/admin/videos/_records.html.erb
38
+ - app/views/admin/videos/_sortable_list.html.erb
39
+ - app/views/admin/videos/_video.html.erb
40
+ - app/views/admin/videos/_videos.html.erb
41
+ - app/views/shared/_video.html.erb
42
+ - app/views/videos/index.html.erb
43
+ homepage:
44
+ licenses: []
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 1.8.18
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Videos engine for Refinery CMS
67
+ test_files: []