lipsiadmin 5.1.6 → 5.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/lib/access_control/authentication.rb +20 -20
  2. data/lib/access_control/base.rb +40 -40
  3. data/lib/controller/ext.rb +27 -27
  4. data/lib/controller/lipsiadmin_controller.rb +3 -3
  5. data/lib/controller/pdf_builder.rb +33 -31
  6. data/lib/controller/rescue.rb +12 -12
  7. data/lib/controller/responds_to_parent.rb +5 -5
  8. data/lib/data_base/attachment.rb +60 -60
  9. data/lib/data_base/attachment/attach.rb +18 -18
  10. data/lib/data_base/attachment/geometry.rb +7 -7
  11. data/lib/data_base/attachment/iostream.rb +1 -1
  12. data/lib/data_base/attachment/processor.rb +2 -2
  13. data/lib/data_base/attachment/storage.rb +11 -11
  14. data/lib/data_base/attachment/thumbnail.rb +2 -2
  15. data/lib/data_base/attachment_table.rb +27 -27
  16. data/lib/data_base/translate_attributes.rb +9 -9
  17. data/lib/data_base/utility_scopes.rb +7 -7
  18. data/lib/data_base/without_table.rb +10 -10
  19. data/lib/generator.rb +4 -4
  20. data/lib/loops.rb +77 -77
  21. data/lib/loops/base.rb +2 -2
  22. data/lib/loops/daemonize.rb +5 -5
  23. data/lib/loops/process_manager.rb +3 -3
  24. data/lib/loops/worker.rb +1 -1
  25. data/lib/loops/worker_pool.rb +1 -1
  26. data/lib/mailer/exception_notifier.rb +5 -5
  27. data/lib/mailer/pdf_builder.rb +20 -18
  28. data/lib/utils/literal.rb +6 -6
  29. data/lib/utils/pdf_builder.rb +10 -10
  30. data/lib/version.rb +1 -1
  31. data/lib/view/helpers/backend_helper.rb +123 -123
  32. data/lib/view/helpers/ext/button.rb +7 -7
  33. data/lib/view/helpers/ext/column_model.rb +18 -18
  34. data/lib/view/helpers/ext/component.rb +50 -50
  35. data/lib/view/helpers/ext/configuration.rb +5 -5
  36. data/lib/view/helpers/ext/grid.rb +46 -46
  37. data/lib/view/helpers/ext/store.rb +14 -14
  38. data/lib/view/helpers/ext/tool_bar.rb +6 -6
  39. data/lib/view/helpers/ext_helper.rb +21 -21
  40. data/lib/view/helpers/frontend_helper.rb +5 -5
  41. data/lib/view/helpers/pdf_helper.rb +7 -7
  42. data/lib/view/helpers/view_helper.rb +28 -28
  43. data/lipsiadmin_generators/attachment/attachment_generator.rb +7 -7
  44. data/lipsiadmin_generators/attachment/templates/controller.rb +13 -13
  45. data/lipsiadmin_generators/attachment/templates/migration.rb +1 -1
  46. data/lipsiadmin_generators/backend/backend_generator.rb +9 -9
  47. data/lipsiadmin_generators/backend/templates/controllers/backend/accounts_controller.rb +10 -10
  48. data/lipsiadmin_generators/backend/templates/controllers/backend/sessions_controller.rb +2 -2
  49. data/lipsiadmin_generators/backend/templates/controllers/javascripts_controller.rb +2 -2
  50. data/lipsiadmin_generators/backend/templates/migrations/create_accounts.rb +5 -5
  51. data/lipsiadmin_generators/backend/templates/models/account.rb +16 -16
  52. data/lipsiadmin_generators/backend/templates/models/account_access.rb +11 -11
  53. data/lipsiadmin_generators/backend/templates/models/notifier.rb +2 -2
  54. data/lipsiadmin_generators/backend_page/backend_page_generator.rb +22 -22
  55. data/lipsiadmin_generators/backend_page/templates/controller.rb +9 -9
  56. data/lipsiadmin_generators/backend_page/templates/functional_test.rb +10 -10
  57. data/lipsiadmin_generators/frontend/frontend_generator.rb +5 -5
  58. data/lipsiadmin_generators/frontend/templates/controllers/frontend/sessions_controller.rb +3 -3
  59. data/lipsiadmin_generators/loops/loops_generator.rb +2 -2
  60. data/lipsiadmin_generators/pdf/pdf_generator.rb +7 -7
  61. data/lipsiadmin_generators/state_session/state_session_generator.rb +9 -9
  62. data/lipsiadmin_generators/state_session/templates/controller.rb +2 -2
  63. data/lipsiadmin_generators/state_session/templates/migration.rb +2 -2
  64. data/resources/rdoc/horo.rb +3 -3
  65. metadata +4 -4
@@ -1,11 +1,11 @@
1
1
  module Lipsiadmin#:nodoc:
2
2
  module Controller#:nodoc:
3
3
  # Base Backend Controller that define:
4
- #
4
+ #
5
5
  # layout false
6
6
  # before_filter :backend_login_required
7
7
  # helper Lipsiadmin::View::Helpers::BackendHelper
8
- #
8
+ #
9
9
  class Base < ActionController::Base
10
10
  def self.inherited(subclass)#:nodoc:
11
11
  super
@@ -15,4 +15,4 @@ module Lipsiadmin#:nodoc:
15
15
  end
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -1,49 +1,49 @@
1
1
  module Lipsiadmin
2
2
  module Controller
3
3
  # This module convert a string/controller to a pdf through Pd4ml java library (included in this plugin)-
4
- #
5
- # PD4ML is a powerful PDF generating tool that uses HTML and CSS (Cascading Style Sheets) as page layout
6
- # and content definition format. Written in 100% pure Java, it allows users to easily add PDF generation
4
+ #
5
+ # PD4ML is a powerful PDF generating tool that uses HTML and CSS (Cascading Style Sheets) as page layout
6
+ # and content definition format. Written in 100% pure Java, it allows users to easily add PDF generation
7
7
  # functionality to end products.
8
- #
8
+ #
9
9
  # Remember to install jdk ex: yum install java-1.6.0-openjdk-devel.i386
10
- #
10
+ #
11
11
  # For generate a pdf you can simply do
12
- #
12
+ #
13
13
  # script/generate pdf invoice
14
- #
14
+ #
15
15
  # then edit your template /app/views/pdf/invoice.html.haml
16
- #
16
+ #
17
17
  # Then in any of your controllers add some like this:
18
- #
18
+ #
19
19
  # def generate_pdf_invoice
20
20
  # render_pdf :invoice, 'invoice_file.pdf'
21
21
  # end
22
- #
22
+ #
23
23
  # Possible options are:
24
- #
24
+ #
25
25
  # * landescape, default it's false
26
26
  # * send_data, default it's true
27
- #
28
- # Lipsiadmin include a trial fully functional evaluation version, but if you want buy it,
27
+ #
28
+ # Lipsiadmin include a trial fully functional evaluation version, but if you want buy it,
29
29
  # go here: http://pd4ml.com/buy.htm and then put your licensed jar in a directory in your
30
30
  # project then simply calling this:
31
- #
31
+ #
32
32
  # Lipsiadmin::Utils::PdfBuilder.jars_path = "here/is/my/licensed/pd4ml"
33
33
  # Lipsiadmin::Utils::PdfBuilder.view_path = "keep/template/in/other/path"
34
- #
34
+ #
35
35
  # you can use your version without any problem.
36
- #
36
+ #
37
37
  # By default Lipsiadmin will look into your "vendor/pd4ml" and if:
38
- #
38
+ #
39
39
  # * pd4ml.jar
40
40
  # * ss_css2.jar
41
- #
41
+ #
42
42
  # are present will use it
43
- #
43
+ #
44
44
  module PdfBuilder
45
45
  include Lipsiadmin::Utils::HtmlEntities
46
-
46
+
47
47
  # # Convert a stream to pdf, the template must be located in app/view/pdf/yourtemplate.pdf.erb
48
48
  def render_pdf(template, filename=nil, options={})
