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:
Levi 2016-07-31 18:58:43 -05:00
parent 57d27e8bc6
commit 8439057f1d
8 changed files with 179 additions and 88 deletions

View 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;
}

View file

@ -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>

View file

@ -3,7 +3,12 @@
{% load i18n %}
{% block content %}
<div class="container order-detail-container">
<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">
@ -44,9 +49,9 @@
<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>
<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"><b>{{donation.donation}} USD</b></p></h4>
<h4>{% trans "Total"%}<p class="pull-right white-font"><b>{{donation.donation}} USD</b></h4>
</div>
<br/>
{% url 'hosting:payment' as payment_url %}
@ -71,4 +76,9 @@
</div>
</div>
</div>
</div>
</div>
</header>
{%endblock%}

View file

@ -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>
<div class="container orders-container">
<div class="row">
<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 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>
@ -51,10 +82,8 @@
{% endif %}
</div>
</div>
</div>
</div>
</header>
{% endblock %}

View file

@ -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;">

View file

@ -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 %}

View file

@ -17,7 +17,9 @@
<h2 class="section-heading">{% trans "Sign up"%}</h2>
<form action="{% url 'nosystemd:signup' %}" method="post" class="form" novalidate>
{% 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 %}

View file

@ -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'))