imagine_cms 3.0.21 → 3.0.22

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.
@@ -958,41 +958,22 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
958
958
  return
959
959
  end
960
960
 
961
- FileUtils.rm_rf(temp_dir)
962
- Dir.mkdir(temp_dir)
963
-
964
961
  # create blank captions.yml if it doesn't already exist
965
962
  create_captions_file(@pg.id)
966
963
 
967
964
  original_captions = YAML.load_file(File.join(gallery_dir, 'captions.yml')).to_a
968
- captions = []
969
- captions << original_captions[0]
965
+ new_captions = [ original_captions[0] ]
966
+
967
+ Dir.glob("#{gallery_dir}/**/*.jpg").each { |img| FileUtils.touch(img); FileUtils.mv(img, img + '.tmp') }
970
968
 
971
969
  sorted_images.each_with_index do |img, i|
972
- localfile = File.join(gallery_dir, img)
973
- thumbfile = File.join(gallery_dir, img.split('.')[0] + '-thumb.jpg')
974
-
975
- temp_localfile = File.join(temp_dir, (i + 1).to_s + '.jpg')
976
- temp_thumbfile = File.join(temp_dir, (i + 1).to_s + '-thumb.jpg')
977
-
978
- begin ; FileUtils.cp(localfile, temp_localfile) ; rescue ; end
979
- begin ; FileUtils.cp(thumbfile, temp_thumbfile) ; rescue ; end
980
-
981
- captions[i + 1] = original_captions[img.split('.')[0].to_i] || ''
970
+ FileUtils.mv(File.join(gallery_dir, "#{img.to_i}.jpg.tmp"), File.join(gallery_dir, "#{i+1}.jpg"))
971
+ FileUtils.mv(File.join(gallery_dir, "#{img.to_i}-thumb.jpg.tmp"), File.join(gallery_dir, "#{i+1}-thumb.jpg"))
972
+ FileUtils.mv(File.join(gallery_dir, 'management', "#{img.to_i}.jpg.tmp"), File.join(gallery_dir, 'management', "#{i+1}.jpg"))
973
+ new_captions << original_captions[img.to_i] || ''
982
974
  end
983
975
 
984
- File.open(File.join(gallery_dir, 'captions.yml'), 'w') { |f| YAML.dump(captions, f) }
985
-
986
- images = Dir.glob("#{gallery_dir}/*.{jpg,jpeg,png,gif}")
987
- temp_images = Dir.glob("#{temp_dir}/*.{jpg,jpeg,png,gif}")
988
-
989
- images.each { |img| File.delete(img) }
990
- temp_images.each { |img| FileUtils.cp(img, File.join(gallery_dir, File.basename(img))) }
991
-
992
- FileUtils.rm_rf(File.join(gallery_dir, 'management'))
993
- create_preview_images(:force => 1)
994
-
995
- FileUtils.rm_rf(temp_dir)
976
+ File.open(File.join(gallery_dir, 'captions.yml'), 'w') { |f| YAML.dump(new_captions, f) }
996
977
  session[:gallery_images_sorted] = nil
997
978
 
998
979
  redirect_to :action => 'gallery_management', :id => @pg, :gallery_id => params[:gallery_id]
@@ -548,8 +548,8 @@ module CmsApplicationHelper
548
548
  temp.gsub!(/<#\s*tags_as_css_classes\s*#>/, page.tags_as_css_classes)
549
549
 
550
550
  # use full date/time format for created_on and updated_on
551
- temp.gsub!(/<#\s*created_on\s*#>/, "#{page.created_on.getlocal.strftime('%a')} #{date_to_str(page.created_on)} #{time_to_str(page.created_on)}") if page.created_on
552
- temp.gsub!(/<#\s*updated_on\s*#>/, "#{page.updated_on.getlocal.strftime('%a')} #{date_to_str(page.updated_on)} #{time_to_str(page.updated_on)}") if page.updated_on
551
+ temp.gsub!(/<#\s*created_on\s*#>/, "#{page.created_on.strftime('%a')} #{date_to_str(page.created_on)} #{time_to_str(page.created_on)}") if page.created_on
552
+ temp.gsub!(/<#\s*updated_on\s*#>/, "#{page.updated_on.strftime('%a')} #{date_to_str(page.updated_on)} #{time_to_str(page.updated_on)}") if page.updated_on
553
553
 
554
554
  # handle any custom substitutions
555
555
  temp = substitute_placeholders_custom(temp, page)
@@ -6,7 +6,7 @@
6
6
  <%- @thumbs.each_with_index do |thumb, index| -%>
7
7
  <table id="thumb_<%= File.basename(thumb, File.extname(thumb)).to_i %>" border="0" cellpadding="0" cellspacing="2" style="width: 90px; height: 90px; float: left;">
8
8
  <tr height="80">
9
- <td align="center"><%= image_tag '/' + thumb %></td>
9
+ <td align="center"><%= image_tag "/#{thumb}?#{File.mtime(File.join(Rails.root, 'public', thumb)).to_i}" %></td>
10
10
  </tr>
11
11
  </table>
12
12
  <%- end -%>
@@ -1,3 +1,6 @@
1
- <%= link_to_remote image_tag("/assets/content/#{path}/#{gallery_id}/management/#{image}.jpg", :size => '90x90'),
1
+ <%-
2
+ thumb = "assets/content/#{path}/#{gallery_id}/management/#{image}.jpg"
3
+ -%>
4
+ <%= link_to_remote image_tag("/#{thumb}?#{File.mtime(File.join(Rails.root, 'public', thumb)).to_i}", :size => '90x90'),
2
5
  :url => { :action => 'image_details', :id => id, :path => path, :gallery_id => gallery_id, :image => image.to_s + '.jpg' },
3
6
  :update => 'gallery_window' %>
@@ -1,4 +1,7 @@
1
- <%- image = image_draggable -%>
1
+ <%-
2
+ image = image_draggable
3
+ thumb = "assets/content/#{path}/#{gallery_id}/management/#{image}.jpg"
4
+ -%>
2
5
  <div id="image_<%= image %>.jpg" style="float: left; cursor: move;">
3
- <%= image_tag("/assets/content/#{path}/#{gallery_id}/management/#{image}.jpg", :size => '90x90') %>
6
+ <%= image_tag("/#{thumb}?#{File.mtime(File.join(Rails.root, 'public', thumb)).to_i}", :size => '90x90') %>
4
7
  </div>
@@ -1,3 +1,3 @@
1
1
  module ImagineCms
2
- VERSION = "3.0.21"
2
+ VERSION = "3.0.22"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imagine_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.21
4
+ version: 3.0.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-24 00:00:00.000000000 Z
12
+ date: 2013-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails