Coder Social home page Coder Social logo

activeadmin-xls's People

Contributors

cprodhomme avatar cpunion avatar ejaypcanaria avatar jundihuang avatar rewritten avatar shanser avatar thambley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

activeadmin-xls's Issues

only_columns in addition to delete_columns

A nice feature would be the abilty to name the columns in the order they should appear in the file. As I understand it, it is only possible to delete columns, eg:

config.xls_builder.delete_columns :id, :created_at, :updated_at, :category_name, :epfl_id_inst, :epfl_id_transact, :epfl_result, :epfl_date_cr, :epfl_payment_cd, :epfl_paymode, :epfl_payment_status_cd, :

It would be nice to be able to also do this

 config.xls_builder.only_columns :first_name, :last_name, :organization, :email, :payment

ActiveAdmin::DatabaseHitDuringLoad when migrating the database.

The code at https://github.com/thambley/activeadmin-xls/blob/master/lib/active_admin/xls/builder.rb#L217 is trying to connect to the database even in situations where it isn't advisable (example: assets:precompile, db:migrate, db:schema:load)

Surrounding the corresponding part of the configuration (both with the DSL and with the explicit builder methods) and rescueing a ActiveRecord::StatementInvalid exception is a temporary workaround but it might be a problem in production.

This issue in ActiveAdmin is similar: activeadmin/activeadmin#2342

Missing per-column localisation option.

I ran into a limitation with the way localising column names is implemented in the gem, as you can only decide to use, or dismiss localisation for the whole DSL block. My use case is mixed, requiring localising regular model attributes, and using key/value pairs that have been saved to the db directly for custom columns (skipping localisation for the key columns).

I did a quick patch that works for my needs, opting to only localise the columns if passed as a symbol, and when a scope exists. Strings are always titleized.

module ActiveAdmin
  module Xls
    class Builder
      class Column
        def localized_name(i18n_scope = nil)
          return name.to_s.titleize unless i18n_scope && (name.is_a? Symbol)
          I18n.t name, scope: i18n_scope
        end
      end
    end
  end
end

Hesitating to do a PR for this though, as it is in essence a breaking change to the way column localisation is handled. Perhaps a passable option for the column helper would be a better approach?

rails 5 deprecation alias_method_chain

DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from included at /bundle/bundler/gems/activeadmin-xls-a5a70018c626/lib/active_admin/xls/resource_controller_extension.rb:5)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from included at /bundle/bundler/gems/activeadmin-xls-a5a70018c626/lib/active_admin/xls/resource_controller_extension.rb:6)

Gemfile.lock


GIT
  remote: git://github.com/thambley/activeadmin-xls.git
  revision: a5a70018c626d1ad3cde9f763bad3d10fa68867a
  specs:
    activeadmin-xls (1.0.3)
      activeadmin
      spreadsheet

Rails 4.2 tests are broken

sprockets-rails says:

Expected to find a manifest file in app/assets/config/manifest.js (Sprockets::Railtie::ManifestNeededError)

Security issue with xls_builder retaining data even if template render fails to an exception on a computed field

There seems to be a possibly high impact issue with the way the xls_builder handles rendering the column contents. Steps to reproduce:

  1. Have the following xls template for an ActiveAdmin resource
  xls do
    whitelist
    column :name do |key|
      custom_helper_that_raises_exception(key)
    end
  end
  1. Have the ActiveAdmin resource filtered in to view A and view B so that
  • Items from viewA raise no exception with the custom helper
  • Some item(s) from viewB raises an exception.
  1. First export viewB as xls and have the server throw an error. Now export viewA as xls.

Observed: viewA.xls contains data from viewB
Expected: Every export should be from a clean slate, so viewA.xls should only contain data from viewA.

Haven't had the chance to see if the issue is with my versions, this gem, or the underlying spreadsheet gem. This does pose a security issue with using custom helpers that might throw an uncaught error, thus leaking data between exports.

Versions used:
Ruby 2.3.7p456, Rails 5.0.7.1, ActiveAdmin 1.2.1, ActiveAdmin-xls 2.0.0, Spreadsheet 1.1.7

undefined local variable or method `max_per_page'

Hi, I am receiving the next error:
NameError (undefined local variable or methodmax_per_page' for #Admin::UsersController:0x000000065f4cd0):
vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-xls-87675360866b/lib/active_admin/xls/resource_controller_extension.rb:26:in per_page_with_xls'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.