Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit bb41ec5

Browse files
author
Melissa Noelle
committed
Adding subdomain option to createroom plugin.
1 parent 595e8ab commit bb41ec5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

createroom/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ Include the JavaScript and CSS files:
1111
<link rel="stylesheet" type="text/css" href="candyshop/createroom/createroom.css" />
1212
```
1313

14-
To enable this Left Tabs plugin, add its `init` method _before_ you `init` Candy:
14+
To enable the Create Room plugin, add its `init` method _before_ you `init` Candy. You can pass it your chat subdomain as well:
1515
```JavaScript
16-
CandyShop.CreateRoom.init();
16+
CandyShop.CreateRoom.init({
17+
subdomain: 'chat'
18+
});
1719
Candy.init('/http-bind', { ...
1820
```

createroom/createroom.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
var CandyShop = (function(self) { return self; }(CandyShop || {}));
77

88
CandyShop.CreateRoom = (function(self, Candy, $) {
9+
self._options = {
10+
subdomain: 'conference'
11+
}
912
/** Object: about
1013
*
1114
* Contains:
@@ -21,6 +24,9 @@ CandyShop.CreateRoom = (function(self, Candy, $) {
2124
* Initializes the CreateRoom plugin with the default settings.
2225
*/
2326
self.init = function(){
27+
// apply the supplied options to the defaults specified
28+
$.extend(true, self._options, options);
29+
2430
$(Candy).on('candy:view.room.after-add', function() {
2531
self.appendButton();
2632
});
@@ -54,7 +60,7 @@ CandyShop.CreateRoom = (function(self, Candy, $) {
5460
} else {
5561
var roomName = $('#create-group-form-name').val().trim();
5662
// Create a valid roomjid.
57-
var roomJid = roomName.replace(/[^A-Z0-9]+/ig, "_").toLowerCase() + '@conference.' +
63+
var roomJid = roomName.replace(/[^A-Z0-9]+/ig, "_").toLowerCase() + '@' + self._options.subdomain + '.' +
5864
Candy.Core.getConnection().domain;
5965

6066
// Once we've joined the room, send configuration information.

0 commit comments

Comments
 (0)