Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
rails_pivot_table_js
Advanced tools
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/)
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.
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!
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.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)This project uses MIT-LICENSE.
FAQs
Unknown package
We found that rails_pivot_table_js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.