Add edit button

This commit is contained in:
Faris Ansari
2017-08-28 15:49:33 +05:30
parent cbe8d2d9d9
commit 398bac512a
4 changed files with 19 additions and 5 deletions

View File

@@ -14,7 +14,7 @@ class Bounty(WebsiteGenerator):
paid_backers = [backer for backer in self.bounty_backer if backer.paid] paid_backers = [backer for backer in self.bounty_backer if backer.paid]
no_of_backers = len(paid_backers) no_of_backers = len(paid_backers)
if no_of_backers == 0: if no_of_backers == 0:
no_of_backers = 'No backers yet' no_of_backers = 'Be the first to back this bounty'
elif no_of_backers == 1: elif no_of_backers == 1:
no_of_backers = str(no_of_backers) + ' backer' no_of_backers = str(no_of_backers) + ' backer'
else: else:

View File

@@ -31,7 +31,13 @@
</style> </style>
<div class="main"> <div class="main">
<h1>{{ title }} <span style="font-size: 14px; line-height: 44px;" class="pull-right small">{{days_to_go}} days to go</span></h1> <h1>
{{ title }}
{% if doc.owner == frappe.session.user %}
<a href="/new-bounty?name={{doc.name}}" class="btn btn-default btn-xs">Edit</a>
{% endif %}
<span style="font-size: 14px; line-height: 44px;" class="pull-right small">{{days_to_go}} days to go</span>
</h1>
{% set bounty_progress = ((doc.bounty_collected/doc.goal)*100) %} {% set bounty_progress = ((doc.bounty_collected/doc.goal)*100) %}
<div class="progress" style="height: 12px;"> <div class="progress" style="height: 12px;">
<div class="progress-bar progress-bar-success" role="progressbar" <div class="progress-bar progress-bar-success" role="progressbar"
@@ -100,7 +106,7 @@
</div> </div>
<p> <p>
<h4>About this feature</h4> <h6 class="text-muted uppercase">About this feature</h6>
<p>{{doc.description}}</p> <p>{{doc.description}}</p>
</p> </p>
<hr style="margin: 50px 0;"> <hr style="margin: 50px 0;">

View File

@@ -1,3 +1,7 @@
frappe.ready(function() { frappe.ready(function() {
setTimeout(() => {
if ($('select[name=user]').val() === "") {
window.location.href = '/bounties';
}
}, 1000);
}) })

View File

@@ -1,3 +1,7 @@
frappe.ready(function() { frappe.ready(function() {
// bind events here setTimeout(() => {
if ($('select[name=user]').val() === "") {
window.location.href = '/bounties';
}
}, 1000);
}) })