Merge pull request #11763 from resilient-tech/fix-target
This commit is contained in:
commit
70d98f706f
11 changed files with 31 additions and 173 deletions
|
|
@ -314,3 +314,5 @@ execute:frappe.db.set_value('Website Settings', 'Website Settings', {'navbar_tem
|
|||
frappe.patches.v13_0.delete_event_producer_and_consumer_keys
|
||||
frappe.patches.v13_0.web_template_set_module #2020-10-05
|
||||
frappe.patches.v13_0.remove_custom_link
|
||||
execute:frappe.delete_doc("DocType", "Footer Item")
|
||||
frappe.patches.v13_0.replace_field_target_with_open_in_new_tab
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
doctype = "Top Bar Item"
|
||||
if not frappe.db.table_exists(doctype) \
|
||||
or not frappe.db.has_column(doctype, "target"):
|
||||
return
|
||||
|
||||
frappe.reload_doc("website", "doctype", "top_bar_item")
|
||||
frappe.db.set_value(doctype, {"target": 'target = "_blank"'}, 'open_in_new_tab', 1)
|
||||
|
|
@ -15,7 +15,8 @@
|
|||
<ul class="footer-group-links list-unstyled">
|
||||
{%- for child in group.child_items -%}
|
||||
<li class="footer-child-item" data-label="{{ child.label }}">
|
||||
<a href="{{ child.url | abs_url }}" {% if child.target %} target="_blank" {% endif %} rel="noreferrer">
|
||||
<a href="{{ child.url | abs_url }}"
|
||||
{% if child.open_in_new_tab %} target="_blank" {% endif %} rel="noreferrer">
|
||||
{%- if child.icon -%}
|
||||
<img src="{{ child.icon }}" alt="{{ child.label }}">
|
||||
{%- else -%}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{% macro footer_link(item) %}
|
||||
<a href="{{ item.url | abs_url }}" {{ item.target }} class="footer-link" rel="noreferrer">
|
||||
<a href="{{ item.url | abs_url }}" {% if item.open_in_new_tab %} target="_blank" {% endif %} class="footer-link" rel="noreferrer">
|
||||
{%- if item.icon -%}
|
||||
<img src="{{ item.icon }}" alt="{{ item.label }}">
|
||||
{%- else -%}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<li {% if child.label %}data-label="{{ child.label }}" {% endif %}
|
||||
class="{% if child.class %} {{ child.class }} {% endif %} logged-in" >
|
||||
{%- if child.url -%}
|
||||
<a href="{{ child.url | abs_url }}" {{ child.target or '' }}
|
||||
<a href="{{ child.url | abs_url }}" {% if child.open_in_new_tab %} target="_blank" {% endif %}
|
||||
rel="nofollow">
|
||||
{{ child.label }}
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@
|
|||
{% if parent %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ (item.url or '')|abs_url }}"
|
||||
{{ item.target or ''}}>
|
||||
{% if item.open_in_new_tab %} target="_blank" {% endif %}>
|
||||
{{ item.label }}
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="{{ (item.url or '') | abs_url }}"
|
||||
{{ item.target or '' }}>
|
||||
{% if item.open_in_new_tab %} target="_blank" {% endif %}>
|
||||
{{ item.label }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
{%- for child in post_login -%}
|
||||
{%- if child.url -%}
|
||||
<a class="dropdown-item" href="{{ child.url | abs_url }}" {{ child.target or '' }} rel="nofollow">
|
||||
<a class="dropdown-item" href="{{ child.url | abs_url }}" {% if child.open_in_new_tab %} target="_blank" {% endif %} rel="nofollow">
|
||||
{{ child.label }}
|
||||
</a>
|
||||
{%- endif -%}
|
||||
|
|
|
|||
|
|
@ -1,146 +0,0 @@
|
|||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2016-04-12 18:40:16.315024",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Other",
|
||||
"editable_grid": 1,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "label",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Label",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "120px",
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"description": "",
|
||||
"fieldname": "group_label",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Group Label",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nCompany\nContact\nPolicy",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"description": "Link to the page you want to open. Leave blank if you want to make it a group parent.",
|
||||
"fieldname": "url",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "URL",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "200px",
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "200px"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"description": "Select target = \"_blank\" to open in a new page.",
|
||||
"fieldname": "target",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Target",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\ntarget = \"_blank\"",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-07-11 03:28:00.573336",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Footer Item",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC",
|
||||
"track_seen": 0
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class FooterItem(Document):
|
||||
pass
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
"field_order": [
|
||||
"label",
|
||||
"url",
|
||||
"target",
|
||||
"open_in_new_tab",
|
||||
"right",
|
||||
"column_break_5",
|
||||
"parent_label",
|
||||
|
|
@ -40,19 +40,11 @@
|
|||
"print_width": "200px",
|
||||
"width": "200px"
|
||||
},
|
||||
{
|
||||
"description": "Select target = \"_blank\" to open in a new page.",
|
||||
"fieldname": "target",
|
||||
"fieldtype": "Select",
|
||||
"label": "Target",
|
||||
"options": "\ntarget = \"_blank\""
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "For top bar",
|
||||
"fieldname": "right",
|
||||
"fieldtype": "Check",
|
||||
"label": "Right"
|
||||
"label": "Align Right"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_5",
|
||||
|
|
@ -63,12 +55,20 @@
|
|||
"fieldname": "icon",
|
||||
"fieldtype": "Attach Image",
|
||||
"label": "Icon"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.url",
|
||||
"fieldname": "open_in_new_tab",
|
||||
"fieldtype": "Check",
|
||||
"label": "Open URL in a New Tab"
|
||||
}
|
||||
],
|
||||
"idx": 1,
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-05-11 06:12:13.191644",
|
||||
"modified": "2020-10-26 20:59:42.142208",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Top Bar Item",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue