Browse Source

Merge branch 'KanchanChauhan-WebsiteChanges' into develop

version-14
Anand Doshi 9 years ago
parent
commit
0ce600b2f9
16 changed files with 171 additions and 113 deletions
  1. +19
    -12
      frappe/model/utils/__init__.py
  2. +13
    -10
      frappe/public/css/avatar.css
  3. +41
    -11
      frappe/public/css/website.css
  4. +16
    -12
      frappe/public/less/avatar.less
  5. +1
    -0
      frappe/public/less/variables.less
  6. +33
    -4
      frappe/public/less/website.less
  7. +1
    -1
      frappe/templates/includes/footer/footer.html
  8. +1
    -1
      frappe/templates/includes/footer/footer_items.html
  9. +3
    -1
      frappe/templates/includes/list/list.html
  10. +12
    -11
      frappe/templates/includes/search_box.html
  11. +2
    -2
      frappe/templates/includes/web_sidebar.html
  12. +1
    -1
      frappe/templates/pages/list.html
  13. +14
    -8
      frappe/templates/pages/list.py
  14. +10
    -7
      frappe/templates/web.html
  15. +1
    -1
      frappe/website/context.py
  16. +3
    -31
      frappe/website/doctype/website_settings/website_settings.json

+ 19
- 12
frappe/model/utils/__init__.py View File

@@ -36,17 +36,24 @@ def render_include(content):
'''render {% include "app/path/filename" in js file %}'''

content = cstr(content)
if "{% include" in content:
paths = re.findall(r'''{% include\s['"](.*)['"]\s%}''', content)
if not paths:
frappe.throw('Invalid include path')

for path in paths:
app, app_path = path.split('/', 1)
with open(frappe.get_app_path(app, app_path), 'r') as f:
include = unicode(f.read(), 'utf-8')
if path.endswith('.html'):
include = html_to_js_template(path, include)
content = re.sub(r'''{{% include\s['"]{0}['"]\s%}}'''.format(path), include, content)

# try 5 levels of includes
for i in xrange(5):
if "{% include" in content:
paths = re.findall(r'''{% include\s['"](.*)['"]\s%}''', content)
if not paths:
frappe.throw('Invalid include path')

for path in paths:
app, app_path = path.split('/', 1)
with open(frappe.get_app_path(app, app_path), 'r') as f:
include = unicode(f.read(), 'utf-8')
if path.endswith('.html'):
include = html_to_js_template(path, include)

content = re.sub(r'''{{% include\s['"]{0}['"]\s%}}'''.format(path), include, content)

else:
break

return content

+ 13
- 10
frappe/public/css/avatar.css View File

