effective_classifieds 0.0.2 → 0.0.3
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: 499abd956dcfe6893f63acfd7c5ebbb2366e153c6e6e5a04a86af79a74646da2
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 87d620ec5502530caada118714c433ebe3996aa57068b0a826333a62619f3232
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ea559cede7e5cd77ba26d4e9ad0a5ebad93e43fba6562edc3c5ec10ab620ce37131754f52bc5cb8ba1dd994085349655940507243ada1fc9d7755ae3e48517b5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e552047d620d5464f504a747d98ce56ab86b1c17f431a974f68bb08fac138d2c34dec723ecd1e99f4044624676d7520d759b148d1de6f5af65fe3303b70ba2ce
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -85,6 +85,7 @@ The permissions you actually want to define are as follows (using CanCan): 
     | 
|
| 
       85 
85 
     | 
    
         
             
            can([:index, :show], Effective::Classified) { |classified| classified.published? }
         
     | 
| 
       86 
86 
     | 
    
         
             
            can([:show, :edit, :update], Effective::Classified) { |classified| classified.owner == user }
         
     | 
| 
       87 
87 
     | 
    
         | 
| 
      
 88 
     | 
    
         
            +
            can(:new, EffectiveClassifieds.ClassifiedSubmission)
         
     | 
| 
       88 
89 
     | 
    
         
             
            can([:show, :index, :destroy], EffectiveClassifieds.ClassifiedSubmission) { |submission| submission.owner == user }
         
     | 
| 
       89 
90 
     | 
    
         
             
            can([:update], EffectiveClassifieds.ClassifiedSubmission) { |submission| submission.owner == user && !submission.was_submitted? }
         
     | 
| 
       90 
91 
     | 
    
         | 
| 
         @@ -92,11 +93,10 @@ if user.admin? 
     | 
|
| 
       92 
93 
     | 
    
         
             
              can :admin, :effective_classifieds
         
     | 
| 
       93 
94 
     | 
    
         | 
| 
       94 
95 
     | 
    
         
             
              can(crud - [:destroy], Classified)
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
96 
     | 
    
         
             
              can(:approve, Classified) { |classified| classified.was_submitted? && !classified.approved? }
         
     | 
| 
       97 
97 
     | 
    
         
             
              can(:destroy, Classified) { |classified| !classified.draft? }
         
     | 
| 
       98 
98 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
              can([: 
     | 
| 
      
 99 
     | 
    
         
            +
              can([:index, :show], EffectiveClassifieds.ClassifiedSubmission)
         
     | 
| 
       100 
100 
     | 
    
         
             
            end
         
     | 
| 
       101 
101 
     | 
    
         
             
            ```
         
     | 
| 
       102 
102 
     | 
    
         | 
| 
         @@ -2,13 +2,8 @@ module Effective 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class ClassifiedsController < ApplicationController
         
     | 
| 
       3 
3 
     | 
    
         
             
                include Effective::CrudController
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                resource_scope -> {
         
     | 
| 
       6 
     | 
    
         
            -
                  unpublished = EffectiveResources.authorized?(self, :admin, :effective_classifieds)
         
     | 
| 
       7 
     | 
    
         
            -
                  Effective::Classified.classifieds(user: current_user, unpublished: unpublished)
         
     | 
| 
       8 
     | 
    
         
            -
                }
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
5 
     | 
    
         
             
                def index
         
     | 
| 
       11 
     | 
    
         
            -
                  @classifieds ||=  
     | 
| 
      
 6 
     | 
    
         
            +
                  @classifieds ||= Effective::Classified.classifieds(user: current_user)
         
     | 
| 
       12 
7 
     | 
    
         | 
| 
       13 
8 
     | 
    
         
             
                  @classifieds = @classifieds.paginate(page: params[:page])
         
     | 
| 
       14 
9 
     | 
    
         |