fullstack-carousel 0.1.1 → 0.1.2

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.
data/README.md CHANGED
@@ -2,6 +2,42 @@
2
2
 
3
3
  Carousel plugin for fullstack cms
4
4
 
5
+ ## Installation
6
+
7
+ ``` rb
8
+ gem fullstack-cms
9
+
10
+ gem fullstack-carousel
11
+ ```
12
+
13
+ ``` sh
14
+ rails g fullstack:carousel:install
15
+
16
+ ```
17
+
18
+ ``` sh
19
+ rake db:migrate
20
+
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ``` rhtml
26
+
27
+ <%= carousel_page_part :slideshow do |item| %>
28
+
29
+ <img src="<%= item.photo.url %>" alt="">
30
+ <div class="carousel-caption">
31
+ <h4><%= item.label %></h4>
32
+ <p><%= item.description %></p>
33
+ </div>
34
+
35
+ <% end %>
36
+
37
+ ```
38
+
39
+
40
+
5
41
  ---
6
42
 
7
43
  Copyright (c) 2012 mcasimir
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,37 +1,51 @@
1
1
  module FullstackCarouselHelper
2
2
 
3
3
  # <%= carousel_page_part(:slideshow, :id => 'myCarousel') do |item| %>
4
- # <img src="<%= item.photo.url %>" alt="">
5
- # <div class="carousel-caption">
6
- # <h4><%= item.label %></h4>
7
- # <p><%= item.description %></p>
8
- # </div>
4
+ # <img src="<%= item.photo.url %>" alt="">
5
+ # <div class="carousel-caption">
6
+ # <h4><%= item.label %></h4>
7
+ # <p><%= item.description %></p>
8
+ # </div>
9
9
  # <% end %>
10
10
 
11
- def carousel_page_part(key, options = {}, &block)
11
+ def carousel_page_part(key, options = {}, &block)
12
+ @_fullstack_carousel_counter ||= 0
13
+ @_fullstack_carousel_counter += 1
14
+
12
15
  options = { :arrows => true }.merge(options)
13
- klass = ((options.delete(:class) || "").split(/\s+/) + [ "carousel" ]).join(" ")
14
- options[:class] = klass
16
+ htmlid = options.delete(:id) || "carousel-#{key}-#{@_fullstack_carousel_counter}"
17
+ htmlclass = ((options.delete(:class) || "").split(/\s+/) + [ "carousel" ]).join(" ")
18
+ options[:class] = htmlclass
19
+ options[:id] = htmlid
15
20
  arrows = !!options.delete(:arrows)
21
+
22
+ arrows_html = !arrows ? "" : <<-eos
23
+ <a class="carousel-control left" href="##{htmlid}" data-slide="prev">&lsaquo;</a>
24
+ <a class="carousel-control right" href="##{htmlid}" data-slide="next">&rsaquo;</a>
25
+ eos
26
+
27
+ items_html = ""
16
28
 
17
- content_tag :div, options
18
- content_tag :div, :class => "carousel-inner"
19
- part key, :schema => :slideshow do |slideshow|
20
-
21
- slideshow.items.each_with_index do |item, i|
22
- capture do
23
- content_tag :div, :class => ( i == 0 ? "item active" : "item" ) do
24
- yield(&block)
25
- end
29
+ part( key, :schema => :slideshow ) do |slideshow|
30
+ slideshow.items.each_with_index do |item, i|
31
+ slideshow_page = capture do
32
+ content_tag :div, :class => ( i == 0 ? "item active" : "item" ) do
33
+ yield(item)
26
34
  end
27
35
  end
28
-
29
- end
30
-
31
- # if arrow
32
- # <a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
33
- # <a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>
34
- end
36
+ items_html << slideshow_page
37
+ end
35
38
  end
36
-
39
+
40
+ content_tag :div, options do
41
+ raw <<-eos
42
+ <div class="carousel-inner">
43
+ #{items_html}
44
+ </div>
45
+ #{arrows_html}
46
+ eos
47
+
48
+ end
49
+ end
50
+
37
51
  end
@@ -1,6 +1,6 @@
1
1
  class SlideshowItem < Link
2
2
 
3
- field :description
3
+ field :description, :text
4
4
 
5
5
  has_attached :photo
6
6
  validates_attachment :photo,
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "fullstack-carousel"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mcasimir"]
@@ -28,7 +28,8 @@ Gem::Specification.new do |s|
28
28
  "fullstack-carousel.gemspec",
29
29
  "lib/fullstack-carousel.rb",
30
30
  "lib/fullstack/carousel.rb",
31
- "lib/fullstack/carousel/engine.rb"
31
+ "lib/fullstack/carousel/engine.rb",
32
+ "lib/generators/fullstack/carousel/install_generator.rb"
32
33
  ]
33
34
  s.homepage = "http://github.com/mcasimir/kaminari-bootstrap"
34
35
  s.licenses = ["MIT"]
@@ -0,0 +1,9 @@
1
+ module Fullstack
2
+ module Carousel
3
+ class InstallGenerator < Rails::Generators::Base
4
+ def generate_migrations
5
+ generate "migration:from slideshow_item slideshow_page_part"
6
+ end
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fullstack-carousel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -79,6 +79,7 @@ files:
79
79
  - lib/fullstack-carousel.rb
80
80
  - lib/fullstack/carousel.rb
81
81
  - lib/fullstack/carousel/engine.rb
82
+ - lib/generators/fullstack/carousel/install_generator.rb
82
83
  homepage: http://github.com/mcasimir/kaminari-bootstrap
83
84
  licenses:
84
85
  - MIT
@@ -94,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  segments:
96
97
  - 0
97
- hash: 3606787983430745266
98
+ hash: -530848568682257071
98
99
  required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  none: false
100
101
  requirements: