From 4a6aaccefc5c1304f76093ba39ee8b37504f3caa Mon Sep 17 00:00:00 2001 From: Raghavendra Kamath Date: Thu, 26 Apr 2018 16:02:32 +0530 Subject: [PATCH] Add frappe web for login and webform --- foundation/templates/base.html | 2 + .../doctype/web_form/templates/web_form.html | 380 ------------------ .../web_form/templates/web_form_row.html | 4 - 3 files changed, 2 insertions(+), 384 deletions(-) delete mode 100644 foundation/website/doctype/web_form/templates/web_form.html delete mode 100644 foundation/website/doctype/web_form/templates/web_form_row.html diff --git a/foundation/templates/base.html b/foundation/templates/base.html index 64eb2f3c..36bda7ab 100644 --- a/foundation/templates/base.html +++ b/foundation/templates/base.html @@ -18,7 +18,9 @@ {% block meta_block %}{% endblock %} + {% if path == 'login' or template == 'website/doctype/web_form/templates/web_form.html' %} + {% endif %} {%- endblock -%} {%- block head_include %}{{ head_include or "" }}{% endblock -%} {%- block style %}{%- endblock -%} diff --git a/foundation/website/doctype/web_form/templates/web_form.html b/foundation/website/doctype/web_form/templates/web_form.html deleted file mode 100644 index c0471370..00000000 --- a/foundation/website/doctype/web_form/templates/web_form.html +++ /dev/null @@ -1,380 +0,0 @@ -{% extends "templates/web.html" %} - -{% block title %}{{ _(title) }}{% endblock %} - -{% block header %} -

{{ _(title) }}

-{% endblock %} - -{% block breadcrumbs %} -{% if has_header and login_required %} -{% include "templates/includes/breadcrumbs.html" %} -{% endif %} -{% endblock %} - -{% block header_actions %} - {% if not read_only and has_header %} -
- {% if login_required -%} - - {{ _("Cancel") }} - {%- endif %} - {% if not is_list %} - - {% endif %} -
- {% endif %} - {% if is_list %} -
- - {{ _("New") }} - -
- {% endif %} - {%- if allow_print and not is_list and not _login_required -%} -
- - {{ _("Print") }} -
- {%- endif -%} -{% endblock %} - -{% block page_content %} -
- {% if introduction_text %} -

{{ _(introduction_text) }}

- {% endif %} -
-
-{% if _login_required %} -
-
- {{ _("Please sign-up or login to begin") }} -
-

- - {{ _("Login") }} - -

-
-{% elif is_list %} - {% include "templates/includes/list/list.html" %} - -{% else %} -
- -{%- macro properties(field) %} - name="{{ field.fieldname }}" data-fieldname="{{ field.fieldname }}" - {% if field.placeholder -%} placeholder="{{ _(field.placeholder) }}" {%- endif %} - data-label="{{ _(field.label) }}" data-fieldtype="{{ field.fieldtype }}" - data-doctype="{{ field.parent }}" data-default="{{ field.default or "" }}" - {{ field.reqd and "data-reqd=1" or "" }} - {{ (read_only or field.read_only) and "disabled" or "" }} -{% endmacro -%} - -{%- macro value(field, _doc) -%} - {%- if _doc -%} - {%- set _value = _doc.get(field.fieldname) or frappe.form_dict.get(field.fieldname) -%} - {%- else -%} - {%- set _value = frappe.form_dict.get(field.fieldname) or field.default -%} - {%- endif -%} - {{ "" if _value==None else _value }} -{%- endmacro -%} - -{%- macro help(field) -%} - {% if field.description -%} - {{ _(field.description) }} - {%- endif -%} -{%- endmacro %} - -{% macro label(field) %} - -{% endmacro %} - -{% macro render_field(field, _doc=None, with_label=True) %} - {% if field.hidden %} - - {% elif field.fieldtype == "HTML" %} -
- {% if field.options %}{{ field.options }}{% endif %} -
- {% elif field.fieldtype in ("Data", "Date", "Datetime", "Int", "Float") %} -
- {% if with_label %}{{ label(field) }}{% endif %} - - {{ help(field) }} -
- {% elif field.fieldtype=="Link" %} -
- {% if with_label %}{{ label(field) }}{% endif %} - - {{ help(field) }} -
- {% elif field.fieldtype=="Select" %} -
- {% if with_label %}{{ label(field) }}{% endif %} - - {{ help(field) }} -
- {% elif field.fieldtype in ("Text", "Small Text") %} -
- {% if with_label %}{{ label(field) }}{% endif %} - {{ help(field) }} - -
- {% elif field.fieldtype == "Text Editor" %} -
- {% if with_label %}{{ label(field) }}{% endif %} - {{ help(field) }} -
{{ value(field, _doc) }}
-
- {% elif field.fieldtype=="Attach" %} -
- {% if with_label %}{{ label(field) }}{% endif %} - {% if value(field, _doc) -%} -

- - {{ _doc.get(field.fieldname) }} - -
-

- {%- endif %} -

- -

- {{ _("Max attachment size is {0}MB").format(max_attachment_size) }} -

-

- {{ help(field) }} -
- {% elif field.fieldtype=="Check" %} -
-
- {% if with_label %} - - {% endif %} - {{ help(field) }} -
-
- {% endif %} -{% endmacro %} - -{% macro render_row(field, d=None, hidden=False) %} - - {% for df in frappe.get_meta(field.options).fields %} - {% if df.in_list_view %} - <{{ 'th' if d==None else 'td' }} style="width: {{ (df.columns or 2) * 8.3333 }}%;"> - {% if d!=None %} - {{ render_field(df, d, False) }} - {% else %} - {{ _(df.label) }} - {% endif %} - - {% endif %} - {% endfor %} - - {% if d!=None %} - - {% endif %} - - -{% endmacro %} - -{% macro render_table(field) %} - {{ label(field) }} -
- - - {{ render_row(field) }} - - - {{ render_row(field, {}, True) }} - {% if doc and doc.get(field.fieldname) %} - {% for d in doc.get(field.fieldname) %} - {{ render_row(field, d) }} - {% endfor %} - {% endif %} - -
-
-

-{% endmacro %} - - -{% if not frappe.form_dict.new and layout|len > 1 %} -
- {% for page in layout %} - - {% endfor %} -
-{% endif %} - -
- {% if frappe.form_dict.name and web_page_link_text %} - - {% endif %} - - {% for page in layout %} - {% set last_page = True if loop.index == layout|len else False %} -
- {% if page.label %} -

{{ _(page.label) }}

- {% endif %} - {% if page.description %} -

{{ _(page.description) }}

-
- {% endif %} - - {% for section in page.sections %} -
- {% if section.label %} -
{{ _(section.label) }}
- {{ _(section.description) }} - {% endif %} -
- {% for column in section.columns %} -
- {% for field in column %} - {% if field.fieldtype=='Table' %} - {{ render_table(field) }} - {% else %} - {{ render_field(field, doc) }} - {% endif %} - {% endfor %} -
- {% endfor %} -
-
- {% endfor %} - {% if last_page and accept_payment %} -
- {% if not doc.paid %} - {% if payment_button_help %} -
- {{ payment_button_help }}
- {% endif %} - - {{ payment_button_label or "Pay"}} - {% else %} -
{{ _("Payment Complete") }}
- {% endif %} -
- {% endif %} - -
- {% if layout|len > 1 %} -

- {{ _("Page {0} of {1}").format(loop.index, layout|len) }}

- {% endif %} -
-

- {%- if loop.index > 1 -%} - - {%- endif -%} - - {% if (loop.index == layout|len or frappe.form_dict.new) %} - {% if not read_only %} - - {% endif %} - {% elif layout|len > 1 %} - - {% endif %} -

-
-
- {% endfor %} - -
- -{% if allow_comments and not frappe.form_dict.new -%} -
-

-

{{ _("Comments") }}

- {% include 'templates/includes/comments/comments.html' %} -
-{%- endif %} -{% endif %} -
-{% endblock %} - -{% block script %} - - - - - -{% endblock %} -{% block style %} - -{% endblock %} diff --git a/foundation/website/doctype/web_form/templates/web_form_row.html b/foundation/website/doctype/web_form/templates/web_form_row.html deleted file mode 100644 index 2b999819..00000000 --- a/foundation/website/doctype/web_form/templates/web_form_row.html +++ /dev/null @@ -1,4 +0,0 @@ -
- {{ title }} -
- \ No newline at end of file