Skip to content

Commit

Permalink
Light devices now ordered by label
Browse files Browse the repository at this point in the history
  • Loading branch information
thelevicole committed Mar 25, 2018
1 parent 0d89c4b commit 233d94f
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 44 deletions.
5 changes: 5 additions & 0 deletions assets/javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
mounted: function() {
this.authenticate();
},
computed: {
ordered_lights: function () {
return _.orderBy(this.lights, 'label');
}
},
methods: {
authenticate: function() {

Expand Down
78 changes: 40 additions & 38 deletions electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,44 +34,46 @@ const create_window = () => {
app_window = null;
});

Menu.setApplicationMenu( Menu.buildFromTemplate([
{
label: 'Edit',
submenu: [
{role: 'undo'},
{role: 'redo'},
{type: 'separator'},
{role: 'cut'},
{role: 'copy'},
{role: 'paste'},
{role: 'delete'},
{role: 'selectall'}
]
},
{
label: 'View',
submenu: [
{role: 'reload'},
{role: 'togglefullscreen'}
]
},
{
role: 'window',
submenu: [
{role: 'minimize'},
{role: 'close'}
]
},
{
role: 'help',
submenu: [
{
label: 'Learn More',
click: () => { require('electron').shell.openExternal('/~https://github.com/thelevicole/lifx-desktop-app'); }
}
]
}
]) );
if (false) {
Menu.setApplicationMenu( Menu.buildFromTemplate([
{
label: 'Edit',
submenu: [
{role: 'undo'},
{role: 'redo'},
{type: 'separator'},
{role: 'cut'},
{role: 'copy'},
{role: 'paste'},
{role: 'delete'},
{role: 'selectall'}
]
},
{
label: 'View',
submenu: [
{role: 'reload'},
{role: 'togglefullscreen'}
]
},
{
role: 'window',
submenu: [
{role: 'minimize'},
{role: 'close'}
]
},
{
role: 'help',
submenu: [
{
label: 'Learn More',
click: () => { require('electron').shell.openExternal('/~https://github.com/thelevicole/lifx-desktop-app'); }
}
]
}
]) );
}
};

app.on('ready', create_window);
Expand Down
3 changes: 3 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ function minify_js(scripts, destination, file, run_babel) {
gutil.log( gutil.colors.red('[Error]'), err.toString() );
})
.pipe( gulp.dest(destination) );

return src;
}

// Compile sass
Expand All @@ -61,6 +63,7 @@ gulp.task('stylesheets', function() {
// Minify JS
gulp.task('javascripts', function() {
return Promise.all([
minify_js('./node_modules/lodash/lodash.js', public+'js', 'lodash.js'),
minify_js('./node_modules/jquery/dist/jquery.js', public+'js', 'jquery.js'),
minify_js('./node_modules/vue/dist/vue.min.js', public+'js', 'vue.js'),
minify_js(source+'javascripts/vendor/Lifx.js', public+'js', 'lifx.js', true),
Expand Down
9 changes: 5 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h3>An access token is required</h3>
<div v-if="!light">
<div id="bulbs" class="text-center" v-if="lights.length">
<h1>Lights</h1>
<light-switch v-for="light in lights" :key="light.id" :data="light"/>
<light-switch v-for="light in ordered_lights" :key="light.id" :data="light"/>
</div>
<h1 v-if="!lights.length" class="text-center text-white">Loading...</h1>
</div>
Expand Down Expand Up @@ -78,10 +78,11 @@ <h1 v-if="!lights.length" class="text-center text-white">Loading...</h1>
</script>

<script>
window.jQuery = window.$ = require('./js/jquery.js');
window.Vue = require('./js/vue.js');
window.jQuery = window.$ = require('./js/jquery.js');
window._ = require('./js/lodash.js');
window.Vue = require('./js/vue.js');
window.Lifx = require('./js/lifx.js');
require('./renderer.js');
window.Lifx = require('./js/lifx.js');
require('./js/color-picker.js');
require('./js/app.js');
</script>
Expand Down
2 changes: 1 addition & 1 deletion js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/lodash.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"gulp-svgmin": "^1.2.4",
"gulp-uglify-es": "^1.0.1",
"gulp-util": "^3.0.8",
"jquery": "^3.3.1"
"jquery": "^3.3.1",
"lodash": "^4.17.5"
},
"dependencies": {}
}

0 comments on commit 233d94f

Please sign in to comment.