From e5237f522745159b0aa604540b3c8fffaf027141 Mon Sep 17 00:00:00 2001 From: Damillora Date: Thu, 11 Mar 2021 00:41:31 +0700 Subject: [PATCH] Add paid content handling --- assets/css/styles.css | 3 + members/signup.hbs | 2 +- partials/post-card.hbs | 22 +++- partials/primary-tag.hbs | 37 ++++--- post.hbs | 219 ++++++++++++++++++++++----------------- 5 files changed, 170 insertions(+), 113 deletions(-) diff --git a/assets/css/styles.css b/assets/css/styles.css index d5e46ed..d5135a1 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -12,6 +12,9 @@ html { header { @apply py-4; } +header a:hover { + @apply no-underline; +} a:hover { @apply underline; } diff --git a/members/signup.hbs b/members/signup.hbs index b394d14..4880eaa 100644 --- a/members/signup.hbs +++ b/members/signup.hbs @@ -50,7 +50,7 @@
{{#if @member}} -

Access restricted. Required infrastructure not yet in place.

+

Access disabled. Required infrastructure not yet in place.

Monthly

diff --git a/partials/post-card.hbs b/partials/post-card.hbs index 87e5232..fb31a88 100644 --- a/partials/post-card.hbs +++ b/partials/post-card.hbs @@ -4,21 +4,35 @@ {{> post-background}} {{!--Special header-image.hbs partial to generate the background image--}}
-
+
{{#if primary_tag}} {{#primary_tag}} -

+

{{/primary_tag}} {{/if}} + {{#has visibility="paid"}} + + {{/has}} + {{#has visibility="members"}} + + {{/has}}

{{title}}

diff --git a/partials/primary-tag.hbs b/partials/primary-tag.hbs index e3a05c3..890fc98 100644 --- a/partials/primary-tag.hbs +++ b/partials/primary-tag.hbs @@ -1,15 +1,28 @@ - {{#if primary_tag}} {{#primary_tag}} -

- - {{#if accent_color}} - - {{else}} - {{name}} - {{/if}} - {{name}} - -

+ {{/primary_tag}} -{{/if}} \ No newline at end of file +{{/if}} +{{#has visibility="paid"}} + +{{/has}} +{{#has visibility="members"}} + +{{/has}} \ No newline at end of file diff --git a/post.hbs b/post.hbs index efa719b..39120f4 100644 --- a/post.hbs +++ b/post.hbs @@ -1,32 +1,31 @@ -{{!< default}} - -{{#post}} -
- {{> header-background background=feature_image}} {{!--Special header-image.hbs partial to generate the background image--}} -
-
+{{!< default}} {{#post}}
+ {{> header-background background=feature_image}} {{!--Special header-image.hbs partial to generate the background + image--}} +
+
-
+
{{> primary-tag}}

{{title}}

-

{{reading_time}}

+

{{reading_time}}

{{#foreach authors}} - {{#if profile_image}} -
- - {{name}} - -
- {{/if}} + {{#if profile_image}} +
+ + {{name}} + +
+ {{/if}} {{/foreach}}
@@ -37,85 +36,113 @@
-
- -
-
-
- {{content}}
-
-
-
- {{#prev_post}} - - arrow_back -
-

Previous post

-

{{title}}

-
-
- {{/prev_post}} -
- {{#next_post}} - -
-

Next post

-

{{title}}

-
- arrow_forward -
- {{/next_post}} -
-
-
-
- {{#is "preview"}} -

Comments are disabled for post previews

- {{else}} - {{!-- Comments --}} - - {{/is}} -
-
-
- {{#if primary_tag}} - {{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related_posts|}} - {{#if related_posts}} - {{#../primary_tag}} - - {{/../primary_tag}} -
- {{#foreach related_posts}} - {{> post-card}} - {{/foreach}} -
- {{/if}} - {{/get}} - {{/if}} -
-{{/post}} -
-{{#contentFor "scripts"}} - -{{/contentFor}} +
+
+
+ {{#if access}} + {{content}} + {{else}} +
+

Access level insufficient

+ {{#has visibility="paid"}} +

Access level: Autonomous System

+

By subscribing as an Autonomous System, you can unlock access to the contents of this post, get additional benefits and support me at the same time!

+ + {{/has}} + {{#has visibility="members"}} +

Access level: Subscriber

+

Subscribing gives you access to the contents of this post, and get notified on subsequent posts!

+ + {{/has}} +
+ {{/if}} +
+
+
+
+ {{#prev_post}} + + arrow_back +
+

Previous post

+

{{title}}

+
+
+ {{/prev_post}} +
+ {{#next_post}} + +
+

Next post

+

{{title}}

+
+ arrow_forward +
+ {{/next_post}} +
+
+
+
+ {{#is "preview"}} +

Comments are disabled for post previews

+ {{else}} + {{!-- Comments --}} + + {{/is}} +
+
+
+ {{#if primary_tag}} + {{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related_posts|}} + {{#if related_posts}} + {{#../primary_tag}} + + {{/../primary_tag}} +
+ {{#foreach related_posts}} + {{> post-card}} + {{/foreach}} +
+ {{/if}} + {{/get}} + {{/if}} +
+ {{/post}} +
+ + {{#contentFor "scripts"}} + + {{/contentFor}} \ No newline at end of file