papermill 1.0.7 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.7
1
+ 1.1.0
@@ -30,7 +30,7 @@ class PapermillController < ApplicationController
30
30
  if @asset.update_attributes(params[:papermill_asset])
31
31
  page << %{ notify("#{ escape_javascript t("papermill.updated", :ressource => @asset.name)}", "notice"); close_popup(self); }
32
32
  else
33
- page << %{ jQuery("#error").html("#{ escape_javascript @asset.errors.full_messages.join('<br>') }"); jQuery("#error").show(); }
33
+ page << %{ jQuery("#error").html("#{ escape_javascript @asset.errors.full_messages.join('<br />') }"); jQuery("#error").show(); }
34
34
  end
35
35
  end
36
36
  end
@@ -48,7 +48,7 @@ class PapermillController < ApplicationController
48
48
  render :partial => "papermill/asset", :object => @asset, :locals => { :gallery => params[:gallery], :thumbnail_style => params[:thumbnail_style] }
49
49
  else
50
50
  render :update do |page|
51
- page << %{ notify("#{ escape_javascript(@asset.errors.join('<br />')) }", "warning"); }
51
+ page << %{ notify("#{ escape_javascript(@asset.errors.to_sentence) }", "warning"); }
52
52
  end
53
53
  end
54
54
  end
@@ -69,18 +69,9 @@ class PapermillController < ApplicationController
69
69
  end
70
70
 
71
71
  def mass_edit
72
- ok_messages = []
73
- ko_messages = []
74
- @assets.each do |asset|
75
- if asset.update_attributes({params[:attribute] => params[:value]})
76
- ok_messages << t("papermill.updated", :ressource => asset.name)
77
- else
78
- ko_messages << "#{asset.name} -> #{asset.errors.full_messages.to_sentence}"
79
- end
80
- end
72
+ @assets.each { |asset| asset.update_attribute(params[:attribute], params[:value]) }
81
73
  render :update do |page|
82
- page << %{ notify("#{ escape_javascript ok_messages.join('\n') }", "notice"); } unless ok_messages.empty?
83
- page << %{ notify("#{ escape_javascript ko_messages.join('\n') }", "error"); } unless ko_messages.empty?
74
+ page << %{ notify("#{ escape_javascript t("papermill.updated", :ressource => @assets.map(&:name).to_sentence) }", "notice"); } unless @assets.blank?
84
75
  end
85
76
  end
86
77
 
@@ -33,7 +33,7 @@ en:
33
33
  fr:
34
34
  papermill:
35
35
  not-processed: "Erreur/ressource non trouvée"
36
- updated: "{{ressource}} mis(e) à jour"
36
+ updated: "{{ressource}} modifiés(s)"
37
37
  not-deleted: "{{ressource}} n'a pas pu être supprimée"
38
38
  not-found: "Asset #{{ressource}} non trouvé"
39
39
  edit-title: "Cliquer pour éditer '{{ressource}}'"
@@ -41,7 +41,7 @@ module ActionView::Helpers::FormTagHelper
41
41
  end
42
42
 
43
43
  assetable = options[:assetable] || @template.instance_variable_get("@#{@object_name}")
44
- options = PapermillAsset.assetable_papermill_options(assetable.class.name, key).deep_merge(options)
44
+ options = PapermillAsset.assetable_papermill_options(assetable && assetable.class.name, key).deep_merge(options)
45
45
 
46
46
  assetable_id = assetable && (assetable.id || assetable.timestamp) || nil
47
47
  assetable_type = assetable && assetable.class.base_class.name || nil
@@ -104,7 +104,7 @@ module ActionView::Helpers::FormTagHelper
104
104
 
105
105
  conditions = {:assetable_type => assetable_type, :assetable_id => assetable_id}
106
106
  conditions.merge!({:assetable_key => key.to_s}) if key
107
- collection = PapermillAsset.all(:conditions => conditions, :order => "position")
107
+ collection = PapermillAsset.all(:conditions => conditions)
108
108
 
109
109
  html[:upload_button] = %{<div id="#{id}-button-wrapper" class="papermill-button-wrapper" style="height: #{options[:swfupload][:button_height]}px;"><span id="browse_for_#{id}" class="swf_button"></span></div>}
110
110
  html[:container] = @template.content_tag(:div, :id => id, :class => "#{(options[:thumbnail] ? "papermill-thumb-container" : "papermill-asset-container")} #{(options[:gallery] ? "papermill-multiple-items" : "papermill-unique-item")}") {
@@ -71,7 +71,7 @@ class PapermillAsset < ActiveRecord::Base
71
71
  end
72
72
 
73
73
  def self.assetable_papermill_options(assetable_class, assetable_key)
74
- if assetable_class
74
+ if assetable_class
75
75
  assoc = assetable_class.constantize.papermill_associations
76
76
  assoc[assetable_key.try(:to_sym)] || assoc[Papermill::options[:base_association_name]]
77
77
  else
@@ -100,7 +100,7 @@ class PapermillAsset < ActiveRecord::Base
100
100
  end
101
101
 
102
102
  def set_position
103
- self.position ||= PapermillAsset.first(:conditions => { :assetable_key => assetable_key, :assetable_type => assetable_type, :assetable_id => assetable_id } ).try(:position).to_i + 1
103
+ self.position ||= PapermillAsset.last(:conditions => { :assetable_key => assetable_key, :assetable_type => assetable_type, :assetable_id => assetable_id } ).try(:position).to_i + 1
104
104
  end
105
105
 
106
106
  def destroy_files
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papermill
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Benoit B\xC3\xA9n\xC3\xA9zech"
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements: []
111
111
 
112
112
  rubyforge_project:
113
- rubygems_version: 1.3.5
113
+ rubygems_version: 1.3.4
114
114
  signing_key:
115
115
  specification_version: 3
116
116
  summary: Paperclip Swfupload UploadHelper wrapper