feature request: use layout #54

Closed
dougc84 opened this Issue May 9, 2012 · 17 comments

Comments

Projects
None yet
3 participants
@dougc84

dougc84 commented May 9, 2012

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.

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 9, 2012

Owner

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.

Owner

jipiboily commented May 9, 2012

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.

@dougc84

This comment has been minimized.

Show comment
Hide comment
@dougc84

dougc84 May 9, 2012

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.

dougc84 commented May 9, 2012

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.

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 9, 2012

Owner

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?

Owner

jipiboily commented May 9, 2012

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?

@ghost ghost assigned jipiboily May 9, 2012

@dougc84

This comment has been minimized.

Show comment
Hide comment
@dougc84

dougc84 May 9, 2012

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.

dougc84 commented May 9, 2012

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.

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 10, 2012

Owner

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? :)

Owner

jipiboily commented May 10, 2012

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? :)

@dougc84

This comment has been minimized.

Show comment
Hide comment
@dougc84

dougc84 May 14, 2012

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.

dougc84 commented May 14, 2012

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.

@tmancino

This comment has been minimized.

Show comment
Hide comment
@tmancino

tmancino May 14, 2012

+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......

+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......

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 15, 2012

Owner

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

Owner

jipiboily commented May 15, 2012

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

@tmancino

This comment has been minimized.

Show comment
Hide comment
@tmancino

tmancino May 15, 2012

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.

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.

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 15, 2012

Owner

@tmancino could you please create another issue for that please? I will take a close look at that too.

Thanks! :)

Owner

jipiboily commented May 15, 2012

@tmancino could you please create another issue for that please? I will take a close look at that too.

Thanks! :)

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 16, 2012

Owner

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"
Owner

jipiboily commented May 16, 2012

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"
@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 16, 2012

Owner

@tmancino I added a new issue to work around your issue with Devise.

Owner

jipiboily commented May 16, 2012

@tmancino I added a new issue to work around your issue with Devise.

jipiboily pushed a commit that referenced this issue May 18, 2012

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 18, 2012

Owner

@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?

Owner

jipiboily commented May 18, 2012

@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?

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily May 18, 2012

Owner

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. :)

Owner

jipiboily commented May 18, 2012

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. :)

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily Jun 2, 2012

Owner

I just released Monologue 0.1.1 with this included.

Owner

jipiboily commented Jun 2, 2012

I just released Monologue 0.1.1 with this included.

@tmancino

This comment has been minimized.

Show comment
Hide comment
@tmancino

tmancino Jun 4, 2012

Great look forward to checking it out. Thanks for the hard work.

tmancino commented Jun 4, 2012

Great look forward to checking it out. Thanks for the hard work.

@jipiboily

This comment has been minimized.

Show comment
Hide comment
@jipiboily

jipiboily Jun 4, 2012

Owner

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! ;)

Owner

jipiboily commented Jun 4, 2012

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! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment