Commit 24d58a5b authored by JC Brand's avatar JC Brand

Merge branch 'consolidation'

parents a29a0293 e2d494f0
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
# reset old environment variables
if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r
fi
if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
PS1="$_OLD_VIRTUAL_PS1"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelavent variables
deactivate nondestructive
VIRTUAL_ENV="/home/jc/dev/converse.js"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/node_modules/.bin:$PATH"
export PATH
if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
_OLD_VIRTUAL_PS1="$PS1"
if [ "x" != x ] ; then
PS1="$PS1"
else
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
else
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
fi
fi
export PS1
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r
fi
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
"requirejs-text": "~2.0.12", "requirejs-text": "~2.0.12",
"requirejs-tpl-jcbrand": "*", "requirejs-tpl-jcbrand": "*",
"momentjs": "~2.6.0", "momentjs": "~2.6.0",
"jquery.browser": "~0.0.6" "jquery.browser": "~0.0.6",
"backbone.overview": "*"
}, },
"exportsOverride": {} "exportsOverride": {}
} }
This diff is collapsed.
This diff is collapsed.
...@@ -568,13 +568,7 @@ span.spinner.hor_centered { ...@@ -568,13 +568,7 @@ span.spinner.hor_centered {
margin-right: 5px; margin-right: 5px;
color: white; color: white;
} }
#conversejs #offscreen-chatboxes { #conversejs #trimmed-chatboxes .box-flyout {
float: left;
height: 25px;
margin-left: 5px;
display: block;
}
#conversejs #offscreen-chatboxes .box-flyout {
position: absolute; position: absolute;
display: block; display: block;
bottom: 1px; bottom: 1px;
...@@ -582,15 +576,16 @@ span.spinner.hor_centered { ...@@ -582,15 +576,16 @@ span.spinner.hor_centered {
border-radius: 4px; border-radius: 4px;
height: auto; height: auto;
} }
#conversejs #offscreen-chatboxes .box-flyout .chat-head { #conversejs #trimmed-chatboxes .box-flyout .chat-head {
font-size: 100%; font-size: 100%;
border-radius: 4px; border-radius: 4px;
padding: 3px 0 0 5px; padding: 3px 0 0 5px;
margin: 0 0 2px 2px; margin: 0 0 2px 2px;
box-shadow: 1px 3px 5px 3px rgba(0, 0, 0, 0.4); box-shadow: 1px 3px 5px 3px rgba(0, 0, 0, 0.4);
height: 24px; height: 24px;
width: 130px;
} }
#conversejs #offscreen-chatboxes .chat-head-chatroom { #conversejs #trimmed-chatboxes .chat-head-chatroom {
width: 100px; width: 100px;
} }
#conversejs #toggle-controlbox { #conversejs #toggle-controlbox {
...@@ -745,10 +740,11 @@ input.error { ...@@ -745,10 +740,11 @@ input.error {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
text-shadow: rgba(0, 0, 0, 0.51) 0 -1px 0; text-shadow: rgba(0, 0, 0, 0.51) 0 -1px 0;
height: 1em;
} }
#conversejs .chat-title a { #conversejs .chat-title a {
color: white; color: white;
width: 100%;
display: block;
} }
#conversejs .chat-head-chatbox, #conversejs .chat-head-chatbox,
#conversejs .chat-head-chatroom { #conversejs .chat-head-chatroom {
...@@ -836,23 +832,20 @@ dl.add-converse-contact { ...@@ -836,23 +832,20 @@ dl.add-converse-contact {
#conversejs .chat-head-message-count { #conversejs .chat-head-message-count {
font-weight: bold; font-weight: bold;
position: absolute; position: absolute;
left: -6px; left: -5px;
top: -6px; top: 2px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.35, #f6f6f6), color-stop(1, #808080)); background: -webkit-gradient(linear, left top, left bottom, color-stop(0.35, #f6f6f6), color-stop(1, #808080));
background: -moz-linear-gradient(center top, #ffff00 5%, #f6f6f6 100%); background: -moz-linear-gradient(center top, #ffff00 5%, #f6f6f6 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='yellow', endColorstr='#f6f6f6'); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='yellow', endColorstr='#f6f6f6');
border: 3px solid #4f6a72; border: 1px solid;
text-shadow: 1px 1px 0 #ccc; text-shadow: 1px 1px 0 #ccc;
color: darkred; color: darkred;
border-radius: 20%; border-radius: 20%;
padding: 2px 10px; padding: 2px 4px;
font-size: 18px; font-size: 15px;
text-align: center; text-align: center;
display: none; display: none;
} }
#conversejs .chat-head-chatroom .chat-head-message-count {
border: 3px solid #2D617A;
}
#conversejs a.configure-chatroom-button, #conversejs a.configure-chatroom-button,
#conversejs a.toggle-chatbox-button, #conversejs a.toggle-chatbox-button,
#conversejs a.close-chatbox-button { #conversejs a.close-chatbox-button {
...@@ -1040,6 +1033,7 @@ dl.add-converse-contact { ...@@ -1040,6 +1033,7 @@ dl.add-converse-contact {
#conversejs #converse-roster dd.pending-xmpp-contact:hover span { #conversejs #converse-roster dd.pending-xmpp-contact:hover span {
width: 70%; width: 70%;
} }
#conversejs #trimmed-chatboxes,
#conversejs .chatbox, #conversejs .chatbox,
#conversejs .chatroom { #conversejs .chatroom {
height: 25px; height: 25px;
...@@ -1047,6 +1041,9 @@ dl.add-converse-contact { ...@@ -1047,6 +1041,9 @@ dl.add-converse-contact {
margin-right: 15px; margin-right: 15px;
display: block; display: block;
} }
#conversejs #trimmed-chatboxes {
width: 130px;
}
#conversejs .chatbox { #conversejs .chatbox {
width: 200px; width: 200px;
} }
......
...@@ -9,6 +9,7 @@ Changelog ...@@ -9,6 +9,7 @@ Changelog
2. Configuration options for the chat toolbar have changed. 2. Configuration options for the chat toolbar have changed.
Please refer to the `relevant documentation http://devbox:8890/docs/html/index.html#visible-toolbar-buttons`_. Please refer to the `relevant documentation http://devbox:8890/docs/html/index.html#visible-toolbar-buttons`_.
* No initial HTML markup is now needed in the document body for converse.js to work. [jcbrand]
* All date handling is now done with moment.js. [jcbrand] * All date handling is now done with moment.js. [jcbrand]
* Add a new toolbar button for clearing chat messages. [jcbrand] * Add a new toolbar button for clearing chat messages. [jcbrand]
* Chat boxes and rooms can now be resized vertically. [jcbrand] * Chat boxes and rooms can now be resized vertically. [jcbrand]
......
...@@ -52,13 +52,6 @@ bottom of your page (after the closing *</body>* element). ...@@ -52,13 +52,6 @@ bottom of your page (after the closing *</body>* element).
}); });
}); });
Finally, Converse.js requires a special snippet of HTML markup to be included in your page:
::
<div id="conversejs"></div>
The `index.html <https://github.com/jcbrand/converse.js/blob/master/index.html>`_ file inside the The `index.html <https://github.com/jcbrand/converse.js/blob/master/index.html>`_ file inside the
Converse.js repository serves as a nice usable example of this. Converse.js repository serves as a nice usable example of this.
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
<link type="text/css" rel="stylesheet" media="screen" href="css/theme.css" /> <link type="text/css" rel="stylesheet" media="screen" href="css/theme.css" />
<link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" /> <link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
<script data-main="main" src="components/requirejs/require.js"></script> <script data-main="main" src="components/requirejs/require.js"></script>
<script src="../components/jquery/dist/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="js/init.js"></script>
</head> </head>
<body id="page-top" data-spy="scroll" data-target=".navbar-custom"> <body id="page-top" data-spy="scroll" data-target=".navbar-custom">
...@@ -209,15 +214,6 @@ ...@@ -209,15 +214,6 @@
</div> </div>
</div> </div>
</section> </section>
<!-- Core JavaScript Files -->
<script src="../components/jquery/dist/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<!-- Custom Theme JavaScript -->
<script src="js/init.js"></script>
<div id="conversejs"></div>
</body> </body>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -598,14 +598,7 @@ span.spinner.hor_centered { ...@@ -598,14 +598,7 @@ span.spinner.hor_centered {
color: white; color: white;
} }
#conversejs #offscreen-chatboxes { #conversejs #trimmed-chatboxes .box-flyout {
float: left;
height: 25px;
margin-left: 5px;
display: block;
}
#conversejs #offscreen-chatboxes .box-flyout {
position: absolute; position: absolute;
display: block; display: block;
bottom: 1px; bottom: 1px;
...@@ -614,16 +607,17 @@ span.spinner.hor_centered { ...@@ -614,16 +607,17 @@ span.spinner.hor_centered {
height: auto; height: auto;
} }
#conversejs #offscreen-chatboxes .box-flyout .chat-head { #conversejs #trimmed-chatboxes .box-flyout .chat-head {
font-size: 100%; font-size: 100%;
border-radius: 4px; border-radius: 4px;
padding: 3px 0 0 5px; padding: 3px 0 0 5px;
margin: 0 0 2px 2px; margin: 0 0 2px 2px;
box-shadow: 1px 3px 5px 3px rgba(0,0,0,0.4); box-shadow: 1px 3px 5px 3px rgba(0,0,0,0.4);
height: 24px; height: 24px;
width: 130px;
} }
#conversejs #offscreen-chatboxes .chat-head-chatroom { #conversejs #trimmed-chatboxes .chat-head-chatroom {
width: 100px; width: 100px;
} }
...@@ -808,11 +802,12 @@ input.error { ...@@ -808,11 +802,12 @@ input.error {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
text-shadow: rgba(0,0,0,0.51) 0 -1px 0; text-shadow: rgba(0,0,0,0.51) 0 -1px 0;
height: 1em;
} }
#conversejs .chat-title a { #conversejs .chat-title a {
color: white; color: white;
width: 100%;
display: block;
} }
#conversejs .chat-head-chatbox, #conversejs .chat-head-chatbox,
...@@ -916,25 +911,21 @@ dl.add-converse-contact { ...@@ -916,25 +911,21 @@ dl.add-converse-contact {
#conversejs .chat-head-message-count { #conversejs .chat-head-message-count {
font-weight: bold; font-weight: bold;
position: absolute; position: absolute;
left: -6px; left: -5px;
top: -6px; top: 2px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.35, #f6f6f6), color-stop(1, grey) ); background: -webkit-gradient(linear, left top, left bottom, color-stop(0.35, #f6f6f6), color-stop(1, grey) );
background: -moz-linear-gradient(center top, yellow 5%, #f6f6f6 100%); background: -moz-linear-gradient(center top, yellow 5%, #f6f6f6 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='yellow', endColorstr='#f6f6f6'); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='yellow', endColorstr='#f6f6f6');
border: 3px solid rgb(79, 106, 114); border: 1px solid;
text-shadow: 1px 1px 0 #ccc; text-shadow: 1px 1px 0 #ccc;
color: darkred; color: darkred;
border-radius: 20%; border-radius: 20%;
padding: 2px 10px; padding: 2px 4px;
font-size: 18px; font-size: 15px;
text-align: center; text-align: center;
display: none; display: none;
} }
#conversejs .chat-head-chatroom .chat-head-message-count {
border: 3px solid #2D617A;
}
#conversejs a.configure-chatroom-button, #conversejs a.configure-chatroom-button,
#conversejs a.toggle-chatbox-button, #conversejs a.toggle-chatbox-button,
#conversejs a.close-chatbox-button { #conversejs a.close-chatbox-button {
...@@ -1152,6 +1143,7 @@ dl.add-converse-contact { ...@@ -1152,6 +1143,7 @@ dl.add-converse-contact {
width: 70%; width: 70%;
} }
#conversejs #trimmed-chatboxes,
#conversejs .chatbox, #conversejs .chatbox,
#conversejs .chatroom { #conversejs .chatroom {
height: 25px; height: 25px;
...@@ -1160,6 +1152,10 @@ dl.add-converse-contact { ...@@ -1160,6 +1152,10 @@ dl.add-converse-contact {
display: block; display: block;
} }
#conversejs #trimmed-chatboxes {
width: 130px;
}
#conversejs .chatbox { #conversejs .chatbox {
width: 200px; width: 200px;
} }
......
...@@ -8,6 +8,7 @@ config = { ...@@ -8,6 +8,7 @@ config = {
"underscore": "components/underscore/underscore", "underscore": "components/underscore/underscore",
"backbone": "components/backbone/backbone", "backbone": "components/backbone/backbone",
"backbone.localStorage": "components/backbone.localStorage/backbone.localStorage", "backbone.localStorage": "components/backbone.localStorage/backbone.localStorage",
"backbone.overview": "components/backbone.overview/backbone.overview",
"text": 'components/requirejs-text/text', "text": 'components/requirejs-text/text',
"tpl": 'components/requirejs-tpl-jcbrand/tpl', "tpl": 'components/requirejs-tpl-jcbrand/tpl',
"converse-templates": "src/templates", "converse-templates": "src/templates",
......
...@@ -373,27 +373,72 @@ ...@@ -373,27 +373,72 @@
</div> </div>
</div> </div>
<div id="offscreen-chatboxes"> <div id="trimmed-chatboxes">
<div class="box-flyout"> <div class="box-flyout">
<div class="chat-head chat-head-chatroom"> <div class="chat-head chat-head-chatroom">
<a class="close-chatbox-button icon-close"></a> <a class="close-chatbox-button icon-close"></a>
<div class="chat-title"> Restricted Chatroom</div> <div class="chat-title">
<a href="#" class="restore-chat" title="Click to maximize this chat">
<div class="chat-head-message-count" style="display:block">3</div>
Restricted Chatroom
</a>
</div>
</div> </div>
<div class="chat-head chat-head-chatbox"> <div class="chat-head chat-head-chatbox">
<a class="close-chatbox-button icon-close"></a> <a class="close-chatbox-button icon-close"></a>
<div class="chat-title"> <div class="chat-title">
<a href="http://opkode.com" target="_blank" class="user"> <a href="#" class="restore-chat" title="Click to maximize this chat">
<div class="chat-head-message-count" style="display:block">42</div>
JC Brand JC Brand
</a> </a>
</div> </div>
</div> </div>
<div class="chat-head chat-head-chatroom"> <div class="chat-head chat-head-chatroom">
<a class="close-chatbox-button icon-close"></a> <a class="close-chatbox-button icon-close"></a>
<div class="chat-title"> My Chatroom</div> <div class="chat-title">
<a href="#" class="restore-chat" title="Click to maximize this chat">
My Chatroom
</a>
</div>
</div>
<div class="chat-head chat-head-chatbox"><a class="close-chatbox-button icon-close"></a>
<div class="chat-title">
<a href="#" class="restore-chat" title="Click to maximize this chat">
Annegreet Gomez
</a>
</div>
</div>
<div class="chat-head chat-head-chatbox"><a class="close-chatbox-button icon-close"></a>
<div class="chat-title">
<a href="#" class="restore-chat" title="Click to maximize this chat">
<div class="chat-head-message-count" style="display:block">842</div>
Asmaa Haakman
</a>
</div>
</div>
<div class="chat-head chat-head-chatbox"><a class="close-chatbox-button icon-close"></a>
<div class="chat-title">
<a href="#" class="restore-chat" title="Click to maximize this chat">
Candice van der Knijff
</a>
</div>
</div>
<div class="chat-head chat-head-chatbox"><a class="close-chatbox-button icon-close"></a>
<div class="chat-title">
<a href="#" class="restore-chat" title="Click to maximize this chat">
Laura Grunewald
</a>
</div>
</div>
<div class="chat-head chat-head-chatbox"><a class="close-chatbox-button icon-close"></a>
<div class="chat-title">
<a href="#" class="restore-chat">
Lena Grunewald
</a>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
...@@ -458,13 +503,7 @@ $(document).ready(function () { ...@@ -458,13 +503,7 @@ $(document).ready(function () {
$('.toggle-chatbox-button').click(function(ev) { $('.toggle-chatbox-button').click(function(ev) {
var $grandparent = $(ev.target).parent().parent().parent(); var $grandparent = $(ev.target).parent().parent().parent();
$grandparent.find('.chat-body').slideToggle('fast'); $grandparent.fadeOut('fast');
var flyout = $grandparent.find('.box-flyout');
if (flyout.hasClass('minimized')) {
flyout.removeClass('minimized');
} else {
flyout.addClass('minimized');
}
}); });
// Clickable Dropdown // Clickable Dropdown
......
This diff is collapsed.
This diff is collapsed.
...@@ -115,14 +115,14 @@ ...@@ -115,14 +115,14 @@
it("can be saved to, and retrieved from, localStorage", $.proxy(function () { it("can be saved to, and retrieved from, localStorage", $.proxy(function () {
// We instantiate a new ChatBoxes collection, which by default // We instantiate a new ChatBoxes collection, which by default
// will be empty. // will be empty.
spyOn(this.chatboxviews, 'trimOpenChats'); spyOn(this.chatboxviews, 'trimChats');
utils.openControlBox(); utils.openControlBox();
var newchatboxes = new this.ChatBoxes(); var newchatboxes = new this.ChatBoxes();
expect(newchatboxes.length).toEqual(0); expect(newchatboxes.length).toEqual(0);
// The chatboxes will then be fetched from localStorage inside the // The chatboxes will then be fetched from localStorage inside the
// onConnected method // onConnected method
newchatboxes.onConnected(); newchatboxes.onConnected();
expect(this.chatboxviews.trimOpenChats).toHaveBeenCalled(); expect(this.chatboxviews.trimChats).toHaveBeenCalled();
expect(newchatboxes.length).toEqual(2); // XXX: Includes controlbox, is this a bug? expect(newchatboxes.length).toEqual(2); // XXX: Includes controlbox, is this a bug?
// Check that the chatrooms retrieved from localStorage // Check that the chatrooms retrieved from localStorage
// have the same attributes values as the original ones. // have the same attributes values as the original ones.
...@@ -139,33 +139,34 @@ ...@@ -139,33 +139,34 @@
this.rosterview.render(); this.rosterview.render();
}, converse)); }, converse));
it("can be toggled by clicking a DOM element with class 'toggle-chatbox-button'", function () { it("can be minimized by clicking a DOM element with class 'toggle-chatbox-button'", function () {
var view = this.chatboxviews.get('lounge@muc.localhost'), var view = this.chatboxviews.get('lounge@muc.localhost'),
chatroom = view.model, $el; trimmed_chatboxes = this.chatboxviews.trimmed_chatboxes_view;
spyOn(view, 'toggleChatBox').andCallThrough();
spyOn(view, 'minimize').andCallThrough();
spyOn(view, 'maximize').andCallThrough();
spyOn(converse, 'emit'); spyOn(converse, 'emit');
view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
runs(function () { runs(function () {
view.$el.find('.toggle-chatbox-button').click(); view.$el.find('.toggle-chatbox-button').click();
}); });
waits(250); waits(50);
runs(function () { runs(function () {
expect(view.toggleChatBox).toHaveBeenCalled(); expect(view.minimize).toHaveBeenCalled();
expect(converse.emit).toHaveBeenCalledWith('onChatBoxToggled', jasmine.any(Object)); expect(converse.emit).toHaveBeenCalledWith('onChatBoxMinimized', jasmine.any(Object));
expect(converse.emit.callCount, 2); expect(converse.emit.callCount, 2);
expect(view.$el.find('.chat-body').is(':visible')).toBeFalsy(); expect(view.$el.is(':visible')).toBeFalsy();
expect(view.$el.find('.toggle-chatbox-button').hasClass('icon-minus')).toBeFalsy();
expect(view.$el.find('.toggle-chatbox-button').hasClass('icon-plus')).toBeTruthy();
expect(view.model.get('minimized')).toBeTruthy(); expect(view.model.get('minimized')).toBeTruthy();
view.$el.find('.toggle-chatbox-button').click(); expect(view.minimize).toHaveBeenCalled();
trimmedview = trimmed_chatboxes.get(view.model.get('id'));
trimmedview.$("a.restore-chat").click();
}); });
waits(250); waits(50);
runs(function () { runs(function () {
expect(view.toggleChatBox).toHaveBeenCalled(); expect(view.maximize).toHaveBeenCalled();
expect(converse.emit).toHaveBeenCalledWith('onChatBoxToggled', jasmine.any(Object)); expect(converse.emit).toHaveBeenCalledWith('onChatBoxMaximized', jasmine.any(Object));
expect(view.$el.find('.chat-body').is(':visible')).toBeTruthy(); expect(view.$el.is(':visible')).toBeTruthy();
expect(view.$el.find('.toggle-chatbox-button').hasClass('icon-minus')).toBeTruthy();
expect(view.$el.find('.toggle-chatbox-button').hasClass('icon-plus')).toBeFalsy();
expect(view.model.get('minimized')).toBeFalsy(); expect(view.model.get('minimized')).toBeFalsy();
expect(converse.emit.callCount, 3); expect(converse.emit.callCount, 3);
}); });
...@@ -174,16 +175,16 @@ ...@@ -174,16 +175,16 @@
it("can be closed again by clicking a DOM element with class 'close-chatbox-button'", $.proxy(function () { it("can be closed again by clicking a DOM element with class 'close-chatbox-button'", $.proxy(function () {
var view = this.chatboxviews.get('lounge@muc.localhost'), chatroom = view.model, $el; var view = this.chatboxviews.get('lounge@muc.localhost'), chatroom = view.model, $el;
spyOn(view, 'closeChat').andCallThrough(); spyOn(view, 'close').andCallThrough();
spyOn(converse, 'emit'); spyOn(converse, 'emit');
spyOn(converse.connection.muc, 'leave'); spyOn(converse.connection.muc, 'leave');
view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
runs(function () { runs(function () {
view.$el.find('.close-chatbox-button').click(); view.$el.find('.close-chatbox-button').click();
}); });
waits(250); waits(50);
runs(function () { runs(function () {
expect(view.closeChat).toHaveBeenCalled(); expect(view.close).toHaveBeenCalled();
expect(this.connection.muc.leave).toHaveBeenCalled(); expect(this.connection.muc.leave).toHaveBeenCalled();
expect(this.emit).toHaveBeenCalledWith('onChatBoxClosed', jasmine.any(Object)); expect(this.emit).toHaveBeenCalledWith('onChatBoxClosed', jasmine.any(Object));
}.bind(converse)); }.bind(converse));
...@@ -204,7 +205,7 @@ ...@@ -204,7 +205,7 @@
afterEach($.proxy(function () { afterEach($.proxy(function () {
var view = this.chatboxviews.get('problematic@muc.localhost'); var view = this.chatboxviews.get('problematic@muc.localhost');
view.closeChat(); view.close();
}, converse)); }, converse));
it("will show an error message if the room requires a password", $.proxy(function () { it("will show an error message if the room requires a password", $.proxy(function () {
......
...@@ -8,13 +8,10 @@ ...@@ -8,13 +8,10 @@
); );
} (this, function (mock, utils) { } (this, function (mock, utils) {
describe("The Control Box", $.proxy(function (mock, utils) { describe("The Control Box", $.proxy(function (mock, utils) {
beforeEach(function () { beforeEach(function () {
runs(function () { runs(function () {
utils.openControlBox(); utils.openControlBox();
}); });
waits(250);
runs(function () {});
}); });
it("can be opened by clicking a DOM element with class 'toggle-online-users'", $.proxy(function () { it("can be opened by clicking a DOM element with class 'toggle-online-users'", $.proxy(function () {
...@@ -501,8 +498,6 @@ ...@@ -501,8 +498,6 @@
runs(function () { runs(function () {
utils.openControlBox(); utils.openControlBox();
}); });
waits(250);
runs(function () {});
}, converse)); }, converse));
it("contains two tabs, 'Contacts' and 'ChatRooms'", $.proxy(function () { it("contains two tabs, 'Contacts' and 'ChatRooms'", $.proxy(function () {
...@@ -524,8 +519,6 @@ ...@@ -524,8 +519,6 @@
runs(function () { runs(function () {
utils.openControlBox(); utils.openControlBox();
}); });
waits(250);
runs(function () {});
}, converse)); }, converse));
it("is opened by clicking the 'Chatrooms' tab", $.proxy(function () { it("is opened by clicking the 'Chatrooms' tab", $.proxy(function () {
......
...@@ -3,6 +3,7 @@ define("converse-dependencies", [ ...@@ -3,6 +3,7 @@ define("converse-dependencies", [
"moment", "moment",
"locales", "locales",
"backbone.localStorage", "backbone.localStorage",
"backbone.overview",
"jquery.tinysort", "jquery.tinysort",
"jquery.browser", "jquery.browser",
"strophe", "strophe",
......
...@@ -2,6 +2,7 @@ define("converse-dependencies", [ ...@@ -2,6 +2,7 @@ define("converse-dependencies", [
"moment", "moment",
"locales", "locales",
"backbone.localStorage", "backbone.localStorage",
"backbone.overview",
"jquery.tinysort", "jquery.tinysort",
"jquery.browser", "jquery.browser",
"strophe", "strophe",
......
define("converse-templates", [ define("converse-templates", [
"tpl!src/templates/action", "tpl!src/templates/action",
"tpl!src/templates/message",
"tpl!src/templates/new_day",
"tpl!src/templates/info",
"tpl!src/templates/controlbox",
"tpl!src/templates/chatbox",
"tpl!src/templates/toolbar",
"tpl!src/templates/contacts_tab",
"tpl!src/templates/contacts_panel",
"tpl!src/templates/chatrooms_tab",
"tpl!src/templates/login_tab",
"tpl!src/templates/add_contact_dropdown", "tpl!src/templates/add_contact_dropdown",
"tpl!src/templates/add_contact_form", "tpl!src/templates/add_contact_form",
"tpl!src/templates/room_item", "tpl!src/templates/change_status_message",
"tpl!src/templates/room_description", "tpl!src/templates/chat_status",
"tpl!src/templates/room_panel",
"tpl!src/templates/chatroom",
"tpl!src/templates/chatarea", "tpl!src/templates/chatarea",
"tpl!src/templates/chatbox",
"tpl!src/templates/chatroom",
"tpl!src/templates/chatrooms_tab",
"tpl!src/templates/choose_status",
"tpl!src/templates/contacts",
"tpl!src/templates/contacts_panel",
"tpl!src/templates/contacts_tab",
"tpl!src/templates/controlbox",
"tpl!src/templates/controlbox_toggle",
"tpl!src/templates/field",
"tpl!src/templates/form_checkbox",
"tpl!src/templates/form_input", "tpl!src/templates/form_input",
"tpl!src/templates/select_option",
"tpl!src/templates/form_select", "tpl!src/templates/form_select",
"tpl!src/templates/form_checkbox", "tpl!src/templates/info",
"tpl!src/templates/field", "tpl!src/templates/login_panel",
"tpl!src/templates/login_tab",
"tpl!src/templates/message",
"tpl!src/templates/new_day",
"tpl!src/templates/occupant", "tpl!src/templates/occupant",
"tpl!src/templates/roster_item",
"tpl!src/templates/pending_contact", "tpl!src/templates/pending_contact",
"tpl!src/templates/pending_contacts",
"tpl!src/templates/requesting_contact", "tpl!src/templates/requesting_contact",
"tpl!src/templates/requesting_contacts", "tpl!src/templates/requesting_contacts",
"tpl!src/templates/pending_contacts", "tpl!src/templates/room_description",
"tpl!src/templates/contacts", "tpl!src/templates/room_item",
"tpl!src/templates/chat_status", "tpl!src/templates/room_panel",
"tpl!src/templates/change_status_message", "tpl!src/templates/roster_item",
"tpl!src/templates/choose_status", "tpl!src/templates/select_option",
"tpl!src/templates/status_option", "tpl!src/templates/status_option",
"tpl!src/templates/login_panel", "tpl!src/templates/toolbar",
"tpl!src/templates/controlbox_toggle" "tpl!src/templates/trimmed_chat",
"tpl!src/templates/trimmed_chats"
], function () { ], function () {
return { return {
action: arguments[0], action: arguments[0],
message: arguments[1], add_contact_dropdown: arguments[1],
new_day: arguments[2], add_contact_form: arguments[2],
info: arguments[3], change_status_message: arguments[3],
controlbox: arguments[4], chat_status: arguments[4],
chatbox: arguments[5], chatarea: arguments[5],
toolbar: arguments[6], chatbox: arguments[6],
contacts_tab: arguments[7], chatroom: arguments[7],
contacts_panel: arguments[8], chatrooms_tab: arguments[8],
chatrooms_tab: arguments[9], choose_status: arguments[9],
login_tab: arguments[10], contacts: arguments[10],
add_contact_dropdown: arguments[11], contacts_panel: arguments[11],
add_contact_form: arguments[12], contacts_tab: arguments[12],
room_item: arguments[13], controlbox: arguments[13],
room_description: arguments[14], controlbox_toggle: arguments[14],
room_panel: arguments[15], field: arguments[15],
chatroom: arguments[16], form_checkbox: arguments[16],
chatarea: arguments[17], form_input: arguments[17],
form_input: arguments[18], form_select: arguments[18],
select_option: arguments[19], info: arguments[19],
form_select: arguments[20], login_panel: arguments[20],
form_checkbox: arguments[21], login_tab: arguments[21],
field: arguments[22], message: arguments[22],
occupant: arguments[23], new_day: arguments[23],
roster_item: arguments[24], occupant: arguments[24],
pending_contact: arguments[25], pending_contact: arguments[25],
requesting_contact: arguments[26], pending_contacts: arguments[26],
requesting_contacts: arguments[27], requesting_contact: arguments[27],
pending_contacts: arguments[28], requesting_contacts: arguments[28],
contacts: arguments[29], room_description: arguments[29],
chat_status: arguments[30], room_item: arguments[30],
change_status_message: arguments[31], room_panel: arguments[31],
choose_status: arguments[32], roster_item: arguments[32],
status_option: arguments[33], select_option: arguments[33],
login_panel: arguments[34], status_option: arguments[34],
controlbox_toggle: arguments[35] toolbar: arguments[35],
trimmed_chat: arguments[36],
trimmed_chats: arguments[37]
}; };
}); });
<div class="box-flyout {[if (minimized) {]} minimized {[}]}" <div class="box-flyout" style="height: {{height}}px">
{[if (!minimized) {]} style="height: {{height}}px" {[}]}> <div class="dragresize dragresize-tm"></div>
<div class="dragresize dragresize-tm" {[ if (minimized) { ]} style="display:none" {[ } ]}></div>
<div class="chat-head chat-head-chatbox"> <div class="chat-head chat-head-chatbox">
<div class="chat-head-message-count">0</div>
<a class="close-chatbox-button icon-close"></a> <a class="close-chatbox-button icon-close"></a>
<a class="toggle-chatbox-button <a class="toggle-chatbox-button icon-minus"></a>
{[ if (minimized) { ]} icon-plus {[ } ]}
{[ if (!minimized) { ]} icon-minus {[ } ]}
"></a>
<div class="chat-title"> <div class="chat-title">
{[ if (url) { ]} {[ if (url) { ]}
<a href="{{url}}" target="_blank" class="user"> <a href="{{url}}" target="_blank" class="user">
...@@ -19,7 +14,7 @@ ...@@ -19,7 +14,7 @@
</div> </div>
<p class="user-custom-message"><p/> <p class="user-custom-message"><p/>
</div> </div>
<div class="chat-body" {[ if (minimized) { ]} style="display:none" {[ } ]}> <div class="chat-body">
<div class="chat-content"></div> <div class="chat-content"></div>
<form class="sendXMPPMessage" action="" method="post"> <form class="sendXMPPMessage" action="" method="post">
{[ if (show_toolbar) { ]} {[ if (show_toolbar) { ]}
......
<div class="box-flyout {[if (minimized) {]} minimized {[}]}" <div class="box-flyout" style="height: {{height}}px"
{[if (!minimized) {]} style="height: {{height}}px" {[}]}> {[ if (minimized) { ]} style="display:none" {[ } ]}>
<div class="dragresize dragresize-tm" {[ if (minimized) { ]} style="display:none" {[ } ]}></div> <div class="dragresize dragresize-tm"></div>
<div class="chat-head chat-head-chatroom"> <div class="chat-head chat-head-chatroom">
<div class="chat-head-message-count">0</div> <div class="chat-head-message-count">0</div>
<a class="close-chatbox-button icon-close"></a> <a class="close-chatbox-button icon-close"></a>
<a class="toggle-chatbox-button <a class="toggle-chatbox-button icon-minus"></a>
{[ if (minimized) { ]} icon-plus {[ } ]}
{[ if (!minimized) { ]} icon-minus {[ } ]}
"></a>
<a class="configure-chatroom-button icon-wrench" style="display:none"></a> <a class="configure-chatroom-button icon-wrench" style="display:none"></a>
<div class="chat-title"> {{ name }} </div> <div class="chat-title"> {{ name }} </div>
<p class="chatroom-topic"><p/> <p class="chatroom-topic"><p/>
</div> </div>
<div class="chat-body" {[ if (minimized) { ]} style="display:none" {[ } ]}> <div class="chat-body"><span class="spinner centered"/></div>
<span class="spinner centered"/>
</div>
</div> </div>
<a class="close-chatbox-button icon-close"></a>
<div class="chat-title">
<a href="#" class="restore-chat">
<div class="chat-head-message-count">0</div>
{{ title }}
</a>
</div>
<div id="trimmed-chatboxes"><div class="box-flyout"></div></div>
...@@ -6,8 +6,10 @@ ...@@ -6,8 +6,10 @@
<meta name="description" content="Converse.js: A chat client for your website" /> <meta name="description" content="Converse.js: A chat client for your website" />
<link rel="shortcut icon" type="image/png" href="components/jasmine/images/jasmine_favicon.png"> <link rel="shortcut icon" type="image/png" href="components/jasmine/images/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="components/jasmine/src/html/jasmine.css"> <link rel="stylesheet" type="text/css" href="components/jasmine/src/html/jasmine.css">
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css"> <link type="text/css" rel="stylesheet" media="screen" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" media="screen" href="converse.css"> <link type="text/css" rel="stylesheet" media="screen" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
<link type="text/css" rel="stylesheet" media="screen" href="css/theme.css" />
<link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
<script src="main.js"></script> <script src="main.js"></script>
<script data-main="tests/main" src="components/requirejs/require.js"></script> <script data-main="tests/main" src="components/requirejs/require.js"></script>
</head> </head>
...@@ -19,6 +21,5 @@ ...@@ -19,6 +21,5 @@
<h2 id="project_tagline">Tests</h2> <h2 id="project_tagline">Tests</h2>
</header> </header>
</div> </div>
<div id="conversejs"></div>
</body> </body>
</html> </html>
...@@ -45,7 +45,7 @@ require([ ...@@ -45,7 +45,7 @@ require([
auto_subscribe: false, auto_subscribe: false,
animate: false, animate: false,
connection: mock.mock_connection, connection: mock.mock_connection,
testing: true no_trimming: true
}, function (converse) { }, function (converse) {
window.converse = converse; window.converse = converse;
window.crypto = { window.crypto = {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
var i, chatbox; var i, chatbox;
for (i=converse.chatboxes.models.length-1; i>-1; i--) { for (i=converse.chatboxes.models.length-1; i>-1; i--) {
chatbox = converse.chatboxes.models[i]; chatbox = converse.chatboxes.models[i];
converse.chatboxviews.get(chatbox.get('id')).closeChat(); converse.chatboxviews.get(chatbox.get('id')).close();
} }
return this; return this;
}; };
...@@ -22,17 +22,16 @@ ...@@ -22,17 +22,16 @@
var i, chatbox, num_chatboxes = converse.chatboxes.models.length; var i, chatbox, num_chatboxes = converse.chatboxes.models.length;
for (i=num_chatboxes-1; i>-1; i--) { for (i=num_chatboxes-1; i>-1; i--) {
chatbox = converse.chatboxes.models[i]; chatbox = converse.chatboxes.models[i];
converse.chatboxviews.get(chatbox.get('id')).closeChat(); converse.chatboxviews.get(chatbox.get('id')).close();
converse.chatboxviews.get(chatbox.get('id')).$el.remove(); converse.chatboxviews.get(chatbox.get('id')).$el.remove();
} }
converse.chatboxviews.get('controlbox').closeChat(); converse.chatboxviews.get('controlbox').close();
converse.chatboxviews.get('controlbox').$el.remove(); converse.chatboxviews.get('controlbox').$el.remove();
return this; return this;
}; };
utils.initConverse = function () { utils.initConverse = function () {
converse.chatboxes = new converse.ChatBoxes(); converse._initialize();
converse.chatboxviews = new converse.ChatBoxViews({model: converse.chatboxes});
converse.onConnected(); converse.onConnected();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment