UI for invite revocation.
This commit is contained in:
parent
36c5ff5b08
commit
a501d5fcce
2
NEWS
2
NEWS
|
@ -1,5 +1,5 @@
|
||||||
1.1.0: December ??, 2007
|
1.1.0: December ??, 2007
|
||||||
* Ability to invite people to your notebook.
|
* Ability to invite people to view your notebook.
|
||||||
* When the web browser is resized, all notes are automatically resized as well.
|
* When the web browser is resized, all notes are automatically resized as well.
|
||||||
* Fixed note focusing in Safari.
|
* Fixed note focusing in Safari.
|
||||||
* Fixed note state detection (bold, italic, etc.) in Safari.
|
* Fixed note state detection (bold, italic, etc.) in Safari.
|
||||||
|
|
|
@ -73,6 +73,19 @@ h3 {
|
||||||
background-color: #ffcc66;
|
background-color: #ffcc66;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.revoke_button {
|
||||||
|
border-style: outset;
|
||||||
|
border-width: 0px;
|
||||||
|
background-color: #d0e0f0;
|
||||||
|
font-size: 90%;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.revoke_button:hover {
|
||||||
|
background-color: #ffcc66;
|
||||||
|
}
|
||||||
|
|
||||||
.text_field {
|
.text_field {
|
||||||
margin-top: 0.25em;
|
margin-top: 0.25em;
|
||||||
padding: 0.25em;
|
padding: 0.25em;
|
||||||
|
@ -117,6 +130,10 @@ ol li {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invite {
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
#access_table td {
|
#access_table td {
|
||||||
padding-right: 1em;
|
padding-right: 1em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,8 +210,22 @@ Editor.prototype.finish_init = function () {
|
||||||
signal( self, "submit_form", "/users/send_invites", invite_form, function ( result ) {
|
signal( self, "submit_form", "/users/send_invites", invite_form, function ( result ) {
|
||||||
if ( !result.invites ) return;
|
if ( !result.invites ) return;
|
||||||
signal( self, "invites_updated", result.invites );
|
signal( self, "invites_updated", result.invites );
|
||||||
} ); event.stop();
|
} );
|
||||||
|
event.stop();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
var revoke_buttons = getElementsByTagAndClassName( "input", "revoke_button" );
|
||||||
|
for ( var i in revoke_buttons ) {
|
||||||
|
var revoke_button = revoke_buttons[ i ];
|
||||||
|
var invite_id = revoke_button.id.split( "_" ).pop();
|
||||||
|
connect( revoke_button, "onclick", function ( event ) {
|
||||||
|
signal( self, "revoke_invite", invite_id, function ( result ) {
|
||||||
|
if ( !result.invites ) return;
|
||||||
|
signal( self, "invites_updated", result.invites );
|
||||||
|
} );
|
||||||
|
event.stop();
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
|
@ -644,6 +644,12 @@ Wiki.prototype.create_editor = function ( id, note_text, deleted_from_id, revisi
|
||||||
connect( editor, "submit_form", function ( url, form, callback ) {
|
connect( editor, "submit_form", function ( url, form, callback ) {
|
||||||
self.invoker.invoke( url, "POST", null, callback, form );
|
self.invoker.invoke( url, "POST", null, callback, form );
|
||||||
} );
|
} );
|
||||||
|
connect( editor, "revoke_invite", function ( invite_id, callback ) {
|
||||||
|
self.invoker.invoke( "/users/revoke_invite", "POST", {
|
||||||
|
"notebook_id": self.notebook_id,
|
||||||
|
"invite_id": invite_id
|
||||||
|
}, callback );
|
||||||
|
} );
|
||||||
|
|
||||||
this.clear_messages();
|
this.clear_messages();
|
||||||
this.clear_pulldowns();
|
this.clear_pulldowns();
|
||||||
|
@ -1297,7 +1303,7 @@ Wiki.prototype.share_notebook = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
var invite_area = createDOM( "p", { "id": "invite_area" } );
|
var invite_area = createDOM( "p", { "id": "invite_area" } );
|
||||||
this.update_invites( invite_area );
|
this.display_invites( invite_area );
|
||||||
|
|
||||||
var div = createDOM( "div", {},
|
var div = createDOM( "div", {},
|
||||||
createDOM( "form", { "id": "invite_form" },
|
createDOM( "form", { "id": "invite_form" },
|
||||||
|
@ -1323,39 +1329,63 @@ Wiki.prototype.share_notebook = function () {
|
||||||
this.create_editor( "share_notebook", "<h3>share this notebook</h3>" + div.innerHTML, undefined, undefined, undefined, false, true, true, getElement( "notes_top" ) );
|
this.create_editor( "share_notebook", "<h3>share this notebook</h3>" + div.innerHTML, undefined, undefined, undefined, false, true, true, getElement( "notes_top" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Wiki.prototype.update_invites = function ( invite_area ) {
|
Wiki.prototype.display_invites = function ( invite_area ) {
|
||||||
if ( !this.invites || this.invites.length == 0 )
|
if ( !this.invites || this.invites.length == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var collaborators = createDOM( "ul", { "id": "collaborators" } );
|
var collaborators = createDOM( "div", { "id": "collaborators" } );
|
||||||
var viewers = createDOM( "ul", { "id": "viewers" } );
|
var viewers = createDOM( "div", { "id": "viewers" } );
|
||||||
var owners = createDOM( "ul", { "id": "owners" } );
|
var owners = createDOM( "div", { "id": "owners" } );
|
||||||
|
var self = this;
|
||||||
|
|
||||||
for ( var i in this.invites ) {
|
for ( var i in this.invites ) {
|
||||||
var invite = this.invites[ i ];
|
var invite = this.invites[ i ];
|
||||||
|
var revoke_button = createDOM( "input", {
|
||||||
|
"type": "button",
|
||||||
|
"id": "revoke_" + invite.object_id,
|
||||||
|
"class": "revoke_button",
|
||||||
|
"value": " x ",
|
||||||
|
"title": "revoke this person's notebook access"
|
||||||
|
} );
|
||||||
|
|
||||||
if ( invite.owner ) {
|
if ( invite.owner ) {
|
||||||
appendChildNodes( owners, createDOM( "li", {}, invite.email_address ) );
|
appendChildNodes(
|
||||||
|
owners, createDOM( "div", { "class": "invite" },
|
||||||
|
invite.email_address, " ", revoke_button )
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if ( invite.read_write )
|
if ( invite.read_write )
|
||||||
appendChildNodes( collaborators, createDOM( "li", {}, invite.email_address ) );
|
appendChildNodes(
|
||||||
|
collaborators, createDOM( "div", { "class": "invite" },
|
||||||
|
invite.email_address, " ", revoke_button )
|
||||||
|
);
|
||||||
else
|
else
|
||||||
appendChildNodes( viewers, createDOM( "li", {}, invite.email_address ) );
|
appendChildNodes(
|
||||||
|
viewers, createDOM( "div", { "class": "invite" },
|
||||||
|
invite.email_address, " ", revoke_button )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var div = createDOM( "div" );
|
var div = createDOM( "div" );
|
||||||
|
|
||||||
if ( collaborators.childNodes.length > 0 ) {
|
if ( collaborators.childNodes.length > 0 ) {
|
||||||
appendChildNodes( div, createDOM( "h3", {}, "collaborators" ) );
|
var p = createDOM( "p" );
|
||||||
appendChildNodes( div, collaborators );
|
appendChildNodes( p, createDOM( "b", {}, "collaborators" ) );
|
||||||
|
appendChildNodes( p, collaborators );
|
||||||
|
appendChildNodes( div, p );
|
||||||
}
|
}
|
||||||
if ( viewers.childNodes.length > 0 ) {
|
if ( viewers.childNodes.length > 0 ) {
|
||||||
appendChildNodes( div, createDOM( "h3", {}, "viewers" ) );
|
var p = createDOM( "p" );
|
||||||
appendChildNodes( div, viewers );
|
appendChildNodes( p, createDOM( "b", {}, "viewers" ) );
|
||||||
|
appendChildNodes( p, viewers );
|
||||||
|
appendChildNodes( div, p );
|
||||||
}
|
}
|
||||||
if ( owners.childNodes.length > 0 ) {
|
if ( owners.childNodes.length > 0 ) {
|
||||||
appendChildNodes( div, createDOM( "h3", {}, "owners" ) );
|
var p = createDOM( "p" );
|
||||||
appendChildNodes( div, owners );
|
appendChildNodes( p, createDOM( "b", {}, "owners" ) );
|
||||||
|
appendChildNodes( p, owners );
|
||||||
|
appendChildNodes( div, p );
|
||||||
}
|
}
|
||||||
|
|
||||||
replaceChildNodes( invite_area, div );
|
replaceChildNodes( invite_area, div );
|
||||||
|
@ -1369,7 +1399,7 @@ Wiki.prototype.display_message = function ( text, nodes, position_after ) {
|
||||||
for ( var i in nodes )
|
for ( var i in nodes )
|
||||||
appendChildNodes( inner_div, nodes[ i ] );
|
appendChildNodes( inner_div, nodes[ i ] );
|
||||||
|
|
||||||
ok_button = createDOM( "input", {
|
var ok_button = createDOM( "input", {
|
||||||
"type": "button",
|
"type": "button",
|
||||||
"class": "message_button",
|
"class": "message_button",
|
||||||
"value": "ok",
|
"value": "ok",
|
||||||
|
|
Reference in New Issue