victorjonsson / Arlima

Article List Manager - Wordpress plugin suitable for online newspapers that's in need of a fully customizable front page
28 stars 16 forks source link

Arlima admin: set classes to items in arlima lists based on formats and templates #60

Closed chredd closed 9 years ago

chredd commented 9 years ago

Makes it easier to visually show which format and/or template that is being used for a teaser. Let's say that my format "Featued teaser" should have a red bar (or background), the format "Standard" should have a blue bar (or backbround, or whatever) to make it easier for editors to determine how the teaser looks like without opening it in preview.

It would make i possible to create something like this (ignore the red line at the end): wp-admin

victorjonsson commented 9 years ago

That makes sense... and it doesn't require too much code either. Look into ArlimaArticle.js and the function updateItemPresentation().

victorjonsson commented 9 years ago

You can now declare the border color when calling arlima_register_format()

https://github.com/victorjonsson/Arlima/wiki/Article-formats#registering-and-deregistering-formats

Do you think it's enough if the formats has this feature? I'm thinking that it will get bit distracting if both formats and templates applies different colors to the article item

chredd commented 9 years ago

Great!

There is some value on having the template as CSS class as well since you might either one of them in your implementation. So sometimes templates are important and sometimes formats are. Just adding the CSS classes let me as a developer decide how I should format them visually in Arlima admin.

Does this make any sense?

victorjonsson commented 9 years ago

Yes, I think you're absolutely right. Your'e either a heavy user of formats, or a heavy user of templates...

You don't register the templates one by one so the css has to be inserted with an inline style-tag, or something...

Let's say you have the template ..esport/template/sport-teaser.tmpl then the class template-sport-teaser would be added to the article item. The css could be inserted with something like this:

add_action('arlima_admin_scripts-main', function() { ?>
  <style>
    .article.template-sport-tease {
       border: pink dotted 4px;
    }
  </style>
<?php });
chredd commented 9 years ago

That sounds like a good idea. Also makes it really clear on what you are targeting.

victorjonsson commented 9 years ago

Let me know if it works as expected. Notice that the template classes is prefixed with template- but that format classes is not prefixed with anything.

chredd commented 9 years ago

I will try this out today.

chredd commented 9 years ago

I works super swell! In order to making it clearer it would be great if the formats are prefixed as well tho. IE: class="article template-image-background format-serif-title". What do you think?

Edit: guessing that this could be done by just adding as a prefix it here: https://github.com/victorjonsson/Arlima/blob/145c22c75541427ad24cdaefda22cb452ed02d06/js/arlima/dev/ArlimaArticle.js#L105

chredd commented 9 years ago

:+1: