populate-me 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffa555c375c147ea8402816359b8b225d60c7368
|
4
|
+
data.tar.gz: d0336d760d44cdcdc82a682b0cc59354df8eafeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2db9d92250e619bfb7fea8c8970b739de5f46c790616ff41e7694a02171b931107b1d8b3524ce50982892a4c311b8dbdda251705d626cff95d7763212febc765
|
7
|
+
data.tar.gz: e2b70515a0afedf3d878d13e061d8e3c2a2cd8ed1748c9e3d32c828c0dfb5c4ce086d985041c391455b44c3f70942d40367431c847bc6e8a1fb2a9ab693b8adc
|
@@ -20,15 +20,18 @@
|
|
20
20
|
});
|
21
21
|
$('.'+settings.link_class, $el)
|
22
22
|
.on('click.columnav', function(e,cb) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
root.trigger('pop.columnav',[removable,function(cb_info) {
|
23
|
+
if (!root.busy) {
|
24
|
+
root.busy = true;
|
25
|
+
$('.'+settings.link_class, $el).removeClass(settings.selected_link_class);
|
26
|
+
var $this = $(this).addClass(settings.selected_link_class);
|
27
|
+
var removable = $this.parents('.'+settings.column_class).nextAll();
|
28
|
+
if (removable.length === 0) {
|
30
29
|
root.trigger('getandpush.columnav',[$this.attr('href'),cb]);
|
31
|
-
}
|
30
|
+
} else {
|
31
|
+
root.trigger('pop.columnav',[removable,function(cb_info) {
|
32
|
+
root.trigger('getandpush.columnav',[$this.attr('href'),cb]);
|
33
|
+
}]);
|
34
|
+
}
|
32
35
|
}
|
33
36
|
e.preventDefault();
|
34
37
|
});
|
@@ -39,12 +42,14 @@
|
|
39
42
|
overflow: 'scroll',
|
40
43
|
whiteSpace: 'nowrap'
|
41
44
|
});
|
45
|
+
root.busy = false;
|
42
46
|
root.on('push.columnav', function(e,data,cb) {
|
43
47
|
var $data = $("<li class='"+settings.column_class+"'>"+data+"</li>");
|
44
48
|
root.append($data);
|
45
49
|
new_column($data, root);
|
46
50
|
var cb_object = {event:e,column:$data,container:root,settings:settings};
|
47
51
|
root.animate({scrollLeft: root.width()},function(){
|
52
|
+
root.busy = false;
|
48
53
|
settings.on_push(cb_object);
|
49
54
|
if (typeof cb == 'function') cb(cb_object);
|
50
55
|
});
|
@@ -17,7 +17,7 @@ module PopulateMe
|
|
17
17
|
class_name: self.class.name,
|
18
18
|
id: self.id,
|
19
19
|
admin_url: to_admin_url,
|
20
|
-
title: to_s,
|
20
|
+
title: WebUtils.truncate(to_s, 60),
|
21
21
|
image_url: admin_image_url,
|
22
22
|
local_menu: self.class.relationships.inject([]) do |out,(k,v)|
|
23
23
|
unless v[:hidden]
|
data/lib/populate_me/version.rb
CHANGED
@@ -40,4 +40,28 @@ describe PopulateMe::Document, 'AdminAdapter' do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
describe '#to_admin_list_item' do
|
44
|
+
class ContentTitle < PopulateMe::Document
|
45
|
+
field :content
|
46
|
+
end
|
47
|
+
describe 'When title is long' do
|
48
|
+
it 'Is truncated' do
|
49
|
+
doc = ContentTitle.new
|
50
|
+
doc.content = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
51
|
+
title = doc.to_admin_list_item[:title]
|
52
|
+
refute_equal doc.content, title
|
53
|
+
assert_match title.sub(/\.\.\.$/, ''), doc.content
|
54
|
+
assert_operator title.length, :<=, doc.content.length
|
55
|
+
end
|
56
|
+
end
|
57
|
+
describe 'When title is short enough' do
|
58
|
+
it 'Does not truncate' do
|
59
|
+
doc = ContentTitle.new
|
60
|
+
doc.content = 'Hello'
|
61
|
+
title = doc.to_admin_list_item[:title]
|
62
|
+
assert_equal doc.content, title
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
43
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: populate-me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickael Riga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: web-utils
|