noodall-ui 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/app/models/asset.rb CHANGED
@@ -43,14 +43,25 @@ class Asset
43
43
  elsif video?
44
44
  file.encode(:tiff, { :offset => "#{video_thumbnail_offset}%" }).thumb(*args).url
45
45
  else
46
- file.thumb(*args).url(:suffix => ".#{file_ext}")
46
+ file.thumb(*args).url
47
47
  end
48
48
  end
49
49
 
50
+ def web_image_extension
51
+ # If the extension id anything other than a png or gif then it should be a jpg
52
+ case file_ext
53
+ when 'png', 'gif'
54
+ file_ext
55
+ else
56
+ 'jpg'
57
+ end.to_sym
58
+ end
59
+
50
60
  def dragonfly_extension_sym
51
- file_ext.gsub('jpeg','jpg').to_sym
61
+ warn "[DEPRECATION] `dragonfly_extension_sym` is deprecated. Please use `web_image_extension` instead."
62
+ web_image_extension
52
63
  end
53
-
64
+
54
65
  def file_uid
55
66
  # Required to rerun the correct object for Dragonfly pending
56
67
  return Dragonfly::ActiveRecordExtensions::PendingUID.new if @file_uid == "PENDING"
@@ -5,10 +5,10 @@
5
5
  <li class="file" title="<%= h( asset.title ) %>">
6
6
  <div class="file-detail" id="asset-<%= asset.id %>">
7
7
  <span class="file-title"><%= h( asset.title ) %></span>
8
-
9
- <%= (asset.image? or asset.video?) ? image_tag( asset.url('70x70#', asset.dragonfly_extension_sym) ) : asset_icon(asset) %>
8
+
9
+ <%= (asset.image? or asset.video?) ? image_tag( asset.url('70x70#', asset.web_image_extension) ) : asset_icon(asset) %>
10
10
  </div>
11
-
11
+
12
12
  <%= link_to 'Show', noodall_admin_asset_path(asset, :readonly => readonly), :class => 'show button', :title => 'View this asset' %>
13
13
  <%= link_to 'Add me', asset.url, :class => 'add button', :title => 'Add this asset' %>
14
14
  </li>
@@ -45,7 +45,7 @@
45
45
  <div id="sub-form">
46
46
  <div id="image">
47
47
  <% if @asset.image? or @asset.video? %>
48
- <%= image_tag( @asset.url('260x', @asset.dragonfly_extension_sym), :alt => @asset.description, :id => "asset-#{@asset.id}" ) %>
48
+ <%= image_tag( @asset.url('260x', @asset.web_image_extension), :alt => @asset.description, :id => "asset-#{@asset.id}" ) %>
49
49
  <% else -%>
50
50
  <%= link_to( @asset.file.name, @asset.url, :title => @asset.description, :id => "asset-#{@asset.id}" ) %>
51
51
  <% end -%>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div id="image">
6
6
  <% if @asset.image? or @asset.video? %>
7
- <%= link_to(image_tag( @asset.url('500x400', @asset.dragonfly_extension_sym), :alt => @asset.description, :id => "asset-#{@asset.id}" ), @asset.url, :class => ('lightboxVideo' if @asset.video?)) %>
7
+ <%= link_to(image_tag( @asset.url('500x400', @asset.web_image_extension), :alt => @asset.description, :id => "asset-#{@asset.id}" ), @asset.url, :class => ('lightboxVideo' if @asset.video?)) %>
8
8
  <% else -%>
9
9
  <%= link_to( asset_icon(@asset) ) %>
10
10
  <% end -%>
@@ -1,10 +1,10 @@
1
1
  <% if @asset.image? %>
2
- <%= link_to image_tag( @asset.url('100x100#', @asset.dragonfly_extension_sym), :alt => @asset.description, :id => "asset-#{@asset.id}" ), @asset.url('800x600', @asset.dragonfly_extension_sym), :class => 'lightbox', :title => @asset.title %>
2
+ <%= link_to image_tag( @asset.url('100x100#', @asset.web_image_extension), :alt => @asset.description, :id => "asset-#{@asset.id}" ), @asset.url('800x600', @asset.web_image_extension), :class => 'lightbox', :title => @asset.title %>
3
3
  <% elsif @asset.video? %>
