refinerycms-page-images 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,8 @@
10
10
  <%= text_area_tag "#{f.object_name}[images_attributes][#{index}][caption]",
11
11
  f.object.caption_for_image_index(index),
12
12
  :style => 'display: none',
13
- :id => "page_captions_#{index}" %>
13
+ :id => "page_captions_#{index}",
14
+ :class => 'page_caption' %>
14
15
  </div>
15
16
  <% end %>
16
17
  </li>
@@ -22,7 +23,8 @@
22
23
  <%= text_area_tag "#{f.object_name}[images_attributes][#{f.object.images.size}][caption]",
23
24
  '',
24
25
  :style => 'display: none',
25
- :id => "page_captions_#{f.object.images.size}" %>
26
+ :id => "page_captions_#{f.object.images.size}",
27
+ :class => 'page_caption' %>
26
28
  </div>
27
29
  <% end %>
28
30
  </li>
@@ -0,0 +1,17 @@
1
+ @refinerycms @pages @pages-manage @page-images
2
+ Feature: Attach Page Images
3
+ In order to control the content on my website
4
+ As an administrator
5
+ I want to create and manage page images
6
+
7
+ Background:
8
+ Given I am a logged in refinery user
9
+ And I have pages titled Home, About
10
+ When I go to the list of pages
11
+ And I follow "Edit this page"
12
+
13
+ Scenario: Page Edit Shows Images Tab
14
+ Then I should see "Images" within "#custom_images_tab"
15
+
16
+ Scenario: Add Image Button appears
17
+ Then I should see "Add Image"
data/lib/gemspec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- version = '1.0.1'
2
+ version = '1.0.2'
3
3
  raise "Could not get version so gemspec can not be built" if version.nil?
4
4
  files = (Dir.glob("*") | Dir.glob("**/*")).reject{|f| f =~ %r{.gem(spec)?$}}
5
5
 
@@ -37,10 +37,14 @@ module Refinery
37
37
  end
38
38
 
39
39
  config.after_initialize do
40
- Refinery::Pages::Tab.register do |tab|
40
+ ::Refinery::Pages::Tab.register do |tab|
41
41
  tab.name = "images"
42
42
  tab.partial = "/admin/pages/tabs/images"
43
43
  end
44
+ ::Refinery::Plugin.register do |plugin|
45
+ plugin.name = "refinerycms_page_images"
46
+ plugin.hide_from_menu = true
47
+ end
44
48
  end
45
49
  end
46
50
  end
@@ -45,9 +45,13 @@ reset_functionality = function() {
45
45
  reindex_images();
46
46
  });
47
47
 
48
- img_caption = $("<img src='/images/refinery/icons/user_comment.png' width='16' height='16' class='caption' />");
49
- img_caption.appendTo(image_actions);
50
- img_caption.click(open_image_caption);
48
+ if ($(this).find('textarea.page_caption').length > 0) {
49
+ img_caption = $("<img src='/images/refinery/icons/user_comment.png' width='16' height='16' class='caption' />");
50
+ img_caption.appendTo(image_actions);
51
+ img_caption.click(open_image_caption);
52
+ } else {
53
+ image_actions.addClass('no_captions');
54
+ }
51
55
 
52
56
  image_actions.appendTo($(this));
53
57
  }
@@ -29,6 +29,9 @@
29
29
  top: 0px;
30
30
  width: 135px;
31
31
  }
32
+ #page_images li .image_actions.no_captions {
33
+ background: transparent;
34
+ }
32
35
  #page_images > li .image_actions img.caption {
33
36
  position: absolute;
34
37
  right: 3px;
data/readme.md CHANGED
@@ -17,7 +17,7 @@ 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', '~> 1.0.1'
20
+ gem 'refinerycms-page-images', '~> 1.0.2'
21
21
 
22
22
  Next run
23
23
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refinerycms-page-images
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.1
5
+ version: 1.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Resolve Digital
@@ -42,6 +42,7 @@ files:
42
42
  - app/views/admin/pages/tabs/_images_field.html.erb
43
43
  - db/migrate/20101014230041_create_page_images.rb
44
44
  - db/migrate/20101014230042_add_caption_to_image_pages.rb
45
+ - features/attach_page_images.feature
45
46
  - lib/gemspec.rb
46
47
  - lib/generators/refinerycms_page_images_generator.rb
47
48
  - lib/refinerycms-page-images.rb