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

Last changes including significant aesthetic changes #146

Merged
merged 23 commits into from
Oct 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
907d2e1
W.I.P various improvements
tony-gaia Aug 3, 2016
8d2ddf5
Merge branch 'master' into aesthetic_changes
tony-gaia Oct 20, 2016
bee8c76
Added new-look intro section for entry pages.
tony-gaia Oct 21, 2016
d953ae9
Merge branch 'master' into aesthetic_changes
tony-gaia Oct 24, 2016
366a269
Used new intro template in all application pages, changed application…
tony-gaia Oct 25, 2016
7568ccc
Removed unnecessary space
tony-gaia Oct 25, 2016
148f9b5
Merge branch 'master' into aesthetic_changes
tony-gaia Oct 25, 2016
0022dfa
Merge branch 'master' into aesthetic_changes
tony-gaia Oct 26, 2016
718a00f
Added price label to licence types and variants.
tony-gaia Oct 26, 2016
a6d233f
Merge branch 'master' into aesthetic_changes
tony-gaia Oct 26, 2016
47d5b78
Added meta header to turn off the telephone number detection for W11/…
serge-gaia Oct 26, 2016
7ed0606
Added comment for the phone number meta header.
serge-gaia Oct 26, 2016
90dd50a
Merge branch 'master' into disable_phone_detection_windows
serge-gaia Oct 26, 2016
14d827e
Merge pull request #127 from gaiaresources/disable_phone_detection_wi…
tony-gaia Oct 26, 2016
c3180d8
Changed intro section appearance and customer dashboard text.
tony-gaia Oct 26, 2016
025b6e1
Basic auth test for reports
serge-gaia Oct 26, 2016
ea9b604
Changed product code from slug-field to charfield
tony-gaia Oct 27, 2016
9488692
Merge branch 'master' into aesthetic_changes
tony-gaia Oct 27, 2016
ebd8e17
Merge pull request #128 from gaiaresources/product_code_slug_change
serge-gaia Oct 27, 2016
36b52b4
Merge branch 'master' into add_tests
serge-gaia Oct 27, 2016
56fb6fc
Merge pull request #129 from gaiaresources/add_tests
tony-gaia Oct 27, 2016
e9d5247
Numerous fixes
tony-gaia Oct 27, 2016
52517b4
Merge pull request #130 from gaiaresources/aesthetic_changes
serge-gaia Oct 28, 2016
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
85 changes: 82 additions & 3 deletions wildlifelicensing/apps/applications/mixins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import datetime

from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.mixins import UserPassesTestMixin

Expand All @@ -9,7 +11,7 @@ class UserCanEditApplicationMixin(UserPassesTestMixin):
"""
CBV mixin that check that the user is the applicant and that the status of the application is
in editable mode.
This mixin assume that the url contains the pk of the application on 2nd position.

If the user is not logged-in it redirects to the login page, else it throws a 403
Officers can edit an application
"""
Expand All @@ -25,7 +27,7 @@ def get_application(self):

def test_func(self):
"""
implementation of the UserPassesTestMixin test_func
implementation of the UserCanEditApplicationMixin test_func
"""
user = self.request.user
if not user.is_authenticated():
Expand All @@ -41,6 +43,83 @@ def test_func(self):
return True


class UserCanRenewApplicationMixin(UserPassesTestMixin):
"""
CBV mixin that check that the user is the applicant and that the application is renewable.

If the user is not logged-in it redirects to the login page, else it throws a 403
Officers can edit an application
"""
login_url = reverse_lazy('home')
permission_denied_message = "You don't have the permission to access this resource."
raise_exception = True

def get_application(self):
if self.args:
return Application.objects.filter(licence=self.args[0]).first()
else:
return None

def test_func(self):
"""
implementation of the UserCanRenewApplicationMixin test_func
"""
user = self.request.user
if not user.is_authenticated():
self.raise_exception = False
return False
if is_officer(user):
return True
self.raise_exception = True
application = self.get_application()
if application is not None:
if application.applicant != user:
return False

expiry_days = (application.licence.end_date - datetime.date.today()).days
return expiry_days <= 30 and application.licence.is_renewable
else:
return False


class UserCanAmendApplicationMixin(UserPassesTestMixin):
"""
CBV mixin that check that the user is the applicant and that the application is amendable.

If the user is not logged-in it redirects to the login page, else it throws a 403
Officers can edit an application
"""
login_url = reverse_lazy('home')
permission_denied_message = "You don't have the permission to access this resource."
raise_exception = True

def get_application(self):
if self.args:
return Application.objects.filter(licence=self.args[0]).first()
else:
return None

