This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 refactor settings screens to use ember-concurrency & gh-task-button
refs TryGhost/Ghost#7865 - updates all settings screens to use EC tasks and `gh-task-button` to get save-state save buttons - removes now-unused `settings-save` mixin - moves the order of button color CSS so that grey buttons can change to green/red after completing - removes the heading from `apps-loading` template so that there's no odd flash when loading slack/amp screens directly
- Loading branch information
1 parent
9e34812
commit bc4e607
Showing
20 changed files
with
159 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,31 @@ | ||
import Controller from 'ember-controller'; | ||
import injectService from 'ember-service/inject'; | ||
import {task} from 'ember-concurrency'; | ||
|
||
export default Controller.extend({ | ||
notifications: injectService(), | ||
|
||
// will be set by route | ||
settings: null, | ||
|
||
isSaving: false, | ||
save: task(function* () { | ||
let amp = this.get('model'); | ||
let settings = this.get('settings'); | ||
|
||
actions: { | ||
update(value) { | ||
this.set('model', value); | ||
}, | ||
|
||
save() { | ||
let amp = this.get('model'); | ||
let settings = this.get('settings'); | ||
|
||
if (this.get('isSaving')) { | ||
return; | ||
} | ||
settings.set('amp', amp); | ||
|
||
settings.set('amp', amp); | ||
try { | ||
return yield settings.save(); | ||
|
||
this.set('isSaving', true); | ||
} catch (error) { | ||
this.get('notifications').showAPIError(error); | ||
throw error; | ||
} | ||
}).drop(), | ||
|
||
return settings.save().catch((err) => { | ||
this.get('notifications').showAPIError(err); | ||
throw err; | ||
}).finally(() => { | ||
this.set('isSaving', false); | ||
}); | ||
actions: { | ||
update(value) { | ||
this.set('model', value); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import Controller from 'ember-controller'; | ||
import injectService from 'ember-service/inject'; | ||
import SettingsSaveMixin from 'ghost-admin/mixins/settings-save'; | ||
import {task} from 'ember-concurrency'; | ||
|
||
export default Controller.extend(SettingsSaveMixin, { | ||
export default Controller.extend({ | ||
notifications: injectService(), | ||
|
||
save() { | ||
save: task(function* () { | ||
let notifications = this.get('notifications'); | ||
|
||
return this.get('model').save().catch((error) => { | ||
try { | ||
return yield this.get('model').save(); | ||
} catch (error) { | ||
notifications.showAPIError(error, {key: 'code-injection.save'}); | ||
}); | ||
} | ||
throw error; | ||
} | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.