From 398bac512a0dd6e0e8dc7df4214d0f7e33ff07d0 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 28 Aug 2017 15:49:33 +0530 Subject: [PATCH] Add edit button --- foundation/erpnext_foundation/doctype/bounty/bounty.py | 2 +- .../doctype/bounty/templates/bounty.html | 10 ++++++++-- .../web_form/back_this_bounty/back_this_bounty.js | 6 +++++- .../back_this_bounty_usd/back_this_bounty_usd.js | 6 +++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/foundation/erpnext_foundation/doctype/bounty/bounty.py b/foundation/erpnext_foundation/doctype/bounty/bounty.py index 203634e2..24fd2d33 100644 --- a/foundation/erpnext_foundation/doctype/bounty/bounty.py +++ b/foundation/erpnext_foundation/doctype/bounty/bounty.py @@ -14,7 +14,7 @@ class Bounty(WebsiteGenerator): paid_backers = [backer for backer in self.bounty_backer if backer.paid] no_of_backers = len(paid_backers) 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: no_of_backers = str(no_of_backers) + ' backer' else: diff --git a/foundation/erpnext_foundation/doctype/bounty/templates/bounty.html b/foundation/erpnext_foundation/doctype/bounty/templates/bounty.html index 1f78a014..98dc311d 100644 --- a/foundation/erpnext_foundation/doctype/bounty/templates/bounty.html +++ b/foundation/erpnext_foundation/doctype/bounty/templates/bounty.html @@ -31,7 +31,13 @@
-

{{ title }} {{days_to_go}} days to go

+

+ {{ title }} + {% if doc.owner == frappe.session.user %} + Edit + {% endif %} + {{days_to_go}} days to go +

{% set bounty_progress = ((doc.bounty_collected/doc.goal)*100) %}

-

About this feature

+
About this feature

{{doc.description}}


diff --git a/foundation/erpnext_foundation/web_form/back_this_bounty/back_this_bounty.js b/foundation/erpnext_foundation/web_form/back_this_bounty/back_this_bounty.js index 8d110a16..2385473f 100644 --- a/foundation/erpnext_foundation/web_form/back_this_bounty/back_this_bounty.js +++ b/foundation/erpnext_foundation/web_form/back_this_bounty/back_this_bounty.js @@ -1,3 +1,7 @@ frappe.ready(function() { - + setTimeout(() => { + if ($('select[name=user]').val() === "") { + window.location.href = '/bounties'; + } + }, 1000); }) \ No newline at end of file diff --git a/foundation/erpnext_foundation/web_form/back_this_bounty_usd/back_this_bounty_usd.js b/foundation/erpnext_foundation/web_form/back_this_bounty_usd/back_this_bounty_usd.js index 699703c5..2385473f 100644 --- a/foundation/erpnext_foundation/web_form/back_this_bounty_usd/back_this_bounty_usd.js +++ b/foundation/erpnext_foundation/web_form/back_this_bounty_usd/back_this_bounty_usd.js @@ -1,3 +1,7 @@ frappe.ready(function() { - // bind events here + setTimeout(() => { + if ($('select[name=user]').val() === "") { + window.location.href = '/bounties'; + } + }, 1000); }) \ No newline at end of file