enki-engine 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/admin/actions.js +1 -1
- data/app/assets/javascripts/admin/common.js +26 -20
- data/app/assets/javascripts/admin/dashboard.js +22 -20
- data/app/assets/javascripts/admin/edit-preview.js +4 -4
- data/app/assets/javascripts/admin/shortcut.js +96 -45
- data/app/assets/javascripts/common.js +10 -8
- data/app/assets/javascripts/live-comment-preview.js +19 -13
- data/app/controllers/enki/admin/pages_controller.rb +2 -2
- data/app/controllers/enki/admin/posts_controller.rb +3 -3
- data/app/models/enki/base/post.rb +5 -3
- data/app/models/enki/delete_post_undo.rb +1 -1
- data/app/views/enki/admin/comments/index.html.erb +2 -1
- data/app/views/enki/admin/pages/_form.html.erb +1 -1
- data/app/views/enki/admin/pages/index.html.erb +1 -1
- data/app/views/enki/admin/posts/_form.html.erb +1 -1
- data/app/views/enki/admin/posts/_post.html.erb +1 -1
- data/app/views/enki/admin/posts/index.html.erb +2 -1
- data/enki-engine.gemspec +2 -2
- data/lib/enki/version.rb +1 -1
- data/spec/controllers/admin/pages_controller_spec.rb +1 -1
- data/spec/controllers/admin/posts_controller_spec.rb +2 -2
- metadata +89 -30
- data/app/assets/javascripts/admin/comments.js +0 -3
- data/app/assets/javascripts/admin/pages.js +0 -1
- data/app/assets/javascripts/admin/posts.js +0 -1
@@ -1,21 +1,21 @@
|
|
1
|
+
var undo_stack = [];
|
2
|
+
|
1
3
|
jQuery.delegate = function(rules) {
|
2
4
|
return function(e) {
|
3
5
|
var target = $(e.target);
|
4
|
-
for (var selector in rules)
|
5
|
-
if (target.is(selector))
|
6
|
-
|
7
|
-
}
|
6
|
+
for (var selector in rules) {
|
7
|
+
if (target.is(selector)) {
|
8
|
+
return rules[selector].apply(this, $.makeArray(arguments));
|
9
|
+
}
|
10
|
+
}
|
11
|
+
};
|
12
|
+
};
|
8
13
|
|
9
14
|
$(document).ajaxSend(function(e, xhr, options) {
|
10
15
|
var token = $("meta[name='csrf-token']").attr("content");
|
11
16
|
xhr.setRequestHeader("X-CSRF-Token", token);
|
12
17
|
});
|
13
18
|
|
14
|
-
function restripe() {
|
15
|
-
$('table tr:odd').removeClass('alt');
|
16
|
-
$('table tr:even').addClass('alt');
|
17
|
-
}
|
18
|
-
|
19
19
|
function asyncDeleteForm(obj, options) {
|
20
20
|
$.ajax($.extend({
|
21
21
|
type: "DELETE",
|
@@ -25,7 +25,7 @@ function asyncDeleteForm(obj, options) {
|
|
25
25
|
},
|
26
26
|
dataType: 'json',
|
27
27
|
success: function(msg){
|
28
|
-
display = msg.undo_message
|
28
|
+
display = msg.undo_message;
|
29
29
|
if (msg.undo_path) {
|
30
30
|
display += '<span class="undo-link"> (<a class="undo-link" href="' + msg.undo_path + '">undo</a>)</span>';
|
31
31
|
undo_stack.push(msg.undo_path);
|
@@ -56,7 +56,9 @@ function processUndo(path, options) {
|
|
56
56
|
|
57
57
|
// Assume success and remove undo link
|
58
58
|
$('a.undo-link[href=' + path + ']').parent('span').hide();
|
59
|
-
undo_stack = jQuery.grep(undo_stack, function(e) {
|
59
|
+
undo_stack = jQuery.grep(undo_stack, function(e) {
|
60
|
+
return e != path;
|
61
|
+
});
|
60
62
|
}
|
61
63
|
|
62
64
|
function asyncUndoBehaviour(options) {
|
@@ -69,22 +71,20 @@ function asyncUndoBehaviour(options) {
|
|
69
71
|
jQuery.each(["Ctrl+Z", "Meta+Z"], function () {
|
70
72
|
shortcut.add(this, function() {
|
71
73
|
item = undo_stack.pop();
|
72
|
-
if (item)
|
73
|
-
processUndo(item, options)
|
74
|
-
else
|
74
|
+
if (item) {
|
75
|
+
processUndo(item, options);
|
76
|
+
} else {
|
75
77
|
humanMsg.displayMsg("Nothing to undo");
|
78
|
+
}
|
76
79
|
});
|
77
80
|
});
|
78
81
|
}
|
79
82
|
|
80
|
-
var undo_stack = new Array();
|
81
|
-
|
82
83
|
function onDeleteFormClick() {
|
83
84
|
asyncDeleteForm($(this));
|
84
85
|
|
85
86
|
// Assume success and remove item
|
86
87
|
$(this).parent('td').parent('tr').remove();
|
87
|
-
restripe();
|
88
88
|
return false;
|
89
89
|
}
|
90
90
|
|
@@ -98,12 +98,18 @@ function destroyAndUndoBehaviour(type) {
|
|
98
98
|
|
99
99
|
$('form.delete-item').unbind('submit', onDeleteFormClick);
|
100
100
|
$('form.delete-item').submit(onDeleteFormClick);
|
101
|
-
restripe();
|
102
101
|
});
|
103
|
-
}
|
102
|
+
}
|
104
103
|
});
|
105
104
|
|
106
105
|
$('form.delete-item').submit(onDeleteFormClick);
|
107
|
-
}
|
106
|
+
};
|
108
107
|
}
|
109
108
|
|
109
|
+
$(document).ready(function() {
|
110
|
+
$(['posts', 'comments', 'pages']).each(function() {
|
111
|
+
if ($('#' + this).length > 0) {
|
112
|
+
destroyAndUndoBehaviour(this)();
|
113
|
+
}
|
114
|
+
});
|
115
|
+
});
|
@@ -4,30 +4,32 @@ function extractId(obj) {
|
|
4
4
|
}
|
5
5
|
|
6
6
|
$(document).ready(function (){
|
7
|
-
$('
|
7
|
+
if ($('#recent-comments').length) {
|
8
|
+
$('.comment-body').hide();
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
$('.comment-link').click(function() {
|
11
|
+
comment_body_id = '#comment-body-' + extractId($(this));
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
$('.comment-body').not(comment_body_id).hide();
|
14
|
+
$(comment_body_id).toggle();
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
return false;
|
17
|
+
});
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
$(document).click(function() {
|
20
|
+
$('.comment-body').hide();
|
21
|
+
});
|
21
22
|
|
22
|
-
|
23
|
+
asyncUndoBehaviour();
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
$('form.delete-item').submit(function () {
|
26
|
+
asyncDeleteForm($(this));
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
28
|
+
// Assume success and remove comment
|
29
|
+
comment_link_id = '#comment-link-' + extractId($(this));
|
30
|
+
$(comment_link_id).remove();
|
31
|
+
$(this).parent('div').parent('div').remove();
|
32
|
+
return false;
|
33
|
+
});
|
34
|
+
}
|
35
|
+
});
|
@@ -3,11 +3,11 @@ $(document).ready(function() {
|
|
3
3
|
|
4
4
|
if (form.length > 0 && form.attr('id').match(/^(new_enki_post|edit_enki_post|new_enki_page|edit_enki_page)/)) {
|
5
5
|
var dest = window.location.href;
|
6
|
-
dest = dest.replace(/\/(new|\d+)$/, '')
|
7
|
-
dest = dest + '/preview'
|
6
|
+
dest = dest.replace(/\/(new|\d+)$/, '');
|
7
|
+
dest = dest + '/preview';
|
8
8
|
|
9
9
|
var toggle_preview = function() {
|
10
|
-
if ($('#preview').length
|
10
|
+
if ($('#preview').length === 0) {
|
11
11
|
form.hide();
|
12
12
|
form.after('<div id="preview"><h3>Your entry will be formatted like this:</h3><p>Use Ctrl+E to return to edit mode.</p><div class="content"><p>Please wait...</p></div></div>');
|
13
13
|
|
@@ -28,7 +28,7 @@ $(document).ready(function() {
|
|
28
28
|
$('#preview').remove();
|
29
29
|
form.show();
|
30
30
|
}
|
31
|
-
}
|
31
|
+
};
|
32
32
|
|
33
33
|
$(document).keyup(function(e) {
|
34
34
|
if (e.ctrlKey && (e.which == 69)) { // Works in recent Safari and FF, unsure about IE
|
@@ -14,39 +14,64 @@ shortcut = {
|
|
14
14
|
'disable_in_input':false,
|
15
15
|
'target':document,
|
16
16
|
'keycode':false
|
17
|
-
}
|
18
|
-
if(!opt)
|
19
|
-
|
17
|
+
};
|
18
|
+
if(!opt) {
|
19
|
+
opt = default_options;
|
20
|
+
} else {
|
20
21
|
for(var dfo in default_options) {
|
21
|
-
if(typeof opt[dfo] == 'undefined')
|
22
|
+
if(typeof opt[dfo] == 'undefined') {
|
23
|
+
opt[dfo] = default_options[dfo];
|
24
|
+
}
|
22
25
|
}
|
23
26
|
}
|
24
27
|
|
25
|
-
var ele = opt.target
|
26
|
-
|
27
|
-
|
28
|
+
var ele = opt.target,
|
29
|
+
ths = this;
|
30
|
+
|
31
|
+
if(typeof opt.target === 'string') {
|
32
|
+
ele = document.getElementById(opt.target);
|
33
|
+
}
|
28
34
|
shortcut_combination = shortcut_combination.toLowerCase();
|
29
35
|
|
30
36
|
//The function to be called at keypress
|
31
37
|
var func = function(e) {
|
32
38
|
e = e || window.event;
|
33
39
|
|
34
|
-
if(opt
|
40
|
+
if(opt.disable_in_input) { //Don't enable shortcut keys in Input, Textarea fields
|
35
41
|
var element;
|
36
|
-
if(e.target)
|
37
|
-
|
38
|
-
|
42
|
+
if(e.target) {
|
43
|
+
element=e.target;
|
44
|
+
}
|
45
|
+
else if(e.srcElement) {
|
46
|
+
element=e.srcElement;
|
47
|
+
}
|
48
|
+
if(element.nodeType==3) {
|
49
|
+
element=element.parentNode;
|
50
|
+
}
|
39
51
|
|
40
|
-
if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA')
|
52
|
+
if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') {
|
53
|
+
return;
|
54
|
+
}
|
41
55
|
}
|
42
56
|
|
43
57
|
//Find Which key is pressed
|
44
|
-
if (e.keyCode)
|
45
|
-
|
58
|
+
if (e.keyCode) {
|
59
|
+
code = e.keyCode;
|
60
|
+
}
|
61
|
+
else if (e.which) {
|
62
|
+
code = e.which;
|
63
|
+
}
|
46
64
|
var character = String.fromCharCode(code).toLowerCase();
|
47
65
|
|
48
|
-
|
49
|
-
if(code ==
|
66
|
+
//If the user presses , when the type is onkeydown
|
67
|
+
if(code == 188) {
|
68
|
+
character=",";
|
69
|
+
}
|
70
|
+
|
71
|
+
//If the user presses , when the type is onkeydown
|
72
|
+
if(code == 190) {
|
73
|
+
character=".";
|
74
|
+
}
|
50
75
|
|
51
76
|
var keys = shortcut_combination.split("+");
|
52
77
|
//Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
|
@@ -73,7 +98,7 @@ shortcut = {
|
|
73
98
|
".":">",
|
74
99
|
"/":"?",
|
75
100
|
"\\":"|"
|
76
|
-
}
|
101
|
+
};
|
77
102
|
//Special Keys - and their codes
|
78
103
|
var special_keys = {
|
79
104
|
'esc':27,
|
@@ -127,7 +152,7 @@ shortcut = {
|
|
127
152
|
'f10':121,
|
128
153
|
'f11':122,
|
129
154
|
'f12':123
|
130
|
-
}
|
155
|
+
};
|
131
156
|
|
132
157
|
var modifiers = {
|
133
158
|
shift: { wanted:false, pressed:false},
|
@@ -136,12 +161,21 @@ shortcut = {
|
|
136
161
|
meta : { wanted:false, pressed:false} //Meta is Mac specific
|
137
162
|
};
|
138
163
|
|
139
|
-
if(e.ctrlKey)
|
140
|
-
|
141
|
-
|
142
|
-
if(e.
|
164
|
+
if(e.ctrlKey) {
|
165
|
+
modifiers.ctrl.pressed = true;
|
166
|
+
}
|
167
|
+
if(e.shiftKey) {
|
168
|
+
modifiers.shift.pressed = true;
|
169
|
+
}
|
170
|
+
if(e.altKey) {
|
171
|
+
modifiers.alt.pressed = true;
|
172
|
+
}
|
173
|
+
if(e.metaKey) {
|
174
|
+
modifiers.meta.pressed = true;
|
175
|
+
}
|
143
176
|
|
144
|
-
for(var i=0;
|
177
|
+
for(var i=0; i<keys.length; i++) {
|
178
|
+
var k=keys[i];
|
145
179
|
//Modifiers
|
146
180
|
if(k == 'ctrl' || k == 'control') {
|
147
181
|
kp++;
|
@@ -158,17 +192,24 @@ shortcut = {
|
|
158
192
|
kp++;
|
159
193
|
modifiers.meta.wanted = true;
|
160
194
|
} else if(k.length > 1) { //If it is a special key
|
161
|
-
if(special_keys[k] == code)
|
195
|
+
if(special_keys[k] == code) {
|
196
|
+
kp++;
|
197
|
+
}
|
162
198
|
|
163
|
-
} else if(opt
|
164
|
-
if(opt
|
199
|
+
} else if(opt.keycode) {
|
200
|
+
if(opt.keycode == code) {
|
201
|
+
kp++;
|
202
|
+
}
|
165
203
|
|
166
204
|
} else { //The special keys did not match
|
167
|
-
if(character == k)
|
168
|
-
|
205
|
+
if(character == k) {
|
206
|
+
kp++;
|
207
|
+
} else {
|
169
208
|
if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
|
170
209
|
character = shift_nums[character];
|
171
|
-
if(character == k)
|
210
|
+
if(character == k) {
|
211
|
+
kp++;
|
212
|
+
}
|
172
213
|
}
|
173
214
|
}
|
174
215
|
}
|
@@ -181,7 +222,7 @@ shortcut = {
|
|
181
222
|
modifiers.meta.pressed == modifiers.meta.wanted) {
|
182
223
|
callback(e);
|
183
224
|
|
184
|
-
if(!opt
|
225
|
+
if(!opt.propagate) { //Stop the event
|
185
226
|
//e.cancelBubble is supported by IE - this will kill the bubbling process.
|
186
227
|
e.cancelBubble = true;
|
187
228
|
e.returnValue = false;
|
@@ -194,30 +235,40 @@ shortcut = {
|
|
194
235
|
return false;
|
195
236
|
}
|
196
237
|
}
|
197
|
-
}
|
238
|
+
};
|
198
239
|
this.all_shortcuts[shortcut_combination] = {
|
199
240
|
'callback':func,
|
200
241
|
'target':ele,
|
201
|
-
'event': opt
|
242
|
+
'event': opt.type
|
202
243
|
};
|
203
244
|
//Attach the function with the event
|
204
|
-
if(ele.addEventListener)
|
205
|
-
|
206
|
-
|
245
|
+
if(ele.addEventListener) {
|
246
|
+
ele.addEventListener(opt.type, func, false);
|
247
|
+
} else if(ele.attachEvent) {
|
248
|
+
ele.attachEvent('on'+opt.type, func);
|
249
|
+
} else {
|
250
|
+
ele['on'+opt.type] = func;
|
251
|
+
}
|
207
252
|
},
|
208
253
|
|
209
254
|
//Remove the shortcut - just specify the shortcut and I will remove the binding
|
210
255
|
'remove':function(shortcut_combination) {
|
211
256
|
shortcut_combination = shortcut_combination.toLowerCase();
|
212
257
|
var binding = this.all_shortcuts[shortcut_combination];
|
213
|
-
delete(this.all_shortcuts[shortcut_combination])
|
214
|
-
if(!binding)
|
215
|
-
|
216
|
-
|
217
|
-
var
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
258
|
+
delete(this.all_shortcuts[shortcut_combination]);
|
259
|
+
if(!binding) {
|
260
|
+
return;
|
261
|
+
}
|
262
|
+
var type = binding.event;
|
263
|
+
var ele = binding.target;
|
264
|
+
var callback = binding.callback;
|
265
|
+
|
266
|
+
if(ele.detachEvent) {
|
267
|
+
ele.detachEvent('on'+type, callback);
|
268
|
+
} else if(ele.removeEventListener) {
|
269
|
+
ele.removeEventListener(type, callback, false);
|
270
|
+
} else {
|
271
|
+
ele['on'+type] = false;
|
272
|
+
}
|
222
273
|
}
|
223
|
-
}
|
274
|
+
};
|
@@ -1,22 +1,24 @@
|
|
1
1
|
// Based on http://www.germanforblack.com/javascript-sleeping-keypress-delays-and-bashing-bad-articles
|
2
2
|
Function.prototype.only_every = function (millisecond_delay) {
|
3
|
-
if (!window.only_every_func)
|
4
|
-
{
|
3
|
+
if (!window.only_every_func) {
|
5
4
|
var function_object = this;
|
6
|
-
window.only_every_func = setTimeout(function() {
|
7
|
-
|
5
|
+
window.only_every_func = setTimeout(function() {
|
6
|
+
function_object();
|
7
|
+
window.only_every_func = null;
|
8
|
+
}, millisecond_delay);
|
9
|
+
}
|
8
10
|
};
|
9
11
|
|
10
12
|
// http://www.ivanuzunov.net/top-10-javascript-stringprototype-extensions/
|
11
13
|
String.prototype.endsWith = function(t, i) {
|
12
|
-
if (i
|
14
|
+
if (i===false) {
|
13
15
|
return (t == this.substring(this.length - t.length));
|
14
16
|
} else {
|
15
17
|
return (t.toLowerCase() == this.substring(this.length - t.length).toLowerCase());
|
16
18
|
}
|
17
|
-
}
|
19
|
+
};
|
18
20
|
|
19
21
|
// jQuery extensions
|
20
22
|
jQuery.prototype.any = function(callback) {
|
21
|
-
return (this.filter(callback).length > 0)
|
22
|
-
}
|
23
|
+
return (this.filter(callback).length > 0);
|
24
|
+
};
|
@@ -1,36 +1,42 @@
|
|
1
1
|
$(function() { // onload
|
2
|
-
var comment_form = $('#new_comment')
|
3
|
-
var input_elements = comment_form.find(':text, textarea')
|
2
|
+
var comment_form = $('#new_comment');
|
3
|
+
var input_elements = comment_form.find(':text, textarea');
|
4
4
|
var fetch_comment_preview = function() {
|
5
5
|
var dest = window.location.href;
|
6
6
|
dest = dest.split('#')[0];
|
7
7
|
dest = dest.split('?')[0];
|
8
8
|
|
9
|
-
if (!dest.endsWith('comments'))
|
9
|
+
if (!dest.endsWith('comments')) {
|
10
10
|
dest += '/comments';
|
11
|
+
}
|
11
12
|
|
12
13
|
jQuery.ajax({
|
13
14
|
data: comment_form.serialize(),
|
14
15
|
url: dest + '/new',
|
16
|
+
dataType: 'html',
|
15
17
|
timeout: 2000,
|
16
18
|
error: function() {
|
17
|
-
if ($('#comment-preview').length
|
18
|
-
comment_form.after('<div id="comment-preview"></div>')
|
19
|
+
if ($('#comment-preview').length === 0) {
|
20
|
+
comment_form.after('<div id="comment-preview"></div>');
|
19
21
|
}
|
20
22
|
$('#comment-preview').text("Failed to submit");
|
21
23
|
},
|
22
24
|
success: function(r) {
|
23
|
-
if ($('#comment-preview').length
|
24
|
-
comment_form.after('<h2>Your comment will look like this:</h2><div id="comment-preview"></div>')
|
25
|
+
if ($('#comment-preview').length === 0) {
|
26
|
+
comment_form.after('<h2>Your comment will look like this:</h2><div id="comment-preview"></div>');
|
25
27
|
}
|
26
|
-
$('#comment-preview').html(r)
|
28
|
+
$('#comment-preview').html(r);
|
27
29
|
}
|
28
|
-
})
|
29
|
-
}
|
30
|
+
});
|
31
|
+
};
|
30
32
|
|
31
33
|
input_elements.keyup(function () {
|
32
34
|
fetch_comment_preview.only_every(1000);
|
33
|
-
})
|
34
|
-
|
35
|
+
});
|
36
|
+
|
37
|
+
if (input_elements.any(function() {
|
38
|
+
return $(this).val().length > 0;
|
39
|
+
})) {
|
35
40
|
fetch_comment_preview();
|
36
|
-
}
|
41
|
+
}
|
42
|
+
});
|
@@ -18,7 +18,7 @@ module Enki
|
|
18
18
|
respond_to do |format|
|
19
19
|
format.html {
|
20
20
|
flash[:notice] = "Created page '#{@page.title}'"
|
21
|
-
redirect_to enki.
|
21
|
+
redirect_to enki.admin_pages_path
|
22
22
|
}
|
23
23
|
end
|
24
24
|
else
|
@@ -33,7 +33,7 @@ module Enki
|
|
33
33
|
respond_to do |format|
|
34
34
|
format.html {
|
35
35
|
flash[:notice] = "Updated page '#{@page.title}'"
|
36
|
-
redirect_to enki.
|
36
|
+
redirect_to enki.admin_pages_path
|
37
37
|
}
|
38
38
|
end
|
39
39
|
else
|
@@ -17,7 +17,7 @@ module Enki
|
|
17
17
|
respond_to do |format|
|
18
18
|
format.html {
|
19
19
|
flash[:notice] = "Created post '#{@post.title}'"
|
20
|
-
redirect_to(enki.
|
20
|
+
redirect_to(enki.admin_posts_path)
|
21
21
|
}
|
22
22
|
end
|
23
23
|
else
|
@@ -32,7 +32,7 @@ module Enki
|
|
32
32
|
respond_to do |format|
|
33
33
|
format.html {
|
34
34
|
flash[:notice] = "Updated post '#{@post.title}'"
|
35
|
-
redirect_to(enki.
|
35
|
+
redirect_to(enki.admin_posts_path)
|
36
36
|
}
|
37
37
|
end
|
38
38
|
else
|
@@ -74,7 +74,7 @@ module Enki
|
|
74
74
|
end
|
75
75
|
format.json {
|
76
76
|
render :json => {
|
77
|
-
:undo_path => undo_admin_undo_item_path(undo_item),
|
77
|
+
:undo_path => enki.undo_admin_undo_item_path(undo_item),
|
78
78
|
:undo_message => undo_item.description,
|
79
79
|
:post => @post.attributes
|
80
80
|
}
|
@@ -11,9 +11,11 @@ module Enki
|
|
11
11
|
has_many :taggings, :as => :taggable, :dependent => :destroy, :include => :tag
|
12
12
|
has_many :base_tags, :through => :taggings, :source => :tag
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
if Enki.config.comments?
|
15
|
+
has_many :comments, :dependent => :destroy
|
16
|
+
has_many :approved_comments, :class_name => 'Comment'
|
17
|
+
end
|
18
|
+
|
17
19
|
attr_accessible :body, :edited_at, :minor_edit, :published_at, :published_at_natural, :slug, :tag_list, :title,
|
18
20
|
:body_html, :active, :cached_tag_list, :created_at, :updated_at, :approved_comments_count, :author
|
19
21
|
|
@@ -29,7 +29,7 @@ module Enki
|
|
29
29
|
|
30
30
|
class << self
|
31
31
|
def create_undo(post)
|
32
|
-
DeletePostUndo.create!(:data => {:post => post.attributes, :comments => post.comments.collect(&:attributes)}.to_yaml)
|
32
|
+
DeletePostUndo.create!(:data => {:post => post.attributes, :comments => Enki.config.comments? && post.comments.collect(&:attributes)}.to_yaml)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<%= form.input :title %>
|
2
2
|
<%= form.input :slug, :hint => "Leave blank for an auto-generated slug based on the title." %>
|
3
|
-
<%= form.input :body, :hint => "<a href='http://textile.thresholdstate.com/'>Textile enabled</a>. Use Ctrl+E to switch between preview and edit mode.".html_safe %>
|
3
|
+
<%= form.input :body, :hint => "<a target='_blank' href='http://textile.thresholdstate.com/'>Textile enabled</a>. Use Ctrl+E to switch between preview and edit mode.".html_safe %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<fieldset>
|
2
2
|
<%= form.input :title -%>
|
3
3
|
<%= form.input :slug, :hint => "Leave blank for an auto-generated slug based on the title." -%>
|
4
|
-
<%= form.input :body, :hint => "<a href='http://textile.thresholdstate.com/'>Textile enabled</a>. Use Ctrl+E to switch between preview and edit mode.".html_safe -%>
|
4
|
+
<%= form.input :body, :hint => "<a target='_blank' href='http://textile.thresholdstate.com/'>Textile enabled</a>. Use Ctrl+E to switch between preview and edit mode.".html_safe -%>
|
5
5
|
</fieldset>
|
6
6
|
<%= render :partial => 'enki/admin/posts/upload_form', :locals => { :form => form } -%>
|
7
7
|
<%= render :partial => 'enki/admin/posts/taggings_form', :locals => { :form => form } if tags? -%>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<td>
|
7
7
|
<%= link_to(image_tag('silk/pencil.png', :alt => 'edit'), enki.admin_post_path(post)) %>
|
8
8
|
<%= form_for(post, :as => :post, :url => enki.admin_post_path(post), :html => {:class => 'delete-item', :method => :delete}) do |form| -%>
|
9
|
-
<%= image_submit_tag("silk/delete.png", :alt => 'Delete
|
9
|
+
<%= image_submit_tag("silk/delete.png", :alt => 'Delete Post') %>
|
10
10
|
<% end -%>
|
11
11
|
</td>
|
12
12
|
</tr>
|
data/enki-engine.gemspec
CHANGED
@@ -5,7 +5,7 @@ require "enki/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "enki-engine"
|
7
7
|
s.version = Enki::VERSION
|
8
|
-
s.date =
|
8
|
+
s.date = `git log -1 --format="%cd" --date=short lib/enki/version.rb`
|
9
9
|
s.authors = ["James McCarthy", "Andy Triggs", "Xavier Shay"]
|
10
10
|
s.email = ["james2mccarthy@gmail.com"]
|
11
11
|
s.homepage = "http://github.com/ThisIsHatch/enki_engine"
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_runtime_dependency 'coderay'
|
31
31
|
s.add_runtime_dependency 'lesstile'
|
32
32
|
s.add_runtime_dependency 'simple_form'
|
33
|
-
|
33
|
+
|
34
34
|
s.add_development_dependency 'acts-as-taggable-on'
|
35
35
|
s.add_development_dependency 'rails', "~> 3.2"
|
36
36
|
s.add_development_dependency 'rspec-rails', ">= 2.9"
|
data/lib/enki/version.rb
CHANGED
@@ -81,10 +81,10 @@ module Enki
|
|
81
81
|
do_put
|
82
82
|
end
|
83
83
|
|
84
|
-
it 'it redirects to
|
84
|
+
it 'it redirects to index' do
|
85
85
|
do_put
|
86
86
|
response.should be_redirect
|
87
|
-
response.should redirect_to(
|
87
|
+
response.should redirect_to(admin_posts_path)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enki-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-07-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: RedCloth
|
18
|
-
requirement:
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,15 @@ dependencies:
|
|
23
23
|
version: 4.2.9
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements:
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 4.2.9
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
33
|
name: aaronh-chronic
|
29
|
-
requirement:
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
30
35
|
none: false
|
31
36
|
requirements:
|
32
37
|
- - ! '>='
|
@@ -34,10 +39,15 @@ dependencies:
|
|
34
39
|
version: '0'
|
35
40
|
type: :runtime
|
36
41
|
prerelease: false
|
37
|
-
version_requirements:
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
38
48
|
- !ruby/object:Gem::Dependency
|
39
49
|
name: coderay
|
40
|
-
requirement:
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
41
51
|
none: false
|
42
52
|
requirements:
|
43
53
|
- - ! '>='
|
@@ -45,10 +55,15 @@ dependencies:
|
|
45
55
|
version: '0'
|
46
56
|
type: :runtime
|
47
57
|
prerelease: false
|
48
|
-
version_requirements:
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
49
64
|
- !ruby/object:Gem::Dependency
|
50
65
|
name: lesstile
|
51
|
-
requirement:
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
52
67
|
none: false
|
53
68
|
requirements:
|
54
69
|
- - ! '>='
|
@@ -56,10 +71,15 @@ dependencies:
|
|
56
71
|
version: '0'
|
57
72
|
type: :runtime
|
58
73
|
prerelease: false
|
59
|
-
version_requirements:
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
60
80
|
- !ruby/object:Gem::Dependency
|
61
81
|
name: simple_form
|
62
|
-
requirement:
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
63
83
|
none: false
|
64
84
|
requirements:
|
65
85
|
- - ! '>='
|
@@ -67,10 +87,15 @@ dependencies:
|
|
67
87
|
version: '0'
|
68
88
|
type: :runtime
|
69
89
|
prerelease: false
|
70
|
-
version_requirements:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
71
96
|
- !ruby/object:Gem::Dependency
|
72
97
|
name: acts-as-taggable-on
|
73
|
-
requirement:
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
74
99
|
none: false
|
75
100
|
requirements:
|
76
101
|
- - ! '>='
|
@@ -78,10 +103,15 @@ dependencies:
|
|
78
103
|
version: '0'
|
79
104
|
type: :development
|
80
105
|
prerelease: false
|
81
|
-
version_requirements:
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
82
112
|
- !ruby/object:Gem::Dependency
|
83
113
|
name: rails
|
84
|
-
requirement:
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
85
115
|
none: false
|
86
116
|
requirements:
|
87
117
|
- - ~>
|
@@ -89,10 +119,15 @@ dependencies:
|
|
89
119
|
version: '3.2'
|
90
120
|
type: :development
|
91
121
|
prerelease: false
|
92
|
-
version_requirements:
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ~>
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '3.2'
|
93
128
|
- !ruby/object:Gem::Dependency
|
94
129
|
name: rspec-rails
|
95
|
-
requirement:
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
96
131
|
none: false
|
97
132
|
requirements:
|
98
133
|
- - ! '>='
|
@@ -100,10 +135,15 @@ dependencies:
|
|
100
135
|
version: '2.9'
|
101
136
|
type: :development
|
102
137
|
prerelease: false
|
103
|
-
version_requirements:
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '2.9'
|
104
144
|
- !ruby/object:Gem::Dependency
|
105
145
|
name: factory_girl_rails
|
106
|
-
requirement:
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
107
147
|
none: false
|
108
148
|
requirements:
|
109
149
|
- - ! '>='
|
@@ -111,10 +151,15 @@ dependencies:
|
|
111
151
|
version: '0'
|
112
152
|
type: :development
|
113
153
|
prerelease: false
|
114
|
-
version_requirements:
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
115
160
|
- !ruby/object:Gem::Dependency
|
116
161
|
name: nokogiri
|
117
|
-
requirement:
|
162
|
+
requirement: !ruby/object:Gem::Requirement
|
118
163
|
none: false
|
119
164
|
requirements:
|
120
165
|
- - ~>
|
@@ -122,10 +167,15 @@ dependencies:
|
|
122
167
|
version: 1.5.0
|
123
168
|
type: :development
|
124
169
|
prerelease: false
|
125
|
-
version_requirements:
|
170
|
+
version_requirements: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ~>
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: 1.5.0
|
126
176
|
- !ruby/object:Gem::Dependency
|
127
177
|
name: webrat
|
128
|
-
requirement:
|
178
|
+
requirement: !ruby/object:Gem::Requirement
|
129
179
|
none: false
|
130
180
|
requirements:
|
131
181
|
- - ! '>='
|
@@ -133,10 +183,15 @@ dependencies:
|
|
133
183
|
version: '0'
|
134
184
|
type: :development
|
135
185
|
prerelease: false
|
136
|
-
version_requirements:
|
186
|
+
version_requirements: !ruby/object:Gem::Requirement
|
187
|
+
none: false
|
188
|
+
requirements:
|
189
|
+
- - ! '>='
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
137
192
|
- !ruby/object:Gem::Dependency
|
138
193
|
name: sqlite3
|
139
|
-
requirement:
|
194
|
+
requirement: !ruby/object:Gem::Requirement
|
140
195
|
none: false
|
141
196
|
requirements:
|
142
197
|
- - ! '>='
|
@@ -144,7 +199,12 @@ dependencies:
|
|
144
199
|
version: '0'
|
145
200
|
type: :development
|
146
201
|
prerelease: false
|
147
|
-
version_requirements:
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
none: false
|
204
|
+
requirements:
|
205
|
+
- - ! '>='
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
148
208
|
description: An adaptation of the Enki blogging application as a Rails::Engine, for
|
149
209
|
mounting in a host application
|
150
210
|
email:
|
@@ -177,12 +237,9 @@ files:
|
|
177
237
|
- app/assets/images/silk/pencil.png
|
178
238
|
- app/assets/javascripts/admin.js
|
179
239
|
- app/assets/javascripts/admin/actions.js
|
180
|
-
- app/assets/javascripts/admin/comments.js
|
181
240
|
- app/assets/javascripts/admin/common.js
|
182
241
|
- app/assets/javascripts/admin/dashboard.js
|
183
242
|
- app/assets/javascripts/admin/edit-preview.js
|
184
|
-
- app/assets/javascripts/admin/pages.js
|
185
|
-
- app/assets/javascripts/admin/posts.js
|
186
243
|
- app/assets/javascripts/admin/shortcut.js
|
187
244
|
- app/assets/javascripts/application.js
|
188
245
|
- app/assets/javascripts/common.js
|
@@ -300,6 +357,7 @@ files:
|
|
300
357
|
- spec/controllers/pages_controller_spec.rb
|
301
358
|
- spec/controllers/posts_controller_spec.rb
|
302
359
|
- spec/dummy/Gemfile
|
360
|
+
- spec/dummy/Gemfile.lock
|
303
361
|
- spec/dummy/Rakefile
|
304
362
|
- spec/dummy/app/controllers/application_controller.rb
|
305
363
|
- spec/dummy/config.ru
|
@@ -380,7 +438,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
380
438
|
version: 1.2.0
|
381
439
|
requirements: []
|
382
440
|
rubyforge_project: enki-engine
|
383
|
-
rubygems_version: 1.8.
|
441
|
+
rubygems_version: 1.8.24
|
384
442
|
signing_key:
|
385
443
|
specification_version: 3
|
386
444
|
summary: A Rails3 engine adapted from Xavier Shay's Enki blogging app
|
@@ -407,6 +465,7 @@ test_files:
|
|
407
465
|
- spec/controllers/pages_controller_spec.rb
|
408
466
|
- spec/controllers/posts_controller_spec.rb
|
409
467
|
- spec/dummy/Gemfile
|
468
|
+
- spec/dummy/Gemfile.lock
|
410
469
|
- spec/dummy/Rakefile
|
411
470
|
- spec/dummy/app/controllers/application_controller.rb
|
412
471
|
- spec/dummy/config.ru
|
@@ -1 +0,0 @@
|
|
1
|
-
$(document).ready(destroyAndUndoBehaviour('pages')); // Defined in admin/common.js
|
@@ -1 +0,0 @@
|
|
1
|
-
$(document).ready(destroyAndUndoBehaviour('posts')); // Defined in admin/common.js
|