Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Documentation #383

Closed
l4rth opened this issue Nov 23, 2014 · 8 comments
Closed

Template Documentation #383

l4rth opened this issue Nov 23, 2014 · 8 comments

Comments

@l4rth
Copy link

l4rth commented Nov 23, 2014

Hi,

I am currently trying to customize the templates to meet my webpage design and I am missing some Documentation on what is content and what is detail and how the templates work together. By now I tried to change the ... yeah I don't have a name, the -template, where title, written by, the whole content etc. is shown. But my changes have influence on the list, and maybe other things.

What I was expecting:

entry_detail_base.html -> The Entries detail view (Title, meta information, everything of the post)
entry_list.html -> A list of entries.

Maybe you can give me a hint or something on what file i could take as base file, and what's the difference between content and detail?

@bittner
Copy link
Contributor

bittner commented Nov 23, 2014

You can take a look at django-organice-theme, which customizes Zinnia to integrate nicely into a django CMS driven platform.

The source code demonstrates how to

  • change the basic appearance (base.html)
  • and the different displays of entries (base, list, day, month, year),
  • customize specific tags

Maybe also helpful: Documentation and threads

@l4rth
Copy link
Author

l4rth commented Nov 23, 2014

Thank you for the django-organice-theme link. I have read the customize documentation but it only tells me how to override templates and which to overwrite but not how they are composed which i think is not trivial.
For example, changes in the entry_detail_base.html seem to have no impact on the design. Changes on _entry_detail_base.html results in changes but for both list AND detail view which should not happen.

What I think no is:

entry_detail_base like _entry_detail_base is meta-data like the title, author, tags, etc.
it is base for lists AND content and one particular Entry post is composed together of the detail template and a content template. If this is true, then i have to ask why?

@l4rth
Copy link
Author

l4rth commented Dec 1, 2014

I now tried to setup my templates.

Is there really no way to split the detail view from the list view?

To me it looks like a essential use case that classes and html for the list differs from classes and html for the detail view.

@bittner
Copy link
Contributor

bittner commented Apr 27, 2015

Yes, the entry_detail_base vs. _entry_detail_base and entry_detail vs. _entry_detail cases are a beast. I guess this is historically grown and cannot be changed easily without breaking backward compatibility in the templates.

Part of the "problem" is that with the content_template variable there is some flexibility built-in (that I'm wondering who needs it). The rendering is done in blocks such as

{% include object.content_template with object_content=object.html_content %}
{% include object.content_template with object_content=object.html_preview continue_reading=1 %}

Examples:

In the latter example, the continue_reading flag is used for deciding whether to show a preview or the full article. html_content and html_preview are properties of the entry model that handle the (potential) conversion to HTML and the necessarily complex truncation of HTML.

I think most people need to modify the _entry_detail_base.html template and don't need to touch entry_detail_base.html ever, for example. I believe some renaming of the template files would make things much much clearer. -- At the cost of breaking backward compatibility.

@Fantomas42
Copy link
Owner

@bittner thanks for your explanation.

I would add this information, the organization the _base.html suffix with inheritance is designed to ease the declination of different templates for rendering the entries. Using a base intermediary template make also the maintenance task a lot easier.

This design organization has been done after my own experience on http://darwin.willbreak.it, which required a lot of customization to represent the different kind of entries. And it was a real pain before this change.

Regards

@jdejoode
Copy link

jdejoode commented Oct 3, 2015

To be honest I think this issue is not solved yet. The question is: how can one change the way articles are presented in a 'list' view (for instance, 5 most recent articles in cmsplugin_zinnia) without affecting the way these individual articles are presented in their 'detail' view.

For instance: how can one have the entry-footer in the detail view, but not a list view.

Currently, one can change _entry_detail_base.html but that affects both list and detail views.

All help welcome

@Fantomas42
Copy link
Owner

If you change _entry_detail_base.html, it's affects by default the detail and list template used, because in zinnia/entry_detail_base.html and zinnia/entry_list.html, the same include in used.

{{ object.content_template }}

Change the include in zinnia/entry_detail_base.html to point to the same template each time.

Regards

@jdejoode
Copy link

jdejoode commented Oct 5, 2015

That did the trick! It did take a lot of experimenting. In my view the name "detail" should be reserved for templates that are old school detail views. Thanks for the pointer.

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

No branches or pull requests

4 participants