Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amp-access-laterpay fixes #9633

Merged
merged 4 commits into from Jun 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions examples/article-access-laterpay.amp.html
Expand Up @@ -3,14 +3,17 @@
<head>
<meta charset="utf-8">
<title>Lorem Ipsum | PublisherName</title>
<link rel="canonical" href="amps.html" >
<link rel="canonical" href="article-access-laterpay.html" >
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<!-- See https://github.com/ampproject/amp-publisher-sample -->
<script id="amp-access" type="application/json">
{
"vendor": "laterpay",
"laterpay": {
"articleTitleSelector": ".content-container > header > h1"
"articleTitleSelector": ".content-container > header > h1",
"localeMessages": {
"header": "LaterPay"
}
}
}
</script>
Expand Down
30 changes: 27 additions & 3 deletions extensions/amp-access-laterpay/0.1/amp-access-laterpay.css
Expand Up @@ -28,9 +28,10 @@
}

.amp-access-laterpay ul {
width: 100%;
margin: 0;
padding: 0;
width: 100%;
margin-bottom: 40px;
}

.amp-access-laterpay li {
Expand All @@ -48,8 +49,13 @@
width: 20px;
}

.amp-access-laterpay-metadata-container {
width: 90%;
.amp-access-laterpay-header {
font-size: 1.2em;
margin-bottom: 40px;
}

.amp-access-laterpay-metadata {
width: 92%;
}

.amp-access-laterpay-title {
Expand All @@ -69,8 +75,26 @@
margin-left: auto;
}

.amp-access-laterpay-price {
font-size: 1.5em;
}

.amp-access-laterpay-currency {
font-size: 0.7em;
}

.amp-access-laterpay-purchase-button {
font-size: 1.1em;
padding: 0.5em 0.8em;
width: 70%;
padding: 0.5em 0.8em;
background-color: #8db444;
border-radius: 4px;
border: 0;
color: #fff;
width: 70%;
}

.amp-access-laterpay-already-purchased-link-container {
font-size: 0.9em;
}
6 changes: 5 additions & 1 deletion extensions/amp-access-laterpay/0.1/laterpay-impl.js
Expand Up @@ -76,7 +76,8 @@ let PurchaseOptionDef;
* access: boolean,
* apl: string,
* premiumcontent: !PurchaseOptionDef,
* timepasses: Array<PurchaseOptionDef>=
* timepasses: Array<PurchaseOptionDef>=,
* subscriptions: Array<PurchaseOptionDef>=
* }}
*/
let PurchaseConfigDef;
Expand Down Expand Up @@ -307,6 +308,9 @@ export class LaterpayVendor {
this.purchaseConfig_.timepasses.forEach(timepass => {
listContainer.appendChild(this.createPurchaseOption_(timepass));
});
this.purchaseConfig_.subscriptions.forEach(subscription => {
listContainer.appendChild(this.createPurchaseOption_(subscription));
});
const purchaseButton = this.createElement_('button');
purchaseButton.className = TAG + '-purchase-button';
purchaseButton.textContent = this.i18n_.defaultButton;
Expand Down
Expand Up @@ -152,6 +152,9 @@ describes.fakeWin('LaterpayVendor', {
premiumcontent: {
price: {},
},
subscriptions: [
{price: {}},
],
timepasses: [
{price: {}},
],
Expand All @@ -167,8 +170,8 @@ describes.fakeWin('LaterpayVendor', {
expect(container.querySelector('ul')).to.not.be.null;
});

it('renders 2 purchase options', () => {
expect(container.querySelector('ul').childNodes.length).to.equal(2);
it('renders 3 purchase options', () => {
expect(container.querySelector('ul').childNodes.length).to.equal(3);
});

});
Expand All @@ -184,6 +187,9 @@ describes.fakeWin('LaterpayVendor', {
premiumcontent: {
price: {},
},
subscriptions: [
{price: {}},
],
timepasses: [
{price: {}},
],
Expand Down Expand Up @@ -216,6 +222,9 @@ describes.fakeWin('LaterpayVendor', {
premiumcontent: {
price: {},
},
subscriptions: [
{price: {}},
],
timepasses: [
{price: {}},
],
Expand Down