-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from alyf-de/custom-markers
- Loading branch information
Showing
12 changed files
with
270 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import frappe | ||
|
||
from landa.utils import get_current_member_data | ||
from landa.water_body_management.doctype.custom_icon.custom_icon import get_icon_map | ||
|
||
|
||
def boot_session(bootinfo): | ||
if frappe.session.user == "Guest": | ||
return | ||
|
||
bootinfo.landa = get_current_member_data() | ||
bootinfo.icon_map = get_icon_map() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
10 changes: 10 additions & 0 deletions
10
landa/water_body_management/doctype/custom_icon/custom_icon.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) 2023, ALYF GmbH and contributors | ||
// For license information, please see license.txt | ||
|
||
frappe.ui.form.on("Custom Icon", { | ||
refresh: function (frm) { | ||
if (!frm.is_new() && !frm.doc.icon) { | ||
frm.dashboard.set_headline(__("Please attach an icon file.")); | ||
} | ||
}, | ||
}); |
67 changes: 67 additions & 0 deletions
67
landa/water_body_management/doctype/custom_icon/custom_icon.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"actions": [], | ||
"creation": "2023-07-18 20:42:02.895070", | ||
"doctype": "DocType", | ||
"editable_grid": 1, | ||
"engine": "InnoDB", | ||
"field_order": [ | ||
"title", | ||
"icon" | ||
], | ||
"fields": [ | ||
{ | ||
"fieldname": "title", | ||
"fieldtype": "Data", | ||
"in_list_view": 1, | ||
"label": "Title", | ||
"reqd": 1 | ||
}, | ||
{ | ||
"fieldname": "icon", | ||
"fieldtype": "Attach Image", | ||
"label": "Icon", | ||
"mandatory_depends_on": "eval: !doc.__islocal" | ||
} | ||
], | ||
"image_field": "icon", | ||
"links": [], | ||
"make_attachments_public": 1, | ||
"modified": "2023-11-10 12:54:07.987734", | ||
"modified_by": "Administrator", | ||
"module": "Water Body Management", | ||
"name": "Custom Icon", | ||
"owner": "Administrator", | ||
"permissions": [ | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "System Manager", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "LANDA State Organization Employee", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"read": 1, | ||
"role": "All" | ||
} | ||
], | ||
"sort_field": "modified", | ||
"sort_order": "DESC", | ||
"title_field": "title" | ||
} |
15 changes: 15 additions & 0 deletions
15
landa/water_body_management/doctype/custom_icon/custom_icon.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2023, ALYF GmbH and contributors | ||
# For license information, please see license.txt | ||
|
||
import frappe | ||
from frappe.model.document import Document | ||
|
||
|
||
class CustomIcon(Document): | ||
def autoname(self): | ||
self.name = "-".join(self.title.lower().split(" ")) | ||
|
||
|
||
def get_icon_map(): | ||
icons = frappe.get_all("Custom Icon", fields=["name", "icon"]) | ||
return {icon.name: icon.icon for icon in icons} |
9 changes: 9 additions & 0 deletions
9
landa/water_body_management/doctype/custom_icon/test_custom_icon.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2023, ALYF GmbH and Contributors | ||
# See license.txt | ||
|
||
# import frappe | ||
import unittest | ||
|
||
|
||
class TestCustomIcon(unittest.TestCase): | ||
pass |
17 changes: 17 additions & 0 deletions
17
landa/water_body_management/doctype/water_body/water_body.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
div[data-fieldname="icon_preview"] { | ||
height: 24px; | ||
width: 24px; | ||
margin: auto !important; | ||
} | ||
|
||
input[type=range]::-webkit-slider-thumb { | ||
background: var(--primary); | ||
} | ||
|
||
input[type=range]::-moz-range-thumb { | ||
background: var(--primary); | ||
} | ||
|
||
input[type=range]::-ms-thumb { | ||
background: var(--primary); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters