fixes to website module and fixed rename and double column bugs

This commit is contained in:
Rushabh Mehta 2012-04-25 18:24:44 +05:30
parent e848300958
commit dcfdfc317c
12 changed files with 128 additions and 81 deletions

View File

@ -1923,9 +1923,9 @@ div.std-footer-item {
}
.layout_wrapper, .layout-wrapper {
-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
-webkit-box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
background-color: #fff;
padding: 15px;
-webkit-border-radius: 5px;
@ -1945,7 +1945,8 @@ div.std-footer-item {
}
.layout-main {
padding: 15px;
padding: 15px;
background-color: #fff;
}
.layout-main-section {

View File

@ -1403,9 +1403,9 @@ div.std-footer-item {
}
.layout_wrapper, .layout-wrapper {
-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
-webkit-box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
background-color: #fff;
padding: 15px;
-webkit-border-radius: 5px;
@ -1425,7 +1425,8 @@ div.std-footer-item {
}
.layout-main {
padding: 15px;
padding: 15px;
background-color: #fff;
}
.layout-main-section {
@ -1946,8 +1947,8 @@ div#body_div, header .container, .content, #opened-page-selector, footer {
width: 900px;
}
.layout_wrapper {
padding: 27px;
div#body_div {
margin-top: 90px;
}
p, li {
@ -1965,10 +1966,6 @@ pre {
margin-bottom: 9px;
}
.web-content input[type="text"], .web-content input[type="password"], .web-content select {
min-width: 180px;
}
.web-head-section {
margin-bottom: 20px
}
@ -1991,6 +1988,7 @@ pre {
.web-page-status {
padding: 7px;
margin-top: -20px;
color: #777;
clear: both;
text-align: right;
@ -2021,20 +2019,12 @@ footer {
}
.web-footer div, .web-footer a {
font-size: 11px;
font-size: 14px;
}
.web-footer-menu {
margin-bottom: 7px;
}
footer a, footer a:visited {
color: #777;
}
footer a:hover {
background-color: #777;
color: #fff;
}
.web-footer-menu ul {
list-style: none;
@ -2080,9 +2070,8 @@ footer a:hover {
}
.two-column {
width: 40%;
width: 50%;
float: left;
padding: 5%;
}
.clear {

View File

@ -2,8 +2,8 @@ div#body_div, header .container, .content, #opened-page-selector, footer {
width: 900px;
}
.layout_wrapper {
padding: 27px;
div#body_div {
margin-top: 90px;
}
p, li {
@ -21,10 +21,6 @@ pre {
margin-bottom: 9px;
}
.web-content input[type="text"], .web-content input[type="password"], .web-content select {
min-width: 180px;
}
.web-head-section {
margin-bottom: 20px
}
@ -47,6 +43,7 @@ pre {
.web-page-status {
padding: 7px;
margin-top: -20px;
color: #777;
clear: both;
text-align: right;
@ -77,20 +74,12 @@ footer {
}
.web-footer div, .web-footer a {
font-size: 11px;
font-size: 14px;
}
.web-footer-menu {
margin-bottom: 7px;
}
footer a, footer a:visited {
color: #777;
}
footer a:hover {
background-color: #777;
color: #fff;
}
.web-footer-menu ul {
list-style: none;
@ -136,9 +125,8 @@ footer a:hover {
}
.two-column {
width: 40%;
width: 50%;
float: left;
padding: 5%;
}
.clear {

View File

@ -3,6 +3,7 @@ body {
background: url("files/{{ doc.background_image }}") repeat;
{% elif doc.background_color %}
background-color: #{{ doc.background_color }};
background-image: none;
{% endif %}
{% if doc.font %}
font-family: '{{ doc.font }}', Verdana, Sans !important;

View File

@ -28,6 +28,8 @@ class DocType:
self.doc.small_font_size = str(int(self.doc.font_size[:-2])-2) + 'px'
self.doc.custom_css = temp.render(doc = self.doc)
if self.doc.add_css:
self.doc.custom_css += '\n\n/* User CSS */\n\n' + self.doc.add_css
from webnotes.session_cache import clear_cache
clear_cache('Guest')

View File

@ -5,7 +5,7 @@
{
'creation': '2012-04-02 16:02:43',
'docstatus': 0,
'modified': '2012-04-16 13:36:48',
'modified': '2012-04-25 10:00:35',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -23,7 +23,7 @@
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 19
'version': 23
},
# These values are common for all DocField
@ -89,6 +89,27 @@
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Select a white footer foreground color if you have a dark background',
'doctype': u'DocField',
'fieldname': u'footer_font_color',
'fieldtype': u'Select',
'label': u'Footer Font Color',
'options': u'\nwhite',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldtype': u'Column Break',
'label': u'Fonts',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
@ -121,13 +142,20 @@
# DocField
{
'colour': u'White:FFF',
'description': u'Select a white footer foreground color if you have a dark background',
'doctype': u'DocField',
'fieldname': u'footer_font_color',
'fieldtype': u'Select',
'label': u'Footer Font Color',
'options': u'\nwhite',
'fieldtype': u'Section Break',
'label': u'CSS',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'add your own CSS (careful!)',
'doctype': u'DocField',
'fieldname': u'add_css',
'fieldtype': u'Code',
'label': u'Add CSS',
'permlevel': 0
},

View File

@ -1,5 +1,5 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="web-content" id="content-{{ doc.name }}"
<div class="web-content"
style="text-align: {{ doc.text_align }};">
{% if doc.layout.startswith('Two column') %}

View File

@ -1,15 +1,33 @@
$.extend(cur_frm.cscript, {
layout: function(doc) {
if(!doc.layout) doc.layout = 'Two column with header'
hide_field(['head_section', 'side_section']);
hide_field(['head_section', 'side_section', 'javascript', 'css']);
if(doc.layout=='Two column with header') {
unhide_field(['head_section', 'side_section']);
}
if(doc.layout=='Two column') {
unhide_field('side_section');
}
if(doc.insert_code) {
if(!doc.javascript) {
doc.javascript = 'wn.pages["'+doc.name+'"].onload = function(wrapper) { }';
}
unhide_field('javascript');
}
if(doc.insert_style) {
if(!doc.css) {
doc.css = '#page-'+doc.name+' { }';
}
unhide_field('css');
}
},
refresh: function(doc) {
cur_frm.cscript.layout(doc);
},
insert_style: function() {
cur_frm.cscript.layout(doc);
},
insert_code: function() {
cur_frm.cscript.layout(doc);
}
})

View File

@ -44,6 +44,14 @@ class DocType:
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
p.content = Template(f.read()).render(doc=self.doc)
p.title = self.doc.title
if self.doc.insert_code:
p.script = self.doc.javascript
if self.doc.insert_style:
p.style = self.doc.css
p.save()
website.utils.add_guest_access_to_page(p.name)

View File

@ -5,7 +5,7 @@
{
'creation': '2012-04-02 16:02:43',
'docstatus': 0,
'modified': '2012-04-10 10:41:00',
'modified': '2012-04-25 16:03:57',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -22,7 +22,7 @@
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 11
'version': 16
},
# These values are common for all DocField
@ -85,15 +85,6 @@
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'layout',
'fieldtype': u'Select',
'label': u'Layout',
'options': u'Two column with header\nTwo column\nSingle column'
},
# DocField
{
'doctype': u'DocField',
@ -105,10 +96,10 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'text_align',
'fieldname': u'layout',
'fieldtype': u'Select',
'label': u'Text Align',
'options': u'Left\nCenter\nRight'
'label': u'Layout',
'options': u'Two column with header\nTwo column\nSingle column'
},
# DocField
@ -158,29 +149,49 @@
'doctype': u'DocField',
'fieldname': u'sb2',
'fieldtype': u'Section Break',
'label': u'Links'
'label': u'More'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'text_align',
'fieldtype': u'Select',
'label': u'Text Align',
'options': u'Left\nCenter\nRight'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Link for next page appears at the bottom of the page',
'doctype': u'DocField',
'fieldname': u'next_page',
'fieldtype': u'Link',
'label': u'Next Page',
'options': u'Page'
'fieldname': u'insert_code',
'fieldtype': u'Check',
'label': u'Insert Code'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Related pages appear on the right side of the link and are linked both ways.',
'doctype': u'DocField',
'fieldname': u'related_pages',
'fieldtype': u'Table',
'label': u'Related Pages',
'options': u'Related Page'
'fieldname': u'javascript',
'fieldtype': u'Code',
'label': u'Javascript'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'insert_style',
'fieldtype': u'Check',
'label': u'Insert Style'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'css',
'fieldtype': u'Code',
'label': u'CSS'
},
# DocField

View File

@ -353,7 +353,7 @@ if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!me.fields_by_name[df.field
/*
* lib/js/wn/views/container.js
*/
wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').appendTo(this.container).get(0);if(onshow)
wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').attr('id',"page-"+label).appendTo(this.container).get(0);if(onshow)
$(page).bind('show',onshow);if(onshow)
$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){if(this.page&&this.page.label==label){return;}
var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}
@ -1710,7 +1710,8 @@ _f.Frm.prototype.email_doc=function(){if(!_e.dialog)_e.make();sel=this.print_sel
c.appendChild(this.print_sel);c.cur_sel=this.print_sel;_e.dialog.widgets['Send With Attachments'].checked=0;if(cur_frm.doc.file_list){$ds(_e.dialog.rows['Send With Attachments']);}else{$dh(_e.dialog.rows['Send With Attachments']);}
_e.dialog.widgets['Subject'].value=get_doctype_label(this.meta.name)+': '+this.docname;_e.dialog.show();}
_f.Frm.prototype.rename_notify=function(dt,old,name){this.is_editable[name]=this.is_editable[old];delete this.is_editable[old];if(this.docname==old)
this.docname=name;if(this&&this.opendocs[old]){local_dt[dt][name]=local_dt[dt][old];local_dt[dt][old]=null;}
this.docname=name;else
return;if(this&&this.opendocs[old]){local_dt[dt][name]=local_dt[dt][old];local_dt[dt][old]=null;}
delete this.opendocs[old];this.opendocs[name]=true;wn.re_route[window.location.hash]='Form/'+encodeURIComponent(this.doctype)+'/'+encodeURIComponent(name);wn.set_route('Form',this.doctype,name);}
_f.Frm.prototype.setup_meta=function(){this.meta=get_local('DocType',this.doctype);this.perm=get_perm(this.doctype);if(this.meta.istable){this.meta.in_dialog=1}
this.setup_print();}

View File

@ -240,7 +240,7 @@ if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!me.fields_by_name[df.field
/*
* lib/js/wn/views/container.js
*/
wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').appendTo(this.container).get(0);if(onshow)
wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').attr('id',"page-"+label).appendTo(this.container).get(0);if(onshow)
$(page).bind('show',onshow);if(onshow)
$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){if(this.page&&this.page.label==label){return;}
var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}