More thoughts on admin classes

Discussion corner for Developers of Serendipity.
Post Reply
User avatar
Don Chambers
Regular
Posts: 3614
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

More thoughts on admin classes

Post by Don Chambers » Tue Feb 03, 2015 5:28 am

So now I am working on a custom staticpage smarty template. What I would like to do is model a lot of this from the same page we see when editing entries.

Something I would like to be able to do is hook into existing classes. Problem is, once again, many things are styled to a very specific class. here is an example:

Code: Select all

.entryproperties_access_groups, .entryproperties_access_users, .entryproperties_access_author, .entryproperties_markup, #plugin_groups {
    float: left;
    margin-right: 2%;
    width: 48%;
}
and....

Instead of that, any chance of getting something like:

Code: Select all

.entryproperties_float_left {
    float: left;
    margin-right: 2%;
    width: 48%;
}
Wouldn't mind seeing that with an alternating odd/even class to float left vs. right with a corresponding change to margin left vs. right.

User avatar
yellowled
Regular
Posts: 6959
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: More thoughts on admin classes

Post by yellowled » Tue Feb 03, 2015 11:12 am

Don Chambers wrote:

Code: Select all

.entryproperties_access_groups, .entryproperties_access_users, .entryproperties_access_author, .entryproperties_markup
Instead of that, any chance of getting something like:

Code: Select all

.entryproperties_float_left
Are you aware that you could re-use any of the first four classes and that the only difference in the second solution would be that we would be using a single (and very unsemantic) class name?
Don Chambers wrote:Wouldn't mind seeing that with an alternating odd/even class to float left vs. right with a corresponding change to margin left vs. right.
In general, alternating odd/even is not always possible in the backend (it is with :nth-child(), but since we still support IE8, this is not always feasible).

Here, it would simply fail if one of there we disabled by the user.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Don Chambers
Regular
Posts: 3614
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: More thoughts on admin classes

Post by Don Chambers » Tue Feb 03, 2015 3:50 pm

yellowled wrote:Are you aware that you could re-use any of the first four classes and that the only difference in the second solution would be that we would be using a single (and very unsemantic) class name?
Yes, I am aware, and am actually doing that. But in doing so, I am using a class semantically intended for access_groups, or access_author, and using it for something completely unrelated to those semantic names.

User avatar
yellowled
Regular
Posts: 6959
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: More thoughts on admin classes

Post by yellowled » Tue Feb 03, 2015 5:59 pm

Don Chambers wrote:But in doing so, I am using a class semantically intended for access_groups, or access_author, and using it for something completely unrelated to those semantic names.
Which is exactly the same as what you would be doing if there was a class called entryproperties_float_left. :)

Generic layout classes are never semantic. One could actually even discuss the value of semantic class names. In fact, there are tons of articles about that out there. (The usual train of thought being that semantics are supposed to come from elements anyway, that semantic class names only work within the group that agreed upon the meaning that these class names should have, and where was I …? Oh, right.)

I have no good solution for you. Generic layout class names are not a good idea, using a non-semantic class for those elements aren't, either. But frankly, if you use entryproperties_float_left or entryproperties_access_groups out of context does not really make a difference, so I would go with the existing classes. (In an ideal world, you would just add your own class and CSS for that template, but that would only be possible using inline styles. Please don't do that.)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Post Reply