Skip to content

Commit

Permalink
Merge pull request #651 from nightscout/wip/rawbg-settings
Browse files Browse the repository at this point in the history
add a some special handling for rawbg in the web settings
  • Loading branch information
jasoncalabrese committed Jun 24, 2015
2 parents d3239ba + 2cb7009 commit ac0d657
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
5 changes: 3 additions & 2 deletions lib/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ function init() {
_.forEach(enabledPlugins, f);
};

plugins.alwaysShown = 'delta upbat';
//these plugins are either always on or have custom settings
plugins.specialPlugins = 'delta upbat rawbg';

plugins.shownPlugins = function(sbx) {
return _.filter(enabledPlugins, function filterPlugins(plugin) {
return plugins.alwaysShown.indexOf(plugin.name) > -1 || (sbx && sbx.showPlugins && sbx.showPlugins.indexOf(plugin.name) > -1);
return plugins.specialPlugins.indexOf(plugin.name) > -1 || (sbx && sbx.showPlugins && sbx.showPlugins.indexOf(plugin.name) > -1);
});
};

Expand Down
7 changes: 6 additions & 1 deletion lib/plugins/pluginbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ function init (majorPills, minorPills, statusPills, bgStatus, tooltip) {

var pill = findOrCreatePill(plugin);

pill.toggle(!options.hide);
if (options.hide) {
pill.addClass('hidden');
} else {
pill.removeClass('hidden');
}

pill.addClass(options.pillClass);

pill.find('label').attr('class', options.labelClass).text(options.label);
Expand Down
16 changes: 10 additions & 6 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,24 @@ body {
width: 360px;
}

.loading .bgButton .pill.rawbg {
.loading .pill.rawbg {
display: none;
}

.bgButton .pill.rawbg {
.pill.rawbg {
display: inline-block;
border-radius: 2px;
border: 1px solid #808080;
}

.bgButton .pill.rawbg em {
.pill.rawbg em {
color: white;
background-color: black;
display: block;
font-size: 20px;
}

.bgButton .pill.rawbg label {
.pill.rawbg label {
display: block;
font-size: 14px;
}
Expand Down Expand Up @@ -338,6 +338,10 @@ div.tooltip {
background: #808080;
}

.pill.hidden {
display: none;
}

@media (max-width: 800px) {
.bgStatus {
width: 300px;
Expand Down Expand Up @@ -421,11 +425,11 @@ div.tooltip {
padding: 0;
}

.bgButton .pill.rawbg em {
.pill.rawbg em {
font-size: 14px;
}

.bgButton .pill.rawbg label {
.pill.rawbg label {
font-size: 12px;
}

Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1 class="customTitle">Nightscout</h1>
<div class="primary">
<div class="bgStatus current">
<div class="bgButton ">
<span class="pill rawbg"><em></em><label></label></span>
<span class="pill rawbg hidden"><em></em><label></label></span>
<span class="currentBG">---</span>
<span class="currentDirection">-</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion static/js/ui-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function getBrowserSettings(storage) {
json.showPlugins = setDefault(json.showPlugins, app.defaults.showPlugins || Nightscout.plugins.enabledPluginNames());
var showPluginsSettings = $('#show-plugins');
Nightscout.plugins.eachEnabledPlugin(function each(plugin) {
if (Nightscout.plugins.alwaysShown.indexOf(plugin.name) > -1) {
if (Nightscout.plugins.specialPlugins.indexOf(plugin.name) > -1) {
//ignore these, they are always on for now
} else {
var id = 'plugin-' + plugin.name;
Expand Down

0 comments on commit ac0d657

Please sign in to comment.