[website] [minor] moving to framework

This commit is contained in:
Anand Doshi
2013-09-10 18:29:39 +05:30
parent f2d0255031
commit b0d996ffb1
52 changed files with 606 additions and 199 deletions

View File

@@ -128,7 +128,7 @@ $.extend(wn.cart, {
render_item_row: function($cart_items, doc) {
doc.image_html = doc.image ?
'<div style="height: 120px; overflow: hidden;"><img src="' + doc.image + '" /></div>' :
'{% include "app/website/templates/html/product_missing_image.html" %}';
'{% include "app/stock/doctype/item/templates/includes/product_missing_image.html" %}';
if(doc.description === doc.item_name) doc.description = "";

View File

@@ -0,0 +1,6 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
no_cache = True

View File

@@ -1,7 +1,7 @@
{% extends base_template %}
{% block javascript %}
{% include "app/website/templates/js/cart.js" %}
<script>{% include "app/portal/templates/includes/cart.js" %}</script>
{% endblock %}
{% set title="Shopping Cart" %}

View File

@@ -0,0 +1,6 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
no_cache = True

View File

@@ -1 +0,0 @@
{% extends "app/portal/templates/sale.html" %}

View File

@@ -1,14 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def get_context():
from portal.website_transactions import get_transaction_context
context = get_transaction_context("Sales Invoice", webnotes.form_dict.name)
context.update({
"parent_link": "invoices",
"parent_title": "Invoices"
})
return context

View File

@@ -1 +0,0 @@
{% extends "app/portal/templates/sales_transactions.html" %}

View File

@@ -1,22 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def get_context():
from portal.website_transactions import get_currency_context
context = get_currency_context()
context.update({
"title": "Invoices",
"method": "portal.templates.pages.invoices.get_invoices",
"icon": "icon-file-text",
"empty_list_message": "No Invoices Found",
"page": "invoice"
})
return context
@webnotes.whitelist()
def get_invoices(start=0):
from portal.website_transactions import get_transaction_list
return get_transaction_list("Sales Invoice", start)

View File

@@ -1 +0,0 @@
{% extends "app/portal/templates/sale.html" %}

View File

@@ -1,14 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def get_context():
from portal.website_transactions import get_transaction_context
context = get_transaction_context("Sales Order", webnotes.form_dict.name)
context.update({
"parent_link": "orders",
"parent_title": "My Orders"
})
return context

View File

@@ -1 +0,0 @@
{% extends "app/portal/templates/sales_transactions.html" %}

View File

@@ -1,23 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def get_context():
from portal.website_transactions import get_currency_context
context = get_currency_context()
context.update({
"title": "My Orders",
"method": "portal.templates.pages.orders.get_orders",
"icon": "icon-list",
"empty_list_message": "No Orders Yet",
"page": "order",
})
return context
@webnotes.whitelist()
def get_orders(start=0):
from portal.website_transactions import get_transaction_list
return get_transaction_list("Sales Order", start)

View File

@@ -9,7 +9,7 @@
<li><a href="account">My Account</a></li>
<li class="active"><i class="icon-user icon-fixed-width"></i> My Profile</li>
</ul>
<div class="alert" id="message" style="display: none;"></div>
<div class="alert alert-warning" id="message" style="display: none;"></div>
<form>
<fieldset>
<label>Full Name</label>
@@ -39,7 +39,7 @@ $(document).ready(function() {
$("#fullname").val(getCookie("full_name") || "");
$("#update_profile").click(function() {
wn.call({
method: "startup.webutils.update_profile",
method: "portal.templates.pages.profile.update_profile",
type: "POST",
args: {
fullname: $("#fullname").val(),

View File

@@ -0,0 +1,32 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr
no_cache = True
def get_context():
from selling.utils.cart import get_lead_or_customer
party = get_lead_or_customer()
if party.doctype == "Lead":
mobile_no = party.mobile_no
phone = party.phone
else:
mobile_no, phone = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user,
"customer": party.name}, ["mobile_no", "phone"])
return {
"company_name": cstr(party.customer_name if party.doctype == "Customer" else party.company_name),
"mobile_no": cstr(mobile_no),
"phone": cstr(phone)
}
@webnotes.whitelist()
def update_profile(fullname, password=None, company_name=None, mobile_no=None, phone=None):
from selling.utils.cart import update_party
update_party(fullname, company_name, mobile_no, phone)
from core.doctype.profile import profile
return profile.update_profile(fullname, password)

View File

@@ -1 +0,0 @@
{% extends "app/portal/templates/sale.html" %}

View File

@@ -1,14 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def get_context():
from portal.website_transactions import get_transaction_context
context = get_transaction_context("Delivery Note", webnotes.form_dict.name)
context.update({
"parent_link": "shipments",
"parent_title": "Shipments"
})
return context

View File

@@ -1 +0,0 @@
{% extends "app/portal/templates/sales_transactions.html" %}

View File

@@ -1,22 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def get_context():
from portal.website_transactions import get_currency_context
context = get_currency_context()
context.update({
"title": "Shipments",
"method": "portal.templates.pages.shipments.get_shipments",
"icon": "icon-truck",
"empty_list_message": "No Shipments Found",
"page": "shipment"
})
return context
@webnotes.whitelist()
def get_shipments(start=0):
from portal.website_transactions import get_transaction_list
return get_transaction_list("Delivery Note", start)

View File

@@ -1,61 +0,0 @@
{% extends base_template %}
{% set title="My Profile" %}
{% block content %}
<div class="col-md-12">
<ul class="breadcrumb">
<li><a href="index">Home</a></li>
<li><a href="account">My Account</a></li>
<li class="active"><i class="icon-user icon-fixed-width"></i> My Profile</li>
</ul>
<div class="alert alert-warning" id="message" style="display: none;"></div>
<form>
<fieldset>
<label>Full Name</label>
<input class="form-control" type="text" id="fullname" placeholder="Your Name">
</fieldset>
<fieldset>
<label>Password</label>
<input class="form-control" type="password" id="password" placeholder="Password">
</fieldset>
<fieldset>
<label>Company Name</label>
<input class="form-control" type="text" id="company_name" placeholder="Company Name" value="{{ company_name }}">
</fieldset>
<fieldset>
<label>Mobile No</label>
<input class="form-control" type="text" id="mobile_no" placeholder="Mobile No" value="{{ mobile_no }}">
</fieldset>
<fieldset>
<label>Phone</label>
<input class="form-control" type="text" id="phone" placeholder="Phone" value="{{ phone }}">
</fieldset>
<button id="update_profile" type="submit" class="btn btn-default">Update</button>
</form>
</div>
<script>
$(document).ready(function() {
$("#fullname").val(getCookie("full_name") || "");
$("#update_profile").click(function() {
wn.call({
method: "startup.webutils.update_profile",
type: "POST",
args: {
fullname: $("#fullname").val(),
password: $("#password").val(),
company_name: $("#company_name").val(),
mobile_no: $("#mobile_no").val(),
phone: $("#phone").val()
},
btn: this,
msg: $("#message"),
callback: function(r) {
if(!r.exc) $("#user-full-name").html($("#fullname").val());
}
});
return false;
})
})
</script>
{% endblock %}