website fixes
This commit is contained in:
parent
2b264146d3
commit
d8e21ecaca
9 changed files with 61 additions and 22 deletions
|
|
@ -119,7 +119,6 @@ div#body_div {
|
|||
|
||||
.content {
|
||||
width: 900px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.background-fade-in {
|
||||
|
|
@ -130,9 +129,8 @@ div#body_div {
|
|||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
header .container {
|
||||
width: 900px;
|
||||
|
|
@ -156,7 +154,6 @@ div.no_script {
|
|||
}
|
||||
|
||||
div.loading_div {
|
||||
position: absolute;
|
||||
background-color: #FFFFCC;
|
||||
z-index: 1999;
|
||||
right: 5px;
|
||||
|
|
|
|||
12
js/core.min.js
vendored
12
js/core.min.js
vendored
|
|
@ -208,7 +208,14 @@ $(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},
|
|||
var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}
|
||||
if(!page){console.log('Page not found '+label);return;}
|
||||
if(this.page){$(this.page).toggle(false);$(this.page).trigger('hide');}
|
||||
this.page=page;$(this.page).fadeIn();$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;return this.page;}})
|
||||
this.page=page;$(this.page).fadeIn();$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;scroll(0,0);return this.page;}});wn.views.add_module_btn=function(parent,module){$(parent).append(repl('<span class="label" style="margin-right: 8px; cursor: pointer;"\
|
||||
onclick="wn.set_route(\'%(module_small)s-home\')">\
|
||||
<i class="icon-home icon-white"></i> %(module)s Home\
|
||||
</span>',{module:module,module_small:module.toLowerCase()}));}
|
||||
wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('<span class="label" style="margin-right: 8px; cursor: pointer;"\
|
||||
onclick="wn.set_route(\'List\', \'%(doctype)s\')">\
|
||||
<i class="icon-list icon-white"></i> %(doctype)s List\
|
||||
</span>',{doctype:doctype}));}
|
||||
/*
|
||||
* lib/js/wn/views/doclistview.js
|
||||
*/
|
||||
|
|
@ -217,6 +224,7 @@ document.title=page.doclistview.label;wn.container.change_to(pagename);})}
|
|||
wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doctype=doctype;this.$page=$(page);this.label=get_doctype_label(doctype);this.label=(this.label.toLowerCase().substr(-4)=='list')?this.label:(this.label+' List');this.make_page();this.setup();},make_page:function(){var me=this;this.$page.html(repl('<div class="layout-wrapper layout-wrapper-background">\
|
||||
<div class="layout-main-section">\
|
||||
<a class="close" onclick="window.history.back();">×</a>\
|
||||
<div class="breadcrumbs-area"></div>\
|
||||
<h1>%(label)s</h1>\
|
||||
<hr>\
|
||||
<div class="wnlist-area"><div class="help">Loading...</div></div>\
|
||||
|
|
@ -230,7 +238,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
|
|||
</div>\
|
||||
</div>\
|
||||
<div style="clear: both"></div>\
|
||||
</div>',{label:this.label}));},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
|
||||
</div>',{label:this.label}));wn.views.breadcrumbs(this.$page.find('.breadcrumbs-area').get(0),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
|
||||
else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);}
|
||||
this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('<div class="well"><p>No %(doctype_label)s found</p>\
|
||||
%(description)s\
|
||||
|
|
|
|||
|
|
@ -45,22 +45,17 @@ var def_ph_style = {
|
|||
function PageHeader(parent, main_text, sub_text) {
|
||||
|
||||
this.wrapper = $a(parent,'div','page_header');
|
||||
this.t1 = make_table($a(this.wrapper,'div','',def_ph_style.wrapper.backgroundColor), 1, 2, '100%', [null, '100px'], {padding: '2px'});
|
||||
$y(this.t1, {borderCollapse:'collapse'})
|
||||
this.lhs = $td(this.t1, 0, 0);
|
||||
this.close_btn = $a(this.wrapper, 'a', 'close', {}, '×');
|
||||
this.close_btn.onclick = function() { window.history.back(); };
|
||||
|
||||
this.main_head = $a(this.lhs, 'h1', '', def_ph_style.main_heading);
|
||||
this.sub_head = $a(this.lhs, 'h4', '', def_ph_style.sub_heading);
|
||||
this.breadcrumbs = $a(this.wrapper, 'div');
|
||||
this.main_head = $a(this.wrapper, 'h1', '', def_ph_style.main_heading);
|
||||
this.sub_head = $a(this.wrapper, 'h4', '', def_ph_style.sub_heading);
|
||||
|
||||
this.separator = $a(this.wrapper, 'div', '', def_ph_style.separator);
|
||||
this.toolbar_area = $a(this.wrapper, 'div', '', def_ph_style.toolbar_area);
|
||||
this.padding_area = $a(this.wrapper, 'div', '', {padding:'3px'});
|
||||
|
||||
// close btn
|
||||
$y($td(this.t1, 0, 1),{textAlign:'right', padding:'3px'});
|
||||
this.close_btn = $a($td(this.t1, 0, 1), 'span', 'close', {}, '×');
|
||||
this.close_btn.onclick = function() { window.history.back(); };
|
||||
|
||||
if(main_text) this.main_head.innerHTML = main_text;
|
||||
if(sub_text) this.sub_head.innerHTML = sub_text;
|
||||
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ _f.Frm.prototype.setup_std_layout = function() {
|
|||
$(this.page_layout.main).removeClass('layout-main-section');
|
||||
$(this.page_layout.sidebar_area).toggle(false);
|
||||
} else {
|
||||
// module link
|
||||
this.setup_sidebar();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,15 @@ _f.FrmHeader = function(parent, frm) {
|
|||
if(frm.meta.in_dialog) $y(this.wrapper, {marginLeft:'8px', marginRight:'8px'});
|
||||
|
||||
this.page_head = new PageHeader(this.wrapper);
|
||||
|
||||
wn.views.breadcrumbs(this.page_head.breadcrumbs, frm.meta.module, frm.meta.name);
|
||||
|
||||
// doctype
|
||||
this.dt_area = $a(this.page_head.main_head, 'h1', '', {marginRight:'8px', display:'inline'})
|
||||
|
||||
// name
|
||||
var div = $a(null, 'div', '', {marginBottom:'4px'});
|
||||
|
||||
this.page_head.lhs.insertBefore(div, this.page_head.sub_head);
|
||||
this.page_head.wrapper.insertBefore(div, this.page_head.sub_head);
|
||||
this.dn_area = $a(div, 'span', '', {fontSize:'14px', fontWeight:'normal', marginRight:'8px', padding: '2px'})
|
||||
|
||||
// status
|
||||
|
|
|
|||
17
js/wn/views/breadcrumbs.js
Normal file
17
js/wn/views/breadcrumbs.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
wn.provide('wn.views');
|
||||
wn.views.breadcrumbs = function(parent, module, doctype, name) {
|
||||
var $bspan = $(repl('<span class="breadcrumbs">\
|
||||
<a href="#%(home_page)s"><i class="icon-home"></i></a></span>', {home_page: wn.boot.home_page}));
|
||||
if(module) {
|
||||
$bspan.append(repl(' / <a href="#!%(module_small)s-home">%(module)s Home</a>',
|
||||
{module: module, module_small: module.toLowerCase() }))
|
||||
}
|
||||
if(doctype && (locals.DocType[doctype] && !locals.DocType[doctype].issingle)) {
|
||||
$bspan.append(repl(' / <a href="#!List/%(doctype)s">%(doctype)s List</a>',
|
||||
{doctype: doctype}))
|
||||
}
|
||||
if(name) {
|
||||
$bspan.append(' / ' + name)
|
||||
}
|
||||
$bspan.appendTo(parent);
|
||||
}
|
||||
|
|
@ -51,7 +51,24 @@ wn.views.Container = Class.extend({
|
|||
$(this.page).trigger('show');
|
||||
this.page._route = window.location.hash;
|
||||
document.title = this.page.label;
|
||||
scroll(0,0);
|
||||
|
||||
return this.page;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
wn.views.add_module_btn = function(parent, module) {
|
||||
$(parent).append(
|
||||
repl('<span class="label" style="margin-right: 8px; cursor: pointer;"\
|
||||
onclick="wn.set_route(\'%(module_small)s-home\')">\
|
||||
<i class="icon-home icon-white"></i> %(module)s Home\
|
||||
</span>', {module: module, module_small: module.toLowerCase()}));
|
||||
}
|
||||
|
||||
wn.views.add_list_btn = function(parent, doctype) {
|
||||
$(parent).append(
|
||||
repl('<span class="label" style="margin-right: 8px; cursor: pointer;"\
|
||||
onclick="wn.set_route(\'List\', \'%(doctype)s\')">\
|
||||
<i class="icon-list icon-white"></i> %(doctype)s List\
|
||||
</span>', {doctype: doctype}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
this.$page.html(repl('<div class="layout-wrapper layout-wrapper-background">\
|
||||
<div class="layout-main-section">\
|
||||
<a class="close" onclick="window.history.back();">×</a>\
|
||||
<div class="breadcrumbs-area"></div>\
|
||||
<h1>%(label)s</h1>\
|
||||
<hr>\
|
||||
<div class="wnlist-area"><div class="help">Loading...</div></div>\
|
||||
|
|
@ -70,6 +71,8 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
</div>\
|
||||
<div style="clear: both"></div>\
|
||||
</div>', {label: this.label}));
|
||||
|
||||
wn.views.breadcrumbs(this.$page.find('.breadcrumbs-area').get(0), locals.DocType[this.doctype].module);
|
||||
},
|
||||
|
||||
setup: function() {
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ body_html = """
|
|||
</div>
|
||||
<!-- Main Starts -->
|
||||
<div id="body_div">
|
||||
<footer></footer>
|
||||
</div>
|
||||
<footer></footer>
|
||||
<div class="no_script" style="display: none;">
|
||||
%s
|
||||
</div>
|
||||
|
|
@ -100,7 +100,7 @@ def html_snapshot(page):
|
|||
for m in webnotes.conn.sql("""select parentfield, label, url, custom_page
|
||||
from `tabTop Bar Item` where parent='Top Bar Settings' order by idx""", as_dict=1):
|
||||
|
||||
m['std_page'] = m.get('url') or m('custom_page')
|
||||
m['std_page'] = m.get('url') or m.get('custom_page')
|
||||
|
||||
if m['parentfield']=='top_bar_items':
|
||||
doc.header_menu += '<li><a href="index.cgi#!%(std_page)s">%(label)s</a></li>' % m
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue