-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
470d6c2
commit b3ddeda
Showing
14 changed files
with
211 additions
and
141 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
4 changes: 2 additions & 2 deletions
4
builder/builder/doctype/builder_component/patches/set_component_id.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
|
||
import frappe | ||
|
||
|
||
def execute(): | ||
"""Set Component ID""" | ||
component_list = frappe.get_all("Builder Component") | ||
|
||
for component in component_list: | ||
component_doc = frappe.get_doc("Builder Component", component) | ||
component_doc.component_id = component_doc.name | ||
component_doc.db_set("component_id", component_doc.name, update_modified=False) | ||
component_doc.db_set("component_id", component_doc.name, update_modified=False) |
39 changes: 24 additions & 15 deletions
39
builder/builder/doctype/builder_page/patches/attach_client_script_to_builder_page.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 |
---|---|---|
@@ -1,31 +1,40 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
"""Attach Client Script to Builder Page""" | ||
for builder_page in frappe.db.sql("""select name, client_script, style from `tabBuilder Page`""", as_dict=True): | ||
for builder_page in frappe.db.sql( | ||
"""select name, client_script, style from `tabBuilder Page`""", as_dict=True | ||
): | ||
if builder_page.client_script: | ||
script_doc = get_or_create_builder_script("Builder Client Script", builder_page.client_script, "JavaScript") | ||
script_doc = get_or_create_builder_script( | ||
"Builder Client Script", builder_page.client_script, "JavaScript" | ||
) | ||
create_builder_page_client_script(builder_page.name, script_doc.name) | ||
elif builder_page.style: | ||
style_doc = get_or_create_builder_script("Builder Client Script", builder_page.style, "CSS") | ||
create_builder_page_client_script(builder_page.name, style_doc.name) | ||
|
||
|
||
def get_or_create_builder_script(doctype, script, script_type): | ||
script_name = frappe.db.exists(doctype, {"script": script}) | ||
if script_name: | ||
return frappe.get_doc(doctype, script_name) | ||
else: | ||
return frappe.get_doc({ | ||
"doctype": doctype, | ||
"script_type": script_type, | ||
"script": script | ||
}).insert(ignore_permissions=True) | ||
return frappe.get_doc({"doctype": doctype, "script_type": script_type, "script": script}).insert( | ||
ignore_permissions=True | ||
) | ||
|
||
|
||
def create_builder_page_client_script(parent, builder_script, parentfield="client_scripts", parenttype="Builder Page"): | ||
frappe.get_doc({ | ||
"doctype": "Builder Page Client Script", | ||
"parent": parent, | ||
"builder_script": builder_script, | ||
"parentfield": parentfield, | ||
"parenttype": parenttype | ||
}).insert(ignore_permissions=True) | ||
def create_builder_page_client_script( | ||
parent, builder_script, parentfield="client_scripts", parenttype="Builder Page" | ||
): | ||
frappe.get_doc( | ||
{ | ||
"doctype": "Builder Page Client Script", | ||
"parent": parent, | ||
"builder_script": builder_script, | ||
"parentfield": parentfield, | ||
"parenttype": parenttype, | ||
} | ||
).insert(ignore_permissions=True) |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
|
||
|
||
class BuilderPageClientScript(Document): | ||
pass | ||
pass |
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,4 +1,4 @@ | ||
frappe.search.utils.make_function_searchable( | ||
() => window.open("/builder"), | ||
"Open Builder", | ||
); | ||
() => window.open("/builder"), | ||
"Open Builder", | ||
); |
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
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
Oops, something went wrong.