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

Editors, authors and readers can get thank-you emails to their librarian #414

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/form/button-group.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load component_tags %}

<div class="w-full flex pt-4 items-start gap-4 flex-wrap">
<div class="w-full flex items-start gap-4 flex-wrap">
{% slot "buttons" default %}{% endslot %}
</div>
2 changes: 2 additions & 0 deletions components/timeline/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ def get_template_name(self, context):
def get_context_data(self, alternate, *args, **kwargs):
step = kwargs.pop('step', '')
bg = kwargs.pop('bg', 'bg-white')
prose = kwargs.pop('prose', True)
context = super().get_context_data(*args, **kwargs)
context['alternate'] = alternate
context['step'] = step
context['bg'] = bg
context['prose'] = prose
return context
8 changes: 7 additions & 1 deletion components/timeline/section_even.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@
{{ step }}
</h3>
</div>
<div class="prose lg:prose-lg w-full">
<div
class="
w-full
{% if prose %}
prose lg:prose-lg
{% endif %}
">
{% slot 'content' default %}{% endslot %}
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion components/timeline/section_odd.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@
{{ step }}
</h3>
</div>
<div class="prose lg:prose-lg w-full">
<div
class="
w-full
{% if prose %}
prose lg:prose-lg
{% endif %}
">
{% slot 'content' default %}{% endslot %}
</div>
</div>
Expand Down
26 changes: 14 additions & 12 deletions templates/custom/recommend-us-choose-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
{% load uuid %}

{% get_uuid4 as aria_controls %}
{% component_block "timeline_section" alternate="odd" step=step bg="bg-blue" %}
<div class="text-white">
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<input hidden name="role" value="{{ role }}">
{% component_block "timeline_section" alternate="odd" step=step bg="bg-blue" prose=False %}
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<input hidden name="previous_step" value="{{ step }}">
<input hidden name="goal" value="{{ goal }}">
<input hidden name="role" value="{{ role }}">
<div class="prose lg:prose-lg text-white">
{% if articles %}
{% with article_count=articles.count %}
<h2 class="text-white">Article{{ article_count|pluralize }} with “{{ query }}”.</h2>
{% endwith %}
<div class="not-prose">
<ul>
{% for article in articles %}
<li class="list-none mt-4">
<div>{{ article.how_to_cite|safe }}</div>
<li class="list-none">
<div class="my-4">{{ article.how_to_cite|safe }}</div>
{% component_block "button_group" %}
{% url 'recommend_us_generate_email' as hx_post %}
{% component_block "button" name="article_pk" value=article.pk hx_post=hx_post aria_controls=aria_controls %}
Expand All @@ -32,13 +34,13 @@ <h2 class="text-white">No matches for “{{ query }}”.</h2>
<p>We couldn't find an article with that title. Please try modifying
your query or generate a generic template.</p>
{% endif %}
{% component_block "button_group" %}
{% url 'recommend_us_generate_email' as hx_post %}
{% component_block "button" name="general" hx_post=hx_post aria_controls=aria_controls %}
Get a general email
{% endcomponent_block %}
</div>
{% component_block "button_group" %}
{% url 'recommend_us_generate_email' as hx_post %}
{% component_block "button" hx_post=hx_post aria_controls=aria_controls %}
Get a general email
{% endcomponent_block %}
{% endcomponent_block %}
</div>
{% endcomponent_block %}
{% endcomponent_block %}
<div id="{{ aria_controls }}"></div>
20 changes: 11 additions & 9 deletions templates/custom/recommend-us-choose-journal.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
{% load uuid %}

{% get_uuid4 as aria_controls %}
{% component_block "timeline_section" alternate="odd" step=step bg="bg-blue" %}
<div class="text-white">
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<input hidden name="role" value="{{ role }}">
{% component_block "timeline_section" alternate="odd" step=step bg="bg-blue" prose=False %}
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<input hidden name="previous_step" value="{{ step }}">
<input hidden name="goal" value="{{ goal }}">
<input hidden name="role" value="{{ role }}">
<div class="prose lg:prose-lg text-white">
{% if journal_names %}
{% with journal_count=journal_names.count %}
<h2 class="text-white">
Expand All @@ -16,8 +18,8 @@ <h2 class="text-white">
<div class="not-prose">
<ul>
{% for setting in journal_names %}
<li class="list-none mt-4">
<div>{{ setting.value }}</div>
<li class="list-none">
<div class="my-4">{{ setting.value }}</div>
{% component_block "button_group" %}
{% url 'recommend_us_generate_email' as hx_post %}
{% component_block "button" name="journal_pk" value=setting.journal.pk hx_post=hx_post aria_controls=aria_controls %}
Expand All @@ -36,11 +38,11 @@ <h2 class="text-white">No matches for “{{ query }}”.</h2>
{% endif %}
{% component_block "button_group" %}
{% url 'recommend_us_generate_email' as hx_post %}
{% component_block "button" name="general" hx_post=hx_post aria_controls=aria_controls %}
{% component_block "button" hx_post=hx_post aria_controls=aria_controls %}
Get a general email
{% endcomponent_block %}
{% endcomponent_block %}
{% endcomponent_block %}
</div>
</div>
{% endcomponent_block %}
{% endcomponent_block %}
<div id="{{ aria_controls }}"></div>
19 changes: 11 additions & 8 deletions templates/custom/recommend-us-choose-role.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,43 @@
{% load uuid %}

{% get_uuid4 as aria_controls %}
{% component_block "timeline_section" alternate="odd" step=step bg="bg-blue" %}
<h2 class="text-white">How do you know about the OLH?</h2>
{% component_block "timeline_section" alternate="odd" step=step bg="bg-blue" prose=False %}
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
{% csrf_token %}
<p class="text-white">Are you an...<p>
<input hidden name="previous_step" value="{{ step }}">
<input hidden name="goal" value="{{ goal }}">
<div class="prose lg:prose-lg text-white">
<h2 class="text-white">How do you know about the OLH?</h2>
<p class="text-white">Are you an...<p>
<div class="w-full flex flex-wrap gap-4 pt-4 items-center">
<div class="w-48">
{% url 'recommend_us_search_article' as hx_post %}
{% component_block "button" name="author" hx_post=hx_post aria_controls=aria_controls %}
{% component_block "button" name="role" value="author" hx_post=hx_post aria_controls=aria_controls %}
Author
{% endcomponent_block %}
<div class="w-36 p-3 text-white">of a paper in an OLH journal</div>
</div>
<div class="w-48">
{% url 'recommend_us_search_journal' as hx_post %}
{% component_block "button" name="editor" hx_post=hx_post aria_controls=aria_controls %}
{% component_block "button" name="role" value="editor" hx_post=hx_post aria_controls=aria_controls %}
Editor
{% endcomponent_block %}
<div class="w-36 p-3 text-white">of an OLH journal</div>
</div>
<div class="w-48">
{% url 'recommend_us_search_article' as hx_post %}
{% component_block "button" name="reader" hx_post=hx_post aria_controls=aria_controls %}
{% component_block "button" name="role" value="reader" hx_post=hx_post aria_controls=aria_controls %}
Reader
{% endcomponent_block %}
<div class="w-36 p-3 text-white">of one of your journal articles</div>
</div>
<div class="w-48">
{% url 'recommend_us_generate_email' as hx_post %}
{% component_block "button" name="other" hx_post=hx_post aria_controls=aria_controls %}
{% component_block "button" name="role" value="general" hx_post=hx_post aria_controls=aria_controls %}
Other
{% endcomponent_block %}
<div class="w-36 p-3 text-white">I just want to help!</div>
</div>
</div>
</div>
{% endcomponent_block %}
{% endcomponent_block %}
Expand Down
20 changes: 10 additions & 10 deletions templates/custom/recommend-us-confirm-sent.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
{% load uuid %}

{% get_uuid4 as copy_pid %}
{% component_block "timeline_section" alternate="odd" step=step bg="bg-blue" %}
<div class="text-white">
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
{% component_block "timeline_section" alternate="odd" step=step bg="bg-blue" prose=False %}
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<div class="prose lg:prose-lg text-white">
<h2 class="text-white">Thank you for supporting open access.</h2>
<p>Library support has helped us to make over
{{ request.press.published_articles.count|intcomma }} articles
diamond open access so far, saving university libraries an estimated £33.9
million since 2015. By recommending us to your librarian, you are helping to keep
knowledge free. Thank you.</p>
<p>One more thing... Please share this page on social media so others
recommend us.</p>
{% component_block "button_group" %}
{% component_block "button" name="general" id=copy_pid type="button" %}
Copy link to this page
{% endcomponent_block %}
<p>One more thing... Please share this page on social media to help us
keep knowledge free.</p>
</div>
{% component_block "button_group" %}
{% component_block "button" name="general" id=copy_pid type="button" %}
Copy link to this page
{% endcomponent_block %}
{% endcomponent_block %}
</div>
{% endcomponent_block %}
<script defer type="module">
const copyButton = document.querySelector('#{{ copy_pid }}');
copyButton.addEventListener('click', () => writeToClipboard(window.location.href));
Expand Down
14 changes: 8 additions & 6 deletions templates/custom/recommend-us-generate-email.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

{% get_uuid4 as copy_pid %}
{% get_uuid4 as aria_controls %}
{% component_block "timeline_section" alternate="even" step=step bg="bg-blue" %}
<div>
{% component_block "timeline_section" alternate="even" step=step bg="bg-blue" prose=False %}
<div class="prose lg:prose-lg text-white">
<h2 class="text-white">Voilà.</h2>
<p class="text-white">Here is an email to send to your library. Just copy
and paste this text into an email to your librarian to help us reach them.
Expand All @@ -23,9 +23,6 @@ <h2 class="text-white">Voilà.</h2>
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<input hidden name="previous_step" value="{{ step }}">
{% component_block "button_group" %}
{% component_block "button" name="general" id=copy_pid type="button" %}
Copy to clipboard
{% endcomponent_block %}
<a
class="
p-4 not-prose
Expand All @@ -37,10 +34,15 @@ <h2 class="text-white">Voilà.</h2>
href="mailto:?subject=Joining the OLH&body={{ email|striptags|urlencode }}">
{% include "custom/button-action-inner-white.html" with label="Open in email" %}
</a>
{% component_block "button" name="general" id=copy_pid type="button" %}
Copy to clipboard
{% endcomponent_block %}
{% url "recommend_us" as rel_path %}
{% include "custom/button-action-white.html" with rel_path=rel_path label="Start over" %}
{% endcomponent_block %}
<p class="text-white">Have you sent the email to your library?</p>
<div class="prose lg:prose-lg text-white">
<p>Have you sent the email to your library?</p>
</div>
{% component_block "button_group" %}
{% url 'recommend_us_confirm_sent' as hx_post %}
{% component_block "button" hx_post=hx_post aria_controls=aria_controls %}
Expand Down
22 changes: 13 additions & 9 deletions templates/custom/recommend-us-search-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@
{% load uuid %}

{% get_uuid4 as aria_controls %}
{% component_block "timeline_section" alternate="even" step=step bg="bg-blue" %}
<h2 class="text-white">
{% if role == 'author' %}
Find your article.
{% elif role == 'reader' %}
Find the article you read.
{% endif %}
</h2>
{% component_block "timeline_section" alternate="even" step=step bg="bg-blue" prose=False %}
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<input hidden name="previous_step" value="{{ step }}">
<input hidden name="goal" value="{{ goal }}">
<input hidden name="role" value="{{ role }}">
<div class="prose lg:prose-lg">
<h2 class="text-white">
{% if role == 'author' %}
Find your article.
{% elif role == 'reader' %}
Find the article you read.
{% endif %}
</h2>
</div>
{% component_block "form_field" id_for_label="search_article" label="Article title" %}
{% component "form_input" type="search" id="search_article" name="article_query" %}
{% endcomponent_block %}
<input hidden name="role" value="{{ role }}">
{% component_block "button_group" %}
{% url 'recommend_us_choose_article' as hx_post %}
{% component_block "button" hx_post=hx_post aria_controls=aria_controls %}
Expand Down
14 changes: 9 additions & 5 deletions templates/custom/recommend-us-search-journal.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
{% load uuid %}

