beef-has_assets 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.9
@@ -23,7 +23,8 @@ module Admin::AssetsHelper
23
23
 
24
24
  def admin_assets_path_with_session_information
25
25
  session_key = ActionController::Base.session_options[:key]
26
- admin_assets_path(session_key => cookies[session_key], request_forgery_protection_token => form_authenticity_token)
26
+ params = {request_forgery_protection_token => form_authenticity_token, :cookies => cookies}
27
+ admin_assets_path(params)
27
28
  end
28
29
 
29
30
  def replace_thumbnail_admin_asset_path_with_session_information(asset)
data/has_assets.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{has_assets}
5
- s.version = "0.2.8"
5
+ s.version = "0.2.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Steve England"]
9
- s.date = %q{2009-09-01}
9
+ s.date = %q{2009-09-03}
10
10
  s.email = %q{steve@wearebeef.co.uk}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -45,12 +45,13 @@ Gem::Specification.new do |s|
45
45
  "generators/assets_admin_files/templates/public/javascripts/swfupload.js",
46
46
  "generators/assets_admin_files/templates/public/javascripts/upload_progress.js",
47
47
  "has_assets.gemspec",
48
- "lib/custom_redcloth_tags.rb",
49
- "lib/flash_sesion_cookie_middleware.rb",
50
- "lib/geometry_crop.rb",
51
48
  "lib/has_assets.rb",
52
- "lib/imagescience_crop.rb",
53
- "lib/swfupload.rb",
49
+ "lib/has_assets/custom_redcloth_tags.rb",
50
+ "lib/has_assets/flash_sesion_cookie_middleware.rb",
51
+ "lib/has_assets/geometry_crop.rb",
52
+ "lib/has_assets/has_assets.rb",
53
+ "lib/has_assets/imagescience_crop.rb",
54
+ "lib/has_assets/swfupload.rb",
54
55
  "rails/init.rb",
55
56
  "test/has_assets_test.rb",
56
57
  "test/test_helper.rb"
@@ -9,7 +9,14 @@ class FlashSessionCookieMiddleware
9
9
  def call(env)
10
10
  if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
11
11
  params = ::Rack::Utils.parse_query(env['QUERY_STRING'])
12
- env['HTTP_COOKIE'] = [ @session_key, params[@session_key] ].join('=').freeze unless params[@session_key].nil?
12
+ cookies = []
13
+ params.each_pair do |key, value|
14
+ if key =~ /^cookie/
15
+ cookie_key = key[8..-2]
16
+ cookies << [ cookie_key, value ].join('=').freeze
17
+ end
18
+ end
19
+ env['HTTP_COOKIE'] = cookies.join(';')
13
20
  end
14
21
  @app.call(env)
15
22
  end
@@ -0,0 +1,28 @@
1
+ module Beef
2
+ module Has
3
+ module Assets
4
+ def self.included(base)
5
+ base.extend ClassMethods
6
+ end
7
+
8
+ module ClassMethods
9
+ def has_assets
10
+ has_many :assetings, :as => :assetable, :dependent => :delete_all
11
+ has_many :assets, :through => :assetings, :order => 'assetings.id'
12
+
13
+ # Override the default asset_ids method
14
+ define_method("asset_ids=") do |new_value|
15
+ ids = (new_value || []).reject { |nid| nid.blank? }
16
+ ids.collect!{ |id| id.to_i}
17
+ logger.debug "ASSETS the same #{ids == self.asset_ids} | IDS #{ids} | #{self.asset_ids}"
18
+ return if ids == self.asset_ids
19
+ self.assets.clear
20
+ ids.each_index do |idx|
21
+ self.assets << Asset.find(ids[idx])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
File without changes
data/lib/has_assets.rb CHANGED
@@ -1,28 +1,7 @@
1
- module Beef
2
- module Has
3
- module Assets
4
- def self.included(base)
5
- base.extend ClassMethods
6
- end
7
-
8
- module ClassMethods
9
- def has_assets
10
- has_many :assetings, :as => :assetable, :dependent => :delete_all
11
- has_many :assets, :through => :assetings, :order => 'assetings.id'
12
-
13
- # Override the default asset_ids method
14
- define_method("asset_ids=") do |new_value|
15
- ids = (new_value || []).reject { |nid| nid.blank? }
16
- ids.collect!{ |id| id.to_i}
17
- logger.debug "ASSETS the same #{ids == self.asset_ids} | IDS #{ids} | #{self.asset_ids}"
18
- return if ids == self.asset_ids
19
- self.assets.clear
20
- ids.each_index do |idx|
21
- self.assets << Asset.find(ids[idx])
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
1
+ require 'has_assets/custom_redcloth_tags'
2
+ require 'has_assets/flash_sesion_cookie_middleware'
3
+ require 'has_assets/geometry_crop'
4
+ require 'has_assets/has_assets'
5
+ require 'has_assets/imagescience_crop'
6
+ require 'has_assets/swfupload'
7
+
data/rails/init.rb CHANGED
@@ -1,14 +1,13 @@
1
- require 'flash_sesion_cookie_middleware'
2
- require 'admin_area'
3
- require 'has_assets'
4
- require 'swfupload'
5
- require 'geometry_crop'
6
- require 'imagescience_crop'
1
+ require 'has_assets/flash_sesion_cookie_middleware'
2
+ require 'has_assets/geometry_crop'
3
+ require 'has_assets/has_assets'
4
+ require 'has_assets/imagescience_crop'
5
+ require 'has_assets/swfupload'
7
6
 
