make permissions editor UI clearer

This commit is contained in:
or-else
2017-08-09 10:30:59 +03:00
parent 40108d5201
commit 0f90626a49
2 changed files with 13 additions and 11 deletions
+12 -11
View File
@@ -67,8 +67,6 @@
// Make a data URL from public.photo
function makeImageUrl(photo) {
//console.log("makeImageUrl");
//console.log(photo);
return (photo && photo.type && photo.data) ?
'data:image/' + photo.type + ';base64,' + photo.data : null;
}
@@ -433,16 +431,19 @@
var items = [];
for (var i=0; i<all.length; i++) {
var c = all.charAt(i);
if (skip.indexOf(c) >= 0) {
if (skip.indexOf(c) >= 0 && mode.indexOf(c) < 0) {
// Permission is marked as inactive: hide unchecked permissions, disable checked permissions
continue;
}
items.push(
<tr key={c}>
<td>{names[c]}</td>
<td className="checkbox">
<CheckBox name={c} checked={(mode.indexOf(c) > -1)} onChange={this.handleChange}/>
</td>{this.props.compare ? <td className="checkbox">
<CheckBox name={c} checked={(compare.indexOf(c) > -1)}/>
<td className="checkbox">{skip.indexOf(c) < 0 ?
<CheckBox name={c} checked={(mode.indexOf(c) >= 0)} onChange={this.handleChange}/>
:
<CheckBox name={c} checked={(mode.indexOf(c) >= 0)} />
}</td>{this.props.compare ? <td className="checkbox">
<CheckBox name={c} checked={(compare.indexOf(c) >= 0)}/>
</td> : null}
</tr>
);
@@ -1738,7 +1739,6 @@
},
onSubsUpdated: function() {
console.log("onSubsUpdated");
var topic = Tinode.getTopic(this.props.topic);
if (!topic) {
return;
@@ -1805,13 +1805,14 @@
case 'want':
toEdit = this.state.modeWant;
toCompare = this.state.modeGiven;
toSkip ='O';
toSkip = this.state.groupTopic ? 'O' : 'ASDO';
titleEdit = 'Requested';
titleCompare = 'Granted';
break;
case 'given':
toEdit = this.state.modeGiven2;
toCompare = this.state.modeWant2;
toSkip = this.state.groupTopic ? (this.state.owner ? '' : 'O') : 'ASDO';
titleEdit = 'Granted';
titleCompare = 'Requested';
break;
@@ -1942,11 +1943,11 @@
<div>
<div><label className="small">Permissions:</label></div>
<div className="quoted">
<div>Yours: <tt className="clickable"
<div>Yours: &nbsp;<tt className="clickable"
onClick={this.handleLaunchPermissionsEditor.bind(this, 'want')}>
{this.state.access}
</tt></div>
<div>{this.state.fullName}&prime;s: <tt className="clickable"
<div>{this.state.fullName}&prime;s: &nbsp;<tt className="clickable"
onClick={this.handleLaunchPermissionsEditor.bind(this, 'given')}>
{this.state.modeGiven2}
</tt></div>