proper sticky footer

This commit is contained in:
lone-cloud 2016-11-20 14:13:01 -08:00
parent df88aa7c8b
commit 36465a858c
13 changed files with 80 additions and 40 deletions

View file

@ -0,0 +1,40 @@
import Ember from 'ember';
const {
Controller,
isEmpty
} = Ember;
export default Controller.extend({
dimmerOn: false,
init(){
this._super(...arguments);
let storage = new window.Locally.Store({compress: true}),
dimmerOn = storage.get('huegasm.dimmerOn');
this.set('storage', storage);
if (!isEmpty(dimmerOn) && dimmerOn) {
this.send('toggleDimmer');
}
},
actions: {
toggleDimmer(){
this.toggleProperty('dimmerOn');
let dimmerOn = this.get('dimmerOn');
if (dimmerOn) {
$('body').addClass('dimmerOn');
$('html').addClass('dimmerOn');
} else {
$('body').removeClass('dimmerOn');
$('html').removeClass('dimmerOn');
}
this.get('storage').set('huegasm.dimmerOn', dimmerOn);
}
}
});

View file

@ -1 +1,3 @@
{{huegasm-app}}
{{huegasm-app action="toggleDimmer" dimmerOn=dimmerOn storage=storage}}
{{huegasm-footer action="toggleDimmer" dimmerOn=dimmerOn storage=storage}}

View file

@ -115,7 +115,7 @@ export default Component.extend({
location.reload();
},
toggleDimmer() {
this.sendAction("toggleDimmer");
this.sendAction();
},
clearAllSettings() {
this.get('storage').clear();

View file

@ -32,8 +32,8 @@
{{light-group lightsData=lightsData activeLights=activeLights syncLight=syncLight apiURL=apiURL dimmerOn=dimmerOn storage=storage}}
<div class="row">
{{lights-tab apiURL=apiURL lightsData=lightsData activeLights=activeLights syncLight=syncLight trial=trial active=lightsTabSelected colorLoopOn=colorLoopOn dimmerOn=dimmerOn strobeOn=pauseLightUpdates toggleDimmer="toggleDimmer"}}
{{lights-tab apiURL=apiURL lightsData=lightsData activeLights=activeLights syncLight=syncLight trial=trial active=lightsTabSelected colorLoopOn=colorLoopOn dimmerOn=dimmerOn strobeOn=pauseLightUpdates}}
{{music-tab apiURL=apiURL lightsData=lightsData activeLights=activeLights active=musicTabSelected pauseLightUpdates=pauseLightUpdates dimmerOn=dimmerOn storage=storage colorLoopOn=colorLoopOn toggleDimmer="toggleDimmer" action="startIntro"}}
{{music-tab apiURL=apiURL lightsData=lightsData activeLights=activeLights active=musicTabSelected pauseLightUpdates=pauseLightUpdates dimmerOn=dimmerOn storage=storage colorLoopOn=colorLoopOn action="startIntro"}}
</div>
{{/if}}

View file

@ -2,28 +2,18 @@ import Ember from 'ember';
const {
Component,
isEmpty,
isNone,
$
isEmpty
} = Ember;
export default Component.extend({
bridgeIp: null,
bridgeUsername: null,
trial: false,
dimmerOn: false,
ready: false,
elementId: 'huegasm',
init(){
this._super(...arguments);
let storage = new window.Locally.Store({compress: true}),
dimmerOn = storage.get('huegasm.dimmerOn');
this.set('storage', storage);
if (!isNone(dimmerOn) && dimmerOn) {
this.send('toggleDimmer');
}
let storage = this.get('storage');
if (!isEmpty(storage.get('huegasm.bridgeIp')) && !isEmpty(storage.get('huegasm.bridgeUsername'))) {
this.setProperties({
@ -35,19 +25,7 @@ export default Component.extend({
actions: {
toggleDimmer(){
this.toggleProperty('dimmerOn');
let dimmerOn = this.get('dimmerOn');
if (dimmerOn) {
$('body').addClass('dimmerOn');
$('html').addClass('dimmerOn');
} else {
$('body').removeClass('dimmerOn');
$('html').removeClass('dimmerOn');
}
this.get('storage').set('huegasm.dimmerOn', dimmerOn);
this.sendAction();
},
isReady(){

View file

@ -1,5 +1,5 @@
{{#if bridgeUsername}}
{{hue-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial dimmerOn=dimmerOn storage=storage toggleDimmer="toggleDimmer"}}
{{hue-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial dimmerOn=dimmerOn storage=storage action="toggleDimmer"}}
{{else}}
{{#if ready}}
{{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial storage=storage}}

View file

@ -15,7 +15,7 @@ export default Component.extend({
actions: {
toggleDimmer(){
this.sendAction('toggleDimmer');
this.sendAction();
}
}
});

View file

@ -41,5 +41,3 @@
{{paper-switch value=colorLoopOn onChange=(action (mut colorLoopOn)) disabled=trial skipProxy=trial label=colorloopOnTxt}}
{{/paper-item}}
{{/paper-list}}
{{huegasm-footer toggleDimmer="toggleDimmer"}}

View file

@ -218,5 +218,3 @@
{{ember-notify messageStyle='bootstrap' closeAfter=5000}}
{{music-tab/add-soundcloud-sound-modal action="handleNewSoundCloudURL" isShowingModal=isShowingAddSoundCloudModal}}
{{huegasm-footer toggleDimmer="toggleDimmer"}}

View file

@ -16,10 +16,20 @@
@import 'music-tab';
@import 'noui-slider';
body > .ember-view {
display: flex;
min-height: 100vh;
flex-direction: column;
}
body, button {
font-family: 'Slabo 27px', serif;
}
#huegasm {
flex: 1;
}
.ember-app {
padding-bottom: 50px;
}
@ -34,6 +44,7 @@ body, button {
display: inline-block;
position: relative;
bottom: 10px;
font-size: 18px;
a {
margin-left: 5px;
}

View file

@ -23,6 +23,7 @@
#hue-controls {
max-width: 1200px;
position: relative;
flex: 1;
}
// preload images

View file

@ -9,7 +9,7 @@
},
"scripts": {
"start": "ember server",
"build": "ember build",
"build": "ember build --env=production",
"test": "ember test"
},
"engines": {

View file

@ -0,0 +1,12 @@
import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:application', 'Unit | Controller | application', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.subject();
assert.ok(controller);
});