tb_blog 1.2.1 → 1.3.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/admin/blog/post_categories.js +100 -98
- data/app/assets/javascripts/admin/blog/posts.js +53 -60
- data/app/assets/stylesheets/admin/blog/application.css.scss +30 -73
- data/app/controllers/admin/post_categories_controller.rb +3 -3
- data/app/controllers/admin/post_comments_controller.rb +2 -0
- data/app/controllers/admin/posts_controller.rb +4 -1
- data/app/controllers/posts_controller.rb +3 -0
- data/app/models/spud/spud_post_model.rb +2 -1
- data/app/views/admin/post_categories/_category.html.erb +7 -14
- data/app/views/admin/post_categories/_form.html.erb +9 -11
- data/app/views/admin/post_categories/index.html.erb +8 -9
- data/app/views/admin/post_comments/index.html.erb +8 -10
- data/app/views/admin/posts/_form.html.erb +82 -92
- data/app/views/admin/posts/index.html.erb +57 -38
- data/app/views/admin/posts/new.html.erb +1 -1
- data/db/migrate/20121113135812_add_nested_set_to_post_categories.rb +2 -2
- data/lib/spud_blog/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ff051c880e167863c62338d656dc998b1c646fd
|
4
|
+
data.tar.gz: 7e92aee8c71a94de5703385f013d6f3157dd690f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b5299d1d8cbddadbd517e73f3bd1b78d2dc3a4fcc8d4f018f6829a3cde16b37288ad0beb30f4c11e35515a6e890908e6c40dce82b8ca4bd2b6ee286a37ee64
|
7
|
+
data.tar.gz: a4074b7a6e3d868e23618767782531e226b7f561af8a2dff76b48a433e03179cadc3ead416e60127501d09adadb8a67cf0e826e16f73139cee802ce6c2efc5c8
|
@@ -1,113 +1,115 @@
|
|
1
|
-
|
1
|
+
(function(){
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
spud.admin.post_categories = {
|
4
|
+
init: function(){
|
5
|
+
$('body').on('click', '.spud-blog-manage-categories', clickedManageCategories);
|
6
|
+
$('body').on('click', '.spud-blog-category-add-new', clickedAddNewCategory);
|
7
|
+
$('body').on('click', '.spud-blog-category-edit', clickedEditCategory);
|
8
|
+
$('body').on('click', '.spud-blog-manage-categories-back', clickedBackButton);
|
9
|
+
$('body').on('click', '.spud-blog-manage-categories-save', submittedPostCategoryForm);
|
10
|
+
$('body').on('submit', '.spud-post-category-form', submittedPostCategoryForm);
|
11
|
+
$('body').on('click', '.spud-blog-category-delete', clickedDeleteCategory);
|
12
|
+
}
|
13
|
+
};
|
5
14
|
|
6
|
-
|
7
|
-
$('body').on('click', '.spud_blog_manage_categories', self.clickedManageCategories);
|
8
|
-
$('body').on('click', '.spud_blog_category_add_new', self.clickedAddNewCategory);
|
9
|
-
$('body').on('click', '.spud_blog_category_edit', self.clickedEditCategory);
|
10
|
-
$('body').on('click', '.spud_blog_manage_categories_back', self.clickedBackButton);
|
11
|
-
$('body').on('click', '.spud_blog_manage_categories_save', self.submittedPostCategoryForm);
|
12
|
-
$('body').on('submit', '.spud_post_category_form', self.submittedPostCategoryForm);
|
13
|
-
$('body').on('click', '.spud_blog_category_delete', self.clickedDeleteCategory);
|
14
|
-
};
|
15
|
+
var _cachedCategoryIndex;
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
17
|
+
var clickedManageCategories = function(e){
|
18
|
+
e.preventDefault();
|
19
|
+
$.ajax({
|
20
|
+
url: $(this).attr('href'),
|
21
|
+
success: function(html, textStatus, jqXHR){
|
22
|
+
_cachedCategoryIndex = html;
|
23
|
+
spud.admin.modal.displayWithOptions({
|
24
|
+
title: 'Manage Categories',
|
25
|
+
html: html,
|
26
|
+
buttons: {
|
27
|
+
'spud-blog-manage-categories-back': 'Back',
|
28
|
+
'spud-blog-manage-categories-save btn-primary': 'Save'
|
29
|
+
}
|
30
|
+
});
|
31
|
+
}
|
32
|
+
});
|
33
|
+
};
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
35
|
+
var clickedAddNewCategory = function(e){
|
36
|
+
e.preventDefault();
|
37
|
+
$.ajax({
|
38
|
+
url: $(this).attr('href'),
|
39
|
+
dataType: 'html',
|
40
|
+
success: function(html, textStatus, jqXHR){
|
41
|
+
$('.modal-footer button[data-dismiss="modal"]').hide();
|
42
|
+
$('.spud-blog-manage-categories-save, .spud-blog-manage-categories-back').show();
|
43
|
+
$('.spud-blog-category-manager').replaceWith(html);
|
44
|
+
}
|
45
|
+
});
|
46
|
+
};
|
46
47
|
|
47
|
-
|
48
|
-
|
48
|
+
var clickedEditCategory = function(e){
|
49
|
+
e.preventDefault();
|
50
|
+
$.ajax({
|
51
|
+
url: $(this).attr('href'),
|
52
|
+
dataType: 'html',
|
53
|
+
success: function(html, textStatus, jqXHR){
|
54
|
+
$('.modal-footer button[data-dismiss="modal"]').hide();
|
55
|
+
$('.spud-blog-manage-categories-save, .spud-blog-manage-categories-back').show();
|
56
|
+
$('.spud-blog-category-manager').replaceWith(html);
|
57
|
+
}
|
58
|
+
});
|
59
|
+
};
|
60
|
+
|
61
|
+
var clickedBackButton = function(e){
|
62
|
+
e.preventDefault();
|
63
|
+
$('.spud-post-category-form').replaceWith(_cachedCategoryIndex);
|
64
|
+
$('.modal-footer button[data-dismiss="modal"]').show();
|
65
|
+
$('.spud-blog-manage-categories-save, .spud-blog-manage-categories-back').hide();
|
66
|
+
};
|
67
|
+
|
68
|
+
var clickedDeleteCategory = function(e){
|
69
|
+
e.preventDefault();
|
70
|
+
if(window.confirm('Are you sure you want to delete this category?')){
|
49
71
|
$.ajax({
|
50
72
|
url: $(this).attr('href'),
|
73
|
+
data: {_method: 'delete'},
|
74
|
+
type: 'delete',
|
51
75
|
dataType: 'html',
|
52
76
|
success: function(html, textStatus, jqXHR){
|
53
|
-
|
54
|
-
$('.
|
55
|
-
$('.spud_blog_category_manager').replaceWith(html);
|
77
|
+
_cachedCategoryIndex = html;
|
78
|
+
$('.spud-blog-category-manager').replaceWith(html);
|
56
79
|
}
|
57
80
|
});
|
58
|
-
}
|
81
|
+
}
|
82
|
+
};
|
59
83
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
84
|
+
var submittedPostCategoryForm = function(e){
|
85
|
+
e.preventDefault();
|
86
|
+
var form = $('.spud-post-category-form');
|
87
|
+
$.ajax({
|
88
|
+
url: form.attr('action'),
|
89
|
+
data: form.serialize(),
|
90
|
+
type: 'post',
|
91
|
+
dataType: 'html',
|
92
|
+
success: savedPostCategorySuccess,
|
93
|
+
error: savePostCategoryError
|
94
|
+
});
|
95
|
+
};
|
66
96
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
data: {_method: 'delete'},
|
73
|
-
type: 'delete',
|
74
|
-
dataType: 'html',
|
75
|
-
success: function(html, textStatus, jqXHR){
|
76
|
-
_cachedCategoryIndex = html;
|
77
|
-
$('.spud_blog_category_manager').replaceWith(html);
|
78
|
-
}
|
79
|
-
});
|
80
|
-
}
|
81
|
-
};
|
97
|
+
var savedPostCategorySuccess = function(html, textStatus, jqXHR){
|
98
|
+
_cachedCategoryIndex = html;
|
99
|
+
$('.spud-blog-manage-categories-save, .spud-blog-manage-categories-back').hide();
|
100
|
+
$('.spud-post-category-form').replaceWith(html);
|
101
|
+
};
|
82
102
|
|
83
|
-
|
84
|
-
|
85
|
-
var
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
success: self.savedPostCategorySuccess,
|
92
|
-
error: self.savePostCategoryError
|
93
|
-
});
|
94
|
-
};
|
95
|
-
|
96
|
-
this.savedPostCategorySuccess = function(html, textStatus, jqXHR){
|
97
|
-
_cachedCategoryIndex = html;
|
98
|
-
$('.spud_blog_manage_categories_save, .spud_blog_manage_categories_back').hide();
|
99
|
-
$('.spud_post_category_form').replaceWith(html);
|
100
|
-
};
|
101
|
-
|
102
|
-
this.savePostCategoryError = function(jqXHR, textStatus, errorThrown){
|
103
|
-
if(jqXHR.status == 422){
|
104
|
-
var html = jqXHR.responseText;
|
105
|
-
$('.spud_post_category_form').replaceWith(html);
|
103
|
+
var savePostCategoryError = function(jqXHR, textStatus, errorThrown){
|
104
|
+
if(jqXHR.status == 422){
|
105
|
+
var html = jqXHR.responseText;
|
106
|
+
$('.spud-post-category-form').replaceWith(html);
|
107
|
+
}
|
108
|
+
else{
|
109
|
+
if(window.console){
|
110
|
+
console.error('Oh Snap:', arguments);
|
106
111
|
}
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
}
|
112
|
-
};
|
113
|
-
};
|
112
|
+
}
|
113
|
+
};
|
114
|
+
|
115
|
+
})();
|
@@ -1,66 +1,59 @@
|
|
1
|
-
|
1
|
+
(function(){
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
$('body').on('click', '.save_post_category_button', self.submittedPostCategoryForm);
|
10
|
-
$('body').on('submit', '.spud_post_category_form', self.submittedPostCategoryForm);
|
11
|
-
};
|
3
|
+
spud.admin.posts = {
|
4
|
+
edit: function(){
|
5
|
+
$('body').on('click', '.spud-post-add-category', clickedPostAddCategory);
|
6
|
+
$('body').on('submit', '.spud-post-category-form', submittedPostCategoryForm);
|
7
|
+
}
|
8
|
+
};
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
10
|
+
var clickedPostAddCategory = function(e){
|
11
|
+
e.preventDefault();
|
12
|
+
$.ajax({
|
13
|
+
url: $(this).attr('href'),
|
14
|
+
dataType: 'html',
|
15
|
+
success: function(html, textStatus, jqXHR){
|
16
|
+
spud.admin.modal.displayWithOptions({
|
17
|
+
title: 'Add Category',
|
18
|
+
html: html
|
19
|
+
});
|
20
|
+
}
|
21
|
+
});
|
22
|
+
};
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
24
|
+
var submittedPostCategoryForm = function(e){
|
25
|
+
e.preventDefault();
|
26
|
+
var form = $('.spud-post-category-form');
|
27
|
+
$.ajax({
|
28
|
+
url: form.attr('action'),
|
29
|
+
data: form.serialize(),
|
30
|
+
type: 'post',
|
31
|
+
dataType: 'json',
|
32
|
+
success: savedPostCategorySuccess,
|
33
|
+
error: savePostCategoryError
|
34
|
+
});
|
35
|
+
};
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
else{
|
50
|
-
$('.spud_post_categories_form').append(checkbox);
|
51
|
-
}
|
52
|
-
hideModalDialog();
|
53
|
-
};
|
37
|
+
var savedPostCategorySuccess = function(data, textStatus, jqXHR){
|
38
|
+
var checkbox = '';
|
39
|
+
checkbox += '<li class="spud_post_form_category" data-id="'+data.id+'">';
|
40
|
+
checkbox += '<input id="spud_post_category_'+data.id+'" name="spud_post[category_ids][]" type="checkbox" value="'+data.id+'" checked>' + "\n";
|
41
|
+
checkbox += '<label for="spud_post_category_'+data.id+'">'+data.name+'</label>';
|
42
|
+
checkbox += '<ul></ul></li>';
|
43
|
+
$('.spud-post-categories-list').append(checkbox).scrollTop(99999);
|
44
|
+
spud.admin.modal.hide();
|
45
|
+
};
|
54
46
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
};
|
47
|
+
var savePostCategoryError = function(jqXHR, textStatus, errorThrown){
|
48
|
+
if(jqXHR.status == 422){
|
49
|
+
var html = jqXHR.responseText;
|
50
|
+
$('.spud-post-category-form').replaceWith(html);
|
51
|
+
}
|
52
|
+
else{
|
53
|
+
if(window.console){
|
54
|
+
console.error('Oh Snap:', arguments);
|
55
|
+
}
|
56
|
+
}
|
66
57
|
};
|
58
|
+
|
59
|
+
})();
|
@@ -1,86 +1,47 @@
|
|
1
1
|
// Form Layout
|
2
2
|
//////////////////
|
3
|
-
.
|
4
|
-
|
5
|
-
}
|
6
|
-
.spud_post_form_col{
|
7
|
-
width: 400px;
|
8
|
-
float: left;
|
9
|
-
margin: 0 20px;
|
10
|
-
}
|
11
|
-
.spud_post_form_input_group{
|
12
|
-
border: 1px dashed #E5E5E5;
|
13
|
-
padding: 4px;
|
14
|
-
margin: 0 0 10px;
|
15
|
-
}
|
16
|
-
.spud_post_form_input_group input{
|
3
|
+
.post-published-at-picker{
|
4
|
+
width: 60px;
|
17
5
|
display: inline-block;
|
18
6
|
}
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
.spud_post_form_input_group label{
|
23
|
-
margin: 0 10px 0 0;
|
24
|
-
padding: 0;
|
7
|
+
#spud_post_published_at_2i{
|
8
|
+
width: 105px;
|
25
9
|
}
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
.spud_post_form_help_block{
|
30
|
-
font-size: 12px;
|
31
|
-
font-style: italic;
|
32
|
-
margin: 0 0 20px;
|
33
|
-
display: block;
|
34
|
-
}
|
35
|
-
#spud_post_meta_keywords, #spud_post_meta_description{
|
36
|
-
width: 380px;
|
37
|
-
}
|
38
|
-
#spud_post_meta_description{
|
39
|
-
height: 100px;
|
10
|
+
#spud_post_published_at_1i, #spud_post_published_at_4i{
|
11
|
+
width: 50px;
|
40
12
|
}
|
41
13
|
|
42
14
|
// Categories
|
43
15
|
//////////////
|
44
|
-
.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
min-height: 200px;
|
50
|
-
background: white;
|
51
|
-
border: 1px solid #E5E5E5;
|
52
|
-
padding: 10px 0 10px 15px;
|
53
|
-
overflow: auto;
|
54
|
-
border-radius: 5px;
|
55
|
-
}
|
56
|
-
.spud_post_categories_form ul{
|
57
|
-
list-style-type: none;
|
58
|
-
margin: 0;
|
59
|
-
padding: 0 0 0 15px;
|
60
|
-
}
|
61
|
-
.spud_post_categories_form input{
|
62
|
-
display: inline-block;
|
63
|
-
margin: 0;
|
64
|
-
}
|
65
|
-
.spud_post_categories_form label{
|
66
|
-
display: inline;
|
16
|
+
.table-spud-post-categories{
|
17
|
+
max-height: 250px;
|
18
|
+
overflow-y: scroll;
|
19
|
+
clear: right;
|
20
|
+
margin: 20px 0;
|
67
21
|
}
|
68
|
-
.
|
69
|
-
|
22
|
+
.spud-post-categories-list{
|
23
|
+
list-style: none;
|
24
|
+
max-height: 200px;
|
25
|
+
padding: 4px 8px;
|
26
|
+
overflow-y: scroll;
|
27
|
+
border: 1px solid #cccccc;
|
28
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
29
|
+
border-radius: 4px;
|
70
30
|
}
|
71
31
|
|
72
32
|
// Category Manager
|
73
33
|
//////////////////
|
74
|
-
.
|
75
|
-
float: right;
|
76
|
-
}
|
77
|
-
.spud_blog_category_manager{
|
34
|
+
.spud-blog-category-manager{
|
78
35
|
padding-right: 10px;
|
79
36
|
}
|
80
|
-
.
|
81
|
-
|
37
|
+
.spud-blog-category-manager-table{
|
38
|
+
padding: 0 0 0 20px;
|
39
|
+
margin: 10px 0;
|
40
|
+
min-height: 100px;
|
41
|
+
max-height: 350px;
|
42
|
+
overflow: auto;
|
82
43
|
}
|
83
|
-
.
|
44
|
+
.spud-blog-category-manager-list{
|
84
45
|
clear: right;
|
85
46
|
padding: 0 0 0 20px;
|
86
47
|
margin: 10px 0;
|
@@ -88,21 +49,17 @@
|
|
88
49
|
max-height: 350px;
|
89
50
|
overflow: auto;
|
90
51
|
}
|
91
|
-
.
|
52
|
+
.spud-blog-category-manager-item{
|
92
53
|
position: relative;
|
93
54
|
margin: 10px 0;
|
94
55
|
|
95
56
|
}
|
96
|
-
.
|
97
|
-
margin: 0;
|
98
|
-
padding: 0 0 0 15px;
|
99
|
-
}
|
100
|
-
.spud_blog_category_manager_item_actions{
|
57
|
+
.spud-blog-category-manager-item-actions{
|
101
58
|
position: absolute;
|
102
59
|
right: 0;
|
103
60
|
margin: 0 0 0 10px;
|
104
61
|
}
|
105
|
-
.
|
62
|
+
.spud-blog-manage-categories-save, .spud-blog-manage-categories-back{
|
106
63
|
display: none;
|
107
64
|
}
|
108
65
|
|
@@ -16,7 +16,7 @@ class Admin::PostCategoriesController < Admin::ApplicationController
|
|
16
16
|
|
17
17
|
def update
|
18
18
|
if @post_category.update_attributes(category_params)
|
19
|
-
flash[:notice] = 'Post Category was successfully updated'
|
19
|
+
flash.now[:notice] = 'Post Category was successfully updated'
|
20
20
|
respond_with @post_category, :location => admin_post_categories_path
|
21
21
|
else
|
22
22
|
render 'new', :status => 422
|
@@ -31,7 +31,7 @@ class Admin::PostCategoriesController < Admin::ApplicationController
|
|
31
31
|
def create
|
32
32
|
@post_category = SpudPostCategory.new(category_params)
|
33
33
|
if @post_category.save
|
34
|
-
flash[:notice] = 'Post Category was successfully created'
|
34
|
+
flash.now[:notice] = 'Post Category was successfully created'
|
35
35
|
respond_with @post_category, :location => admin_post_categories_path
|
36
36
|
else
|
37
37
|
render 'new', :status => 422
|
@@ -40,7 +40,7 @@ class Admin::PostCategoriesController < Admin::ApplicationController
|
|
40
40
|
|
41
41
|
def destroy
|
42
42
|
if @post_category.destroy
|
43
|
-
flash[:notice] = 'Post Category was successfully deleted'
|
43
|
+
flash.now[:notice] = 'Post Category was successfully deleted'
|
44
44
|
@post_categories = SpudPostCategory.ordered
|
45
45
|
render 'index'
|
46
46
|
else
|
@@ -4,6 +4,8 @@ class Admin::PostCommentsController < Admin::ApplicationController
|
|
4
4
|
respond_to :html, :xml, :json
|
5
5
|
before_action :load_blog, :only => :index
|
6
6
|
before_action :find_comment, :only => [:show, :edit, :update, :destroy, :approve, :spam]
|
7
|
+
# add_breadcrumb 'Blog Posts', :admin_posts_path
|
8
|
+
# add_breadcrumb 'Comments', :admin_post_comments_path
|
7
9
|
|
8
10
|
def index
|
9
11
|
@page_name = "Comments"
|
@@ -6,7 +6,10 @@ class Admin::PostsController < Admin::ApplicationController
|
|
6
6
|
before_action :find_post, :only => [:show, :edit, :update, :destroy]
|
7
7
|
|
8
8
|
def index
|
9
|
-
@posts = SpudPost.for_blog(params[:blog_key]).ordered.
|
9
|
+
@posts = SpudPost.for_blog(params[:blog_key]).ordered.paginate(:page => params[:page], :per_page => 15)
|
10
|
+
if params[:search]
|
11
|
+
@posts = @posts.search(params[:search])
|
12
|
+
end
|
10
13
|
respond_with @posts
|
11
14
|
end
|
12
15
|
|
@@ -8,6 +8,9 @@ class PostsController < ApplicationController
|
|
8
8
|
|
9
9
|
def index
|
10
10
|
@posts = SpudPost.for_user(current_user).visible.for_blog(params[:blog_key]).ordered.paginate(:page => get_page_number, :per_page => Spud::Blog.config.posts_per_page)
|
11
|
+
if params[:search]
|
12
|
+
@posts = @posts.search(params[:search])
|
13
|
+
end
|
11
14
|
respond_with @posts do |format|
|
12
15
|
format.html{
|
13
16
|
render view_for_action('index')
|
@@ -23,6 +23,7 @@ class Spud::SpudPostModel < ActiveRecord::Base
|
|
23
23
|
scope :visible, ->{ where('visible = true AND published_at <= ?', Time.now.utc) }
|
24
24
|
scope :ordered, ->{ order('published_at desc') }
|
25
25
|
|
26
|
+
scope :search, ->(term){ where('title LIKE ?', "%#{term}%") }
|
26
27
|
scope :for_user, ->(user){
|
27
28
|
if Spud::Blog.query_for_user.present?
|
28
29
|
where(Spud::Blog.query_for_user.call(user))
|
@@ -36,7 +37,7 @@ class Spud::SpudPostModel < ActiveRecord::Base
|
|
36
37
|
before_validation :set_url_name
|
37
38
|
after_save :set_spud_site_ids
|
38
39
|
|
39
|
-
|
40
|
+
acts_as_tb_liquid_content
|
40
41
|
|
41
42
|
attr_accessor :spud_site_ids
|
42
43
|
|
@@ -1,14 +1,7 @@
|
|
1
|
-
<%= content_tag :
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
</span>
|
9
|
-
<ul class="spud_blog_category_manager_item_children">
|
10
|
-
<% if @post_categories[category.id] %>
|
11
|
-
<%= render :partial => 'category', :collection => @post_categories[category.id] %>
|
12
|
-
<% end %>
|
13
|
-
</ul>
|
14
|
-
<% end %>
|
1
|
+
<%= content_tag :tr, :class => 'spud-blog-category-manager-item', 'data-id' => category.id do %>
|
2
|
+
<td><%= category.name %></td>
|
3
|
+
<td class="table-actions">
|
4
|
+
<%= link_to 'Edit', edit_admin_post_category_path(category), :class => 'btn btn-xs btn-default spud-blog-category-edit' %>
|
5
|
+
<%= link_to 'Delete', admin_post_category_path(category), :class => 'btn btn-xs btn-danger spud-blog-category-delete' %>
|
6
|
+
</td>
|
7
|
+
<% end %>
|
@@ -1,14 +1,12 @@
|
|
1
|
-
<%= form_for @post_category, :url => (@post_category.new_record? ? admin_post_categories_path : admin_post_category_path(@post_category)), :html => {:class => 'form-horizontal
|
1
|
+
<%= form_for @post_category, :url => (@post_category.new_record? ? admin_post_categories_path : admin_post_category_path(@post_category)), :html => {:class => 'form-horizontal spud-post-category-form'} do |f| %>
|
2
2
|
|
3
|
-
<%=
|
3
|
+
<%= tb_form_errors(@post_category) %>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
</div>
|
12
|
-
</fieldset>
|
5
|
+
<div class="form-group">
|
6
|
+
<%= f.label :name, :required => true, :class=> "col-sm-2 control-label" %>
|
7
|
+
<div class="col-sm-10">
|
8
|
+
<%= f.text_field :name, :class=>'form-control' %>
|
9
|
+
</div>
|
10
|
+
</div>
|
13
11
|
|
14
|
-
<% end %>
|
12
|
+
<% end %>
|
@@ -1,9 +1,8 @@
|
|
1
|
-
<div class="
|
2
|
-
<%= link_to "New Post Category", new_admin_post_category_path, :class => "btn btn-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
</div>
|
1
|
+
<div class="spud-blog-category-manager">
|
2
|
+
<%= link_to "New Post Category", new_admin_post_category_path, :class => "btn btn-sm btn-primary spud-blog-category-add-new", :title => "New Post Category" %>
|
3
|
+
<table class="table table-striped table-condensed spud-blog-category-manager-table">
|
4
|
+
<tbody>
|
5
|
+
<%= render :partial => 'category', :collection => @post_categories %>
|
6
|
+
</tbody>
|
7
|
+
</table>
|
8
|
+
</div>
|
@@ -31,32 +31,30 @@
|
|
31
31
|
</td>
|
32
32
|
<td>
|
33
33
|
<% if comment.spam %>
|
34
|
-
Spam
|
34
|
+
<span class="label label-warning">Spam</span>
|
35
35
|
<% elsif comment.approved %>
|
36
|
-
Approved
|
36
|
+
<span class="label label-success">Approved</span>
|
37
37
|
<% else %>
|
38
|
-
Pending
|
38
|
+
<span class="label label-default">Pending</span>
|
39
39
|
<% end %>
|
40
40
|
</td>
|
41
41
|
<td class="spud-post-comment-actions">
|
42
42
|
<% if !comment.approved %>
|
43
|
-
<%= link_to 'Approve', approve_admin_post_comment_path(comment), :class => 'btn btn-success btn-
|
43
|
+
<%= link_to 'Approve', approve_admin_post_comment_path(comment), :class => 'btn btn-success btn-sm' %>
|
44
44
|
<% end %>
|
45
45
|
<% if !comment.spam %>
|
46
|
-
<%= link_to 'Spam', spam_admin_post_comment_path(comment), :class => 'btn btn-warning btn-
|
46
|
+
<%= link_to 'Spam', spam_admin_post_comment_path(comment), :class => 'btn btn-warning btn-sm' %>
|
47
47
|
<% end %>
|
48
|
-
<%= link_to 'Delete', admin_post_comment_path(comment), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this comment?'}, :class => 'btn btn-danger btn-
|
48
|
+
<%= link_to 'Delete', admin_post_comment_path(comment), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this comment?'}, :class => 'btn btn-danger btn-sm' %>
|
49
49
|
</td>
|
50
50
|
</tr>
|
51
51
|
<%end%>
|
52
52
|
</tbody>
|
53
53
|
</table>
|
54
|
-
|
55
|
-
<%= will_paginate @post_comments%>
|
56
|
-
</div>
|
54
|
+
<%= will_paginate @post_comments, :renderer => BootstrapPagination::Rails %>
|
57
55
|
|
58
56
|
<script>
|
59
57
|
$(document).ready(spud.admin.post_comments.index);
|
60
58
|
</script>
|
61
59
|
|
62
|
-
<%end%>
|
60
|
+
<% end %>
|
@@ -1,109 +1,99 @@
|
|
1
|
-
<%=
|
1
|
+
<%= tb_form_errors(@post)%>
|
2
2
|
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
</fieldset>
|
9
|
-
<%if Spud::Blog.config.enable_markdown%>
|
10
|
-
<div class="control-group">
|
11
|
-
<div class="controls">
|
12
|
-
<%=f.select :content_format,[["HTML"],["Markdown"]], {:include_blank => false}, :class => "pull-right", "data-formatter" => "spud_post_content"%>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
<%end%>
|
16
|
-
<div style="clear:both;">
|
17
|
-
<%= f.text_area :content,:style => "width:100%;", :class => 'tinymce full-width', "data-format" => f.object.content_format%>
|
3
|
+
<div class="form-group">
|
4
|
+
<div class="col-sm-12">
|
5
|
+
<%= f.label :title, :required => true,:class=> "control-label" %>
|
6
|
+
<%= f.text_field :title, :class=>'form-control', :placeholder => "Enter title here" %>
|
7
|
+
</div>
|
18
8
|
</div>
|
19
9
|
|
20
|
-
<
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<h4>Meta Data</h4>
|
10
|
+
<div class="form-group">
|
11
|
+
<div class="col-sm-12">
|
12
|
+
<%= f.label :content %>
|
13
|
+
<%= f.text_area :content, :class => 'tinymce form-control' %>
|
14
|
+
</div>
|
15
|
+
</div>
|
27
16
|
|
28
|
-
|
29
|
-
<%= f.label :published_at, 'Publish Date' %>
|
30
|
-
<%= f.text_field :published_at, :value => f.object.published_at.strftime("%Y-%m-%d %H:%M"), :class => 'tb-form-date-picker' %>
|
31
|
-
<span class="time_select">
|
32
|
-
<%= f.time_select :published_at, :ignore_date => true,:ampm => true%>
|
33
|
-
</span>
|
34
|
-
</div>
|
17
|
+
<h4>Advanced</h4>
|
35
18
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
19
|
+
<% if @current_user.super_admin %>
|
20
|
+
<div class="form-group">
|
21
|
+
<%= f.label :spud_user_id, 'Author', :class => "col-sm-2 control-label" %>
|
22
|
+
<div class="col-sm-10">
|
23
|
+
<%= f.select :spud_user_id, options_for_select(SpudUser.ordered.collect{|user| [user.full_name, user.id]}, @post.spud_user_id), {}, :class => 'form-control' %>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<% else %>
|
27
|
+
<%= f.hidden_field :spud_user_id %>
|
28
|
+
<% end %>
|
44
29
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
</div>
|
57
|
-
<% end %>
|
30
|
+
<div class="form-group">
|
31
|
+
<%= f.label :visible, :class => 'col-sm-2 control-label' %>
|
32
|
+
<div class="col-sm-10">
|
33
|
+
<label class="radio-inline" for="spud_post_visible_true">
|
34
|
+
<%= f.radio_button :visible, true %> Yes
|
35
|
+
</label>
|
36
|
+
<label class="radio-inline" for="spud_post_visible_false">
|
37
|
+
<%= f.radio_button :visible, false %> No
|
38
|
+
</label>
|
39
|
+
</div>
|
40
|
+
</div>
|
58
41
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
42
|
+
<div class="form-group">
|
43
|
+
<%= f.label :comments_enabled, 'Enable Comments', :class => 'col-sm-2 control-label' %>
|
44
|
+
<div class="col-sm-10">
|
45
|
+
<label class="radio-inline" for="spud_post_comments_enabled_true">
|
46
|
+
<%= f.radio_button :comments_enabled, true %> Yes
|
47
|
+
</label>
|
48
|
+
<label class="radio-inline" for="spud_post_comments_enabled_false">
|
49
|
+
<%= f.radio_button :comments_enabled, false %> No
|
50
|
+
</label>
|
51
|
+
</div>
|
52
|
+
</div>
|
68
53
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
<label class="radio inline" for="spud_post_comments_enabled_false">No</label>
|
76
|
-
</div>
|
77
|
-
</div>
|
54
|
+
<div class="form-group">
|
55
|
+
<%= f.label :published_at, 'Publish Date', :class => 'col-sm-2 control-label' %>
|
56
|
+
<div class="col-sm-10">
|
57
|
+
<%= f.datetime_select :published_at, {:ampm => true, :minute_step => 5, :order => [:month, :day, :year, :hour, :minute]}, {:class => 'form-control post-published-at-picker'} %>
|
58
|
+
</div>
|
59
|
+
</div>
|
78
60
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
61
|
+
<div class="form-group">
|
62
|
+
<%= label_tag :categories, 'Categories', :class => "col-sm-2 control-label" %>
|
63
|
+
<div class="col-sm-10">
|
64
|
+
<input type="hidden" name="spud_post[category_ids][]" value="" />
|
65
|
+
<ul class="spud-post-categories-list">
|
66
|
+
<%= render :partial => '/admin/posts/category', :collection => SpudPostCategory.ordered %>
|
67
|
+
</ul>
|
68
|
+
<%= link_to 'Add Category', new_admin_post_category_path, :class => 'btn btn-xs btn-primary spud-post-add-category' %>
|
69
|
+
</div>
|
70
|
+
</div>
|
84
71
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
<span class="spud_post_form_help_block">A short description of the article. This is what appears on a search engines search result page.</span>
|
89
|
-
</div>
|
90
|
-
</div>
|
72
|
+
<%= render :partial => '/admin/posts/custom_fields', :locals => {:f => f} %>
|
73
|
+
|
74
|
+
<h4>Meta Data</h4>
|
91
75
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
</ul>
|
99
|
-
</div>
|
76
|
+
<div class="form-group">
|
77
|
+
<%= f.label :meta_keywords, :required => true, :class=> "col-sm-2 control-label" %>
|
78
|
+
<div class="col-sm-10">
|
79
|
+
<%= f.text_field :meta_keywords, :class=>'form-control' %>
|
80
|
+
</div>
|
81
|
+
</div>
|
100
82
|
|
101
|
-
|
83
|
+
<div class="form-group">
|
84
|
+
<%= f.label :meta_description, :required => true, :class=> "col-sm-2 control-label" %>
|
85
|
+
<div class="col-sm-10">
|
86
|
+
<%= f.text_field :meta_description, :class=>'form-control' %>
|
87
|
+
</div>
|
88
|
+
</div>
|
102
89
|
|
103
|
-
<div class="form-
|
104
|
-
|
90
|
+
<div class="form-group">
|
91
|
+
<div class="col-sm-offset-2 col-sm-10">
|
92
|
+
<%= f.submit "Save Post", :class => "btn btn-primary", "data-loading-text" => "Saving..." %>
|
93
|
+
<%= link_to "Cancel", request.referer, :class => "btn btn-default" %>
|
94
|
+
</div>
|
105
95
|
</div>
|
106
96
|
|
107
97
|
<script type="text/javascript">
|
108
98
|
$(document).ready(spud.admin.posts.edit);
|
109
|
-
</script>
|
99
|
+
</script>
|
@@ -1,48 +1,67 @@
|
|
1
1
|
<%= content_for :data_controls do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
<%= form_tag admin_posts_path, :method => :get, :class => 'form-inline' do %>
|
3
|
+
<div class="form-group">
|
4
|
+
<div class="input-group">
|
5
|
+
<div class="input-group-addon"><span class="glyphicon glyphicon-search"></span></div>
|
6
|
+
<%= text_field_tag 'search', params[:search], :placeholder => 'Search', :class => 'form-control' %>
|
7
|
+
<% if params[:search] %>
|
8
|
+
<div class="input-group-addon">
|
9
|
+
<%= link_to raw('<span class="glyphicon glyphicon-remove"></span>'), admin_posts_path %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<div class="form-group">
|
15
|
+
<%= link_to "Manage Categories", admin_post_categories_path, :class => 'btn btn-default spud-blog-manage-categories', :title => 'Manage Categories' %>
|
16
|
+
<%= link_to "Manage Comments", admin_post_comments_path, :class => 'btn btn-default', :title => 'Manage Comments' %>
|
17
|
+
<%= link_to "New Post", new_admin_post_path, :class => "btn btn-primary", :title => "New Post" %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
5
20
|
<% end %>
|
6
21
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<
|
11
|
-
<th>Title</th>
|
12
|
-
<th>Author</th>
|
13
|
-
<th>Published At</th>
|
14
|
-
<th>Comments Pending</th>
|
15
|
-
<th> </th>
|
16
|
-
</tr>
|
17
|
-
</thead>
|
18
|
-
<tbody>
|
19
|
-
<% @posts.each do |post| %>
|
22
|
+
<% content_for :detail do %>
|
23
|
+
<div class="table-responsive">
|
24
|
+
<table class="table table-striped table-hover">
|
25
|
+
<thead>
|
20
26
|
<tr>
|
21
|
-
<
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
</td>
|
27
|
-
<td><%= post.author.full_name %></td>
|
28
|
-
<td><%= post.published_at.strftime('%m/%d/%Y') %></td>
|
29
|
-
<td>
|
30
|
-
<%= post.pending_comments.length %>
|
31
|
-
<%= link_to "Manage", admin_post_post_comments_path(post), :class => 'spud-post-comments-manage' %>
|
32
|
-
</td>
|
33
|
-
<td class="text-right">
|
34
|
-
<%= link_to 'Edit', edit_admin_post_path(post), :class => 'btn btn-small' %>
|
35
|
-
<%= link_to 'Delete', admin_post_path(post), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this post?'}, :class => 'btn btn-small btn-danger' %>
|
36
|
-
</td>
|
27
|
+
<th>Title</th>
|
28
|
+
<th>Author</th>
|
29
|
+
<th>Published At</th>
|
30
|
+
<th>Comments</th>
|
31
|
+
<th> </th>
|
37
32
|
</tr>
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
</thead>
|
34
|
+
<tbody>
|
35
|
+
<% cache @posts do %>
|
36
|
+
<% @posts.each do |post| %>
|
37
|
+
<% cache post do %>
|
38
|
+
<tr>
|
39
|
+
<td>
|
40
|
+
<%= link_to post.title, post_path(post.url_name), :target => :blank %>
|
41
|
+
<% if !post.visible? %>
|
42
|
+
<span class="badge">Draft</span>
|
43
|
+
<% end %>
|
44
|
+
</td>
|
45
|
+
<td><%= post.author.full_name %></td>
|
46
|
+
<td><%= post.published_at.strftime('%m/%d/%Y') %></td>
|
47
|
+
<td>
|
48
|
+
<%= content_tag :span, post.comments.count, :class => "label label-#{post.pending_comments.count > 0 ? 'info' : 'default'}" %>
|
49
|
+
<%= link_to "Manage", admin_post_post_comments_path(post), :class => 'spud-post-comments-manage' %>
|
50
|
+
</td>
|
51
|
+
<td class="table-actions">
|
52
|
+
<%= link_to 'Edit', edit_admin_post_path(post), :class => 'btn btn-sm btn-default' %>
|
53
|
+
<%= link_to 'Delete', admin_post_path(post), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this post?'}, :class => 'btn btn-sm btn-danger' %>
|
54
|
+
</td>
|
55
|
+
</tr>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
</tbody>
|
60
|
+
</table>
|
43
61
|
</div>
|
62
|
+
<%= will_paginate @posts, :renderer => BootstrapPagination::Rails %>
|
44
63
|
|
45
64
|
<script>
|
46
|
-
$(document).ready(spud.admin.post_categories.
|
65
|
+
$(document).ready(spud.admin.post_categories.init);
|
47
66
|
</script>
|
48
67
|
<%end%>
|
@@ -7,8 +7,8 @@ class AddNestedSetToPostCategories < ActiveRecord::Migration
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# Populates lft, rgt, and depth values for nested set
|
10
|
-
SpudPostCategory.where(:parent_id => 0).update_all({:parent_id => nil})
|
11
|
-
SpudPostCategory.rebuild!
|
10
|
+
# SpudPostCategory.where(:parent_id => 0).update_all({:parent_id => nil})
|
11
|
+
# SpudPostCategory.rebuild!
|
12
12
|
end
|
13
13
|
|
14
14
|
def down
|
data/lib/spud_blog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Westlake Design
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -351,9 +351,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
351
351
|
version: '0'
|
352
352
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
353
353
|
requirements:
|
354
|
-
- - "
|
354
|
+
- - ">"
|
355
355
|
- !ruby/object:Gem::Version
|
356
|
-
version:
|
356
|
+
version: 1.3.1
|
357
357
|
requirements: []
|
358
358
|
rubyforge_project:
|
359
359
|
rubygems_version: 2.2.1
|