49
49
 
@@ -51,46 +51,48 @@ module Lipsiadmin
51
51
  jars_path = Lipsiadmin::Utils::PdfBuilder.jars_path
52
52
  # path to our templates
53
53
  view_path = Lipsiadmin::Utils::PdfBuilder.view_path
54
-
54
+
55
55
  options[:landescape] = options[:landescape] ? "LANDESCAPE" : "PORTRAIT"
56
56
  options[:send_data] ||= !filename.blank?
57
-
57
+
58
58
  # try to find erb extension
59
59
  ext = File.exist?("#{view_path}/#{template}.html.erb") ? "erb" : "haml"
60
-
60
+
61
61
  # encode the template
62
62
  input = encode_entities(render(:template => "#{view_path}/#{template}.html.#{ext}", :layout => false))
63
-
63
+
64
64
  # search for stylesheet links and make their paths absolute.
65
65
  input.gsub!('<link href="/javascripts', '<link href="' + view_path + '/../../../public/javascripts')
66
- input.gsub!('<link href="/stylesheets', '<link href="' + view_path + '/../../../public/stylesheets')
66
+ input.gsub!('<link href="/stylesheets', '<link href="' + view_path + '/../../../public/stylesheets')
67
67
 
68
68
  # search for images src, append full-path.
69
69
  input.gsub!('src="/', 'src="' + RAILS_ROOT + '/public/')
70
70
  input.gsub!('url(','url('+RAILS_ROOT+'/public')
71
71
 
72
72
  # write our temp file
73
- t = Tempfile.new("pd4ml.html", "#{Rails.root}/tmp")
73
+ tmp = File.join(Rails.root, 'tmp')
74
+ Dir.mkdir(tmp) unless File.exist?(tmp)
75
+ t = Tempfile.new("pd4ml.html", tmp)
74
76
  t.binmode
75
77
  t.write(input)
76
78
  t.flush
77
-
79
+
78
80
  # build the command
79
81
  class_path = "#{jars_path}/pd4ml.jar:.:#{jars_path}"
80
82
  class_path = "\"#{jars_path}/pd4ml.jar\";\"#{jars_path}\"" if RUBY_PLATFORM =~ /mswin/
81
83
  cmd = "cd #{Lipsiadmin::Utils::PdfBuilder.pd4ruby_path} && java -Xmx512m -Djava.awt.headless=true -cp #{class_path} Pd4Ruby --file \"#{t.path}\" --width 950 --orientation #{options[:landescape]} 2>&1"
82
-
84
+
83
85
  # grep the output
84
86
  output = IO.popen(cmd) { |s| s.read }
85
87
 
86
88
  # raise error if process returned false (ie: a java error)
87
89
  raise PdfError, "An unknonwn error occurred while generating pdf" if $?.exitstatus == 127
88
-
90
+
89
91
  # return raw pdf binary-stream
90
92
  if options[:send_data]
91
93
  pdf_options = { :filename => filename, :type => 'application/pdf' }
92
94
  pdf_options[:disposition] = "inline" if Rails.env == "development"
93
- send_data(output, pdf_options)
95
+ send_data(output, pdf_options)
94
96
  else
95
97
  erase_results
96
98
  output
@@ -102,4 +104,4 @@ module Lipsiadmin
102
104
  end
103
105
  end
104
106
  end
105
- end
107
+ end
@@ -1,22 +1,22 @@
1
1
  module Lipsiadmin
2
2
  module Controller
3
3
  # This module are raised when an exception fire up in controllers.
4
- #
4
+ #
5
5
  # Now you can personalize exception and simplify the layout using templates in:
6
- #
6
+ #
7
7
  # app/views/exception
8
- #
9
- # when an exception is raised it try to send an email, and for send an email
8
+ #
9
+ # when an exception is raised it try to send an email, and for send an email
10
10
  # you need to configure in enviroment or in an initializer some like this:
11
11
  #
12
12
  # Examples:
13
- #
13
+ #
14
14
  # Lipsiadmin::Mailer::ExceptionNotifier.sender_address = %("Exception Notifier" <server1@lipsiasoft.com>)
