Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rails_pivot_table_js

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails_pivot_table_js

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Gem Version

RailsPivotTableJs

The rails_pivot_table_js gem provides a helper to display a pivot_table using the open source pivot_table.js (http://nicolas.kruchten.com/pivottable/examples/)

Features

  • Encaplsulates all pivottable.js scripts and css
  • provide a helper to display the pivot_table
  • TODO: Saved Configs, scoped by contexts, to persist pivot configurations for tlater retrieval

Installation

Add this line to your application's Gemfile:

gem 'rails_pivot_table_js'

Execute:

$ bundle

Or install it yourself as:

$ gem install rails_pivot_table_js

For while we don't need to change this file.

Usage

First, in your model, genrate the desired data as annra of hashes, then convert it to JSON

  def pivot_data
    rows = []
    self.documentos.each do |nfe|
      rows << {
                'Emitente' => nfe.estabelecimento.nome,
                'Emitente CNPJ' => nfe.estabelecimento.cnpj,
                'Mês Emissão' => nfe.nf_data_emissao.strftime('%y-%m'),
                'Valor' => nfe.nf_valor
      }
    end
    rows.to_json
  end

In your controoler, define the data and defaul_config

    @pivot_dara = cliente.pivot_data
    @pivot_columns = {
        cols: ['Emitente'],
        rows: ['Mês Emissão']
    }

In yout view, call the helper with the data

  %hr
  %h3 Indicadores de Documentos Recebidos
  = show_pivot_table @pivot_data, @pivot_columns

All done! Enjoy the pivot table!

i18n Support

This gem was built using i18n translation supports, and has bult-in support for English (en) and Brazilian Portuguese (pt-BR). If you want to translate to your specific language, add a new locale file in your config/locales and translate the values to your language. You can get one of the locales of this project to make it easier to translate to your language.

Contributing

  1. Fork it ( https://github.com/davidbrusius/ransack_advanced_search/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

This project uses MIT-LICENSE.

FAQs

Package last updated on 29 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc