[personal profile] jana posting in [community profile] style_system
I'd like to move the filter meta data to the .datetime span - if that's possible, that is. So, instead of '4 December 2010 at 13:00' it should display something like '4 December 2010 at 13:00 in *some filter(s)*'.

What do I have to change in/add to my theme layer? Solution can be found here :)

Date: 2011-01-21 07:35 pm (UTC)
ninetydegrees: Art: self-portrait (Default)
From: [personal profile] ninetydegrees
This is what I have so far: http://www.dreamwidth.org/customize/advanced/layersource?id=180318

Note that class myClass must be at the very top of your layer.

I haven't tested this very thoroughly but one issue I noticed is that it prints the metadata container after entry text when you've got a filter but not other metadata. I don't know how to fix this.

Date: 2011-01-21 07:49 pm (UTC)
ninetydegrees: Art: self-portrait (Default)
From: [personal profile] ninetydegrees
Sorry if wasn't quite what you wanted. I must have misunderstood.

You're welcome. Also, I've updated the layer to fix the issue I mentioned in my previous comment.

Date: 2011-01-23 10:42 am (UTC)
ninetydegrees: Art: self-portrait (Default)
From: [personal profile] ninetydegrees
Oh crap I've just stupidly deleted everything. Looking at the code you posted here you're working with my very first draft where the filters were after the subject, not the date. Can you link to your layer? Or a layer with the code I wrote?

Edit: or PM me with the link if you don't want it out there...
Edited Date: 2011-01-23 10:43 am (UTC)

Date: 2011-01-23 10:54 am (UTC)
ninetydegrees: Art: self-portrait (Default)
From: [personal profile] ninetydegrees
Perfect, thanks.

Here's mine: http://www.dreamwidth.org/customize/advanced/layersource?id=180499

I'm gonna try and see if the code fits in a comment so that it doesn't get lost again.

Code

Date: 2011-01-23 11:02 am (UTC)
ninetydegrees: Art: self-portrait (Default)
From: [personal profile] ninetydegrees
Feel free to improve it. :)


class myClass {
    function lay_print_metadata_groups(Entry e);
}

function Entry::print_metadata() {

    var bool has_meta = ($.metadata{"music"} != "") or ($.metadata{"mood"} != "") or ($.metadata{"location"} != "") or ($.metadata{"xpost"} != "") ? true : false;

    if ($has_meta) {
        var string position = ($*entry_metadata_position == "top") ? " top-metadata" : " bottom-metadata";
        var string[] key = ["music", "mood", "location", "xpost"];

        """<div class="metadata$position">\n<ul>\n""";
        foreach var string m ($key) {
            if ($.metadata{$m} != "") {
                var string metadata_name = lang_metadata_title($m);
                """<li><span class="metadata-label metadata-label-$m">$metadata_name: </span>""";
                if ($m == "mood") {
                    " $.mood_icon ";
                }
                """<span class="metadata-item metadata-item-$m">$.metadata{$m}</span></li>\n""";
            }
        }
        "</ul>\n</div>\n";
    }
}

function myClass::lay_print_metadata_groups(Entry e) {
    if ($e.metadata{"groups"} != "") {
        """<span class="metadata-groups">$e.metadata{"groups"}</span>\n""";
    }
}

function Page::print_entry(Entry e) {

var myClass mc = new myClass;

    ## For most styles, this will be overridden by FriendsPage::print_entry and such.
    $e->print_wrapper_start();
    """<div class="header">\n""";
    $e->print_subject();
    $e->print_metatypes();
    $e->print_time();
    $mc->lay_print_metadata_groups($e);
    """</div>\n""";
    """<div>\n""";
    """<div class="contents">\n""";
    """<div class="inner">\n""";
    $e->print_userpic();
    $e->print_poster();
    if ($*entry_metadata_position == "top") { $e->print_metadata(); }
    $e->print_text();
    if ($*entry_metadata_position == "bottom") { $e->print_metadata(); }
    """</div>\n""";
    """</div>\n""";
    """</div>\n""";
    """<div class="footer">\n""";
    """<div class="inner">\n""";
    $e->print_tags();
    $this->print_entry_footer($e);
    "</div>\n</div>\n";
    $e->print_wrapper_end();
}

set custom_css ="""
.metadata-groups {
    display: inline-block;
    padding-left: .2em;
    }

.metadata-groups:before {
    content: " in ";
    }
""";

Profile

Dreamwidth style system discussion

July 2025

S M T W T F S
  123 45
6789101112
13141516171819
20212223242526
2728293031  

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 18th, 2025 05:08 pm
Powered by Dreamwidth Studios