15
15
  # Lipsiadmin::Mailer::ExceptionNotifier.recipients_addresses = %(info@lipsiasoft.com)
16
16
  # Lipsiadmin::Mailer::ExceptionNotifier.email_prefix = "[Your Project]"
17
- #
17
+ #
18
18
  module Rescue
19
-
19
+
20
20
  def self.included(base)#:nodoc:
21
21
  base.class_eval do
22
22
  alias_method_chain :rescue_action_in_public, :notifier
@@ -35,7 +35,7 @@ module Lipsiadmin
35
35
  # to a target iframe, so we need to respond to the parent.
36
36
  if request.post?
37
37
  responds_to_parent do
38
- render :update do |page|
38
+ render :update do |page|
39
39
  page.unmask
40
40
  page.ext_alert I18n.t("lipsiadmin.exceptions.#{status}.title"), I18n.t("lipsiadmin.exceptions.#{status}.description")
41
41
  end
@@ -43,8 +43,8 @@ module Lipsiadmin
43
43
  else
44
44
  # We can't use status, because Backend.app.load don't permit load 500, 404 pages
45
45
  format.html { render :template => "/exceptions/#{status}" }
46
- format.js do
47
- render :update do |page|
46
+ format.js do
47
+ render :update do |page|
48
48
  page.unmask
49
49
  page.ext_alert I18n.t("lipsiadmin.exceptions.#{status}.title"), I18n.t("lipsiadmin.exceptions.#{status}.description")
50
50
  end
@@ -65,8 +65,8 @@ module Lipsiadmin
65
65
  Lipsiadmin::Mailer::ExceptionNotifier.deliver_exception(exception, self, request)
66
66
  end
67
67
  end
68
-
68
+
69
69
  end
70
70
 
71
71
  end
72
- end
72
+ end
@@ -1,14 +1,14 @@
1
1
  module Lipsiadmin
2
2
  module Controller
3
3
  # Executes the response body as JavaScript in the context of the parent window.
4
- #
4
+ #
5
5
  # Use this method of you are posting a form to a hidden IFRAME or if you would like
6
6
  # to use IFRAME base RPC.
7
7
  module RespondsToParent
8
8
  # Render an action to parent
9
9
  def render_to_parent(*options_for_render)
10
10
  responds_to_parent do
11
- # I don't use page.update for prevent dobule rendering
11
+ # I don't use page.update for prevent dobule rendering
12
12
  # and so we can save rendering time!
13
13
  source = render_to_string(*options_for_render)
14
14
  render :update do |page|
@@ -41,7 +41,7 @@ module Lipsiadmin
41
41
  gsub('</script>','</scr"+"ipt>')
42
42
  # Clear out the previous render to prevent double render
43
43
  erase_results
44
- # Eval in parent scope and replace document location of this frame
44
+ # Eval in parent scope and replace document location of this frame
45
45
  # so back button doesn't replay action on targeted forms
46
46
  # loc = document.location to be set after parent is updated for IE
47
47
  # with(window.parent) - pull in variables from parent window
@@ -49,9 +49,9 @@ module Lipsiadmin
49
49
  # window.eval - legal eval for Opera
50
50
  render :text => "<html><body><script type='text/javascript' charset='utf-8'>
51
51
  var loc = document.location;
52
- with(window.parent) { setTimeout(function() { window.eval('#{script}'); loc.replace('about:blank'); }, 1) }
52
+ with(window.parent) { setTimeout(function() { window.eval('#{script}'); loc.replace('about:blank'); }, 1) }
53
53
  </script></body></html>"
54
54
  end
55
55
  end
56
56
  end
57
- end
57
+ end
@@ -24,35 +24,35 @@ module Lipsiadmin
24
24
  end
25
25
 
26
26
  module ClassMethods
27
-
27
+
28
28
  # Attach a single file/image to your model.
29
- #
29
+ #
30
30
  # Examples:
31
- #
31
+ #
32
32
  # has_one_attachment :image
33
33
  # attachment_styles_for :image, :normal, "128x128!"