@@ -4,6 +4,16 @@
width: 50px;
height: 50px;
}
.avatar-frame {
display: inline-block;
width: 100%;
height: 0;
padding: 50% 0px;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 4px;
}
.avatar img {
max-width: 100%;
max-height: 100%;
@@ -21,6 +31,9 @@
.avatar-small .standard-image {
font-size: 14px;
}
.avatar-small .avatar-frame {
border-radius: 3px;
}
.avatar-medium {
margin-right: 5px;
width: 36px;
@@ -54,16 +67,6 @@
height: 0;
padding-bottom: 100%;
}
.avatar-frame {
display: inline-block;
width: 100%;
height: 0;
padding: 50% 0px;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 4px;
}
.standard-image {
width: 100%;
height: 0;


+ 41
- 11
frappe/public/css/website.css View File

@@ -226,6 +226,16 @@ a.no-decoration:active {
width: 50px;
height: 50px;
}
.avatar-frame {
display: inline-block;
width: 100%;
height: 0;
padding: 50% 0px;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 4px;
}
.avatar img {
max-width: 100%;
max-height: 100%;
@@ -243,6 +253,9 @@ a.no-decoration:active {
.avatar-small .standard-image {
font-size: 14px;
}
.avatar-small .avatar-frame {
border-radius: 3px;
}
.avatar-medium {
margin-right: 5px;
width: 36px;
@@ -276,16 +289,6 @@ a.no-decoration:active {
height: 0;
padding-bottom: 100%;
}
.avatar-frame {
display: inline-block;
width: 100%;
height: 0;
padding: 50% 0px;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 4px;
}
.standard-image {
width: 100%;
height: 0;
@@ -361,6 +364,23 @@ a.no-decoration:active {
html,
body {
font-family: "Open Sans", "Helvetica Neue", Serif;
color: #6c7680;
}
a {
color: #6c7680;
}
a:hover,
a:focus,
a:active {
color: #36414C;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 300;
}
.navbar-brand {
max-width: none;
@@ -467,6 +487,10 @@ body {
.panel-body {
padding-left: 15px;
}
.page-head h1,
.page-head h2 {
margin-top: 0px;
}
.page-header-actions-block {
text-align: right;
}
@@ -915,10 +939,16 @@ li .social-child-item {
padding-top: 30px;
padding-bottom: 20px;
}
#item-search {
.item-search {
border-bottom: 1px solid #d1d8dd;
}
.item-search .item-search-input {
position: relative;
outline: none;
border: none;
margin-right: 5px;
padding: 7px;
padding-left: 0px;
}
.vert-line {
overflow: hidden;


+ 16
- 12
frappe/public/less/avatar.less View File

@@ -7,6 +7,17 @@
height: 50px;
}

.avatar-frame {
display: inline-block;
width: 100%;
height: 0;
padding: 50% 0px;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 4px;
}

.avatar img {
max-width: 100%;
max-height: 100%;
@@ -26,6 +37,10 @@
.standard-image {
font-size: 14px;
}

.avatar-frame {
border-radius: 3px;
}
}

.avatar-medium {
@@ -68,17 +83,6 @@
padding-bottom: 100%;
}

.avatar-frame {
display: inline-block;
width: 100%;
height: 0;
padding: 50% 0px;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 4px;
}

.standard-image {
width: 100%;
height: 0;
@@ -93,4 +97,4 @@
border: 1px solid @border-color;
font-weight: normal;
margin-top: -1px;
}
}

+ 1
- 0
frappe/public/less/variables.less View File

@@ -3,6 +3,7 @@
@border-color: #d1d8dd;
@light-border-color: #EBEFF2;
@text-color: #36414C;
@text-light: #6c7680;
@text-muted: #8D99A6;
@btn-bg: #F0F4F7;
@panel-bg: #F7FAFC;


+ 33
- 4
frappe/public/less/website.less View File

@@ -5,6 +5,21 @@

html, body {
font-family: "Open Sans", "Helvetica Neue", Serif;
color: @text-light;
}

a& {
color: @text-light;

&:hover,
&:focus,
&:active {
color: @text-color;
}
}

h1, h2, h3, h4, h5, h6 {
font-weight: 300;
}

.navbar-brand {
@@ -133,6 +148,12 @@ html, body {
padding-left: 15px;
}

.page-head {
h1, h2 {
margin-top: 0px;
}
}

.page-header-actions-block {
text-align: right;
}
@@ -523,13 +544,21 @@ li .social-child-item {
padding-bottom:20px;
}

#item-search {
position: relative;
outline:none;
border:none;
.item-search {
border-bottom: 1px solid @border-color;

.item-search-input {
position: relative;
outline: none;
border: none;
margin-right: 5px;
padding: 7px;
padding-left: 0px;
}
}

.vert-line {overflow:hidden;}
.vert-line>div+div{border-left:1px solid @light-border-color;}
.vert-line>div{
padding-bottom:2000px; margin-bottom:-2000px;}


+ 1
- 1
frappe/templates/includes/footer/footer.html View File

@@ -27,7 +27,7 @@
{% endif %}
{% if footer_items -%}
<ul class="list-unstyled navbar-nav">
<ul class="list-unstyled navbar-nav" style="{% if facebook_share or google_plus_one or twitter_share or linked_in_share %} margin-left:65px; {%else%} margin-left:0px;{%endif%}">
{% include "templates/includes/footer/footer_items.html" %}
</ul>
{% endif %}


+ 1
- 1
frappe/templates/includes/footer/footer_items.html View File

@@ -1,6 +1,6 @@
{% for page in footer_items %}
{% if not page.parent_label -%}
<li style="margin-left:65px;" data-label='{{ page.label }}' {% if page.child_items %} {% endif %}>
<li data-label='{{ page.label }}' {% if page.child_items %} {% endif %}>
<a {% if not page.child_items -%} href="{{ (page.url or '')|abs_url }}" {%- endif %}
{% if page.child_items %} onclick="return false;" {% endif %}
{{ page.target or ''}}>


+ 3
- 1
frappe/templates/includes/list/list.html View File

@@ -9,7 +9,9 @@
{% include "templates/includes/list/filters.html" %}
{%- endif %} -->

{% if introduction %}<p class='lead'>{{ introduction }}{% endif %}
{% if introduction %}<p class='lead'>{{ introduction }}{% endif %}

{% if result_heading_template %}{% include result_heading_template %}{% endif %}

<div class="result">
{% for item in result %}


+ 12
- 11
frappe/templates/includes/search_box.html View File

@@ -1,30 +1,31 @@
<div class="item-search text-muted pull-right">
<input type="text" id="item-search" placeholder="Quick Search" autocomplete="off">
<i class="octicon octicon-search"></i>
<input type="text" class="item-search-input"
placeholder="Search" autocomplete="off">
<i class="octicon octicon-search"></i>
</div>
<div class="clearfix pull-right" style="width:300px;">
<h4 class="item-search-results pull-left"></h4>
<p class="pull-right">
<a style="display: none; padding-left:5px;" href="javascript:history.back();" class="octicon octicon-x text-extra-muted clear" title="Clear Search" ></a>
</p>
<h4 class="item-search-results pull-left"></h4>
<p class="pull-right">
<a style="display: none; padding-left:5px;" href="javascript:history.back();" class="octicon octicon-x text-extra-muted clear" title="Clear Search" ></a>
</p>
</div>

<script>
frappe.ready(function() {
if(get_url_arg("q")){
var txt = get_url_arg("q");
if(get_url_arg("search")){
var txt = get_url_arg("search");
$(".item-search-results").html("Search results for : " + txt);
$(".clear").toggle(true);
}
var thread = null;
function findResult(t) {
window.location.href=document.URL + "&q=" + t;
window.location.href=document.URL + "?search=" + t;
}

$("#item-search").keyup(function() {
$(".item-search-input").keyup(function() {
clearTimeout(thread);
var $this = $(this); thread = setTimeout(function(){findResult($this.val())}, 1000);
});
$(".form-search").on("submit", function() { return false; });
});
</script>
</script>

+ 2
- 2
frappe/templates/includes/web_sidebar.html View File

@@ -5,9 +5,9 @@
<span class="user-image-sidebar"></span>
</div>
<div class="col-xs-10">
<div class="web-sidebar-user text-muted">{{ fullname }}</div>
<div class="web-sidebar-user">{{ fullname }}</div>
<a href="/?cmd=web_logout">
<div style="margin-top:0px;" class="text-extra-muted small">
<div style="margin-top:0px;" class="text-muted small">
{{ _("Logout") }}</div>
</a>
</div>


+ 1
- 1
frappe/templates/pages/list.html View File

@@ -3,7 +3,7 @@
{% block title %}{{ title or (_("{0} List").format(_(doctype))) }}{% endblock %}

{% block header %}
{{ title or (_("{0} List").format(_(doctype))) }}
<h1>{{ title or (_("{0} List").format(_(doctype))) }}</h1>
{% endblock %}

{% block breadcrumbs %}


+ 14
- 8
frappe/templates/pages/list.py View File

@@ -26,8 +26,12 @@ def get(doctype, txt=None, limit_start=0, **kwargs):
limit_start = cint(limit_start)
limit_page_length = 20
next_start = limit_start + limit_page_length
if not txt and frappe.form_dict.search:
txt = frappe.form_dict.search
del frappe.form_dict['search']

filters = prepare_filters(kwargs)
filters = prepare_filters(doctype, kwargs)
meta = frappe.get_meta(doctype)
list_context = get_list_context(frappe._dict(), doctype)

@@ -77,19 +81,21 @@ def set_route(context):
context.route = "{0}/{1}".format(context.pathname or quoted(context.doc.doctype),
quoted(context.doc.name))

def prepare_filters(kwargs):
def prepare_filters(doctype, kwargs):
filters = frappe._dict(kwargs)

meta = frappe.get_meta(doctype)
if filters.pathname:
# resolve additional filters from path
resolve_path(filters.pathname)
for key, val in frappe.local.form_dict.items():
if key in ("cmd", "pathname", "doctype", "txt", "limit_start"):
if key in filters:
del filters[key]

elif key not in filters:
if key not in filters:
filters[key] = val
# filter the filters to include valid fields only
for fieldname, val in filters.items():
if not meta.has_field(fieldname):
del filters[fieldname]

if "is_web_form" in filters:
del filters["is_web_form"]


+ 10
- 7
frappe/templates/web.html View File

@@ -15,24 +15,27 @@
<div class="page-content-wrapper">
<div class="row page-head">
<div class="col-sm-8">
{% if self.breadcrumbs() %}
{% if not no_breadcrumbs and self.breadcrumbs() %}
<div class="page-breadcrumbs">
{% block breadcrumbs %}{% endblock %}
</div>
{% endif %}
<h2>{% block header %}{% endblock %}</h2>
{% block header %}{% endblock %}
</div>
<div class="col-sm-4">
{% if show_search %}
<div class="page-search-block">
{% block search %}
{% include 'templates/includes/search_box.html' %}
{% endblock %}
</div>
<div class="page-search-block">
{% block search %}
{% include 'templates/includes/search_box.html' %}
{% endblock %}
</div>
{% endif %}

{% if self.header_actions() %}
<div class="page-header-actions-block">
{% block header_actions %}{% endblock %}
</div>
{% endif %}
</div>
</div>
</div>


+ 1
- 1
frappe/website/context.py View File

@@ -82,6 +82,7 @@ def build_context(context):

def add_sidebar_data(context):
from frappe.utils.user import get_fullname_and_avatar
import frappe.templates.pages.list

context.my_account_list = frappe.get_all('Portal Menu Item',
fields=['title', 'route', 'reference_doctype'], filters={'enabled': 1}, order_by='idx asc')
@@ -90,7 +91,6 @@ def add_sidebar_data(context):
if item.reference_doctype:
item.count = len(frappe.templates.pages.list.get(item.reference_doctype).get('result'))


info = get_fullname_and_avatar(frappe.session.user)
context["fullname"] = info.fullname
context["user_image"] = info.avatar


+ 3
- 31
frappe/website/doctype/website_settings/website_settings.json View File

@@ -58,31 +58,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If checked, the Home page will be the default Item Group for the website.",
"fieldname": "home_page_is_products",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Home Page is Products",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"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,
@@ -984,7 +959,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 10,
"modified": "2016-04-12 23:17:55.682407",
"modified": "2016-04-22 09:13:08.875846",
"modified_by": "Administrator",
"module": "Website",
"name": "Website Settings",
@@ -1004,8 +979,6 @@
"print": 1,
"read": 1,
"report": 0,
"restrict": 0,
"restricted": 0,
"role": "Website Manager",
"set_user_permissions": 0,
"share": 1,
@@ -1026,15 +999,14 @@
"print": 0,
"read": 1,
"report": 0,
"restrict": 0,
"restricted": 0,
"role": "All",
"set_user_permissions": 0,
"share": 1,
"share": 0,
"submit": 0,
"write": 0
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_order": "ASC",


Loading…
Cancel
Save