[website] [minor] moving to framework

This commit is contained in:
Rushabh Mehta 2013-09-09 17:31:19 +05:30
parent bb4c6eb630
commit bdb846f665
9 changed files with 42 additions and 65 deletions

View File

@ -43,12 +43,6 @@
"color": "#7f8c8d",
"icon": "icon-cogs"
},
"Website": {
"type": "module",
"link": "website-home",
"color": "#16a085",
"icon": "icon-globe"
},
"HR": {
"type": "module",
"link": "hr-home",
@ -80,28 +74,13 @@
},
"web": {
"pages": {
"about": {
"template": "app/website/templates/pages/about",
"args_method": "website.doctype.about_us_settings.about_us_settings.get_args"
},
"account": {
"no_cache": true,
"template": "app/website/templates/pages/account"
},
"blog": {
"template": "app/website/templates/pages/blog",
"args_method": "website.doctype.blog_post.blog_post.get_blog_template_args"
},
"contact": {
"template": "app/website/templates/pages/contact",
"args_doctype": "Contact Us Settings"
},
"index": {
"template": "app/website/templates/pages/index"
"template": "app/portal/templates/account.html"
},
"order": {
"no_cache": true,
"template": "app/website/templates/pages/sale",
"template": "app/portal/templates/sale.html",
"args_method": "utilities.website_transactions.get_order_args",
"portal": {
"doctype": "Sales Order",
@ -112,12 +91,12 @@
},
"orders": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
"template": "app/portal/templates/sales_transactions.html",
"args_method": "utilities.website_transactions.order_list_args"
},
"invoice": {
"no_cache": true,
"template": "app/website/templates/pages/sale",
"template": "app/portal/templates/sale.html",
"args_method": "utilities.website_transactions.get_invoice_args",
"portal": {
"doctype": "Sales Invoice",
@ -128,12 +107,12 @@
},
"invoices": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
"template": "app/portal/templates/sales_transactions.html",
"args_method": "utilities.website_transactions.invoice_list_args"
},
"shipment": {
"no_cache": true,
"template": "app/website/templates/pages/sale",
"template": "app/portal/templates/sale.html",
"args_method": "utilities.website_transactions.get_shipment_args",
"portal": {
"doctype": "Delivery Note",
@ -144,69 +123,57 @@
},
"shipments": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
"template": "app/portal/templates/sales_transactions.html",
"args_method": "utilities.website_transactions.shipment_list_args"
},
"product_search": {
"template": "app/website/templates/pages/product_search"
"template": "app/stock/doctype/item/templates/product_search.html"
},
"ticket": {
"no_cache": true,
"template": "app/website/templates/pages/ticket",
"template": "app/support/doctype/support_ticket/templates/ticket.html",
"args_method": "support.doctype.support_ticket.support_ticket.get_website_args",
"portal": {
"doctype": "Support Ticket"
}
},
"tickets": {
"template": "app/website/templates/pages/tickets",
"template": "app/support/doctype/support_ticket/templates/tickets.html",
"args_method": "utilities.website_transactions.ticket_list_args"
},
"address": {
"no_cache": true,
"template": "app/website/templates/pages/address",
"template": "app/utilities/doctype/address/templates/address.html",
"args_method": "utilities.doctype.address.address.get_website_args"
},
"addresses": {
"template": "app/website/templates/pages/addresses"
},
"writers": {
"template": "app/website/templates/pages/writers",
"args_method": "website.doctype.blogger.blogger.get_writers_args"
"template": "app/utilities/doctype/address/templates/addresses.html"
},
"profile": {
"no_cache": true,
"template": "app/website/templates/pages/profile",
"template": "app/portal/templates/profile.html",
"args_method": "startup.webutils.get_profile_args"
},
"cart": {
"no_cache": true,
"template": "app/website/templates/pages/cart.html"
"template": "app/portal/templates/cart.html"
},
"partners": {
"template": "app/website/templates/pages/partners",
"template": "app/setup/doctype/sales_partners/templates/partners.html",
"args_method": "setup.doctype.sales_partner.sales_partner.get_partner_args"
}
},
"generators": {
"Web Page": {
"template": "app/website/templates/html/web_page.html",
"condition_field": "published"
},
"Blog Post": {
"template": "app/website/templates/html/blog_page.html",
"condition_field": "published"
},
"Item": {
"template": "app/website/templates/html/product_page.html",
"template": "app/stock/doctype/item/templates/item.html",
"condition_field": "show_in_website"
},
"Item Group":{
"template": "app/website/templates/html/product_group.html",
"template": "app/setup/doctype/item_group/templates/item_group.html",
"condition_field": "show_in_website"
},
"Sales Partner": {
"template": "app/website/templates/html/partner_page.html",
"template": "app/setup/doctype/sales_partner/templates/partner_page.html",
"condition_field": "show_in_website"
}
}

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import get_base_path
import os
import os, shutil
def execute():
# remove pyc files
@ -13,5 +13,5 @@ def execute():
print exists
os.remove(utils_pyc)
# TODO remove website folder
shutil.rmtree(os.path.join(get_base_path(), "app", "website"))

View File

@ -0,0 +1,19 @@
{% extends "lib/website/templates/base.html" %}
{% block toolbar %}
<div class="pull-right" style="margin:4px;" id="user-tools">
{% if shopping_cart_enabled -%}
<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>
<span class="cart-count"></span></a> |
{%- endif %}
<a id="login-link" href="login">Login</a>
</div>
<div class="pull-right hide" style="margin:4px;" id="user-tools-post-login">
<a href="account" title="My Account" id="user-full-name"></a> |
{% if shopping_cart_enabled -%}
<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>
<span class="cart-count"></span></a> |
{%- endif %}
<a href="server.py?cmd=web_logout" title="Sign Out"><i class="icon-signout"></i></a>
</div>
{% endblock %}

View File

@ -44,7 +44,7 @@ class DocType(DocTypeNestedSet):
webnotes.msgprint("An item exists with same name (%s), please change the \
item group name or rename the item" % self.doc.name, raise_exception=1)
def prepare_template_args(self):
def get_context(self):
from selling.utils.product import get_product_list_for_group, \
get_parent_item_groups, get_group_item_count

View File

@ -29,7 +29,7 @@ class DocType:
else:
return ''
def prepare_template_args(self):
def get_context(self):
address = webnotes.conn.get_value("Address",
{"sales_partner": self.doc.name, "is_primary_address": 1},
"*", as_dict=True)

View File

@ -7,15 +7,6 @@ from webnotes.utils import cint, cstr, encode
def get_templates_path():
return os.path.join(os.path.dirname(conf.__file__), "app", "website", "templates")
def get_home_page():
doc_name = webnotes.conn.get_value('Website Settings', None, 'home_page')
if doc_name:
page_name = webnotes.conn.get_value('Web Page', doc_name, 'page_name')
else:
page_name = 'login'
return page_name
def update_template_args(page_name, args):
from webnotes.utils import get_request_site_address

View File

@ -258,7 +258,7 @@ class DocType(DocListController):
def get_tax_rate(self, tax_type):
return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") }
def prepare_template_args(self):
def get_context(self):
from selling.utils.product import get_parent_item_groups
self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
self.doc.title = self.doc.item_name