lipsiadmin 5.0.7 → 5.0.8

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.
data/CHANGELOG CHANGED
@@ -1,8 +1,15 @@
1
+ 2009-09-09
2
+ * Bump to 5.0.8
3
+ * Changed the rake lipsiadmin:update:javascripts now update also backend.js.erb and locale.js.erb
4
+ * Added a new frontend helper method for resize images on the fly
5
+ * Added new locales for rails 2.3.4
6
+
1
7
  2009-09-7
2
- * Bump to 5.0.7 Version
8
+ * Bump to 5.0.7
3
9
  * Fix some compatibility issues on IE6+
4
10
  * Fix stackoverflow with prototype
5
11
 
12
+
6
13
  2009-09-4
7
14
  * Fix header height on ie6+
8
15
  * Updated extjs to lastest version
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@ module Lipsiadmin
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 5
4
4
  MINOR = 0
5
- TINY = 7
5
+ TINY = 8
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,3 +1,4 @@
1
+ require 'open-uri'
1
2
  module Lipsiadmin
2
3
  module View
3
4
  module Helpers
@@ -19,6 +20,69 @@ module Lipsiadmin
19
20
  def keywords(text)
20
21
  content_for(:keywords) { text }
21
22
  end
23
+
24
+ # Override the default image tag with a special option
25
+ # <tt>resize</tt> that crop/resize on the fly the image
26
+ # and store them in <tt>uploads/thumb</tt> directory.
27
+ #
28
+ def image_tag(source, options = {})
29
+ options.symbolize_keys!
30
+ # We set here the upload path
31
+ upload_path = "uploads/thumbs"
32
+ # Now we can create a thumb on the fly
33
+ if options[:resize]
34
+ begin
35
+ geometry = options.delete(:resize)
36
+ filename = File.basename(source)
37
+ new_filename = "#{geometry}_#{filename}".downcase.gsub(/#/, '')
38
+ # Checking if we have just process them (we don't want to do the same job two times)
39
+ if File.exist?("#{Rails.root}/public/#{upload_path}/#{new_filename}")
40
+ options[:src] = "/#{upload_path}/#{new_filename}"
41
+ else # We need to create the thumb
42
+ FileUtils.mkdir("#{Rails.root}/tmp") unless File.exist?("#{Rails.root}/tmp")
43
+ # We create a temp file of the original file
44
+ # Notice that we can download them from an url! So this Image can reside anywhere on the web
45
+ if source =~ /#{URI.regexp}/
46
+ tmp = File.new("#{Rails.root}/tmp/#{filename}", "w")
47
+ tmp.write open(source).read
48
+ tmp.close
49
+ else # If the image is local
50
+ tmp = File.open(File.join("#{Rails.root}/public", path_to_image(source).gsub(/\?+\d*/, "")))
51
+ end
52
+ # Now we generate a thumb with our Thumbnail Processor (based on Paperclip)
53
+ thumb = Lipsiadmin::Attachment::Thumbnail.new(tmp, :geometry => geometry).make
54
+ # We check if our dir exists
55
+ FileUtils.mkdir_p("#{Rails.root}/public/#{upload_path}") unless File.exist?("#{Rails.root}/public/#{upload_path}")
56
+ # Now we put the image in our public path
57
+ File.open("#{Rails.root}/public/#{upload_path}/#{new_filename}", "w") do |f|
58
+ f.write thumb.read
59
+ end
60
+ # Finally we return the new image path
61
+ options[:src] = "/#{upload_path}/#{new_filename}"
62
+ end
63
+ rescue Exception => e
64
+ options[:src] = path_to_image(source)
65
+ ensure
66
+ File.delete(tmp.path) if tmp && tmp.path =~ /#{Rails.root}\/tmp/
67
+ File.delete(thumb.path) if thumb
68
+ end
69
+ end
70
+
71
+ if size = options.delete(:size)
72
+ options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$}
73
+ end
74
+
75
+ options[:src] ||= path_to_image(source)
76
+ options[:alt] ||= File.basename(options[:src], '.*').
77
+ split('.').first.to_s.capitalize
78
+
79
+ if mouseover = options.delete(:mouseover)
80
+ options[:onmouseover] = "this.src='#{image_path(mouseover)}'"
81
+ options[:onmouseout] = "this.src='#{image_path(options[:src])}'"
82
+ end
83
+
84
+ tag("img", options)
85
+ end
22
86
  end
23
87
  end
24
88
  end
@@ -8,7 +8,7 @@ class BackendGenerator < Rails::Generator::Base
8
8
  backend.resources :sessions
9
9
  end
10
10
 
11
- map.backend '/backend', :controller => 'backend/base', :action => 'index'
11
+ map.backend '/backend', :controller => 'backend/base', :action => 'index'
12
12
  map.connect '/javascripts/:action.:format', :controller => 'javascripts'
13
13
  ROUTES
14
14
 
@@ -27,6 +27,8 @@ en:
27
27
 
28
28
  # Used in array.to_sentence.
29
29
  support:
30
+ select:
31
+ prompt: "Please select"
30
32
  array:
31
33
  words_connector: ", "
32
34
  two_words_connector: " and "
@@ -162,6 +164,7 @@ en:
162
164
  less_than_or_equal_to: "must be less than or equal to {{count}}"
163
165
  odd: "must be odd"
164
166
  even: "must be even"
167
+ record_invalid: "Validation failed: {{errors}}"
165
168
  content_type: "file format not supported"
166
169
  # Append your own errors here or at the model/attributes scope.
167
170
 
@@ -30,6 +30,8 @@ it:
30
30
  pm: 'pm'
31
31
 
32
32
  support:
33
+ select:
34
+ prompt: "Scegli"
33
35
  array:
34
36
  sentence_connector: "e"
35
37
  skip_last_comma: false
@@ -139,4 +141,5 @@ it:
139
141
  less_than_or_equal_to: "deve essere meno o uguale a {{count}}"
140
142
  odd: "deve essere dispari"
141
143
  even: "deve essere pari"
144
+ record_invalid: "Validazione fallita: {{errors}}"
142
145
  content_type: "il seguente tipo di file non è supportato"
@@ -24,6 +24,11 @@ namespace :lipsiadmin do
24
24
  puts "Coping #{File.basename(js)} ... DONE"
25
25
  FileUtils.cp(js, RAILS_ROOT + '/public/javascripts/')
26
26
  end
27
+ %w(backend locale).each do |t|
28
+ js = File.join(File.dirname(__FILE__), '..', "/lipsiadmin_generators/backend/templates/views/javascripts/#{t}.js.erb")
29
+ puts "Coping #{t}.js.erb ... DONE"
30
+ FileUtils.cp(js, RAILS_ROOT + '/app/views/javascripts/')
31
+ end
27
32
  end
28
33
 
29
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lipsiadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.7
4
+ version: 5.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide D'Agostino
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-08 00:00:00 +02:00
12
+ date: 2009-09-10 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency