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

Commit

Permalink
Adding subdomain option to createroom plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
Melissa Noelle committed Aug 25, 2014
1 parent 595e8ab commit bb41ec5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions createroom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ Include the JavaScript and CSS files:
<link rel="stylesheet" type="text/css" href="candyshop/createroom/createroom.css" />
```

To enable this Left Tabs plugin, add its `init` method _before_ you `init` Candy:
To enable the Create Room plugin, add its `init` method _before_ you `init` Candy. You can pass it your chat subdomain as well:
```JavaScript
CandyShop.CreateRoom.init();
CandyShop.CreateRoom.init({
subdomain: 'chat'
});
Candy.init('/http-bind', { ...
```
8 changes: 7 additions & 1 deletion createroom/createroom.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
var CandyShop = (function(self) { return self; }(CandyShop || {}));

CandyShop.CreateRoom = (function(self, Candy, $) {
self._options = {
subdomain: 'conference'
}
/** Object: about
*
* Contains:
Expand All @@ -21,6 +24,9 @@ CandyShop.CreateRoom = (function(self, Candy, $) {
* Initializes the CreateRoom plugin with the default settings.
*/
self.init = function(){
// apply the supplied options to the defaults specified
$.extend(true, self._options, options);

$(Candy).on('candy:view.room.after-add', function() {
self.appendButton();
});
Expand Down Expand Up @@ -54,7 +60,7 @@ CandyShop.CreateRoom = (function(self, Candy, $) {
} else {
var roomName = $('#create-group-form-name').val().trim();
// Create a valid roomjid.
var roomJid = roomName.replace(/[^A-Z0-9]+/ig, "_").toLowerCase() + '@conference.' +
var roomJid = roomName.replace(/[^A-Z0-9]+/ig, "_").toLowerCase() + '@' + self._options.subdomain + '.' +
Candy.Core.getConnection().domain;

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

0 comments on commit bb41ec5

Please sign in to comment.