added wesite slideshow and attributions on website

This commit is contained in:
Rushabh Mehta 2012-12-25 18:18:17 +05:30
parent f50c012808
commit 7edf899706
21 changed files with 383 additions and 96 deletions

View File

@ -1,6 +1,3 @@
.layout-attributions table {
width: 70%;
}
.layout-attributions td:first-child {
width: 30%;
}

View File

@ -6,12 +6,13 @@
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td><a href="https://github.com/webnotes/wnframework">wnframework</a></td>
<td>The full stack Python + Javascript web application framework on which ERPNext is built.</td>
<td><a href="https://github.com/webnotes/erpnext">ERPNext</a></td>
<td>Web based, Open Source ERP. <br>
Get top class hosting and support at <a href="https://erpnext.com">ERPNext.com</a></td>
</tr>
<tr>
<td><a href="https://github.com/webnotes/erpnext">ERPNext</a></td>
<td>Web based, Open Source ERP.</td>
<td><a href="https://github.com/webnotes/wnframework">wnframework</a></td>
<td>The full stack Python + Javascript web application framework on which ERPNext is built.</td>
</tr>
<tr>
<td><a href="http://en.wikipedia.org/wiki/Linux">Linux Operating System</a></td>
@ -93,7 +94,7 @@
<hr>
<h3>ERPNext License: GNU/General Public License</h3>
<div class="well" style="width: 65%;">
<div class="well">
<p><b>ERPNext - Open Source, web based ERP</b></p>
<p>Copyright &copy; 2012, Web Notes Technologies Pvt Ltd, India</p>

View File

@ -37,7 +37,10 @@ class DocType(DocTypeNestedSet):
page_name = "products"
update_page_name(self.doc, self.doc.name)
from website.helpers.product import invalidate_cache_for
invalidate_cache_for(self.doc.name)
def prepare_template_args(self):
from website.helpers.product import get_product_list_for_group, \
get_parent_item_groups, get_group_item_count
@ -51,4 +54,4 @@ class DocType(DocTypeNestedSet):
self.doc.items = get_product_list_for_group(product_group = self.doc.name, limit=20)
self.parent_groups = get_parent_item_groups(self.doc.name)

View File

@ -40,9 +40,8 @@ class DocType:
def on_update(self):
if self.doc.show_in_website:
# webpage updates
from website.utils import update_page_name
update_page_name(self.doc, self.doc.item_name)
self.update_website()
bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
if bin and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
msgprint("Please Update Stock UOM with the help of Stock UOM Replace Utility.")
@ -76,6 +75,16 @@ class DocType:
child.conversion_factor = 1
child.save()
def update_website(self):
from website.utils import update_page_name
update_page_name(self.doc, self.doc.item_name)
from website.helpers.product import invalidate_cache_for
invalidate_cache_for(self.doc.item_group)
[invalidate_cache_for(d.item_group) for d in \
self.doclist.get({"doctype":"Website Item Group"})]
# On delete 1. Delete BIN (if none of the corrosponding transactions present, it gets deleted. if present, rolled back due to exception)
def on_trash(self):
sql("""delete from tabBin where item_code=%s""", self.doc.item_code)

View File

