mirror of
https://github.com/erpnext/foundation.git
synced 2026-10-16 18:00:47 +02:00
Cleanup, add progress in list view
This commit is contained in:
@@ -4,5 +4,10 @@
|
||||
frappe.ui.form.on('Bounty', {
|
||||
refresh: function(frm) {
|
||||
|
||||
},
|
||||
feature_name: function(frm) {
|
||||
if (frm.doc.route) return;
|
||||
const route = 'bounty/' + frm.doc.feature_name.toLowerCase().replace(/ /g, '-');
|
||||
frm.set_value('route', route);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "github_issue",
|
||||
"fieldname": "route",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
@@ -58,7 +58,37 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "GitHub Issue",
|
||||
"label": "Route",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "published",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Published",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@@ -162,6 +192,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "github_issue",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "GitHub Issue",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -282,66 +342,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "published",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Published",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "route",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Route",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -364,7 +364,7 @@
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -384,7 +384,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-17 15:47:24.234653",
|
||||
"modified": "2017-08-21 15:20:13.637175",
|
||||
"modified_by": "Administrator",
|
||||
"module": "ERPNext Foundation",
|
||||
"name": "Bounty",
|
||||
|
||||
@@ -34,6 +34,9 @@ class Bounty(WebsiteGenerator):
|
||||
|
||||
def validate(self):
|
||||
self.bounty_collected = sum([backer.amount for backer in self.bounty_backer if backer.paid])
|
||||
if not self.route:
|
||||
self.published = 1
|
||||
self.route = 'bounty/' + self.feature_name.lower().replace(' ', '-')
|
||||
|
||||
def get_list_context(context):
|
||||
context.allow_guest = True
|
||||
@@ -41,5 +44,5 @@ def get_list_context(context):
|
||||
context.title = 'ERPNext Bounties'
|
||||
context.no_breadcrumbs = True
|
||||
context.order_by = 'creation desc'
|
||||
context.introduction = '<p>List of all ERPNext bounties</p>'
|
||||
context.introduction = '<a href="new-bounty" class="btn btn-primary">Start a new Bounty</a>'
|
||||
context.fmt_money = fmt_money
|
||||
@@ -1,9 +1,18 @@
|
||||
{% if doc.published %}
|
||||
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable">
|
||||
<a href={{ route }}>
|
||||
<h3>{{ doc.feature_name }}</h3>
|
||||
{% set bounty_progress = ((doc.bounty_collected/doc.goal)*100) %}
|
||||
<div class="progress" style="height: 6px;">
|
||||
<div class="progress-bar progress-bar-success" role="progressbar"
|
||||
aria-valuenow="{{bounty_progress}}" aria-valuemin="0" aria-valuemax="100" style="width: {{bounty_progress}}%">
|
||||
<span class="sr-only">{{ doc.bounty_collected }} of {{ doc.goal }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<span class="label">{{ fmt_money(doc.goal, currency="USD") }}</span>
|
||||
<span class="label">{{ doc.end_date }}</span>
|
||||
{% if doc.bounty_backer %}
|
||||
<span class="label">
|
||||
{{ doc.bounty_backer|len }}
|
||||
{% if doc.bounty_backer|len > 1 %}
|
||||
@@ -12,7 +21,9 @@
|
||||
Backer
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>{{ html2text(doc.description[:200]) }}{% if doc.description|len > 200 %}...{% endif %}</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -17,6 +17,7 @@ class BountyBacker(Document):
|
||||
|
||||
def on_payment_authorized(self, *args, **kwargs):
|
||||
self.db_set('paid', 1)
|
||||
# to trigger form events of Bounty doctype
|
||||
doc = frappe.get_doc('Bounty', self.bounty_name)
|
||||
doc.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user