This commit is contained in:
Kanchan Chauhan 2016-04-14 16:51:58 +05:30
parent 110ec335b8
commit ca4c64fd8a
17 changed files with 301 additions and 123 deletions

View file

@ -411,7 +411,7 @@ a.no-decoration:active {
.web-footer {
padding: 20px 0px;
min-height: 140px;
border-top: 1px solid #ebeff2;
border-top: 1px solid #d1d8dd;
}
.carousel-control .icon {
position: absolute;
@ -491,9 +491,6 @@ fieldset {
.page-container {
padding: 0px;
}
.page-content {
padding-bottom: 20px;
}
.page-content hr {
margin-left: -15px;
margin-right: -15px;
@ -830,3 +827,34 @@ body {
.btn-next-wrapper {
margin-top: 60px;
}
.footer-group-label {
display: inline-block;
padding-bottom: 4px;
text-transform: uppercase;
font-size: 12px;
}
.show-sidebar {
border-left: 1px solid #d1d8dd;
padding-left: 50px;
}
.item-list {
padding-top: 20px;
}
.sidebar-block,
.content-block {
padding-top: 50px;
padding-bottom: 50px;
}
.content-header {
padding-bottom: 50px;
font-size: 28px;
}
.selected-p-item {
color: #78D6FF;
}
a:hover,
a:visited,
a:link,
a:active {
text-decoration: none;
}

View file

@ -68,6 +68,7 @@
.web-footer {
padding: 20px 0px;
min-height: 140px;
border-top: 1px solid #d1d8dd;
}
.carousel-control .icon {
@ -162,7 +163,6 @@ fieldset {
}
.page-content {
padding-bottom: 20px;
hr {
margin-left: -15px;
margin-right: -15px;
@ -423,3 +423,36 @@ a.active {
.btn-next-wrapper {
margin-top: 60px;
}
.footer-group-label {
display:inline-block;
padding-bottom: 4px;
text-transform: uppercase;
font-size: 12px;
}
.show-sidebar {
border-left: 1px solid #d1d8dd;
padding-left:50px;
}
.item-list{
padding-top: 20px;
}
.sidebar-block, .content-block {
padding-top:50px;
padding-bottom:50px;
}
.content-header {
padding-bottom:50px;
font-size:28px;
}
.selected-p-item {
color:#78D6FF;
}
a:hover, a:visited, a:link, a:active
{
text-decoration: none;
}

View file

@ -4,36 +4,32 @@
<div class="row">
<div class="col-sm-6 text-left">
{% if facebook_share or google_plus_one or twitter_share or linked_in_share %}
<ul class="list-unstyled social-icons" style="float:left; width:15%">
<span><u>Share</u></span>
<ul class="list-unstyled social-icons" style="float:left;">
<span class="footer-group-label text-extra-muted">Share</span>
{% if google_plus_one %}
<li><a href="https://plus.google.com/share?url={{ url }}"
target="_blank"><i class="icon-google-plus icon-3x"></i></a></li>
<li class="small"><a href="https://plus.google.com/share?url={{ url }}"
target="_blank">Google +</a></li>
{% endif %}
{% if twitter_share %}
<li><a href="https://twitter.com/intent/tweet?url={{ url }}&text={{ encoded_title }}"
target="_blank" ><i class="icon-twitter icon-3x"></i></a></li>
<li class="small"><a href="https://twitter.com/intent/tweet?url={{ url }}&text={{ encoded_title }}"
target="_blank" >Twitter</a></li>
{% endif %}
{% if facebook_share %}
<li><a href="https://www.facebook.com/sharer.php?u={{ url }}&t={{ encoded_title }}&via={{ twitter_share_via }}"
target="_blank"><i class="icon-facebook icon-3x"></i></a></li>
<li class="small"><a href="https://www.facebook.com/sharer.php?u={{ url }}&t={{ encoded_title }}&via={{ twitter_share_via }}"
target="_blank">Facebook</a></li>
{% endif %}
{% if linked_in_share %}
<li><a href="http://www.linkedin.com/shareArticle?mini=true&url={{ url }}&title={{ encoded_title }}"
target="_blank"><i class="icon-linkedin icon-3x"></i></a></li>
<li class="small"> <a href="http://www.linkedin.com/shareArticle?mini=true&url={{ url }}&title={{ encoded_title }}"
target="_blank">Linkedin</a></li>
{% endif %}
</ul>
{% endif %}
<ul class="list-unstyled" style="float:left; width:15%">
{% for item in footer_items %}
{% if not item.url %}
<span><u> {{ item.label }} </u></span>
{% else %}
<li style="text-center"><a href="{{ item.url }}" {{ item.target }}
data-label="{{ item.label }}" class="small">{{ item.label }}</a></li>
{% endif %}
{% endfor %}
</ul>
{% if footer_items -%}
<ul class="list-unstyled navbar-nav">
{% include "templates/includes/footer/footer_items.html" %}
</ul>
{% endif %}
</div>
<div class="col-sm-6 text-right">

View file

@ -0,0 +1,24 @@
{% for page in footer_items %}
{% if not page.parent_label -%}
<li style="margin-left:65px;" 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 ''}}>
{%- if page.child_items -%}
<span class="footer-group-label text-extra-muted">{{ page.label }}<span>
</a>
<ul class="list-unstyled small">
{%- for child in page.child_items -%}
<li data-label='{{ child.label }}'>
<a {% if child.indent %} style="padding-left: {{((child.indent|int)+1)*15 }}px"{% endif %}
href="{{ child.url | abs_url }}" {{ child.target or '' }}>{{ child.label }}</a>
</li>
{%- endfor -%}
</ul>
{%- else -%}
{{ page.label }}
</a>
{%- endif -%}
</li>
{%- endif -%}
{% endfor %}

View file

@ -35,7 +35,9 @@
.form-signin {
max-width: 360px;
padding: 30px;
padding-right: 30px;
padding-left: 30px;
padding-top: 10px;
margin: 0 auto;
border-radius: 5px;
background-color: #fff;
@ -95,7 +97,8 @@ h5:before {
font-size: 36px;
position: relative;
text-align: center;
margin:20px;
margin-bottom:20px;
}
p{
@ -104,4 +107,9 @@ p{
.btn-login, .btn-signup, .btn-forgot {
background: #78D6FF;
color: white;
}
.content-block {
padding-top:10px;
padding-bottom:30px;
}

View file

@ -13,5 +13,6 @@
{% include "templates/includes/navbar/navbar_link.html" %}
{%- endif -%}
{%- endfor %}
<li class="shopping-cart" style="padding-top:9px;"></li>
{% include "templates/includes/navbar/navbar_login.html" %}
</ul>

View file

@ -1,7 +1,9 @@
{% extends "templates/web.html" %}
{% block title %}About Us{% endblock %}
{% block page_sidebar %}
{% include "templates/pages/web_sidebar.html" %}
{% endblock %}
{% block page_content %}
<!-- no-sidebar -->
<article class="about-content">

View file

@ -5,4 +5,5 @@ from __future__ import unicode_literals
import frappe
def get_context(context):
context.show_sidebar=True
return { "doc": frappe.get_doc("About Us Settings", "About Us Settings") }

View file

@ -26,22 +26,28 @@
</div>
<button class="btn btn-lg btn-default btn-block btn-login" type="submit">{{ _("Sign in") }}</button>
<h5><span>{{ _("Or login with") }}</span></h5>
{# {%- if social_login -%} #}
<h5><span>{{ _("Or login with") }}</span></h5>
<p class="text-center" style="margin-top: 15px">
<p class="text-center" style="margin-top: 15px">
{#{%- if facebook_login is defined %}#}
<a href="{{ facebook_login }}" class="no-decoration btn-social btn-facebook">
<i class="icon-facebook-sign icon-2x"></i></a>
{#{%- endif -%}
<a href="{{ facebook_login }}" class="no-decoration btn-social btn-facebook">
<i class="icon-facebook-sign icon-2x"></i></a>
{%- if google_login is defined %}#}
<a href="{{ google_login }}" class="no-decoration btn-social btn-google">
<i class="icon-google-plus-sign icon-2x"></i></a>
{#{%- endif -%}
<a href="{{ google_login }}" class="no-decoration btn-social btn-google">
<i class="icon-google-plus-sign icon-2x"></i></a>
<a href="{{ github_login }}" class="no-decoration btn-social btn-github">
<i class="icon-github-sign icon-2x"></i></a>
</p>
{%- if github_login is defined %}#}
<a href="{{ github_login }}" class="no-decoration btn-social btn-github">
<i class="icon-github-sign icon-2x"></i></a>
{#{%- endif -%}#}
</p>
{# {%- endif -%} #}
<div style="margin-top: 25px">
{%- if not disable_signup -%}

View file

@ -1,9 +1,14 @@
{% extends "templates/web.html" %}
{% block title %}{{ _("My Account") }}{% endblock %}
{% block header %}{{ _("My Account") }}{% endblock %}
{% block page_sidebar %}
{% include "templates/pages/web_sidebar.html" %}
{% endblock %}
{% block page_content %}
<!-- no-sidebar -->
<div class="content-header">{{ _("My Account") }}</div>
<!-- no-cache -->
<div class="row">
<div class="col-sm-3">
@ -19,7 +24,7 @@
{% endif -%}
</div>
<div>
<h4>{{ fullname }}</h4>
<ul class="list-unstyled">
<li><a href="/update-password">
<h6 class="text-muted">{{ _("Reset Password") }}</h6>
@ -27,60 +32,19 @@
<li><a href="/edit-profile">
<h6 class="text-muted">{{ _("Edit Profile") }}</h6>
</a></li>
<li><a href="/?cmd=web_logout">
<h6 class="text-muted">{{ _("Logout") }}</h6>
</a></li>
</ul>
</div>
</div>
</div>
<div class="col-sm-9">
<ul class="list-group" style="margin: 15px 0px;">
{% for item in my_account_list -%}
{% if item.count or (not item.reference_doctype) %}
<li class="list-group-item">
<a href="{{ item.route }}" class="no-decoration"
{% if item.target %}target="{{ item.target }}"{% endif %}>
<h4>{{ _(item.title) }}
{% if item.reference_doctype %}
<span class="badge">
{{ "20+" if item.count > 20 else item.count }}
</span>
{% endif %}
</h4>
</a></li>
{% endif %}
{%- endfor %}
</ul>
<div class="col-sm-4">
<p>
<span class="label">User Name</span>
<span class="value"> {{ fullname }}</span>
</p>
</div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
{% endblock %}
{% block style %}
<style>
.your-account-info {
margin: 15px 0px;
}
.my-account-list {
margin: 0px 0px 15px;
}
.my-account-list > li > a {
margin: 15px 0px;
display: inline-block;
}
.user-options {
margin-top: 15px;
}
.user-options > li > a {
margin: 5px 0px;
display: inline-block;
}
</style>
{% endblock %}

View file

@ -11,6 +11,7 @@ no_cache = 1
no_sitemap = 1
def get_context(context):
context.show_sidebar=True
if frappe.session.user == "Guest":
frappe.throw(_("You need to be logged in to access this page."), frappe.PermissionError)
@ -24,3 +25,4 @@ def get_context(context):
info = get_fullname_and_avatar(frappe.session.user)
context["fullname"] = info.fullname
context["user_image"] = info.avatar

View file

@ -0,0 +1,56 @@
<div class="web-sidebar">
<div class="your-account-info">
<div class="avatar avatar-medium" style="float:left;margin-right:20px;">
<a href="/me">
{% if user_image -%}
<img class="user-image" src="{{ user_image }}" /></a>
{% else %}
{% block script %}
<script> $('.avatar-medium').append($(frappe.avatar()).find('.standard-image')) </script>
{% endblock %}
{% endif -%}
</div>
<div>
<h4 style="margin-top:0px;margin-bottom:0px;">{{ fullname }}</h4>
<a href="/?cmd=web_logout">
<h6 style="margin-top:0px;" class="text-muted">{{ _("Logout") }}</h6>
</a>
</div>
</div>
<div class="sidebar-items">
<ul class="list-unstyled sidebar" style="margin: 15px 0px;">
<li class="item-list">
<a href="/me">
<h5>My Account
</h5>
</a>
</li>
{% for item in my_account_list -%}
{% if item.count or (not item.reference_doctype) %}
<li class="item-list">
<a href="{{ item.route }}"
{% if item.target %}target="{{ item.target }}"{% endif %}>
<h5>{{ _(item.title) }}
{% if item.reference_doctype %}
<span class="badge">
{{ "20+" if item.count > 20 else item.count }}
</span>
{% endif %}
</h5>
</a>
</li>
{% endif %}
{%- endfor %}
</ul>
</div>
</div>
<script>
frappe.ready(function() {
$('.sidebar a').each(function(index) {
if(this.href.trim() == window.location)
$(this).addClass("selected-p-item");
});
});
</script>

View file

@ -0,0 +1,27 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils.user import get_fullname_and_avatar
import frappe.templates.pages.list
no_cache = 1
no_sitemap = 1
def get_context(context):
if frappe.session.user == "Guest":
frappe.throw(_("You need to be logged in to access this page."), frappe.PermissionError)
context.my_account_list = frappe.get_all('Portal Menu Item',
fields=['title', 'route', 'reference_doctype'], filters={'enabled': 1}, order_by='idx asc')
for item in context.my_account_list:
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

View file

@ -1,7 +1,7 @@
{% extends base_template_path %}
{% block hero %}{% endblock %}
{% block header %}{% endblock %}
{% block content %}
<div class="page-container" id="page-{{ name or page_name }}" data-path="{{ pathname }}"
{% if page_or_generator=="Generator" %}data-doctype="{{ doctype }}"{% endif %}>
@ -15,9 +15,7 @@
{% block breadcrumbs %}{% endblock %}
</div>
{% endif %}
<div class="page-header-block" data-html-block="header">
{% block header %}{% endblock %}
</div>
</div>
{% if not full_width %}
<div class="col-sm-4">
@ -27,10 +25,20 @@
</div>
{% endif %}
</div>
<div class="page-content-block">
{%- block page_content -%}{%- endblock -%}
</div>
</div>
<div class="row">
{% if show_sidebar %}
<div class="sidebar-block col-sm-3">
{%- block page_sidebar -%}{%- endblock -%}
</div>
{% endif %}
<div class="{% if show_sidebar %} content-block show-sidebar col-sm-9 {% else %} content-block col-sm-12 {% endif %}">
<div class="content">
{%- block page_content -%}{%- endblock -%}
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -57,6 +57,7 @@
"length": 0,
"no_column": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,

View file

@ -34,6 +34,9 @@ $.extend(cur_frm.cscript, {
if(item.parentfield === "top_bar_items") {
this.set_parent_label_options();
}
else if(item.parentfield === "footer_items") {
this.set_parent_label_options_footer();
}
},
parent_label: function(doc, cdt, cdn) {
@ -52,6 +55,15 @@ $.extend(cur_frm.cscript, {
cur_frm.fields_dict.top_bar_items.grid.refresh();
}
},
set_parent_label_options_footer: function() {
frappe.meta.get_docfield("Top Bar Item", "parent_label", cur_frm.docname).options =
this.get_parent_options("footer_items");
if($(cur_frm.fields_dict.footer_items.grid.wrapper).find(".grid-row-open")) {
cur_frm.fields_dict.footer_items.grid.refresh();
}
},
// get labels of parent items
get_parent_options: function(table_field) {

View file

@ -39,10 +39,20 @@ class WebsiteSettings(Document):
top_bar_item.idx))
def validate_footer_items(self):
"""clear parent label in footer"""
"""validate url in top bar items"""
for footer_item in self.get("footer_items"):
footer_item.parent_label = None
if footer_item.parent_label:
parent_label_item = self.get("footer_items", {"label": footer_item.parent_label})
if not parent_label_item:
# invalid item
frappe.throw(_("{0} does not exist in row {1}").format(footer_item.parent_label, footer_item.idx))
elif not parent_label_item[0] or parent_label_item[0].url:
# parent cannot have url
frappe.throw(_("{0} in row {1} cannot have both URL and child items").format(footer_item.parent_label,
footer_item.idx))
def on_update(self):
self.clear_cache()
@ -59,32 +69,12 @@ class WebsiteSettings(Document):
frappe.clear_cache()
def get_website_settings():
hooks = frappe.get_hooks()
all_top_items = frappe.db.sql("""\
select * from `tabTop Bar Item`
where parent='Website Settings' and parentfield='top_bar_items'
order by idx asc""", as_dict=1)
top_items = [d for d in all_top_items if not d['parent_label']]
# attach child items to top bar
for d in all_top_items:
if d['parent_label']:
for t in top_items:
if t['label']==d['parent_label']:
if not 'child_items' in t:
t['child_items'] = []
t['child_items'].append(d)
break
context = frappe._dict({
'top_bar_items': top_items,
'footer_items': frappe.db.sql("""\
select * from `tabTop Bar Item`
where parent='Website Settings' and parentfield='footer_items'
order by idx asc""", as_dict=1),
'top_bar_items': get_items('top_bar_items'),
'footer_items': get_items('footer_items'),
"post_login": [
{"label": "My Account", "url": "/me"},
{"class": "divider"},
@ -134,4 +124,23 @@ def get_website_settings():
context["favicon"] = settings.favicon
return context
def get_items(parentfield):
all_top_items = frappe.db.sql("""\
select * from `tabTop Bar Item`
where parent='Website Settings' and parentfield= %s
order by idx asc""", parentfield, as_dict=1)
top_items = [d for d in all_top_items if not d['parent_label']]
# attach child items to top bar
for d in all_top_items:
if d['parent_label']:
for t in top_items:
if t['label']==d['parent_label']:
if not 'child_items' in t:
t['child_items'] = []
t['child_items'].append(d)
break
return top_items