beef-has_assets 0.3.6 → 0.3.7
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 +19 -0
- data/app/views/admin/assets/_form.html.erb +1 -1
- data/app/views/admin/shared/_flickr.html.erb +11 -0
- data/app/views/admin/shared/_flickr_image.html.erb +1 -0
- data/app/views/admin/shared/_flickr_latest.html.erb +6 -0
- data/generators/assets_admin_files/templates/public/images/flickr_logo.jpg +0 -0
- data/generators/assets_admin_files/templates/public/javascripts/admin/assets.js +8 -0
- data/has_assets.gemspec +12 -4
- data/lib/flickr.rb +386 -0
- metadata +9 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.7
|
@@ -41,4 +41,23 @@ module Admin::AssetsHelper
|
|
41
41
|
render :partial => 'admin/flickrs/selector', :locals => { :flickr_images => flickr_result }
|
42
42
|
end
|
43
43
|
|
44
|
+
|
45
|
+
def lastest_flickr
|
46
|
+
return if Settings.flickr_api_key.blank? or Settings.flickr_user_id.blank?
|
47
|
+
Flickr::API.connect Settings.flickr_api_key, Settings.flickr_api_secret, Settings.flickr_auth_token
|
48
|
+
flickr_params = { :per_page => '5', :page => params[:page], :user_id => Settings.flickr_user_id, :sort => 'date-taken-desc', :tag_mode => 'all' }
|
49
|
+
flickr_params[:tags] = params[:tags] unless params[:tags].blank?
|
50
|
+
flickr_result = Flickr::Photo.find(:all, flickr_params)
|
51
|
+
render :partial => 'admin/shared/flickr_latest.html.erb', :locals => { :flickr_images => flickr_result }
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def flickr_select
|
56
|
+
return if Settings.flickr_api_key.blank? or Settings.flickr_user_id.blank?
|
57
|
+
Flickr::API.connect Settings.flickr_api_key, Settings.flickr_api_secret, Settings.flickr_auth_token
|
58
|
+
flickr_params = { :per_page => '12', :page => params[:page], :user_id => Settings.flickr_user_id, :sort => 'date-taken-desc', :tag_mode => 'all' }
|
59
|
+
flickr_params[:tags] = params[:tags] unless params[:tags].blank?
|
60
|
+
flickr_result = Flickr::Photo.find(:all, flickr_params)
|
61
|
+
render :partial => 'admin/shared/flickr.html.erb', :locals => { :flickr_images => flickr_result }
|
62
|
+
end
|
44
63
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
<div id="flickr-select">
|
3
|
+
<% form_remote_tag( :url => admin_flickr_path ) do -%>
|
4
|
+
<p><label for="tags">Search by tag:</label>
|
5
|
+
<%= text_field_tag :tags, params[:tags] %> <%= submit_tag "go" %></p>
|
6
|
+
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%= render :partial => 'admin/shared/flickr_image.html.erb', :collection => flickr_images -%>
|
10
|
+
|
11
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<img src="/images/admin/flickr_logo.jpg" flickr_src="<%= flickr_image.source('s') %>" alt="<%= flickr_image.description || flickr_image.title %>" title="<%= flickr_image.title %>" onclick="addLinkedImage('<%= flickr_image.source %>',this.alt)"/>
|
@@ -390,3 +390,11 @@ var Renameable = Class.create(Holdable, {
|
|
390
390
|
});
|
391
391
|
}
|
392
392
|
});
|
393
|
+
|
394
|
+
var load_flickr_select = function(){
|
395
|
+
$$('#flickr-select img').each(function(el){
|
396
|
+
|
397
|
+
el.writeAttribute('src', el.readAttribute('flickr_src'));
|
398
|
+
});
|
399
|
+
}
|
400
|
+
document.observe('dom:loaded', load_flickr_select);
|
data/has_assets.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{has_assets}
|
5
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.7"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Steve England"]
|
9
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-14}
|
10
13
|
s.email = %q{steve@wearebeef.co.uk}
|
11
14
|
s.extra_rdoc_files = [
|
12
15
|
"LICENSE",
|
@@ -40,15 +43,20 @@ Gem::Specification.new do |s|
|
|
40
43
|
"app/views/admin/flickrs/_selector.html.erb",
|
41
44
|
"app/views/admin/flickrs/show.html.erb",
|
42
45
|
"app/views/admin/flickrs/show.js.rjs",
|
46
|
+
"app/views/admin/shared/_flickr.html.erb",
|
47
|
+
"app/views/admin/shared/_flickr_image.html.erb",
|
48
|
+
"app/views/admin/shared/_flickr_latest.html.erb",
|
43
49
|
"config/routes.rb",
|
44
50
|
"generators/asset_migration/asset_migration_generator.rb",
|
45
51
|
"generators/asset_migration/templates/migration.rb",
|
46
52
|
"generators/assets_admin_files/asset_admin_files_generator.rb",
|
47
53
|
"generators/assets_admin_files/templates/public/flash/swfupload.swf",
|
54
|
+
"generators/assets_admin_files/templates/public/images/flickr_logo.jpg",
|
48
55
|
"generators/assets_admin_files/templates/public/javascripts/admin/assets.js",
|
49
56
|
"generators/assets_admin_files/templates/public/javascripts/swfupload.js",
|
50
57
|
"generators/assets_admin_files/templates/public/javascripts/upload_progress.js",
|
51
58
|
"has_assets.gemspec",
|
59
|
+
"lib/flickr.rb",
|
52
60
|
"lib/has_assets.rb",
|
53
61
|
"lib/has_assets/custom_redcloth_tags.rb",
|
54
62
|
"lib/has_assets/flash_sesion_cookie_middleware.rb",
|
@@ -65,8 +73,8 @@ Gem::Specification.new do |s|
|
|
65
73
|
s.rubygems_version = %q{1.3.5}
|
66
74
|
s.summary = %q{Rails Engine. Adds uploadable assets to a model and admin area for files}
|
67
75
|
s.test_files = [
|
68
|
-
"test/
|
69
|
-
"test/
|
76
|
+
"test/test_helper.rb",
|
77
|
+
"test/has_assets_test.rb"
|
70
78
|
]
|
71
79
|
|
72
80
|
if s.respond_to? :specification_version then
|
data/lib/flickr.rb
ADDED
@@ -0,0 +1,386 @@
|
|
1
|
+
# = Flickr
|
2
|
+
# An insanely easy interface to the Flickr photo-sharing service. By Scott Raymond.
|
3
|
+
# Modified by Steve England www.wearebeef.co.uk
|
4
|
+
|
5
|
+
# Now using ObjectiveFlickr gem as it makes auth easy
|
6
|
+
# gem 'objectiveflickr'
|
7
|
+
require 'objectiveflickr'
|
8
|
+
|
9
|
+
class Flickr
|
10
|
+
|
11
|
+
def self.connect(api_key, secret, auth_token = nil)
|
12
|
+
API.connect(api_key, secret, auth_token)
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
class Error < StandardError ; end
|
17
|
+
|
18
|
+
# Essentially a standard RuntimeError that can include the response as an
|
19
|
+
# REXML object reference.
|
20
|
+
class APIError < Error
|
21
|
+
attr_reader :response
|
22
|
+
|
23
|
+
# Creates a new exception.
|
24
|
+
def initialize(response)
|
25
|
+
super
|
26
|
+
@response = response
|
27
|
+
end
|
28
|
+
|
29
|
+
# The error string returned by the API call.
|
30
|
+
def to_s
|
31
|
+
response['message']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Flickr client class. Requires an API key, and optionally takes an email and password for authentication
|
36
|
+
class API
|
37
|
+
class << self
|
38
|
+
|
39
|
+
# Replace this API key with your own (see http://www.flickr.com/services/api/misc.api_keys.html)
|
40
|
+
def connect(api_key, secret, auth_token = nil)
|
41
|
+
@api_key = api_key
|
42
|
+
@auth_token = auth_token
|
43
|
+
@fi = FlickrInvocation.new(api_key,secret)
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
def fi
|
48
|
+
raise Error.new('API not connected') if @fi.nil?
|
49
|
+
@fi
|
50
|
+
end
|
51
|
+
|
52
|
+
def login_url(permission='read')
|
53
|
+
fi.login_url(permission)
|
54
|
+
end
|
55
|
+
|
56
|
+
def unauthorised?
|
57
|
+
params = { :api_key => @api_key, :auth_token => @auth_token }
|
58
|
+
logger.debug params
|
59
|
+
data = fi.call('flickr.auth.checkToken',params).data
|
60
|
+
logger.debug data
|
61
|
+
return data['message'] if data['stat'] != 'ok'
|
62
|
+
false
|
63
|
+
end
|
64
|
+
|
65
|
+
def authorise(frob)
|
66
|
+
@auth_token = request('flickr.auth.getToken', { :api_key => @api_key, :frob => frob } )['auth']['token']['_content']
|
67
|
+
end
|
68
|
+
|
69
|
+
# Implements flickr.urls.lookupGroup and flickr.urls.lookupUser
|
70
|
+
def find_by_url(url)
|
71
|
+
response = urls_lookupUser('url'=>url) rescue urls_lookupGroup('url'=>url) rescue nil
|
72
|
+
(response['user']) ? User.new(response['user']['id']) : Group.new(response['group']['id']) unless response.nil?
|
73
|
+
end
|
74
|
+
|
75
|
+
# Implements flickr.photos.getRecent and flickr.photos.search, returns PhotoList object so
|
76
|
+
# that page_count, total etc. are avaiable for pagination.
|
77
|
+
def photos(params = {})
|
78
|
+
photos = (params.empty?) ? photos_getRecent['photos'] : photos_search(params)['photos']
|
79
|
+
PhotoList.new(photos, self)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Implements flickr.people.getOnlineList, flickr.people.findByEmail, and flickr.people.findByUsername
|
83
|
+
def users(lookup=nil)
|
84
|
+
if(lookup)
|
85
|
+
user = people_findByEmail('find_email'=>lookup)['user'] rescue people_findByUsername('username'=>lookup)['user']
|
86
|
+
return User.find(user['nsid'])
|
87
|
+
else
|
88
|
+
return people_getOnlineList['online']['user'].collect { |person| User.new(person['nsid']) }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Implements flickr.groups.getActiveList
|
93
|
+
def groups
|
94
|
+
groups_getActiveList['activegroups']['group'].collect { |group| Group.new(group['nsid']) }
|
95
|
+
end
|
96
|
+
|
97
|
+
# Implements flickr.tags.getRelated
|
98
|
+
def related_tags(tag)
|
99
|
+
tags_getRelated('tag_id'=>tag)['tags']['tag']
|
100
|
+
end
|
101
|
+
|
102
|
+
# Implements flickr.photos.licenses.getInfo
|
103
|
+
def licenses
|
104
|
+
photos_licenses_getInfo['licenses']['license']
|
105
|
+
end
|
106
|
+
|
107
|
+
# Todo:
|
108
|
+
# logged_in?
|
109
|
+
# if logged in:
|
110
|
+
# flickr.blogs.getList
|
111
|
+
# flickr.favorites.add
|
112
|
+
# flickr.favorites.remove
|
113
|
+
# flickr.groups.browse
|
114
|
+
# flickr.photos.getCounts
|
115
|
+
# flickr.photos.getNotInSet
|
116
|
+
# flickr.photos.getUntagged
|
117
|
+
# flickr.photosets.create
|
118
|
+
# flickr.photosets.orderSets
|
119
|
+
# flickr.tags.getListUserPopular
|
120
|
+
# flickr.test.login
|
121
|
+
# uploading
|
122
|
+
|
123
|
+
private
|
124
|
+
|
125
|
+
def logger
|
126
|
+
RAILS_DEFAULT_LOGGER
|
127
|
+
end
|
128
|
+
|
129
|
+
# Takes a Flickr API method name and set of parameters
|
130
|
+
def request(method, params = {}, auth = true)
|
131
|
+
params[:auth] = auth
|
132
|
+
params[:auth_token] = @auth_token unless @auth_token.nil?
|
133
|
+
logger.debug params.inspect
|
134
|
+
|
135
|
+
|
136
|
+
data = fi.call(method,params).data
|
137
|
+
logger.debug data.inspect
|
138
|
+
raise APIError.new(data) if data['stat'] != 'ok'
|
139
|
+
data
|
140
|
+
end
|
141
|
+
|
142
|
+
# Implements everything else.
|
143
|
+
# Any method not defined explicitly will be passed on to the Flickr API,
|
144
|
+
# and return an XmlSimple document. For example, Flickr#test_echo is not defined,
|
145
|
+
# so it will pass the call to the flickr.test.echo method.
|
146
|
+
# e.g., Flickr#test_echo['stat'] should == 'ok'
|
147
|
+
def method_missing(method_id, *params)
|
148
|
+
request('flickr.' + method_id.id2name.gsub(/_/, '.'), params[0])
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
class ApiObject
|
156
|
+
|
157
|
+
protected
|
158
|
+
|
159
|
+
def initialize(hash)
|
160
|
+
hash.each do |key, value|
|
161
|
+
instance_variable_set '@' + key, value
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def self.find(*args)
|
166
|
+
case args.first
|
167
|
+
when :first then find_initial(args[1])
|
168
|
+
when :all then find_every(args[1])
|
169
|
+
else find_by_id(args)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
class Person < ApiObject
|
176
|
+
|
177
|
+
attr_reader :nsid, :username, :name, :location, :count, :firstdate, :firstdatetaken
|
178
|
+
|
179
|
+
def self.find_by_id(id)
|
180
|
+
self.new(API.people_getInfo('user_id'=>id)['person'])
|
181
|
+
end
|
182
|
+
|
183
|
+
def self.find_by_email(email)
|
184
|
+
id = API.people_findByEmail('find_email'=>email)['user']['nsid']
|
185
|
+
find(id)
|
186
|
+
end
|
187
|
+
|
188
|
+
# Implements flickr.people.getPublicGroups
|
189
|
+
def groups
|
190
|
+
API.people_getPublicGroups('user_id'=>@nsid)['groups']['group'].collect { |group| Group.new(group['nsid']) }
|
191
|
+
end
|
192
|
+
|
193
|
+
def photos(params = {})
|
194
|
+
@photolist ||= API.photos(params.merge('user_id'=>@nsid, 'sort'=>'date-taken-desc'))
|
195
|
+
end
|
196
|
+
|
197
|
+
# Implements flickr.photosets.getList
|
198
|
+
def photosets
|
199
|
+
if @photosets.nil?
|
200
|
+
photosets = API.photosets_getList('user_id'=>@nsid)['photosets']
|
201
|
+
if photosets.empty?
|
202
|
+
@photosets = []
|
203
|
+
else
|
204
|
+
@photosets = photosets['photoset'].collect { |photoset| Photoset.new(photoset) }
|
205
|
+
end
|
206
|
+
else
|
207
|
+
@photosets
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# Implements flickr.contacts.getPublicList and flickr.contacts.getList
|
212
|
+
def contacts
|
213
|
+
API.contacts_getPublicList('user_id'=>@nsid)['contacts']['contact'].collect { |contact| User.new(contact['nsid']) }
|
214
|
+
end
|
215
|
+
|
216
|
+
# Implements flickr.favorites.getPublicList and flickr.favorites.getList
|
217
|
+
def favorites
|
218
|
+
API.favorites_getPublicList('user_id'=>@nsid)['photos']['photo'].collect { |photo| Photo.new(photo) }
|
219
|
+
#or
|
220
|
+
end
|
221
|
+
|
222
|
+
# Implements flickr.tags.getListUser
|
223
|
+
def tags
|
224
|
+
API.tags_getListUser('user_id'=>@nsid)['who']['tags']['tag'].collect { |tag| tag }
|
225
|
+
end
|
226
|
+
|
227
|
+
# Implements flickr.photos.getContactsPublicPhotos and flickr.photos.getContactsPhotos
|
228
|
+
def contactsPhotos
|
229
|
+
API.photos_getContactsPublicPhotos('user_id'=>@nsid)['photos']['photo'].collect { |photo| Photo.new(photo) }
|
230
|
+
# or
|
231
|
+
#API.photos_getContactsPhotos['photos']['photo'].collect { |photo| Photo.new(photo['id']) }
|
232
|
+
end
|
233
|
+
|
234
|
+
def to_s
|
235
|
+
@name
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
|
240
|
+
class Photoset < ApiObject
|
241
|
+
attr_reader :id, :title, :description
|
242
|
+
|
243
|
+
def find_by_id(id)
|
244
|
+
self.new(photosets_getInfo('photoset_id'=>id)['photoset'])
|
245
|
+
end
|
246
|
+
|
247
|
+
def total
|
248
|
+
@photos
|
249
|
+
end
|
250
|
+
|
251
|
+
def photos
|
252
|
+
photo = API.photosets_getPhotos('photoset_id'=>id)['photoset']['photo']
|
253
|
+
return [] if photo.nil?
|
254
|
+
return [Photo.new(photo, self)] if photo.is_a? Hash
|
255
|
+
photo.collect { |photo| Photo.new(photo) }
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
class Photo < ApiObject
|
260
|
+
|
261
|
+
attr_reader :id, :title, :owner_id, :server, :isfavourite, :license, :rotation, :description, :notes
|
262
|
+
attr_writer :owner
|
263
|
+
|
264
|
+
def self.find_by_id(id)
|
265
|
+
self.new(API.photos_getInfo('photo_id'=>id)['photo'])
|
266
|
+
end
|
267
|
+
|
268
|
+
# Implements flickr.photos.getRecent and flickr.photos.search, returns PhotoList object so
|
269
|
+
# that page_count, total etc. are avaiable for pagination.
|
270
|
+
def self.find_every(params = {})
|
271
|
+
photos = (params.empty?) ? API.photos_getRecent['photos'] : API.photos_search(params)['photos']
|
272
|
+
PhotoList.new(photos)
|
273
|
+
end
|
274
|
+
|
275
|
+
def self.find_initial(params = {})
|
276
|
+
params[:per_page] = 1
|
277
|
+
find_every(params = {})
|
278
|
+
end
|
279
|
+
|
280
|
+
# Returns the URL for the photo page (default or any specified size)
|
281
|
+
def url(size='Medium')
|
282
|
+
if size=='Medium'
|
283
|
+
"http://flickr.com/photos/#{owner.username}/#{@id}"
|
284
|
+
else
|
285
|
+
sizes(size)['url']
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
# Returns the URL for the image (default or any specified size)
|
290
|
+
def source(size=nil)
|
291
|
+
url = "http://static.flickr.com/#{@server}/#{@id}_#{@secret}"
|
292
|
+
url << "_#{size}" unless size.nil?
|
293
|
+
url + ".jpg"
|
294
|
+
end
|
295
|
+
|
296
|
+
# Returns the photo file data itself, in any specified size. Example: File.open(photo.title, 'w') { |f| f.puts photo.file }
|
297
|
+
def file(size=nil)
|
298
|
+
Net::HTTP.get_response(URI.parse(source(size))).body
|
299
|
+
end
|
300
|
+
|
301
|
+
# Unique filename for the image, based on the Flickr NSID
|
302
|
+
def filename
|
303
|
+
"#{@id}.jpg"
|
304
|
+
end
|
305
|
+
|
306
|
+
# Implements flickr.photos.getContext
|
307
|
+
def context
|
308
|
+
context = API.photos_getContext('photo_id'=>@id)
|
309
|
+
@previousPhoto = Photo.new(context['prevphoto']['id'])
|
310
|
+
@nextPhoto = Photo.new(context['nextphoto']['id'])
|
311
|
+
return [@previousPhoto, @nextPhoto]
|
312
|
+
end
|
313
|
+
|
314
|
+
# Implements flickr.photos.getExif
|
315
|
+
def exif
|
316
|
+
API.photos_getExif('photo_id'=>@id)['photo']
|
317
|
+
end
|
318
|
+
|
319
|
+
# Implements flickr.photos.getPerms
|
320
|
+
def permissions
|
321
|
+
API.photos_getPerms('photo_id'=>@id)['perms']
|
322
|
+
end
|
323
|
+
|
324
|
+
# Implements flickr.photos.getSizes
|
325
|
+
def sizes(size=nil)
|
326
|
+
sizes = API.photos_getSizes('photo_id'=>@id)['sizes']['size']
|
327
|
+
sizes = sizes.find{|asize| asize['label']==size} if size
|
328
|
+
return sizes
|
329
|
+
end
|
330
|
+
|
331
|
+
# flickr.tags.getListPhoto
|
332
|
+
def tags
|
333
|
+
API.tags_getListPhoto('photo_id'=>@id)['photo']['tags']
|
334
|
+
end
|
335
|
+
|
336
|
+
# Implements flickr.blogs.postPhoto
|
337
|
+
def postToBlog(blog_id, title='', description='')
|
338
|
+
API.blogs_postPhoto('photo_id'=>@id, 'title'=>title, 'description'=>description)
|
339
|
+
end
|
340
|
+
|
341
|
+
# Converts the Photo to a string by returning its title
|
342
|
+
def to_s
|
343
|
+
@title
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|
347
|
+
|
348
|
+
# Todo:
|
349
|
+
# flickr.groups.pools.add
|
350
|
+
# flickr.groups.pools.getContext
|
351
|
+
# flickr.groups.pools.getGroups
|
352
|
+
# flickr.groups.pools.getPhotos
|
353
|
+
# flickr.groups.pools.remove
|
354
|
+
class Group < ApiObject
|
355
|
+
attr_reader :id, :client, :name, :members, :online, :privacy, :chatid, :chatcount, :url
|
356
|
+
|
357
|
+
def self.find_by_id(id)
|
358
|
+
self.new(API.groups_getInfo('user_id'=>id)['person'])
|
359
|
+
end
|
360
|
+
|
361
|
+
def self.photos(id, params = {})
|
362
|
+
params['group_id'] = id
|
363
|
+
PhotoList.new(API.groups_pools_getPhotos(params)['photos'])
|
364
|
+
end
|
365
|
+
|
366
|
+
|
367
|
+
end
|
368
|
+
|
369
|
+
# Extended from array to allow perpage etc.
|
370
|
+
class PhotoList < Array
|
371
|
+
attr_reader :page, :pages, :perpage, :total
|
372
|
+
|
373
|
+
def initialize(flickr_response)
|
374
|
+
@page = flickr_response['page'].to_i
|
375
|
+
@perpage = flickr_response['perpage'].to_i
|
376
|
+
@total = flickr_response['total'].to_i
|
377
|
+
@pages = flickr_response['pages'].to_i
|
378
|
+
|
379
|
+
@photo = flickr_response['photo']
|
380
|
+
|
381
|
+
super Photo.new(@photo, self) if @photo.is_a? Hash
|
382
|
+
super @photo.collect { |photo| Photo.new(photo) }
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
end
|
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.3.
|
4
|
+
version: 0.3.7
|
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-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -50,15 +50,20 @@ files:
|
|
50
50
|
- app/views/admin/flickrs/_selector.html.erb
|
51
51
|
- app/views/admin/flickrs/show.html.erb
|
52
52
|
- app/views/admin/flickrs/show.js.rjs
|
53
|
+
- app/views/admin/shared/_flickr.html.erb
|
54
|
+
- app/views/admin/shared/_flickr_image.html.erb
|
55
|
+
- app/views/admin/shared/_flickr_latest.html.erb
|
53
56
|
- config/routes.rb
|
54
57
|
- generators/asset_migration/asset_migration_generator.rb
|
55
58
|
- generators/asset_migration/templates/migration.rb
|
56
59
|
- generators/assets_admin_files/asset_admin_files_generator.rb
|
57
60
|
- generators/assets_admin_files/templates/public/flash/swfupload.swf
|
61
|
+
- generators/assets_admin_files/templates/public/images/flickr_logo.jpg
|
58
62
|
- generators/assets_admin_files/templates/public/javascripts/admin/assets.js
|
59
63
|
- generators/assets_admin_files/templates/public/javascripts/swfupload.js
|
60
64
|
- generators/assets_admin_files/templates/public/javascripts/upload_progress.js
|
61
65
|
- has_assets.gemspec
|
66
|
+
- lib/flickr.rb
|
62
67
|
- lib/has_assets.rb
|
63
68
|
- lib/has_assets/custom_redcloth_tags.rb
|
64
69
|
- lib/has_assets/flash_sesion_cookie_middleware.rb
|
@@ -70,7 +75,6 @@ files:
|
|
70
75
|
- test/test_helper.rb
|
71
76
|
has_rdoc: false
|
72
77
|
homepage: http://github.com/beef/assets
|
73
|
-
licenses:
|
74
78
|
post_install_message:
|
75
79
|
rdoc_options:
|
76
80
|
- --charset=UTF-8
|
@@ -91,10 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
95
|
requirements: []
|
92
96
|
|
93
97
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
98
|
+
rubygems_version: 1.2.0
|
95
99
|
signing_key:
|
96
100
|
specification_version: 3
|
97
101
|
summary: Rails Engine. Adds uploadable assets to a model and admin area for files
|
98
102
|
test_files:
|
99
|
-
- test/has_assets_test.rb
|
100
103
|
- test/test_helper.rb
|
104
|
+
- test/has_assets_test.rb
|