refinerycms-page-images 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/gemspec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- version = '0.9.1'
2
+ version = '0.9.2'
3
3
  raise "Could not get version so gemspec can not be built" if version.nil?
4
4
  files = %w( readme.md )
5
5
  %w(app config generators lib public rails test vendor).each do |dir|
@@ -21,18 +21,6 @@ $(document).ready(function(){
21
21
  reset_functionality();
22
22
  });
23
23
 
24
- reindex_images = function() {
25
- $('#page_images li input:hidden').each(function(i, input){
26
- // make the image's name consistent with its position.
27
- parts = $(input).attr('name').split(']');
28
- parts[1] = ('[' + i)
29
- $(input).attr('name', parts.join(']'));
30
-
31
- // make the image's id consistent with its position.
32
- $(input).attr('id', $(input).attr('id').replace(/_\d_/, '_'+i+'_').replace(/_\d/, '_'+i));
33
- });
34
- }
35
-
36
24
  reset_functionality = function() {
37
25
  $("#page_images").sortable({
38
26
  'tolerance': 'pointer'
@@ -86,6 +74,7 @@ image_added = function(image) {
86
74
  , src: result.url
87
75
  }).appendTo(current_list_item);
88
76
  }
77
+
89
78
  },
90
79
  error: function(xhr, txt, status) {
91
80
  if (console && console.log) {
@@ -100,4 +89,19 @@ image_added = function(image) {
100
89
  current_list_item.attr('id', 'image_' + image_id).removeClass('empty');
101
90
 
102
91
  new_list_item.appendTo($('#page_images'));
92
+ reindex_images();
93
+ }
94
+
95
+ reindex_images = function() {
96
+ alert("reindexing images");
97
+ $('#page_images li input:hidden').each(function(i, input){
98
+
99
+ // make the image's name consistent with its position.
100
+ parts = $(input).attr('name').split(']');
101
+ parts[1] = ('[' + i)
102
+ $(input).attr('name', parts.join(']'));
103
+
104
+ // make the image's id consistent with its position.
105
+ $(input).attr('id', $(input).attr('id').replace(/_\d_/, '_'+i+'_').replace(/_\d/, '_'+i));
106
+ });
103
107
  }
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: 57
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 1
10
- version: 0.9.1
9
+ - 2
10
+ version: 0.9.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Resolve Digital