noodall-ui 0.0.4 → 0.0.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/Gemfile.lock +13 -10
- data/app/controllers/noodall/admin/assets_controller.rb +1 -1
- data/app/helpers/noodall/components_helper.rb +6 -11
- data/app/models/asset.rb +6 -6
- data/app/views/noodall/admin/assets/_menu.html.erb +2 -2
- data/app/views/noodall/admin/assets/form.html.erb +1 -3
- data/app/views/noodall/admin/assets/index.html.erb +0 -1
- data/app/views/noodall/admin/assets/show.html.erb +0 -1
- data/app/views/noodall/admin/assets/tags.html.erb +0 -1
- data/app/views/noodall/admin/nodes/_branch.html.erb +1 -1
- data/app/views/noodall/admin/nodes/change_template.html.erb +0 -2
- data/app/views/noodall/admin/nodes/index.html.erb +0 -2
- data/app/views/noodall/admin/nodes/new.html.erb +0 -1
- data/app/views/noodall/admin/nodes/show.html.erb +1 -3
- data/demo/models/home.rb +3 -0
- data/features/step_definitions/asset_steps.rb +7 -6
- data/lib/noodall/ui/version.rb +1 -1
- data/public/javascripts/admin/application.js +21 -28
- metadata +5 -4
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
noodall-ui (0.0.
|
4
|
+
noodall-ui (0.0.5)
|
5
5
|
dynamic_form
|
6
6
|
noodall-core
|
7
7
|
thoughtbot-sortable_table (= 0.0.6)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
culerity (0.2.12)
|
69
69
|
database_cleaner (0.6.0)
|
70
70
|
diff-lcs (1.1.2)
|
71
|
-
dragonfly (0.7.
|
71
|
+
dragonfly (0.7.7)
|
72
72
|
rack
|
73
73
|
dynamic_form (1.1.3)
|
74
74
|
erubis (2.6.6)
|
@@ -85,7 +85,7 @@ GEM
|
|
85
85
|
json (~> 1.4.6)
|
86
86
|
term-ansicolor (~> 1.0.5)
|
87
87
|
git (1.2.5)
|
88
|
-
haml (3.0.
|
88
|
+
haml (3.0.23)
|
89
89
|
i18n (0.4.2)
|
90
90
|
jeweler (1.4.0)
|
91
91
|
gemcutter (>= 0.1.0)
|
@@ -104,19 +104,22 @@ GEM
|
|
104
104
|
mime-types (~> 1.16)
|
105
105
|
treetop (~> 1.4.8)
|
106
106
|
mime-types (1.16)
|
107
|
+
mm-multi-parameter-attributes (0.1.1)
|
108
|
+
mongo_mapper
|
107
109
|
mongo (1.1.1)
|
108
110
|
bson (>= 1.1.1)
|
109
|
-
mongo_mapper (0.8.
|
111
|
+
mongo_mapper (0.8.6)
|
110
112
|
activesupport (>= 2.3.4)
|
111
113
|
jnunemaker-validatable (~> 1.8.4)
|
112
|
-
plucky (~> 0.3.
|
114
|
+
plucky (~> 0.3.6)
|
113
115
|
newbamboo-rvideo (0.9.6)
|
114
116
|
activesupport
|
115
117
|
nokogiri (1.4.3.1)
|
116
|
-
noodall-core (0.
|
118
|
+
noodall-core (0.3.2)
|
117
119
|
canable (= 0.1.1)
|
118
|
-
|
119
|
-
|
120
|
+
mm-multi-parameter-attributes (~> 0.1.1)
|
121
|
+
mongo_mapper (~> 0.8.6)
|
122
|
+
ramdiv-mongo_mapper_acts_as_tree (~> 0.1.1)
|
120
123
|
ruby-stemmer
|
121
124
|
open4 (0.9.6)
|
122
125
|
plucky (0.3.6)
|
@@ -141,7 +144,7 @@ GEM
|
|
141
144
|
rake (>= 0.8.4)
|
142
145
|
thor (~> 0.14.0)
|
143
146
|
rake (0.8.7)
|
144
|
-
ramdiv-mongo_mapper_acts_as_tree (0.1.
|
147
|
+
ramdiv-mongo_mapper_acts_as_tree (0.1.2)
|
145
148
|
mongo_mapper (>= 0.6.8)
|
146
149
|
rmagick (2.13.1)
|
147
150
|
rspec (2.0.1)
|
@@ -167,7 +170,7 @@ GEM
|
|
167
170
|
rubyzip
|
168
171
|
spork (0.8.4)
|
169
172
|
term-ansicolor (1.0.5)
|
170
|
-
thor (0.14.
|
173
|
+
thor (0.14.4)
|
171
174
|
thoughtbot-sortable_table (0.0.6)
|
172
175
|
treetop (1.4.8)
|
173
176
|
polyglot (>= 0.3.1)
|
@@ -41,7 +41,7 @@ module Noodall
|
|
41
41
|
def tags
|
42
42
|
options = { :order => '_id' } # Order by name which is _id in the map/reduce
|
43
43
|
if params[:asset_type]
|
44
|
-
options.merge!(asset_options(params[:asset_type]))
|
44
|
+
options.merge!(asset_options(params[:asset_type]))
|
45
45
|
@page_title << " Tags"
|
46
46
|
else
|
47
47
|
@page_title = "Tags"
|
@@ -9,27 +9,22 @@ module Noodall::ComponentsHelper
|
|
9
9
|
# render each slot in the row
|
10
10
|
args.map do |slot_code|
|
11
11
|
index = args.index(slot_code)
|
12
|
-
component = components[index]
|
13
|
-
|
12
|
+
component = components[index]
|
13
|
+
|
14
14
|
additional_classes = []
|
15
15
|
additional_classes << slot_code.split("_").shift unless slot_code.split("_").shift.nil?
|
16
16
|
additional_classes << 'penultimate' if slot_code == args[args.size - 2]
|
17
17
|
additional_classes << 'last' if args.last == slot_code
|
18
18
|
additional_classes << 'first' if args.first == slot_code
|
19
|
-
|
19
|
+
|
20
20
|
# pass a flag to the view to add an expanded html class
|
21
21
|
component(node, slot_code, ( components[index + 1].nil? && index < (args.size - 1) ), additional_classes.join(' ')).to_s
|
22
|
-
end
|
22
|
+
end.to_s.html_safe
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def component(node, slot_code, expand = false, additional_classes = '')
|
26
26
|
component = node.send(slot_code)
|
27
|
-
|
28
|
-
if component.respond_to?(:contents)
|
29
|
-
component.contents.reject!{|c| c.asset_id.blank? }
|
30
|
-
component.contents << Content.new
|
31
|
-
end
|
32
|
-
|
27
|
+
|
33
28
|
additional_classes = []
|
34
29
|
additional_classes << slot_code.split("_").shift unless slot_code.split("_").shift.nil?
|
35
30
|
|
data/app/models/asset.rb
CHANGED
@@ -23,18 +23,22 @@ class Asset
|
|
23
23
|
validates_presence_of :file, :title, :description
|
24
24
|
validates_length_of :tags, :minimum => 3, :message => "must have at least 3 items"
|
25
25
|
|
26
|
+
# Set up video format
|
27
|
+
cattr_accessor :video_extensions
|
28
|
+
self.video_extensions = []
|
29
|
+
|
26
30
|
def image?
|
27
31
|
!(file_mime_type =~ self.class.image_reg_ex).nil?
|
28
32
|
end
|
29
33
|
|
30
34
|
def video?
|
31
|
-
file_ext
|
35
|
+
@@video_extensions.include?(file_ext)
|
32
36
|
end
|
33
37
|
|
34
38
|
def url(*args)
|
35
39
|
if args.blank?
|
36
40
|
# Use the transparent url just the file is required with no processing
|
37
|
-
file.url
|
41
|
+
file.url(:suffix => ".#{file_ext}")
|
38
42
|
elsif video?
|
39
43
|
file.encode(:tiff, { :offset => "#{video_thumbnail_offset}%" }).thumb(*args).url
|
40
44
|
else
|
@@ -82,10 +86,6 @@ class Asset
|
|
82
86
|
def image_extensions
|
83
87
|
['png','gif','jpg','jpeg']
|
84
88
|
end
|
85
|
-
|
86
|
-
def video_extensions
|
87
|
-
['flv', 'avi', 'mpeg', 'mpg']
|
88
|
-
end
|
89
89
|
end
|
90
90
|
extend ClassMethods
|
91
91
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<ul class="choices">
|
2
2
|
<%= content_tag :li, '<a>Done</a>'.html_safe, :class => 'action' if params[:mode] == 'multi' %>
|
3
|
-
<%= content_tag :li, '<a>Cancel</a>'.html_safe, :class => 'cancel' %>
|
3
|
+
<%= content_tag :li, '<a>Cancel</a>'.html_safe, :class => 'cancel' if params[:mode] %>
|
4
4
|
<li class="upload"><%= link_to 'Upload', new_noodall_admin_asset_path(:readonly => readonly) %></li>
|
5
5
|
<%= content_tag :li, link_to( 'Images', noodall_admin_assets_path(:readonly => readonly) ), :class => 'images' if params[:allowed_types].blank? or params[:allowed_types].include?('images') %>
|
6
6
|
<%= content_tag :li, link_to( 'Documents', documents_noodall_admin_assets_path(:readonly => readonly) ), :class => 'documents' if params[:allowed_types].blank? or params[:allowed_types].include?('documents') %>
|
7
|
-
<%= content_tag :li, link_to( 'Videos', videos_noodall_admin_assets_path(:readonly => readonly) ), :class => 'videos' if params[:allowed_types].blank? or params[:allowed_types].include?('videos') %>
|
7
|
+
<%= content_tag :li, link_to( 'Videos', videos_noodall_admin_assets_path(:readonly => readonly) ), :class => 'videos' if Asset.video_extensions.any? and (params[:allowed_types].blank? or params[:allowed_types].include?('videos')) %>
|
8
8
|
</ul>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<ol class="tree">
|
2
2
|
<% for node in nodes %>
|
3
3
|
<li><%= link_to h( node.title), node_path(node), :id => "id-#{node.id}" %>
|
4
|
-
<% unless (children = node.children(options)).empty? -%>
|
4
|
+
<% unless (children = node.children.where(options)).empty? -%>
|
5
5
|
<span class="expand">+</span>
|
6
6
|
<%= render :partial => 'branch', :locals => { :nodes => children, :options => options } %>
|
7
7
|
<% end -%>
|
@@ -1,5 +1,3 @@
|
|
1
|
-
<a class="tooltip" href="/cms_help.pdf"> </a>
|
2
|
-
|
3
1
|
<% content_for :header, javascript_include_tag( 'tiny_mce/jquery.tinymce.js', 'admin/tiny_mce_config', 'admin/nodes', 'admin/assets' ) %>
|
4
2
|
|
5
3
|
|
@@ -125,7 +123,7 @@
|
|
125
123
|
<span class="tooltip" title="Please choose where you would like to place each component"> </span>
|
126
124
|
|
127
125
|
<%= yield :component_table %>
|
128
|
-
<% if can_publish?(@node) %>
|
126
|
+
<% if can_publish?(@node) and !@node.is_a?(Home) %>
|
129
127
|
<%= link_to "Change Template", change_template_noodall_admin_node_path(@node), :class => 'change' %>
|
130
128
|
<% end -%>
|
131
129
|
<div id="modules-list">
|
data/demo/models/home.rb
ADDED
@@ -23,9 +23,9 @@ Given /^files have been uploaded to the asset library$/ do
|
|
23
23
|
20.times { Factory(:asset) }
|
24
24
|
20.times { Factory(:document_asset) }
|
25
25
|
20.times { Factory(:video_asset) }
|
26
|
-
|
26
|
+
|
27
27
|
20.times { Factory(:asset, :title => "Tagged Asset", :tags => ['RAC','lorem','dolar']) }
|
28
|
-
|
28
|
+
|
29
29
|
end
|
30
30
|
|
31
31
|
Then /^I should be able to browse assets by content type$/ do
|
@@ -35,10 +35,11 @@ Then /^I should be able to browse assets by content type$/ do
|
|
35
35
|
within(:css, "ul.choices") { click_link "Documents" }
|
36
36
|
page.should_not have_content('Image asset')
|
37
37
|
page.should_not have_content('Video asset')
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
if Asset.video_extensions.any?
|
39
|
+
within(:css, "ul.choices") { click_link "Videos" }
|
40
|
+
page.should_not have_content('Document asset')
|
41
|
+
page.should_not have_content('Image asset')
|
42
|
+
end
|
42
43
|
end
|
43
44
|
|
44
45
|
Then /^I should be able to browse assets by tags$/ do
|
data/lib/noodall/ui/version.rb
CHANGED
@@ -57,7 +57,7 @@ $(document).ready(function() {
|
|
57
57
|
//video previews
|
58
58
|
domain = window.location.href.replace(/http:\/\/([^\/]+)\/.*/i,'$1');
|
59
59
|
var videoUrl = 'video=http://'+ domain + escape($('a.lightboxVideo').attr('href')) + '&standalone=true';
|
60
|
-
|
60
|
+
|
61
61
|
$('a.lightboxVideo').fancybox({
|
62
62
|
'padding': 10,
|
63
63
|
'autoScale': true,
|
@@ -120,7 +120,7 @@ $(document).ready(function() {
|
|
120
120
|
|
121
121
|
$("#advanced").hide();
|
122
122
|
$("legend.advanced").hide();
|
123
|
-
|
123
|
+
|
124
124
|
$(".show-advanced").append("<a class='advanced' href='#advanced'>Advanced</a>");
|
125
125
|
|
126
126
|
$(".show-advanced a.advanced").click(
|
@@ -134,11 +134,11 @@ $(document).ready(function() {
|
|
134
134
|
$(".show-advanced a.advanced.open").fadeIn("fast");
|
135
135
|
}
|
136
136
|
});
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
142
|
|
143
143
|
$('body#assets.index .file').click(function() {
|
144
144
|
document.location = $(this).find("a.show").attr('href');
|
@@ -259,7 +259,7 @@ var Component = {
|
|
259
259
|
|
260
260
|
// Reset
|
261
261
|
Component.slot_form = $(Component.slot_form_id);
|
262
|
-
|
262
|
+
|
263
263
|
// Make file selectors sortable
|
264
264
|
Component.slot_form.find('.multi-file-files ol').sortable({
|
265
265
|
axis: 'y',
|
@@ -281,7 +281,7 @@ var Component = {
|
|
281
281
|
},
|
282
282
|
add_all_assets: function() {
|
283
283
|
$.each(Browser.assets_to_add, function(i, asset_id){
|
284
|
-
Component.add_asset(asset_id);
|
284
|
+
Component.add_asset(asset_id);
|
285
285
|
});
|
286
286
|
Component.reopen_slot();
|
287
287
|
}
|
@@ -350,7 +350,7 @@ var Browser = {
|
|
350
350
|
action = '/';
|
351
351
|
if (Browser.allowed_types.length > 0) {
|
352
352
|
action += Browser.allowed_types[0];
|
353
|
-
}
|
353
|
+
}
|
354
354
|
$.get("/admin/assets" + action, {
|
355
355
|
allowed_types: Browser.allowed_types,
|
356
356
|
mode: Browser.mode,
|
@@ -371,8 +371,8 @@ var Browser = {
|
|
371
371
|
after_ajax: function() {
|
372
372
|
if (Browser.mode == 'multi') {
|
373
373
|
$.each(Browser.assets_to_add, function(i, asset_id){
|
374
|
-
$('#asset-' + asset_id).siblings('a.add').addClass('selected');
|
375
|
-
});
|
374
|
+
$('#asset-' + asset_id).siblings('a.add').addClass('selected');
|
375
|
+
});
|
376
376
|
}
|
377
377
|
},
|
378
378
|
do_action_and_close: function() {
|
@@ -466,10 +466,11 @@ $('#asset-browser li.cancel a').live('click', Browser.close);
|
|
466
466
|
// Action button
|
467
467
|
$('#asset-browser li.action a').live('click', Browser.do_action_and_close);
|
468
468
|
|
469
|
-
// Open the file select
|
469
|
+
// Open the file select
|
470
470
|
$('span.select-file').live('click', function(event) {
|
471
471
|
Browser.set_opener($(this));
|
472
472
|
Browser.action = Browser.attach_asset;
|
473
|
+
Browser.after_close = $.fancybox.close;
|
473
474
|
Browser.open();
|
474
475
|
});
|
475
476
|
// After close the file select in component form reopen slot form
|
@@ -565,22 +566,14 @@ $('#tree-browser.link a').live('click', function(e) {
|
|
565
566
|
$('span.link-asset').live('click', {readonly:true}, function(event) {
|
566
567
|
Component.link_input = $(this).siblings('input').first();
|
567
568
|
Component.allowed_types = [];
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
$('#asset-browser').attr('class', 'link');
|
575
|
-
},
|
576
|
-
'script');
|
569
|
+
Browser.action = function() {
|
570
|
+
asset_id = Browser.assets_to_add[0]
|
571
|
+
Component.link_input.val($('#asset-' + asset_id).siblings('a.add').attr('href'));
|
572
|
+
}
|
573
|
+
Browser.after_close = Component.reopen_slot;
|
574
|
+
Browser.open();
|
577
575
|
|
578
|
-
event.stopImmediatePropagation();
|
579
|
-
return false;
|
580
|
-
});
|
581
576
|
|
582
|
-
|
583
|
-
$(Component.link_input).val($(this).attr('href'));
|
584
|
-
Component.reopen_slot();
|
577
|
+
event.stopImmediatePropagation();
|
585
578
|
return false;
|
586
579
|
});
|
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.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: 2010-11-
|
18
|
+
date: 2010-11-04 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- demo/initializers/secret_token.rb
|
172
172
|
- demo/initializers/session_store.rb
|
173
173
|
- demo/models/gallery.rb
|
174
|
+
- demo/models/home.rb
|
174
175
|
- demo/models/page_a.rb
|
175
176
|
- demo/models/page_b.rb
|
176
177
|
- demo/models/page_c.rb
|