34
34
  # validates_attachment_presence_for :image
35
35
  # validates_attachment_size_for :image, :greater_than => 10.megabytes
36
36
  # validates_attachment_content_type_for :image, "image/png"
37
- #
37
+ #
38
38
  # Then in your form (with multipart) you can simply add:
39
- #
39
+ #
40
40
  # =file_field_tag "yourmodel[image_attributes][file]"
41
- #
41
+ #
42
42
  # or
43
- #
43
+ #
44
44
  # -fields_for "yourmodel[image_attributes][file]", @yourmodel.build_image do |image|
45
45
  # =image.file_field :file
46
- #
46
+ #
47
47
  def has_one_attachment(name, options={})
48
48
  options[:as] ||= :attacher
49
49
  options[:class_name] ||= "Attachment"
50
-
50
+
51
51
  # We need to check if the attachment model allow multiple attachments
52
52
  multi_attachments = options[:class_name].constantize.column_names.include?("attacher_name")
53
-
53
+
54
54
  options[:conditions] = "attacher_name = '#{name}'" if multi_attachments
55
-
55
+
56
56
  has_one name, options
57
57
  before_save "before_save_for_#{name}"
58
58
  attr_accessor "#{name}_attributes"
@@ -76,14 +76,14 @@ module Lipsiadmin
76
76
  define_method "before_save_for_#{name}" do
77
77
  attributes = send("#{name}_attributes")
78
78
  attributes ||= {}
79
-
79
+
80
80
  return if attributes[:file].blank?
81
-
81
+
82
82
  attributes.merge!(:attachment_definitions => self.class.attachment_definitions[name])
83
-
83
+
84
84
  # We need to add the new attacher_name
85
85
  attributes.merge!(:attacher_name => name.to_s) if multi_attachments
86
-
86
+
87
87
  if file_column = self.send(name)
88
88
  file_column.update_attributes(attributes)
89
89
  else
@@ -94,27 +94,27 @@ module Lipsiadmin
94
94
  end
95
95
 
96
96
  # Attach a many files/images to your model.
97
- #
97
+ #
98
98
  # Examples:
99
- #
99
+ #
100
100
  # has_one_attachment :images
101
101
  # attachment_styles_for :images, :normal, "128x128!"
102
102
  # validates_attachment_presence_for :images
103
103
  # validates_attachment_size_for :images, :greater_than => 10.megabytes
104
104
  # validates_attachment_content_type_for :images, "image/png"
105
- #
105
+ #
106
106
  # Then in your form (with multipart) you can simply add:
107
- #
107
+ #
108
108
  # -fields_for "yourmodel[images_attributes][]", @yourmodel.images.build do |image|
109
109
  # =image.file_field :file
110
- #
110
+ #
111
111
  def has_many_attachments(name, options = {})
112
112
  options[:as] ||= :attacher
113
113
  options[:class_name] ||= "Attachment"
114
-
114
+
115
115
  # We need to check if the attachment model allow multiple attachments
116
116
  multi_attachments = options[:class_name].constantize.column_names.include?("attacher_name")
117
-
117
+
118
118
  options[:conditions] = "attacher_name = '#{name}'" if multi_attachments
119
119
 
120
120
  has_many name, options
@@ -156,12 +156,12 @@ module Lipsiadmin
156
156
 
157
157
  end
158
158
  end
159
-
159
+
160
160
  # The full URL of where the attachment is publically accessible. This can just
161
161
  # as easily point to a directory served directly through Apache as it can to an action
162
162
  # that can control permissions. You can specify the full domain and path, but usually
163
- # just an absolute path is sufficient. The leading slash *must* be included manually for
164
- # absolute paths. The default value is
163
+ # just an absolute path is sufficient. The leading slash *must* be included manually for
164
+ # absolute paths. The default value is
165
165
  # "/uploads/:id_:attachment_:style_:basename.:extension". See
166
166
  # Lipsiadmin::Attachment::Attach#interpolate for more information on variable interpolaton.
167
167
  # :url => "/:class/:attachment/:id/:style_:basename.:extension"
