refinerycms-page-images 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ nk:
2
+ plugins:
3
+ page_images:
4
+ title: Pagina Afbeeldingen
5
+ description: Pagina Afbeeldingen stelt u in staat op afbeeldingen te koppelen aan een specifieke pagina.
6
+ admin:
7
+ pages:
8
+ tabs:
9
+ images_bar:
10
+ add: Afbeelding toevoegen.
data/lib/gemspec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- version = '1.0.3'
2
+ version = '1.0.4'
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
 
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.authors = ['Resolve Digital', 'David Jones', 'Philip Arndt']
16
16
  s.require_paths = %w(lib)
17
17
 
18
- s.add_dependency 'refinerycms', '>= 0.9.9'
18
+ s.add_dependency 'refinerycms-pages', '>= 0.9.9.1'
19
19
 
20
20
  s.files = [
21
21
  '#{files.join("',\n '")}'
@@ -15,6 +15,8 @@ module Refinery
15
15
  # this is because images_attributes= overrides accepts_nested_attributes_for.
16
16
  accepts_nested_attributes_for :images, :allow_destroy => false
17
17
 
18
+ attr_accessible :images_attributes
19
+
18
20
  def images_attributes=(data)
19
21
  ImagePage.delete_all(:page_id => self.id)
20
22
 
@@ -18,6 +18,25 @@ $(document).ready(function(){
18
18
  }
19
19
  });
20
20
 
21
+ // Webkit browsers don't like the textarea being moved around the DOM,
22
+ // they ignore the new contents. This is fixed below by adding a hidden
23
+ // field that stays in place.
24
+ $('#content #page_images li textarea:hidden').each(function(index) {
25
+ var old_name = $(this).attr('name');
26
+ $(this).attr('data-old-id', $(this).attr('id'));
27
+ $(this).attr('name', 'ignore_me_' + index);
28
+ $(this).attr('id', 'ignore_me_' + index);
29
+
30
+ var hidden = $('<input>')
31
+ .addClass('caption')
32
+ .attr('type', 'hidden')
33
+ .attr('name', old_name)
34
+ .attr('id', $(this).attr('data-old-id'))
35
+ .val($(this).val());
36
+
37
+ $(this).parents('li').first().append(hidden);
38
+ });
39
+
21
40
  reset_functionality();
22
41
  });
23
42
 
@@ -41,7 +60,7 @@ reset_functionality = function() {
41
60
  img_delete = $("<img src='/images/refinery/icons/delete.png' width='16' height='16' />");
42
61
  img_delete.appendTo(image_actions);
43
62
  img_delete.click(function() {
44
- $(this).parents('li[id*=image_]').remove();
63
+ $(this).parents('li').first().remove();
45
64
  reindex_images();
46
65
  });
47
66
 
@@ -84,7 +103,7 @@ image_added = function(image) {
84
103
 
85
104
  open_image_caption = function(e) {
86
105
  // move the textarea out of the list item, and then move the textarea back into it when we click done.
87
- (list_item = $(this).parents('li')).addClass('current_caption_list_item');
106
+ (list_item = $(this).parents('li').first()).addClass('current_caption_list_item');
88
107
  textarea = list_item.find('.textarea_wrapper_for_wym > textarea');
89
108
 
90
109
  textarea.after($("<div class='form-actions'><div class='form-actions-left'><a class='button'>Done</a></div></div>"));
@@ -115,6 +134,8 @@ open_image_caption = function(e) {
115
134
  $('li.current_caption_list_item').removeClass('current_caption_list_item');
116
135
 
117
136
  $('.ui-dialog, .ui-widget-overlay:visible').remove();
137
+
138
+ $('#' + $(this).attr('data-old-id')).val($(this).val());
118
139
  }, textarea)
119
140
  , false);
120
141
 
@@ -123,6 +144,16 @@ open_image_caption = function(e) {
123
144
 
124
145
  reindex_images = function() {
125
146
  $('#page_images li textarea:hidden').each(function(i, input){
147
+ // make the image's name consistent with its position.
148
+ parts = $(input).attr('name').split('_');
149
+ parts[2] = ('' + i);
150
+ $(input).attr('name', parts.join('_'));
151
+
152
+ // make the image's id consistent with its position.
153
+ $(input).attr('id', $(input).attr('id').replace(/_\d/, '_' + i));
154
+ $(input).attr('data-old-id', $(input).attr('data-old-id').replace(/_\d_/, '_'+i+'_').replace(/_\d/, '_' + i));
155
+ });
156
+ $('#page_images li input:hidden:not(.caption)').each(function(i, input){
126
157
  // make the image's name consistent with its position.
127
158
  parts = $(input).attr('name').split(']');
128
159
  parts[1] = ('[' + i);
@@ -131,7 +162,7 @@ reindex_images = function() {
131
162
  // make the image's id consistent with its position.
132
163
  $(input).attr('id', $(input).attr('id').replace(/_\d_/, '_'+i+'_').replace(/_\d/, '_'+i));
133
164
  });
134
- $('#page_images li input:hidden').each(function(i, input){
165
+ $('#page_images li input.caption:hidden').each(function(i, input){
135
166
  // make the image's name consistent with its position.
136
167
  parts = $(input).attr('name').split(']');
137
168
  parts[1] = ('[' + i);
data/readme.md CHANGED
@@ -12,6 +12,7 @@ Page Images allows you to relate one or more images to any page in Refinery whic
12
12
 
13
13
  * Ability to select one or more images from the image picker and relate them to a page
14
14
  * Reordering support, simply drag into order
15
+ * Optionally include captions with each image.
15
16
 
16
17
  ## Install
17
18
 
@@ -43,6 +44,10 @@ Then run:
43
44
  And then try again. Note that doing this will likely mean that you need to fix your application
44
45
  for any changes that have happened since the version of Refinery CMS that you were using.
45
46
 
47
+ ## Enable Captions
48
+
49
+ Change the setting "Page Images Captions" to "true" to enable captions.
50
+
46
51
  ## Usage
47
52
 
48
53
  `app/views/pages/show.html.erb`
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.3
5
+ version: 1.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Resolve Digital
@@ -12,18 +12,18 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-02-09 00:00:00 +13:00
15
+ date: 2011-05-08 00:00:00 +12:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
- name: refinerycms
19
+ name: refinerycms-pages
20
20
  prerelease: false
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
22
22
  none: false
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.9
26
+ version: 0.9.9.1
27
27
  type: :runtime
28
28
  version_requirements: *id001
29
29
  description: Page Images Engine for Refinery CMS
@@ -41,6 +41,7 @@ files:
41
41
  - app/views/admin/pages/tabs/_images_bar.html.erb
42
42
  - app/views/admin/pages/tabs/_images_field.html.erb
43
43
  - config/locales/en.yml
44
+ - config/locales/nl.yml
44
45
  - db/migrate/20101014230041_create_page_images.rb
45
46
  - db/migrate/20101014230042_add_caption_to_image_pages.rb
46
47
  - features/attach_page_images.feature
@@ -73,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  requirements: []
74
75
 
75
76
  rubyforge_project:
76
- rubygems_version: 1.5.0
77
+ rubygems_version: 1.6.2
77
78
  signing_key:
78
79
  specification_version: 3
79
80
  summary: Page Images Engine for Refinery CMS