forge-cli 0.1.6 → 0.1.7
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.
- checksums.yaml +4 -4
- data/lib/forge-cli/version.rb +1 -1
- data/lib/forge/app/views/forge/galleries/_form.html.haml +6 -1
- data/lib/forge/lib/assets/javascripts/forge/features/nested_fields.js +28 -16
- data/lib/forge/lib/assets/stylesheets/forge/assets.css.scss +1 -0
- data/lib/forge/vendor/assets/javascripts/jquery.quickSearch.js.erb +18 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb034dc7596b2cf13168ae5f7d8f504e54d8fcbc
|
4
|
+
data.tar.gz: 0f73b2c8c982284f5533553d4fc3b8b0e2c84979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62a94b3ae2dffef6811e27390027e061cf1cefc9515f35bcf3640269a811d73479394ae1dc0d254d144473811f42548e257586b6ff360ad22abcf66fcc21c089
|
7
|
+
data.tar.gz: 8f98b94286c1eef77d657d89a8b185585238ebc7463ec8cdf3bd1b9d9e1438a95cb7b8bd5bb166613eb4317ad0ce1f828ab5b2f78b03fa2223b9cf19f6fdc40a
|
data/lib/forge-cli/version.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
- content_for :scripts do
|
2
2
|
:javascript
|
3
3
|
$(function() {
|
4
|
-
FORGE.features.nestedFields.init('#photos', {
|
4
|
+
FORGE.features.nestedFields.init('#photos', {
|
5
|
+
after: function() {
|
6
|
+
FORGE.features.nestedFields.reorganize(4, '#photos-list li');
|
7
|
+
FORGE.features.nestedFields.setListOrder('#photos-list li');
|
8
|
+
}
|
9
|
+
});
|
5
10
|
FORGE.features.nestedFields.reorganize(4, '#photos-list li');
|
6
11
|
});
|
7
12
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
FORGE.features.nestedFields = {
|
2
2
|
config: {
|
3
3
|
sortable: {
|
4
|
-
|
4
|
+
|
5
5
|
}
|
6
6
|
},
|
7
|
-
|
7
|
+
|
8
8
|
init: function (container, options) {
|
9
9
|
var self = FORGE.features.nestedFields,
|
10
10
|
$container = $(container);
|
11
11
|
$.extend(self.config, options);
|
12
|
-
|
12
|
+
|
13
13
|
$container
|
14
14
|
.on('click', 'a.add_child', self.addChild)
|
15
15
|
.on('click', 'a.remove_child', self.removeChild)
|
@@ -25,7 +25,7 @@ FORGE.features.nestedFields = {
|
|
25
25
|
}
|
26
26
|
});
|
27
27
|
},
|
28
|
-
|
28
|
+
|
29
29
|
addChild: function (e) {
|
30
30
|
e.preventDefault();
|
31
31
|
var self = FORGE.features.nestedFields,
|
@@ -34,11 +34,11 @@ FORGE.features.nestedFields = {
|
|
34
34
|
regexp = new RegExp('new_' + assoc, 'g'),
|
35
35
|
new_id = new Date().getTime(),
|
36
36
|
$list = $('#'+assoc+'-list');
|
37
|
-
|
37
|
+
|
38
38
|
self.runCallback(self.config.before);
|
39
|
-
|
39
|
+
|
40
40
|
$list.append(content.replace(regexp, new_id));
|
41
|
-
|
41
|
+
|
42
42
|
// Maintain the same value as the last select box
|
43
43
|
if (content.match(/<select/)) {
|
44
44
|
var length = $list.find("select").length;
|
@@ -47,37 +47,49 @@ FORGE.features.nestedFields = {
|
|
47
47
|
//$('input').hint();
|
48
48
|
self.runCallback(self.config.after);
|
49
49
|
},
|
50
|
-
|
50
|
+
|
51
51
|
removeChild: function () {
|
52
52
|
var self = FORGE.features.nestedFields,
|
53
53
|
hiddenField = $(this).prev('input[name*=_destroy]')[0];
|
54
|
-
|
55
|
-
if (confirm("Are you sure?")) {
|
54
|
+
|
55
|
+
if (confirm("Are you sure?")) {
|
56
56
|
// Existing records get set as deleted, new records just get cleared out of the DOM
|
57
57
|
if(hiddenField) {
|
58
58
|
hiddenField.value = 'true';
|
59
59
|
}
|
60
|
-
|
60
|
+
|
61
61
|
$(this).closest('li').fadeOut('fast', function() {
|
62
62
|
self.runCallback(self.config.after);
|
63
63
|
});
|
64
|
-
|
64
|
+
|
65
65
|
}
|
66
66
|
return false;
|
67
67
|
},
|
68
|
-
|
68
|
+
|
69
69
|
runCallback: function (callback) {
|
70
70
|
if (typeof(callback) !== 'undefined')
|
71
71
|
callback.call();
|
72
72
|
},
|
73
|
-
|
73
|
+
|
74
74
|
reorganize: function (mod, selector) {
|
75
75
|
var $images = $(selector);
|
76
76
|
$images.removeClass('last');
|
77
77
|
$.each($images, function() {
|
78
78
|
var index = $(this).index(selector + ":visible");
|
79
|
-
if((index + 1) % mod === 0)
|
79
|
+
if((index + 1) % mod === 0) {
|
80
80
|
$(this).addClass('last');
|
81
|
+
}
|
82
|
+
});
|
83
|
+
},
|
84
|
+
|
85
|
+
setListOrder: function (selector) {
|
86
|
+
var $images = $(selector);
|
87
|
+
$.each($images, function() {
|
88
|
+
var listOrder = $(this).find('input[name*=list_order]');
|
89
|
+
var index = $(this).index(selector + ":visible");
|
90
|
+
if (listOrder.length > 0) {
|
91
|
+
listOrder.val(index);
|
92
|
+
}
|
81
93
|
});
|
82
94
|
}
|
83
|
-
}
|
95
|
+
};
|
@@ -35,5 +35,6 @@ ul#assets { list-style:none; padding:20px 0px 20px 10px;
|
|
35
35
|
small { border-bottom:1px solid #343434; color:white; display:block; line-height:20px; padding-bottom:6px; }
|
36
36
|
}
|
37
37
|
a { color:white; font-size:.8em; text-transform:uppercase; }
|
38
|
+
&.no-search-results { color: white; }
|
38
39
|
}
|
39
40
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
(function($) {
|
2
|
-
|
1
|
+
(function($) {
|
2
|
+
|
3
3
|
$.fn.quickSearch = function(options) {
|
4
4
|
var settings = {
|
5
5
|
url: '/',
|
@@ -7,15 +7,15 @@
|
|
7
7
|
holder: $('#item-list'),
|
8
8
|
loader: '<%= asset_path 'forge/ajax-loader.gif' %>'
|
9
9
|
};
|
10
|
-
if ( options )
|
10
|
+
if ( options )
|
11
11
|
$.extend( settings, options );
|
12
|
-
|
12
|
+
|
13
13
|
var previousValue = "";
|
14
|
-
|
14
|
+
|
15
15
|
this.each(function() {
|
16
16
|
$(this).keyup($.debounce(settings.delay, runUpdate));
|
17
17
|
});
|
18
|
-
|
18
|
+
|
19
19
|
function runUpdate() {
|
20
20
|
var currentValue = $(this).val();
|
21
21
|
|
@@ -23,24 +23,24 @@
|
|
23
23
|
if (currentValue == previousValue) {
|
24
24
|
return;
|
25
25
|
}
|
26
|
-
|
27
|
-
// Hide the default content if this is the first time the search is entered
|
26
|
+
|
27
|
+
// Hide the default content if this is the first time the search is entered
|
28
28
|
if (previousValue == '') {
|
29
29
|
hideDefaultContent();
|
30
30
|
}
|
31
|
-
|
31
|
+
|
32
32
|
previousValue = currentValue;
|
33
|
-
|
33
|
+
|
34
34
|
// Restore the old content if search is cleared
|
35
35
|
if (currentValue == '') {
|
36
36
|
restoreDefaultContent();
|
37
37
|
return;
|
38
38
|
}
|
39
|
-
|
39
|
+
|
40
40
|
// Show a loader
|
41
41
|
var loader = $('<li />').css('text-align', 'center').html($('<img />').attr('src', settings.loader))
|
42
42
|
settings.holder.html(loader);
|
43
|
-
|
43
|
+
|
44
44
|
// Run the query
|
45
45
|
$.ajax({
|
46
46
|
url: settings.url,
|
@@ -48,9 +48,11 @@
|
|
48
48
|
dataType: 'HTML',
|
49
49
|
success: function(data) {
|
50
50
|
if ($.trim(data) == '') {
|
51
|
-
var noResult = $('<li />')
|
51
|
+
var noResult = $('<li />')
|
52
|
+
.addClass('no-search-results')
|
53
|
+
.html("Sorry, we couldn't find anything for <strong>" + currentValue + "</strong>.<br /><small>Why don't you try a broader search term, we'll do our best to find what you're looking for!</small>")
|
52
54
|
settings.holder.html(noResult);
|
53
|
-
} else {
|
55
|
+
} else {
|
54
56
|
settings.holder.html(data);
|
55
57
|
}
|
56
58
|
if(typeof searchTrigger == 'function') {
|
@@ -59,14 +61,14 @@
|
|
59
61
|
}
|
60
62
|
})
|
61
63
|
}
|
62
|
-
|
64
|
+
|
63
65
|
function hideDefaultContent() {
|
64
66
|
$('<div id="hidden-quick-search-content"/>').html(settings.holder.html()).css('display', 'none').appendTo('body');
|
65
67
|
$('#item-list-bottom div.regular').fadeOut('fast', function() {
|
66
68
|
$('#item-list-bottom div.search-results').fadeIn('fast');
|
67
69
|
});
|
68
70
|
}
|
69
|
-
|
71
|
+
|
70
72
|
function restoreDefaultContent() {
|
71
73
|
settings.holder.html($('#hidden-quick-search-content').html());
|
72
74
|
$('#item-list-bottom div.search-results').fadeOut('fast', function() {
|