effective_posts 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9c81635c7e56d5facbc3813276bb811a474df76044f0f58e75f4ecbce9e3c535
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 87acdee49f9b8d8ae2d364d477bae82bb2a41acbcb4ffc7795578dac36191f19
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 345527391a44291733d2c714a4d848a209f0cee44bc98d4ceeffefb7c6ae2216d648690e955ca82e49087f49c4d5bc53a54e480a0c81db652d066184d0474fbc
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 178b671b010fe6eacc41de115f533a7b97ddc5dc18756e75ebb73a9e5925c88e7c9123b6e9438494c2cc910508f4a09896154beef0ff9a64c189da2ef6e9768f
         
     | 
| 
         @@ -25,21 +25,14 @@ module Effective 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                  EffectivePosts.authorize!(self, :index, Effective::Post)
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                  if params[:page]
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                    @canonical_url ||= effective_posts.posts_url(page: params[:page])
         
     | 
| 
       31 
     | 
    
         
            -
                  else
         
     | 
| 
       32 
     | 
    
         
            -
                    @page_title ||= (params[:category].presence || 'Blog').titleize
         
     | 
| 
       33 
     | 
    
         
            -
                    @canonical_url ||= effective_posts.posts_url
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
                  @page_title ||= [(params[:category] || 'Blog').to_s.titleize, (" - Page #{params[:page]}" if params[:page])].compact.join
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @canonical_url ||= helpers.effective_post_category_url(params[:category], page: params[:page])
         
     | 
| 
       36 
30 
     | 
    
         
             
                end
         
     | 
| 
       37 
31 
     | 
    
         | 
| 
       38 
32 
     | 
    
         
             
                def show
         
     | 
| 
       39 
33 
     | 
    
         
             
                  @posts ||= Effective::Post.posts(user: current_user, category: params[:category], unpublished: EffectivePosts.authorized?(self, :admin, :effective_posts))
         
     | 
| 
       40 
34 
     | 
    
         
             
                  @post = @posts.find(params[:id])
         
     | 
| 
       41 
35 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
36 
     | 
    
         
             
                  if @post.respond_to?(:roles_permit?)
         
     | 
| 
       44 
37 
     | 
    
         
             
                    raise Effective::AccessDenied.new('Access Denied', :show, @post) unless @post.roles_permit?(current_user)
         
     | 
| 
       45 
38 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -29,20 +29,25 @@ module EffectivePostsHelper 
     | 
|
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
              def effective_post_category_path(category, opts = nil)
         
     | 
| 
       32 
     | 
    
         
            -
                return effective_posts.posts_path unless category.present?
         
     | 
| 
      
 32 
     | 
    
         
            +
                return effective_posts.posts_path(opts || {}) unless category.present?
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                category = category.to_s.downcase
         
     | 
| 
       35 
     | 
    
         
            -
                opts  
     | 
| 
      
 35 
     | 
    
         
            +
                opts = (opts || {}).compact
         
     | 
| 
      
 36 
     | 
    
         
            +
                query = ('?' + opts.to_query) if opts.present?
         
     | 
| 
       36 
37 
     | 
    
         | 
| 
       37 
38 
     | 
    
         
             
                if EffectivePosts.use_blog_routes
         
     | 
| 
       38 
     | 
    
         
            -
                  "/blog/category/#{category}"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  "/blog/category/#{category}#{query}"
         
     | 
| 
       39 
40 
     | 
    
         
             
                elsif EffectivePosts.use_category_routes
         
     | 
| 
       40 
     | 
    
         
            -
                  "/#{category}"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  "/#{category}#{query}"
         
     | 
| 
       41 
42 
     | 
    
         
             
                else
         
     | 
| 
       42 
     | 
    
         
            -
                  effective_posts.posts_path(opts.merge(category: category))
         
     | 
| 
      
 43 
     | 
    
         
            +
                  effective_posts.posts_path(opts.merge(category: category.presence).compact)
         
     | 
| 
       43 
44 
     | 
    
         
             
                end
         
     | 
| 
       44 
45 
     | 
    
         
             
              end
         
     | 
| 
       45 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
              def effective_post_category_url(category, opts = nil)
         
     | 
| 
      
 48 
     | 
    
         
            +
                root_url.to_s.chomp('/') + effective_post_category_path(category, opts)
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
       46 
51 
     | 
    
         
             
              def link_to_post_category(category, options = {})
         
     | 
| 
       47 
52 
     | 
    
         
             
                category = category.to_s.downcase
         
     | 
| 
       48 
53 
     | 
    
         
             
                link_to(category.to_s.titleize, effective_post_category_path(category), title: category.to_s.titleize)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: effective_posts
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Code and Effect
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2019- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-09-02 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     |