{% get_uuid4 as aria_controls %}
{% component_block "timeline_section" alternate="even" step=step bg="bg-blue" %}
<h2 class="text-white">
Find your journal.
</h2>
{% component_block "timeline_section" alternate="even" step=step bg="bg-blue" prose=False %}
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<div class="prose lg:prose-lg">
<h2 class="text-white">
Find your journal.
</h2>
</div>
<input hidden name="previous_step" value="{{ step }}">
<input hidden name="goal" value="{{ goal }}">
<input hidden name="role" value="{{ role }}">
{% component_block "form_field" id_for_label="search_journal" label="Journal name" %}
{% component "form_input" type="search" id="search_journal" name="journal_query" %}
{% endcomponent_block %}
<input hidden name="role" value="{{ role }}">
{% url 'recommend_us_choose_journal' as hx_post %}
{% component_block "button_group" %}
{% component_block "button" hx_post=hx_post aria_controls=aria_controls %}
Expand Down
58 changes: 35 additions & 23 deletions templates/custom/recommend-us-see-matching-supporters.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,44 @@
{% load uuid %}

{% get_uuid4 as aria_controls %}
{% component_block "timeline_section" alternate="even" step=step bg="bg-blue" %}
<div class="text-white">
{% if supporters %}
<h2 class="text-white">Current members with “{{ query }}”.</h2>
<p>These institutions are already members:</p>
<ul>
{% for supporter in supporters %}
<li class="list-none">
{{ supporter.name }}, {{ supporter.country.name }}
</li>
{% endfor %}
</ul>
<p>If your library is not here, they are not a member yet... Help us reach them!</p>
{% else %}
<h2 class="text-white">No matches for “{{ query }}”.</h2>
<p>It looks like your library isn’t an OLH supporter yet... Help us reach them!</p>
{% endif %}
<p>Fill in your details to generate a template email to your library.</p>
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
{% component_block "timeline_section" alternate="even" step=step bg="bg-blue" prose=False %}
{% component_block "form" form_method="POST" notify_required=False default_button=False %}
<input hidden name="previous_step" value="{{ step }}">
<div class="prose lg:prose-lg text-white">
{% if supporters %}
<h2 class="text-white">Current members with “{{ query }}”.</h2>
<p>These institutions are already members:</p>
<ul>
{% for supporter in supporters %}
<li class="list-none">
{{ supporter.name }}, {{ supporter.country.name }}
</li>
{% endfor %}
</ul>
<p>If your library is not here, they are not a member yet. Help us reach
them!</p>
{% else %}
<h2 class="text-white">No matches for “{{ query }}”.</h2>
<p>It looks like your library isn’t an OLH supporter yet. Help us reach
them!</p>
{% endif %}
<p>Fill in your details to generate a template email to your library.</p>
{% component_block "button_group" %}
{% url 'recommend_us_choose_role' as hx_post %}
{% component_block "button" hx_post=hx_post aria_controls=aria_controls %}
Fill in details
{% component_block "button" name="goal" value="recommend" hx_post=hx_post aria_controls=aria_controls %}
Get a recommendation email
{% endcomponent_block %}
{% endcomponent_block %}
{% endcomponent_block %}
</div>
{% if supporters %}
<p>If your library is already a member, show them some love!</p>
{% component_block "button_group" %}
{% url 'recommend_us_choose_role' as hx_post %}
{% component_block "button" name="goal" value="thank_supporter" hx_post=hx_post aria_controls=aria_controls %}
Get a thank-you email
{% endcomponent_block %}
{% endcomponent_block %}
{% endif %}
</div>
{% endcomponent_block %}
{% endcomponent_block %}
<div id="{{ aria_controls }}"></div>
Loading