@ -36,10 +36,6 @@ p, li {
padding: 8px;
}
footer {
}
.web-footer-menu {
margin-bottom: 7px;
}
@ -64,11 +60,6 @@ footer {
border-right: 0px solid #777 !important;
}
.web-footer-powered, .web-footer-powered a {
color: #888;
margin-top: 20px;
}
.two-column {
width: 50%;
float: left;

View File

@ -41,5 +41,10 @@ class DocType():
clear_cache('index')
def prepare_template_args(self):
self.doc.main_section_html = self.doc.main_section
self.doc.side_section_html = self.doc.side_section
if self.doc.slideshow:
slideshow = webnotes.model_wrapper("Website Slideshow", self.doc.slideshow)
self.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"})
self.doc.slideshow_header = slideshow.doc.header or ""
for s in self.slides:
if s.image and not s.image.lower().startswith("http"):
s.image = "files/" + s.image

View File

@ -2,9 +2,9 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-11-30 18:14:18",
"creation": "2012-12-07 15:15:17",
"modified_by": "Administrator",
"modified": "2012-12-06 15:59:02"
"modified": "2012-12-25 17:04:19"
},
{
"allow_attach": 1,
@ -26,9 +26,7 @@
"name": "__common__",
"parent": "Web Page",
"read": 1,
"submit": 0,
"doctype": "DocPerm",
"amend": 0,
"parenttype": "DocType",
"role": "Website Manager",
"parentfield": "permissions"
@ -37,16 +35,8 @@
"name": "Web Page",
"doctype": "DocType"
},
{
"doctype": "DocField",
"label": "Title and Style",
"fieldname": "sb0",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"description": "Title / headline of your page",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Title",
"fieldname": "title",
@ -54,15 +44,6 @@
"reqd": 1,
"permlevel": 0
},
{
"description": "Page url name (auto-generated) ",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Page Name",
"fieldname": "page_name",
"fieldtype": "Data",
"permlevel": 1
},
{
"doctype": "DocField",
"width": "50%",
@ -78,43 +59,40 @@
"permlevel": 0
},
{
"description": "Page url name (auto-generated) (add \".html\")",
"doctype": "DocField",
"label": "Layout",
"options": "Single column\nTwo column",
"fieldname": "layout",
"fieldtype": "Select",
"permlevel": 0
"label": "Page Name",
"fieldname": "page_name",
"fieldtype": "Data",
"permlevel": 1
},
{
"description": "Page content",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Content",
"fieldname": "sb1",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"description": "Begin this page with a slideshow of images",
"doctype": "DocField",
"label": "Slideshow",
"options": "Website Slideshow",
"fieldname": "slideshow",
"fieldtype": "Link",
"permlevel": 0
},
{
"description": "Content in markdown format that appears on the main side of your page",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Main Section",
"fieldname": "main_section",
"fieldtype": "Text Editor",
"permlevel": 0
},
{
"description": "Content in markdown format that appears on the right side",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Side Section",
"fieldname": "side_section",
"fieldtype": "Text Editor",
"permlevel": 0
},
{
"description": "Link to other pages in the side bar and next section",
"colour": "White:FFF",
"doctype": "DocField",
"label": "More",
"fieldname": "sb2",
@ -131,7 +109,6 @@
},
{
"description": "Add code as &lt;script&gt;",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Insert Code",
"fieldname": "insert_code",
@ -175,14 +152,10 @@
"create": 1,
"doctype": "DocPerm",
"write": 1,
"cancel": 1,
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"cancel": 0,
"permlevel": 1
}
]

View File

@ -4,7 +4,7 @@
"docstatus": 0,
"creation": "2012-07-12 23:29:36",
"modified_by": "Administrator",
"modified": "2012-12-20 14:28:46"
"modified": "2012-12-25 15:41:48"
},
{
"issingle": 1,
@ -104,10 +104,11 @@
"permlevel": 0
},
{
"description": "Address and other legal information you may want to put in the footer.",
"doctype": "DocField",
"label": "Address",
"fieldname": "address",
"fieldtype": "Text",
"fieldtype": "Text Editor",
"permlevel": 0
},
{

View File

@ -0,0 +1,9 @@
cur_frm.cscript.refresh = function(doc) {
cur_frm.set_intro("");
if(doc.__islocal) {
cur_frm.set_intro("First set the name and save the record.");
}
else {
cur_frm.set_intro("Attach files / urls and add in table.");
}
}

View File

@ -0,0 +1,8 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -0,0 +1,85 @@
[
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-12-25 16:47:53",
"modified_by": "Administrator",
"modified": "2012-12-25 16:56:34"
},
{
"autoname": "field:slideshow_name",
"allow_attach": 1,
"name": "__common__",
"doctype": "DocType",
"module": "Website",
"max_attachments": 10,
"document_type": "Transaction",
"description": "Slideshow like display for the website"
},
{
"name": "__common__",
"parent": "Website Slideshow",
"doctype": "DocField",
"parenttype": "DocType",
"permlevel": 0,
"parentfield": "fields"
},
{
"parent": "Website Slideshow",
"read": 1,
"cancel": 1,
"name": "__common__",
"create": 1,
"doctype": "DocPerm",
"write": 1,
"parenttype": "DocType",
"role": "Website Manager",
"permlevel": 0,
"parentfield": "permissions"
},
{
"name": "Website Slideshow",
"doctype": "DocType"
},
{
"read_only": 0,
"doctype": "DocField",
"label": "Slideshow Name",
"fieldname": "slideshow_name",
"fieldtype": "Data",
"reqd": 1
},
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"label": "Slideshow Items",
"fieldname": "sb0",
"fieldtype": "Section Break"
},
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"label": "Slideshow Items",
"fieldname": "slideshow_items",
"fieldtype": "Table",
"options": "Website Slideshow Item"
},
{
"description": "This goes above the slideshow.",
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"label": "Header",
"fieldname": "header",
"fieldtype": "Text Editor"
},
{
"doctype": "DocField",
"label": "File List",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1
},
{
"doctype": "DocPerm"
}
]

View File

