it would be great to be able to pick a layout to encapsulate the blog. custom css is fine, but when it mismatches the remainder of the site (as in the blog is NOT the primary focus), it looks super messy.
Great idea! How would you like this to be implementend? A simple (optionnal) setting in the initializer with path to the layout file? This is how I would do it I think...
Thanks for the suggestion.
yeah, that sounds like a winner. or maybe a module in the models folder to change parameters on the fly instead of using an initializer altogether.
I see a downside to that: the meta description, page title and feed tag should be handled within the main app.
To fix that downside, I think I might split the head in two. Meta description, title and feed should be in a partial that the main_app could just include in it's layout. In that partial there would be those three tags, but they would only be printed when in a page handled by Monologue.
Does it make sense to you @dougc84?
I think i understand what you're saying. That sounds great! The only thing I really have a concern about this, however, is that I create a model on every app I make called Site. In Site, I put a constant called TITLE. Site::TITLE is the title of the site listed in the titlebar, as well as anywhere I want to mention the app's name (ever have someone tell you they don't like it spelled 'Application', they want it spelled 'aPPlication,' and then you're stuck changing it everywhere?).
It'd be nice to let values such as these accessible to monologue, which you can't do in an initializer, but I think you could do in a public layout.
Sorry to say, but I am not sure to understand your point. You don't want the blog post title be merged with a default site name (which is currently in an initializer: Monologue.site_name | https://github.com/jipiboily/monologue/wiki/Configuration) to give the final <title> of a page, is that it?
Can you elaborate a bit more please? :)
Not quite. I'd like to be able to access Model data to pass to the app.
Like I was saying, I set up a constant in every application called Site::TITLE. That's not available in the initializer unless I set it much earlier, but I use that model file (/app/models/site.rb) to define site-wide constants, and expand on that if there's a preferences system I build in. Being able to pass along application data post-initializer is what I'd be looking for. If it's in a partial, it could obviously call the main app's variables, which would be great.
+1 for the ability to point to a layout file. How are people modifying it currently? Is there a way to vendor an engine and change the code directly? I gem unpacked into vendor and pointed the gemfile to it but started getting `require': cannot load such file -- tinymce-rails errors......weird. I thought vendoring the gem would just work. Thanks......
I will make that happen real soon.
@tmancino for now, you would have to override the layout or the partial you want to modify at the exact same path. If you want to override the layout, you would have to create a file in your own app at "app/views/layouts/monologue/application.html.erb". You could also use a project like Deface to customize the erb files.
Here are the monologue views: https://github.com/jipiboily/monologue/tree/master/app/views
This worked great thanks. Only issue encountered was in trying to use current_user.user_name method call with Devise on the main_app. It looks like it is conflicting with the monologue current_user helper method in the overridden view.
@tmancino could you please create another issue for that please? I will take a close look at that too.
I have added the ability to choose a different layout for frontend. It is available in master and 0-1-stable branch. You can see it here: a7019f7. I still need to do some work to make it easy to use meta tags and such from main_app layout.
Just add to your config file:
Monologue.layout = "path/to/your/layout/file"
@tmancino I added a new issue to work around your issue with Devise.
added test for layout configuration (#54)
decoupled multiple parts of the head in layout to make it easier to e…
…xtend or integrate with main_app (#54)
@dougc84 I did decoupled the <head> in multiple partials to make it easier to use your own layout and stuff. For the site name, you could set Monologue.site_name in your model, right? It can be set in initializer but can be overridden anywhere. Want to try that?
is everything fine now or there could be more improvements? I will close this issue for now, do not hesitate to comment or re-open if something is not as you expected about the layout, else, do not hesitate to open other issues. Pull requests are welcomed too. :)
comment non passing test for #54 until I find a workaround
I just released Monologue 0.1.1 with this included.
Great look forward to checking it out. Thanks for the hard work.
I released 0.1.2 yesterday too as there was a regression in feed URLs. There is now a cover to make sure that will never come back! ;)