[fix] on page change, set full-width for containers if explicitly specified

else limit width to 970px
This commit is contained in:
Anand Doshi 2014-09-16 16:20:13 +05:30
parent 00ae80134f
commit 99eda53ce5
6 changed files with 16 additions and 4 deletions

View file

@ -75,7 +75,7 @@ div#freeze {
overflow: hidden;
}
.page-container .container {
.limit-container-width .container {
max-width: 970px;
}

View file

@ -312,7 +312,7 @@ frappe.ui.make_app_page = function(opts) {
"title: [optional] set this title"
]
*/
$wrapper = $(opts.parent)
var $wrapper = $(opts.parent)
$('<div class="app-page container"><div class="appframe-titlebar">\
<div class="container">\
<div class="row">\
@ -360,5 +360,6 @@ frappe.ui.make_app_page = function(opts) {
opts.parent.appframe.set_document_title = opts.set_document_title;
if(opts.title) opts.parent.appframe.set_title(opts.title);
if(opts.icon) opts.parent.appframe.get_main_icon(opts.icon);
if(opts.full_width) $wrapper.find(".app-page").addClass("full-width");
}

View file

@ -13,6 +13,8 @@ frappe.views.Container = Class.extend({
this.page = null; // current page
this.pagewidth = $('#body_div').width();
this.pagemargin = 50;
$(document).on("page-change", this.set_full_width);
},
add_page: function(label, onshow, onhide) {
var page = $('<div class="content page-container"></div>')
@ -71,5 +73,11 @@ frappe.views.Container = Class.extend({
$(this.page).trigger('show');
scroll(0,0);
return this.page;
},
set_full_width: function() {
// limit max-width to 970px for most pages
$("body").toggleClass("limit-container-width", !$(frappe.container.page).find(".app-page.full-width").length);
}
});

View file

@ -103,6 +103,7 @@ frappe.views.GridReport = Class.extend({
var me = this;
$.extend(this, opts);
$(this.page).find(".app-page").addClass("full-width");
this.wrapper = $('<div>').appendTo(this.parent);
this.appframe.parent.find(".appframe").css({"padding-top": "0px"});
@ -125,6 +126,7 @@ frappe.views.GridReport = Class.extend({
// reapply filters on show
frappe.cur_grid_report = me;
me.get_data_and_refresh();
frappe.container.set_full_width();
});
},

View file

@ -12,7 +12,8 @@ frappe.standard_pages["query-report"] = function() {
frappe.ui.make_app_page({
parent: wrapper,
title: __('Query Report'),
single_column: true
single_column: true,
full_width: true
});
frappe.query_report = new frappe.views.QueryReport({

View file

@ -41,7 +41,7 @@ frappe.views.ReportViewPage = Class.extend({
var me = this;
this.page = frappe.container.add_page(this.page_name);
frappe.ui.make_app_page({parent:this.page,
single_column:true});
single_column:true, full_width: true});
frappe.container.change_to(this.page_name);
$(this.page).on('show', function(){