Refactor single-page-app page assembly
This commit is contained in:
parent
88ff347744
commit
985403894f
|
@ -1,79 +0,0 @@
|
||||||
<div id="main-tabs-bodies">
|
|
||||||
<div id="main-tab-body-contacts">
|
|
||||||
<h2>Add a new contact</h2>
|
|
||||||
<form class="form-inline">
|
|
||||||
<label for="add-contact-email">New contact email: </label>
|
|
||||||
<input class="form-control" id="add-contact-email" type="email">
|
|
||||||
<button class="btn btn-default" id="add-contact">Add contact</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<h2>Contact List</h2>
|
|
||||||
<div class="container">
|
|
||||||
<div class="contact-list" class="row"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="main-tab-body-new-chat">
|
|
||||||
<h2>New Conversation</h2>
|
|
||||||
<div class="container">
|
|
||||||
<div class="contact-list" class="row"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="main-tab-body-conversations">
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-4">
|
|
||||||
<div id="conversation-list">
|
|
||||||
</div>
|
|
||||||
<div class="align-center">
|
|
||||||
<a class="big-icon text-gray-dark" href="#/new-chat"><i class="cursor-interactive icon ion-plus-circled"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-8">
|
|
||||||
<p class="align-center">
|
|
||||||
Select a conversation from the column to the left,
|
|
||||||
or <a href="#/new-chat">create a new conversation</a>.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="main-tab-body-permissions">
|
|
||||||
<h2>Permissions I enjoy</h2>
|
|
||||||
<ul id="permissions"></ul>
|
|
||||||
|
|
||||||
<h2>Permissions I have granted to others</h2>
|
|
||||||
<ul id="grants"></ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="main-tab-body-questions">
|
|
||||||
<h2>Questions</h2>
|
|
||||||
<p class="show-only-zero-count count{{questionCount}}">There are no questions waiting for you to answer.</p>
|
|
||||||
<div class="container">
|
|
||||||
<div id="question-container" class="row"></div>
|
|
||||||
</div>
|
|
||||||
<div class="hide-zero-count count{{otherRequestCount}}">
|
|
||||||
<p>
|
|
||||||
<label for="show-all-requests-from-others">Show all pending requests from others? </label>
|
|
||||||
<input type="checkbox" id="show-all-requests-from-others" {{#showRequestsFromOthers}}checked{{/showRequestsFromOthers}}>
|
|
||||||
</p>
|
|
||||||
{{#showRequestsFromOthers}}
|
|
||||||
<div id="all-requests-from-others-div">
|
|
||||||
<h2>All requests from others</h2>
|
|
||||||
<ul id="others-permission-requests"></ul>
|
|
||||||
</div>
|
|
||||||
{{/showRequestsFromOthers}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="main-tab-body-my-requests">
|
|
||||||
<h2>Requests I have made</h2>
|
|
||||||
<p class="show-only-zero-count count{{myRequestCount}}">You have no outstanding requests waiting for responses from others.</p>
|
|
||||||
<ul id="my-permission-requests"></ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<!-- <pre id="debug-space"></pre> -->
|
|
||||||
</div>
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<h2>Add a new contact</h2>
|
||||||
|
<form class="form-inline">
|
||||||
|
<label for="add-contact-email">New contact email: </label>
|
||||||
|
<input class="form-control" id="add-contact-email" type="email">
|
||||||
|
<button class="btn btn-default" id="add-contact">Add contact</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<h2>Contact List</h2>
|
||||||
|
<div class="container">
|
||||||
|
<div class="contact-list" class="row"></div>
|
||||||
|
</div>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-4">
|
||||||
|
<div id="conversation-list">
|
||||||
|
</div>
|
||||||
|
<div class="align-center">
|
||||||
|
<a class="big-icon text-gray-dark" href="#/new-chat"><i class="cursor-interactive icon ion-plus-circled"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<p class="align-center">
|
||||||
|
Select a conversation from the column to the left,
|
||||||
|
or <a href="#/new-chat">create a new conversation</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<h2>Requests I have made</h2>
|
||||||
|
<p class="show-only-zero-count count{{myRequestCount}}">You have no outstanding requests waiting for responses from others.</p>
|
||||||
|
<ul id="my-permission-requests"></ul>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<h2>New Conversation</h2>
|
||||||
|
<div class="container">
|
||||||
|
<div class="contact-list" class="row"></div>
|
||||||
|
</div>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<h2>Permissions I enjoy</h2>
|
||||||
|
<ul id="permissions"></ul>
|
||||||
|
|
||||||
|
<h2>Permissions I have granted to others</h2>
|
||||||
|
<ul id="grants"></ul>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<h2>Questions</h2>
|
||||||
|
<p class="show-only-zero-count count{{questionCount}}">There are no questions waiting for you to answer.</p>
|
||||||
|
<div class="container">
|
||||||
|
<div id="question-container" class="row"></div>
|
||||||
|
</div>
|
||||||
|
<div class="hide-zero-count count{{otherRequestCount}}">
|
||||||
|
<p>
|
||||||
|
<label for="show-all-requests-from-others">Show all pending requests from others? </label>
|
||||||
|
<input type="checkbox" id="show-all-requests-from-others" {{#showRequestsFromOthers}}checked{{/showRequestsFromOthers}}>
|
||||||
|
</p>
|
||||||
|
{{#showRequestsFromOthers}}
|
||||||
|
<div id="all-requests-from-others-div">
|
||||||
|
<h2>All requests from others</h2>
|
||||||
|
<ul id="others-permission-requests"></ul>
|
||||||
|
</div>
|
||||||
|
{{/showRequestsFromOthers}}
|
||||||
|
</div>
|
|
@ -88,6 +88,8 @@
|
||||||
|
|
||||||
actor {
|
actor {
|
||||||
this.ui = new Syndicate.UI.Anchor();
|
this.ui = new Syndicate.UI.Anchor();
|
||||||
|
var mainpage_c = this.ui.context('mainpage');
|
||||||
|
|
||||||
field this.connectedTo = null;
|
field this.connectedTo = null;
|
||||||
field this.myRequestCount = 0; // requests *I* have made of others
|
field this.myRequestCount = 0; // requests *I* have made of others
|
||||||
field this.otherRequestCount = 0; // requests *others* have made of me
|
field this.otherRequestCount = 0; // requests *others* have made of me
|
||||||
|
@ -101,60 +103,48 @@
|
||||||
on asserted brokerConnected($url) { this.connectedTo = url; }
|
on asserted brokerConnected($url) { this.connectedTo = url; }
|
||||||
on retracted brokerConnected(_) { this.connectedTo = null; }
|
on retracted brokerConnected(_) { this.connectedTo = null; }
|
||||||
|
|
||||||
var mainpage_c = this.ui.context('mainpage');
|
|
||||||
during inbound(uiTemplate("mainpage.html", $mainpage)) {
|
|
||||||
assert mainpage_c.html('div#main-div', Mustache.render(
|
|
||||||
mainpage,
|
|
||||||
{
|
|
||||||
questionCount: this.questionCount,
|
|
||||||
myRequestCount: this.myRequestCount,
|
|
||||||
otherRequestCount: this.otherRequestCount,
|
|
||||||
globallyVisible: this.globallyVisible,
|
|
||||||
showRequestsFromOthers: this.showRequestsFromOthers
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
during inbound(online()) {
|
during inbound(online()) {
|
||||||
on start { this.globallyVisible = true; }
|
on start { this.globallyVisible = true; }
|
||||||
on stop { this.globallyVisible = false; }
|
on stop { this.globallyVisible = false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
during mainpage_c.fragmentVersion($mainpageVersion) {
|
during inbound(uiTemplate("nav-account.html", $entry)) {
|
||||||
// We track mainpageVersion so that changes to mainpage.html force re-creation
|
var c = this.ui.context('nav', 0, 'account');
|
||||||
// of nested widgetry. If we didn't include mainpageVersion in each subwidget's
|
assert outbound(online()) when (this.locallyVisible);
|
||||||
// context, then so long as the subwidget's content itself remained unchanged,
|
assert c.html('#nav-ul', Mustache.render(
|
||||||
// the user would see the subwidget disappear when mainpage.html changed.
|
entry,
|
||||||
|
{
|
||||||
on asserted Syndicate.UI.locationHash($hash) {
|
email: sessionInfo.email,
|
||||||
var tab = hash.substr(1);
|
avatar: avatar(sessionInfo.email),
|
||||||
console.log("Switching tab to", tab);
|
questionCount: this.questionCount,
|
||||||
$('#main-tabs-bodies > div').hide();
|
myRequestCount: this.myRequestCount,
|
||||||
$('#main-tabs-tabs a.nav-link').removeClass('active');
|
otherRequestCount: this.otherRequestCount,
|
||||||
$('#main-tab-body-' + tab).show();
|
globallyVisible: this.globallyVisible,
|
||||||
$('#main-tab-tab-' + tab).addClass('active');
|
locallyVisible: this.locallyVisible
|
||||||
|
}));
|
||||||
|
on message c.event('.toggleInvisible', 'click', _) {
|
||||||
|
this.locallyVisible = !this.locallyVisible;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
during inbound(uiTemplate("nav-account.html", $entry)) {
|
// assert mainpage_c.html('div#main-div', Mustache.render(
|
||||||
var c = this.ui.context(mainpageVersion, 'nav', 0, 'account');
|
// mainpage,
|
||||||
assert outbound(online()) when (this.locallyVisible);
|
// {
|
||||||
assert c.html('#nav-ul', Mustache.render(
|
// questionCount: this.questionCount,
|
||||||
entry,
|
// myRequestCount: this.myRequestCount,
|
||||||
{
|
// otherRequestCount: this.otherRequestCount,
|
||||||
email: sessionInfo.email,
|
// globallyVisible: this.globallyVisible,
|
||||||
avatar: avatar(sessionInfo.email),
|
// showRequestsFromOthers: this.showRequestsFromOthers
|
||||||
questionCount: this.questionCount,
|
// }));
|
||||||
myRequestCount: this.myRequestCount,
|
|
||||||
otherRequestCount: this.otherRequestCount,
|
|
||||||
globallyVisible: this.globallyVisible,
|
during Syndicate.UI.locationHash('/contacts') {
|
||||||
locallyVisible: this.locallyVisible
|
during inbound(uiTemplate("page-contacts.html", $mainEntry)) {
|
||||||
}));
|
assert mainpage_c.html('div#main-div', Mustache.render(mainEntry, {}));
|
||||||
on message c.event('.toggleInvisible', 'click', _) {
|
|
||||||
this.locallyVisible = !this.locallyVisible;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
during inbound(uiTemplate("contact-entry.html", $entry)) {
|
during inbound(uiTemplate("contact-entry.html", $entry)) {
|
||||||
during Syndicate.UI.locationHash('/contacts') {
|
during mainpage_c.fragmentVersion($mainpageVersion) {
|
||||||
during inbound(contactListEntry(sessionInfo.email, $contact)) {
|
during inbound(contactListEntry(sessionInfo.email, $contact)) {
|
||||||
field this.pendingContactRequest = false;
|
field this.pendingContactRequest = false;
|
||||||
field this.isPresent = false;
|
field this.isPresent = false;
|
||||||
|
@ -167,13 +157,12 @@
|
||||||
on stop { this.pendingContactRequest = false; }
|
on stop { this.pendingContactRequest = false; }
|
||||||
}
|
}
|
||||||
var c = this.ui.context(mainpageVersion, 'all-contacts', contact);
|
var c = this.ui.context(mainpageVersion, 'all-contacts', contact);
|
||||||
assert c.html('#main-tab-body-contacts .contact-list',
|
assert c.html('.contact-list', Mustache.render(entry, {
|
||||||
Mustache.render(entry, {
|
email: contact,
|
||||||
email: contact,
|
avatar: avatar(contact),
|
||||||
avatar: avatar(contact),
|
pendingContactRequest: this.pendingContactRequest,
|
||||||
pendingContactRequest: this.pendingContactRequest,
|
isPresent: this.isPresent
|
||||||
isPresent: this.isPresent
|
}));
|
||||||
}));
|
|
||||||
on message c.event('.delete-contact', 'click', _) {
|
on message c.event('.delete-contact', 'click', _) {
|
||||||
if (confirm((this.pendingContactRequest
|
if (confirm((this.pendingContactRequest
|
||||||
? "Cancel contact request to "
|
? "Cancel contact request to "
|
||||||
|
@ -189,146 +178,199 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
during inputValue('#add-contact-email', $rawContact) {
|
during mainpage_c.fragmentVersion($mainpageVersion) {
|
||||||
var contact = rawContact.trim();
|
during inputValue('#add-contact-email', $rawContact) {
|
||||||
if (contact) {
|
var contact = rawContact.trim();
|
||||||
on message mainpage_c.event('#add-contact', 'click', _) {
|
if (contact) {
|
||||||
:: outbound(createResource(grant(sessionInfo.email,
|
on message mainpage_c.event('#add-contact', 'click', _) {
|
||||||
sessionInfo.email,
|
:: outbound(createResource(grant(sessionInfo.email,
|
||||||
contact,
|
sessionInfo.email,
|
||||||
pFollow(sessionInfo.email),
|
contact,
|
||||||
false)));
|
pFollow(sessionInfo.email),
|
||||||
$('#add-contact-email').val('');
|
false)));
|
||||||
|
$('#add-contact-email').val('');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
during Syndicate.UI.locationHash('/permissions') {
|
||||||
|
during inbound(uiTemplate("page-permissions.html", $mainEntry)) {
|
||||||
|
assert mainpage_c.html('div#main-div', Mustache.render(mainEntry, {}));
|
||||||
|
}
|
||||||
|
|
||||||
during inbound(uiTemplate("permission-entry.html", $entry)) {
|
during inbound(uiTemplate("permission-entry.html", $entry)) {
|
||||||
during inbound(permitted($i, $e, $p, $d)) {
|
during mainpage_c.fragmentVersion($mainpageVersion) {
|
||||||
if (i !== sessionInfo.email) {
|
during inbound(permitted($i, $e, $p, $d)) {
|
||||||
var c = this.ui.context(mainpageVersion, 'permitted', i, e, p, d);
|
if (i !== sessionInfo.email) {
|
||||||
assert c.html('#permissions', Mustache.render(entry,
|
var c = this.ui.context(mainpageVersion, 'permitted', i, e, p, d);
|
||||||
{issuer: i,
|
assert c.html('#permissions', Mustache.render(entry, {
|
||||||
email: e,
|
issuer: i,
|
||||||
permission: JSON.stringify(p),
|
email: e,
|
||||||
isDelegable: d,
|
permission: JSON.stringify(p),
|
||||||
isRelinquishable: i !== e}));
|
isDelegable: d,
|
||||||
on message c.event('.relinquish', 'click', _) {
|
isRelinquishable: i !== e
|
||||||
:: outbound(deleteResource(permitted(i, e, p, d)));
|
}));
|
||||||
|
on message c.event('.relinquish', 'click', _) {
|
||||||
|
:: outbound(deleteResource(permitted(i, e, p, d)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
during inbound(uiTemplate("grant-entry.html", $entry)) {
|
during inbound(uiTemplate("grant-entry.html", $entry)) {
|
||||||
during inbound(grant($i, sessionInfo.email, $ge, $p, $d)) {
|
during mainpage_c.fragmentVersion($mainpageVersion) {
|
||||||
var c = this.ui.context(mainpageVersion, 'granted', i, ge, p, d);
|
during inbound(grant($i, sessionInfo.email, $ge, $p, $d)) {
|
||||||
assert c.html('#grants', Mustache.render(entry, {issuer: i,
|
var c = this.ui.context(mainpageVersion, 'granted', i, ge, p, d);
|
||||||
grantee: ge,
|
assert c.html('#grants', Mustache.render(entry, {
|
||||||
permission: JSON.stringify(p),
|
issuer: i,
|
||||||
isDelegable: d}));
|
grantee: ge,
|
||||||
on message c.event('.revoke', 'click', _) {
|
permission: JSON.stringify(p),
|
||||||
:: outbound(deleteResource(grant(i, sessionInfo.email, ge, p, d)));
|
isDelegable: d
|
||||||
|
}));
|
||||||
|
on message c.event('.revoke', 'click', _) {
|
||||||
|
:: outbound(deleteResource(grant(i, sessionInfo.email, ge, p, d)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
during Syndicate.UI.locationHash('/my-requests') {
|
||||||
|
during inbound(uiTemplate("page-my-requests.html", $mainEntry)) {
|
||||||
|
assert mainpage_c.html('div#main-div', Mustache.render(mainEntry, {
|
||||||
|
myRequestCount: this.myRequestCount
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
during inbound(uiTemplate("permission-request-out-GENERIC.html", $genericEntry)) {
|
during inbound(uiTemplate("permission-request-out-GENERIC.html", $genericEntry)) {
|
||||||
during inbound(permissionRequest($issuer, sessionInfo.email, $permission)) {
|
during mainpage_c.fragmentVersion($mainpageVersion) {
|
||||||
on start { this.myRequestCount++; }
|
during inbound(permissionRequest($issuer, sessionInfo.email, $permission)) {
|
||||||
on stop { this.myRequestCount--; }
|
on start { this.myRequestCount++; }
|
||||||
|
on stop { this.myRequestCount--; }
|
||||||
|
|
||||||
var c = this.ui.context(mainpageVersion, 'my-permission-request', issuer, permission);
|
var c = this.ui.context(mainpageVersion, 'my-permission-request', issuer, permission);
|
||||||
field this.entry = genericEntry;
|
|
||||||
assert c.html('#my-permission-requests',
|
|
||||||
Mustache.render(this.entry,
|
|
||||||
{issuer: issuer,
|
|
||||||
permission: permission,
|
|
||||||
permissionJSON: JSON.stringify(permission)}))
|
|
||||||
when (this.entry);
|
|
||||||
var specificTemplate = "permission-request-out-" +
|
|
||||||
encodeURIComponent(permission.meta.label) + ".html";
|
|
||||||
on asserted inbound(uiTemplate(specificTemplate, $specificEntry)) {
|
|
||||||
this.entry = specificEntry || genericEntry;
|
|
||||||
}
|
|
||||||
on message c.event('.cancel', 'click', _) {
|
|
||||||
:: outbound(deleteResource(permissionRequest(issuer, sessionInfo.email, permission)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
during inputValue('#show-all-requests-from-others', $showRequestsFromOthers) {
|
|
||||||
on start { this.showRequestsFromOthers = showRequestsFromOthers; }
|
|
||||||
}
|
|
||||||
|
|
||||||
during inbound(uiTemplate("permission-request-in-GENERIC.html", $genericEntry)) {
|
|
||||||
during inbound(permissionRequest($issuer, $grantee, $permission)) {
|
|
||||||
if (grantee !== sessionInfo.email) {
|
|
||||||
on start { this.otherRequestCount++; }
|
|
||||||
on stop { this.otherRequestCount--; }
|
|
||||||
|
|
||||||
var c = this.ui.context(mainpageVersion, 'others-permission-request', issuer, grantee, permission);
|
|
||||||
field this.entry = genericEntry;
|
field this.entry = genericEntry;
|
||||||
assert c.html('#others-permission-requests',
|
assert c.html('#my-permission-requests', Mustache.render(this.entry, {
|
||||||
Mustache.render(this.entry,
|
issuer: issuer,
|
||||||
{issuer: issuer,
|
permission: permission,
|
||||||
grantee: grantee,
|
permissionJSON: JSON.stringify(permission)
|
||||||
permission: permission,
|
})) when (this.entry);
|
||||||
permissionJSON: JSON.stringify(permission)}))
|
var specificTemplate = "permission-request-out-" +
|
||||||
when (this.entry);
|
|
||||||
var specificTemplate = "permission-request-in-" +
|
|
||||||
encodeURIComponent(permission.meta.label) + ".html";
|
encodeURIComponent(permission.meta.label) + ".html";
|
||||||
on asserted inbound(uiTemplate(specificTemplate, $specificEntry)) {
|
on asserted inbound(uiTemplate(specificTemplate, $specificEntry)) {
|
||||||
this.entry = specificEntry || genericEntry;
|
this.entry = specificEntry || genericEntry;
|
||||||
}
|
}
|
||||||
on message c.event('.grant', 'click', _) {
|
on message c.event('.cancel', 'click', _) {
|
||||||
:: outbound(createResource(grant(issuer,
|
:: outbound(deleteResource(permissionRequest(issuer, sessionInfo.email, permission)));
|
||||||
sessionInfo.email,
|
|
||||||
grantee,
|
|
||||||
permission,
|
|
||||||
false)));
|
|
||||||
}
|
}
|
||||||
on message c.event('.deny', 'click', _) {
|
}
|
||||||
:: outbound(deleteResource(permissionRequest(issuer, grantee, permission)));
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
during Syndicate.UI.locationHash('/questions') {
|
||||||
|
during inbound(uiTemplate("page-questions.html", $mainEntry)) {
|
||||||
|
assert mainpage_c.html('div#main-div', Mustache.render(mainEntry, {
|
||||||
|
questionCount: this.questionCount,
|
||||||
|
otherRequestCount: this.otherRequestCount,
|
||||||
|
showRequestsFromOthers: this.showRequestsFromOthers
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
during mainpage_c.fragmentVersion($mainpageVersion) {
|
||||||
|
during inputValue('#show-all-requests-from-others', $showRequestsFromOthers) {
|
||||||
|
on start { this.showRequestsFromOthers = showRequestsFromOthers; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
during inbound(uiTemplate("permission-request-in-GENERIC.html", $genericEntry)) {
|
||||||
|
during mainpage_c.fragmentVersion($mainpageVersion) {
|
||||||
|
during inbound(permissionRequest($issuer, $grantee, $permission)) {
|
||||||
|
if (grantee !== sessionInfo.email) {
|
||||||
|
on start { this.otherRequestCount++; }
|
||||||
|
on stop { this.otherRequestCount--; }
|
||||||
|
|
||||||
|
var c = this.ui.context(mainpageVersion, 'others-permission-request', issuer, grantee, permission);
|
||||||
|
field this.entry = genericEntry;
|
||||||
|
assert c.html('#others-permission-requests', Mustache.render(this.entry, {
|
||||||
|
issuer: issuer,
|
||||||
|
grantee: grantee,
|
||||||
|
permission: permission,
|
||||||
|
permissionJSON: JSON.stringify(permission)
|
||||||
|
})) when (this.entry);
|
||||||
|
var specificTemplate = "permission-request-in-" +
|
||||||
|
encodeURIComponent(permission.meta.label) + ".html";
|
||||||
|
on asserted inbound(uiTemplate(specificTemplate, $specificEntry)) {
|
||||||
|
this.entry = specificEntry || genericEntry;
|
||||||
|
}
|
||||||
|
on message c.event('.grant', 'click', _) {
|
||||||
|
:: outbound(createResource(grant(issuer,
|
||||||
|
sessionInfo.email,
|
||||||
|
grantee,
|
||||||
|
permission,
|
||||||
|
false)));
|
||||||
|
}
|
||||||
|
on message c.event('.deny', 'click', _) {
|
||||||
|
:: outbound(deleteResource(permissionRequest(issuer, grantee, permission)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
during inbound(question($qid, $timestamp, $klass, sessionInfo.email, $title, $blurb, $qt))
|
during mainpage_c.fragmentVersion($mainpageVersion) {
|
||||||
{
|
during
|
||||||
on start { this.questionCount++; }
|
inbound(question($qid, $timestamp, $klass, sessionInfo.email, $title, $blurb, $qt))
|
||||||
on stop { this.questionCount--; }
|
{
|
||||||
|
on start { this.questionCount++; }
|
||||||
|
on stop { this.questionCount--; }
|
||||||
|
|
||||||
var c = this.ui.context(mainpageVersion, 'question', timestamp, qid);
|
var c = this.ui.context(mainpageVersion, 'question', timestamp, qid);
|
||||||
|
|
||||||
switch (qt.meta.label) {
|
switch (qt.meta.label) {
|
||||||
case "option-question": {
|
case "option-question": {
|
||||||
var options = qt.fields[0];
|
var options = qt.fields[0];
|
||||||
during inbound(uiTemplate("option-question.html", $entry)) {
|
during inbound(uiTemplate("option-question.html", $entry)) {
|
||||||
assert c.html('#question-container',
|
assert c.html('#question-container', Mustache.render(entry, {
|
||||||
Mustache.render(entry, {questionClass: klass,
|
questionClass: klass,
|
||||||
title: title,
|
title: title,
|
||||||
blurb: blurb,
|
blurb: blurb,
|
||||||
options: options}));
|
options: options
|
||||||
on message c.event('.response', 'click', $e) {
|
}));
|
||||||
react { assert outbound(answer(qid, e.target.dataset.value)); }
|
on message c.event('.response', 'click', $e) {
|
||||||
|
react { assert outbound(answer(qid, e.target.dataset.value)); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
during Syndicate.UI.locationHash('/conversations') {
|
||||||
|
during inbound(uiTemplate("page-conversations.html", $mainEntry)) {
|
||||||
|
assert mainpage_c.html('div#main-div', Mustache.render(mainEntry, {}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
during Syndicate.UI.locationHash('/new-chat') {
|
||||||
|
during inbound(uiTemplate("page-new-chat.html", $mainEntry)) {
|
||||||
|
assert mainpage_c.html('div#main-div', Mustache.render(mainEntry, {}));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
G.dataspace.setOnStateChange(function (mux, patch) {
|
// G.dataspace.setOnStateChange(function (mux, patch) {
|
||||||
$("#debug-space").text(Syndicate.prettyTrie(mux.routingTable));
|
// $("#debug-space").text(Syndicate.prettyTrie(mux.routingTable));
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
testing.rktd
|
testing.rktd
|
||||||
|
compiled/main_rkt.*
|
||||||
|
|
Loading…
Reference in New Issue