Coder Social home page Coder Social logo

Comments (12)

lassebunk avatar lassebunk commented on August 20, 2024

Hi Brendon,

Yeah that sounds like a good idea. Would you consider investigating a little further and submit a pull request?

Thanks.

from gretel.

brendon avatar brendon commented on August 20, 2024

I certainly would :) I'll have a look and see what I can come up with.

On Sat, Dec 7, 2013 at 10:13 PM, Lasse Bunk [email protected]:

Hi Brendon,

Yeah that sounds like a good idea. Would you consider investigating a
little further and submit a pull request?

Thanks.


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-30051115
.

from gretel.

lassebunk avatar lassebunk commented on August 20, 2024

Thanks :-)

from gretel.

brendon avatar brendon commented on August 20, 2024

Hi Lasse :) I'm wondering if you could take a different approach to your breadcrumbs files (though it might be a breaking change if you didn't want to make the effort of providing backward compatibility).

You could hook into rails autoload_paths (I'm assuming they reload on refresh), instruct users to store their breadcrumbs in /app/breadcrumbs. In the breadcrumbs files themselves include the module Gretel::Crumbs::Filename so that the autoloading works and then Rails will handle the rest?

I'm making a lot of assumptions here as I'm not 100% sure that that is how autoload_paths works, but it seems to be a better way than manually handling configuration and also checking whether the files have changed as you're currently doing? :)

What do you think?

from gretel.

lassebunk avatar lassebunk commented on August 20, 2024

When I moved the breadcrumbs config out of initializers, I originally wanted to put them in app/breadcrumbs, because I think they belong there. But then I ran into the problem that Rails would try to load the files, and the files cannot be loaded; they must be instance_eval'ed.

If it's possible, I'd really like the breadcrumbs to be in app/breadcrumbs as you suggest. Then we'd just deprecate config/breadcrumbs and support them until v4.

Any ideas?

from gretel.

brendon avatar brendon commented on August 20, 2024

Lol, yea I just realised you were eval'ing them :)

What if you changed the configuration format completely and turned the crumb calls into methods themselves? This is just brainstorming here!

I have one like this:

crumb :site_settings do
  link "Site Settings", edit_admin_site_settings_path
end

It could become:

def site_settings_crumb
  link "Site Settings", edit_admin_site_settings_path
end

It would still allow you to pass in parameters etc... and the methods would only get called when they're used.

I have to admit that I'm getting quite out of my depth at this point so I'm not sure how much more help I'd be, but I'm happy to try :)

from gretel.

lassebunk avatar lassebunk commented on August 20, 2024

Hmm, if we'd do the def xx_crumb .. end, I think it would define the methods in the global (or main) namespace so every class in the system would get access to it.

Maybe we can make Rails skip the app/breadcrumbs directory.

from gretel.

lassebunk avatar lassebunk commented on August 20, 2024

Fixed in #24. Thanks.

from gretel.

lassebunk avatar lassebunk commented on August 20, 2024

And I'm considering the app/breadcrumbs idea to see how we could do it.

from gretel.

lassebunk avatar lassebunk commented on August 20, 2024

I found a solution which I think may be even better than app/breadcrumbs.
Breadcrumbs are a concern of the view, and can now be put in the app/views/breadcrumbs folder. The format is the same as in the config folder. The feature is experimental which means that we can use it in actual projects and see how we like it. Then later on, if it works good, we can replace loading from the config folder with this.
It's available in v3.0.3 which I just released.

Thanks for the input :)

from gretel.

brendon avatar brendon commented on August 20, 2024

Thanks Lasse :) That sounds great! and much more logical.

With regards to the methods, I think these could still be 'defined' within your Gretel::Crumbs class but I'm not sure how that would happen with rails auto_loading the files. Glad you were able to come up with something anyway, and the blocks are much more succinct anyway :)

Have a great day!

from gretel.

lassebunk avatar lassebunk commented on August 20, 2024

Thanks! You too :) Let me know if you need anything.

2013/12/9 Brendon Muir [email protected]

Thanks Lasse :) That sounds great! and much more logical.

With regards to the methods, I think these could still be 'defined' within
your Gretel::Crumbs class but I'm not sure how that would happen with rails
auto_loading the files. Glad you were able to come up with something
anyway, and the blocks are much more succinct anyway :)

Have a great day!


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-30173033
.

from gretel.

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.