ajaxify_rails 0.7.1 → 0.7.5
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.
    
        data/README.md
    CHANGED
    
    
| 
         @@ -1,20 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'active_support/core_ext/module/qualified_const'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            # Makes Ajaxify work properly with action cached actions.
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
            if ActionController.qualified_const_defined?("Caching::Actions::ActionCacheFilter")
         
     | 
| 
      
 5 
     | 
    
         
            +
            	module ActionController
         
     | 
| 
      
 6 
     | 
    
         
            +
            	  module Caching
         
     | 
| 
      
 7 
     | 
    
         
            +
            	    module Actions
         
     | 
| 
       5 
8 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
            	      protected
         
     | 
| 
       7 
10 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
            	        class ActionCacheFilter #:nodoc:
         
     | 
| 
       9 
12 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            	        	alias_method :original_filter, :filter
         
     | 
| 
       11 
14 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
            	          def filter(controller)
         
     | 
| 
      
 16 
     | 
    
         
            +
            							original_filter controller
         
     | 
| 
      
 17 
     | 
    
         
            +
            	            controller.ajaxify_add_meta_tags unless controller.request.xhr?
         
     | 
| 
      
 18 
     | 
    
         
            +
            	            controller.ajaxify_set_asset_digest_header if controller.ajaxified?
         
     | 
| 
      
 19 
     | 
    
         
            +
            	          end
         
     | 
| 
      
 20 
     | 
    
         
            +
            	        end
         
     | 
| 
       17 
21 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
            	    end
         
     | 
| 
      
 23 
     | 
    
         
            +
            	  end
         
     | 
| 
      
 24 
     | 
    
         
            +
            	end
         
     | 
| 
       20 
25 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,6 +3,8 @@ module ActionControllerAdditions 
     | 
|
| 
       3 
3 
     | 
    
         
             
              def self.included(controller)
         
     | 
| 
       4 
4 
     | 
    
         
             
                controller.class_eval do
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
                  hide_action :page_title, :ajaxify_extra_content, :ajaxify_add_meta_tags, :ajaxify_set_asset_digest_header, :ajaxified?
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       6 
8 
     | 
    
         
             
                  # override in your controller
         
     | 
| 
       7 
9 
     | 
    
         
             
                  def page_title
         
     | 
| 
       8 
10 
     | 
    
         
             
                    nil
         
     | 
| 
         @@ -15,21 +17,26 @@ module ActionControllerAdditions 
     | 
|
| 
       15 
17 
     | 
    
         | 
| 
       16 
18 
     | 
    
         | 
| 
       17 
19 
     | 
    
         
             
                  def ajaxify_add_meta_tags
         
     | 
| 
       18 
     | 
    
         
            -
                    ajaxify_add_meta_tag( ajaxify_assets_digest_meta_tag ) 
     | 
| 
      
 20 
     | 
    
         
            +
                    ajaxify_add_meta_tag( ajaxify_assets_digest_meta_tag )
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
                    # Correcting urls for non history api browsers wont work for post requests so add a meta tag to the response body to communicate this to
         
     | 
| 
       21 
23 
     | 
    
         
             
                    # the ajaxify javascript
         
     | 
| 
       22 
     | 
    
         
            -
                    ajaxify_add_meta_tag( view_context.tag(:meta, name: 'ajaxify:dont_correct_url', content: 'true') ) if request.post? 
     | 
| 
      
 24 
     | 
    
         
            +
                    ajaxify_add_meta_tag( view_context.tag(:meta, name: 'ajaxify:dont_correct_url', content: 'true') ) if request.post?
         
     | 
| 
       23 
25 
     | 
    
         
             
                  end
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
27 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                   
     | 
| 
      
 28 
     | 
    
         
            +
                  def ajaxify_set_asset_digest_header
         
     | 
| 
      
 29 
     | 
    
         
            +
                    response.headers['Ajaxify-Assets-Digest'] = ajaxify_assets_digest
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       27 
32 
     | 
    
         | 
| 
       28 
33 
     | 
    
         
             
                  def ajaxified?
         
     | 
| 
       29 
34 
     | 
    
         
             
                    request.xhr? and params[:ajaxified]
         
     | 
| 
       30 
35 
     | 
    
         
             
                  end
         
     | 
| 
       31 
36 
     | 
    
         | 
| 
       32 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
                  private
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
       33 
40 
     | 
    
         
             
                  def render *args, &block
         
     | 
| 
       34 
41 
     | 
    
         
             
                    if ajaxified?
         
     | 
| 
       35 
42 
     | 
    
         
             
                      args = _normalize_args(*args, &block)
         
     | 
| 
         @@ -58,14 +65,14 @@ module ActionControllerAdditions 
     | 
|
| 
       58 
65 
     | 
    
         
             
                                                                   data: { page_title: page_title,
         
     | 
| 
       59 
66 
     | 
    
         
             
                                                                           flashes: flashes.to_json } )
         
     | 
| 
       60 
67 
     | 
    
         
             
                      response.body = response_body[0]
         
     | 
| 
       61 
     | 
    
         
            -
                       
     | 
| 
      
 68 
     | 
    
         
            +
                      ajaxify_set_asset_digest_header
         
     | 
| 
       62 
69 
     | 
    
         | 
| 
       63 
70 
     | 
    
         
             
                      return
         
     | 
| 
       64 
71 
     | 
    
         
             
                    end
         
     | 
| 
       65 
72 
     | 
    
         | 
| 
       66 
73 
     | 
    
         
             
                    super
         
     | 
| 
       67 
74 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                    ajaxify_add_meta_tags 
     | 
| 
      
 75 
     | 
    
         
            +
                    ajaxify_add_meta_tags unless request.xhr?
         
     | 
| 
       69 
76 
     | 
    
         | 
| 
       70 
77 
     | 
    
         
             
                    return
         
     | 
| 
       71 
78 
     | 
    
         
             
                  end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ajaxify_rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.7. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.5
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013-03- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-03-14 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rails
         
     |