Browse Source

[style] for web forms

version-14
Rushabh Mehta 8 years ago
parent
commit
4dc37d216f
4 changed files with 55 additions and 29 deletions
  1. +3
    -2
      frappe/public/css/website.css
  2. +3
    -2
      frappe/public/less/website.less
  3. +46
    -22
      frappe/templates/generators/web_form.html
  4. +3
    -3
      frappe/website/doctype/web_form/web_form.py

+ 3
- 2
frappe/public/css/website.css View File

@@ -592,6 +592,7 @@ fieldset {
font-weight: 500 !important; font-weight: 500 !important;
} }
.web-sidebar .sidebar-items { .web-sidebar .sidebar-items {
margin-top: -10px;
margin-bottom: 30px; margin-bottom: 30px;
} }
.web-sidebar .sidebar-items .title { .web-sidebar .sidebar-items .title {
@@ -633,7 +634,8 @@ fieldset {
margin-top: 15px; margin-top: 15px;
} }
.web-list-item { .web-list-item {
padding: 15px 0px;
padding: 10px;
margin: 0px -15px;
border-bottom: 1px solid #EBEFF2; border-bottom: 1px solid #EBEFF2;
} }
.web-list-item h1, .web-list-item h1,
@@ -810,7 +812,6 @@ a.active {
} }
.page-content.with-sidebar { .page-content.with-sidebar {
padding-left: 50px; padding-left: 50px;
padding-right: 50px;
} }
@media screen and (max-width: 480px) { @media screen and (max-width: 480px) {
.page-content { .page-content {


+ 3
- 2
frappe/public/less/website.less View File

@@ -256,6 +256,7 @@ fieldset {


.sidebar-items { .sidebar-items {
// margin-top:30px; // margin-top:30px;
margin-top: -10px;
margin-bottom:30px; margin-bottom:30px;
.title{ .title{
font-size: 14px; font-size: 14px;
@@ -308,7 +309,8 @@ fieldset {
} }


.web-list-item { .web-list-item {
padding: 15px 0px;
padding: 10px;
margin: 0px -15px;
border-bottom: 1px solid @light-border-color; border-bottom: 1px solid @light-border-color;


h1, h2, h3 { h1, h2, h3 {
@@ -535,7 +537,6 @@ a.active {


.page-content.with-sidebar { .page-content.with-sidebar {
padding-left: 50px; padding-left: 50px;
padding-right: 50px;
} }


@media screen and (max-width: 480px) { @media screen and (max-width: 480px) {


+ 46
- 22
frappe/templates/generators/web_form.html View File

@@ -32,8 +32,7 @@
{% block page_content %} {% block page_content %}
<div class="introduction"> <div class="introduction">
{% if introduction_text %} {% if introduction_text %}
<p class="lead">{{ introduction_text }}</p>
<hr>
<p class="text-muted">{{ introduction_text }}</p>
{% endif %} {% endif %}
</div> </div>
<div class="form-message alert alert-warning hide"></div> <div class="form-message alert alert-warning hide"></div>
@@ -74,7 +73,7 @@


{%- macro help(field) -%} {%- macro help(field) -%}
{% if field.description -%} {% if field.description -%}
<span class="help-block small">{{ _(field.description) }}</span>
<span class="help-block small text-muted">{{ _(field.description) }}</span>
{%- endif -%} {%- endif -%}
{%- endmacro %} {%- endmacro %}


@@ -147,7 +146,7 @@
<p class="{{ value(field, _doc) and 'hide' or '' }} attach-input-wrap"> <p class="{{ value(field, _doc) and 'hide' or '' }} attach-input-wrap">
<input type="file" style="margin-top: 7px;" <input type="file" style="margin-top: 7px;"
{{ properties(field) }}> {{ properties(field) }}>
<p class='text-muted small'>
<p class='text-muted small' style='margin-bottom: 20px;'>
{{ _("Max attachment size is {0}MB").format(max_attachment_size) }} {{ _("Max attachment size is {0}MB").format(max_attachment_size) }}
</p> </p>
</p> </p>
@@ -157,7 +156,7 @@
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
{% if with_label %} {% if with_label %}
<label>
<label class='text-muted'>
<input type="checkbox" id="{{ field.fieldname }}" <input type="checkbox" id="{{ field.fieldname }}"
name="{{ field.fieldname }}" data-doctype="{{ field.parent }}" name="{{ field.fieldname }}" data-doctype="{{ field.parent }}"
{{ _doc and _doc.get(field.fieldname) and 'checked' or '' }}> {{ _doc and _doc.get(field.fieldname) and 'checked' or '' }}>
@@ -243,7 +242,14 @@
<div class="web-form-page{% if loop.index > 1 %} hidden{% endif %}" <div class="web-form-page{% if loop.index > 1 %} hidden{% endif %}"
data-idx="{{ loop.index }}" data-idx="{{ loop.index }}"
data-label="{{ page.label or _("Page {0}").format(loop.index) }}"> data-label="{{ page.label or _("Page {0}").format(loop.index) }}">
{% if page.label %}<h2>{{ page.label }}</h2>{% endif %}
{% if page.label %}
<h2 class='text-center'>{{ page.label }}</h2>
{% endif %}
{% if page.description %}
<p class='text-center text-muted small'>{{ page.description }}</p>
<br>
{% endif %}

{% for section in page.sections %} {% for section in page.sections %}
<div class="section"> <div class="section">
{% if section.label %} {% if section.label %}
@@ -263,18 +269,18 @@
{% endfor %} {% endfor %}
</div> </div>
{% if last_page and accept_payment and payment_url %} {% if last_page and accept_payment and payment_url %}
<div class="well payment-details">
{% if not doc.paid %}
{% if payment_button_help %}
<div class='text-muted' style='padding-bottom: 15px;'>
{{ payment_button_help }}</div>
{% endif %}
<a class="btn btn-primary btn-payment" href="{{ payment_url }}">
{{ payment_button_label }}</a>
{% else %}
<div>{{ _("Payment Complete") }}</div>
<div class="well payment-details">
{% if not doc.paid %}
{% if payment_button_help %}
<div class='text-muted' style='padding-bottom: 15px;'>
{{ payment_button_help }}</div>
{% endif %} {% endif %}
</div>
<a class="btn btn-primary btn-payment" href="{{ payment_url }}">
{{ payment_button_label }}</a>
{% else %}
<div>{{ _("Payment Complete") }}</div>
{% endif %}
</div>
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}
@@ -728,11 +734,30 @@ frappe.ready(function() {


{% block style %} {% block style %}
<style> <style>
.web-form-page {

.introduction {
border-bottom: 1px solid #e1e9f0;
padding: 15px;
padding-top: 0px;
margin-left: -15px;
margin-right: -15px;
margin-bottom: 15px;
}

.form-group label {
font-weight: normal;
}

input[type='checkbox'] {
margin-top: 3px;
}

.checkbox label {
font-size: 12px;
} }


.web-form-page input, .web-form-page select {
max-width: 500px;
.web-form-page, .web-form-page .section {
padding: 20px 0px;
} }


.web-form-grid-row input, .web-form-grid-row select { .web-form-grid-row input, .web-form-grid-row select {
@@ -748,8 +773,7 @@ frappe.ready(function() {


.slide-progress { .slide-progress {
/*border-top: 1px solid #d1d8dd;*/ /*border-top: 1px solid #d1d8dd;*/
margin-top: -7px;
padding: 15px 0px;
margin-top: -10px;
} }
.slide-progress .icon-fixed-width { .slide-progress .icon-fixed-width {
vertical-align: middle; vertical-align: middle;


+ 3
- 3
frappe/website/doctype/web_form/web_form.py View File

@@ -239,7 +239,7 @@ def get_context(context):
new_page = {'sections': []} new_page = {'sections': []}
layout.append(new_page) layout.append(new_page)
if df and df.fieldtype=='Page Break': if df and df.fieldtype=='Page Break':
new_page['label'] = df.label
new_page.update(df.as_dict())


return new_page return new_page


@@ -247,7 +247,7 @@ def get_context(context):
new_section = {'columns': []} new_section = {'columns': []}
layout[-1]['sections'].append(new_section) layout[-1]['sections'].append(new_section)
if df and df.fieldtype=='Section Break': if df and df.fieldtype=='Section Break':
new_section['label'] = df.label
new_section.update(df.as_dict())


return new_section return new_section


@@ -280,7 +280,7 @@ def get_context(context):
if not section: if not section:
section = add_section() section = add_section()
column = None column = None
if not column:
if column==None:
column = add_column() column = add_column()
column.append(df) column.append(df)




Loading…
Cancel
Save