beef-has_assets 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -1,6 +1,6 @@
1
1
  <div id="flickr-select">
2
2
  <h2>Flickr Images</h2>
3
- <% form_remote_tag( :url => admin_flickr_path, :method => :get ) do -%>
3
+ <% form_remote_tag( :url => admin_flickrs_path, :method => :get ) do -%>
4
4
  <p><label for="tags">Search by tag:</label>
5
5
  <%= text_field_tag :tags, params[:tags] %> &nbsp; <%= submit_tag "go" %></p>
6
6
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{beef-has_assets}
8
- s.version = "0.6.1"
8
+ s.version = "0.6.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve England"]
@@ -1,10 +1,12 @@
1
1
  var AssetBrowser = Class.create({
2
- initialize: function(grouping, folder) {
2
+ initialize: function(grouping, folder, for_content, ajax) {
3
3
  AssetBrowser.current_grouping = grouping;
4
4
  AssetBrowser.dl = $('asset-browser');
5
5
  AssetBrowser.setContentNodeForm('has-assets-form');
6
6
  AssetBrowser.dts = AssetBrowser.dl.select('dt');
7
7
  AssetBrowser.open_folder = folder;
8
+ AssetBrowser.ajax = (ajax || false);
9
+ AssetBrowser.for_content = (for_content || false);
8
10
 
9
11
  AssetBrowser.dts.each(function(dt) {
10
12
  dt.dd = dt.next('dd');
@@ -16,7 +18,9 @@ var AssetBrowser = Class.create({
16
18
  if(AssetBrowser.ajax && !this.dd.visible() && !dt.dd.down('ul li'))
17
19
  AssetBrowser.loadFilesByFolder(dt.innerHTML, dt.dd.down('ul').id);
18
20
 
19
- this.dd.toggle();
21
+
22
+
23
+ this.dd.toggle();
20
24
  if (AssetBrowser.current_content != this.dd) {
21
25
  if (AssetBrowser.current_content != null && AssetBrowser.current_content.visible()) {
22
26
  AssetBrowser.current_content.toggle();
@@ -78,15 +82,7 @@ Object.extend(AssetBrowser, {
78
82
  this.destroyAsset(asset);
79
83
  }
80
84
  },
81
-
82
- loadFilesByFolder: function(folder_name, folder_id){
83
- new Ajax.Request('/admin/assets/category', { method: 'get',
84
- asynchronous:true,
85
- parameters: { for_content: AssetBrowser.for_content, format: 'html', category: folder_name, authenticity_token: AJ.authenticity_token() },
86
- onSuccess: function(response){ $(folder_id).update(response.responseText); } } );
87
-
88
- },
89
-
85
+
90
86
  destroyAsset: function(asset) {
91
87
  if (confirm('Are you sure you wish to delete the asset \'' + asset.filename + ' \'?')) {
92
88
  new Ajax.Request('/admin/assets/'+ asset.id, { method: 'delete',
@@ -108,7 +104,13 @@ Object.extend(AssetBrowser, {
108
104
  }
109
105
  },
110
106
 
111
-
107
+ loadFilesByFolder: function(folder_name, folder_id){
108
+ new Ajax.Request('/admin/assets/category', { method: 'get',
109
+ asynchronous:true,
110
+ parameters: { for_content: AssetBrowser.for_content, format: 'html', category: folder_name, authenticity_token: AJ.authenticity_token() },
111
+ onSuccess: function(response){ $(folder_id).update(response.responseText); } } );
112
+
113
+ },
112
114
 
113
115
  // Fire once a asset has been uploaded
114
116
  uploadedAsset: function(asset) {
@@ -146,8 +148,6 @@ Object.extend(AssetBrowser, {
146
148
  this.contentNodeForm = $(id);
147
149
  if (this.contentNodeForm) {
148
150
  this.contentNodeForm.model_name = this.contentNodeForm.className.split('_').slice(1,this.contentNodeForm.className.split('_').length).join('_');
149
- this.contentNodeForm.model_title = '';
150
- this.contentNodeForm.className.split('_').slice(1,this.contentNodeForm.className.split('_').length).each(function(e){ this.contentNodeForm.model_title = this.contentNodeForm.model_title + e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(); });
151
151
  this.setUpAssetList();
152
152
  this.contentNodeForm.addAssetIDs = function() {
153
153
  $$('input.asset_id').invoke('remove');
@@ -404,62 +404,6 @@ var Renameable = Class.create(Holdable, {
404
404
  });
405
405
  }
406
406
  });
407
-
408
- /**
409
- * Ajax.Request.abort
410
- * extend the prototype.js Ajax.Request object so that it supports an abort method
411
- */
412
- Ajax.Request.prototype.abort = function() {
413
- // prevent and state change callbacks from being issued
414
- this.transport.onreadystatechange = Prototype.emptyFunction;
415
- // abort the XHR
416
- this.transport.abort();
417
- // update the request counter
418
- Ajax.activeRequestCount--;
419
- };
420
-
421
-
422
-
423
-
424
- var flickr_comms_ref = false;
425
- var flickr_before_handler = function(){
426
- if(false != flickr_comms_ref)
427
- flickr_comms_ref.abort();
428
- $('flickr_loading').show();
429
- };
430
-
431
- var current_page = 1;
432
- var flickr_get_next_page = function(button){
433
- flickr_get_page(current_page+=1);
434
- }
435
- var flickr_get_prev_page = function(button){
436
- current_page = Math.max(1,current_page-1)
437
- flickr_get_page(current_page);
438
- }
439
-
440
- var flickr_get_page = function(num){
441
- flickr_before_handler();
442
-
443
- //if we have this page already
444
- if(page_div = $('flickr-page-' + num)){
445
- $$('.flickr-page').invoke('hide');
446
- page_div.show();
447
- $('flickr_loading').hide();
448
- }
449
- //get it
450
- else{
451
- flickr_comms_ref = new Ajax.Request('/admin/flickrs', {
452
- method: 'get',
453
- parameters: { page: num, format: 'html' },
454
- onSuccess: function(response){ $$('.flickr-page').invoke('hide');flickr_display_images(response, num); }
455
- });
456
- }
457
-
458
- };
459
- var flickr_display_images = function(response, page){
460
- $('flickr_loading').hide();
461
- $('flickr-image-container').insert('<div class="flickr-page" id="flickr-page-' + page + '">' +response.responseText+ '</div>')
462
- };
463
407
  var flickr_load_select = function(){
464
408
  if($('flickr-image-container')) {
465
409
  new Ajax.Request('/admin/flickrs', {method: 'get'});
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.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve England