mirror of https://github.com/snachodog/mybuddy.git
Refactor JS to use BabyBlotter as primary JS namespace.
This commit is contained in:
parent
78eb20ab91
commit
f81f763cfb
|
@ -0,0 +1,12 @@
|
||||||
|
/* Baby Blotter
|
||||||
|
*
|
||||||
|
* Default namespace for the Baby Blotter app.
|
||||||
|
*/
|
||||||
|
if (typeof jQuery === 'undefined') {
|
||||||
|
throw new Error('Baby Blotter requires jQuery.')
|
||||||
|
}
|
||||||
|
|
||||||
|
var BabyBlotter = function () {
|
||||||
|
var BabyBlotter = {};
|
||||||
|
return BabyBlotter;
|
||||||
|
}();
|
|
@ -1,9 +1,4 @@
|
||||||
if (typeof jQuery === 'undefined') {
|
/* Baby Blotter Timer
|
||||||
throw new Error('BabyBlotter Timer requires jQuery.')
|
|
||||||
}
|
|
||||||
|
|
||||||
var BBTimer = function ($) {
|
|
||||||
/* Baby Blotter Timer
|
|
||||||
*
|
*
|
||||||
* Uses a supplied ID to run a timer. The element using the ID must have
|
* Uses a supplied ID to run a timer. The element using the ID must have
|
||||||
* three children with the following classes:
|
* three children with the following classes:
|
||||||
|
@ -11,15 +6,16 @@ var BBTimer = function ($) {
|
||||||
* * timer-minutes
|
* * timer-minutes
|
||||||
* * timer-hours
|
* * timer-hours
|
||||||
*/
|
*/
|
||||||
|
BabyBlotter.Timer = function ($) {
|
||||||
var runIntervalId = null;
|
var runIntervalId = null;
|
||||||
var timerElement = null;
|
var timerElement = null;
|
||||||
|
|
||||||
var BBTimer = {
|
var Timer = {
|
||||||
run: function(id) {
|
run: function(id) {
|
||||||
timerElement = $('#' + id);
|
timerElement = $('#' + id);
|
||||||
|
|
||||||
if (timerElement.length == 0) {
|
if (timerElement.length == 0) {
|
||||||
console.error('BBTimer: Timer element not found.')
|
console.error('BBTimer: Timer element not found.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,5 +57,5 @@ var BBTimer = function ($) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return BBTimer;
|
return Timer;
|
||||||
}(jQuery);
|
}(jQuery);
|
||||||
|
|
|
@ -41,6 +41,6 @@
|
||||||
|
|
||||||
{% block javascript %}
|
{% block javascript %}
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
BBTimer.run('timer-status');
|
BabyBlotter.Timer.run('timer-status');
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -5,7 +5,10 @@ var concat = require('gulp-concat');
|
||||||
|
|
||||||
gulp.task('app:scripts', function() {
|
gulp.task('app:scripts', function() {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'core/static/js/timer.js'
|
'babyblotter/static_site/js/babyblotter.js',
|
||||||
|
'api/static/js/*.js',
|
||||||
|
'core/static/js/*.js',
|
||||||
|
'dashboard/static/js/*.js'
|
||||||
])
|
])
|
||||||
.pipe(concat('app.js'))
|
.pipe(concat('app.js'))
|
||||||
.pipe(gulp.dest('babyblotter/static/babyblotter/js/'));
|
.pipe(gulp.dest('babyblotter/static/babyblotter/js/'));
|
||||||
|
|
Loading…
Reference in New Issue