diff --git a/static/js/controllers/controllers.js b/static/js/controllers/controllers.js
index 099ce823..10d51949 100644
--- a/static/js/controllers/controllers.js
+++ b/static/js/controllers/controllers.js
@@ -26,16 +26,14 @@ define([
'controllers/mediastreamcontroller',
'controllers/statusmessagecontroller',
'controllers/chatroomcontroller',
- 'controllers/roomchangecontroller',
'controllers/usersettingscontroller',
'controllers/contactsmanagercontroller',
- 'controllers/contactsmanagereditcontroller'], function(_, MediastreamController, StatusmessageController, ChatroomController, RoomchangeController, UsersettingsController, ContactsmanagerController, ContactsmanagereditController) {
+ 'controllers/contactsmanagereditcontroller'], function(_, MediastreamController, StatusmessageController, ChatroomController, UsersettingsController, ContactsmanagerController, ContactsmanagereditController) {
var controllers = {
MediastreamController: MediastreamController,
StatusmessageController: StatusmessageController,
ChatroomController: ChatroomController,
- RoomchangeController: RoomchangeController,
UsersettingsController: UsersettingsController,
ContactsmanagerController: ContactsmanagerController,
ContactsmanagereditController: ContactsmanagereditController
diff --git a/static/js/controllers/roomchangecontroller.js b/static/js/controllers/roomchangecontroller.js
deleted file mode 100644
index a1dfc3f5..00000000
--- a/static/js/controllers/roomchangecontroller.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Spreed WebRTC.
- * Copyright (C) 2013-2014 struktur AG
- *
- * This file is part of Spreed WebRTC.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- */
-
-"use strict";
-define([], function() {
- return ["$scope", "rooms", function($scope, rooms) {
- $scope.joinRoomByName = rooms.joinByName;
- }];
-});
diff --git a/static/js/directives/directives.js b/static/js/directives/directives.js
index d6c8713d..e12f192d 100644
--- a/static/js/directives/directives.js
+++ b/static/js/directives/directives.js
@@ -46,7 +46,8 @@ define([
'directives/presentation',
'directives/youtubevideo',
'directives/bfi',
- 'directives/title'], function(_, onEnter, onEscape, statusMessage, buddyList, buddyPictureCapture, buddyPictureUpload, settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar, socialShare, page, contactRequest, defaultDialog, pdfcanvas, odfcanvas, presentation, youtubevideo, bfi, title) {
+ 'directives/title',
+ 'directives/welcome'], function(_, onEnter, onEscape, statusMessage, buddyList, buddyPictureCapture, buddyPictureUpload, settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar, socialShare, page, contactRequest, defaultDialog, pdfcanvas, odfcanvas, presentation, youtubevideo, bfi, title, welcome) {
var directives = {
onEnter: onEnter,
@@ -72,7 +73,8 @@ define([
presentation: presentation,
youtubevideo: youtubevideo,
bfi: bfi,
- title: title
+ title: title,
+ welcome: welcome
};
var initialize = function(angModule) {
diff --git a/static/js/directives/page.js b/static/js/directives/page.js
index 33d5ed29..3cb71d9e 100644
--- a/static/js/directives/page.js
+++ b/static/js/directives/page.js
@@ -23,47 +23,24 @@
define(['text!partials/page.html', 'text!partials/page/welcome.html'], function(template, welcome) {
return ["$templateCache", "$timeout", "rooms", function($templateCache, $timeout, rooms) {
+
$templateCache.put('page/welcome.html', welcome);
var link = function($scope, $element, attrs) {
- $scope.randomRoom = rooms.randomRoom;
-
$scope.$on("room.joined", function(event) {
+ // Show no page when joined a room.
$scope.page = null;
});
-
$scope.$on("room.random", function(ev, roomdata) {
+ // Show welcome page on room random events.
$scope.page = "page/welcome.html";
- $scope.roomdata = roomdata;
- $timeout(function() {
- $element.find(".roomdata-link-input:visible:enabled:first").focus();
- });
- });
-
- $scope.roomdataInput = {
- name: ""
- };
- $scope.roomdata = {};
-
- $scope.$watch("roomdata.name", function(name) {
- $scope.roomdata.link = rooms.link({Name: name});
- }, true);
-
- $scope.$watch("roomdataInput.name", function(name) {
- if (name === "") {
- $scope.randomRoom();
- } else {
- $scope.roomdata.name = name;
- }
});
-
};
return {
restrict: 'E',
replace: true,
template: template,
- controller: "RoomchangeController",
link: link
};
}];
diff --git a/static/js/directives/roombar.js b/static/js/directives/roombar.js
index 87c3dc20..e8b44347 100644
--- a/static/js/directives/roombar.js
+++ b/static/js/directives/roombar.js
@@ -81,7 +81,6 @@ define(['underscore', 'angular', 'text!partials/roombar.html'], function(_, angu
replace: true,
scope: true,
template: template,
- controller: "RoomchangeController",
link: link
}
diff --git a/static/js/directives/welcome.js b/static/js/directives/welcome.js
new file mode 100644
index 00000000..2d2163ba
--- /dev/null
+++ b/static/js/directives/welcome.js
@@ -0,0 +1,75 @@
+/*
+ * Spreed WebRTC.
+ * Copyright (C) 2013-2014 struktur AG
+ *
+ * This file is part of Spreed WebRTC.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+"use strict";
+define([], function() {
+
+ // welcome
+ return ["rooms", "$timeout", function(rooms, $timeout) {
+
+ function link($scope, $element) {
+ //console.log("xxx welcome", $scope.$id, $element);
+
+ $scope.randomRoom = rooms.randomRoom;
+ $scope.joinRoomByName = rooms.joinByName;
+
+ var roomdata = rooms.getRandomRoom();
+ if (roomdata) {
+ $scope.roomdata = {name: roomdata.name}
+ } else {
+ $scope.roomdata = {};
+ }
+
+ $scope.roomdataInput = {
+ name: ""
+ };
+
+ $scope.$watch("roomdata.name", function(name) {
+ $scope.roomdata.link = rooms.link({Name: name});
+ }, true);
+
+ $scope.$watch("roomdataInput.name", function(name) {
+ if (name === "") {
+ $scope.randomRoom();
+ } else {
+ $scope.roomdata.name = name;
+ }
+ });
+
+ $scope.$on("room.random", function(event, roomdata) {
+ $scope.roomdata = {name: roomdata.name};
+ $scope.roomdataInput.name = "";
+ });
+
+ $timeout(function() {
+ $element.find(".roomdata-link-input:visible:enabled:first").focus();
+ });
+
+ }
+
+ return {
+ restrict: 'EA',
+ link: link
+ }
+
+ }];
+
+});
diff --git a/static/js/services/rooms.js b/static/js/services/rooms.js
index 3483f6d3..e4ce965b 100644
--- a/static/js/services/rooms.js
+++ b/static/js/services/rooms.js
@@ -31,6 +31,7 @@ define([
var requestedRoomName = "";
var helloedRoomName = null;
var currentRoom = null;
+ var randomRoom = null;
var joinFailed = function(error) {
setCurrentRoom(null);
@@ -179,13 +180,18 @@ define([
if (!data.name) {
data.name = "";
}
- $rootScope.$broadcast('room.random', {name: data.name});
+ randomRoom = {name: data.name};
+ $rootScope.$broadcast('room.random', randomRoom);
}).
error(function() {
console.error("Failed to retrieve random room data.");
- $rootScope.$broadcast('room.random', {});
+ randomRoom = {};
+ $rootScope.$broadcast('room.random', randomRoom);
});
},
+ getRandomRoom: function() {
+ return randomRoom;
+ },
joinByName: function(name, replace) {
name = $window.encodeURIComponent(name);
name = name.replace(/^%40/, "@");
diff --git a/static/partials/page/welcome.html b/static/partials/page/welcome.html
index b4fa9fdf..f77a0d17 100644
--- a/static/partials/page/welcome.html
+++ b/static/partials/page/welcome.html
@@ -1,4 +1,4 @@
-
+
{{_("Enter a room name")}}