chartkick 1.1.2 → 1.1.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.
Potentially problematic release.
This version of chartkick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +13 -1
- data/lib/chartkick/helper.rb +8 -1
- data/lib/chartkick/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 128a490e06abdcd32d0c7b941b4b087b3a633827
         | 
| 4 | 
            +
              data.tar.gz: fa41e91b74b5d857a5c4037a95795e975a911aa0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e05a9b51baa1528c89fcc92c23c94b6f010b86e30554552e306ad4f2b502cf95e146b346b716f9dcd08faa3a85bab087fa14410c16ff7a912a7b43dec591c3ef
         | 
| 7 | 
            +
              data.tar.gz: 2530a2f68acc7c21eb1f653a3b0a7719c2dc0dd41dbaa675402a1e1214b67c78eb08a3aefd27bb5b14231adc8faefa9686be4941ceeea18375a4758e153aa8e7
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -76,6 +76,18 @@ You can pass options directly to the charting library with: | |
| 76 76 | 
             
            <%= line_chart User.group_by_day(:created_at).count, :library => {:backgroundColor => "#eee"} %>
         | 
| 77 77 | 
             
            ```
         | 
| 78 78 |  | 
| 79 | 
            +
            You can also pass a content_for option, which will put the javascript in a content block.  This is great for including all of your javascript at the bottom of the page.
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            ```erb
         | 
| 82 | 
            +
            <%= line_chart User.group_by_day(:created_at).count, :content_for => :js_initialization %>
         | 
| 83 | 
            +
            ```
         | 
| 84 | 
            +
            Then, in your layout:
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            ```erb
         | 
| 87 | 
            +
            <%= yield :js_initialization # Rails %>
         | 
| 88 | 
            +
            <%= yield_content :js_initialization # Padrino %>
         | 
| 89 | 
            +
            ```
         | 
| 90 | 
            +
             | 
| 79 91 | 
             
            ### Data
         | 
| 80 92 |  | 
| 81 93 | 
             
            Pass data as a Hash or Array
         | 
| @@ -108,7 +120,7 @@ Add this line to your application's Gemfile: | |
| 108 120 | 
             
            gem "chartkick"
         | 
| 109 121 | 
             
            ```
         | 
| 110 122 |  | 
| 111 | 
            -
            And add the javascript files to your views.  These files must be included **before** the helper methods.
         | 
| 123 | 
            +
            And add the javascript files to your views.  These files must be included **before** the helper methods, unless using the `:content_for` option.
         | 
| 112 124 |  | 
| 113 125 | 
             
            For Google Charts, use:
         | 
| 114 126 |  | 
    
        data/lib/chartkick/helper.rb
    CHANGED
    
    | @@ -28,10 +28,17 @@ module Chartkick | |
| 28 28 | 
             
            <div id="#{ERB::Util.html_escape(element_id)}" style="height: #{ERB::Util.html_escape(height)}; text-align: center; color: #999; line-height: #{ERB::Util.html_escape(height)}; font-size: 14px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif;">
         | 
| 29 29 | 
             
              Loading...
         | 
| 30 30 | 
             
            </div>
         | 
| 31 | 
            +
            HTML
         | 
| 32 | 
            +
                 js = <<JS
         | 
| 31 33 | 
             
            <script type="text/javascript">
         | 
| 32 34 | 
             
              new Chartkick.#{klass}(#{element_id.to_json}, #{data_source.to_json}, #{options.to_json});
         | 
| 33 35 | 
             
            </script>
         | 
| 34 | 
            -
             | 
| 36 | 
            +
            JS
         | 
| 37 | 
            +
                  if options[:content_for]
         | 
| 38 | 
            +
                    content_for(options[:content_for]) { js.respond_to?(:html_safe) ? js.html_safe : js }
         | 
| 39 | 
            +
                  else
         | 
| 40 | 
            +
                    html += js
         | 
| 41 | 
            +
                  end
         | 
| 35 42 |  | 
| 36 43 | 
             
                  html.respond_to?(:html_safe) ? html.html_safe : html
         | 
| 37 44 | 
             
                end
         | 
    
        data/lib/chartkick/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: chartkick
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 4 | 
            +
              version: 1.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Andrew Kane
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2013-06- | 
| 11 | 
            +
            date: 2013-06-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |