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 +1 -1
- data/app/helpers/admin/assets_helper.rb +2 -1
- data/has_assets.gemspec +8 -7
- data/lib/{custom_redcloth_tags.rb → has_assets/custom_redcloth_tags.rb} +0 -0
- data/lib/{flash_sesion_cookie_middleware.rb → has_assets/flash_sesion_cookie_middleware.rb} +8 -1
- data/lib/{geometry_crop.rb → has_assets/geometry_crop.rb} +0 -0
- data/lib/has_assets/has_assets.rb +28 -0
- data/lib/{imagescience_crop.rb → has_assets/imagescience_crop.rb} +0 -0
- data/lib/{swfupload.rb → has_assets/swfupload.rb} +0 -0
- data/lib/has_assets.rb +7 -28
- data/rails/init.rb +7 -8
- data/test/test_helper.rb +1 -2
- metadata +10 -8
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
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
|
-
|
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.
|
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-
|
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/
|
53
|
-
"lib/
|
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"
|
File without changes
|
@@ -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
|
-
|
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
|
File without changes
|
@@ -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
|
File without changes
|
data/lib/has_assets.rb
CHANGED
@@ -1,28 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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 '
|
3
|
-
require 'has_assets'
|
4
|
-
require '
|
5
|
-
require '
|
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.
|
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
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.
|
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-
|
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/
|
63
|
-
- lib/
|
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.
|
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
|