Comments (12)
Hi Brendon,
Yeah that sounds like a good idea. Would you consider investigating a little further and submit a pull request?
Thanks.
from gretel.
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.
Thanks :-)
from gretel.
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.
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.
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.
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.
Fixed in #24. Thanks.
from gretel.
And I'm considering the app/breadcrumbs
idea to see how we could do it.
from gretel.
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.
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.
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)
- Status of the project HOT 9
- Add a screenshot of a generated breadcrumb to the README.md HOT 2
- Nullable parent for specific crumb HOT 5
- Bootstrap 4 HOT 2
- is this thread-safe? HOT 4
- current tag link is relative to the route not the url provided? HOT 2
- alias_method_chain is deprecated in Rails 5 HOT 10
- using jRuby yields uninitialized constant error HOT 1
- Using tap instead breadcrumbs blocks HOT 4
- Add examples page to dummy rails application?
- breadcrumbs not accepting any arguments HOT 3
- Could you release a new version? HOT 3
- Foundation 6 support ? HOT 1
- Support of I18n HOT 2
- Do not depend on "rails" gem, depend on parts of Rails that Gretel uses HOT 2
- Update `Building the breadcrumbs manually` example HOT 1
- Outside Div HOT 1
- Specify class for link HOT 3
- Add breadcrumbs in controller actions
- Subtle test order dependency when mixing Gretel breadcrumbs with TrailBlazer Cells HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gretel.