Move donation and subscription out from the user menu to the navbar, Changed donations.html background and style, Added donation status to donations.html. Added button cancel donation to donation.html ,Added button reactivate donation to donation.html,Fixed some bugs on donation view. Changed donations.html table style. Added pagination to donations list view. Hiding donate now button if the user is logged in and already has a donation. Handled the case when an user has not donations yet in donations.html view. Fixed bug on donation signup
This commit is contained in:
parent
57d27e8bc6
commit
8439057f1d
8 changed files with 179 additions and 88 deletions
21
nosystemd/static/nosystemd/css/nosystemd.css
Normal file
21
nosystemd/static/nosystemd/css/nosystemd.css
Normal file
|
@ -0,0 +1,21 @@
|
|||
.donations-container {
|
||||
|
||||
top:30% !important;
|
||||
}
|
||||
|
||||
|
||||
.donations-container .table-hover>tbody>tr:hover {
|
||||
color:black;
|
||||
}
|
||||
|
||||
.donations-container .table>thead>tr>th {
|
||||
text-alig:center;
|
||||
}
|
||||
|
||||
.donation-detail-container {
|
||||
text-align:left !important;
|
||||
}
|
||||
|
||||
.white-font {
|
||||
color:white;
|
||||
}
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
<title>NOSYSTEMD</title>
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{% static 'nosystemd/vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
|
||||
|
||||
|
@ -26,6 +28,9 @@
|
|||
<!-- Theme CSS -->
|
||||
<link href="{% static 'nosystemd/css/creative.css' %}" rel="stylesheet">
|
||||
|
||||
<link href="{% static 'nosystemd/css/nosystemd.css' %}" rel="stylesheet">
|
||||
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
|
@ -50,7 +55,7 @@
|
|||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<!-- <li>
|
||||
<a class="page-scroll" href="#about">About</a>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -58,14 +63,15 @@
|
|||
</li>
|
||||
<li>
|
||||
<a class="page-scroll" href="#contact">Contact</a>
|
||||
</li>
|
||||
</li> -->
|
||||
{% if request.user.is_authenticated %}
|
||||
<li>
|
||||
<a href="{% url 'nosystemd:donations' %}"><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "My Donations"%} </a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#">
|
||||
<i class="glyphicon glyphicon-user"></i> {{request.user.name}} <span class="caret"></span></a>
|
||||
<ul id="g-account-menu" class="dropdown-menu" role="menu">
|
||||
<li><a href="{% url 'nosystemd:donations' %}"><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "Donations"%} </a></li>
|
||||
<li><a href="{% url 'nosystemd:donator_status' %}"><i class="fa fa-credit-card" aria-hidden="true"></i> {% trans "Subscription"%} </a></li>
|
||||
<li><a href="{% url 'nosystemd:logout' %}"><i class="glyphicon glyphicon-lock"></i> {% trans "Logout"%} </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -3,72 +3,82 @@
|
|||
{% load i18n %}
|
||||
{% block content %}
|
||||
|
||||
<div class="container order-detail-container">
|
||||
<div class="row">
|
||||
<div class="col-xs-8 col-xs-offset-2">
|
||||
<div class="invoice-title">
|
||||
<h2>{% trans "Invoice"%}</h2><h3 class="pull-right">{% trans "Donation #"%} {{donation.id}}</h3>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<address>
|
||||
<h3><b>{% trans "Billing Address:"%}</b></h3>
|
||||
{{user.name}}<br>
|
||||
{{donation.billing_address.street_address}},{{donation.billing_address.postal_code}}<br>
|
||||
{{donation.billing_address.city}}, {{donation.billing_address.country}}.
|
||||
</address>
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
<address>
|
||||
<strong>{% trans "Date:"%}</strong><br>
|
||||
{{donation.created_at}}<br><br>
|
||||
<br><br>
|
||||
</address>
|
||||
<header style="text-align:left">
|
||||
<div class="header-content donation-detail-container">
|
||||
<div class="header-content-inner">
|
||||
|
||||
|
||||
<div class="container ">
|
||||
<div class="row">
|
||||
<div class="col-xs-8 col-xs-offset-2">
|
||||
<div class="invoice-title">
|
||||
<h2>{% trans "Invoice"%}</h2><h3 class="pull-right">{% trans "Donation #"%} {{donation.id}}</h3>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<address>
|
||||
<h3><b>{% trans "Billing Address:"%}</b></h3>
|
||||
{{user.name}}<br>
|
||||
{{donation.billing_address.street_address}},{{donation.billing_address.postal_code}}<br>
|
||||
{{donation.billing_address.city}}, {{donation.billing_address.country}}.
|
||||
</address>
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
<address>
|
||||
<strong>{% trans "Date:"%}</strong><br>
|
||||
{{donation.created_at}}<br><br>
|
||||
<br><br>
|
||||
</address>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<address>
|
||||
<strong>{% trans "Payment Method:"%}</strong><br>
|
||||
{{donation.cc_brand}} ending **** {{donation.last4}}<br>
|
||||
{{user.email}}
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<h3><b>{% trans "Donation summary"%}</b></h3>
|
||||
<hr>
|
||||
<div class="content">
|
||||
<b>{% trans "Donation"%}-{{donation.created_at|date:"M Y"}}</b> <span class="pull-right">{{donation.donation}} USD</span>
|
||||
<hr>
|
||||
<h4>{% trans "Total"%}<p class="pull-right white-font"><b>{{donation.donation}} USD</b></h4>
|
||||
</div>
|
||||
<br/>
|
||||
{% url 'hosting:payment' as payment_url %}
|
||||
{% if payment_url in request.META.HTTP_REFERER %}
|
||||
<div class=" content pull-right">
|
||||
<a href="{% url 'hosting:virtual_machine_key' order.vm_plan.id %}" ><button class="btn btn-info">{% trans "Finish Configuration"%}</button></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<hr>
|
||||
{% trans "Thanks for you donation, you can cancel your monthly donation at any time going to profile > subscription "%}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class=" content pull-right">
|
||||
<a href="{% url 'nosystemd:donations' %}" ><button class="btn btn-info">{% trans "View Donations"%}</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<address>
|
||||
<strong>{% trans "Payment Method:"%}</strong><br>
|
||||
{{donation.cc_brand}} ending **** {{donation.last4}}<br>
|
||||
{{user.email}}
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<h3><b>{% trans "Donation summary"%}</b></h3>
|
||||
<hr>
|
||||
<div class="content">
|
||||
<p><b>{% trans "Donation"%}-{{donation.created_at|date:"M Y"}}</b> <span class="pull-right">{{donation.donation}} USD</span></p>
|
||||
<hr>
|
||||
<h4>{% trans "Total"%}<p class="pull-right"><b>{{donation.donation}} USD</b></p></h4>
|
||||
</div>
|
||||
<br/>
|
||||
{% url 'hosting:payment' as payment_url %}
|
||||
{% if payment_url in request.META.HTTP_REFERER %}
|
||||
<div class=" content pull-right">
|
||||
<a href="{% url 'hosting:virtual_machine_key' order.vm_plan.id %}" ><button class="btn btn-info">{% trans "Finish Configuration"%}</button></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<hr>
|
||||
{% trans "Thanks for you donation, you can cancel your monthly donation at any time going to profile > subscription "%}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class=" content pull-right">
|
||||
<a href="{% url 'nosystemd:donations' %}" ><button class="btn btn-info">{% trans "View Donations"%}</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{%endblock%}
|
||||
|
|
|
@ -2,13 +2,44 @@
|
|||
{% load staticfiles bootstrap3 i18n %}
|
||||
|
||||
{% block content %}
|
||||
<header>
|
||||
<div class="header-content donations-container">
|
||||
<div class="header-content-inner">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div style="margin-top:10%">
|
||||
|
||||
{% if messages %}
|
||||
<ul class="list-unstyled">
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% if donator_status %}
|
||||
<form action="{% url 'nosystemd:change_donator_status' donator_status.id %}" method="post" class="form" novalidate>
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
<h3>Your monthly donation status is {{donator_status.status}}
|
||||
<button type="submit" class="btn btn-link">
|
||||
{% if donator_status.status == 'active'%}
|
||||
{% trans "Cancel Donation"%}
|
||||
{% else %}
|
||||
{% trans "Reanude Donation"%}
|
||||
{% endif %}
|
||||
|
||||
</button>
|
||||
</h3>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="container orders-container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<table class="table borderless table-hover">
|
||||
<h3><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "Donations"%}</h3>
|
||||
<h3><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "Donations Made"%}</h3>
|
||||
<br/>
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -36,25 +67,23 @@
|
|||
|
||||
{% if is_paginated %}
|
||||
<div class="pagination">
|
||||
<span class="page-links">
|
||||
{% if page_obj.has_previous %}
|
||||
<span class="page-links">
|
||||
{% if page_obj.has_previous %}
|
||||
<a href="{{ request.path }}?page={{ page_obj.previous_page_number }}">{% trans "previous"%}</a>
|
||||
{% endif %}
|
||||
<span class="page-current">
|
||||
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
|
||||
</span>
|
||||
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
|
||||
</span>
|
||||
{% if page_obj.has_next %}
|
||||
<a href="{{ request.path }}?page={{ page_obj.next_page_number }}">{% trans "next"%}</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% endblock %}
|
|
@ -95,12 +95,12 @@
|
|||
<table cellspacing="0" cellpadding="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
|
||||
<tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
|
||||
<td class="header-lg" style="border-collapse: collapse; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 32px; color: #4d4d4d; text-align: center; line-height: normal; font-weight: 700; padding: 35px 0 0;" align="center">
|
||||
Thank you for you support.
|
||||
Thank you for your support.
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
|
||||
<td class="free-text" style="border-collapse: collapse; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; width: 100% !important; padding: 10px 60px 0px;" align="center">
|
||||
Your monthly donation for {{donation.donation}} USD has been charged. <br/> you can view your invoice clicking on the button below.
|
||||
Your monthly donation for {{donation.donation}} USD has been charged. <br/> You can view your invoice clicking on the button below.
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
|
||||
|
|
|
@ -8,14 +8,16 @@
|
|||
<h1 id="homeHeading">No more SYSTEMD</h1>
|
||||
<hr>
|
||||
<p>We want to remove systemd from the famous linux distros and create a good replacement</p>
|
||||
{% if allow_donation %}
|
||||
<a href="{% url 'nosystemd:make_donation' %}" class="btn btn-primary btn-xl page-scroll">DONATE NOW</a>
|
||||
{% endif %}
|
||||
<h2>We have collected <strong class="text-primary" >{{total_donations_amount}} USD</strong> at time. Thanks you all.</h2>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="bg-primary" id="about">
|
||||
<!-- <section class="bg-primary" id="about">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 text-center">
|
||||
|
@ -98,6 +100,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section> -->
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
<h2 class="section-heading">{% trans "Sign up"%}</h2>
|
||||
|
||||
<form action="{% url 'nosystemd:signup' %}" method="post" class="form" novalidate>
|
||||
<input type="hidden" name="next" value="{{ request.GET.next }}">
|
||||
{% if request.GET.next %}
|
||||
<input type="hidden" name="next" value="{{ request.GET.next }}">
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
{% bootstrap_field field show_label=False %}
|
||||
|
|
|
@ -23,9 +23,15 @@ class LandingView(TemplateView):
|
|||
template_name = "nosystemd/landing.html"
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
|
||||
allow_donation = self.request.user.is_anonymous() or \
|
||||
(self.request.user.is_authenticated() and
|
||||
not DonatorStatus.objects.filter(user=self.request.user).exists())
|
||||
|
||||
total_donations_amount = Donation.get_total_donations_amount()
|
||||
context = {
|
||||
'total_donations_amount': total_donations_amount
|
||||
'total_donations_amount': total_donations_amount,
|
||||
'allow_donation': allow_donation
|
||||
}
|
||||
return context
|
||||
|
||||
|
@ -112,7 +118,7 @@ class DonationView(LoginRequiredMixin, FormView):
|
|||
|
||||
if DonatorStatus.objects.filter(user=self.request.user).exists():
|
||||
messages.success(self.request, 'Your already are a monthly contributor')
|
||||
return HttpResponseRedirect(reverse_lazy('nosystemd:donator_status'))
|
||||
return HttpResponseRedirect(reverse_lazy('nosystemd:donations'))
|
||||
|
||||
return self.render_to_response(self.get_context_data())
|
||||
|
||||
|
@ -200,6 +206,21 @@ class DonationListView(LoginRequiredMixin, ListView):
|
|||
context_object_name = "donations"
|
||||
login_url = reverse_lazy('nosystemd:login')
|
||||
model = Donation
|
||||
paginate_by = 10
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DonationListView, self).get_context_data(**kwargs)
|
||||
|
||||
status = None
|
||||
try:
|
||||
status = self.request.user.donatorstatus
|
||||
except DonatorStatus.DoesNotExist:
|
||||
pass
|
||||
|
||||
context.update({
|
||||
'donator_status': status
|
||||
})
|
||||
return context
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super(DonationListView, self).get_queryset()
|
||||
|
@ -243,4 +264,4 @@ class ChangeDonatorStatusDetailView(LoginRequiredMixin, UpdateView):
|
|||
|
||||
donator_status.save()
|
||||
messages.success(self.request, 'Your monthly donation status has been changed.')
|
||||
return HttpResponseRedirect(reverse_lazy('nosystemd:donator_status'))
|
||||
return HttpResponseRedirect(reverse_lazy('nosystemd:donations'))
|
||||
|
|
Loading…
Reference in a new issue