def test_func(self):
"""
implementation of the UserCanAmendApplicationMixin test_func
"""
user = self.request.user
if not user.is_authenticated():
self.raise_exception = False
return False
if is_officer(user):
return True
self.raise_exception = True
application = self.get_application()
if application is not None:
if application.applicant != user:
return False

return application.licence.end_date >= datetime.date.today()
else:
return False


class CanPerformAssessmentMixin(UserPassesTestMixin):
"""
CBV mixin that check the 'editability' of assessment that the user is a assessor and that he/she belongs to the right assessor group.
Expand Down Expand Up @@ -74,7 +153,7 @@ def test_func(self):

class UserCanViewApplicationMixin(UserPassesTestMixin):
"""
CBV mixin that check that the user is the applicant or an officer and that the status of the
CBV mixin that check that the user is the applicant or an officer and that the status of the
application is in approved mode.
If the user is not logged-in it redirects to the login page, else it throws a 403
"""
Expand Down
4 changes: 2 additions & 2 deletions wildlifelicensing/apps/applications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def can_user_view(self):
@property
def is_senior_offer_applicable(self):
return self.licence_type.senior_applicable and \
self.applicant.is_senior and \
bool(self.applicant.senior_card)
self.applicant.is_senior and \
bool(self.applicant.senior_card)

def log_user_action(self, action, request):
return ApplicationUserAction.log_action(self, action, request.user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ hr {

a {
cursor: pointer;
}
}intro

/* enter details / preview */
{% load bootstrap3 %}

#sectionList > ul > .active {
font-weight: bold;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'wl/base.html' %}

{% load static %}

{% block extra_css %}
<link href="{% static 'wl/css/applications.css' %}" rel="stylesheet"/>
{% endblock %}

{% block intro %}
<div class="container bottom-buffer">
<div class="top-buffer bottom-buffer intro applications">
{% block intro_title %}{% endblock %}
{% block intro_subtitle %}{% endblock %}
</div>
{% block intro_text%}{% endblock %}
<hr>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'wl/base.html' %}
{% extends 'wl/applications_base.html' %}

{% load static %}

Expand All @@ -10,7 +10,7 @@
<link href="//static.dpaw.wa.gov.au/static/libs/select2/3.5.3/select2.min.css" rel="stylesheet"/>
<link href="//static.dpaw.wa.gov.au/static/libs/select2-bootstrap-css/1.4.6/select2-bootstrap.css"
rel="stylesheet"/>
<link href="{% static 'wl/css/application.css' %}" rel="stylesheet"/>
{{ block.super }}
{% endblock %}

{% block requirements %}
Expand All @@ -29,7 +29,6 @@
logs.initActionLog({
logListURL: "{% url 'wl_applications:action_list' application.id %}",
});

});
});
{% endblock %}
Expand All @@ -48,15 +47,15 @@
</div>
{% endblock %}

{% block intro_title %}<h3>Enter Licence Conditions</h3>{% endblock %}
{% block intro_subtitle %}
<h4 class="inline">
{{ application.licence_type.name }}
</h4>
{% endblock %}

{% block content %}
<div class="container bottom-buffer">
<div class="row">
<div class="col-md-12">
<h2>Enter Licence Conditions</h2>
<h3>{{ application.licence_type.name }}</h3>
<hr>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'wl/base.html' %}
{% extends 'wl/applications_base.html' %}

{% load static %}

Expand All @@ -11,7 +11,7 @@
<link href="//static.dpaw.wa.gov.au/static/libs/select2/3.5.3/select2.min.css" rel="stylesheet"/>
<link href="//static.dpaw.wa.gov.au/static/libs/select2-bootstrap-css/1.4.6/select2-bootstrap.css"
rel="stylesheet"/>
<link href="{% static 'wl/css/application.css' %}" rel="stylesheet"/>
{{ block.super }}
{% endblock %}


Expand Down Expand Up @@ -48,15 +48,15 @@
</div>
{% endblock %}

{% block intro_title %}<h3>Enter Licence Conditions</h3>{% endblock %}
{% block intro_subtitle %}
<h4 class="inline">
{{ application.licence_type.name }}
</h4>
{% endblock %}

{% block content %}
<div class="container bottom-buffer">
<div class="row">
<div class="col-md-12">
<h2>Enter Licence Conditions</h2>
<h3>{{ application.licence_type.name }}</h3>
<hr>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'wl/base.html' %}
{% extends 'wl/applications_base.html' %}

{% load static %}

Expand All @@ -8,10 +8,6 @@

{% load users %}

{% block extra_css %}
<link href="{% static 'wl/css/application.css' %}" rel="stylesheet"/>
{% endblock %}

{% block breadcrumbs %}
<div class="container">
<div class="row">
Expand All @@ -25,22 +21,34 @@
</div>
{% endblock %}

{% block intro_title %}<h3>Application Complete</h3>{% endblock %}
{% block intro_subtitle %}
<h4 class="inline">
{{ licence_type.name }} {% if is_renewal %}(Renewal) {% endif %} {% if is_amendment %}(Amendment) {% endif %}
</h4>
{% if customer %}
<h4 class="pull-right">Customer: {{ customer.get_full_name }}</h4>
{% endif %}
{% if variants %}
<h4>
<em>({{ variants }})</em>
</h4>
{% endif %}
{% endblock %}
{% block intro_text %}
<div class="info">
<p>
The application process is now complete and your application is now under review. Please allow up to 20 working days for processing. You can see the status of the application
on the dashboard and view a read-only version of the application details. You may receive requests for amendments to the application, at which
point you will be able to modify the content and resubmit.
</p>
</div>
{% endblock %}

{% block content %}
<div class="container">
<div class="row">
<div class="col-md-12">
{% with heading='Application Complete' %}
{% include 'wl/entry/header.html' %}
{% endwith %}
</div>
</div>
<div class="row">
<div class="col-md-12">
<p>
The application process is now complete and your application is now under review. Please allow up to 20 working days for processing. You can see the status of the application
on the dashboard and view a read-only version of the application details. You may receive requests for amendments to the application, at which
point you will be able to modify the content and resubmit.
</p>
{% if show_invoice %}
<p>
Note that if your licence requires payment, the invoice must be paid before the licence can be issued. You can download the invoice from the links below.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'wl/base.html' %}
{% extends 'wl/applications_base.html' %}

{% load static %}

Expand All @@ -9,7 +9,7 @@
<link href="//static.dpaw.wa.gov.au/static/libs/select2-bootstrap-css/1.4.6/select2-bootstrap.css" rel="stylesheet"/>
<link href="//static.dpaw.wa.gov.au/static/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css"
rel="stylesheet"/>
<link href="{% static 'wl/css/application.css' %}" rel="stylesheet"/>
{{ block.super }}
{% endblock %}

{% block requirements %}
Expand All @@ -33,16 +33,13 @@
</div>
{% endblock %}

{% block intro_title %}<h3>Select or Create Customer</h3>{% endblock %}
{% block intro_subtitle %}<h4>Select or create the customer for whom the application is being applied on behalf of.</h4>{% endblock %}

{% block content %}
<div class="container bottom-buffer">
<div class="row">
<div class="col-md-12">
{% with heading='Select or Create Customer' %}
{% include 'wl/entry/header.html' %}
{% endwith %}
<p>
Select or create the customer for whom the application is being applied on behalf of.
</p>
<form method="post">
{% csrf_token %}
<div class="form-group">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
{% extends 'wl/base.html' %}
{% extends 'wl/applications_base.html' %}

{% load static %}

{% load bootstrap3 %}

{% load users %}

{% block extra_css %}
<link href="{% static 'wl/css/application.css' %}" rel="stylesheet"/>
{% endblock %}

{% block requirements %}
require(['js/entry/navigation'], function(navigation) {
navigation.setupNavigateAway('Warning: any information entered into the form '+
Expand All @@ -36,18 +32,32 @@
</div>
{% endblock %}

{% block intro_title %}<h3>Select Profile</h3>{% endblock %}
{% block intro_subtitle %}
<h4 class="inline">
{{ licence_type.name }} {% if is_renewal %}(Renewal) {% endif %} {% if is_amendment %}(Amendment) {% endif %}
</h4>
{% if customer %}
<h4 class="pull-right">Customer: {{ customer.get_full_name }}</h4>
{% endif %}
{% if variants %}
<h4>
<em>({{ variants }})</em>
</h4>
{% endif %}
{% endblock %}
{% block intro_text %}
<p>
The Wildlife Licensing system utilises the concept of profiles to allow users to apply for a licence under different circumstances, such holding a licence
for personal, commercial or research purposes. Please select an existing profile or alternatively create a new profile for this licence application.
</p>
{% endblock %}

{% block content %}
<div class="container bottom-buffer">
{% if profile_selection_form %}
<div class="row">
<div class="col-md-12">
{% with heading='Select Profile' %}
{% include 'wl/entry/header.html' %}
{% endwith %}
<p>
The Wildlife Licensing system utilises the concept of profiles to allow users to apply for a licence under different circumstances, such holding a licence
for personal, commercial or research purposes. Please select an existing profile or alternatively create a new profile for this licence application.
</p>
<form method="post">
{% csrf_token %}
{% bootstrap_form profile_selection_form %}
Expand Down
Loading