refinerycms-page-images 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ class CreatePageImages < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :image_pages, :id => false do |t|
5
+ t.integer :image_id
6
+ t.integer :page_id
7
+ t.integer :position
8
+ end
9
+
10
+ add_index :image_pages, :image_id
11
+ add_index :image_pages, :page_id
12
+ end
13
+
14
+ def self.down
15
+ drop_table :image_pages
16
+ end
17
+
18
+ end
data/lib/gemspec.rb CHANGED
@@ -1,10 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- version = '0.9.5'
2
+ version = '0.9.6'
3
3
  raise "Could not get version so gemspec can not be built" if version.nil?
4
- files = %w( readme.md )
5
- %w(app config generators lib public rails test vendor).each do |dir|
6
- files += Dir.glob("#{dir}/**/*") if File.directory?(dir)
7
- end
4
+ files = (Dir.glob("*") | Dir.glob("**/*")).reject{|f| f =~ %r{.gem(spec)?$}}
8
5
 
9
6
  gemspec = <<EOF
10
7
  Gem::Specification.new do |s|
@@ -6,12 +6,13 @@ module Refinery
6
6
  initializer "static assets" do |app|
7
7
  app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
8
8
  end
9
-
9
+
10
10
  config.to_prepare do
11
11
  Page.module_eval do
12
-
13
12
  has_many :image_pages
14
- has_many :images, :through => :image_pages
13
+ has_many :images, :through => :image_pages, :order => 'position ASC'
14
+ # accepts_nested_attributes_for MUST come before def images_attributes=
15
+ # this is because images_attributes= overrides accepts_nested_attributes_for.
15
16
  accepts_nested_attributes_for :images, :allow_destroy => false
16
17
 
17
18
  def images_attributes=(data)
@@ -22,7 +23,7 @@ module Refinery
22
23
  end
23
24
  end
24
25
  end
25
-
26
+
26
27
  config.after_initialize do
27
28
  Refinery::Pages::Tab.register do |tab|
28
29
  tab.name = "images"
data/readme.md CHANGED
@@ -6,7 +6,7 @@ Page Images allows you to relate one or more images to any page in Refinery whic
6
6
 
7
7
  ## Requirements
8
8
 
9
- * refinerycms >= 0.9.9
9
+ * refinerycms >= 0.9.9 (as yet *unreleased*)
10
10
 
11
11
  ## Features
12
12
 
@@ -17,20 +17,20 @@ Page Images allows you to relate one or more images to any page in Refinery whic
17
17
 
18
18
  Add this line to your applications `Gemfile`
19
19
 
20
- gem 'refinerycms-page-images', '= 0.9.4'
21
-
20
+ gem 'refinerycms-page-images', '~> 0.9.6'
21
+
22
22
  Next run
23
23
 
24
24
  bundle install
25
25
  rails g refinerycms_page_images
26
26
  rake db:migrate
27
-
27
+
28
28
  Now when you start up your Refinery application, edit a page and there should be a new "Images" tab.
29
29
 
30
30
  ## Usage
31
31
 
32
32
  `app/views/pages/show.html.erb`
33
-
33
+
34
34
  <% content_for :body_content_right do %>
35
35
  <ul id='gallery'>
36
36
  <% @page.images.each do |i| %>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-page-images
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Resolve Digital
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-12 00:00:00 +13:00
19
+ date: 2010-10-26 00:00:00 +13:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -32,6 +32,7 @@ files:
32
32
  - readme.md
33
33
  - app/models/image_page.rb
34
34
  - app/views/admin/pages/tabs/_images.html.erb
35
+ - db/migrate/create_page_images.rb
35
36
  - lib/gemspec.rb
36
37
  - lib/generators/refinerycms_page_images_generator.rb
37
38
  - lib/refinerycms-page-images.rb