diff --git a/opentech/apply/funds/migrations/0072_add_guide_link_field.py b/opentech/apply/funds/migrations/0072_add_guide_link_field.py new file mode 100644 index 0000000000000000000000000000000000000000..d2d47cbb5922d053fcef942ede451ae371bd9360 --- /dev/null +++ b/opentech/apply/funds/migrations/0072_add_guide_link_field.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.9 on 2020-01-31 12:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('funds', '0071_update_field_reviewer'), + ] + + operations = [ + migrations.AddField( + model_name='applicationbase', + name='guide_link', + field=models.URLField(blank=True, help_text='Link to the apply guide.', max_length=255), + ), + migrations.AddField( + model_name='labbase', + name='guide_link', + field=models.URLField(blank=True, help_text='Link to the apply guide.', max_length=255), + ), + ] diff --git a/opentech/apply/funds/models/applications.py b/opentech/apply/funds/models/applications.py index d9a3d4d24bd5a3dd883269b9904153a36b481b8b..2191bd0f640fe9525fdf0e5b6e4b63b98e30b597 100644 --- a/opentech/apply/funds/models/applications.py +++ b/opentech/apply/funds/models/applications.py @@ -73,6 +73,8 @@ class ApplicationBase(EmailForm, WorkflowStreamForm): # type: ignore related_name='funds', ) + guide_link = models.URLField(blank=True, max_length=255, help_text=_('Link to the apply guide.')) + slack_channel = models.CharField(blank=True, max_length=128, help_text=_('The slack #channel for notifications.')) objects = PageManager.from_queryset(ApplicationBaseManager)() @@ -110,6 +112,7 @@ class ApplicationBase(EmailForm, WorkflowStreamForm): # type: ignore content_panels = WorkflowStreamForm.content_panels + [ FieldPanel('approval_form'), FieldPanel('reviewers', widget=forms.SelectMultiple(attrs={'size': '16'})), + FieldPanel('guide_link'), FieldPanel('slack_channel'), ] @@ -400,6 +403,8 @@ class LabBase(EmailForm, WorkflowStreamForm, SubmittableStreamForm): # type: ig related_name='labs', ) + guide_link = models.URLField(blank=True, max_length=255, help_text=_('Link to the apply guide.')) + slack_channel = models.CharField(blank=True, max_length=128, help_text=_('The slack #channel for notifications.')) parent_page_types = ['apply_home.ApplyHomePage'] @@ -409,6 +414,7 @@ class LabBase(EmailForm, WorkflowStreamForm, SubmittableStreamForm): # type: ig FieldPanel('approval_form'), FieldPanel('lead'), FieldPanel('reviewers', widget=forms.SelectMultiple(attrs={'size': '16'})), + FieldPanel('guide_link'), FieldPanel('slack_channel'), ] diff --git a/opentech/apply/funds/templates/funds/application_base.html b/opentech/apply/funds/templates/funds/application_base.html index a82e3844f287e327d73fa01d0c8847dc87124434..d3ceb7f7a9ffc3cf8281fba6d8a119c9e6b311d9 100644 --- a/opentech/apply/funds/templates/funds/application_base.html +++ b/opentech/apply/funds/templates/funds/application_base.html @@ -6,7 +6,6 @@ {% block header_modifier %}header--light-bg{% endblock %} {% block content %} - {% if form.errors or form.non_field_errors %} <div class="wrapper wrapper--medium wrapper--error"> <svg class="icon icon--error"><use xlink:href="#error"></use></svg> @@ -26,6 +25,11 @@ {# the page has no open rounds and we arent on a round page #} <h3>{% blocktrans %}Sorry this {{ page|verbose_name }} is not accepting applications at the moment{% endblocktrans %}</h3> {% else%} + {% if page.get_parent.specific.guide_link %} + <a href="{{ page.get_parent.specific.guide_link }}" class="link link--fixed-apply"> + {% trans "Application guide" %} + </a> + {% endif %} <form class="form application-form" action="/test500/" method="POST" enctype="multipart/form-data"> {{ form.media }} {% csrf_token %} diff --git a/opentech/public/funds/templates/public_funds/includes/fund_apply_cta.html b/opentech/public/funds/templates/public_funds/includes/fund_apply_cta.html index 9e8d0b196443fada4815f09e924dd5caafd3c595..73c9e22411fe14c844fb6b21f4388a0b7afd657e 100644 --- a/opentech/public/funds/templates/public_funds/includes/fund_apply_cta.html +++ b/opentech/public/funds/templates/public_funds/includes/fund_apply_cta.html @@ -15,6 +15,11 @@ <a href="{% pageurl apply_page %}" class="link link--button-secondary"> {% trans "Apply for this" %} {% verbose_name apply_page %} </a> + {% if apply_page.specific.guide_link %} + <a href="{{ apply_page.specific.guide_link }}" class="link link--button-tertiary"> + {% trans "Application guide" %} + </a> + {% endif %} {% else %} <h3 class="heading heading--no-margin"> {% trans "CLOSED" %} diff --git a/opentech/static_src/src/sass/public/components/_link.scss b/opentech/static_src/src/sass/public/components/_link.scss index 7d4790b203e0c1384fb609e97c9e5773a3978670..95288fd06cbce9d68278f03eb5ff11cd95eff4c4 100644 --- a/opentech/static_src/src/sass/public/components/_link.scss +++ b/opentech/static_src/src/sass/public/components/_link.scss @@ -32,6 +32,17 @@ @include button($color--purple, darken($color--purple, 20%)); } + &--button-tertiary { + @include button(transparent, darken($color--purple, 20%)); + color: $color--purple; + border-color: $color--purple; + + &:focus, + &:hover { + color: $color--white; + } + } + &--button-transparent { @include button(transparent, $color--darkest-blue); color: $color--white;