4
4
  <div class="video">
5
- <%= link_to image_tag( @asset.url('220x125#', @asset.dragonfly_extension_sym), :alt => @asset.description, :id => "asset-#{@asset.id}" ), @asset.url, :class => 'lightboxVideo', :title => @asset.title %>
5
+ <%= link_to image_tag( @asset.url('220x125#', @asset.web_image_extension), :alt => @asset.description, :id => "asset-#{@asset.id}" ), @asset.url, :class => 'lightboxVideo', :title => @asset.title %>
6
6
  <strong><%= @asset.title %></strong>
7
7
  </div>
8
8
  <% else -%>
9
9
  <%= link_to( @asset.title, @asset.url, :title => @asset.description, :id => "asset-#{@asset.id}" ) %>
10
- <% end -%>
10
+ <% end -%>
@@ -18,7 +18,7 @@
18
18
  <tr id="asset-<%= asset.id %>" class="<%=cycle('odd', 'even')%>">
19
19
  <td><%= link_to h( asset.title ), edit_noodall_admin_asset_path(asset), :class => 'edit', :title => 'Edit this asset' %></td>
20
20
  <td class="file">
21
- <%= (asset.image? or asset.video?) ? image_tag( asset.url('70x70', asset.dragonfly_extension_sym), :alt => "#{truncate(asset.file.name, :length => 80)}") : link_to( asset_icon(asset) ) %>
21
+ <%= (asset.image? or asset.video?) ? image_tag( asset.url('70x70', asset.web_image_extension), :alt => "#{truncate(asset.file.name, :length => 80)}") : link_to( asset_icon(asset) ) %>
22
22
  <%= link_to 'Show', noodall_admin_asset_path(asset), :class => 'show', :title => 'View this asset' %>
23
23
  </td>
24
24
  <td><%=h asset.created_at.to_formatted_s(:short_ordinal) %></td>
@@ -1,5 +1,5 @@
1
1
  module Noodall
