Code Monkey home page Code Monkey logo

Comments (14)

randym avatar randym commented on July 17, 2024

Hi @unenemy

Can you let me know a bit more about how you are doing this?
For example, are you trying to configure this in ActiveAdmin.register [Model] block?
Somewhere in a controller?

More than happy to help out, and fix anything that may be broken, I just need to be able to recreate the problem and dig in.

from activeadmin-axlsx.

unenemy avatar unenemy commented on July 17, 2024

Okay, I register a Model like this:

ActiveAdmin.register Order, :as => "OrderStatistics" do
end

And xlsx works perfectly, loads an xlsx file with all the field, thats nice.
But when I tried customize it. My customization ended with:

ActiveAdmin.register Order, :as => "OrderStatistics" do
xlsx do
end
end

After adding this 2 lines it gives me those errors.
Thanks for quick reply :)
PS: does that matters, my active_admin version is "0.5.0"?

from activeadmin-axlsx.

randym avatar randym commented on July 17, 2024

Please have a look at the readme for this gem. configuration is done via the config builder object. I am not quite sure where you are getting that 'xlsx' from. Perhaps there is some reference out there that I dont know about giving the wrong information?

from activeadmin-axlsx.

unenemy avatar unenemy commented on July 17, 2024

I found this in your code. That's where I get info about xlsx method

module ActiveAdmin
module Axlsx
module DSL
# Configure the xlsx format
#
# For example:
#
# xlsx do
# i18n_scope = [:active_admin, :resources, :post]
# column :name
# column(:author) { |post| post.author.full_name }
# end
#
# xlsx :header_style => { :bg_color => "00", :fg_color => "FF" } do
# column :name
# end
def xlsx(options={}, &block)
config.xlsx_builder = XlsxBuilder.new(options, &block)
end

end

end
end

Besides, I have another problem. I tried out the config builder object and it worked fine. I added it this way
ActiveAdmin.register Currency do
config.xlsx_builder.column('test') do
"test"
end

#xlsx do
#end
end

BUT. After I tried restart my server, I've got an error:
undefined method `xlsx_builder' for #ActiveAdmin::Resource:0xbd5b62c (NoMethodError)

I'm sorry for giving you my troubles, but I really need configure output file ( remove some columns, add another columns (using config I can do only adding new)).

Thanks.

from activeadmin-axlsx.

randym avatar randym commented on July 17, 2024

Well done mate!

Please accept my sincerest apologies for providing the only thing worse than no documentation: bad documentation!

In the short term, can you use the config.axlsx_builder blocks like the README shows?
I am fairly sure you have access to the columns collection and can hack on that without issue.

I'll have a look at that DSL tomorrow and see what is going on (JST here, so time for bed soon!)

from activeadmin-axlsx.

unenemy avatar unenemy commented on July 17, 2024

Yeap, I can hack that with axlsx_builder, but I'm very waiting for dsl :)
Thanks and good night :)

from activeadmin-axlsx.

randym avatar randym commented on July 17, 2024

Some goodies coming for us soon. Any chance I can encourage you to do some testing against master?

from activeadmin-axlsx.

unenemy avatar unenemy commented on July 17, 2024

Thanks a lot, that's was fast. For now, that's all I've found.

from activeadmin-axlsx.

warpc avatar warpc commented on July 17, 2024

Hi!

I also have this problem: #4

Do you need any additional informations?

from activeadmin-axlsx.

randym avatar randym commented on July 17, 2024

Does it happen in master?

from activeadmin-axlsx.

warpc avatar warpc commented on July 17, 2024

Hi!

Yes, i insert Gemfile in:

 gem 'activeadmin-axlsx', :git => "[email protected]:randym/activeadmin-axlsx.git"

Use bundle install and try to run application using rails s

 orders.rb:63:in `block in <top (required)>': undefined method `xlsx_builder' for #    <ActiveAdmin::Resource:0x007fad6cc205a8> (NoMethodError)

In this file this code is:

 xlsx do 

I try use

  config.xlsx_builder.delete_columns :id, :created_at, :updated_at

and also get error:

 7:in `block in <top (required)>': undefined method `xlsx_builder' for #<ActiveAdmin::Resource:0x007fbb7af22780> (NoMethodError)

from activeadmin-axlsx.

randym avatar randym commented on July 17, 2024

Thank you very much! I'll try and have a look at this tomorrow morning.

from activeadmin-axlsx.

warpc avatar warpc commented on July 17, 2024

Hi. Do you need any additional informations or help with testing changes?

from activeadmin-axlsx.

warpc avatar warpc commented on July 17, 2024

@randym, please look it: #4 (comment)

from activeadmin-axlsx.

Related Issues (20)

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.