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.
refs TryGhost/Ghost#7769 - adds Google AMP to `apps` in order to disable and enable it on request.
- Loading branch information
1 parent
1556004
commit b93fb04
Showing
11 changed files
with
150 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Controller from 'ember-controller'; | ||
import injectService from 'ember-service/inject'; | ||
|
||
export default Controller.extend({ | ||
notifications: injectService(), | ||
|
||
// will be set by route | ||
settings: null, | ||
|
||
isSaving: false, | ||
|
||
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); | ||
|
||
this.set('isSaving', true); | ||
|
||
return settings.save().catch((err) => { | ||
this.get('notifications').showAPIError(err); | ||
throw err; | ||
}).finally(() => { | ||
this.set('isSaving', false); | ||
}); | ||
} | ||
} | ||
}); |
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 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; | ||
import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings'; | ||
import styleBody from 'ghost-admin/mixins/style-body'; | ||
|
||
export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, { | ||
titleToken: 'Settings - Apps - AMP', | ||
|
||
classNames: ['settings-view-apps-amp'], | ||
|
||
model() { | ||
return this.modelFor('settings.apps').get('amp'); | ||
}, | ||
|
||
setupController(controller) { | ||
this._super(...arguments); | ||
|
||
controller.set('settings', this.modelFor('settings.apps')); | ||
} | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<header class="view-header"> | ||
{{#gh-view-title openMobileMenu="openMobileMenu"}}<span style="padding-left:1px">{{#link-to "settings.apps.index"}}Apps{{/link-to}} <i class="icon-arrow-right" style="display:inline"></i> AMP</span>{{/gh-view-title}} | ||
<section class="view-actions"> | ||
{{#gh-spin-button id="saveSlackIntegration" class="btn btn-green" action=(action "save") submitting=isSaving}} | ||
Save | ||
{{/gh-spin-button}} | ||
</section> | ||
</header> | ||
<section class="view-container"> | ||
<section class="view-content"> | ||
<section class="app-grid"> | ||
<div class="app-cell"> | ||
<img class="app-icon" src="{{gh-path 'asset' '/img/ampicon.png'}}" /> | ||
</div> | ||
<div class="app-cell"> | ||
<h3>AMP</h3> | ||
<p>Accelerated Mobile Pages</p> | ||
</div> | ||
</section> | ||
<section class="app-subtitle"> | ||
<p>Enable <a href="https://ampproject.org">Google Accelerated Mobile Pages </a>for your site?</p> | ||
</section> | ||
<form class="app-config-form" id="amp-settings" novalidate="novalidate"> | ||
<div class="form-group for-checkbox"> | ||
<label for="amp">AMP support for your publications</label> | ||
<label class="checkbox" for="amp"> | ||
{{one-way-checkbox model id="amp" name="amp" type="checkbox" update=(action "update")}} | ||
<span class="input-toggle-component"></span> | ||
<p>Enable AMP support</p> | ||
</label> | ||
</div> | ||
</form> | ||
|
||
</section> | ||
</section> |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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