2
2
  module UI
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ function setUpAssets() {
4
4
  document.write('<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>');
5
5
  document.write('<script type="text/javascript" src="/javascripts/plupload/plupload.full.min.js"></script>');
6
6
  document.write('<script type="text/javascript" src="/javascripts/plupload/jquery.plupload.queue.min.js"></script>');
7
-
7
+
8
8
  $('#asset-browser ul.choices a, #asset-browser #tags a, #asset-browser .tags a, #asset-browser a.show, #asset-browser .pagination a').live('click', function() {
9
9
  $.get(
10
10
  $(this).attr('href'),
@@ -17,7 +17,7 @@ function setUpAssets() {
17
17
  }
18
18
 
19
19
  function setUpPlupload() {
20
-
20
+
21
21
  $("#uploader").pluploadQueue({
22
22
 
23
23
  // General settings
@@ -26,17 +26,17 @@ function setUpPlupload() {
26
26
  // max_file_size : '10mb',
27
27
  chunk_size : '1mb',
28
28
  unique_names : false,
29
-
29
+
30
30
  // Use multipart
31
- // multipart: true,
31
+ // multipart: true,
32
32
  // multipart_params: { 'var1': 'val1', 'var2': 'val2' },
33
-
33
+
34
34
  // Resize images on clientside if we can
35
35
  // resize : {width : 320, height : 240, quality : 90},
36
36
 
37
37
  // Specify what files to browse for
38
38
  filters : [
39
- {title : "Image files", extensions : "jpg,gif,png"},
39
+ {title : "Image files", extensions : "jpg,gif,png,tiff,bmp"},
40
40
  {title : "Zip files", extensions : "zip"},
41
41
  {title : "Flash files", extensions : "swf"},
42
42
  {title : "Document files", extensions : "doc,pdf,xls,txt,docx,ppt"},
@@ -50,8 +50,8 @@ function setUpPlupload() {
50
50
 
51
51
  });
52
52
  var uploader = $('#uploader').pluploadQueue();
53
-
54
-
53
+
54
+
55
55
  uploader.bind('FileUploaded', function(up, file, res) {
56
56
  if(this.total.queued == 0) {
57
57
  message = $('<div id="flash"><div class="flash notice">Assets were successfully uploaded. <strong>Please enter full information for each asset</strong></div></div>');
@@ -65,32 +65,32 @@ function setUpPlupload() {
65
65
  }
66
66
  }
67
67
  });
68
-
68
+
69
69
  var error_translations = [];
70
70
  error_translations[700] = 'File type is not allowed.';
71
71
  error_translations[600] = 'File is too large, '+ plupload.formatSize(uploader.settings.max_file_size) +' maximum.';
72
-
72
+
73
73
  uploader.bind('Error', function(up, err){
74
74
  uploader_dom = $('#uploader');
75
-
75
+
76
76
  if(uploader_dom.find('.plupload_droptext').length >0)
77
77
  uploader_dom.find('.plupload_droptext').remove();
78
-
78
+
79
79
  // get a nicer error message
80
80
  // or fail to pluploads errors
81
81
  error_message = err.message;
82
82
  err_code = Math.abs(err.code);
83
83
  if(error_translations[err_code])
84
84
  error_message = error_translations[err_code];
85
-
85
+
86
86
  error_item = $('<li></li>');
87
87
  error_item.addClass('plupload_error');
88
88
  error_item.text(error_message + (err.file ? " (" + err.file.name + ")" : ""));
89
-
89
+
90
90
  $('#uploader_filelist').append(error_item);
91
91
 
92
92
  error_item.delay(8000).fadeOut(2000, function(){ $(this).remove(); if($('#uploader_filelist li').length == 0) $('#uploader_filelist').append('<li class="plupload_droptext">Drag files here.</li>'); });
93
-
93
+
94
94
  up.refresh(); // Reposition Flash/Silverlight
95
95
  });
96
96
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noodall-ui
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
4
+ hash: 17
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve England
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-13 00:00:00 +00:00
18
+ date: 2011-01-16 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -28,10 +28,10 @@ dependencies:
28
28
  segments:
29
29
  - 0
30
30
  version: "0"
31
- type: :runtime
32
31
  name: noodall-core
33
32
  prerelease: false
34
33
  version_requirements: *id001
34
+ type: :runtime
35
35
  - !ruby/object:Gem::Dependency
36
36
  requirement: &id002 !ruby/object:Gem::Requirement
37
37
  none: false
@@ -44,26 +44,27 @@ dependencies:
44
44
  - 0
45
45
  - 6
46
46
  version: 0.0.6
47
- type: :runtime
48
47
  name: thoughtbot-sortable_table
49
48
  prerelease: false
50
49
  version_requirements: *id002
50
+ type: :runtime
51
51
  - !ruby/object:Gem::Dependency
52
52
  requirement: &id003 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
- hash: 270495401
57
+ hash: 1923831917
58
58
  segments:
59
59
  - 3
60
60
  - 0
61
- - pre2
61
+ - pre
62
+ - 2
62
63
  version: 3.0.pre2
63
- type: :runtime
64
64
  name: will_paginate
65
65
  prerelease: false
66
66
  version_requirements: *id003
67
+ type: :runtime
67
68
  - !ruby/object:Gem::Dependency
68
69
  requirement: &id004 !ruby/object:Gem::Requirement
69
70
  none: false
@@ -74,10 +75,10 @@ dependencies:
74
75
  segments:
75
76
  - 0
76
77
  version: "0"
77
- type: :runtime
78
78
  name: dynamic_form
79
79
  prerelease: false
80
80
  version_requirements: *id004
81
+ type: :runtime
81
82
  - !ruby/object:Gem::Dependency
82
83
  requirement: &id005 !ruby/object:Gem::Requirement
83
84
  none: false
@@ -90,10 +91,10 @@ dependencies:
90
91
  - 0
91
92
  - 0
92
93
  version: 1.0.0
93
- type: :development
94
94
  name: bundler
95
95
  prerelease: false
96
96
  version_requirements: *id005
97
+ type: :development
97
98
  description: Noodall Rails User Interface Engine. Requires Noodall Core
98
99
  email:
99
100
  - steve@wearebeef.co.uk
@@ -673,7 +674,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
673
674
  requirements: []
674
675
 
675
676
  rubyforge_project:
676
- rubygems_version: 1.3.7
677
+ rubygems_version: 1.4.1
677
678
  signing_key:
678
679
  specification_version: 3
679
680
  summary: Noodall Rails User Interface