mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
added website settings, refactored home
This commit is contained in:
@@ -11,8 +11,8 @@ def execute():
|
|||||||
from webnotes.modules import reload_doc
|
from webnotes.modules import reload_doc
|
||||||
reload_doc('website', 'Role', 'Website Manager')
|
reload_doc('website', 'Role', 'Website Manager')
|
||||||
reload_doc('website', 'Module Def', 'Website')
|
reload_doc('website', 'Module Def', 'Website')
|
||||||
reload_doc('website', 'doctype', 'home_settings')
|
reload_doc('website', 'doctype', 'website_settings')
|
||||||
reload_doc('website', 'doctype', 'top_bar_settings')
|
reload_doc('website', 'doctype', 'style_settings')
|
||||||
reload_doc('website', 'doctype', 'top_bar_item')
|
reload_doc('website', 'doctype', 'top_bar_item')
|
||||||
reload_doc('website', 'doctype', 'contact_us_settings')
|
reload_doc('website', 'doctype', 'contact_us_settings')
|
||||||
reload_doc('website', 'doctype', 'about_us_settings')
|
reload_doc('website', 'doctype', 'about_us_settings')
|
||||||
@@ -22,7 +22,6 @@ def execute():
|
|||||||
reload_doc('website', 'doctype', 'product')
|
reload_doc('website', 'doctype', 'product')
|
||||||
reload_doc('website', 'doctype', 'web_page')
|
reload_doc('website', 'doctype', 'web_page')
|
||||||
|
|
||||||
reload_doc('website', 'page', 'home')
|
|
||||||
reload_doc('website', 'page', 'contact')
|
reload_doc('website', 'page', 'contact')
|
||||||
reload_doc('website', 'page', 'about')
|
reload_doc('website', 'page', 'about')
|
||||||
reload_doc('website', 'page', 'blog')
|
reload_doc('website', 'page', 'blog')
|
||||||
|
|||||||
@@ -40,10 +40,11 @@ def boot_session(bootinfo):
|
|||||||
import webnotes.model.doc
|
import webnotes.model.doc
|
||||||
|
|
||||||
if webnotes.session['user']=='Guest':
|
if webnotes.session['user']=='Guest':
|
||||||
bootinfo['topbar'] = webnotes.model.doc.getsingle('Top Bar Settings')
|
bootinfo['website_settings'] = webnotes.model.doc.getsingle('Website Settings')
|
||||||
bootinfo['topbaritems'] = webnotes.conn.sql("""select label, std_page, custom_page,
|
bootinfo['website_menus'] = webnotes.conn.sql("""select label, std_page, custom_page,
|
||||||
parent_label, parentfield
|
parent_label, parentfield
|
||||||
from `tabTop Bar Item` where parent='Top Bar Settings' order by idx asc""", as_dict=1)
|
from `tabTop Bar Item` where parent='Website Settings' order by idx asc""", as_dict=1)
|
||||||
|
bootinfo['custom_css'] = webnotes.conn.get_value('Style Settings', None, 'custom_css') or ''
|
||||||
else:
|
else:
|
||||||
bootinfo['letter_heads'] = get_letter_heads()
|
bootinfo['letter_heads'] = get_letter_heads()
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ pscript.select_sidebar_menu = function(t, dt, dn) {
|
|||||||
var body_background = '#e2e2e2';
|
var body_background = '#e2e2e2';
|
||||||
|
|
||||||
MenuPointer = function(parent, label) {
|
MenuPointer = function(parent, label) {
|
||||||
|
var me = this;
|
||||||
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
|
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
|
||||||
$br(this.wrapper, '3px');
|
$br(this.wrapper, '3px');
|
||||||
|
|
||||||
@@ -73,8 +73,10 @@ MenuPointer = function(parent, label) {
|
|||||||
|
|
||||||
$(this.wrapper)
|
$(this.wrapper)
|
||||||
.hover(
|
.hover(
|
||||||
function() { if(!this.selected)$bg(this, '#eee'); } ,
|
function() { if(!me.selected)
|
||||||
function() { if(!this.selected)$bg(this, body_background); }
|
$bg(this, '#eee'); } ,
|
||||||
|
function() { if(!me.selected)
|
||||||
|
$bg(this, body_background); }
|
||||||
)
|
)
|
||||||
|
|
||||||
$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
|
$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
|
||||||
@@ -84,9 +86,10 @@ MenuPointer = function(parent, label) {
|
|||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
|
||||||
MenuPointer.prototype.select = function(grey) {
|
MenuPointer.prototype.select = function(grey) {
|
||||||
$y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'});
|
$y($td(this.tab, 0, 0), {
|
||||||
//$gr(this.wrapper, '#F84', '#F63');
|
color:'#fff', borderBottom:'0px solid #000'
|
||||||
$gr(this.wrapper, '#888', '#666');
|
});
|
||||||
|
$(this.wrapper).css('background-color', '#999');
|
||||||
this.selected = 1;
|
this.selected = 1;
|
||||||
|
|
||||||
if(cur_menu_pointer && cur_menu_pointer != this)
|
if(cur_menu_pointer && cur_menu_pointer != this)
|
||||||
@@ -99,7 +102,7 @@ MenuPointer.prototype.select = function(grey) {
|
|||||||
|
|
||||||
MenuPointer.prototype.deselect = function() {
|
MenuPointer.prototype.deselect = function() {
|
||||||
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
|
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
|
||||||
$gr(this.wrapper, body_background, body_background);
|
$(this.wrapper).css('background-color', body_background);
|
||||||
this.selected = 0;
|
this.selected = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
h1, h2, h3, h4 {
|
h1, h2, h3, h4, h5 {
|
||||||
font-family: Tahoma, Arial, Verdana, sans-serif;
|
font-family: Tahoma, Arial, Verdana, sans-serif;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
body, span, div, td, input, textarea, button, select {
|
body {
|
||||||
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span, div, td, input, textarea, button, select {
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #e2e2e2;
|
background-color: #e2e2e2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ erpnext.startup.start = function() {
|
|||||||
$dh(page_body.left_sidebar);
|
$dh(page_body.left_sidebar);
|
||||||
wn.require('erpnext/website/css/website.css');
|
wn.require('erpnext/website/css/website.css');
|
||||||
wn.require('erpnext/website/js/topbar.js');
|
wn.require('erpnext/website/js/topbar.js');
|
||||||
|
if(wn.boot.custom_css) {
|
||||||
|
set_style(wn.boot.custom_css);
|
||||||
|
}
|
||||||
|
if(wn.boot.website_settings.title_prefix) {
|
||||||
|
wn.title_prefix = wn.boot.website_settings.title_prefix;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// modules
|
// modules
|
||||||
wn.require('erpnext/startup/modules.js');
|
wn.require('erpnext/startup/modules.js');
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{
|
{
|
||||||
'creation': '2012-01-23 17:05:32',
|
'creation': '2012-01-23 17:05:32',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-01-31 15:19:28',
|
'modified': '2012-02-02 13:23:41',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'Administrator'
|
'owner': 'Administrator'
|
||||||
},
|
},
|
||||||
@@ -44,14 +44,6 @@
|
|||||||
'name': 'Website'
|
'name': 'Website'
|
||||||
},
|
},
|
||||||
|
|
||||||
# Module Def Item
|
|
||||||
{
|
|
||||||
'display_name': 'Top Bar Settings',
|
|
||||||
'doc_name': 'Top Bar Settings',
|
|
||||||
'doc_type': 'Single DocType',
|
|
||||||
'doctype': 'Module Def Item'
|
|
||||||
},
|
|
||||||
|
|
||||||
# Module Def Item
|
# Module Def Item
|
||||||
{
|
{
|
||||||
'display_name': 'Web Page',
|
'display_name': 'Web Page',
|
||||||
@@ -76,6 +68,22 @@
|
|||||||
'doctype': 'Module Def Item'
|
'doctype': 'Module Def Item'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# Module Def Item
|
||||||
|
{
|
||||||
|
'display_name': 'Style Settings',
|
||||||
|
'doc_name': 'Style Settings',
|
||||||
|
'doc_type': 'Single DocType',
|
||||||
|
'doctype': 'Module Def Item'
|
||||||
|
},
|
||||||
|
|
||||||
|
# Module Def Item
|
||||||
|
{
|
||||||
|
'display_name': 'Website Settings',
|
||||||
|
'doc_name': 'Website Settings',
|
||||||
|
'doc_type': 'Single DocType',
|
||||||
|
'doctype': 'Module Def Item'
|
||||||
|
},
|
||||||
|
|
||||||
# Module Def Item
|
# Module Def Item
|
||||||
{
|
{
|
||||||
'display_name': 'Home Settings',
|
'display_name': 'Home Settings',
|
||||||
@@ -100,14 +108,6 @@
|
|||||||
'doctype': 'Module Def Item'
|
'doctype': 'Module Def Item'
|
||||||
},
|
},
|
||||||
|
|
||||||
# Module Def Item
|
|
||||||
{
|
|
||||||
'display_name': 'About Us Settings',
|
|
||||||
'doc_name': 'About Us Settings',
|
|
||||||
'doc_type': 'Single DocType',
|
|
||||||
'doctype': 'Module Def Item'
|
|
||||||
},
|
|
||||||
|
|
||||||
# Module Def Item
|
# Module Def Item
|
||||||
{
|
{
|
||||||
'display_name': 'Products Settings',
|
'display_name': 'Products Settings',
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
width: 900px;
|
width: 900px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
@@ -16,8 +20,7 @@ header .topbar .container {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.web-home-banner {
|
.web-head-section {
|
||||||
width: 860px;
|
|
||||||
margin-bottom: 20px
|
margin-bottom: 20px
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,9 +43,13 @@ header .topbar .container {
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.web-footer {
|
footer {
|
||||||
text-align: center;
|
|
||||||
color: #777;
|
color: #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.web-footer {
|
||||||
|
color: inherit;
|
||||||
|
text-align: center;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
}
|
}
|
||||||
@@ -54,11 +61,11 @@ header .topbar .container {
|
|||||||
.web-footer-menu {
|
.web-footer-menu {
|
||||||
margin-bottom: 7px;
|
margin-bottom: 7px;
|
||||||
}
|
}
|
||||||
.web-footer a, .web-footer a:visited {
|
footer a, footer a:visited {
|
||||||
color: #777;
|
color: #777;
|
||||||
}
|
}
|
||||||
|
|
||||||
.web-footer a:hover {
|
footer a:hover {
|
||||||
background-color: #777;
|
background-color: #777;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
@@ -75,5 +82,5 @@ header .topbar .container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.web-footer-menu ul li:last-child {
|
.web-footer-menu ul li:last-child {
|
||||||
border-right: 0px solid #777;
|
border-right: 0px solid #777 !important;
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<div class="layout_wrapper">
|
<div class="layout_wrapper">
|
||||||
<div class="web-content" id="blog-{{ doc.name }}">
|
<div class="web-content" id="blog-{{ doc.name }}">
|
||||||
<h1>Blog</h1>
|
<h1>Blog</h1>
|
||||||
<br>
|
|
||||||
<div class="web-main-section">
|
<div class="web-main-section">
|
||||||
<h2>{{ doc.title }}</h2>
|
<h2>{{ doc.title }}</h2>
|
||||||
|
<br>
|
||||||
{{ doc.content_html }}
|
{{ doc.content_html }}
|
||||||
</div>
|
</div>
|
||||||
<div class="web-side-section">
|
<div class="web-side-section">
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
"""
|
|
||||||
generate html
|
|
||||||
"""
|
|
||||||
import webnotes
|
|
||||||
|
|
||||||
class DocType:
|
|
||||||
def __init__(self, d, dl):
|
|
||||||
self.doc, self.doclist = d, dl
|
|
||||||
|
|
||||||
def on_update(self):
|
|
||||||
"""make home html"""
|
|
||||||
from website.utils import make_template
|
|
||||||
import os
|
|
||||||
path = os.path.join(os.path.dirname(__file__), 'template.html')
|
|
||||||
|
|
||||||
webnotes.conn.set_value('Page', 'home', 'content', make_template(self.doc, path))
|
|
||||||
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
# DocType, Home Settings
|
|
||||||
[
|
|
||||||
|
|
||||||
# These values are common in all dictionaries
|
|
||||||
{
|
|
||||||
'creation': '2012-01-24 15:56:06',
|
|
||||||
'docstatus': 0,
|
|
||||||
'modified': '2012-01-25 13:31:56',
|
|
||||||
'modified_by': 'Administrator',
|
|
||||||
'owner': 'Administrator'
|
|
||||||
},
|
|
||||||
|
|
||||||
# These values are common for all DocType
|
|
||||||
{
|
|
||||||
'_last_update': '1327476129',
|
|
||||||
'allow_attach': 1,
|
|
||||||
'colour': 'White:FFF',
|
|
||||||
'doctype': 'DocType',
|
|
||||||
'issingle': 1,
|
|
||||||
'max_attachments': 5,
|
|
||||||
'module': 'Website',
|
|
||||||
'name': '__common__',
|
|
||||||
'section_style': 'Simple',
|
|
||||||
'show_in_menu': 0,
|
|
||||||
'version': 4
|
|
||||||
},
|
|
||||||
|
|
||||||
# These values are common for all DocField
|
|
||||||
{
|
|
||||||
'doctype': 'DocField',
|
|
||||||
'name': '__common__',
|
|
||||||
'parent': 'Home Settings',
|
|
||||||
'parentfield': 'fields',
|
|
||||||
'parenttype': 'DocType',
|
|
||||||
'permlevel': 0
|
|
||||||
},
|
|
||||||
|
|
||||||
# These values are common for all DocPerm
|
|
||||||
{
|
|
||||||
'create': 1,
|
|
||||||
'doctype': 'DocPerm',
|
|
||||||
'name': '__common__',
|
|
||||||
'parent': 'Home Settings',
|
|
||||||
'parentfield': 'permissions',
|
|
||||||
'parenttype': 'DocType',
|
|
||||||
'permlevel': 0,
|
|
||||||
'read': 1,
|
|
||||||
'write': 1
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocType, Home Settings
|
|
||||||
{
|
|
||||||
'doctype': 'DocType',
|
|
||||||
'name': 'Home Settings'
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocPerm
|
|
||||||
{
|
|
||||||
'doctype': 'DocPerm',
|
|
||||||
'role': 'System Manager'
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocPerm
|
|
||||||
{
|
|
||||||
'doctype': 'DocPerm',
|
|
||||||
'role': 'Website Manager'
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'colour': 'White:FFF',
|
|
||||||
'description': 'HTML that will appear on the top part of the home page. For no headline, leave blank',
|
|
||||||
'doctype': 'DocField',
|
|
||||||
'fieldname': 'headline',
|
|
||||||
'fieldtype': 'Text',
|
|
||||||
'label': 'Headline'
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'doctype': 'DocField',
|
|
||||||
'fieldname': 'banner',
|
|
||||||
'fieldtype': 'Select',
|
|
||||||
'label': 'Banner',
|
|
||||||
'options': 'attach_files:'
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'colour': 'White:FFF',
|
|
||||||
'description': 'For formatting, use \n<a href="http://warpedvisions.org/projects/markdown-cheat-sheet/" \ntarget = "_blank">markdown</a>',
|
|
||||||
'doctype': 'DocField',
|
|
||||||
'fieldname': 'main_section',
|
|
||||||
'fieldtype': 'Code',
|
|
||||||
'label': 'Main Section'
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'colour': 'White:FFF',
|
|
||||||
'description': 'For formatting, use \n<a href="http://warpedvisions.org/projects/markdown-cheat-sheet/" \ntarget = "_blank">markdown</a>',
|
|
||||||
'doctype': 'DocField',
|
|
||||||
'fieldname': 'side_section',
|
|
||||||
'fieldtype': 'Code',
|
|
||||||
'label': 'Side Section'
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'doctype': 'DocField',
|
|
||||||
'fieldname': 'file_list',
|
|
||||||
'fieldtype': 'Text',
|
|
||||||
'hidden': 1,
|
|
||||||
'label': 'File List',
|
|
||||||
'no_copy': 1,
|
|
||||||
'print_hide': 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<div class="layout_wrapper">
|
|
||||||
<div class="web-content" id="content-home">
|
|
||||||
{% if doc.headline %}
|
|
||||||
<h1>{{ doc.headline }}</h1>
|
|
||||||
{% endif %}
|
|
||||||
{% if doc.banner %}
|
|
||||||
<img src="files/{{ doc.banner }}" class="web-home-banner" />
|
|
||||||
{% endif %}
|
|
||||||
<div class="web-main-section">
|
|
||||||
{{ doc.main_section_html }}
|
|
||||||
</div>
|
|
||||||
<div class="web-side-section">
|
|
||||||
{{ doc.side_section_html }}
|
|
||||||
</div>
|
|
||||||
<div style="clear: both"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
31
erpnext/website/doctype/style_settings/custom_template.css
Normal file
31
erpnext/website/doctype/style_settings/custom_template.css
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
body {
|
||||||
|
{% if doc.background_image %}
|
||||||
|
background: url("files/{{ doc.background_image }}") repeat !important;
|
||||||
|
{% elif doc.background_color %}
|
||||||
|
background-color: #{{ doc.background_color }};
|
||||||
|
{% endif %}
|
||||||
|
{% if doc.font %}
|
||||||
|
font-family: {{ doc.font }} !important;
|
||||||
|
{% endif %}
|
||||||
|
{% if doc.font_size %}
|
||||||
|
font-size: {{ doc.font_size }} !important;
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
|
||||||
|
{% if doc.footer_font_color %}
|
||||||
|
footer {
|
||||||
|
color: {{ doc.footer_font_color }};
|
||||||
|
}
|
||||||
|
footer a, footer a:visited, footer a:hover {
|
||||||
|
color: {{ doc.footer_font_color }};
|
||||||
|
}
|
||||||
|
.web-footer-menu ul li {
|
||||||
|
border-right: 1px solid {{ doc.footer_font_color }};
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if doc.heading_font %}
|
||||||
|
h1, h2, h3, h4, h5 {
|
||||||
|
font-family: {{ doc.heading_font}} !important;
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
6
erpnext/website/doctype/style_settings/style_settings.js
Normal file
6
erpnext/website/doctype/style_settings/style_settings.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
wn.require('lib/js/lib/jscolor/jscolor.js');
|
||||||
|
|
||||||
|
cur_frm.cscript.onload_post_render = function() {
|
||||||
|
cur_frm.fields_dict.background_color.input.className = 'color';
|
||||||
|
jscolor.bind();
|
||||||
|
}
|
||||||
17
erpnext/website/doctype/style_settings/style_settings.py
Normal file
17
erpnext/website/doctype/style_settings/style_settings.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
class DocType:
|
||||||
|
def __init__(self, d, dl):
|
||||||
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
"""make custom css"""
|
||||||
|
from jinja2 import Template
|
||||||
|
|
||||||
|
with open('erpnext/website/doctype/style_settings/custom_template.css', 'r') as f:
|
||||||
|
temp = Template(f.read())
|
||||||
|
|
||||||
|
self.doc.custom_css = temp.render(doc = self.doc)
|
||||||
|
|
||||||
|
from webnotes.session_cache import clear_cache
|
||||||
|
clear_cache('Guest')
|
||||||
|
|
||||||
|
|
||||||
156
erpnext/website/doctype/style_settings/style_settings.txt
Normal file
156
erpnext/website/doctype/style_settings/style_settings.txt
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
# DocType, Style Settings
|
||||||
|
[
|
||||||
|
|
||||||
|
# These values are common in all dictionaries
|
||||||
|
{
|
||||||
|
'creation': '2012-02-02 09:57:25',
|
||||||
|
'docstatus': 0,
|
||||||
|
'modified': '2012-02-02 10:47:38',
|
||||||
|
'modified_by': 'Administrator',
|
||||||
|
'owner': 'Administrator'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocType
|
||||||
|
{
|
||||||
|
'_last_update': '1328159294',
|
||||||
|
'allow_attach': 1,
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'Set your background color, font and image (tiled)',
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'issingle': 1,
|
||||||
|
'max_attachments': 1,
|
||||||
|
'module': 'Website',
|
||||||
|
'name': '__common__',
|
||||||
|
'section_style': 'Simple',
|
||||||
|
'show_in_menu': 0,
|
||||||
|
'version': 9
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'name': '__common__',
|
||||||
|
'parent': 'Style Settings',
|
||||||
|
'parentfield': 'fields',
|
||||||
|
'parenttype': 'DocType'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocPerm
|
||||||
|
{
|
||||||
|
'doctype': 'DocPerm',
|
||||||
|
'name': '__common__',
|
||||||
|
'parent': 'Style Settings',
|
||||||
|
'parentfield': 'permissions',
|
||||||
|
'parenttype': 'DocType',
|
||||||
|
'read': 1,
|
||||||
|
'role': 'Website Manager'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocType, Style Settings
|
||||||
|
{
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'name': 'Style Settings'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'create': 1,
|
||||||
|
'doctype': 'DocPerm',
|
||||||
|
'permlevel': 0,
|
||||||
|
'write': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'doctype': 'DocPerm',
|
||||||
|
'permlevel': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'Solid background color (default light gray)',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'background_color',
|
||||||
|
'fieldtype': 'Data',
|
||||||
|
'label': 'Background Color',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'If image is selected, color will be ignored (attach first)',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'background_image',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Background Image',
|
||||||
|
'options': 'attach_files:',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'font',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Font',
|
||||||
|
'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'font_size',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Font Size',
|
||||||
|
'options': '\n12px\n13px\n14px',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'heading_font',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Heaing Font',
|
||||||
|
'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'Select a white footer foreground color if you have a dark background',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'footer_font_color',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Footer Font Color',
|
||||||
|
'options': '\nwhite',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'Auto generated',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'custom_css',
|
||||||
|
'fieldtype': 'Code',
|
||||||
|
'label': 'Custom CSS',
|
||||||
|
'permlevel': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'file_list',
|
||||||
|
'fieldtype': 'Text',
|
||||||
|
'hidden': 1,
|
||||||
|
'label': 'File List',
|
||||||
|
'no_copy': 1,
|
||||||
|
'permlevel': 0,
|
||||||
|
'print_hide': 1
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
<div class="layout_wrapper">
|
<div class="layout_wrapper">
|
||||||
<div class="web-content" id="content-{{ doc.name }}">
|
<div class="web-content" id="content-{{ doc.name }}">
|
||||||
<h1>{{ doc.title }}</h1>
|
{% if doc.head_section %}
|
||||||
<br>
|
<div class="web-head-section">
|
||||||
|
{{ doc.head_section_html }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="web-main-section">
|
<div class="web-main-section">
|
||||||
{{ doc.main_section_html }}
|
{{ doc.main_section_html }}
|
||||||
{% if doc.next_page_html %}
|
{% if doc.next_page_html %}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class DocType:
|
|||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
import os
|
import os
|
||||||
|
|
||||||
website.utils.markdown(self.doc, ['main_section', 'side_section'])
|
website.utils.markdown(self.doc, ['head_section','main_section', 'side_section'])
|
||||||
|
|
||||||
self.add_page_links()
|
self.add_page_links()
|
||||||
|
|
||||||
@@ -44,7 +44,8 @@ class DocType:
|
|||||||
|
|
||||||
def cleanup_temp(self):
|
def cleanup_temp(self):
|
||||||
"""cleanup temp fields"""
|
"""cleanup temp fields"""
|
||||||
fl = ['main_section_html', 'side_section_html', 'see_also', 'next_page_html']
|
fl = ['main_section_html', 'side_section_html', 'see_also', \
|
||||||
|
'next_page_html', 'head_section_html']
|
||||||
for f in fl:
|
for f in fl:
|
||||||
if f in self.doc.fields:
|
if f in self.doc.fields:
|
||||||
del self.doc.fields[f]
|
del self.doc.fields[f]
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
{
|
{
|
||||||
'creation': '2012-01-31 15:18:49',
|
'creation': '2012-01-31 15:18:49',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-02-01 16:19:39',
|
'modified': '2012-02-02 13:15:36',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'Administrator'
|
'owner': 'Administrator'
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocType
|
# These values are common for all DocType
|
||||||
{
|
{
|
||||||
'_last_update': '1328093309',
|
'_last_update': '1328093379',
|
||||||
'allow_attach': 1,
|
'allow_attach': 1,
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
'description': 'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms, Help etc.\n\n',
|
'description': 'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms, Help etc.\n\n',
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'section_style': 'Simple',
|
'section_style': 'Simple',
|
||||||
'show_in_menu': 0,
|
'show_in_menu': 0,
|
||||||
'version': 5
|
'version': 6
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
# These values are common for all DocField
|
||||||
@@ -77,6 +77,16 @@
|
|||||||
'reqd': 1
|
'reqd': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'Section that will span 2 columns, formatted as markdown. If no head, leave blank. If you are displaying a banner, it must be 860px',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'head_section',
|
||||||
|
'fieldtype': 'Text',
|
||||||
|
'label': 'Head Section'
|
||||||
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
|
|||||||
20
erpnext/website/doctype/website_settings/website_settings.py
Normal file
20
erpnext/website/doctype/website_settings/website_settings.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
class DocType:
|
||||||
|
def __init__(self, d, dl):
|
||||||
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
"""clear cache"""
|
||||||
|
# set home page
|
||||||
|
import webnotes
|
||||||
|
from webnotes.model.doc import Document
|
||||||
|
|
||||||
|
webnotes.conn.sql("""delete from `tabDefault Home Page` where role='Guest'""")
|
||||||
|
|
||||||
|
d = Document('Default Home Page')
|
||||||
|
d.parent = 'Control Panel'
|
||||||
|
d.role = 'Guest'
|
||||||
|
d.home_page = self.doc.home_page
|
||||||
|
d.save()
|
||||||
|
|
||||||
|
from webnotes.session_cache import clear_cache
|
||||||
|
clear_cache('Guest')
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
# DocType, Top Bar Settings
|
# DocType, Website Settings
|
||||||
[
|
[
|
||||||
|
|
||||||
# These values are common in all dictionaries
|
# These values are common in all dictionaries
|
||||||
{
|
{
|
||||||
'creation': '2012-01-24 10:21:41',
|
'creation': '2012-02-02 13:19:50',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-01-31 15:55:34',
|
'modified': '2012-02-02 13:31:24',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'Administrator'
|
'owner': 'Administrator'
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocType
|
# These values are common for all DocType
|
||||||
{
|
{
|
||||||
'_last_update': '1327382102',
|
'_last_update': '1328169455',
|
||||||
'allow_attach': 1,
|
'allow_attach': 1,
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
'doctype': 'DocType',
|
'doctype': 'DocType',
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'section_style': 'Simple',
|
'section_style': 'Simple',
|
||||||
'show_in_menu': 0,
|
'show_in_menu': 0,
|
||||||
'version': 4
|
'version': 3
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
# These values are common for all DocField
|
||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'parent': 'Top Bar Settings',
|
'parent': 'Website Settings',
|
||||||
'parentfield': 'fields',
|
'parentfield': 'fields',
|
||||||
'parenttype': 'DocType',
|
'parenttype': 'DocType',
|
||||||
'permlevel': 0
|
'permlevel': 0
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
'create': 1,
|
'create': 1,
|
||||||
'doctype': 'DocPerm',
|
'doctype': 'DocPerm',
|
||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'parent': 'Top Bar Settings',
|
'parent': 'Website Settings',
|
||||||
'parentfield': 'permissions',
|
'parentfield': 'permissions',
|
||||||
'parenttype': 'DocType',
|
'parenttype': 'DocType',
|
||||||
'permlevel': 0,
|
'permlevel': 0,
|
||||||
@@ -49,10 +49,10 @@
|
|||||||
'write': 1
|
'write': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocType, Top Bar Settings
|
# DocType, Website Settings
|
||||||
{
|
{
|
||||||
'doctype': 'DocType',
|
'doctype': 'DocType',
|
||||||
'name': 'Top Bar Settings'
|
'name': 'Website Settings'
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocPerm
|
# DocPerm
|
||||||
@@ -74,6 +74,28 @@
|
|||||||
'label': 'Top Bar'
|
'label': 'Top Bar'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'title_prefix',
|
||||||
|
'fieldtype': 'Data',
|
||||||
|
'label': 'Title Prefix'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'The "Web Page" that is the website home page',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'home_page',
|
||||||
|
'fieldtype': 'Link',
|
||||||
|
'label': 'Home Page',
|
||||||
|
'options': 'Web Page',
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
@@ -13,14 +13,14 @@ wn.require('lib/js/bootstrap/bootstrap-dropdown.js');
|
|||||||
erpnext.topbar.TopBar = Class.extend({
|
erpnext.topbar.TopBar = Class.extend({
|
||||||
init: function() {
|
init: function() {
|
||||||
this.make();
|
this.make();
|
||||||
$('.brand').html(wn.boot.topbar.brand_html);
|
$('.brand').html(wn.boot.website_settings.brand_html);
|
||||||
this.make_items();
|
this.make_items();
|
||||||
},
|
},
|
||||||
make: function() {
|
make: function() {
|
||||||
$('header').append('<div class="topbar">\
|
$('header').append('<div class="topbar">\
|
||||||
<div class="topbar-inner">\
|
<div class="topbar-inner">\
|
||||||
<div class="container">\
|
<div class="container">\
|
||||||
<a class="brand" href="#!home">[brand]</a>\
|
<a class="brand">[brand]</a>\
|
||||||
<ul class="nav">\
|
<ul class="nav">\
|
||||||
</ul>\
|
</ul>\
|
||||||
<img src="lib/images/ui/spinner.gif" id="spinner"/>\
|
<img src="lib/images/ui/spinner.gif" id="spinner"/>\
|
||||||
@@ -30,9 +30,10 @@ erpnext.topbar.TopBar = Class.extend({
|
|||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>');
|
</div>');
|
||||||
|
$('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page'))
|
||||||
},
|
},
|
||||||
make_items: function() {
|
make_items: function() {
|
||||||
var items = wn.boot.topbaritems
|
var items = wn.boot.website_menus
|
||||||
for(var i=0;i<items.length;i++) {
|
for(var i=0;i<items.length;i++) {
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
if(!item.parent_label && item.parentfield=='top_bar_items') {
|
if(!item.parent_label && item.parentfield=='top_bar_items') {
|
||||||
@@ -55,11 +56,11 @@ erpnext.Footer = Class.extend({
|
|||||||
<div class="web-footer-copyright">© %(copyright)s</div>\
|
<div class="web-footer-copyright">© %(copyright)s</div>\
|
||||||
<div class="web-footer-powered">Powered by \
|
<div class="web-footer-powered">Powered by \
|
||||||
<a href="https://erpnext.com">erpnext.com</a></div>\
|
<a href="https://erpnext.com">erpnext.com</a></div>\
|
||||||
</div>', wn.boot.topbar));
|
</div>', wn.boot.website_settings));
|
||||||
this.make_items();
|
this.make_items();
|
||||||
},
|
},
|
||||||
make_items: function() {
|
make_items: function() {
|
||||||
var items = wn.boot.topbaritems
|
var items = wn.boot.website_menus
|
||||||
for(var i=0;i<items.length;i++) {
|
for(var i=0;i<items.length;i++) {
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
if(!item.parent_label && item.parentfield=='footer_items') {
|
if(!item.parent_label && item.parentfield=='footer_items') {
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# Page, home
|
|
||||||
[
|
|
||||||
|
|
||||||
# These values are common in all dictionaries
|
|
||||||
{
|
|
||||||
'creation': '2012-01-24 16:08:44',
|
|
||||||
'docstatus': 0,
|
|
||||||
'modified': '2012-01-24 16:08:44',
|
|
||||||
'modified_by': 'Administrator',
|
|
||||||
'owner': 'Administrator'
|
|
||||||
},
|
|
||||||
|
|
||||||
# These values are common for all Page
|
|
||||||
{
|
|
||||||
'doctype': 'Page',
|
|
||||||
'module': 'Website',
|
|
||||||
'name': '__common__',
|
|
||||||
'page_name': 'home',
|
|
||||||
'standard': 'Yes'
|
|
||||||
},
|
|
||||||
|
|
||||||
# These values are common for all Page Role
|
|
||||||
{
|
|
||||||
'doctype': 'Page Role',
|
|
||||||
'name': '__common__',
|
|
||||||
'parent': 'home',
|
|
||||||
'parentfield': 'roles',
|
|
||||||
'parenttype': 'Page',
|
|
||||||
'role': 'Guest'
|
|
||||||
},
|
|
||||||
|
|
||||||
# Page, home
|
|
||||||
{
|
|
||||||
'doctype': 'Page',
|
|
||||||
'name': 'home'
|
|
||||||
},
|
|
||||||
|
|
||||||
# Page Role
|
|
||||||
{
|
|
||||||
'doctype': 'Page Role'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1 +1 @@
|
|||||||
335
|
353
|
||||||
Reference in New Issue
Block a user