tb_blog 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab37b0d808766124759d266757d35eaaea4d359b
4
- data.tar.gz: ee83293562e1e9246b8bd2df584c07f1deb7f695
3
+ metadata.gz: c3f0e49fcb5e713ca2539e045f2ffb5d0e35546d
4
+ data.tar.gz: 2661478bca463998d924ab06d4c8cdf6684decde
5
5
  SHA512:
6
- metadata.gz: a641f5ca8ca4c50f518c8dd3636520d07ddc6e5f547e7f7ff4bb3fcb449b3d0a5759a655e33c630f5f2f4828899e785cca31a963afe8e9a2d34346ddb80cd115
7
- data.tar.gz: cb498d73cd7db7dc97cfdfebf59ef26788d0e6a92d0da47dc60f83f4bb2f6e3c1ab2bb6dd0310bde5e1b425517435c0c31a97864f89e9449435f905bb7fa5b39
6
+ metadata.gz: c8b835b9f998af0cffce8387ee034038972f0409dcf86ff1fc27073fb597b003b75f872328b74da4a58376e1f8447591a58fd9da94c15287eb230e9ded245cfe
7
+ data.tar.gz: 45f3c1bec9ac7dbcf32d3afd332d93b8012c7895dd0786cabe63483f8bb8970871c753010f31b53c30015ce0d6a22f41a511416be8c990eeed77ff52c5a224d8
@@ -1,6 +1,6 @@
1
1
  class Admin::PostsController < Admin::ApplicationController
2
2
  include BlogUrlHelpers
3
- include PostViewForAction
3
+ include RenderPostAction
4
4
 
5
5
  respond_to :html, :xml, :json
6
6
  before_action :load_blog
@@ -51,11 +51,7 @@ class Admin::PostsController < Admin::ApplicationController
51
51
  SpudPost.new
52
52
  end
53
53
  @post.assign_attributes(post_params)
54
- render template: post_view_for_action(:show), controller: :posts, layout: @config.layout
55
- end
56
-
57
- def render_preview
58
- render template: post_view_for_action(:show), controller: :posts, layout: @config.layout
54
+ render_post_action :show, controller: :posts, layout: @config.layout
59
55
  end
60
56
 
61
57
  private
@@ -0,0 +1,7 @@
1
+ module RenderPostAction
2
+ extend ActiveSupport::Concern
3
+
4
+ def render_post_action(action, args = {})
5
+ render action, args.merge(prefixes: [@config.key, 'posts'])
6
+ end
7
+ end
@@ -1,6 +1,6 @@
1
1
  class PostsController < ApplicationController
2
2
  include BlogUrlHelpers
3
- include PostViewForAction
3
+ include RenderPostAction
4
4
 
5
5
  respond_to :html, :json, :rss
6
6
 
@@ -13,7 +13,7 @@ class PostsController < ApplicationController
13
13
  @posts = @posts.search(params[:search]) if params[:search]
14
14
  respond_with @posts do |format|
15
15
  format.html do
16
- render post_view_for_action(:index)
16
+ render_post_action :index
17
17
  end
18
18
  end
19
19
  end
@@ -39,20 +39,20 @@ class PostsController < ApplicationController
39
39
  return
40
40
  end
41
41
  respond_with @posts do |format|
42
- format.html { render post_view_for_action :index }
42
+ format.html { render_post_action :index }
43
43
  end
44
44
  end
45
45
 
46
46
  def archive
47
47
  @posts = SpudPost.for_user(current_user).visible.for_blog(params[:blog_key]).from_archive(params[:archive_date]).paginate(page: @page_number, per_page: Spud::Blog.config.posts_per_page)
48
48
  respond_with @posts do |format|
49
- format.html { render post_view_for_action :index }
49
+ format.html { render_post_action :index }
50
50
  end
51
51
  end
52
52
 
53
53
  def show
54
54
  respond_with @post do |format|
55
- format.html { render post_view_for_action :show }
55
+ format.html { render_post_action :show }
56
56
  end
57
57
  end
58
58
 
@@ -82,7 +82,6 @@ class PostsController < ApplicationController
82
82
  @config = SpudBlogConfig.find(params[:blog_key])
83
83
  if @config.blank?
84
84
  raise Spud::NotFoundError(item: 'blog')
85
- return false
86
85
  else
87
86
  self.class.layout(@config.layout)
88
87
  end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Blog
3
- VERSION = '1.4.0'.freeze
3
+ VERSION = '1.4.1'.freeze
4
4
  end
5
5
  end
@@ -27,4 +27,12 @@ describe PostsController, type: :controller do
27
27
  end
28
28
  end
29
29
 
30
+ describe 'show' do
31
+ it 'renders the post' do
32
+ post = FactoryGirl.create(:spud_post)
33
+ get :show, params: { blog_key: post.blog_key, id: post.url_name }
34
+ expect(response).to have_http_status(:success)
35
+ end
36
+ end
37
+
30
38
  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.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moser Consulting
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-23 00:00:00.000000000 Z
11
+ date: 2017-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -183,7 +183,7 @@ files:
183
183
  - app/controllers/admin/post_categories_controller.rb
184
184
  - app/controllers/admin/posts_controller.rb
185
185
  - app/controllers/concerns/blog_url_helpers.rb
186
- - app/controllers/concerns/post_view_for_action.rb
186
+ - app/controllers/concerns/render_post_action.rb
187
187
  - app/controllers/posts_controller.rb
188
188
  - app/helpers/admin/news_posts_helper.rb
189
189
  - app/helpers/admin/post_categories_helper.rb
@@ -1,11 +0,0 @@
1
- module PostViewForAction
2
- extend ActiveSupport::Concern
3
-
4
- def post_view_for_action(action)
5
- if File.exist?(Rails.root.join("app/views/#{@config.key}/#{action}.html.erb"))
6
- return "/#{@config.key}/#{action}"
7
- else
8
- return "/posts/#{action}"
9
- end
10
- end
11
- end