Skip to content

Commit

Permalink
DEV: Upgrade to Ember 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
udan11 committed Jan 26, 2019
1 parent 42c9564 commit feb0e39
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
Expand Up @@ -24,13 +24,13 @@
<p class="text-danger">{{i18n passphraseStatus}}</p>
{{/if}}

{{d-button class="btn-primary" icon="exchange" action="changeEncrypt" disabled=(or passphraseStatus inProgress) label="encrypt.preferences.change"}}
{{d-button action="hidePassphraseInput" disabled=inProgress label="cancel"}}
{{d-button class="btn-primary" icon="exchange" action=(action "changeEncrypt") disabled=(or passphraseStatus inProgress) label="encrypt.preferences.change"}}
{{d-button action=(action "hidePassphraseInput") disabled=inProgress label="cancel"}}
</form>
{{else}}
{{d-button icon="exchange" action="showPassphraseInput" label="encrypt.preferences.change" id="change"}}
{{d-button icon="times" action="deactivateEncrypt" label="encrypt.preferences.deactivate" id="deactivate"}}
{{d-button icon="file-export" action="export" label="encrypt.export.title"}}
{{d-button icon="exchange" action=(action "showPassphraseInput") label="encrypt.preferences.change" id="change"}}
{{d-button icon="times" action=(action "deactivateEncrypt") label="encrypt.preferences.deactivate" id="deactivate"}}
{{d-button icon="file-export" action=(action "export") label="encrypt.export.title"}}
{{/if}}
{{else}}
<form>
Expand All @@ -40,7 +40,7 @@
<label for="">{{i18n "encrypt.preferences.passphrase_label"}}</label>
{{input type="password" value=passphrase id="passphrase" autocomplete="current-password" disabled=inProgress}}
</p>
<p>{{d-button class="btn-primary" icon="unlock" action="activateEncrypt" disabled=inProgress label="encrypt.preferences.activate"}}</p>
<p>{{d-button class="btn-primary" icon="unlock" action=(action "activateEncrypt") disabled=inProgress label="encrypt.preferences.activate"}}</p>
</form>
{{/if}}
{{else}}
Expand All @@ -60,12 +60,12 @@
<p class="text-danger">{{i18n passphraseStatus}}</p>
{{/if}}
<p>
{{d-button class="btn-primary" icon="lock" action="enableEncrypt" disabled=(or passphraseStatus inProgress) label="encrypt.preferences.enable"}}
{{d-button action="hidePassphraseInput" disabled=inProgress label="cancel"}}
{{d-button class="btn-primary" icon="lock" action=(action "enableEncrypt") disabled=(or passphraseStatus inProgress) label="encrypt.preferences.enable"}}
{{d-button action=(action "hidePassphraseInput") disabled=inProgress label="cancel"}}
</p>
</form>
{{else}}
{{d-button icon="lock" action="showPassphraseInput" label="encrypt.preferences.enable"}}
{{d-button icon="lock" action=(action "showPassphraseInput") label="encrypt.preferences.enable"}}
{{/if}}
{{/if}}
{{else}}
Expand Down
Expand Up @@ -49,17 +49,6 @@ export default {
isEncryptActive: false,
// TOOD: Check out if there is a way to define functions like this in
// the `export default` scope.
passphraseStatus: function() {
const passphrase = component.get("passphrase");
const passphrase2 = component.get("passphrase2");
if (!passphrase) {
return "encrypt.preferences.passphrase_enter";
} else if (passphrase.length < 15) {
return "encrypt.preferences.passphrase_insecure";
} else if (passphrase !== passphrase2) {
return "encrypt.preferences.passphrase_mismatch";
}
}.property("passphrase", "passphrase2"),
willDestroyElement() {
this._super(...arguments);
this.appEvents.off(
Expand All @@ -69,6 +58,21 @@ export default {
);
}
});
Ember.defineProperty(
component,
"passphraseStatus",
Ember.computed("passphrase", "passphrase2", function() {
const passphrase = component.get("passphrase");
const passphrase2 = component.get("passphrase2");
if (!passphrase) {
return "encrypt.preferences.passphrase_enter";
} else if (passphrase.length < 15) {
return "encrypt.preferences.passphrase_insecure";
} else if (passphrase !== passphrase2) {
return "encrypt.preferences.passphrase_mismatch";
}
})
);
} else {
component.setProperties({
model: args.model,
Expand Down
Expand Up @@ -10,6 +10,6 @@
{{/d-modal-body}}

<div class="modal-footer">
{{d-button class="btn btn-primary" icon="unlock" label="encrypt.preferences.activate" action="activate"}}
{{d-button class="btn btn-primary" icon="unlock" label="encrypt.preferences.activate" action=(action "activate")}}
{{d-modal-cancel close=(action "closeModal")}}
</div>
Expand Up @@ -14,12 +14,12 @@
{{/d-modal-body}}

<div class="modal-footer">
{{d-button class="btn btn-primary" icon="file-export" label="encrypt.export.title" action="export"}}
{{d-button class="btn btn-primary" icon="file-export" label="encrypt.export.title" action=(action "export")}}
{{#if exported}}
{{#if copied}}
{{d-button class="btn" icon="clipboard" label="admin.customize.copied_to_clipboard" action="copy"}}
{{d-button class="btn" icon="clipboard" label="admin.customize.copied_to_clipboard" action=(action "copy")}}
{{else}}
{{d-button class="btn" icon="clipboard" label="admin.customize.copy_to_clipboard" action="copy"}}
{{d-button class="btn" icon="clipboard" label="admin.customize.copy_to_clipboard" action=(action "copy")}}
{{/if}}
{{/if}}
{{d-modal-cancel close=(action "closeModal")}}
Expand Down

0 comments on commit feb0e39

Please sign in to comment.