mirror of
https://github.com/fergalmoran/dss.git
synced 2026-03-26 23:45:15 +00:00
Fixed marionette require load timeout
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
requirejs.config({
|
||||
baseUrl: "static/js",
|
||||
baseUrl: 'static/js',
|
||||
urlArgs: com.podnoms.settings.urlArgs,
|
||||
waitSeconds: 200,
|
||||
paths: {
|
||||
@@ -14,6 +14,7 @@ requirejs.config({
|
||||
text: 'libs/text',
|
||||
templates: '/templates',
|
||||
app: 'app/appv2',
|
||||
utils: 'app/lib/utils',
|
||||
vent: 'app/lib/eventAggregator',
|
||||
views: 'app/views',
|
||||
models: 'app/models',
|
||||
@@ -24,25 +25,28 @@ requirejs.config({
|
||||
shim: {
|
||||
backbone: {
|
||||
exports: 'Backbone',
|
||||
deps: ['underscore']
|
||||
deps: ['jquery', 'underscore']
|
||||
},
|
||||
bootstrap: {
|
||||
exports: 'bootstrap',
|
||||
deps: ['jquery']
|
||||
},
|
||||
marionette: {
|
||||
exports: 'Marionette',
|
||||
deps: ['backbone']
|
||||
deps: ['jquery', 'backbone']
|
||||
},
|
||||
underscore: {
|
||||
exports: '_'
|
||||
},
|
||||
'toastr': {
|
||||
deps: ['jquery'],
|
||||
exports: 'toastr'
|
||||
utils: {
|
||||
deps: ['jquery', 'bootstrap']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
requirejs(['toastr', 'underscore', 'backbone', 'app'], function (toastr, _, Backbone, App) {
|
||||
"use strict"
|
||||
'use strict'
|
||||
|
||||
console.log("Dss.Bootstrapper: primed");
|
||||
console.log('Dss.Bootstrapper: primed');
|
||||
App.start();
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define['jquery', 'bootstrap']
|
||||
define ['jquery', 'bootstrap']
|
||||
($, bootstrap) ->
|
||||
class Utils
|
||||
|
||||
@@ -13,6 +13,7 @@ define['jquery', 'bootstrap']
|
||||
).success ->
|
||||
$("input:text:visible:first").focus()
|
||||
true
|
||||
|
||||
checkPlayCount: ->
|
||||
if document.cookie.indexOf("sessionId")
|
||||
$.getJSON "/ajax/session_play_count", (data) ->
|
||||
|
||||
67
static/js/app/views/header.coffee
Normal file
67
static/js/app/views/header.coffee
Normal file
@@ -0,0 +1,67 @@
|
||||
###
|
||||
@license
|
||||
|
||||
----------------------------------------------
|
||||
|
||||
Copyright (c) 2012, Fergal Moran. All rights reserved.
|
||||
Code provided under the BSD License:
|
||||
###
|
||||
define ["underscore", "backbone", "vent", "utils", "text!/tpl/HeaderView"], (_, Backbone, vent, utils, Template) ->
|
||||
class HeaderView extends Backbone.View
|
||||
template: _.template(Template)
|
||||
events:
|
||||
"click #header-play-pause-button": "togglePlayState"
|
||||
"click #header-login-button": "login"
|
||||
"click #header-live-button": "playLive"
|
||||
|
||||
initialize: ->
|
||||
@render()
|
||||
@listenTo vent, "mix:play", @trackPlaying
|
||||
@listenTo vent, "mix:pause", @trackPaused
|
||||
|
||||
login: ->
|
||||
utils.modal "tpl/LoginView"
|
||||
|
||||
logout: ->
|
||||
utils.showAlert "Success", "You are now logged out"
|
||||
|
||||
trackChanged: (data) ->
|
||||
$(@el).find("#track-description").text data.title
|
||||
$(@el).find("#track-description").attr "href", "#" + data.item_url
|
||||
|
||||
trackPlaying: (data) ->
|
||||
$(@el).find("#header-play-button-icon").removeClass "icon-play"
|
||||
$(@el).find("#header-play-button-icon").addClass "icon-pause"
|
||||
|
||||
trackPaused: (data) ->
|
||||
$(@el).find("#header-play-button-icon").removeClass "icon-pause"
|
||||
$(@el).find("#header-play-button-icon").addClass "icon-play"
|
||||
|
||||
render: ->
|
||||
$(@el).html @template()
|
||||
this
|
||||
|
||||
playLive: ->
|
||||
ref = this
|
||||
dssSoundHandler.playLive()
|
||||
_eventAggregator.trigger "track_playing"
|
||||
button = $(@el).find("#header-play-pause-button")
|
||||
button.data "mode", "pause"
|
||||
$.getJSON "ajax/live_now_playing/", (data) ->
|
||||
alert data.title
|
||||
$(ref.el).find("#live-now-playing").text data.title
|
||||
|
||||
|
||||
togglePlayState: ->
|
||||
button = $(@el).find("#header-play-pause-button")
|
||||
mode = button.data("mode")
|
||||
if mode is "play"
|
||||
dssSoundHandler.resumeSound()
|
||||
_eventAggregator.trigger "track_playing"
|
||||
button.data "mode", "pause"
|
||||
else
|
||||
dssSoundHandler.pauseSound()
|
||||
_eventAggregator.trigger "track_paused"
|
||||
button.data "mode", "play"
|
||||
|
||||
HeaderView
|
||||
@@ -1,73 +0,0 @@
|
||||
/** @license
|
||||
|
||||
----------------------------------------------
|
||||
|
||||
Copyright (c) 2012, Fergal Moran. All rights reserved.
|
||||
Code provided under the BSD License:
|
||||
|
||||
*/
|
||||
define(['underscore', 'backbone', 'vent', 'text!/tpl/HeaderView'],
|
||||
function (_, Backbone, vent, Template) {
|
||||
return Backbone.View.extend({
|
||||
template: _.template(Template),
|
||||
events: {
|
||||
"click #header-play-pause-button": "togglePlayState",
|
||||
"click #header-login-button": "login",
|
||||
"click #header-live-button": "playLive"
|
||||
},
|
||||
initialize: function () {
|
||||
this.render();
|
||||
this.listenTo(vent, 'mix:play', this.trackPlaying);
|
||||
this.listenTo(vent, 'mix:pause', this.trackPaused);
|
||||
},
|
||||
login: function () {
|
||||
com.podnoms.utils.modal('tpl/LoginView');
|
||||
},
|
||||
logout: function () {
|
||||
com.podnoms.utils.showAlert("Success", "You are now logged out");
|
||||
},
|
||||
trackChanged: function (data) {
|
||||
$(this.el).find('#track-description').text(data.title);
|
||||
$(this.el).find('#track-description').attr("href", "#" + data.item_url);
|
||||
},
|
||||
trackPlaying: function (data) {
|
||||
$(this.el).find('#header-play-button-icon').removeClass('icon-play');
|
||||
$(this.el).find('#header-play-button-icon').addClass('icon-pause');
|
||||
|
||||
},
|
||||
trackPaused: function (data) {
|
||||
$(this.el).find('#header-play-button-icon').removeClass('icon-pause');
|
||||
$(this.el).find('#header-play-button-icon').addClass('icon-play');
|
||||
},
|
||||
render: function () {
|
||||
$(this.el).html(this.template());
|
||||
return this;
|
||||
},
|
||||
playLive: function () {
|
||||
var ref = this;
|
||||
dssSoundHandler.playLive();
|
||||
_eventAggregator.trigger("track_playing")
|
||||
var button = $(this.el).find('#header-play-pause-button');
|
||||
button.data("mode", "pause");
|
||||
$.getJSON(
|
||||
'ajax/live_now_playing/',
|
||||
function (data) {
|
||||
alert(data.title);
|
||||
$(ref.el).find('#live-now-playing').text(data.title);
|
||||
});
|
||||
},
|
||||
togglePlayState: function () {
|
||||
var button = $(this.el).find('#header-play-pause-button');
|
||||
var mode = button.data("mode");
|
||||
if (mode == "play") {
|
||||
dssSoundHandler.resumeSound();
|
||||
_eventAggregator.trigger("track_playing");
|
||||
button.data("mode", "pause");
|
||||
} else {
|
||||
dssSoundHandler.pauseSound();
|
||||
_eventAggregator.trigger("track_paused");
|
||||
button.data("mode", "play");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user