mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-25 19:17:35 +00:00
Started new socket.io interface
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
define ['backbone', 'marionette', 'vent', 'app.lib/router', 'app.lib/panningRegion', 'app.lib/audioController', 'views/header',
|
define ['backbone', 'marionette', 'vent',
|
||||||
|
'app.lib/router', 'app.lib/panningRegion', 'app.lib/realtimeController', 'app.lib/audioController', 'views/header',
|
||||||
'views/sidebar/sidebarView',
|
'views/sidebar/sidebarView',
|
||||||
'models/mix/mixCollection'],
|
'models/mix/mixCollection'],
|
||||||
(Backbone, Marionette, vent, DssRouter, PanningRegion, AudioController, HeaderView, SidebarView, MixCollection) ->
|
(Backbone, Marionette, vent, DssRouter, PanningRegion, RealtimeController, AudioController, HeaderView, SidebarView, MixCollection) ->
|
||||||
Marionette.Region.prototype.open = (view) ->
|
Marionette.Region.prototype.open = (view) ->
|
||||||
@.$el.hide();
|
@.$el.hide();
|
||||||
@.$el.html(view.el);
|
@.$el.html(view.el);
|
||||||
@@ -9,7 +10,9 @@ define ['backbone', 'marionette', 'vent', 'app.lib/router', 'app.lib/panningRegi
|
|||||||
true
|
true
|
||||||
|
|
||||||
App = new Marionette.Application();
|
App = new Marionette.Application();
|
||||||
App.audioController = new AudioController()
|
App.audioController = new AudioController();
|
||||||
|
App.realtimeController = new RealtimeController();
|
||||||
|
App.realtimeController.startSocketIO();
|
||||||
|
|
||||||
App.vent.on "routing:started", ->
|
App.vent.on "routing:started", ->
|
||||||
console.log "App(vent): routing:started"
|
console.log "App(vent): routing:started"
|
||||||
@@ -36,9 +39,7 @@ define ['backbone', 'marionette', 'vent', 'app.lib/router', 'app.lib/panningRegi
|
|||||||
App.vent.trigger("routing:started");
|
App.vent.trigger("routing:started");
|
||||||
|
|
||||||
App.addInitializer ->
|
App.addInitializer ->
|
||||||
console.log("App: gobbling links");
|
|
||||||
$(document).on("click", "a[href]:not([data-bypass])", (evt) ->
|
$(document).on("click", "a[href]:not([data-bypass])", (evt) ->
|
||||||
console.log("App: scarfed link")
|
|
||||||
href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
|
href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
|
||||||
root = location.protocol + "//" + location.host + (App.root || '/');
|
root = location.protocol + "//" + location.host + (App.root || '/');
|
||||||
if (href.prop.slice(0, root.length) == root)
|
if (href.prop.slice(0, root.length) == root)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Generated by CoffeeScript 1.3.3
|
// Generated by CoffeeScript 1.3.3
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
define(['backbone', 'marionette', 'vent', 'app.lib/router', 'app.lib/panningRegion', 'app.lib/audioController', 'views/header', 'views/sidebar/sidebarView', 'models/mix/mixCollection'], function(Backbone, Marionette, vent, DssRouter, PanningRegion, AudioController, HeaderView, SidebarView, MixCollection) {
|
define(['backbone', 'marionette', 'vent', 'app.lib/router', 'app.lib/panningRegion', 'app.lib/realtimeController', 'app.lib/audioController', 'views/header', 'views/sidebar/sidebarView', 'models/mix/mixCollection'], function(Backbone, Marionette, vent, DssRouter, PanningRegion, RealtimeController, AudioController, HeaderView, SidebarView, MixCollection) {
|
||||||
var App, sidebarView;
|
var App, sidebarView;
|
||||||
Marionette.Region.prototype.open = function(view) {
|
Marionette.Region.prototype.open = function(view) {
|
||||||
this.$el.hide();
|
this.$el.hide();
|
||||||
@@ -11,6 +11,8 @@
|
|||||||
};
|
};
|
||||||
App = new Marionette.Application();
|
App = new Marionette.Application();
|
||||||
App.audioController = new AudioController();
|
App.audioController = new AudioController();
|
||||||
|
App.realtimeController = new RealtimeController();
|
||||||
|
App.realtimeController.startSocketIO();
|
||||||
App.vent.on("routing:started", function() {
|
App.vent.on("routing:started", function() {
|
||||||
var enablePushState, pushState;
|
var enablePushState, pushState;
|
||||||
console.log("App(vent): routing:started");
|
console.log("App(vent): routing:started");
|
||||||
@@ -36,10 +38,8 @@
|
|||||||
return App.vent.trigger("routing:started");
|
return App.vent.trigger("routing:started");
|
||||||
});
|
});
|
||||||
App.addInitializer(function() {
|
App.addInitializer(function() {
|
||||||
console.log("App: gobbling links");
|
|
||||||
$(document).on("click", "a[href]:not([data-bypass])", function(evt) {
|
$(document).on("click", "a[href]:not([data-bypass])", function(evt) {
|
||||||
var href, root;
|
var href, root;
|
||||||
console.log("App: scarfed link");
|
|
||||||
href = {
|
href = {
|
||||||
prop: $(this).prop("href"),
|
prop: $(this).prop("href"),
|
||||||
attr: $(this).attr("href")
|
attr: $(this).attr("href")
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ requirejs.config({
|
|||||||
models: 'app/models',
|
models: 'app/models',
|
||||||
'app.lib': 'app/lib',
|
'app.lib': 'app/lib',
|
||||||
moment: 'libs/moment',
|
moment: 'libs/moment',
|
||||||
toastr: 'libs/toastr'
|
toastr: 'libs/toastr',
|
||||||
|
'socket.io': com.podnoms.settings.SOCKET_IO_JS_URL
|
||||||
},
|
},
|
||||||
shim: {
|
shim: {
|
||||||
jquery: {
|
jquery: {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
define ['app', 'marionette',
|
define ['app', 'marionette',
|
||||||
|
'views/chat/chatView',
|
||||||
'models/mix/mixItem', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView',
|
'models/mix/mixItem', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView',
|
||||||
'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'],
|
'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'],
|
||||||
(App, Marionette, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserListView, UserEditView)->
|
(App, Marionette, ChatView, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserListView, UserEditView)->
|
||||||
class DssController extends Marionette.Controller
|
class DssController extends Marionette.Controller
|
||||||
home: ->
|
home: ->
|
||||||
console.log "Controller: home"
|
console.log "Controller: home"
|
||||||
@@ -51,6 +52,11 @@ define ['app', 'marionette',
|
|||||||
)
|
)
|
||||||
true
|
true
|
||||||
|
|
||||||
|
showChat: ->
|
||||||
|
console.log("Controller: showChat")
|
||||||
|
app = require('app')
|
||||||
|
app.contentRegion.show(new ChatView())
|
||||||
|
|
||||||
showUserList: (type) ->
|
showUserList: (type) ->
|
||||||
console.log("Controller: showUserList")
|
console.log("Controller: showUserList")
|
||||||
app = require('app')
|
app = require('app')
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.3.3
|
||||||
(function() {
|
(function() {
|
||||||
var __hasProp = {}.hasOwnProperty,
|
var __hasProp = {}.hasOwnProperty,
|
||||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||||
|
|
||||||
define(['app', 'marionette', 'models/mix/mixItem', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'], function(App, Marionette, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserListView, UserEditView) {
|
define(['app', 'marionette', 'views/chat/chatView', 'models/mix/mixItem', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'], function(App, Marionette, ChatView, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserListView, UserEditView) {
|
||||||
var DssController, _ref;
|
var DssController;
|
||||||
|
|
||||||
DssController = (function(_super) {
|
DssController = (function(_super) {
|
||||||
|
|
||||||
__extends(DssController, _super);
|
__extends(DssController, _super);
|
||||||
|
|
||||||
function DssController() {
|
function DssController() {
|
||||||
_ref = DssController.__super__.constructor.apply(this, arguments);
|
return DssController.__super__.constructor.apply(this, arguments);
|
||||||
return _ref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DssController.prototype.home = function() {
|
DssController.prototype.home = function() {
|
||||||
@@ -22,7 +21,6 @@
|
|||||||
|
|
||||||
DssController.prototype._showMixList = function(options) {
|
DssController.prototype._showMixList = function(options) {
|
||||||
var app;
|
var app;
|
||||||
|
|
||||||
console.log("Controller: _showMixList");
|
console.log("Controller: _showMixList");
|
||||||
app = require('app');
|
app = require('app');
|
||||||
app.contentRegion.show(new MixListView(options));
|
app.contentRegion.show(new MixListView(options));
|
||||||
@@ -38,7 +36,6 @@
|
|||||||
|
|
||||||
DssController.prototype.showMix = function(slug) {
|
DssController.prototype.showMix = function(slug) {
|
||||||
var app, mix;
|
var app, mix;
|
||||||
|
|
||||||
console.log("Controller: showMix");
|
console.log("Controller: showMix");
|
||||||
app = require('app');
|
app = require('app');
|
||||||
mix = new MixItem({
|
mix = new MixItem({
|
||||||
@@ -57,7 +54,6 @@
|
|||||||
|
|
||||||
DssController.prototype.uploadMix = function() {
|
DssController.prototype.uploadMix = function() {
|
||||||
var app, mix;
|
var app, mix;
|
||||||
|
|
||||||
console.log("Controller: mixUpload");
|
console.log("Controller: mixUpload");
|
||||||
app = require('app');
|
app = require('app');
|
||||||
mix = new MixItem({
|
mix = new MixItem({
|
||||||
@@ -74,7 +70,6 @@
|
|||||||
|
|
||||||
DssController.prototype.editMix = function(slug) {
|
DssController.prototype.editMix = function(slug) {
|
||||||
var app, mix;
|
var app, mix;
|
||||||
|
|
||||||
console.log("Controller: mixEdit");
|
console.log("Controller: mixEdit");
|
||||||
app = require('app');
|
app = require('app');
|
||||||
mix = new MixItem({
|
mix = new MixItem({
|
||||||
@@ -90,9 +85,15 @@
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DssController.prototype.showChat = function() {
|
||||||
|
var app;
|
||||||
|
console.log("Controller: showChat");
|
||||||
|
app = require('app');
|
||||||
|
return app.contentRegion.show(new ChatView());
|
||||||
|
};
|
||||||
|
|
||||||
DssController.prototype.showUserList = function(type) {
|
DssController.prototype.showUserList = function(type) {
|
||||||
var app;
|
var app;
|
||||||
|
|
||||||
console.log("Controller: showUserList");
|
console.log("Controller: showUserList");
|
||||||
app = require('app');
|
app = require('app');
|
||||||
return app.contentRegion.show(new UserListView());
|
return app.contentRegion.show(new UserListView());
|
||||||
@@ -144,7 +145,6 @@
|
|||||||
|
|
||||||
DssController.prototype.editUser = function() {
|
DssController.prototype.editUser = function() {
|
||||||
var app, user;
|
var app, user;
|
||||||
|
|
||||||
console.log("Controller: editUser");
|
console.log("Controller: editUser");
|
||||||
app = require('app');
|
app = require('app');
|
||||||
user = new UserItem({
|
user = new UserItem({
|
||||||
|
|||||||
15
static/js/app/lib/realtimeController.coffee
Normal file
15
static/js/app/lib/realtimeController.coffee
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
define ['socket.io'],
|
||||||
|
(SocketIO) ->
|
||||||
|
class RealtimeController
|
||||||
|
startSocketIO: ->
|
||||||
|
console.log("RealtimeController: Socket IO starting")
|
||||||
|
@socket = SocketIO.connect(com.podnoms.settings.REALTIME_HOST)
|
||||||
|
@socket.on "connect": =>
|
||||||
|
console.log("RealtimeController: Connected")
|
||||||
|
|
||||||
|
sendMessage: (message) ->
|
||||||
|
console.log("RealtimeController: sendMessage")
|
||||||
|
@socket.
|
||||||
|
|
||||||
|
RealtimeController
|
||||||
|
|
||||||
32
static/js/app/lib/realtimeController.js
Normal file
32
static/js/app/lib/realtimeController.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// Generated by CoffeeScript 1.3.3
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
define(['socket.io'], function(SocketIO) {
|
||||||
|
var RealtimeController;
|
||||||
|
RealtimeController = (function() {
|
||||||
|
|
||||||
|
function RealtimeController() {}
|
||||||
|
|
||||||
|
RealtimeController.prototype.startSocketIO = function() {
|
||||||
|
var _this = this;
|
||||||
|
console.log("RealtimeController: Socket IO starting");
|
||||||
|
this.socket = SocketIO.connect(com.podnoms.settings.REALTIME_HOST);
|
||||||
|
return this.socket.on("news", function(data) {
|
||||||
|
console.log("RealtimeController: Connected");
|
||||||
|
return _this.socket.emit("dss:connected", {
|
||||||
|
my: "data"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
RealtimeController.prototype.sendMessage = function(message) {
|
||||||
|
return console.log("RealtimeController: sendMessage");
|
||||||
|
};
|
||||||
|
|
||||||
|
return RealtimeController;
|
||||||
|
|
||||||
|
})();
|
||||||
|
return RealtimeController;
|
||||||
|
});
|
||||||
|
|
||||||
|
}).call(this);
|
||||||
@@ -12,6 +12,8 @@ define ['marionette', 'app.lib/controller'],
|
|||||||
"mix/:slug": "showMix"
|
"mix/:slug": "showMix"
|
||||||
"mix/edit/:slug": "editMix",
|
"mix/edit/:slug": "editMix",
|
||||||
|
|
||||||
|
"chat": "showChat",
|
||||||
|
|
||||||
"users": "showUserList"
|
"users": "showUserList"
|
||||||
"user/:slug/favourites": "showUserFavourites"
|
"user/:slug/favourites": "showUserFavourites"
|
||||||
"user/:slug/likes": "showUserLikes"
|
"user/:slug/likes": "showUserLikes"
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.3.3
|
||||||
(function() {
|
(function() {
|
||||||
var __hasProp = {}.hasOwnProperty,
|
var __hasProp = {}.hasOwnProperty,
|
||||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||||
|
|
||||||
define(['marionette', 'app.lib/controller'], function(Marionette, Controller) {
|
define(['marionette', 'app.lib/controller'], function(Marionette, Controller) {
|
||||||
var DssRouter, _ref;
|
var DssRouter;
|
||||||
|
|
||||||
return DssRouter = (function(_super) {
|
return DssRouter = (function(_super) {
|
||||||
|
|
||||||
__extends(DssRouter, _super);
|
__extends(DssRouter, _super);
|
||||||
|
|
||||||
function DssRouter() {
|
function DssRouter() {
|
||||||
_ref = DssRouter.__super__.constructor.apply(this, arguments);
|
return DssRouter.__super__.constructor.apply(this, arguments);
|
||||||
return _ref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DssRouter.prototype.controller = new Controller;
|
DssRouter.prototype.controller = new Controller;
|
||||||
@@ -24,6 +23,7 @@
|
|||||||
"mixes/:type": "showMixList",
|
"mixes/:type": "showMixList",
|
||||||
"mix/:slug": "showMix",
|
"mix/:slug": "showMix",
|
||||||
"mix/edit/:slug": "editMix",
|
"mix/edit/:slug": "editMix",
|
||||||
|
"chat": "showChat",
|
||||||
"users": "showUserList",
|
"users": "showUserList",
|
||||||
"user/:slug/favourites": "showUserFavourites",
|
"user/:slug/favourites": "showUserFavourites",
|
||||||
"user/:slug/likes": "showUserLikes",
|
"user/:slug/likes": "showUserLikes",
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ define ['marionette', 'models/activity/activityCollection', 'views/activity/acti
|
|||||||
@collection.fetch(
|
@collection.fetch(
|
||||||
success: =>
|
success: =>
|
||||||
console.log "ActivityListView: Collection fetched"
|
console.log "ActivityListView: Collection fetched"
|
||||||
console.log @collection
|
|
||||||
return
|
return
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.3.3
|
||||||
(function() {
|
(function() {
|
||||||
var __hasProp = {}.hasOwnProperty,
|
var __hasProp = {}.hasOwnProperty,
|
||||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||||
|
|
||||||
define(['marionette', 'models/activity/activityCollection', 'views/activity/activityItemView', 'text!/tpl/ActivityListView'], function(Marionette, ActivityCollection, ActivityItemView, Template) {
|
define(['marionette', 'models/activity/activityCollection', 'views/activity/activityItemView', 'text!/tpl/ActivityListView'], function(Marionette, ActivityCollection, ActivityItemView, Template) {
|
||||||
var ActivityListView, _ref;
|
var ActivityListView;
|
||||||
|
|
||||||
ActivityListView = (function(_super) {
|
ActivityListView = (function(_super) {
|
||||||
|
|
||||||
__extends(ActivityListView, _super);
|
__extends(ActivityListView, _super);
|
||||||
|
|
||||||
function ActivityListView() {
|
function ActivityListView() {
|
||||||
_ref = ActivityListView.__super__.constructor.apply(this, arguments);
|
return ActivityListView.__super__.constructor.apply(this, arguments);
|
||||||
return _ref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityListView.prototype.template = _.template(Template);
|
ActivityListView.prototype.template = _.template(Template);
|
||||||
@@ -26,13 +25,11 @@
|
|||||||
|
|
||||||
ActivityListView.prototype.initialize = function() {
|
ActivityListView.prototype.initialize = function() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
console.log("ActivityListView: initialize");
|
console.log("ActivityListView: initialize");
|
||||||
this.collection = new ActivityCollection;
|
this.collection = new ActivityCollection;
|
||||||
this.collection.fetch({
|
this.collection.fetch({
|
||||||
success: function() {
|
success: function() {
|
||||||
console.log("ActivityListView: Collection fetched");
|
console.log("ActivityListView: Collection fetched");
|
||||||
console.log(_this.collection);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
18
static/js/app/views/chat/chatView.coffee
Executable file
18
static/js/app/views/chat/chatView.coffee
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
define ['marionette', 'app.lib/realtimeController', 'text!/tpl/ChatView'],
|
||||||
|
(Marionette, RealtimeController, Template) ->
|
||||||
|
class ChatView extends Marionette.ItemView
|
||||||
|
controller = new RealtimeController()
|
||||||
|
template: _.template(Template)
|
||||||
|
ui:
|
||||||
|
chatMessage: '#chat-message'
|
||||||
|
|
||||||
|
events:
|
||||||
|
"click #chat-send": "sendChatMessage"
|
||||||
|
|
||||||
|
sendChatMessage: ->
|
||||||
|
console.log("ChatView: sendChatMessage")
|
||||||
|
message = @ui.chatMessage.val()
|
||||||
|
if message
|
||||||
|
controller.sendMessage(message)
|
||||||
|
|
||||||
|
ChatView
|
||||||
44
static/js/app/views/chat/chatView.js
Normal file
44
static/js/app/views/chat/chatView.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// Generated by CoffeeScript 1.3.3
|
||||||
|
(function() {
|
||||||
|
var __hasProp = {}.hasOwnProperty,
|
||||||
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||||
|
|
||||||
|
define(['marionette', 'app.lib/realtimeController', 'text!/tpl/ChatView'], function(Marionette, RealtimeController, Template) {
|
||||||
|
var ChatView;
|
||||||
|
ChatView = (function(_super) {
|
||||||
|
var controller;
|
||||||
|
|
||||||
|
__extends(ChatView, _super);
|
||||||
|
|
||||||
|
function ChatView() {
|
||||||
|
return ChatView.__super__.constructor.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
controller = new RealtimeController();
|
||||||
|
|
||||||
|
ChatView.prototype.template = _.template(Template);
|
||||||
|
|
||||||
|
ChatView.prototype.ui = {
|
||||||
|
chatMessage: '#chat-message'
|
||||||
|
};
|
||||||
|
|
||||||
|
ChatView.prototype.events = {
|
||||||
|
"click #chat-send": "sendChatMessage"
|
||||||
|
};
|
||||||
|
|
||||||
|
ChatView.prototype.sendChatMessage = function() {
|
||||||
|
var message;
|
||||||
|
console.log("ChatView: sendChatMessage");
|
||||||
|
message = this.ui.chatMessage.val();
|
||||||
|
if (message) {
|
||||||
|
return controller.sendMessage(message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return ChatView;
|
||||||
|
|
||||||
|
})(Marionette.ItemView);
|
||||||
|
return ChatView;
|
||||||
|
});
|
||||||
|
|
||||||
|
}).call(this);
|
||||||
@@ -2,9 +2,8 @@ if (!com) var com = {};
|
|||||||
if (!com.podnoms) com.podnoms = {};
|
if (!com.podnoms) com.podnoms = {};
|
||||||
|
|
||||||
com.podnoms.settings = {
|
com.podnoms.settings = {
|
||||||
CHAT_HOST: '{{ CHAT_HOST }}',
|
REALTIME_HOST: "{{ REALTIME_HOST }}",
|
||||||
REALTIME_HOST: '{{ CHAT_HOST }}',
|
SOCKET_IO_JS_URL: "{{ SOCKET_IO_JS_URL }}",
|
||||||
REALTIME_PORT: '{{ CHAT_HOST }}',
|
|
||||||
urlRoot: '{{ API_URL }}',
|
urlRoot: '{{ API_URL }}',
|
||||||
liveStreamRoot: 'http://{{ LIVE_STREAM_URL }}:{{ LIVE_STREAM_PORT }}/{{ LIVE_STREAM_MOUNT }}',
|
liveStreamRoot: 'http://{{ LIVE_STREAM_URL }}:{{ LIVE_STREAM_PORT }}/{{ LIVE_STREAM_MOUNT }}',
|
||||||
streamInfoUrl: 'http://{{ LIVE_STREAM_INFO_URL }}',
|
streamInfoUrl: 'http://{{ LIVE_STREAM_INFO_URL }}',
|
||||||
|
|||||||
16
templates/views/ChatView.html
Normal file
16
templates/views/ChatView.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<fieldset>
|
||||||
|
<legend>Dss Chat Server</legend>
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="chat-message" class="control-label">Message</label>
|
||||||
|
<div class="controls">
|
||||||
|
<textarea class="input-block-level" id="chat-message" rows="3" name="textarea"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Button -->
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<button id="chat-send" name="chat-send" class="btn btn-success">Send message</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
Reference in New Issue
Block a user