[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 :)

Code

Date: 2011-01-23 11:02 am (UTC)
ninetydegrees: Art & Text: heart with aroace colors, "you are loved" (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

April 2025

S M T W T F S
  12345
6 78910 1112
13 141516171819
2021 2223242526
27282930   

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 14th, 2025 04:10 pm
Powered by Dreamwidth Studios