Don't render placeholder markup unless necessary

Rather than always rendering divs for the key and placeholder, render
the placeholder only if the key is missing.

// FREEBIE
This commit is contained in:
lilia 2016-01-19 19:01:47 -08:00
parent 6c7f2cf0fc
commit 05681ce35b
4 changed files with 15 additions and 19 deletions

View file

@ -217,12 +217,11 @@
</div> </div>
<div class='container'> <div class='container'>
<p> {{theirIdentity}} </p> <p> {{theirIdentity}} </p>
<div class='key placeholder'> {{ ^their_key }}
{{ #their_key_unknown }} <span>{{ their_key_unknown }}</span>{{ /their_key_unknown }} <div class='placeholder'>{{ their_key_unknown }}</div>
</div> {{ /their_key }}
<div class='key'> <div class='key'>
{{ #their_key }} <span>{{ . }}</span> {{ /their_key }} {{ #their_key }} <span>{{ . }}</span> {{ /their_key }}
</div> </div>
<p> {{yourIdentity}} </p> <p> {{yourIdentity}} </p>
<div class='key'> <div class='key'>

View file

@ -25,18 +25,14 @@
return octets; return octets;
}, },
render_attributes: function() { render_attributes: function() {
var attributes = { return {
verifyIdentity: i18n('verifyIdentity'), verifyIdentity: i18n('verifyIdentity'),
yourIdentity: i18n('yourIdentity'), yourIdentity: i18n('yourIdentity'),
theirIdentity: i18n('theirIdentity'), theirIdentity: i18n('theirIdentity'),
their_key_unknown: i18n('theirIdentityUnknown'),
your_key: this.splitKey(this.model.your_key), your_key: this.splitKey(this.model.your_key),
their_key: this.splitKey(this.model.their_key)
}; };
if(this.model.their_key) {
attributes.their_key = this.splitKey(this.model.their_key);
} else {
attributes.their_key_unknown = i18n('theirIdentityUnknown');
}
return attributes;
} }
}); });
})(); })();

View file

@ -49,13 +49,14 @@
p { p {
padding: 1em; padding: 1em;
} }
.key { .key, .placeholder {
font-family: monospace;
padding: 0 1em; padding: 0 1em;
-webkit-user-select: text; -webkit-user-select: text;
} }
.key.placeholder { .key {
font-family: inherit; font-family: monospace;
}
.placeholder {
font-weight: bold; font-weight: bold;
} }
.container { .container {

View file

@ -616,12 +616,12 @@ input.search {
background: white; } background: white; }
.key-verification p { .key-verification p {
padding: 1em; } padding: 1em; }
.key-verification .key { .key-verification .key, .key-verification .placeholder {
font-family: monospace;
padding: 0 1em; padding: 0 1em;
-webkit-user-select: text; } -webkit-user-select: text; }
.key-verification .key.placeholder { .key-verification .key {
font-family: inherit; font-family: monospace; }
.key-verification .placeholder {
font-weight: bold; } font-weight: bold; }
.key-verification .container { .key-verification .container {
height: calc(100% - (36px + 5px + 1px + 4px)); } height: calc(100% - (36px + 5px + 1px + 4px)); }