@@ -169,37 +169,37 @@ module Lipsiadmin
169
169
  def attachment_url_for(name, url)
170
170
  attachment_definitions[name][:url] = url
171
171
  end
172
-
173
- # The URL that will be returned if there is no attachment assigned.
174
- # This field is interpolated just as the url is. The default value is
172
+
173
+ # The URL that will be returned if there is no attachment assigned.
174
+ # This field is interpolated just as the url is. The default value is
175
175
  # "/images/backend/no-image.png"
176
176
  # has_one_attached_file :avatar
177
177
  # attachment_default_url :avatar, "/images/backend/no-image.png"
178
- # User.new.avatar.url(:small) # => "/images/backend/no-image.png"
178
+ # User.new.avatar.url(:small) # => "/images/backend/no-image.png"
179
179
  def attachment_default_url_for(name, url)
180
180
  attachment_definitions[name][:default_url] = url
181
181
  end
182
-
183
- # The path were the attachment are stored.
182
+
183
+ # The path were the attachment are stored.
184
184
  # The default value is
185
185
  # :rails_root/public/uploads/:id_:attachment_:style_:basename.:extension
186
186
  # This value must be in consistency with <tt>url</tt>
187
187
  def attachment_path_for(name, path)
188
188
  attachment_definitions[name][:path] = path
189
189
  end
190
-
191
- # A hash of thumbnail styles and their geometries. You can find more about
192
- # geometry strings at the ImageMagick website
190
+
191
+ # A hash of thumbnail styles and their geometries. You can find more about
192
+ # geometry strings at the ImageMagick website
193
193
  # (http://www.imagemagick.org/script/command-line-options.php#resize). Attachment
194
- # also adds the "#" option (e.g. "50x50#"), which will resize the image to fit maximally
195
- # inside the dimensions and then crop the rest off (weighted at the center). The
194
+ # also adds the "#" option (e.g. "50x50#"), which will resize the image to fit maximally
195
+ # inside the dimensions and then crop the rest off (weighted at the center). The
196
196
  # default value is to generate no thumbnails.
197
197
  def attachment_styles_for(name, style_name, styles)
198
198
  attachment_definitions[name][:styles] ||= {}
199
199
  attachment_definitions[name][:styles].merge!(style_name => styles)
200
200
  end
201
-
202
- # The thumbnail style that will be used by default URLs.
201
+
202
+ # The thumbnail style that will be used by default URLs.
203
203
  # Defaults to +original+.
204
204
  # attachment_styles :avatar, :normal, "100x100#"
205
205
  # attachment_default_style :normal
@@ -209,7 +209,7 @@ module Lipsiadmin
209
209
  end
210
210
 
211
211
  # Will raise an error if Attachment cannot post_process an uploaded file due
212
- # to a command line error. This will override the global setting for this attachment.
212
+ # to a command line error. This will override the global setting for this attachment.
213
213
  # Defaults to false.
214
214
  def attachment_whiny_for(name, whiny_thumbnails)
215
215
  attachment_definitions[name][:whiny_thumbnails] = whiny_thumbnails
@@ -222,7 +222,7 @@ module Lipsiadmin
222
222
  def attachment_storage_for(name, storage)
223
223
  attachment_definitions[name][:storage] = storage
224
224
  end
225
-
225
+
226
226
  # When creating thumbnails, use this free-form options
227
227
  # field to pass in various convert command options. Typical options are "-strip" to
228
228
  # remove all Exif data from the image (save space for thumbnails and avatars) or
@@ -241,13 +241,13 @@ module Lipsiadmin
241
241
  attachment_definitions[name][:convert_options] ||= {}
242
242
  attachment_definitions[name][:convert_options].merge!(convert_name => convert_options)
243
243
  end
244
-
244
+
245
245
  # When processing, if the spawn plugin is installed, processing can be done in
246
246
  # a background fork or thread if desired.
247
247
  def attachment_background_for(name, background)
248
248
  attachment_definitions[name][:background] = background
249
249
  end
250
-
250
+
251
251
  # Attachment supports an extendible selection of post-processors. When you define
