templates cleaner and generation for all pages

This commit is contained in:
Rushabh Mehta
2012-05-08 16:06:44 +05:30
parent 5ab8163140
commit a933b632ad
8 changed files with 22 additions and 7 deletions

View File

@@ -0,0 +1,9 @@
import webnotes
def execute():
from webnotes.model.doclist import DocList
import os
for name in webnotes.conn.sql("""select name from `tabWeb Page` where docstatus=0"""):
print name
DocList('Web Page', name[0]).save()

View File

@@ -332,5 +332,10 @@ patch_list = [
'patch_file': 'renamedt_in_custom_search_criteria', 'patch_file': 'renamedt_in_custom_search_criteria',
'description': 'raname dt in custom search criteria' 'description': 'raname dt in custom search criteria'
}, },
{
'patch_module': 'patches.may_2012',
'patch_file': 'cms',
'description': 'generate html pages'
},
] ]

View File

@@ -2,7 +2,7 @@
<div class="web-content" <div class="web-content"
style="text-align: {{ doc.text_align }};"> style="text-align: {{ doc.text_align }};">
{% if doc.layout.startswith('Two column') %} {% if doc.layout and doc.layout.startswith('Two column') %}
<div class="layout-main-section"> <div class="layout-main-section">
{% else %} {% else %}
<div class="layout-main"> <div class="layout-main">
@@ -14,7 +14,7 @@
</div> </div>
{% if doc.layout.startswith('Two column') %} {% if doc.layout and doc.layout.startswith('Two column') %}
<div class="layout-side-section"> <div class="layout-side-section">
{{ doc.side_section_html }} {{ doc.side_section_html }}
{% if doc.see_also %} {% if doc.see_also %}

View File

@@ -40,7 +40,8 @@ class DocType:
webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name) webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name)
p = website.utils.add_page(self.doc.name) p = website.utils.add_page(self.doc.name)
self.doc.page_name = p.name
self.doc.updated = global_date_format(self.doc.modified) self.doc.updated = global_date_format(self.doc.modified)
website.utils.markdown(self.doc, ['head_section','main_section', 'side_section']) website.utils.markdown(self.doc, ['head_section','main_section', 'side_section'])

View File

@@ -35,7 +35,7 @@ class DocType:
"""rewrite all web pages""" """rewrite all web pages"""
import webnotes import webnotes
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
for p in webnotes.conn.sql("""select name from tabPage where docstatus=0 for p in webnotes.conn.sql("""select name from tabPage where docstatus=0
and web_page = 'Yes'"""): and web_page = 'Yes'"""):
get_obj('Page', p[0]).write_cms_page() get_obj('Page', p[0]).write_cms_page()

View File

@@ -95,7 +95,7 @@ def get_header():
return Template("""<div class="navbar navbar-fixed-top"> return Template("""<div class="navbar navbar-fixed-top">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
<a class="brand">{{ brand }}</a> <a class="brand" href="index.html">{{ brand }}</a>
<ul class="nav"> <ul class="nav">
{% for page in top_bar_items %} {% for page in top_bar_items %}
{% if not page.parent_label %} {% if not page.parent_label %}

View File

@@ -1,4 +1,4 @@
window._version_number = "c1dee2b8be9abfbe2a74619482b586b538f7253911fcb06c4c950b10"; window._version_number = "2a070dfb16a80c744b13c7609859086ef91dfd755d70032ee00ee4f6";
window.home_page = "index"; window.home_page = "index";
// footer signup widget // footer signup widget
// automatically adds it to the .layout-main div of the page // automatically adds it to the .layout-main div of the page

View File

@@ -136,7 +136,7 @@ wn.show_forgot_password = function(){
<header><div class="navbar navbar-fixed-top"> <header><div class="navbar navbar-fixed-top">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
<a class="brand">erpnext</a> <a class="brand" href="index.html">erpnext</a>
<ul class="nav"> <ul class="nav">