Merge pull request #5197 from KanchanChauhan/UXChanges_ERPNext

[WIP] No not merge
This commit is contained in:
Rushabh Mehta 2016-04-21 11:39:45 +05:30
commit c291ab64a6
23 changed files with 146 additions and 120 deletions

View File

@ -677,6 +677,8 @@ def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
list_context = get_list_context(context)
list_context["title"] = _("My Invoices")
list_context["show_sidebar"] = True
list_context["show_search"] = True
return list_context
@frappe.whitelist()

View File

@ -19,6 +19,7 @@ docs_version = "6.x.x"
splash_light_background = True
def get_context(context):
context.brand_html = "ERPNext"
context.app.splash_light_background = True
context.top_bar_items = [
{"label": "User Manual", "url": context.docs_base_url + "/user/manual", "right": 1},

View File

@ -7,6 +7,8 @@ from __future__ import unicode_literals
import frappe
from frappe.website.website_generator import WebsiteGenerator
from frappe.utils import quoted
from frappe.utils.user import get_fullname_and_avatar
from frappe import _
class JobOpening(WebsiteGenerator):
@ -15,6 +17,9 @@ class JobOpening(WebsiteGenerator):
condition_field = "publish",
page_title_field = "job_title",
)
def get_route(self):
return 'jobs/' + quoted(self.page_name)
def get_context(self, context):
context.parents = [{'name': 'jobs', 'title': _('All Jobs') }]
@ -22,3 +27,5 @@ class JobOpening(WebsiteGenerator):
def get_list_context(context):
context.title = _("Jobs")
context.introduction = _('Current Job Openings')
context.show_sidebar=True
context.show_search=True

View File

@ -172,11 +172,14 @@ def get_project_list(doctype, txt, filters, limit_start, limit_page_length=20):
def get_list_context(context=None):
return {
"show_sidebar": True,
"show_search": True,
"title": _("My Projects"),
"get_list": get_project_list,
"row_template": "templates/includes/projects/project_row.html"
}
@frappe.whitelist()
def get_cost_center_name(project):
return frappe.db.get_value("Project", project, "cost_center")

View File

@ -10,9 +10,13 @@
text-align: center;
}
.product-image-wrapper {
max-width: 300px;
margin: auto;
max-width: 600px;
width: 187px;
margin: 31.5px;
border-radius: 4px;
border: 1px solid #EBEFF2;
padding-left: 0px;
padding-right: 0px;
}
@media (max-width: 767px) {
.product-image {
@ -28,8 +32,7 @@
background-size: cover;
background-repeat: no-repeat;
background-position: center top;
border-radius: 0.5em;
border: 1px solid #EBEFF2;
border-bottom: 1px dashed #EBEFF2;
}
.product-image.missing-image {
width: 100%;
@ -38,10 +41,8 @@
background-size: cover;
background-repeat: no-repeat;
background-position: center top;
border-radius: 0.5em;
border: 1px solid #EBEFF2;
border: 1px dashed #d1d8dd;
position: relative;
border-bottom: 1px dashed #EBEFF2;
}
.product-image.missing-image .octicon {
font-size: 32px;
@ -50,9 +51,24 @@
.product-text {
padding: 15px 0px;
}
.product-label {
padding-bottom: 4px;
text-transform: uppercase;
font-size: 12px;
}
@media (max-width: 767px) {
.product-search {
width: 100%;
margin-bottom: 13px;
}
}
.borderless td,
.borderless th {
border-bottom: 1px solid #EBEFF2;
padding-left: 0px !important;
line-height: 1.8em !important;
}
.item-desc {
border-top: 2px solid #EBEFF2;
padding-top: 10px;
}

View File

@ -44,14 +44,12 @@ $.extend(shopping_cart, {
var cart_count = getCookie("cart_count");
if($(".cart-icon").length == 0) {
$('<div class="cart-icon" style="float:right;padding-top:10px;">\
<a href="/cart" class="text-muted small">\
<div class="btn btn-primary cart"> Cart\
<span id="cart-count" class="label" style="padding-left:5px;margin-left:5px;\
margin-right:-5px;background-color: #2905E2;">\
</span>\
</div>\
</a></div>').appendTo($('.hidden-xs'))
$('<div class="cart-icon small" style="float:right;padding:3px;border-radius:10px;\
border: 1px solid #7575ff;">\
<a href="/cart" style="color:#7575ff; text-decoration: none">\
Cart\
<span style="color:#7575ff;" class="badge" id="cart-count">5</span>\
</a></div>').appendTo($('.shopping-cart'))
}
var $cart = $('.cart-icon');

View File

@ -15,9 +15,13 @@
}
.product-image-wrapper {
max-width: 300px;
margin: auto;
max-width: 600px;
width: 187px;
margin: 31.5px;
border-radius: 4px;
border: 1px solid @light-border-color;
padding-left: 0px;
padding-right: 0px;
}
@media (max-width: 767px) {
@ -35,14 +39,13 @@
background-size: cover;
background-repeat: no-repeat;
background-position: center top;
border-radius: 0.5em;
border: 1px solid @light-border-color;
border-bottom: 1px dashed @light-border-color;
}
.product-image.missing-image {
.product-image-square;
border: 1px dashed @border-color;
position: relative;
border-bottom: 1px dashed @light-border-color;
}
.product-image.missing-image .octicon {
@ -54,9 +57,26 @@
padding: 15px 0px;
}
.product-label{
padding-bottom: 4px;
text-transform: uppercase;
font-size: 12px;
}
@media (max-width: 767px) {
.product-search {
width: 100%;
margin-bottom: 13px;
}
}
.borderless td, .borderless th {
border-bottom: 1px solid @light-border-color;
padding-left:0px !important;
line-height: 1.8em !important;
}
.item-desc {
border-top: 2px solid @light-border-color;
padding-top:10px;
}

View File

@ -310,6 +310,8 @@ class SalesOrder(SellingController):
def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
list_context = get_list_context(context)
list_context["show_sidebar"] = True
list_context["show_search"] = True
list_context["title"] = _("My Orders")
list_context["parents"] = [{"title": _("My Account"), "name": "me"}]
return list_context

View File

@ -53,11 +53,12 @@ class ItemGroup(NestedSet, WebsiteGenerator):
frappe.throw(frappe._("An item exists with same name ({0}), please change the item group name or rename the item").format(self.name))
def get_context(self, context):
context.show_search=True
start = int(frappe.form_dict.start or 0)
if start < 0:
start = 0
context.update({
"items": get_product_list_for_group(product_group = self.name, start=start, limit=24),
"items": get_product_list_for_group(product_group = self.name, start=start, limit=24, search=frappe.form_dict.get("q")),
"parent_groups": get_parent_item_groups(self.name),
"title": self.name
})
@ -68,7 +69,7 @@ class ItemGroup(NestedSet, WebsiteGenerator):
return context
@frappe.whitelist(allow_guest=True)
def get_product_list_for_group(product_group=None, start=0, limit=10):
def get_product_list_for_group(product_group=None, start=0, limit=10, search=None):
child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(product_group)])
# base query
@ -83,10 +84,16 @@ def get_product_list_for_group(product_group=None, start=0, limit=10):
and (item_group in ({child_groups})
or name in (select parent from `tabWebsite Item Group` where item_group in ({child_groups})))
""".format(child_groups=child_groups)
# search term condition
if search:
query += """ and (web_long_description like %(search)s
or item_name like %(search)s
or name like %(search)s)"""
search = "%" + cstr(search) + "%"
query += """order by weightage desc, modified desc limit %s, %s""" % (start, limit)
data = frappe.db.sql(query, {"product_group": product_group, "today": nowdate()}, as_dict=1)
data = frappe.db.sql(query, {"product_group": product_group,"search": search, "today": nowdate()}, as_dict=1)
return [get_item_for_list_in_html(r) for r in data]

View File

@ -330,6 +330,8 @@ def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
list_context = get_list_context(context)
list_context["title"] = _("My Shipments")
list_context["show_sidebar"] = True
list_context["show_search"] = True
return list_context
def get_invoiced_qty_map(delivery_note):

View File

@ -214,6 +214,7 @@ class Item(WebsiteGenerator):
self.thumbnail = file_doc.thumbnail_url
def get_context(self, context):
context.show_search=True
if self.variant_of:
# redirect to template page!
template_item = frappe.get_doc("Item", self.variant_of)

View File

@ -57,7 +57,9 @@ def get_list_context(context=None):
return {
"title": _("My Issues"),
"get_list": get_issue_list,
"row_template": "templates/includes/issue_row.html"
"row_template": "templates/includes/issue_row.html",
"show_sidebar": True,
"show_search": True
}
def get_issue_list(doctype, txt, filters, limit_start, limit_page_length=20):

View File

@ -2,33 +2,25 @@
{% block title %} {{ title }} {% endblock %}
{% block header %}<h2>{{ title }}</h2>{% endblock %}
{% block header_actions %}
{% include 'templates/includes/product_search_box.html' %}
{% endblock %}
{% block breadcrumbs %}
{% include "templates/includes/breadcrumbs.html" %}
{% endblock %}
{% block page_content %}
{% from "erpnext/templates/includes/macros.html" import product_image %}
<div class="item-content">
<div class="item-content" style="margin-top:20px;">
<div class="product-page-content" itemscope itemtype="http://schema.org/Product">
<div class="row">
<div class="col-sm-5">
<div class="col-sm-6">
{% if slideshow %}
{% include "templates/includes/slideshow.html" %}
{% else %}
{{ product_image(website_image, "product-full-image") }}
{% endif %}
</div>
<div class="col-sm-7">
<!-- <h3 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h3> -->
<div itemprop="description">
{{ web_long_description or description or _("No description given") }}
</div>
<div class="col-sm-6" style="padding-left:20px;">
<h2 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h2>
<p class="text-muted">
{{ _("Item Code") }}: <span itemprop="productID">{{ variant and variant.name or name }}</span></p>
<br>
@ -77,15 +69,24 @@
</div>
</div>
</div>
{% if website_specifications -%}
<div class="row item-website-specification" style="margin-top: 20px">
<div class="row item-website-description" style="margin-top:30px; margin-bottom:20px">
<div class="col-md-12">
<h4>{{ _("Specifications") }}</h4>
<h4>{{ _("DESCRIPTION") }}</h4>
<div itemprop="description" class="item-desc">
{{ web_long_description or description or _("No description given") }}
</div>
</div>
</div>
{% if website_specifications -%}
<div class="row item-website-specification" style="margin-top: 40px">
<div class="col-md-12">
<h4>{{ _("SPECIFICATIONS") }}</h4>
<table class="table table-bordered" style="width: 100%">
<table class="table borderless" style="width: 100%">
{% for d in website_specifications -%}
<tr>
<td style="width: 30%;">{{ d.label }}</td>
<td class="product-label text-muted" style="width: 30%;">{{ d.label }}</td>
<td>{{ d.description }}</td>
</tr>
{%- endfor %}

View File

@ -1,11 +1,18 @@
{% extends "templates/web.html" %}
{% block header_actions %}
{#{% block header_actions %}
{% include 'templates/includes/product_search_box.html' %}
{% endblock %}
{% endblock %}#}
{% block header %}<h1>{{ _("Products") }}</h1>{% endblock %}
{% block breadcrumbs %}
{% include "templates/includes/breadcrumbs.html" %}
<div class="page-breadcrumbs" data-html-block="breadcrumbs">
<ul class="breadcrumb">
<li>
<span class="icon icon-angle-left"></span>
<a href="/me">My Account</a>
</li>
</ul>
</div>
{% endblock %}
{% block page_content %}
@ -38,16 +45,4 @@
{% endif %}
</div>
</div>
{% endblock %}
{% block style %}
<style>
.product-image.missing-image {
border: 1px dashed {{ theme.border_color or "#d1d8dd" }};
}
.product-image.missing-image .octicon {
color: {{ theme.border_color or "#d1d8dd" }};
}
</style>
{% endblock %}
{% endblock %}

View File

@ -10,8 +10,9 @@
{% block page_content %}
{%- if description -%}
<div>{{ description }}</div>
{% endif %}
<p>
<a class='btn btn-primary'
href='/job_application?job_title={{ doc.name }}'>

View File

@ -1,19 +1,11 @@
{% if not hide_footer_signup %}
<div class="container">
<div class="row">
<div class="col-sm-6 col-sm-offset-3 text-center" style="margin-top: 15px;">
<input class="form-control" type="text" id="footer-subscribe-email"
style="display: inline-block; max-width: 50%; margin-right: 10px;"
style="display: inline-block; max-width: 50%;margin-right:15px;"
placeholder="{{ _('Your email address') }}...">
<button class="btn btn-default btn-sm" type="button"
id="footer-subscribe-button">{{ _("Get Updates") }}</button>
</div>
</div>
<div class="text-center text-muted small" style="padding: 30px;">
<a href="https://erpnext.com?source=website_footer" target="_blank" class="text-extra-muted">
Powered by ERPNext</a>
</div>
</div>
<button class="btn btn-default btn-sm btn-subscribe" type="button"
id="footer-subscribe-button" style="float:right; border-radius:8px; border:1px solid #7575ff; color:#7575ff; background-color:white;">{{ _("Get Updates") }}</button>
<script>
frappe.ready(function() {
$("#footer-subscribe-button").click(function() {

View File

@ -1 +1,2 @@
<!-- blank -->
<a href="https://erpnext.com?source=website_footer" target="_blank" class="text-muted">
Powered by ERPNext</a>

View File

@ -4,12 +4,6 @@
text-decoration: underline;
}
.page-container {
font-weight: normal;
margin: 50px auto;
max-width: 700px;
}
.project-item:hover {
background-color: #f7f7f7;
}

View File

@ -2,11 +2,11 @@
<div class="web-list-item">
<a class="no-decoration" href="/projects?project={{ doc.name }}">
<div class="row">
<div class="col-xs-4">
<div class="col-xs-6">
{{ doc.name }}
</div>
<div class="col-xs-4">
<div class="col-xs-3">
{% if doc.percent_complete %}
<div class="progress" style="margin-bottom: 0!important; margin-top: 10px!important; height:5px;">
<div class="progress-bar progress-bar-{{ "warning" if doc.percent_complete|round < 100 else "success"}}" role="progressbar"
@ -19,7 +19,7 @@
{{ doc.status }}</span>
{% endif %}
</div>
<div class="col-xs-4 text-right small text-muted">
<div class="col-xs-3 text-right small text-muted">
{{ frappe.utils.pretty_date(doc.modified) }}
</div>
</div>

View File

@ -1,23 +1,16 @@
<div class="web-list-item">
<a href="/{{ pathname }}/{{ doc.name }}">
<div class="row">
<div class="col-sm-8 col-xs-7">
<div class="row">
<div class="col-sm-9">
<div>{{ doc.name }}</div>
<div class="col-sm-6">
<span class="indicator {{ doc.indicator_color or "darkgrey" }}">{{ doc.name }}</span>
<div class="small text-muted">{{ doc.items_preview }}</div>
</div>
<div class="col-sm-3">
<span class="indicator {{ doc.indicator_color or "darkgrey" }}">
{{ doc.indicator_title or doc.status or "Submitted" }}
</span>
</div>
</div>
</div>
<div class="col-sm-2 col-xs-5 text-right">
<div class="col-sm-3 col-xs-5">
{{ doc.get_formatted("grand_total") }}
</div>
<div class="col-sm-2 small text-muted text-right" title="{{ frappe.utils.format_datetime(doc.creation, "medium") }}">
<div class="col-sm-3 small text-muted text-right" title="{{ frappe.utils.format_datetime(doc.creation, "medium") }}">
{{ frappe.utils.pretty_date(doc.creation) }}</div>
</div>
</a>

View File

@ -8,6 +8,7 @@ from frappe import _
def get_context(context):
context.no_cache = 1
context.show_sidebar = True
context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name)
if hasattr(context.doc, "set_indicator"):
context.doc.set_indicator()

View File

@ -3,11 +3,15 @@
{% block title %}{{ doc.project_name }}{% endblock %}
{%- from "templates/includes/projects/macros.html" import back_link -%}
{% block header_actions %}
{% include 'templates/includes/projects/project_search_box.html' %}
{% endblock %}
{% block header %}<h1>{{ doc.project_name }}</h1>{% endblock %}
{% block header_actions %}{% if doc.percent_complete %}
<div class="progress progress-hg">
<div class="progress-bar progress-bar-{{ "warning" if doc.percent_complete|round < 100 else "success" }} active" role="progressbar"
aria-valuenow="{{ doc.percent_complete|round|int }}"
aria-valuemin="0" aria-valuemax="100" style="width:{{ doc.percent_complete|round|int }}%;">
</div>
</div>
{% endif %}{% endblock %}
{% block breadcrumbs %}
<div class="page-breadcrumbs" data-html-block="breadcrumbs">
<ul class="breadcrumb">
@ -29,24 +33,6 @@
{% block page_content %}
<div class="row">
<div class="col-xs-6">
<h2 class= "title">
{{ doc.project_name }}
</h2>
</div>
<div class="col-xs-6">
{% if doc.percent_complete %}
<div class="progress progress-hg">
<div class="progress-bar progress-bar-{{ "warning" if doc.percent_complete|round < 100 else "success" }} active" role="progressbar"
aria-valuenow="{{ doc.percent_complete|round|int }}"
aria-valuemin="0" aria-valuemax="100" style="width:{{ doc.percent_complete|round|int }}%;">
</div>
</div>
{% endif %}
</div>
</div>
<hr class="small">
<div class="clearfix">
<h4 style="float: left;">{{ _("Tasks") }}</h4>

View File

@ -11,7 +11,8 @@ def get_context(context):
raise frappe.PermissionError
context.no_cache = 1
context.show_search = True
context.show_sidebar = True
project = frappe.get_doc('Project', frappe.form_dict.project)
project.has_permission('read')