252
252
  # a set of styles for an attachment, by default it is expected that those
253
253
  # "styles" are actually "thumbnails". However, you can do more than just
@@ -256,37 +256,37 @@ module Lipsiadmin
256
256
  # your Rails app's lib/attachment_processors directory is automatically loaded by
257
257
  # Attachment, allowing you to easily define custom processors. You can specify a
258
258
  # processor with the :processors option to has_attached_file:
259
- #
259
+ #
260
260
  # attachment_styles :avatar, :text, { :quality => :better }
261
261
  # attachment_processors :avatar, :ocr
262
- #
262
+ #
263
263
  # This would load the hypothetical class Lipsiadmin::Ocr, which would have the
264
264
  # hash "{ :quality => :better }" passed to it along with the uploaded file. For
265
265
  # more information about defining processors, see Lipsiadmin::Attachment::Processor.
266
- #
266
+ #
267
267
  # The default processor is Lipsiadmin::Attachment::Thumbnail. For backwards compatability
268
268
  # reasons, you can pass a single geometry string or an array containing a
269
269
  # geometry and a format, which the file will be converted to, like so:
270
- #
270
+ #
271
271
  # attachment_styles :avatar, :thumb, ["32x32#", :png]
272
- #
272
+ #
273
273
  # This will convert the "thumb" style to a 32x32 square in png format, regardless
274
274
  # of what was uploaded. If the format is not specified, it is kept the same (i.e.
275
275
  # jpgs will remain jpgs).
276
- #
276
+ #
277
277
  # Multiple processors can be specified, and they will be invoked in the order
278
278
  # they are defined in the :processors array. Each successive processor will
279
279
  # be given the result of the previous processor's execution. All processors will
280
280
  # receive the same parameters, which are what you define in the :styles hash.
281
281
  # For example, assuming we had this definition:
282
- #
282
+ #
283
283
  # attachment_styles :avatar, :text, { :quality => :better }
284
284
  # attachment_processors :avatar, :rotator
285
285
  # attachment_processors :avatar, :ocr
286
- #
287
- # then both the :rotator processor and the :ocr processor would receive the
286
+ #
287
+ # then both the :rotator processor and the :ocr processor would receive the
288
288
  # options "{ :quality => :better }". This parameter may not mean anything to one
289
- # or more or the processors, and they are free to ignore it.
289
+ # or more or the processors, and they are free to ignore it.
290
290
  def attachment_processors_for(name, processor_name, processors)
291
291
  attachment_definitions[name][:processors] ||= {}
292
292
  attachment_definitions[name][:processors].merge!(processor_name => processor_processors)
@@ -333,12 +333,12 @@ module Lipsiadmin
333
333
  end
334
334
 
335
335
  # Places ActiveRecord-style validations on the content type of the file
336
- # assigned. The possible options are:
337
- # * +content_type+: Allowed content types. Can be a single content type
338
- # or an array. Each type can be a String or a Regexp. It should be
339
- # noted that Internet Explorer upload files with content_types that you
340
- # may not expect. For example, JPEG images are given image/pjpeg and
341
- # PNGs are image/x-png, so keep that in mind when determining how you
336
+ # assigned. The possible options are:
337
+ # * +content_type+: Allowed content types. Can be a single content type
338
+ # or an array. Each type can be a String or a Regexp. It should be
339
+ # noted that Internet Explorer upload files with content_types that you
340
+ # may not expect. For example, JPEG images are given image/pjpeg and
341
+ # PNGs are image/x-png, so keep that in mind when determining how you
342
342
  # match. Allows all by default.
343
343
  # * +message+: The message to display when the uploaded file has an invalid
344
344
  # content type.
@@ -360,7 +360,7 @@ module Lipsiadmin
360
360
  end
361
361
  end
362
362
  end
363
-
363
+
364
364
  # Returns the attachment definitions defined by each call to
365
365
  # has_attached_file.
366
366
  def attachment_definitions
@@ -370,6 +370,6 @@ module Lipsiadmin
370
370
  end
371
371
 
372
372
  end
373
-
373
+
374
374
  end
375
375
  end