moved directory structure
diff --git a/website/templates/__init__.py b/website/templates/__init__.py
new file mode 100644
index 0000000..baffc48
--- /dev/null
+++ b/website/templates/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/website/templates/css/blog.css b/website/templates/css/blog.css
new file mode 100644
index 0000000..199df1a
--- /dev/null
+++ b/website/templates/css/blog.css
@@ -0,0 +1,7 @@
+ <style>
+ h2 > a, h2 > a:link, h2 > a:visited, h2 > a:active,
+ h2 > a:hover, h2 > a:focus {
+ text-decoration: none;
+ color: inherit;
+ }
+ </style>
\ No newline at end of file
diff --git a/website/templates/css/blog_page.css b/website/templates/css/blog_page.css
new file mode 100644
index 0000000..928b8ac
--- /dev/null
+++ b/website/templates/css/blog_page.css
@@ -0,0 +1,9 @@
+ <style>
+ .comment-title {
+ color:#777;
+ }
+
+ .comment-content {
+ margin-left: 20px;
+ }
+ </style>
\ No newline at end of file
diff --git a/website/templates/css/login.css b/website/templates/css/login.css
new file mode 100644
index 0000000..4e3e4b1
--- /dev/null
+++ b/website/templates/css/login.css
@@ -0,0 +1,10 @@
+ <style>
+ #login_wrapper {
+ width: 300px !important;
+ margin: 20px auto;
+ }
+
+ .login-banner {
+ margin-bottom: 20px;
+ }
+ </style>
\ No newline at end of file
diff --git a/website/templates/css/product_page.css b/website/templates/css/product_page.css
new file mode 100644
index 0000000..2708625
--- /dev/null
+++ b/website/templates/css/product_page.css
@@ -0,0 +1,34 @@
+ <style>
+ .web-long-description {
+ font-size: 18px;
+ line-height: 200%;
+ }
+ .product-page-content {
+ float: left;
+ }
+ /* product page image css */
+ .product-page-content img {
+ max-width: 100%;
+ }
+
+ /* similar products listing */
+ .similar-products .img-area img {
+ max-width: 55px;
+ max-height: 55px;
+ }
+
+ .similar-products .img-area {
+ float: left;
+ width: 30%;
+ margin-top: 0.3em;
+ }
+
+ .similar-product-description {
+ float: left;
+ width: 70%;
+ }
+
+ .similar-product-description span {
+ font-size: 12px;
+ }
+ </style>
\ No newline at end of file
diff --git a/website/templates/css/products.css b/website/templates/css/products.css
new file mode 100644
index 0000000..73289c4
--- /dev/null
+++ b/website/templates/css/products.css
@@ -0,0 +1,11 @@
+ <style>
+ .img-area {
+ float:left;
+ width: 115px;
+ }
+
+ .product-list-description {
+ float:left;
+ width: 400px;
+ }
+ </style>
\ No newline at end of file
diff --git a/website/templates/html/base.html b/website/templates/html/base.html
new file mode 100644
index 0000000..c684b25
--- /dev/null
+++ b/website/templates/html/base.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8">
+ <title>{% block title %}{% endblock %}</title>
+ <meta name="generator" content="wnframework">
+ <script type="text/javascript" src="lib/js/lib/jquery/jquery.min.js"></script>
+ <script type="text/javascript" src="js/all-web.js"></script>
+ <script type="text/javascript" src="js/wn-web.js"></script>
+ <link type="text/css" rel="stylesheet" href="css/all-web.css">
+ <link type="text/css" rel="stylesheet" href="css/wn-web.css">
+
+ {% if favicon %}
+ <link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
+ <link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
+ {% else %}
+ <link rel="shortcut icon" href="app/images/favicon.ico" type="image/x-icon">
+ <link rel="icon" href="app/images/favicon.ico" type="image/x-icon">
+ {% endif %}
+
+
+ {% block header %}
+ {% endblock %}
+</head>
+<body>
+ {% block body %}
+ {% endblock %}
+</body>
\ No newline at end of file
diff --git a/website/templates/html/blog_page.html b/website/templates/html/blog_page.html
new file mode 100644
index 0000000..12a1c7a
--- /dev/null
+++ b/website/templates/html/blog_page.html
@@ -0,0 +1,56 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/blog_page.js" %}
+ {% include "js/blog_subscribe.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/blog_page.css" %}
+{% endblock %}
+
+{% block content %}
+ <div class="layout-wrapper layout-wrapper-background">
+ <div class="web-content" id="blog-{{ name }}">
+
+ <div class="layout-main-section">
+
+ <h2>{{ title }}</h2>
+
+ <!-- begin blog content -->
+ <div class="help">By {{ full_name }} on {{ updated }}</div>
+ <br>
+ {{ content_html }}
+ <!-- end blog content -->
+
+ <hr>
+ <h3>Comments</h3><br>
+ <div class="blog-comments">
+
+ {% if not comment_list %}
+ <div class="no-result help hide">
+ <p>Be the first one to comment</p>
+ <br />
+ </div>
+ {% endif %}
+
+ {% include 'html/comment.html' %}
+ </div>
+ <button class="btn add-comment">Add Comment</button>
+ </div>
+
+ <div class="layout-side-section">
+ <p><a href="blog.html">All Blogs</a></p>
+ <br />
+ {% block blog_subscribe %}
+ {% include "html/blog_subscribe.html" %}
+ {% endblock %}
+ <br />
+ <h4>Recent Posts</h4>
+ <div class="recent-posts" style="min-height: 100px;"></div>
+ </div>
+
+ <div style="clear: both"></div>
+ </div>
+ </div>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/html/blog_subscribe.html b/website/templates/html/blog_subscribe.html
new file mode 100644
index 0000000..7a4fd49
--- /dev/null
+++ b/website/templates/html/blog_subscribe.html
@@ -0,0 +1,9 @@
+<h4>Subscribe</h4>
+<br>
+<p>
+<button class="btn btn-warning btn-blog-subscribe">Get Updates via Email</button>
+</p>
+<p>
+<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
+<a href="rss.xml" target="_blank">RSS Feed</a>
+</p>
\ No newline at end of file
diff --git a/website/templates/html/comment.html b/website/templates/html/comment.html
new file mode 100644
index 0000000..1323e09
--- /dev/null
+++ b/website/templates/html/comment.html
@@ -0,0 +1,14 @@
+{#
+ this template generates comment rows for a blog
+ it is to be included in the blog/blog.html template
+#}
+
+{% for comment in comment_list %}
+<div class="comment-row">
+ <div class="comment-title">
+ {{ comment.comment_by_fullname }} - {{ comment.comment_date }}:
+ </div>
+ <p class="comment-content">{{ comment.comment }}</p>
+ <hr>
+</div>
+{% endfor %}
\ No newline at end of file
diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html
new file mode 100644
index 0000000..a671d98
--- /dev/null
+++ b/website/templates/html/outer.html
@@ -0,0 +1,76 @@
+{#
+ requires, brand, top_bar_items, footer_items, copyright, content
+#}
+
+{% extends "html/base.html" %}
+
+{% block body %}
+
+ <header>
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="index.html">{{ brand }}</a>
+ <ul class="nav">
+ {% for page in top_bar_items %}
+ {% if not page.parent_label %}
+ <li data-label="{{ page.label }}"
+ {% if page.child_items %}
+ class="dropdown"
+ {% endif %}>
+ <a href="{{ page.url or '#' }}"
+ {% if page.child_items %}
+ class="dropdown-toggle"
+ onclick="return false;"
+ data-toggle="dropdown"
+ {% endif %}
+ {{ page.target or ''}}>
+ {{ page.label }}
+ {% if page.child_items %}
+ <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ {% for child in page.child_items %}
+ <li data-label="{{ child.label }}">
+ <a href="{{ child.url }}" {{ child.target or '' }}>
+ {{ child.label }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% else %}
+ </a>
+ {% endif %}
+ </li>
+ {% endif %}
+ {% endfor %}
+ </ul>
+ <img src="images/lib/ui/spinner.gif" id="spinner"/>
+ <ul class="nav pull-right">
+ <li id="login-topbar-item"><a href="login.html">Login</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <script>$('.dropdown-toggle').dropdown()</script>
+ </header>
+ <div id="body_div">
+ <div class="content" id="page-{{ name }}" style="display: block;">
+ {% block content %}
+ {% endblock %}
+ </div>
+ </div>
+ <footer><div class="web-footer">
+ <div class="web-footer-menu"><ul>
+ {% for item in footer_items %}
+ <li><a href="{{ item.url }}" {{ item.target }}
+ data-label="{{ item.label }}">{{ item.label }}</a></li>
+ {% endfor %}
+ </ul></div>
+ {% if copyright %}
+ <div class="web-footer-copyright">© {{ copyright }}
+ {% endif %}
+ </div>
+ </footer>
+
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/html/page.html b/website/templates/html/page.html
new file mode 100644
index 0000000..e2eb6f4
--- /dev/null
+++ b/website/templates/html/page.html
@@ -0,0 +1,36 @@
+{% extends "html/outer.html" %}
+
+{% block title %}{{ title }}{% endblock %}
+
+{% block header %}
+ {{ super() }}
+ <script>
+ window.page_name = "{{ name }}";
+
+ $(document).bind('app_ready', function() {
+ var _page = new wn.views.Page(window.page_name);
+
+ // page script
+ {% block javascript %}
+ {% endblock %}
+
+ // trigger onload
+ _page.trigger('onload');
+
+ // activate page
+ wn.container.change_to(window.page_name);
+ });
+ </script>
+
+ {% block css %}
+ {% if insert_style %}
+
+ <style>{{ css }}</style>
+
+ {% endif %}
+ {% endblock %}
+{% endblock %}
+
+{% block content %}
+ {{ content }}
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/html/product_page.html b/website/templates/html/product_page.html
new file mode 100644
index 0000000..646bba9
--- /dev/null
+++ b/website/templates/html/product_page.html
@@ -0,0 +1,48 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/product_page.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/product_page.css" %}
+{% endblock %}
+
+{% block title %}
+ {% if item_name != name %}
+ {{ item_name }} [{{ name }}]
+ {% else %}
+ {{ item_name }}
+ {% endif %}
+{% endblock %}
+
+{% block content %}
+ <div class="layout-wrapper layout-wrapper-background">
+ <div class="web-content" id="content-product-{{ name }}">
+ <div class="layout-main-section">
+ <h1>{{ item_name }}</h1>
+ <div class="product-page-content">
+ <br><br>
+ {% if website_image %}
+ <image src="files/{{ website_image }}" />
+ {% else %}
+ <div class="img-area"></div>
+ <span style="font-size: 11px">This is an auto-generated Image</span>
+ {% endif %}
+ <br><br>
+ <div class="web-long-description">
+ {{ web_description_html }}
+ </div>
+ </div>
+ </div>
+ <div class="layout-side-section">
+ <h4>More Categories</h4>
+ <div class="more-categories"></div>
+ <br>
+ <h4>Similar Products</h4>
+ <div class="similar-products"></div>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ </div>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/html/web_page.html b/website/templates/html/web_page.html
new file mode 100644
index 0000000..6fa7d27
--- /dev/null
+++ b/website/templates/html/web_page.html
@@ -0,0 +1,29 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% if insert_code %}
+ {{ javascript }}
+ {% endif %}
+{% endblock %}
+
+{% block content %}
+ <div class="layout-wrapper layout-wrapper-background">
+ <div class="web-content" style="text-align: {{ text_align }};">
+
+ {% if layout and layout.startswith('Two column') %}
+ <div class="layout-main-section">
+ {% else %}
+ <div class="layout-main">
+ {% endif %}
+ {{ main_section_html }}
+ </div>
+
+ {% if layout and layout.startswith('Two column') %}
+ <div class="layout-side-section">
+ {{ side_section_html }}
+ </div>
+ {% endif %}
+ <div style="clear: both"></div>
+ </div>
+ </div>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/js/blog.js b/website/templates/js/blog.js
new file mode 100644
index 0000000..8c9b9d7
--- /dev/null
+++ b/website/templates/js/blog.js
@@ -0,0 +1,43 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// js inside blog page
+wn.pages['{{ name }}'].onload = function(wrapper) {
+ erpnext.blog_list = new wn.ui.Listing({
+ parent: $(wrapper).find('#blog-list').get(0),
+ method: 'website.blog.get_blog_list',
+ hide_refresh: true,
+ no_toolbar: true,
+ render_row: function(parent, data) {
+ if(!data.comments) {
+ data.comment_text = 'No comments yet.'
+ } else if (data.comments===1) {
+ data.comment_text = '1 comment.'
+ } else {
+ data.comment_text = data.comments + ' comments.'
+ }
+
+ if(data.content && data.content.length==1000) {
+ data.content += repl('... <a href="%(name)s.html">(read on)</a>', data);
+ }
+ parent.innerHTML = repl('<h2><a href="%(name)s.html">%(title)s</a></h2>\
+ <div class="help">%(comment_text)s</div>\
+ %(content)s<br /><br />', data);
+ },
+ page_length: 10
+ });
+ erpnext.blog_list.run();
+}
\ No newline at end of file
diff --git a/website/templates/js/blog_page.js b/website/templates/js/blog_page.js
new file mode 100644
index 0000000..02d6dd5
--- /dev/null
+++ b/website/templates/js/blog_page.js
@@ -0,0 +1,181 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// js inside blog page
+
+wn.provide('erpnext.blog');
+wn.pages['{{ name }}'].onload = function(wrapper) {
+ erpnext.blog.wrapper = wrapper;
+
+ // sidebar
+ erpnext.blog.render_recent_list(wrapper);
+
+ // unhide no-result if no comments found
+ erpnext.blog.toggle_no_result(wrapper);
+
+ // bind add comment button to comment dialog
+ erpnext.blog.make_comment_dialog(wrapper);
+
+ // hide add comment button after 50 comments
+ erpnext.blog.toggle_add_comment_btn(wrapper);
+}
+
+erpnext.blog.adjust_page_height = function(wrapper) {
+ if (!wrapper) { wrapper = erpnext.blog.wrapper; }
+ if (!wrapper) { return; }
+
+ // adjust page height based on sidebar height
+ var $main_page = $(wrapper).find('.layout-main-section');
+ var $sidebar = $(wrapper).find('.layout-side-section');
+ if ($sidebar.height() > $main_page.height()) {
+ $main_page.height($sidebar.height());
+ }
+}
+
+erpnext.blog.render_recent_list = function(wrapper) {
+ if (!wrapper) { wrapper = erpnext.blog.wrapper; }
+ if (!wrapper) { return; }
+
+ wrapper.recent_list = new wn.ui.Listing({
+ parent: $(wrapper).find('.recent-posts'),
+ no_toolbar: true,
+ method: 'website.blog.get_recent_blog_list',
+ get_args: function() {
+ return { name: '{{ name }}' }
+ },
+ hide_refresh: true,
+ render_row: function(parent, data) {
+ if(data.content && data.content.length>=100) data.content += '...';
+ parent.innerHTML = repl('<div style="font-size: 80%">\
+ <a href="%(page_name)s.html">%(title)s</a>\
+ <div class="comment">%(content)s</div><br></div>', data);
+
+ // adjust page height depending on sidebar height
+ erpnext.blog.adjust_page_height(wrapper);
+ },
+ page_length: 5,
+ });
+ wrapper.recent_list.run();
+}
+
+erpnext.blog.toggle_no_result = function(wrapper) {
+ if (!wrapper) { wrapper = erpnext.blog.wrapper; }
+ if (!wrapper) { return; }
+
+ var $blog_comments = $(wrapper).find('.blog-comments');
+ var $comment_rows = $blog_comments.find('.comment-row');
+ var $no_result = $blog_comments.find('.no-result');
+
+ if ($comment_rows.length == 0) {
+ $no_result.removeClass('hide');
+ } else {
+ $no_result.addClass('hide');
+ }
+}
+
+erpnext.blog.make_comment_dialog = function(wrapper) {
+ if (!wrapper) { wrapper = erpnext.blog.wrapper; }
+ if (!wrapper) { return; }
+
+ var $comment_btn = $(wrapper).find('button.add-comment');
+
+ $comment_btn.click(function() {
+ if(!erpnext.blog.comment_dialog) {
+ var d = new wn.widgets.Dialog({
+ title: 'Add Comment',
+ fields: [
+ {
+ fieldname: 'comment_by_fullname', label: 'Your Name',
+ reqd: 1, fieldtype: 'Data'
+ },
+ {
+ fieldname: 'comment_by', label: 'Email Id',
+ reqd: 1, fieldtype: 'Data'
+ },
+ {
+ fieldname: 'comment', label: 'Comment',
+ reqd: 1, fieldtype: 'Text'
+ },
+ {
+ fieldname: 'post_comment', label: 'Post Comment',
+ fieldtype: 'Button'
+ },
+ ],
+ });
+
+ erpnext.blog.comment_dialog = d;
+ }
+
+ erpnext.blog.comment_dialog.fields_dict.post_comment
+ .input.onclick = function() {
+ erpnext.blog.add_comment(wrapper);
+ }
+
+ erpnext.blog.comment_dialog.show();
+ });
+
+}
+
+erpnext.blog.add_comment = function(wrapper) {
+ var args = erpnext.blog.comment_dialog.get_values();
+
+ if(!args) return;
+
+ args.comment_doctype = 'Blog';
+ args.comment_docname = '{{ name }}';
+ args.page_name = '{{ page_name }}';
+
+ wn.call({
+ method: 'website.blog.add_comment',
+ args: args,
+ btn: this,
+ callback: function(r) {
+ if(!r.exc) {
+ erpnext.blog.add_comment_to_page(wrapper, r.message);
+ erpnext.blog.comment_dialog.hide();
+ }
+ }
+ });
+}
+
+erpnext.blog.add_comment_to_page = function(wrapper, comment) {
+ $blog_comments = $(wrapper).find('.blog-comments');
+ $comment_rows = $blog_comments.find('.comment-row');
+
+ if ($comment_rows.length) {
+ $blog_comments.append(comment);
+ } else {
+ $blog_comments.append(comment);
+ }
+
+ erpnext.blog.toggle_no_result(wrapper);
+ erpnext.blog.toggle_add_comment_btn(wrapper);
+}
+
+erpnext.blog.toggle_add_comment_btn = function(wrapper) {
+ var $wrapper = $(wrapper);
+ if ($wrapper.find('.blog-comments .comment-row').length > 50) {
+ var $comment_btn = $wrapper.find('button.add-comment');
+ $comment_btn.addClass('hide');
+
+ // show comments are close
+ $wrapper.find('.blog-comments').append("\
+ <div class=\"help\"> \
+ <p>Comments Closed</p> \
+ <br /> \
+ </div>");
+ }
+}
\ No newline at end of file
diff --git a/website/templates/js/blog_subscribe.js b/website/templates/js/blog_subscribe.js
new file mode 100644
index 0000000..b3e10a7
--- /dev/null
+++ b/website/templates/js/blog_subscribe.js
@@ -0,0 +1,33 @@
+wn.provide('erpnext.blog');
+
+(function() {
+ $('body').on('click', '.btn-blog-subscribe', function() {
+ var d = new wn.ui.Dialog({
+ title: "Get Blog Updates via Email",
+ fields: [
+ {label: "Your Name", fieldtype:"Data", reqd:1},
+ {label: "Your Email Address", fieldtype:"Data", reqd:1
+ ,description: "You can unsubscribe anytime."},
+ {label: "Subscribe", fieldtype:"Button"}
+ ]
+ });
+ $(d.fields_dict.subscribe.input).click(function() {
+ var args = d.get_values();
+ if(!args) return;
+ wn.call({
+ method: 'website.blog.add_subscriber',
+ args: args,
+ callback: function(r) {
+ if(r.exc) {
+ msgprint('Opps there seems to be some error, Please check back after some time.');
+ } else {
+ msgprint('Thanks for subscribing!');
+ }
+ d.hide();
+ },
+ btn: this
+ })
+ })
+ d.show()
+ })
+})()
diff --git a/website/templates/js/login.js b/website/templates/js/login.js
new file mode 100644
index 0000000..4ca18c9
--- /dev/null
+++ b/website/templates/js/login.js
@@ -0,0 +1,92 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+wn.provide('erpnext.login');
+
+wn.pages["{{ name }}"].onload = function(wrapper) {
+ wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
+ wrapper.appframe.title('Login');
+ wrapper.appframe.$w.find('.close').toggle(false);
+
+ var lw = $i('login_wrapper');
+ $bs(lw, '1px 1px 3px #888');
+
+ $('#login_btn').click(erpnext.login.doLogin)
+
+ $('#password').keypress(function(ev){
+ if(ev.which==13 && $('#password').val()) {
+ $('form').submit(function() {
+ erpnext.login.doLogin();
+ return false;
+ });
+ }
+ });
+ $(document).trigger('login_rendered');
+}
+
+// Login Callback
+erpnext.login.onLoginReply = function(r, rtext) {
+ $('#login_btn').done_working();
+ if(r.message=="Logged In"){
+ window.location.href='app.html' + (get_url_arg('page') ? ('?page='+get_url_arg('page')) : '');
+ } else {
+ $i('login_message').innerHTML = '<span style="color: RED;">'+(r.message)+'</span>';
+ //if(r.exc)alert(r.exc);
+ }
+}
+
+
+// Login
+erpnext.login.doLogin = function(){
+
+ var args = {};
+ args['usr']=$i("login_id").value;
+ args['pwd']=$i("password").value;
+ if($i('remember_me').checked)
+ args['remember_me'] = 1;
+
+ $('#login_btn').set_working();
+ $('#login_message').empty();
+
+ $c("login", args, erpnext.login.onLoginReply);
+
+ return false;
+}
+
+
+erpnext.login.show_forgot_password = function(){
+ // create dialog
+ var d = new wn.ui.Dialog({
+ title:"Forgot Password",
+ fields: [
+ {'label':'Email Id', 'fieldname':'email_id', 'fieldtype':'Data', 'reqd':true},
+ {'label':'Email Me A New Password', 'fieldname':'run', 'fieldtype':'Button'}
+ ]
+ });
+
+ $(d.fields_dict.run.input).click(function() {
+ var values = d.get_values();
+ if(!values) return;
+ wn.call({
+ method:'reset_password',
+ args: { user: values.email_id },
+ callback: function() {
+ d.hide();
+ }
+ })
+ })
+ d.show();
+}
\ No newline at end of file
diff --git a/website/templates/js/product_category.js b/website/templates/js/product_category.js
new file mode 100644
index 0000000..4229d00
--- /dev/null
+++ b/website/templates/js/product_category.js
@@ -0,0 +1,18 @@
+wn.provide('erpnext.products');
+
+erpnext.products.make_product_categories = function(wrapper) {
+ if (!wrapper) { wrapper = erpnext.products.wrapper; }
+ if (!wrapper) { return; }
+
+ wrapper.category_list = new wn.ui.Listing({
+ parent: $(wrapper).find('.more-categories').get(0),
+ method: 'website.product.get_product_category_list',
+ hide_refresh: true,
+ render_row: function(parent, data) {
+ parent.innerHTML = repl(
+ '<a href="products.html#!products/%(item_group)s">%(item_group)s</a> (%(items)s)',
+ data);
+ }
+ });
+ wrapper.category_list.run();
+}
\ No newline at end of file
diff --git a/website/templates/js/product_page.js b/website/templates/js/product_page.js
new file mode 100644
index 0000000..0c4abb4
--- /dev/null
+++ b/website/templates/js/product_page.js
@@ -0,0 +1,92 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+{% include "js/product_category.js" %}
+
+wn.pages['{{ name }}'].onload = function(wrapper) {
+ wrapper.product_group = "{{ item_group }}";
+ wrapper.product_name = "{{ name }}";
+ erpnext.products.make_product_categories(wrapper);
+ erpnext.products.make_similar_products(wrapper);
+
+ // if website image missing, autogenerate one
+ var $img = $(wrapper).find('.product-page-content .img-area');
+ if ($img && $img.length > 0) {
+ $img.append(wn.dom.placeholder(160, "{{ item_name }}"));
+ }
+
+ erpnext.products.adjust_page_height(wrapper);
+
+}
+
+erpnext.products.adjust_page_height = function(wrapper) {
+ if (!wrapper) { wrapper = erpnext.products.wrapper; }
+ if (!wrapper) { return; }
+
+ // adjust page height based on sidebar height
+ var $main_page = $(wrapper).find('.layout-main-section');
+ var $sidebar = $(wrapper).find('.layout-side-section');
+ if ($sidebar.height() > $main_page.height()) {
+ $main_page.height($sidebar.height());
+ }
+}
+
+erpnext.products.make_similar_products = function(wrapper) {
+ if (!wrapper) { wrapper = erpnext.products.wrapper; }
+ if (!wrapper) { return; }
+
+ // similar products
+ wrapper.similar = new wn.ui.Listing({
+ parent: $(wrapper).find('.similar-products').get(0),
+ hide_refresh: true,
+ page_length: 5,
+ method: 'website.product.get_similar_product_list',
+ get_args: function() {
+ return {
+ product_group: wrapper.product_group,
+ product_name: wrapper.product_name
+ }
+ },
+ render_row: function(parent, data) {
+ if (!data.web_short_description) {
+ data.web_short_description = data.description;
+ }
+ if(data.web_short_description.length > 100) {
+ data.web_short_description =
+ data.web_short_description.substr(0,100) + '...';
+ }
+ parent.innerHTML = repl('\
+ <a href="%(page_name)s.html"><div class="img-area"></div></a>\
+ <div class="similar-product-description">\
+ <h5><a href="%(page_name)s.html">%(item_name)s</a></h5>\
+ <span>%(web_short_description)s</span>\
+ </div>\
+ <div style="clear:both"></div>', data);
+
+ if(data.website_image) {
+ $(parent).find('.img-area').append(repl(
+ '<img src="files/%(website_image)s" />', data))
+ } else {
+ $(parent).find('.img-area').append(wn.dom.placeholder(55,
+ data.item_name));
+ }
+
+ // adjust page height, if sidebar height keeps increasing
+ erpnext.products.adjust_page_height(wrapper);
+ }
+ });
+ wrapper.similar.run();
+}
\ No newline at end of file
diff --git a/website/templates/js/products.js b/website/templates/js/products.js
new file mode 100644
index 0000000..f4c68cb
--- /dev/null
+++ b/website/templates/js/products.js
@@ -0,0 +1,106 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// js inside blog page
+
+{% include "js/product_category.js" %}
+
+wn.pages['{{ name }}'].onload = function(wrapper) {
+ erpnext.products.wrapper = wrapper;
+
+ // make product categories in the sidebar
+ erpnext.products.make_product_categories(wrapper);
+
+ // make lists
+ erpnext.products.make_product_list(wrapper);
+
+ // bind search button or enter key
+ $(wrapper).find('.products-search .btn').click(function() {
+ erpnext.products.product_list.run();
+ });
+
+ $(wrapper).find('.products-search input').keypress(function(ev) {
+ if(ev.which==13) $(wrapper).find('.products-search .btn').click();
+ });
+}
+
+erpnext.products.make_product_list = function(wrapper) {
+ if (!wrapper) { wrapper = erpnext.products.wrapper; }
+ if (!wrapper) { return; }
+
+ erpnext.products.product_list = new wn.ui.Listing({
+ parent: $(wrapper).find('#products-list').get(0),
+ run_btn: $(wrapper).find('.products-search .btn').get(0),
+ no_toolbar: true,
+ method: 'website.product.get_product_list',
+ get_args: function() {
+ return {
+ search: $('input[name="products-search"]').val() || '',
+ product_group: erpnext.products.cur_group || '',
+ };
+ },
+ render_row: function(parent, data) {
+ if (!data.web_short_description) {
+ data.web_short_description = data.description;
+ }
+ parent.innerHTML = repl('\
+ <a href="%(page_name)s.html"><div class="img-area"></div></a>\
+ <div class="product-list-description">\
+ <h4><a href="%(page_name)s.html">%(item_name)s</a></h4>\
+ <p>%(web_short_description)s</p></div>\
+ <div style="clear: both;"></div>', data);
+
+ if(data.website_image) {
+ $(parent).find('.img-area').append(repl(
+ '<img src="files/%(website_image)s" style="width:100px;">', data))
+ } else {
+ $(parent).find('.img-area').append(wn.dom.placeholder(100,
+ data.item_name));
+ }
+ }
+ });
+}
+
+wn.pages['{{ name }}'].onshow = function(wrapper) {
+ // show default product category
+ erpnext.products.set_group();
+}
+
+erpnext.products.set_group = function() {
+ var cat = erpnext.products.get_group();
+
+ // get erpnext.products.default_category
+ var wrapper = erpnext.products.wrapper;
+
+ $(wrapper).find('h1').html(cat.label);
+ erpnext.products.product_list.run();
+}
+
+erpnext.products.get_group = function() {
+ route = wn.get_route();
+ if(route && route.length>1) {
+ // from url
+ var grp = route[1];
+ var label = route[1];
+ erpnext.products.cur_group = grp;
+ } else {
+ // default
+ var grp = 'Products';
+ var label = 'Products';
+ erpnext.products.cur_group = null;
+ }
+ return {grp:grp, label:label};
+}
\ No newline at end of file
diff --git a/website/templates/pages/404.html b/website/templates/pages/404.html
new file mode 100644
index 0000000..0423608
--- /dev/null
+++ b/website/templates/pages/404.html
@@ -0,0 +1,12 @@
+{% extends "html/outer.html" %}
+
+{% block content %}
+<div class="content">
+ <div class="layout-wrapper layout-main">
+ <h3>Page missing or moved</h3>
+ <br>
+ <p>We are very sorry for this, but the page you are looking for is missing
+ (this could be because of a typo in the address) or moved.</p>
+ </div>
+</div>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/blog.html b/website/templates/pages/blog.html
new file mode 100644
index 0000000..17fd6e7
--- /dev/null
+++ b/website/templates/pages/blog.html
@@ -0,0 +1,34 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/blog.js" %}
+ {% include "js/blog_subscribe.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/blog.css" %}
+{% endblock %}
+
+{% block title %}Blog{% endblock %}
+
+{% block content %}
+ <div class="layout-wrapper layout-wrapper-background">
+ <div class="web-content" id="content-blog">
+
+ <div class="layout-main-section">
+ <h1>Blog</h1>
+ <br>
+ <div id="blog-list">
+ <!-- blog list will be generated dynamically -->
+ </div>
+ </div>
+
+ <div class="layout-side-section">
+ {% block blog_subscribe %}
+ {% include "html/blog_subscribe.html" %}
+ {% endblock %}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ </div>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/index.html b/website/templates/pages/index.html
new file mode 100644
index 0000000..1307872
--- /dev/null
+++ b/website/templates/pages/index.html
@@ -0,0 +1 @@
+{% extends "html/web_page.html" %}
\ No newline at end of file
diff --git a/website/templates/pages/login.html b/website/templates/pages/login.html
new file mode 100644
index 0000000..9bc3171
--- /dev/null
+++ b/website/templates/pages/login.html
@@ -0,0 +1,52 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/login.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/login.css" %}
+{% endblock %}
+
+{% block title %}
+ Login Page
+{% endblock %}
+
+{% block content %}
+ <div class="layout-wrapper layout-wrapper-appframe" id='login_wrapper'>
+ <div class="appframe-area"></div>
+ <div class="layout-main" style="padding: 15px;">
+ <form autocomplete="on">
+ <table border="0" cellspacing="8">
+ <tbody>
+ <tr>
+ <td>Login Id</td>
+ <td><input id="login_id" type="text" style="width: 180px"/></td>
+ </tr>
+ <tr>
+ <td>Password</td>
+ <td><input id="password" type="password" style="width: 180px" /></td>
+ </tr>
+ <tr>
+ <td style="text-align:right"><input id="remember_me" type="checkbox" /></td>
+ <td>Remember Me</td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td id="login_message"> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td>
+ <button type="submit" id="login_btn" class="btn btn-small btn-primary">Login</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+ <p style="margin-left: 72px;"><span class="link_type"
+ onclick="erpnext.login.show_forgot_password()">Forgot Password</span></p>
+ </div>
+ </div>
+
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/products.html b/website/templates/pages/products.html
new file mode 100644
index 0000000..aa23ea2
--- /dev/null
+++ b/website/templates/pages/products.html
@@ -0,0 +1,37 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/products.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/products.css" %}
+{% endblock %}
+
+{% block title %}
+ Products
+{% endblock %}
+
+{% block content %}
+ <div class="layout-wrapper layout-wrapper-background">
+ <div class="web-content" id="content-products">
+
+ <div class="layout-main-section">
+ <h1 class="products-category"></h1>
+ <div class="products-search" style="margin-bottom: 15px;">
+ <input name="products-search" />
+ <button class="btn" style="margin-left: 7px">Search</button>
+ </div>
+ <div id="products-list">
+ <!-- product list will be generated dynamically -->
+ </div>
+ </div>
+
+ <div class="layout-side-section">
+ <h3>Categories</h3>
+ <div class="more-categories"></div>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ </div>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/unsubscribed.html b/website/templates/pages/unsubscribed.html
new file mode 100644
index 0000000..3dc7df9
--- /dev/null
+++ b/website/templates/pages/unsubscribed.html
@@ -0,0 +1,11 @@
+{% extends "html/outer.html" %}
+
+{% block content %}
+<div class="content">
+ <div class="layout-wrapper layout-main">
+ <h3>Unsubscribed</h3>
+ <br>
+ <p><b>{{ webnotes.unsubscribed_email }}</b> has been unsubscribed.</p>
+ </div>
+</div>
+{% endblock %}
\ No newline at end of file