});
}
});
+
+ $('.colour-preview-box').each(function (index, value) {
+ console.log($(this));
+ $(this).css("background-color", $(this).data("colour"));
+ });
}
page.unload = function() {
elsif url = telephone_link(key, value)
link_to h(value), url, :title => t("browse.tag_details.telephone_link", :phone_number => value)
elsif colour_value = colour_preview(key, value)
- content_tag(:span, "", :class => "colour-preview-box", :style => "background-color:#{colour_value}", :title => t("browse.tag_details.colour_preview", :colour_value => colour_value)) + colour_value
+ content_tag(:span, "", :class => "colour-preview-box", :"data-colour" => colour_value, :title => t("browse.tag_details.colour_preview", :colour_value => colour_value)) + colour_value
else
linkify h(value)
end
assert_dom_equal "<a title=\"The Q123 item on Wikidata\" href=\"//www.wikidata.org/wiki/Q123?uselang=en\">Q123</a>", html
html = format_value("colour", "#f00")
- assert_dom_equal %(<span class="colour-preview-box" style="background-color:#f00" title="Colour #f00 preview"></span>#f00), html
+ assert_dom_equal %(<span class="colour-preview-box" data-colour="#f00" title="Colour #f00 preview"></span>#f00), html
end
def test_icon_tags