Character list - tags/attributes on container

jodie
jodie
edited March 2021 in Feature Requests

Currently the tags can be accessed for fun shenanigans through the data selector on the tag links themselves. But is there any chance of having them on the character-list-item-container list element. Either as classes with a data-tag- prefix or as data attributes.

Think of the POWER

Post edited by jodie on

Comments

  • thaen
    thaen
    Posts: 1,064

    Thanks for the request!

    Can you give a specific example and how you would use it?  I think you're just asking for some classes or attributes to be added to the HTML, which should be possible.  But I'm having trouble seeing exactly what you're asking for?  Screenshots maybe?

    Obsidian Portal Developer

  • jodie
    jodie
    Posts: 82

    So this is a daft example, but the <li> element now has the class 'data-tag-dead' (it would also have data-tag-inquisitor in this scenario). And I added a style that changes the opacity of 'dead' characters to 0.4. But this would let me... put golden borders around inquisitors or nobility. Or change the background to camo for military characters. Or hide characters that I only want accessible through obscure wiki link journies.

  • jodie
    jodie
    Posts: 82

    Or let me animate in and out ghost character's photos. That would be hilarious.

  • thaen
    thaen
    Posts: 1,064

    That screenshot really helps!

    I'll play with this idea and see if I run into any surprises.

    Obsidian Portal Developer

  • jodie
    jodie
    Posts: 82

    You rock thank you ^_^

  • jodie
    jodie
    Posts: 82

    It's just as easy to select an element by its data attribute as its class, so if its a pain to sanitise the tagging names manually, data attributes on the container would be exactly as good. You already have them on the tagging links. 

  • thaen
    thaen
    Posts: 1,064

    The hurdle here is that the element is possibly going to have multiple tags, and you can't have multiple attributes with the same name on an element.  So it works on the tagging links because they only have the one tag.  But to do that for the parent element, we would need to make the attribute names for each tag unique ... which is basically the same as making them classes.

    At this point, I'm just trying to decide what's a reasonable way to turn the tag's string into a class.  And it's silly, but the idea of upper case letters in a class name bothers me.  BUT that means that tags of "Baron" and "baron", which would be different tags, would still be translated to the same class ... "baron", for example.  So I'm kind of waffling, but that's probably the route I'll go.

    Obsidian Portal Developer

  • jodie
    jodie
    Posts: 82

    Oh yeah that makes sense (sorry for backseat driving incorrectly and without any context whatsoever it's a terrible habit). I think if people are using case to distinguish tags and they want to use the classes for something they can just tweak their tagging.

  • thaen
    thaen
    Posts: 1,064

    I totally appreciate the backseat driving, so feel free to keep making suggestions.

    Yeah, I think that's the way to go with the "case issue".

    Thanks for the helpful thoughts on this!

    Obsidian Portal Developer

  • thaen
    thaen
    Posts: 1,064

    This feature is live now.  Test it out, let me know what you think, or if you notice anything odd.

    A few details ...

    The "tags" show up as "tag-[tag name]" classes on the "cards" (li element) of the Characters index page, the Items index page, and the Adventure Logs index page.

    Also, the body element of the view of each individual Character, Item, Adventure Log, and Wiki Page has the classes as well.  So you can now add a body level class to any of those types of pages just by adding a tag.

     

    Obsidian Portal Developer

  • jodie
    jodie
    Posts: 82

    oh wow that's so cool! Eeee heart

  • thaen
    thaen
    Posts: 1,064

    Let us know if you do anything with it!

    Obsidian Portal Developer

Sign In or Register to comment.

March 2024
Wrath of the Highborn

Read the feature post on the blog
Return to Obsidian Portal

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions