tb_blog 1.2.1 → 1.3.0.beta1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d37118df81124d692e43579653d429c6883524ab
4
- data.tar.gz: 938676e0188d55596ffdab542cfa8483758396a3
3
+ metadata.gz: 5ff051c880e167863c62338d656dc998b1c646fd
4
+ data.tar.gz: 7e92aee8c71a94de5703385f013d6f3157dd690f
5
5
  SHA512:
6
- metadata.gz: ec2e038b0c8afa99eca39d2f6cc9f321dc40e03ac288a2420dacd56fad7799ddff54588e84a331d254825d00cdf86e9b10a5a2231daa8a3c69a3cd99ad0a4510
7
- data.tar.gz: cd14ca581a980ab6538f11ded47eec8a3d5591350e1d422ce4bbb623c94320fb69b08c518b2e206b5b419165ee8d7017259bb99b1d85bceeb0be8490392fadb7
6
+ metadata.gz: e6b5299d1d8cbddadbd517e73f3bd1b78d2dc3a4fcc8d4f018f6829a3cde16b37288ad0beb30f4c11e35515a6e890908e6c40dce82b8ca4bd2b6ee286a37ee64
7
+ data.tar.gz: a4074b7a6e3d868e23618767782531e226b7f561af8a2dff76b48a433e03179cadc3ead416e60127501d09adadb8a67cf0e826e16f73139cee802ce6c2efc5c8
@@ -1,113 +1,115 @@
1
- spud.admin.post_categories = new function(){
1
+ (function(){
2
2
 
3
- var self = this;
4
- var _cachedCategoryIndex;
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
- this.index = function(){
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
- this.clickedManageCategories = function(e){
17
- e.preventDefault();
18
- $.ajax({
19
- url: $(this).attr('href'),
20
- success: function(html, textStatus, jqXHR){
21
- _cachedCategoryIndex = html;
22
- displayModalDialogWithOptions({
23
- title: 'Manage Categories',
24
- html: html,
25
- buttons: {
26
- 'spud_blog_manage_categories_back': 'Back',
27
- 'spud_blog_manage_categories_save btn-primary': 'Save'
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
- this.clickedAddNewCategory = function(e){
35
- e.preventDefault();
36
- $.ajax({
37
- url: $(this).attr('href'),
38
- dataType: 'html',
39
- success: function(html, textStatus, jqXHR){
40
- $('.modal-footer button[data-dismiss="modal"]').hide();
41
- $('.spud_blog_manage_categories_save, .spud_blog_manage_categories_back').show();
42
- $('.spud_blog_category_manager').replaceWith(html);
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
- this.clickedEditCategory = function(e){
48
- e.preventDefault();
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
- $('.modal-footer button[data-dismiss="modal"]').hide();
54
- $('.spud_blog_manage_categories_save, .spud_blog_manage_categories_back').show();
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
- this.clickedBackButton = function(e){
61
- e.preventDefault();
62
- $('.spud_post_category_form').replaceWith(_cachedCategoryIndex);
63
- $('.modal-footer button[data-dismiss="modal"]').show();
64
- $('.spud_blog_manage_categories_save, .spud_blog_manage_categories_back').hide();
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
- this.clickedDeleteCategory = function(e){
68
- e.preventDefault();
69
- if(window.confirm('Are you sure you want to delete this category?')){
70
- $.ajax({
71
- url: $(this).attr('href'),
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
- this.submittedPostCategoryForm = function(e){
84
- e.preventDefault();
85
- var form = $('.spud_post_category_form');
86
- $.ajax({
87
- url: form.attr('action'),
88
- data: form.serialize(),
89
- type: 'post',
90
- dataType: 'html',
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
- else{
108
- if(window.console){
109
- console.error('Oh Snap:', arguments);
110
- }
111
- }
112
- };
113
- };
112
+ }
113
+ };
114
+
115
+ })();
@@ -1,66 +1,59 @@
1
- spud.admin.posts = new function(){
1
+ (function(){
2
2
 
3
- var self = this;
4
-
5
- this.edit = function(){
6
- spud.admin.date_picker.init();
7
-
8
- $('body').on('click', '.spud_post_add_category', self.clickedPostAddCategory);
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
- this.clickedPostAddCategory = function(e){
14
- e.preventDefault();
15
- $.ajax({
16
- url: $(this).attr('href'),
17
- dataType: 'html',
18
- success: function(html, textStatus, jqXHR){
19
- displayModalDialogWithOptions({
20
- title: 'Add Category',
21
- html: html
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
- this.submittedPostCategoryForm = function(e){
28
- e.preventDefault();
29
- var form = $('.spud_post_category_form');
30
- $.ajax({
31
- url: form.attr('action'),
32
- data: form.serialize(),
33
- type: 'post',
34
- dataType: 'json',
35
- success: self.savedPostCategorySuccess,
36
- error: self.savePostCategoryError
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
- this.savedPostCategorySuccess = function(data, textStatus, jqXHR){
41
- var checkbox = '';
42
- checkbox += '<li class="spud_post_form_category" data-id="'+data.id+'">';
43
- checkbox += '<input id="spud_post_category_'+data.id+'" name="spud_post[category_ids][]" type="checkbox" value="'+data.id+'" checked>' + "\n";
44
- checkbox += '<label for="spud_post_category_'+data.id+'">'+data.name+'</label>';
45
- checkbox += '<ul></ul></li>';
46
- if(data.parent_id > 0){
47
- $('.spud_post_form_category[data-id="'+data.parent_id+'"]>ul').append(checkbox);
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
- this.savePostCategoryError = function(jqXHR, textStatus, errorThrown){
56
- if(jqXHR.status == 422){
57
- var html = jqXHR.responseText;
58
- $('.spud_post_category_form').replaceWith(html);
59
- }
60
- else{
61
- if(window.console){
62
- console.error('Oh Snap:', arguments);
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
- .spud_post_form_fieldset{
4
- margin: 30px 0;
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
- .spud_post_form_input_group select{
20
- margin-bottom: 20px;
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
- .spud_post_form_row{
27
- margin: 5px 0;
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
- .spud_post_categories_form{
45
- white-space: nowrap;
46
- list-style-type: none;
47
- margin: 15px 0;
48
- max-height: 400px;
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
- .spud_post_form_category{
69
- margin: 4px 0;
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
- .spud_blog_category_add_new{
75
- float: right;
76
- }
77
- .spud_blog_category_manager{
34
+ .spud-blog-category-manager{
78
35
  padding-right: 10px;
79
36
  }
80
- .spud_blog_category_manager ul{
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
- .spud_blog_category_manager_list{
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
- .spud_blog_category_manager_item{
52
+ .spud-blog-category-manager-item{
92
53
  position: relative;
93
54
  margin: 10px 0;
94
55
 
95
56
  }
96
- .spud_blog_category_manager_item_children{
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
- .spud_blog_manage_categories_save, .spud_blog_manage_categories_back{
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.includes(:pending_comments, :author).paginate(:page => params[:page], :per_page => 15)
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
- acts_as_spud_liquid_content
40
+ acts_as_tb_liquid_content
40
41
 
41
42
  attr_accessor :spud_site_ids
42
43
 
@@ -1,14 +1,7 @@
1
- <%= content_tag :li, :class => 'spud_blog_category_manager_item', 'data-id' => category.id do %>
2
- <span class="spud_blog_category_manager_item_name">
3
- <%= category.name %>
4
- </span>
5
- <span class="spud_blog_category_manager_item_actions">
6
- <%= link_to 'Edit', edit_admin_post_category_path(category), :class => 'btn btn-mini spud_blog_category_edit' %>
7
- <%= link_to 'Delete', admin_post_category_path(category), :class => 'btn btn-mini btn-danger spud_blog_category_delete' %>
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 spud_post_category_form'} do |f| %>
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
- <%= error_messages_for(f.object) %>
3
+ <%= tb_form_errors(@post_category) %>
4
4
 
5
- <fieldset>
6
- <div class="control-group">
7
- <%= f.label :name,"Name",:class => "control-label" %>
8
- <div class="controls">
9
- <%= f.text_field :name %>
10
- </div>
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="spud_blog_category_manager">
2
- <%= link_to "New Post Category", new_admin_post_category_path, :class => "btn btn-small btn-primary spud_blog_category_add_new", :title => "New Post Category" %>
3
- <ul class="spud_blog_category_manager_list">
4
- <% if @post_categories.length == 0 %>
5
- <li class="spud_blog_category_manager_empty">You do not have any Post Categories at this time.</li>
6
- <% end %>
7
- <%= render :partial => 'category', :collection => @post_categories %>
8
- </ul>
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-small' %>
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-small' %>
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-small' %>
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
- <div class="spud_admin_pagination">
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
- <%=error_messages_for(f.object)%>
1
+ <%= tb_form_errors(@post)%>
2
2
 
3
- <fieldset>
4
- <div class="control-group">
5
- <%= f.label :title, :required=>true,:style =>"display:none;" %>
6
- <%= f.text_field :title, :class => "full-width",:placeholder=>"Enter title here" %>
7
- </div>
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
- <fieldset class="spud_post_form_fieldset">
21
- <legend>Advanced</legend>
22
-
23
- <div class="spud_post_form_col">
24
- <%= render :partial => '/admin/posts/custom_fields', :locals => {:f => f} %>
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
- <div class="spud_post_form_row">
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
- <% if @current_user.super_admin %>
37
- <div class="spud_post_form_row">
38
- <%= f.label :spud_user_id, 'Author' %>
39
- <%= f.select :spud_user_id,options_for_select(SpudUser.order(:first_name,:last_name,:login).all.collect{|user| [user.full_name,user.id]},f.object.spud_user_id)%>
40
- </div>
41
- <% else %>
42
- <%= f.hidden_field :spud_user_id %>
43
- <% end %>
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
- <% if Spud::Core.config.multisite_mode_enabled %>
46
- <div class="spud_post_form_row">
47
- <%= f.label :sites, 'Websites to Publish' %>
48
- <div class="spud_post_form_input_group">
49
- <%= spud_post_site_check_box_tag(Spud::Core.default_site_config, @post) %>
50
- <%= spud_post_site_label_tag(Spud::Core.default_site_config) %>
51
- <% Spud::Core.config.multisite_config.each do |site| %>
52
- <%= spud_post_site_check_box_tag(site, @post) %>
53
- <%= spud_post_site_label_tag(site) %>
54
- <% end %>
55
- </div>
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
- <div class="spud_post_form_row">
60
- <%= f.label :visible %>
61
- <div class="spud_post_form_input_group">
62
- <%= f.radio_button :visible, true %>
63
- <label class="radio inline" for="spud_post_visible_true">Yes</label>
64
- <%= f.radio_button :visible, false %>
65
- <label class="radio inline" for="spud_post_visible_false">No</label>
66
- </div>
67
- </div>
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
- <div class="spud_post_form_row">
70
- <%= f.label :comments_enabled,"Comments Enabled" %>
71
- <div class="spud_post_form_input_group">
72
- <%= f.radio_button :comments_enabled, true %>
73
- <label class="radio inline" for="spud_post_comments_enabled_true">Yes</label>
74
- <%= f.radio_button :comments_enabled, false %>
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
- <div class="spud_post_form_row">
80
- <%= f.label :meta_keywords, 'Keywords' %>
81
- <%= f.text_field :meta_keywords %>
82
- <span class="spud_post_form_help_block">A Comma seperated list of keywords for search engines. Keep it short (no more than 10 keywords)</span>
83
- </div>
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
- <div class="spud_post_form_row">
86
- <%= f.label :meta_description, 'Description' %>
87
- <%= f.text_area :meta_description %>
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
- <div class="spud_post_form_col">
93
- <h4>Categories</h4>
94
- <%= link_to 'Add Category', new_admin_post_category_path, :class => 'btn btn-mini spud_post_add_category' %>
95
- <input type="hidden" name="spud_post[category_ids][]" value="" />
96
- <ul class="spud_post_categories_form">
97
- <%= render :partial => '/admin/posts/category', :collection => SpudPostCategory.ordered %>
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
- </fieldset>
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-actions">
104
- <%=f.submit "Save Post", :class=>"btn btn-primary form-btn","data-loading-text"=>"Saving..."%> or <%=link_to "cancel",request.referer, :class => "btn"%>
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
- <%= link_to "Manage Categories", admin_post_categories_path, :class => 'btn spud_blog_manage_categories', :title => 'Manage Categories' %>
3
- <%= link_to "Manage Comments", admin_post_comments_path, :class => 'btn', :title => 'Manage Comments' %>
4
- <%= link_to "New Post", new_admin_post_path, :class => "btn btn-primary", :title => "New Post" %>
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
- <%=content_for :detail do %>
8
- <table class="table table-striped">
9
- <thead>
10
- <tr>
11
- <th>Title</th>
12
- <th>Author</th>
13
- <th>Published At</th>
14
- <th>Comments Pending</th>
15
- <th>&nbsp;</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
- <td>
22
- <%= link_to post.title, post_path(post.url_name), :target => :blank %>
23
- <% if !post.visible? %>
24
- <span class="badge">Draft</span>
25
- <% end %>
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>&nbsp;</th>
37
32
  </tr>
38
- <%end%>
39
- </tbody>
40
- </table>
41
- <div class="spud_admin_pagination">
42
- <%= will_paginate @posts %>
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.index);
65
+ $(document).ready(spud.admin.post_categories.init);
47
66
  </script>
48
67
  <%end%>
@@ -1,3 +1,3 @@
1
- <%= form_for @post, :url => admin_posts_path do |f| %>
1
+ <%= form_for @post, :url => admin_posts_path, :html => {:class => 'form-horizontal'} do |f| %>
2
2
  <%= render :partial => 'form', :locals => {:f => f} %>
3
3
  <% 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
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Blog
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.0.beta1"
4
4
  end
5
5
  end
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.2.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-07 00:00:00.000000000 Z
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: '0'
356
+ version: 1.3.1
357
357
  requirements: []
358
358
  rubyforge_project:
359
359
  rubygems_version: 2.2.1