some cleanup
This commit is contained in:
@@ -5,18 +5,18 @@ COMPONENT(Request& context)
|
||||
starter_register_js("components/gauges/common.js", context);
|
||||
starter_register_css("themes/common/css/gauges.css", context);
|
||||
|
||||
String gauge_id = first(context.call["id"].to_string(), "progressbar-" + std::to_string((u64)time()));
|
||||
String style = context.call["style"].to_string();
|
||||
String item_style = context.call["item-style"].to_string();
|
||||
String label_style = context.call["label-style"].to_string();
|
||||
String value_style = context.call["value-style"].to_string();
|
||||
String bar_style = context.call["bar-style"].to_string();
|
||||
String title = context.call["title"].to_string();
|
||||
String subtitle = context.call["subtitle"].to_string();
|
||||
String layout = first(context.call["layout"].to_string(), "horizontal");
|
||||
String bar_color_default = context.call["bar-color"].to_string();
|
||||
DTree scale = context.call["scale"];
|
||||
DTree markers = context.call["markers"];
|
||||
String gauge_id = first(context.props["id"].to_string(), "progressbar-" + std::to_string((u64)time()));
|
||||
String style = context.props["style"].to_string();
|
||||
String item_style = context.props["item-style"].to_string();
|
||||
String label_style = context.props["label-style"].to_string();
|
||||
String value_style = context.props["value-style"].to_string();
|
||||
String bar_style = context.props["bar-style"].to_string();
|
||||
String title = context.props["title"].to_string();
|
||||
String subtitle = context.props["subtitle"].to_string();
|
||||
String layout = first(context.props["layout"].to_string(), "horizontal");
|
||||
String bar_color_default = context.props["bar-color"].to_string();
|
||||
DTree scale = context.props["scale"];
|
||||
DTree markers = context.props["markers"];
|
||||
|
||||
StringList default_palette;
|
||||
default_palette.push_back("var(--success, #10b981)");
|
||||
@@ -35,7 +35,7 @@ COMPONENT(Request& context)
|
||||
<? } ?>
|
||||
<? if(layout == "horizontal") { ?>
|
||||
<div class="progressbar-grid progressbar-grid-horizontal">
|
||||
<? context.call["items"].each([&](DTree bar, String bar_id) {
|
||||
<? context.props["items"].each([&](DTree bar, String bar_id) {
|
||||
DTree merged = scale;
|
||||
bar.each([&](DTree item, String key) { merged[key] = item; });
|
||||
String item_id = gauge_attr_id(bar_id);
|
||||
@@ -86,8 +86,8 @@ COMPONENT(Request& context)
|
||||
}); ?>
|
||||
</div>
|
||||
<? } else { ?>
|
||||
<div class="progressbar-grid progressbar-grid-vertical" style="--progressbar-height: <?= first(context.call["height"].to_string(), "240") ?>px;">
|
||||
<? context.call["items"].each([&](DTree bar, String bar_id) {
|
||||
<div class="progressbar-grid progressbar-grid-vertical" style="--progressbar-height: <?= first(context.props["height"].to_string(), "240") ?>px;">
|
||||
<? context.props["items"].each([&](DTree bar, String bar_id) {
|
||||
DTree merged = scale;
|
||||
bar.each([&](DTree item, String key) { merged[key] = item; });
|
||||
String item_id = gauge_attr_id(bar_id);
|
||||
@@ -137,7 +137,7 @@ COMPONENT(Request& context)
|
||||
</div>
|
||||
<? } ?>
|
||||
</section>
|
||||
<? if(context.call["listen"].to_string() != "") { ?>
|
||||
<? if(context.props["listen"].to_string() != "") { ?>
|
||||
<script>
|
||||
window.ProgressbarComponents = window.ProgressbarComponents || {
|
||||
start_listen : function(prop) {
|
||||
@@ -161,7 +161,7 @@ COMPONENT(Request& context)
|
||||
});
|
||||
}
|
||||
};
|
||||
ProgressbarComponents.start_listen(<?: json_encode(context.call, '\'') ?>);
|
||||
ProgressbarComponents.start_listen(<?: json_encode(context.props, '\'') ?>);
|
||||
</script>
|
||||
<? } ?>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user