8
7
  config.to_prepare do
9
8
  # Rack middleware for fixing flash's issues with sessions
10
9
  # http://thewebfellas.com/blog/2008/12/22/flash-uploaders-rails-cookie-based-sessions-and-csrf-rack-middleware-to-the-rescue
11
- ActionController::Dispatcher.middleware.use FlashSessionCookieMiddleware, ActionController::Base.session_options[:key]
10
+ ActionController::Dispatcher.middleware.insert_before(ActionController::Base.session_store, FlashSessionCookieMiddleware, ActionController::Base.session_options[:key])
12
11
  # Add the asset management helpers
13
12
  Admin::BaseController.helper(Admin::AssetsHelper)
14
13
  ApplicationController.helper(AssetsHelper)
@@ -16,6 +15,6 @@ end
16
15
  ActiveRecord::Base.send :include, Beef::Has::Assets
17
16
 
18
17
  if defined?(RedCloth)
19
- require 'custom_redcloth_tags'
18
+ require 'has_assets/custom_redcloth_tags'
20
19
  end
21
20
 
data/test/test_helper.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  require 'rubygems'
2
2
  require 'test/unit'
3
3
  require 'shoulda'
4
+ require 'redcloth'
4
5
 
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
6
  require 'has_assets'
8
7
 
9
8
  class Test::Unit::TestCase
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beef-has_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve England
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-01 00:00:00 -07:00
12
+ date: 2009-09-03 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -55,17 +55,19 @@ files:
55
55
  - generators/assets_admin_files/templates/public/javascripts/swfupload.js
56
56
  - generators/assets_admin_files/templates/public/javascripts/upload_progress.js
57
57
  - has_assets.gemspec
58
- - lib/custom_redcloth_tags.rb
59
- - lib/flash_sesion_cookie_middleware.rb
60
- - lib/geometry_crop.rb
61
58
  - lib/has_assets.rb
62
- - lib/imagescience_crop.rb
63
- - lib/swfupload.rb
59
+ - lib/has_assets/custom_redcloth_tags.rb
60
+ - lib/has_assets/flash_sesion_cookie_middleware.rb
61
+ - lib/has_assets/geometry_crop.rb
62
+ - lib/has_assets/has_assets.rb
63
+ - lib/has_assets/imagescience_crop.rb
64
+ - lib/has_assets/swfupload.rb
64
65
  - rails/init.rb
65
66
  - test/has_assets_test.rb
66
67
  - test/test_helper.rb
67
68
  has_rdoc: false
68
69
  homepage: http://github.com/beef/assets
70
+ licenses:
69
71
  post_install_message:
70
72
  rdoc_options:
71
73
  - --charset=UTF-8
@@ -86,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
88
  requirements: []
87
89
 
88
90
  rubyforge_project:
89
- rubygems_version: 1.2.0
91
+ rubygems_version: 1.3.5
90
92
  signing_key:
91
93
  specification_version: 3
92
94
  summary: Rails Engine. Adds uploadable assets to a model and admin area for files