@ -0,0 +1,8 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -0,0 +1,59 @@
[
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-12-25 16:48:49",
"modified_by": "Administrator",
"modified": "2012-12-25 16:55:40"
},
{
"istable": 1,
"allow_attach": 0,
"doctype": "DocType",
"module": "Website",
"max_attachments": 10,
"name": "__common__"
},
{
"name": "__common__",
"parent": "Website Slideshow Item",
"doctype": "DocField",
"parenttype": "DocType",
"permlevel": 0,
"parentfield": "fields"
},
{
"name": "Website Slideshow Item",
"doctype": "DocType"
},
{
"doctype": "DocField",
"label": "Image",
"fieldname": "image",
"fieldtype": "Select",
"options": "attach_files:"
},
{
"doctype": "DocField",
"label": "Heading",
"width": "200px",
"fieldname": "heading",
"fieldtype": "Data"
},
{
"doctype": "DocField",
"label": "Description",
"width": "200px",
"fieldname": "description",
"fieldtype": "Text"
},
{
"print_hide": 1,
"no_copy": 1,
"doctype": "DocField",
"label": "File List",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1
}
]

View File

@ -99,4 +99,9 @@ def get_parent_item_groups(item_group_name):
return webnotes.conn.sql("""select name, page_name from `tabItem Group`
where lft <= %s and rgt >= %s
and ifnull(show_in_website,0)=1
order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
def invalidate_cache_for(item_group):
from website.utils import delete_page_cache
for i in get_parent_item_groups(item_group):
delete_page_cache(i.page_name)

View File

@ -3,17 +3,20 @@
<div class="layout-main-section">
<div style="width: 48%; float: left;">
<h5><a href="#List/Web Page">Web Page</a></h5>
<p class="help">Static (content) web page</p>
<p class="help">Static (content) web page.</p>
<br>
<h5><a href="#List/Blog">Blog</a></h5>
<p class="help">Weblog (blog) entry</p>
<p class="help">Weblog (blog) entr.y</p>
<br>
<h5><a href="#List/Website Slideshow">Website Slideshow</a></h5>
<p class="help">Slideshows for adding in website pages.</p>
</div>
<div style="width: 48%; float: right;">
<h5><a href="#Form/Website Settings">Website Settings</a></h5>
<p class="help">Setup of top navigation bar, footer and logo</p>
<p class="help">Setup of top navigation bar, footer and logo.</p>
<br>
<h5><a href="#Form/Style Settings">Style Settings</a></h5>
<p class="help">Setup of fonts and background</p>
<p class="help">Setup of fonts and background.</p>
<br>
<h5><a href="#Form/Product Settings">Product Settings</a></h5>
<p class="help">Settings for Product Catalog on the website.</p>

View File

@ -1,5 +1,5 @@
{#
requires, brand, top_bar_items, footer_items, copyright, content
requires, brand_html, top_bar_items, footer_items, copyright, content, address
#}
{% extends "html/base.html" %}
@ -13,7 +13,7 @@
style="margin-bottom: 0px;">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="index.html">{{ brand }}</a>
<a class="brand" href="index.html">{{ brand_html }}</a>
<ul class="nav">
{% for page in top_bar_items %}
{% if not page.parent_label %}
@ -77,7 +77,10 @@
{% if copyright %}
<div class="web-footer-copyright">&copy; {{ copyright }}</div>
{% endif %}
<div class="web-footer-powered">Powered by <a href="https://erpnext.com">ERPNext.com</a></div>
{% if address %}
{{ address }}
{% endif %}
<p><a style="font-size: 90%;" href="attributions.html">ERPNext Powered</a></p>
</div>
</footer>

View File

@ -9,21 +9,30 @@
{% 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 }}
{% if slideshow %}
{{ slideshow_header }}
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
{% for slide in obj.slides %}
<div class="{% if slide.idx==1 %}active {% endif %}item">
<img src="{{ slide.image }}" />
<div class="carousel-caption">
<h4>{{ slide.heading }}</h4>
<p>{{ slide.description }}</p>
</div>
</div>
{% endfor %}
</div>
<a class="carousel-control left" href="#myCarousel"
data-slide="prev">&lsaquo;</a>
<a class="carousel-control right" href="#myCarousel"
data-slide="next">&rsaquo;</a>
</div>
<script>$(".carousel").carousel();</script>
{% endif %}
{{ main_section }}
</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 %}

View File

@ -0,0 +1,112 @@
{% extends "html/outer.html" %}
{% block header %}
<style>
.layout-attributions td:first-child {
width: 30%;
}
</style>
{% endblock %}
{% block title %}
ERPNext - Web Based, Open Source ERP
{% endblock %}
{% block content %}
<div class="layout-attributions">
<div class="layout-main">
<h3>This website is made using these Awesome Open Source Projects <i class="icon-heart" style="color: red"></i></h3>
<hr>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td><a href="https://github.com/webnotes/erpnext">ERPNext</a></td>
<td>Web based, Open Source ERP. <br>
Get top class hosting and support at <a href="https://erpnext.com">ERPNext.com</a></td>
</tr>
<tr>
<td><a href="https://github.com/webnotes/wnframework">wnframework</a></td>
<td>The full stack Python + Javascript web application framework on which ERPNext is built.</td>
</tr>
<tr>
<td><a href="http://en.wikipedia.org/wiki/Linux">Linux Operating System</a></td>
<td>The operating system that brought a revolution in Open Source software.</td>
</tr>
<tr>
<td><a href="http://www.mysql.com/">MySQL Database</a></td>
<td>The world's most popular Open Source Database.</td>
</tr>
<tr>
<td><a href="http://httpd.apache.org">Apache HTTPD web server</a></td>
<td>The Number One HTTP Server On The Internet.</td>
</tr>
<tr>
<td><a href="http://python.org/">Python Programming Language</a></td>
<td>The "batteries included" language that lets you write elegant code, quickly.<br><br>Python Libraries:
<ul>
<li>MySQLdb
<li>pytz
<li>jinja2
<li>markdown2
<li>dateutil
<li>termcolor
<li>python-memcached
</ul>
</td>
</tr>
<tr>
<td><a href="http://git-scm.com/">Git - Source Code Management</a></td>
<td>Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.<br><br>
Kindly hosted on the web by <a href="https://github.com">GitHub</a>: The service that makes it easier for individuals and teams to write better code, faster. </td>
</tr>
<tr>
<td><a href="http://jquery.com/">JQuery Javascript Libary</a></td>
<td>The write less, do more Javascript Library.</td>
</tr>
<tr>
<td><a href="http://jqueryui.com/">JQuery UI - User Interface Library</a></td>
<td>A curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.</td>
</tr>
<tr>
<td><a href="http://twitter.github.com/bootstrap/index.html">Bootstrap CSS Framework</a></td>
<td>Sleek, intuitive, and powerful front-end framework for faster and easier web development.</td>
</tr>
<tr>
<td><a href="http://fortawesome.github.com/Font-Awesome/">Font Awesome - Icons</a></td>
<td>The iconic font designed for use with Twitter Bootstrap.</td>
</tr>
<tr>
<td><a href="http://www.tinymce.com/">TinyMCE Rich Text Editor</a></td>
<td>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB.</td>
</tr>
<tr>
<td><a href="https://github.com/mleibman/SlickGrid">SlickGrid</a></td>
<td>A lightning fast JavaScript grid/spreadsheet.</td>
</tr>
<tr>
<td><a href="http://www.flotcharts.org/">Flot Charting Library</a></td>
<td>Attractive JavaScript plotting for jQuery.</td>
</tr>
<tr>
<td><a href="http://ace.ajax.org/">Ace Code Editor</a></td>
<td>High Performance Code Editor for the web.</td>
</tr>
<tr>
<td><a href="http://taitems.github.com/jQuery.Gantt/">JQuery.Gantt - Gantt Charts</a></td>
<td>Draw Gantt charts with the famous jQuery ease of development.</td>
</tr>
<tr>
<td><a href="http://jscolor.com/">JSColor - Color Picker</a></td>
<td>HTML/Javascript Color Picker.</td>
</tr>
<tr>
<td><a href="https://github.com/dcneiner/Downloadify">Downloadify - Flash Download Widget</a></td>
<td>A tiny javascript + Flash library that enables the creation and download of text files without server interaction.</td>
</tr>
</tbody>
</table>
<p class="alert">Note: A link to this page must be easily accessible.</p>
</div>
</div>
{% endblock %}

View File

@ -73,7 +73,7 @@ def get_html(page_name):
html = get_html("404")
if page_name=="error":
html = html % {"error": webnotes.getTraceback()}
html = html.replace("%(error)s", webnotes.getTraceback())
else:
comments = "\n\npage:"+page_name+\
"\nload status: " + (from_cache and "cache" or "fresh")
@ -215,18 +215,24 @@ def get_outer_env():
products_item = filter(lambda d: d.url and d.url.split(".")[0]=="products", top_items)[0]
products_item.child_items = products
return {
ret = webnotes._dict({
'top_bar_items': top_items,
'footer_items': webnotes.conn.sql("""\
select * from `tabTop Bar Item`
where parent='Website Settings' and parentfield='footer_items'
order by idx asc""", as_dict=1),
'brand': webnotes.conn.get_value('Website Settings', None, 'brand_html') or 'ERPNext',
'copyright': webnotes.conn.get_value('Website Settings', None, 'copyright'),
'favicon': webnotes.conn.get_value('Website Settings', None, 'favicon'),
'int':int
}
})
settings = webnotes.doc("Website Settings", "Website Settings")
for k in ["brand_html", "copyright", "address"]:
if k in settings.fields:
ret[k] = settings.fields[k]
if not ret.brand_html:
ret.brand_html = "ERPNext"
return ret
def get_home_page():
doc_name = webnotes.conn.get_value('Website Settings', None, 'home_page')