diff --git a/omega-target-chromium-extension/src/module/sync_storage.coffee b/omega-target-chromium-extension/src/module/sync_storage.coffee index 173a679..02b332f 100644 --- a/omega-target-chromium-extension/src/module/sync_storage.coffee +++ b/omega-target-chromium-extension/src/module/sync_storage.coffee @@ -154,6 +154,8 @@ updateGist = (gistId, options) -> }).then((res) -> res.json() ).then((data) -> + if data.status is "404" + throw new Error("The token with Gist permission is required.") if data.message throw data.message lastGistCommit = data.history[0]?.version diff --git a/omega-web/src/less/options.less b/omega-web/src/less/options.less index c6507ca..66cbf2a 100644 --- a/omega-web/src/less/options.less +++ b/omega-web/src/less/options.less @@ -548,3 +548,15 @@ main { .use-built-in-sync-enhance-tip { display: inline-block; } +.settings-group .sync-form .clean-btn{ + position: absolute; +} +.sync-form input.form-control[readonly]{ + -webkit-text-security: disc; + text-security: disc; +} + +.sync-form input.form-control:focus{ + -webkit-text-security: initial; + text-security: initial; +} diff --git a/omega-web/src/omega/controllers/io.coffee b/omega-web/src/omega/controllers/io.coffee index 6d31c88..572bc37 100644 --- a/omega-web/src/omega/controllers/io.coffee +++ b/omega-web/src/omega/controllers/io.coffee @@ -107,6 +107,10 @@ angular.module('omega').controller 'IoCtrl', ( else $rootScope.applyOptionsConfirm().then enable + $scope.cleanInput = (target) -> + $scope[target] = '' + omegaTarget.state(target, '') + $scope.checkOptionsSyncChange = -> $scope.enableOptionsSyncing = true omegaTarget.checkOptionsSyncChange().then( -> diff --git a/omega-web/src/partials/io.jade b/omega-web/src/partials/io.jade index 36ef747..c2a2dbd 100644 --- a/omega-web/src/partials/io.jade +++ b/omega-web/src/partials/io.jade @@ -39,12 +39,13 @@ section.settings-group section.settings-group h3 {{'options_group_syncing' | tr}} div - form + form.sync-form div.form-group label {{'Gist Id'}} .input-group.width-limit span.input-group-addon {{'ID'}} input.form-control(type='text' ng-model='gistId' ng-readonly='syncOptions == "sync"' placeholder="Gist Id e.g. https://gist.github.com/{username}/{Gist Id}") + span.glyphicon.glyphicon-remove.btn.clean-btn(ng-click='cleanInput("gistId")' ng-if='syncOptions != "sync"') span.help-block a(href="https://gist.github.com/" role="button" target="_blank") | {{'Create a secret Gist. '}} @@ -55,9 +56,12 @@ section.settings-group .input-group.width-limit span.input-group-addon {{'TOKEN'}} input.form-control(type='text' ng-model='gistToken' ng-readonly='syncOptions == "sync"' placeholder="Gist Token") + span.glyphicon.glyphicon-remove.btn.clean-btn(ng-click='cleanInput("gistToken")' ng-if='syncOptions != "sync"') span.help-block a(href="https://github.com/settings/tokens/new" role="button" target="_blank") - | {{ 'Create a token that manages the Gist.(Only gist permission is required.)'}} + | {{ 'Create a token that manages the Gist.' }} + strong + | {{ '(Gist permission is required.)'}} div(ng-show='syncOptions == "pristine" || syncOptions == "disabled"') div.checkbox label @@ -91,7 +95,6 @@ section.settings-group span.glyphicon.glyphicon-ok = ' ' | {{"options_syncSyncAlert" | tr}} - p.help-block(omega-html='"options_syncSyncHelp" | tr') p button.btn.btn-warning(ng-click='disableOptionsSync()') span.glyphicon.glyphicon-remove-sign