Commit 823f93f0 authored by JC Brand's avatar JC Brand

Merge branch 'templates' into 0.8

Conflicts:
	converse.js
parents f2c354b7 18cacdc9
......@@ -3,7 +3,9 @@
"version": "0.7.2",
"devDependencies": {
"jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x",
"otr": "0.2.7"
"otr": "0.2.7",
"requirejs-text": "~2.0.10",
"requirejs-tpl-jfparadis": "*"
},
"dependencies": {
"requirejs": "2.1.8",
......@@ -20,7 +22,9 @@
"strophe.muc": "https://raw.github.com/strophe/strophejs-plugins/02310ad1b8da2962cd05b0f4bceaecca134efed4/muc/strophe.muc.js",
"otr": "0.2.7",
"crypto-js": "~3.1.2",
"almond": "~0.2.6"
"almond": "~0.2.6",
"requirejs-text": "~2.0.10",
"requirejs-tpl-jfparadis": "*"
},
"exportsOverride": {}
}
This diff is collapsed.
require.config({
config = {
paths: {
"jquery": "components/jquery/jquery",
"locales": "locale/locales",
......@@ -6,6 +6,9 @@ require.config({
"underscore": "components/underscore/underscore",
"backbone": "components/backbone/backbone",
"backbone.localStorage": "components/backbone.localStorage/backbone.localStorage",
"text": 'components/requirejs-text/text',
"tpl": 'components/requirejs-tpl-jfparadis/tpl',
"converse-templates": "src/templates",
"strophe": "components/strophe/strophe",
"strophe.muc": "components/strophe.muc/index",
"strophe.roster": "components/strophe.roster/index",
......@@ -30,6 +33,14 @@ require.config({
"converse-dependencies": "src/deps-full"
},
tpl: {
// Use Mustache style syntax for variable interpolation
templateSettings: {
evaluate : /\{\[([\s\S]+?)\]\}/g,
interpolate : /\{\{([\s\S]+?)\}\}/g
}
},
// define module dependencies for modules not using define
shim: {
'backbone': {
......@@ -51,8 +62,11 @@ require.config({
'strophe.vcard': { deps: ['strophe'] },
'strophe.disco': { deps: ['strophe'] }
}
});
};
require(["jquery", "converse"], function(require, $, converse) {
window.converse = converse;
});
if (typeof(require) !== 'undefined') {
require.config(config);
require(["jquery", "converse"], function(require, $, converse) {
window.converse = converse;
});
}
......@@ -19,6 +19,10 @@
utils.openContactsPanel();
});
afterEach(function () {
utils.closeAllChatBoxes();
});
it("is created when you click on a roster item", $.proxy(function () {
var i, $el, click, jid, view;
// openControlBox was called earlier, so the controlbox is
......
......@@ -14,6 +14,10 @@
utils.createNewChatRoom('lounge', 'dummy');
});
afterEach(function () {
utils.closeAllChatBoxes();
});
it("shows users currently present in the room", $.proxy(function () {
var chatroomview = this.chatboxesview.views['lounge@muc.localhost'],
$participant_list;
......
......@@ -164,7 +164,7 @@
expect(this.rosterview.render).toHaveBeenCalled();
expect(converse.emit).toHaveBeenCalledWith('onRosterViewUpdated');
// Check that they are sorted alphabetically
t = this.rosterview.$el.find('dt#pending-xmpp-contacts').siblings('dd.pending-xmpp-contact').text();
t = this.rosterview.$el.find('dt#pending-xmpp-contacts').siblings('dd.pending-xmpp-contact').find('span').text();
expect(t).toEqual(mock.pend_names.slice(0,i+1).sort().join(''));
}
}, converse));
......@@ -351,7 +351,7 @@
});
expect(this.rosterview.render).toHaveBeenCalled();
// Check that they are sorted alphabetically
t = this.rosterview.$el.find('dt#xmpp-contact-requests').siblings('dd.requesting-xmpp-contact').text().replace(/AcceptDecline/g, '');
t = this.rosterview.$el.find('dt#xmpp-contact-requests').siblings('dd.requesting-xmpp-contact').children('div').text().replace(/AcceptDecline/g, '');
expect(t).toEqual(mock.req_names.slice(0,i+1).sort().join(''));
// When a requesting contact is added, the controlbox must
// be opened.
......
define("converse-templates", [
"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_form",
"tpl!src/templates/room_item",
"tpl!src/templates/room_description",
"tpl!src/templates/room_panel",
"tpl!src/templates/chatroom",
"tpl!src/templates/chatarea",
"tpl!src/templates/form_input",
"tpl!src/templates/select_option",
"tpl!src/templates/form_select",
"tpl!src/templates/form_checkbox",
"tpl!src/templates/field",
"tpl!src/templates/occupant",
"tpl!src/templates/roster_item",
"tpl!src/templates/pending_contact",
"tpl!src/templates/requesting_contact",
"tpl!src/templates/requesting_contacts",
"tpl!src/templates/pending_contacts",
"tpl!src/templates/contacts",
"tpl!src/templates/chat_status",
"tpl!src/templates/change_status_message",
"tpl!src/templates/choose_status",
"tpl!src/templates/status_option",
"tpl!src/templates/login_panel",
"tpl!src/templates/controlbox_toggle"
], function () {
return {
action: arguments[0],
message: arguments[1],
new_day: arguments[2],
info: arguments[3],
controlbox: arguments[4],
chatbox: arguments[5],
toolbar: arguments[6],
contacts_tab: arguments[7],
contacts_panel: arguments[8],
chatrooms_tab: arguments[9],
login_tab: arguments[10],
add_contact_dropdown: arguments[11],
add_contact_form: arguments[12],
room_item: arguments[13],
room_description: arguments[14],
room_panel: arguments[15],
chatroom: arguments[16],
chatarea: arguments[17],
form_input: arguments[18],
select_option: arguments[19],
form_select: arguments[20],
form_checkbox: arguments[21],
field: arguments[22],
occupant: arguments[23],
roster_item: arguments[24],
pending_contact: arguments[25],
requesting_contact: arguments[26],
requesting_contacts: arguments[27],
pending_contacts: arguments[28],
contacts: arguments[29],
chat_status: arguments[30],
change_status_message: arguments[31],
choose_status: arguments[32],
status_option: arguments[33],
login_panel: arguments[34],
controlbox_toggle: arguments[35]
};
});
<div class="chat-message {{extra_classes}}">
<span class="chat-message-{{sender}}">{{time}} **{{username}} </span>
<span class="chat-message-content">{{message}}</span>
</div>
<dl class="add-converse-contact dropdown">
<dt id="xmpp-contact-search" class="fancy-dropdown">
<a class="toggle-xmpp-contact-form" href="#"
title="{{label_click_to_chat}}">
<span class="icon-plus"></span>{{label_add_contact}}</a>
</dt>
<dd class="search-xmpp" style="display:none"><ul></ul></dd>
</dl>
<li>
<form class="add-xmpp-contact">
<input type="text"
name="identifier"
class="username"
placeholder="{{label_contact_username}}"/>
<button type="submit">{{label_add}}</button>
</form>
<li>
<form id="set-custom-xmpp-status">
<input type="text" class="custom-xmpp-status" {{status_message}}
placeholder="{{label_custom_status}}"/>
<button type="submit">{{label_save}}</button>
</form>
<div class="xmpp-status">
<a class="choose-xmpp-status {{chat_status}}"
data-value="{{status_message}}"
href="#" title="{{desc_change_status}}">
<span class="icon-{{chat_status}}"></span>{{status_message}}
</a>
<a class="change-xmpp-status-message icon-pencil"
href="#"
title="{{desc_custom_status}}"></a>
</div>
<div class="chat-area">
<div class="chat-content"></div>
<form class="sendXMPPMessage" action="" method="post">
{[ if (show_toolbar) { ]}
<ul class="chat-toolbar no-text-select"></ul>
{[ } ]}
<textarea type="text" class="chat-textarea"
placeholder="{{label_message}}"/>
</form>
</div>
<div class="participants">
<ul class="participant-list"></ul>
</div>
<div class="chat-head chat-head-chatbox">
<a class="close-chatbox-button icon-close"></a>
<a href="{{url}}" target="_blank" class="user">
<div class="chat-title"> {{ fullname }} </div>
</a>
<p class="user-custom-message"><p/>
</div>
<div class="chat-content"></div>
<form class="sendXMPPMessage" action="" method="post">
{[ if (show_toolbar) { ]}
<ul class="chat-toolbar no-text-select"></ul>
{[ } ]}
<textarea
type="text"
class="chat-textarea"
placeholder="{{label_personal_message}}"/>
</form>
<div class="chat-head chat-head-chatroom">
<a class="close-chatbox-button icon-close"></a>
<a class="configure-chatroom-button icon-wrench" style="display:none"></a>
<div class="chat-title"> {{ name }} </div>
<p class="chatroom-topic"><p/>
</div>
<div class="chat-body">
<span class="spinner centered"/>
</div>
<li><a class="s" href="#chatrooms">{{label_rooms}}</a></li>
<dl id="target" class="dropdown">
<dt id="fancy-xmpp-status-select" class="fancy-dropdown"></dt>
<dd><ul class="xmpp-status-menu"></ul></dd>
</dl>
<dt id="xmpp-contacts">{{label_contacts}}</dt>
<form class="set-xmpp-status" action="" method="post">
<span id="xmpp-status-holder">
<select id="select-xmpp-status" style="display:none">
<option value="online">{{label_online}}</option>
<option value="dnd">{{label_busy}}</option>
<option value="away">{{label_away}}</option>
<option value="offline">{{label_offline}}</option>
</select>
</span>
</form>
<li><a class="s current" href="#users">{{label_contacts}}</a></li>
<div class="chat-head oc-chat-head">
<ul id="controlbox-tabs"></ul>
<a class="close-chatbox-button icon-close"></a>
</div>
<div class="controlbox-panes"></div>
<strong class="conn-feedback">{{label_toggle}}</strong>
<strong style="display: none" id="online-count">(0)</strong>
<field var="{{name}}"><value>{{value}}</value></field>
<label>{{label}}<input name="{{name}}" type="{{type}}" {{checked}}></label>
<label>{{label}}<input name="{{name}}" type="{{type}}" value="{{value}}"></label>
<label>{{label}}<select name="{{name}}">{{options}}</select></label>
<div class="chat-info">{{message}}</div>
<form id="converse-login">
<label>{{label_username}}</label>
<input type="username" name="jid">
<label>{{label_password}}</label>
<input type="password" name="password">
<input class="login-submit" type="submit" value="{{label_login}}">
</form">
<li><a class="current" href="#login">{{label_sign_in}}</a></li>
<div class="chat-message {{extra_classes}}">
<span class="chat-message-{{sender}}">{{time}} {{username}}:&nbsp;</span>
<span class="chat-message-content">{{message}}</span>
</div>
<time class="chat-date" datetime="{{isodate}}">{{datestring}}</time>
<li class="{{role}}"
{[ if (role === "moderator") { ]}
title="{{desc_moderator}}"
{[ } ]}
{[ if (role === "participant") { ]}
title="{{desc_participant}}"
{[ } ]}
{[ if (role === "visitor") { ]}
title="{{desc_visitor}}"
{[ } ]}
>{{nick}}</li>
<span>{{fullname}}</span> <a class="remove-xmpp-contact icon-remove" title="{{desc_remove}}" href="#"></a>
<dt id="pending-xmpp-contacts">{{label_pending_contacts}}</dt>
<div>{{fullname}}</div>
<button type="button" class="accept-xmpp-request">{{label_accept}}</button>
<button type="button" class="decline-xmpp-request">{{label_decline}}</button>
<dt id="xmpp-contact-requests">{{label_contact_requests}}</dt>
<!-- FIXME: check markup in mockup -->
<div class="room-info">
<p class="room-info"><strong>{{label_desc}}</strong> {{desc}}</p>
<p class="room-info"><strong>{{label_occ}}</strong> {{occ}}</p>
<p class="room-info"><strong>{{label_features}}</strong>
<ul>
{[ if (passwordprotected) { ]}
<li class="room-info locked">{{label_requires_auth}}</li>
{[ } ]}
{[ if (hidden) { ]}
<li class="room-info">{{label_hidden}}</li>
{[ } ]}
{[ if (membersonly) { ]}
<li class="room-info">{{label_requires_invite}}</li>
{[ } ]}
{[ if (moderated) { ]}
<li class="room-info">{{label_moderated}}</li>
{[ } ]}
{[ if (nonanonymous) { ]}
<li class="room-info">{{label_non_anon}}</li>
{[ } ]}
{[ if (open) { ]}
<li class="room-info">{{label_open_room}}</li>
{[ } ]}
{[ if (persistent) { ]}
<li class="room-info">{{label_permanent_room}}</li>
{[ } ]}
{[ if (publicroom) { ]}
<li class="room-info">{{label_public}}</li>
{[ } ]}
{[ if (semianonymous) { ]}
<li class="room-info">{{label_semi_anon}}</li>
{[ } ]}
{[ if (temporary) { ]}
<li class="room-info">{{label_temp_room}}</li>
{[ } ]}
{[ if (unmoderated) { ]}
<li class="room-info">{{label_unmoderated}}</li>
{[ } ]}
</ul>
</p>
</div>
<dd class="available-chatroom">
<a class="open-room" data-room-jid="{{jid}}"
title="{{open_title}}" href="#">{{name}}</a>
<a class="room-info icon-room-info" data-room-jid="{{jid}}"
title="{{info_title}}" href="#">&nbsp;</a>
</dd>
<form class="add-chatroom" action="" method="post">
<input type="text" name="chatroom" class="new-chatroom-name"
placeholder="{{label_room_name}}"/>
<input type="text" name="nick" class="new-chatroom-nick"
placeholder="{{label_nickname}}"/>
<input type="{{server_input_type}}" name="server" class="new-chatroom-server"
placeholder="{{label_server}}"/>
<input type="submit" name="join" value="{{label_join}}"/>
<input type="button" name="show" id="show-rooms" value="{{label_show_rooms}}"/>
</form>
<dl id="available-chatrooms"></dl>
<a class="open-chat" title="{{desc_chat}}" href="#"><span class="icon-{{chat_status}}" title="{{desc_status}}"></span>{{fullname}}</a>
<a class="remove-xmpp-contact icon-remove" title="{{desc_remove}}" href="#"></a>
<li>
<form class="search-xmpp-contact">
<input type="text"
name="identifier"
class="username"
placeholder="{{label_contact_name}}"/>
<button type="submit">{{label_search}}</button>
</form>
<li>
<option value="{{value}}">{{label}}</option>
<li>
<a href="#" class="{{ value }}" data-value="{{ value }}">
<span class="icon-{{ value }}"></span>
{{ text }}
</a>
</li>
{[ if (show_emoticons) { ]}
<li class="toggle-smiley icon-happy" title="Insert a smilery">
<ul>
<li><a class="icon-smiley" href="#" data-emoticon=":)"></a></li>
<li><a class="icon-wink" href="#" data-emoticon=";)"></a></li>
<li><a class="icon-grin" href="#" data-emoticon=":D"></a></li>
<li><a class="icon-tongue" href="#" data-emoticon=":P"></a></li>
<li><a class="icon-cool" href="#" data-emoticon="8)"></a></li>
<li><a class="icon-evil" href="#" data-emoticon=">:)"></a></li>
<li><a class="icon-confused" href="#" data-emoticon=":S"></a></li>
<li><a class="icon-wondering" href="#" data-emoticon=":\"></a></li>
<li><a class="icon-angry" href="#" data-emoticon=">:("></a></li>
<li><a class="icon-sad" href="#" data-emoticon=":("></a></li>
<li><a class="icon-shocked" href="#" data-emoticon=":O"></a></li>
<li><a class="icon-thumbs-up" href="#" data-emoticon="(^.^)b"></a></li>
<li><a class="icon-heart" href="#" data-emoticon="<3"></a></li>
</ul>
</li>
{[ } ]}
{[ if (show_call_button) { ]}
<li><a class="toggle-call icon-phone" title="Start a call"></a></li>
{[ } ]}
{[ if (allow_otr) { ]}
<li class="toggle-otr {{otr_status_class}}" title="{{otr_tooltip}}">
<span class="chat-toolbar-text">{{otr_translated_status}}</span>
{[ if (otr_status == UNENCRYPTED) { ]}
<span class="icon-unlocked"></span>
{[ } ]}
{[ if (otr_status == UNVERIFIED) { ]}
<span class="icon-lock"></span>
{[ } ]}
{[ if (otr_status == VERIFIED) { ]}
<span class="icon-lock"></span>
{[ } ]}
{[ if (otr_status == FINISHED) { ]}
<span class="icon-unlocked"></span>
{[ } ]}
<ul>
{[ if (otr_status == UNENCRYPTED) { ]}
<li><a class="start-otr" href="#">{{label_start_encrypted_conversation}}</a></li>
{[ } ]}
{[ if (otr_status != UNENCRYPTED) { ]}
<li><a class="start-otr" href="#">{{label_start_encrypted_conversation}}</a></li>
<li><a class="end-otr" href="#">{{label_end_encrypted_conversation}}</a></li>
<li><a class="auth-otr" data-scheme="smp" href="#">{{label_verify_with_smp}}</a></li>
{[ } ]}
{[ if (otr_status == UNVERIFIED) { ]}
<li><a class="auth-otr" data-scheme="fingerprint" href="#">{{label_verify_with_fingerprints}}</a></li>
{[ } ]}
<li><a href="http://www.cypherpunks.ca/otr/help/3.2.0/levels.php" target="_blank">{{label_whats_this}}</a></li>
</ul>
</li>
{[ } ]}
......@@ -8,6 +8,7 @@
<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 rel="stylesheet" type="text/css" media="screen" href="converse.css">
<script src="main.js"></script>
<script data-main="tests_main" src="components/requirejs/require.js"></script>
</head>
......
require.config({
paths: {
"jquery": "components/jquery/jquery",
"locales": "locale/locales",
"jquery.tinysort": "components/tinysort/src/jquery.tinysort",
"underscore": "components/underscore/underscore",
"backbone": "components/backbone/backbone",
"backbone.localStorage": "components/backbone.localStorage/backbone.localStorage",
"strophe": "components/strophe/strophe",
"strophe.muc": "components/strophe.muc/index",
"strophe.roster": "components/strophe.roster/index",
"strophe.vcard": "components/strophe.vcard/index",
"strophe.disco": "components/strophe.disco/index",
"salsa20": "components/otr/build/dep/salsa20",
"bigint": "src/bigint",
"crypto.core": "components/otr/vendor/cryptojs/core",
"crypto.enc-base64": "components/otr/vendor/cryptojs/enc-base64",
"crypto.md5": "components/crypto-js/src/md5",
"crypto.evpkdf": "components/crypto-js/src/evpkdf",
"crypto.cipher-core": "components/otr/vendor/cryptojs/cipher-core",
"crypto.aes": "components/otr/vendor/cryptojs/aes",
"crypto.sha1": "components/otr/vendor/cryptojs/sha1",
"crypto.sha256": "components/otr/vendor/cryptojs/sha256",
"crypto.hmac": "components/otr/vendor/cryptojs/hmac",
"crypto.pad-nopadding": "components/otr/vendor/cryptojs/pad-nopadding",
"crypto.mode-ctr": "components/otr/vendor/cryptojs/mode-ctr",
"crypto": "src/crypto",
"eventemitter": "components/otr/build/dep/eventemitter",
"otr": "components/otr/build/otr",
"converse-dependencies": "src/deps-full",
// Extra test dependencies
"mock": "tests/mock",
"utils": "tests/utils",
"jasmine": "components/jasmine/lib/jasmine-core/jasmine",
"jasmine-html": "components/jasmine/lib/jasmine-core/jasmine-html",
"jasmine-console-reporter": "node_modules/jasmine-reporters/src/jasmine.console_reporter",
"jasmine-junit-reporter": "node_modules/jasmine-reporters/src/jasmine.junit_reporter"
},
// Extra test dependencies
config.paths.mock = "tests/mock";
config.paths.utils = "tests/utils";
config.paths.jasmine = "components/jasmine/lib/jasmine-core/jasmine";
config.paths["jasmine-html"] = "components/jasmine/lib/jasmine-core/jasmine-html";
config.paths["jasmine-console-reporter"] = "node_modules/jasmine-reporters/src/jasmine.console_reporter";
config.paths["jasmine-junit-reporter"] = "node_modules/jasmine-reporters/src/jasmine.junit_reporter";
// define module dependencies for modules not using define
shim: {
'backbone': {
//These script dependencies should be loaded before loading
//backbone.js
deps: [
'underscore',
'jquery'
],
//Once loaded, use the global 'Backbone' as the
//module value.
exports: 'Backbone'
},
'jquery.tinysort': { deps: ['jquery'] },
'strophe': { deps: ['jquery'] },
'underscore': { exports: '_' },
'strophe.muc': { deps: ['strophe', 'jquery'] },
'strophe.roster': { deps: ['strophe'] },
'strophe.vcard': { deps: ['strophe'] },
'strophe.disco': { deps: ['strophe'] },
// Extra test dependencies
'jasmine-html': {
deps: ['jasmine'],
exports: 'jasmine'
},
'jasmine-console-reporter': {
deps: ['jasmine-html'],
exports: 'jasmine'
},
'jasmine-junit-reporter': {
deps: ['jasmine-html'],
exports: 'jasmine'
}
}
});
config.shim['jasmine-html'] = {
deps: ['jasmine'],
exports: 'jasmine'
};
config.shim['jasmine-console-reporter'] = {
deps: ['jasmine-html'],
exports: 'jasmine'
};
config.shim['jasmine-junit-reporter'] = {
deps: ['jasmine-html'],
exports: 'jasmine'
};
require.config(config);
// Polyfill 'bind' which is not available in phantomjs < 2.0
if (!Function.prototype.bind) {
......
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