refinerycms-slideshow 2.0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/README.md +13 -0
  2. data/app/controllers/refinery/slideshow/admin/slides_controller.rb +37 -0
  3. data/app/controllers/refinery/slideshow/admin/slideshows_controller.rb +12 -0
  4. data/app/models/refinery/slideshow/slide.rb +18 -0
  5. data/app/models/refinery/slideshow/slideshow.rb +8 -0
  6. data/app/views/refinery/slideshow/admin/slides/_actions.html.erb +21 -0
  7. data/app/views/refinery/slideshow/admin/slides/_form.html.erb +13 -0
  8. data/app/views/refinery/slideshow/admin/slides/_index.html.erb +7 -0
  9. data/app/views/refinery/slideshow/admin/slides/_inner_form.html.erb +32 -0
  10. data/app/views/refinery/slideshow/admin/slides/_records.html.erb +17 -0
  11. data/app/views/refinery/slideshow/admin/slides/_slide.html.erb +15 -0
  12. data/app/views/refinery/slideshow/admin/slides/edit.html.erb +3 -0
  13. data/app/views/refinery/slideshow/admin/slides/new.html.erb +3 -0
  14. data/app/views/refinery/slideshow/admin/slideshows/_actions.html.erb +25 -0
  15. data/app/views/refinery/slideshow/admin/slideshows/_form.html.erb +12 -0
  16. data/app/views/refinery/slideshow/admin/slideshows/_index.html.erb +6 -0
  17. data/app/views/refinery/slideshow/admin/slideshows/_inner_form.html.erb +4 -0
  18. data/app/views/refinery/slideshow/admin/slideshows/_records.html.erb +18 -0
  19. data/app/views/refinery/slideshow/admin/slideshows/_slideshow.html.erb +15 -0
  20. data/app/views/refinery/slideshow/admin/slideshows/_slideshows.html.erb +1 -0
  21. data/app/views/refinery/slideshow/admin/slideshows/edit.html.erb +6 -0
  22. data/app/views/refinery/slideshow/admin/slideshows/index.html.erb +1 -0
  23. data/app/views/refinery/slideshow/admin/slideshows/new.html.erb +2 -0
  24. data/db/migrate/20130730083202_create_slideshows.rb +9 -0
  25. data/db/migrate/20130730140608_create_slides.rb +10 -0
  26. data/db/migrate/20130730150101_add_translation_to_slide.rb +16 -0
  27. data/db/migrate/20130731111538_add_position_to_slide.rb +5 -0
  28. data/lib/refinery/slideshow/engine.rb +26 -0
  29. data/lib/refinery/slideshow.rb +19 -0
  30. data/lib/refinerycms-slideshow.rb +1 -0
  31. metadata +122 -0
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ This a RefineryCMS plugin for managing slideshows in the backend. It's intended to include some kind of helper + JS code so we can have a slideshow without having to write again the HTML, but for now thatś just a dream.
2
+
3
+ Current status
4
+ ==============
5
+
6
+ The plugin right now includes a backend that allow us to create a slideshow and attach it slides with images, videos and an html body.
7
+
8
+ To Do
9
+ =====
10
+
11
+ * Attach a slideshow to an object: "This product must have an slideshow", "I want an slideshow in this refinery page"... Imagine if we just can reuse the slideshow admin!
12
+
13
+ * Some default front helpers: This way we could have a slideshow running without any extra front effort
@@ -0,0 +1,37 @@
1
+ module Refinery
2
+ module Slideshow
3
+ module Admin
4
+ class SlidesController < ::Refinery::AdminController
5
+
6
+ before_filter :find_slideshow
7
+ before_filter :set_slideshow, only: [:create, :update]
8
+
9
+ crudify :'refinery/slideshow/slide', redirect_to_url: :redirect_url
10
+
11
+ def find_slideshow
12
+ @slideshow ||= Refinery::Slideshow::Slideshow.find(params[:slideshow_id]) unless params[:slideshow_id].nil?
13
+ error_404 if @slideshow.nil?
14
+ end
15
+ private :find_slideshow
16
+
17
+ def set_slideshow
18
+ params[:slide][:slideshow_id] = @slideshow.id unless @slideshow.nil?
19
+ end
20
+ private :find_slideshow
21
+
22
+ def find_slide
23
+ find_slideshow
24
+ @slide = @slideshow.slides.find(params[:id])
25
+ end
26
+ private :find_slide
27
+
28
+ def redirect_url
29
+ refinery.edit_slideshow_admin_slideshow_path @slideshow
30
+ end
31
+ private :redirect_url
32
+
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,12 @@
1
+ module Refinery
2
+ module Slideshow
3
+ module Admin
4
+ class SlideshowsController < ::Refinery::AdminController
5
+
6
+ crudify :'refinery/slideshow/slideshow',
7
+ :title_attribute => 'uid'
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ module Refinery::Slideshow
2
+ class Slide < ActiveRecord::Base
3
+
4
+ belongs_to :slideshow
5
+ translates :title, :body, :slide_image_uid, :slide_image_name, :video_url, fallbacks_for_empty_translations: true
6
+
7
+ image_accessor :slide_image if respond_to?(:image_accessor)
8
+
9
+ class Translation
10
+ attr_accessible :title, :body, :slide_image, :video_url
11
+ end
12
+
13
+ def video
14
+ @video ||= UnvlogIt.new(video_url) unless video_url.nil? rescue nil
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,8 @@
1
+ class Refinery::Slideshow::Slideshow < ActiveRecord::Base
2
+ attr_accessible :uid
3
+
4
+ has_many :slides
5
+
6
+ validates :uid, presence: true
7
+ validates :uid, uniqueness: true
8
+ end
@@ -0,0 +1,21 @@
1
+ <ul>
2
+ <li>
3
+ <%= link_to t('.create_new'), refinery.new_slideshow_admin_slideshow_slide_path(slideshow),
4
+ :class => "add_icon" %>
5
+ </li>
6
+ <% if !searching? && ::Refinery::Slideshow::Admin::SlidesController.sortable? && records.count > 1 %>
7
+ <li>
8
+ <%= link_to t('.reorder'),
9
+ refinery.edit_slideshow_admin_slideshow_path(slideshow),
10
+ :id => "reorder_action",
11
+ :class => "reorder_icon" %>
12
+
13
+ <%= link_to t('.reorder_done'),
14
+ refinery.edit_slideshow_admin_slideshow_path(slideshow),
15
+ :id => "reorder_action_done",
16
+ :style => "display: none;",
17
+ :class => "reorder_icon" %>
18
+ </li>
19
+ <% end %>
20
+ </ul>
21
+
@@ -0,0 +1,13 @@
1
+ <%= form_for [refinery, :slideshow_admin, @slideshow, object], html: {multipart: true} do |f| -%>
2
+ <%= render '/refinery/admin/error_messages',
3
+ :object => object,
4
+ :include_object_name => true %>
5
+
6
+ <%= render "/refinery/slideshow/admin/slides/inner_form", f: f, object: object %>
7
+
8
+ <%= render '/refinery/admin/form_actions', :f => f,
9
+ :continue_editing => true,
10
+ :delete_title => t('delete', :scope => "refinery.slideshow.admin.slideshows"),
11
+ :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => object.title),
12
+ :delete_url => [refinery, :slideshow_admin, @slideshow, object] %>
13
+ <% end -%>
@@ -0,0 +1,7 @@
1
+ <section id='records'>
2
+ <%= render 'refinery/slideshow/admin/slides/records', records: records %>
3
+ </section>
4
+ <aside id='actions'>
5
+ <%= render 'refinery/slideshow/admin/slides/actions', records: records, slideshow: slideshow %>
6
+ </aside>
7
+ <%= render '/refinery/admin/make_sortable', :tree => false, update_url: refinery.update_positions_slideshow_admin_slideshow_slides_path(slideshow) if !searching? and controller.class.sortable? and records.count > 1 %>
@@ -0,0 +1,32 @@
1
+ <div class='field'>
2
+ <%= f.label :title -%>
3
+ <%= f.text_field :title, :class => 'larger widest' -%>
4
+ </div>
5
+
6
+ <div class='field'>
7
+ <%= f.label :body -%>
8
+ <%= f.text_area :body, :class => 'widest wymeditor' -%>
9
+ </div>
10
+
11
+ <div class='field'>
12
+ <%= f.label :video_url -%>
13
+ <%= f.text_field :video_url -%>
14
+ </div>
15
+
16
+ <% unless f.object.video.nil? %>
17
+ <%= raw f.object.video.embed_html %>
18
+ <% end %>
19
+
20
+
21
+ <div class='field'>
22
+ <%= f.label :slide_image -%>
23
+ <%= f.file_field :slide_image -%>
24
+ <%= f.hidden_field :retained_slide_image %>
25
+ </div>
26
+
27
+ <% unless f.object.slide_image.nil? %>
28
+ <%= image_tag f.object.slide_image.url %>
29
+
30
+ <%= f.label :remove_slide_image, t('.remove_slide_image') -%>
31
+ <%= f.check_box :remove_slide_image %>
32
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <div class='pagination_container'>
2
+ <% if records.any? %>
3
+
4
+ <ul id='sortable_list'>
5
+ <%= render partial: "/refinery/slideshow/admin/slides/slide", collection: records.order(:position), as: 'slide' %>
6
+ </ul>
7
+ <%= render '/refinery/admin/sortable_list',
8
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %>
9
+
10
+ <% else %>
11
+ <p>
12
+ <strong>
13
+ <%= t('.no_items_yet') %>
14
+ </strong>
15
+ </p>
16
+ <% end %>
17
+ </div>
@@ -0,0 +1,15 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(slide) -%>">
2
+ <span class='title'>
3
+ <%= slide.title %>
4
+ </span>
5
+ <span class='actions'>
6
+
7
+ <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_slideshow_admin_slideshow_slide_path(slide.slideshow, slide),
8
+ :title => t('.edit') %>
9
+ <%= link_to refinery_icon_tag("delete.png"), refinery.slideshow_admin_slideshow_slide_path(slide.slideshow, slide),
10
+ :class => "cancel confirm-delete",
11
+ :title => t('.delete'),
12
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => slide.title),
13
+ :method => :delete %>
14
+ </span>
15
+ </li>
@@ -0,0 +1,3 @@
1
+ <h1><%= t '.title', slideshow: @slideshow.uid %></h1>
2
+ <%= render 'refinery/slideshow/admin/slides/form', object: @slide %>
3
+
@@ -0,0 +1,3 @@
1
+ <h1><%= t '.title', slideshow: @slideshow.uid %></h1>
2
+ <%= render 'refinery/slideshow/admin/slides/form', object: @slide %>
3
+
@@ -0,0 +1,25 @@
1
+ <ul>
2
+ <li>
3
+ <%= link_to t('.create_new'), refinery.new_slideshow_admin_slideshow_path,
4
+ :class => "add_icon" %>
5
+ </li>
6
+ <li>
7
+ <%= link_to t('.list'), refinery.slideshow_admin_slideshows_path,
8
+ :class => "manage_icon" %>
9
+ </li>
10
+ <% if !searching? && ::Refinery::Slideshow::Admin::SlideshowsController.sortable? && ::Refinery::Slideshow::Slideshow.any? %>
11
+ <li>
12
+ <%= link_to t('.reorder'),
13
+ refinery.slideshow_admin_slideshows_path,
14
+ :id => "reorder_action",
15
+ :class => "reorder_icon" %>
16
+
17
+ <%= link_to t('.reorder_done'),
18
+ refinery.slideshow_admin_slideshows_path,
19
+ :id => "reorder_action_done",
20
+ :style => "display: none;",
21
+ :class => "reorder_icon" %>
22
+ </li>
23
+ <% end %>
24
+ </ul>
25
+
@@ -0,0 +1,12 @@
1
+ <%= form_for [refinery, :slideshow_admin, object], html: {multipart: true} do |f| -%>
2
+ <%= render '/refinery/admin/error_messages',
3
+ :object => object,
4
+ :include_object_name => true %>
5
+
6
+ <%= render "/refinery/slideshow/admin/slideshows/inner_form", f: f, object: object %>
7
+
8
+ <%= render '/refinery/admin/form_actions', :f => f,
9
+ :continue_editing => true,
10
+ :delete_title => t('delete', :scope => "refinery.slideshow.admin.slideshows"),
11
+ :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => object.uid) %>
12
+ <% end -%>
@@ -0,0 +1,6 @@
1
+ <section id='records'>
2
+ <%= render 'refinery/slideshow/admin/slideshows/records', records: records %>
3
+ </section>
4
+ <aside id='actions'>
5
+ <%= render 'actions' %>
6
+ </aside>
@@ -0,0 +1,4 @@
1
+ <div class='field'>
2
+ <%= f.label :uid -%>
3
+ <%= f.text_field :uid, :class => 'larger widest' -%>
4
+ </div>
@@ -0,0 +1,18 @@
1
+ <div class='pagination_container'>
2
+ <% if records.any? %>
3
+
4
+ <%= will_paginate records if controller.class.pageable? %>
5
+ <ul id='sortable_list'>
6
+ <%= render partial: "/refinery/slideshow/admin/slideshows/slideshow", collection: records, as: 'slideshow' %>
7
+ </ul>
8
+ <%= render '/refinery/admin/sortable_list',
9
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %>
10
+
11
+ <% else %>
12
+ <p>
13
+ <strong>
14
+ <%= t('.no_items_yet') %>
15
+ </strong>
16
+ </p>
17
+ <% end %>
18
+ </div>
@@ -0,0 +1,15 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(slideshow) -%>">
2
+ <span class='title'>
3
+ <%= slideshow.uid %>
4
+ </span>
5
+ <span class='actions'>
6
+
7
+ <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_slideshow_admin_slideshow_path(slideshow),
8
+ :title => t('.edit') %>
9
+ <%= link_to refinery_icon_tag("delete.png"), refinery.slideshow_admin_slideshow_path(slideshow),
10
+ :class => "cancel confirm-delete",
11
+ :title => t('.delete'),
12
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => slideshow.uid),
13
+ :method => :delete %>
14
+ </span>
15
+ </li>
@@ -0,0 +1 @@
1
+ <%= render 'refinery/slideshow/admin/slideshows/records', records: @slideshows %>
@@ -0,0 +1,6 @@
1
+ <%= render 'refinery/slideshow/admin/slideshows/form', object: @slideshow %>
2
+
3
+ <h2><%= t '.slides' %></h2>
4
+ <%= render 'refinery/slideshow/admin/slides/index', records: @slideshow.slides, slideshow: @slideshow %>
5
+
6
+
@@ -0,0 +1 @@
1
+ <%= render 'refinery/slideshow/admin/slideshows/index', records: @slideshows %>
@@ -0,0 +1,2 @@
1
+ <%= render 'refinery/slideshow/admin/slideshows/form', object: @slideshow %>
2
+
@@ -0,0 +1,9 @@
1
+ class CreateSlideshows < ActiveRecord::Migration
2
+ def change
3
+ create_table Refinery::Slideshow::Slideshow.table_name do |t|
4
+ t.string :uid
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateSlides < ActiveRecord::Migration
2
+ def change
3
+ create_table Refinery::Slideshow::Slide.table_name do |t|
4
+ t.belongs_to :slideshow
5
+
6
+ t.timestamps
7
+ end
8
+ add_index Refinery::Slideshow::Slide.table_name, :slideshow_id
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ class AddTranslationToSlide < ActiveRecord::Migration
2
+ def change
3
+ create_table Refinery::Slideshow::Slide::Translation.table_name do |t|
4
+ t.belongs_to Refinery::Slideshow::Slide.table_name.singularize
5
+
6
+ t.string :title
7
+ t.text :body
8
+ t.string :slide_image_uid
9
+ t.string :slide_image_name
10
+ t.string :video_url
11
+
12
+ t.string :locale
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ class AddPositionToSlide < ActiveRecord::Migration
2
+ def change
3
+ add_column Refinery::Slideshow::Slide.table_name, :position, :integer
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ module Refinery
2
+ module Slideshow
3
+ class Engine < Rails::Engine
4
+ include Refinery::Engine
5
+
6
+ isolate_namespace Refinery::Slideshow
7
+
8
+ initializer "register refinerycms_slideshow plugin" do
9
+ Refinery::Plugin.register do |plugin|
10
+ plugin.pathname = root
11
+ plugin.name = "refinerycms_slideshow"
12
+ plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.slideshow_admin_slideshows_path }
13
+ plugin.menu_match = /refinery\/slideshow\/?/
14
+ plugin.activity = { :class_name => :'refinery/slideshow/slideshow' }
15
+ end
16
+ end
17
+
18
+ config.after_initialize do
19
+ Refinery.register_engine(Refinery::Slideshow)
20
+ end
21
+
22
+ paths["config/locales"] << "config/locales/**"
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ require 'refinerycms-core'
2
+
3
+ module Refinery
4
+
5
+ module Slideshow
6
+ require 'refinery/slideshow/engine'
7
+ attr_writer :root
8
+
9
+ class << self
10
+ def root
11
+ @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
12
+ end
13
+
14
+ def factory_paths
15
+ @factory_paths ||= [ root.join("spec/factories").to_s ]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1 @@
1
+ require 'refinery/slideshow'
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refinerycms-slideshow
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.10.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - david.brenes@the-cocktail.com
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: refinerycms-core
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.10
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.10
30
+ - !ruby/object:Gem::Dependency
31
+ name: refinerycms-i18n
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.0.0
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: refinerycms-testing
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.0.10
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.10
62
+ description: RefineryCMS plugin for managing slideshows
63
+ email:
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - app/models/refinery/slideshow/slide.rb
69
+ - app/models/refinery/slideshow/slideshow.rb
70
+ - app/views/refinery/slideshow/admin/slideshows/_actions.html.erb
71
+ - app/views/refinery/slideshow/admin/slideshows/new.html.erb
72
+ - app/views/refinery/slideshow/admin/slideshows/_inner_form.html.erb
73
+ - app/views/refinery/slideshow/admin/slideshows/edit.html.erb
74
+ - app/views/refinery/slideshow/admin/slideshows/_slideshows.html.erb
75
+ - app/views/refinery/slideshow/admin/slideshows/index.html.erb
76
+ - app/views/refinery/slideshow/admin/slideshows/_records.html.erb
77
+ - app/views/refinery/slideshow/admin/slideshows/_slideshow.html.erb
78
+ - app/views/refinery/slideshow/admin/slideshows/_form.html.erb
79
+ - app/views/refinery/slideshow/admin/slideshows/_index.html.erb
80
+ - app/views/refinery/slideshow/admin/slides/_actions.html.erb
81
+ - app/views/refinery/slideshow/admin/slides/new.html.erb
82
+ - app/views/refinery/slideshow/admin/slides/_inner_form.html.erb
83
+ - app/views/refinery/slideshow/admin/slides/edit.html.erb
84
+ - app/views/refinery/slideshow/admin/slides/_records.html.erb
85
+ - app/views/refinery/slideshow/admin/slides/_form.html.erb
86
+ - app/views/refinery/slideshow/admin/slides/_slide.html.erb
87
+ - app/views/refinery/slideshow/admin/slides/_index.html.erb
88
+ - app/controllers/refinery/slideshow/admin/slides_controller.rb
89
+ - app/controllers/refinery/slideshow/admin/slideshows_controller.rb
90
+ - db/migrate/20130730140608_create_slides.rb
91
+ - db/migrate/20130731111538_add_position_to_slide.rb
92
+ - db/migrate/20130730083202_create_slideshows.rb
93
+ - db/migrate/20130730150101_add_translation_to_slide.rb
94
+ - lib/refinerycms-slideshow.rb
95
+ - lib/refinery/slideshow/engine.rb
96
+ - lib/refinery/slideshow.rb
97
+ - README.md
98
+ homepage:
99
+ licenses: []
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 1.8.24
119
+ signing_key:
120
+ specification_version: 3
121
+ summary: RefineryCMS plugin for managing slideshows
122
+ test_files: []