Split frappe.min.js into desk.min.js, form.min.js, list.min.js and report.min.js
This commit is contained in:
parent
d45dd45e63
commit
9b4fa72bcb
29 changed files with 280 additions and 515 deletions
|
|
@ -1,6 +1,8 @@
|
|||
frappe.provide('frappe.desktop');
|
||||
|
||||
frappe.pages['desktop'].on_page_load = function(wrapper) {
|
||||
frappe.assets.views["Module"]();
|
||||
|
||||
// load desktop
|
||||
frappe.desktop.refresh(wrapper);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,19 +11,23 @@ before_install = "frappe.utils.install.before_install"
|
|||
after_install = "frappe.utils.install.after_install"
|
||||
|
||||
# website
|
||||
app_include_js = "assets/js/frappe.min.js"
|
||||
app_include_js = [
|
||||
"assets/js/desk.min.js",
|
||||
"assets/js/editor.min.js",
|
||||
]
|
||||
app_include_css = [
|
||||
"assets/frappe/css/splash.css",
|
||||
"assets/css/frappe.css"
|
||||
]
|
||||
"assets/css/desk.min.css"
|
||||
]
|
||||
|
||||
web_include_js = [
|
||||
"assets/js/frappe-web.min.js",
|
||||
"website_script.js"
|
||||
]
|
||||
"assets/js/frappe-web.min.js",
|
||||
"website_script.js"
|
||||
]
|
||||
|
||||
web_include_css = [
|
||||
"assets/css/frappe-web.css",
|
||||
"style_settings.css"
|
||||
]
|
||||
"assets/css/frappe-web.css",
|
||||
"style_settings.css"
|
||||
]
|
||||
|
||||
write_file_keys = ["file_url", "file_name"]
|
||||
|
||||
|
|
|
|||
|
|
@ -14,21 +14,17 @@
|
|||
"public/js/frappe/misc/pretty_date.js",
|
||||
"public/js/lib/moment/moment.min.js",
|
||||
"public/js/lib/highlight.pack.js",
|
||||
"public/js/frappe/class.js",
|
||||
"website/js/website.js"
|
||||
],
|
||||
"js/editor.min.js": [
|
||||
"public/js/lib/jquery/jquery.hotkeys.js",
|
||||
"public/js/frappe/class.js",
|
||||
"public/js/lib/beautify-html.js",
|
||||
"public/js/frappe/ui/editor.js"
|
||||
],
|
||||
"css/frappe.css": [
|
||||
"css/desk.min.css": [
|
||||
"public/js/lib/jquery/bootstrap_theme/jquery-ui.selected.css",
|
||||
"public/js/lib/slickgrid/slick.grid.css",
|
||||
"public/js/lib/slickgrid/slick-default-theme.css",
|
||||
|
||||
"public/css/bootstrap.css",
|
||||
"public/css/tag-it.css",
|
||||
"public/css/font-awesome.css",
|
||||
"public/css/octicons/octicons.css",
|
||||
"public/css/desk.css",
|
||||
|
|
@ -37,47 +33,35 @@
|
|||
"public/css/navbar.css",
|
||||
"public/css/sidebar.css",
|
||||
"public/css/page.css",
|
||||
"public/css/form.css",
|
||||
"public/css/form_grid.css",
|
||||
"public/css/list.css",
|
||||
"public/css/report.css",
|
||||
"public/css/module.css",
|
||||
"public/css/slickgrid.css",
|
||||
"public/css/tree_grid.css",
|
||||
"public/css/tree.css",
|
||||
"public/css/nprogress.css",
|
||||
"public/css/desktop.css",
|
||||
"public/css/mobile.css"
|
||||
],
|
||||
"js/frappe.min.js": [
|
||||
"js/desk.min.js": [
|
||||
"public/js/lib/jquery/jquery-ui.min.js",
|
||||
"public/js/lib/Sortable.min.js",
|
||||
"public/js/lib/tag-it.min.js",
|
||||
"public/js/lib/jquery/jquery.hotkeys.js",
|
||||
"public/js/lib/bootstrap.min.js",
|
||||
"public/js/lib/nprogress.js",
|
||||
"public/js/lib/beautify-html.js",
|
||||
"public/js/lib/moment/moment.min.js",
|
||||
"public/js/lib/moment/moment-timezone.min.js",
|
||||
"public/js/frappe/format.js",
|
||||
|
||||
"public/js/frappe/provide.js",
|
||||
"public/js/frappe/class.js",
|
||||
"public/js/frappe/translate.js",
|
||||
"public/js/frappe/assets.js",
|
||||
"public/js/frappe/format.js",
|
||||
"public/js/frappe/form/formatters.js",
|
||||
"public/js/frappe/translate.js",
|
||||
"public/js/frappe/ui/modal.html",
|
||||
"public/js/frappe/dom.js",
|
||||
"public/js/frappe/ui/messages.js",
|
||||
"public/js/frappe/ui/listing.html",
|
||||
"public/js/frappe/ui/listing.js",
|
||||
|
||||
"public/js/frappe/request.js",
|
||||
"public/js/frappe/router.js",
|
||||
"public/js/frappe/desk.js",
|
||||
"public/js/frappe/defaults.js",
|
||||
"public/js/lib/microtemplate.js",
|
||||
|
||||
"public/html/print_template.html",
|
||||
|
||||
"public/js/legacy/globals.js",
|
||||
"public/js/legacy/datatype.js",
|
||||
"public/js/legacy/dom.js",
|
||||
|
|
@ -89,6 +73,8 @@
|
|||
"public/js/frappe/ui/iconbar.js",
|
||||
"public/js/frappe/form/layout.js",
|
||||
"public/js/frappe/ui/field_group.js",
|
||||
"public/js/frappe/form/control.js",
|
||||
"public/js/frappe/form/link_selector.js",
|
||||
"public/js/frappe/ui/dialog.js",
|
||||
"public/js/frappe/ui/button.js",
|
||||
"public/js/frappe/ui/app_icon.js",
|
||||
|
|
@ -99,7 +85,6 @@
|
|||
"public/js/frappe/model/create_new.js",
|
||||
"public/js/frappe/model/perm.js",
|
||||
"public/js/frappe/model/workflow.js",
|
||||
"public/js/frappe/model/indicator.js",
|
||||
|
||||
"public/js/frappe/misc/user.js",
|
||||
"public/js/frappe/misc/pretty_date.js",
|
||||
|
|
@ -110,62 +95,42 @@
|
|||
|
||||
"public/js/frappe/ui/upload.html",
|
||||
"public/js/frappe/upload.js",
|
||||
"public/js/frappe/ui/filters/filters.js",
|
||||
"public/js/frappe/ui/filters/edit_filter.html",
|
||||
"public/js/frappe/ui/tree.js",
|
||||
"public/js/frappe/ui/tags.js",
|
||||
"public/js/frappe/ui/star.js",
|
||||
|
||||
"public/js/frappe/views/container.js",
|
||||
"public/js/frappe/views/factory.js",
|
||||
"public/js/frappe/views/pageview.js",
|
||||
"public/js/frappe/views/module/module_title.html",
|
||||
"public/js/frappe/views/module/module_section.html",
|
||||
"public/js/frappe/views/module/module_sidebar.html",
|
||||
"public/js/frappe/views/module/moduleview.js",
|
||||
"public/js/frappe/views/formview.js",
|
||||
"public/js/frappe/views/reports/reportview.js",
|
||||
"public/js/frappe/views/calendar.js",
|
||||
"public/js/frappe/views/ganttview.js",
|
||||
"public/js/frappe/views/reports/query_report.js",
|
||||
"public/js/frappe/views/reports/grid_report.js",
|
||||
"public/js/frappe/views/reports/print_grid.html",
|
||||
"public/js/frappe/views/communication.js",
|
||||
"public/js/frappe/views/test_runner.js",
|
||||
"public/js/frappe/form/formatters.js",
|
||||
|
||||
"public/js/frappe/list/doclistview.js",
|
||||
"public/js/frappe/list/list_sidebar.js",
|
||||
"public/js/frappe/list/list_sidebar.html",
|
||||
"public/js/frappe/list/list_sidebar_stat.html",
|
||||
"public/js/frappe/list/list_item_main.html",
|
||||
"public/js/frappe/list/list_item_row.html",
|
||||
"public/js/frappe/list/list_item_main_head.html",
|
||||
"public/js/frappe/list/list_item_row_head.html",
|
||||
"public/js/frappe/list/list_item_subject.html",
|
||||
"public/js/frappe/list/listview.js",
|
||||
|
||||
"public/js/frappe/ui/toolbar/selector_dialog.js",
|
||||
"public/js/frappe/ui/toolbar/new.js",
|
||||
"public/js/frappe/ui/toolbar/awesome_bar.js",
|
||||
"public/js/frappe/ui/toolbar/report.js",
|
||||
"public/js/frappe/ui/toolbar/recent.js",
|
||||
"public/js/frappe/ui/toolbar/bookmarks.js",
|
||||
"public/js/frappe/ui/toolbar/about.js",
|
||||
"public/js/frappe/ui/toolbar/navbar.html",
|
||||
"public/js/frappe/ui/toolbar/offcanvas_left_sidebar.html",
|
||||
"public/js/frappe/ui/toolbar/toolbar.js",
|
||||
"public/js/frappe/ui/editor.js",
|
||||
"public/js/frappe/views/communication.js",
|
||||
|
||||
"public/js/frappe/desk.js"
|
||||
],
|
||||
"css/module.min.css": [
|
||||
"public/css/module.css"
|
||||
],
|
||||
"js/module.min.js": [
|
||||
"public/js/frappe/views/module/module_title.html",
|
||||
"public/js/frappe/views/module/module_section.html",
|
||||
"public/js/frappe/views/module/module_sidebar.html",
|
||||
"public/js/frappe/views/module/moduleview.js"
|
||||
],
|
||||
"css/form.min.css": [
|
||||
"public/css/form.css",
|
||||
"public/css/form_grid.css"
|
||||
],
|
||||
"js/form.min.js": [
|
||||
"public/js/frappe/views/formview.js",
|
||||
"public/js/legacy/form.js",
|
||||
"public/js/legacy/clientscriptAPI.js",
|
||||
|
||||
"public/js/frappe/form/toolbar.js",
|
||||
"public/js/frappe/form/dashboard.js",
|
||||
"public/js/frappe/form/save.js",
|
||||
"public/js/frappe/form/script_manager.js",
|
||||
"public/js/frappe/form/control.js",
|
||||
"public/js/frappe/form/link_selector.js",
|
||||
"public/js/frappe/form/grid_form.html",
|
||||
"public/js/frappe/form/grid.js",
|
||||
"public/js/frappe/form/linked_with.js",
|
||||
|
|
@ -185,12 +150,46 @@
|
|||
"public/js/frappe/form/footer/timeline.js",
|
||||
"public/js/frappe/form/footer/assign_to.js"
|
||||
],
|
||||
"js/print_format_v3.min.js": [
|
||||
"public/js/legacy/layout.js",
|
||||
"public/js/legacy/print_table.js",
|
||||
"public/js/legacy/print_format.js"
|
||||
"css/list.min.css": [
|
||||
"public/css/list.css",
|
||||
"public/css/tag-it.css"
|
||||
],
|
||||
"js/slickgrid.min.js": [
|
||||
"js/list.min.js": [
|
||||
"public/js/frappe/ui/listing.html",
|
||||
"public/js/frappe/ui/listing.js",
|
||||
"public/js/frappe/model/indicator.js",
|
||||
"public/js/frappe/ui/filters/filters.js",
|
||||
"public/js/frappe/ui/filters/edit_filter.html",
|
||||
"public/js/frappe/ui/tags.js",
|
||||
"public/js/frappe/ui/star.js",
|
||||
"public/html/print_template.html",
|
||||
"public/js/frappe/list/doclistview.js",
|
||||
"public/js/frappe/list/list_sidebar.js",
|
||||
"public/js/frappe/list/list_sidebar.html",
|
||||
"public/js/frappe/list/list_sidebar_stat.html",
|
||||
"public/js/frappe/list/list_item_main.html",
|
||||
"public/js/frappe/list/list_item_row.html",
|
||||
"public/js/frappe/list/list_item_main_head.html",
|
||||
"public/js/frappe/list/list_item_row_head.html",
|
||||
"public/js/frappe/list/list_item_subject.html",
|
||||
"public/js/frappe/list/listview.js",
|
||||
"public/js/frappe/views/calendar.js",
|
||||
"public/js/frappe/views/ganttview.js"
|
||||
],
|
||||
"css/report.min.css": [
|
||||
"public/css/report.css",
|
||||
"public/css/tree_grid.css",
|
||||
|
||||
"public/js/lib/slickgrid/slick.grid.css",
|
||||
"public/js/lib/slickgrid/slick-default-theme.css",
|
||||
"public/css/slickgrid.css"
|
||||
],
|
||||
"js/report.min.js": [
|
||||
"public/js/frappe/views/reports/reportview.js",
|
||||
"public/js/frappe/views/reports/query_report.js",
|
||||
"public/js/frappe/views/reports/grid_report.js",
|
||||
"public/js/frappe/views/reports/print_grid.html",
|
||||
|
||||
"public/js/lib/slickgrid/jquery.event.drag.js",
|
||||
"public/js/lib/slickgrid/plugins/slick.cellrangedecorator.js",
|
||||
"public/js/lib/slickgrid/plugins/slick.cellrangeselector.js",
|
||||
|
|
@ -199,5 +198,10 @@
|
|||
"public/js/lib/slickgrid/slick.core.js",
|
||||
"public/js/lib/slickgrid/slick.grid.js",
|
||||
"public/js/lib/slickgrid/slick.dataview.js"
|
||||
],
|
||||
"js/print_format_v3.min.js": [
|
||||
"public/js/legacy/layout.js",
|
||||
"public/js/legacy/print_table.js",
|
||||
"public/js/legacy/print_format.js"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
z-index: 1021;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
max-height: 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.2s ease;
|
||||
-o-transition: opacity 0.2s ease;
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
}
|
||||
.grid-row-open .form-in-grid {
|
||||
opacity: 1;
|
||||
max-height: 10000px;
|
||||
height: auto;
|
||||
}
|
||||
.grid-form-heading {
|
||||
padding: 10px 15px;
|
||||
|
|
|
|||
|
|
@ -1,35 +1,3 @@
|
|||
.slick-wrapper,
|
||||
.slick-header {
|
||||
border: none !important;
|
||||
}
|
||||
.slick-headerrow {
|
||||
border: none;
|
||||
border-bottom: 1px solid #d1d8dd;
|
||||
}
|
||||
.slick-headerrow-column {
|
||||
background-color: #f7fafc !important;
|
||||
}
|
||||
.slick-headerrow-column input {
|
||||
border: 1px solid #d1d8dd;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
padding: 0px 3px !important;
|
||||
}
|
||||
.slick-cell {
|
||||
border-color: #d1d8dd !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
.slick-header-column,
|
||||
.slick-header-columns {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
background-color: #f7fafc;
|
||||
border-color: #d1d8dd !important;
|
||||
color: #8d99a6 !important;
|
||||
}
|
||||
.slick-row.odd .slick-cell {
|
||||
background-color: #fafbfc;
|
||||
}
|
||||
.grid-report .plot {
|
||||
margin: 15px;
|
||||
display: none;
|
||||
|
|
|
|||
|
|
@ -1,21 +1,43 @@
|
|||
.slick-cell {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.slick-header-column, .slick-cell {
|
||||
.slick-header-column,
|
||||
.slick-cell {
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
.slick-wrapper,
|
||||
.slick-header {
|
||||
border: none !important;
|
||||
}
|
||||
.slick-headerrow {
|
||||
border: none;
|
||||
border-bottom: 1px solid #d1d8dd;
|
||||
}
|
||||
|
||||
.slick-headerrow-column {
|
||||
background: #87ceeb;
|
||||
text-overflow: clip;
|
||||
background-color: #f7fafc !important;
|
||||
text-overflow: clip;
|
||||
}
|
||||
|
||||
.slick-headerrow-column input {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
min-height: 20px;
|
||||
}
|
||||
border: 1px solid #d1d8dd;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
padding: 0px 3px !important;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
min-height: 20px;
|
||||
}
|
||||
.slick-cell {
|
||||
font-size: 12px;
|
||||
border-color: #d1d8dd !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
.slick-header-column,
|
||||
.slick-header-columns {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
background-color: #f7fafc;
|
||||
border-color: #d1d8dd !important;
|
||||
color: #8d99a6 !important;
|
||||
}
|
||||
.slick-row.odd .slick-cell {
|
||||
background-color: #fafbfc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ frappe.require = function(items) {
|
|||
frappe.assets = {
|
||||
// keep track of executed assets
|
||||
executed_ : {},
|
||||
|
||||
|
||||
check: function() {
|
||||
// if version is different then clear localstorage
|
||||
if(window._version_number != localStorage.getItem("_version_number")) {
|
||||
localStorage.clear();
|
||||
console.log("Cleared App Cache.");
|
||||
}
|
||||
|
||||
|
||||
if(localStorage._last_load) {
|
||||
var not_updated_since = new Date() - new Date(localStorage._last_load);
|
||||
if(not_updated_since < 10000 || not_updated_since > 86400000) {
|
||||
|
|
@ -38,24 +38,24 @@ frappe.assets = {
|
|||
localStorage.clear();
|
||||
console.log("Cleared localstorage");
|
||||
}
|
||||
|
||||
|
||||
frappe.assets.init_local_storage();
|
||||
},
|
||||
|
||||
|
||||
init_local_storage: function() {
|
||||
localStorage._last_load = new Date();
|
||||
localStorage._version_number = window._version_number;
|
||||
if(frappe.boot) localStorage.metadata_version = frappe.boot.metadata_version;
|
||||
},
|
||||
|
||||
|
||||
// check if the asset exists in
|
||||
// localstorage
|
||||
// localstorage
|
||||
exists: function(src) {
|
||||
if('localStorage' in window
|
||||
&& localStorage.getItem(src) && (frappe.boot ? !frappe.boot.developer_mode : true))
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
// add the asset to
|
||||
// localstorage
|
||||
add: function(src, txt) {
|
||||
|
|
@ -66,27 +66,27 @@ frappe.assets = {
|
|||
// if quota is exceeded, clear local storage and set item
|
||||
localStorage.clear();
|
||||
console.log("Local Storage cleared");
|
||||
|
||||
|
||||
localStorage.setItem(src, txt);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
get: function(src) {
|
||||
return localStorage.getItem(src);
|
||||
},
|
||||
|
||||
|
||||
extn: function(src) {
|
||||
if(src.indexOf('?')!=-1) {
|
||||
src = src.split('?').slice(-1)[0];
|
||||
}
|
||||
return src.split('.').slice(-1)[0];
|
||||
},
|
||||
|
||||
|
||||
// load an asset via
|
||||
load: function(src) {
|
||||
// this is virtual page load, only get the the source
|
||||
// *without* the template
|
||||
// *without* the template
|
||||
frappe.set_loading();
|
||||
|
||||
frappe.call({
|
||||
|
|
@ -99,10 +99,10 @@ frappe.assets = {
|
|||
},
|
||||
async: false
|
||||
})
|
||||
|
||||
|
||||
frappe.done_loading();
|
||||
},
|
||||
|
||||
|
||||
// pass on to the handler to set
|
||||
execute: function(src) {
|
||||
if(!frappe.assets.exists(src)) {
|
||||
|
|
@ -114,7 +114,7 @@ frappe.assets = {
|
|||
frappe.assets.executed_[src] = 1;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// handle types of assets
|
||||
// and launch them in the
|
||||
// app
|
||||
|
|
@ -125,5 +125,26 @@ frappe.assets = {
|
|||
css: function(txt, src) {
|
||||
frappe.dom.set_style(txt);
|
||||
}
|
||||
},
|
||||
|
||||
views: {
|
||||
"List": function() {
|
||||
frappe.require("assets/css/list.min.css");
|
||||
frappe.require("assets/js/list.min.js");
|
||||
},
|
||||
"Form": function() {
|
||||
frappe.assets.views["List"]();
|
||||
frappe.require("assets/css/form.min.css");
|
||||
frappe.require("assets/js/form.min.js");
|
||||
},
|
||||
"Report": function() {
|
||||
frappe.assets.views["List"]();
|
||||
frappe.require("assets/css/report.min.css");
|
||||
frappe.require("assets/js/report.min.js");
|
||||
},
|
||||
"Module": function() {
|
||||
frappe.require("assets/css/module.min.css");
|
||||
frappe.require("assets/js/module.min.js");
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -274,4 +274,31 @@ frappe.Application = Class.extend({
|
|||
if(frappe.boot.startup_js)
|
||||
eval(frappe.boot.startup_js);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
frappe.get_module = function(m) {
|
||||
var module = frappe.modules[m];
|
||||
if (!module) {
|
||||
return;
|
||||
}
|
||||
|
||||
module.name = m;
|
||||
|
||||
if(module.type==="module" && !module.link) {
|
||||
module.link = "Module/" + m;
|
||||
}
|
||||
|
||||
if(module.link) {
|
||||
module._id = module.link.toLowerCase().replace("/", "-");
|
||||
}
|
||||
|
||||
if(!module.label) {
|
||||
module.label = m;
|
||||
}
|
||||
|
||||
if(!module._label) {
|
||||
module._label = __(module.label || module.name);
|
||||
}
|
||||
|
||||
return module;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,10 +34,16 @@ frappe.route = function() {
|
|||
route = frappe.get_route();
|
||||
frappe.route_history.push(route);
|
||||
|
||||
if(route[0] && frappe.views[route[0] + "Factory"]) {
|
||||
if(route[0] && route[1] && !frappe.views[route[0] + "Factory"] && frappe.assets.views[route[0]]) {
|
||||
// load factory code
|
||||
frappe.assets.views[route[0]]();
|
||||
}
|
||||
|
||||
if(route[0] && route[1] && frappe.views[route[0] + "Factory"]) {
|
||||
// has a view generator, generate!
|
||||
if(!frappe.view_factory[route[0]])
|
||||
if(!frappe.view_factory[route[0]]) {
|
||||
frappe.view_factory[route[0]] = new frappe.views[route[0] + "Factory"]();
|
||||
}
|
||||
|
||||
frappe.view_factory[route[0]].show();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<div class="result">
|
||||
<div class="list-headers"></div>
|
||||
<div class="list-loading text-center">
|
||||
{%= __("Loading") %}...
|
||||
{%= frappe.messages.get_waiting_message(__("Loading") + "..." ) %}
|
||||
</div>
|
||||
<div class="result-list"></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,13 +4,15 @@
|
|||
frappe.provide("frappe.messages")
|
||||
|
||||
frappe.messages.waiting = function(parent, msg) {
|
||||
return $(repl('<div class="msg-box" style="width: 63%; margin: 30px auto;">\
|
||||
<p style="text-align: center;">%(msg)s</p>', {
|
||||
msg: msg
|
||||
}))
|
||||
return $(frappe.messages.get_waiting_message(msg))
|
||||
.appendTo(parent);
|
||||
};
|
||||
|
||||
frappe.messages.get_waiting_message = function(msg) {
|
||||
return repl('<div class="msg-box" style="width: 63%; margin: 30px auto;">\
|
||||
<p class="text-center">%(msg)s</p></div>', { msg: msg });
|
||||
}
|
||||
|
||||
frappe.throw = function(msg) {
|
||||
msgprint(msg);
|
||||
throw new Error(msg);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ frappe.ui.TagEditor = Class.extend({
|
|||
$.extend(this, opts);
|
||||
var me = this;
|
||||
this.$w = $('<div class="tag-line">').appendTo(this.parent)
|
||||
this.$tags = $('<ul>').prependTo(this.$w).tagit({
|
||||
this.$tags = $('<ul>').prependTo(this.$w);
|
||||
this.$tags.tagit({
|
||||
animate: false,
|
||||
allowSpaces: true,
|
||||
placeholderText: __('Add a tag' + "..."),
|
||||
|
|
|
|||
|
|
@ -1,21 +1,6 @@
|
|||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
|
||||
frappe.ui.toolbar.Search = frappe.ui.toolbar.SelectorDialog.extend({
|
||||
init: function() {
|
||||
this._super({
|
||||
title: __("Search"),
|
||||
execute: function(val) {
|
||||
frappe.set_route("List", val, {"name": "%"});
|
||||
},
|
||||
help: __("Shortcut") + ": Ctrl+G"
|
||||
});
|
||||
|
||||
// get new types
|
||||
this.set_values(frappe.boot.user.can_search.join(',').split(','));
|
||||
}
|
||||
});
|
||||
|
||||
frappe.search = {
|
||||
setup: function() {
|
||||
var opts = {
|
||||
|
|
|
|||
|
|
@ -1,91 +0,0 @@
|
|||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
|
||||
// recent document list
|
||||
frappe.ui.toolbar.Bookmarks = Class.extend({
|
||||
init:function() {
|
||||
$('.navbar .nav:first').append('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
|
||||
title="'+__("Bookmarks")+'"\
|
||||
onclick="return false;">'+__("Bookmarks")+'</a>\
|
||||
<ul class="dropdown-menu" id="toolbar-bookmarks">\
|
||||
<li class="divider"></li>\
|
||||
<li><a href="#" id="add-bookmark-link"><i class="icon-plus"></i> '
|
||||
+__('Add Bookmark')+'</a></li>\
|
||||
<li style="display: none" id="remove-bookmark-link"><a href="#"><i class="icon-minus"></i> '
|
||||
+__('Remove Bookmark')+'</a></li>\
|
||||
</ul>\
|
||||
</li>');
|
||||
|
||||
|
||||
this.setup();
|
||||
},
|
||||
setup: function() {
|
||||
var me = this;
|
||||
|
||||
this.bookmarks = frappe.defaults.get_default("_bookmarks") || [];
|
||||
for(var i=this.bookmarks.length-1; i>=0; i--) {
|
||||
var bookmark = this.bookmarks[i];
|
||||
this.add_item(bookmark.route, bookmark.title)
|
||||
}
|
||||
|
||||
$("#add-bookmark-link").click(function() {
|
||||
me.add(frappe.get_route_str(), document.title);
|
||||
return false;
|
||||
})
|
||||
|
||||
$("#remove-bookmark-link").click(function() {
|
||||
me.remove(frappe.get_route_str());
|
||||
me.save();
|
||||
me.show_hide_bookmark();
|
||||
return false;
|
||||
});
|
||||
|
||||
$(window).bind('hashchange', function() {
|
||||
me.show_hide_bookmark();
|
||||
});
|
||||
|
||||
me.show_hide_bookmark();
|
||||
},
|
||||
show_hide_bookmark: function() {
|
||||
$("#remove-bookmark-link").toggle(this.bookmarked(frappe.get_route_str()) ? true : false);
|
||||
},
|
||||
add_item: function(route, title) {
|
||||
var route_parts = decodeURIComponent(route).split("/");
|
||||
if(route_parts[0]==="List" || route_parts[0]==="Form") {
|
||||
var icon = frappe.boot.doctype_icons[route_parts[1]];
|
||||
} else {
|
||||
var icon = "icon-play";
|
||||
}
|
||||
var html = repl('<li><a href="#%(route)s"><i class="icon-fixed-width %(icon)s"></i> %(title)s</a></li>',
|
||||
{route: route, title: title, icon: icon});
|
||||
$('#toolbar-bookmarks').prepend(html);
|
||||
|
||||
},
|
||||
add: function(route, title) {
|
||||
// bring to front
|
||||
if(this.bookmarked(route)) {
|
||||
this.remove(route);
|
||||
}
|
||||
|
||||
// max length
|
||||
if(this.bookmarks.length >= 11) {
|
||||
this.remove(this.bookmarks[this.bookmarks.length-1].route);
|
||||
}
|
||||
|
||||
this.add_item(route, title);
|
||||
this.bookmarks = [{"route":route, "title":title}].concat(this.bookmarks);
|
||||
this.save();
|
||||
},
|
||||
bookmarked: function(route) {
|
||||
return frappe.utils.filter_dict(this.bookmarks, {"route": route}).length;
|
||||
},
|
||||
save: function() {
|
||||
frappe.defaults.set_default("_bookmarks", this.bookmarks);
|
||||
},
|
||||
remove: function(route) {
|
||||
this.bookmarks = $.map(this.bookmarks, function(d) {
|
||||
if(d.route!=route) return d; });
|
||||
$(repl('#toolbar-bookmarks li a[href="#%(route)s"]', {route:route})).parent().remove();
|
||||
},
|
||||
});
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
|
||||
frappe.ui.toolbar.NewDialog = frappe.ui.toolbar.SelectorDialog.extend({
|
||||
init: function() {
|
||||
this._super({
|
||||
title: __("New Record"),
|
||||
execute: function(val) {
|
||||
new_doc(val);
|
||||
},
|
||||
});
|
||||
|
||||
// get new types
|
||||
this.set_values(frappe.boot.user.can_create.join(',').split(','));
|
||||
}
|
||||
});
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
|
||||
// recent document list
|
||||
frappe.ui.toolbar.RecentDocs = Class.extend({
|
||||
init:function() {
|
||||
$('.navbar .nav:first').append('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
|
||||
title="'+__("History")+'"\
|
||||
onclick="return false;">'+__("History")+'</i></a>\
|
||||
<ul class="dropdown-menu" id="toolbar-recent"></ul>\
|
||||
</li>');
|
||||
this.setup();
|
||||
this.bind_events();
|
||||
},
|
||||
bind_events: function() {
|
||||
// notify on rename
|
||||
var me = this;
|
||||
$(document).bind('rename', function(event, dt, old_name, new_name) {
|
||||
me.rename_notify(dt, old_name, new_name)
|
||||
});
|
||||
},
|
||||
rename_notify: function(dt, old, name) {
|
||||
this.remove(dt, old);
|
||||
this.add(dt, name, 1);
|
||||
},
|
||||
add: function(dt, dn, on_top) {
|
||||
if(this.istable(dt)) return;
|
||||
|
||||
this.remove(dt, dn);
|
||||
var html = repl('<li data-docref="%(dt)s/%(dn)s">\
|
||||
<a href="#Form/%(dt_encoded)s/%(dn_encoded)s">\
|
||||
<i class="icon-fixed-width %(icon)s"></i> \
|
||||
%(dnshow)s</span>\
|
||||
</a></li>',
|
||||
{dt_encoded:encodeURIComponent(dt), dn_encoded:encodeURIComponent(dn),
|
||||
dt: dt, dn: dn,dnshow:__(dn), icon:frappe.boot.doctype_icons[dt]});
|
||||
if(on_top) {
|
||||
$('#toolbar-recent').prepend(html);
|
||||
} else {
|
||||
$('#toolbar-recent').append(html);
|
||||
}
|
||||
},
|
||||
istable: function(dt) {
|
||||
return locals.DocType[dt] && locals.DocType[dt].istable || false;
|
||||
},
|
||||
remove: function(dt, dn) {
|
||||
$(repl('#toolbar-recent li[data-docref="%(dt)s/%(dn)s"]', {dt:dt, dn:dn})).remove();
|
||||
},
|
||||
setup: function() {
|
||||
// add menu items
|
||||
if(!user) return;
|
||||
var rlist = JSON.parse(frappe.boot.user.recent||"[]");
|
||||
if(!rlist) return;
|
||||
var m = rlist.length;
|
||||
if(m>15)m=15;
|
||||
for (var i=0;i<m;i++) {
|
||||
var rd = rlist[i]
|
||||
if(rd[1]) {
|
||||
var dt = rd[0]; var dn = rd[1];
|
||||
try {
|
||||
this.add(dt, dn, 0);
|
||||
} catch(e) {
|
||||
// don't crash
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
|
||||
frappe.ui.toolbar.Report = frappe.ui.toolbar.SelectorDialog.extend({
|
||||
init: function() {
|
||||
this._super({
|
||||
title: __("Start Report For"),
|
||||
execute: function(val) {
|
||||
frappe.set_route('Report', val);
|
||||
},
|
||||
});
|
||||
|
||||
// get new types
|
||||
this.set_values(frappe.boot.user.can_get_report.join(',').split(','));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
|
||||
/*
|
||||
opts:
|
||||
|
||||
- title
|
||||
- execute
|
||||
|
||||
*/
|
||||
|
||||
frappe.provide('frappe.ui.toolbar');
|
||||
|
||||
frappe.ui.toolbar.SelectorDialog = Class.extend({
|
||||
init: function(opts) {
|
||||
this.opts = opts;
|
||||
this.make_dialog();
|
||||
this.bind_events();
|
||||
},
|
||||
make_dialog: function() {
|
||||
this.dialog = new frappe.ui.Dialog({
|
||||
title: this.opts.title,
|
||||
fields: [
|
||||
{fieldtype:'Select', fieldname:'doctype', options:'Select...', label:__('Select Type')},
|
||||
{fieldtype:'Button', label:'Go', fieldname:'go'}
|
||||
]
|
||||
});
|
||||
if(this.opts.help) {
|
||||
$("<div class='help'>"+this.opts.help+"</div>").appendTo(this.dialog.body);
|
||||
}
|
||||
},
|
||||
bind_events: function() {
|
||||
var me = this;
|
||||
|
||||
// on go
|
||||
$(this.dialog.fields_dict.go.input).click(function() {
|
||||
if(!me.dialog.display) return;
|
||||
me.dialog.hide();
|
||||
me.opts.execute(me.dialog.fields_dict.doctype.get_value());
|
||||
});
|
||||
|
||||
// on change
|
||||
$(this.dialog.fields_dict.doctype.input).change(function() {
|
||||
me.dialog.fields_dict.go.input.click();
|
||||
}).keypress(function(ev) {
|
||||
if(ev.which==13) {
|
||||
me.dialog.fields_dict.go.input.click();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
show: function() {
|
||||
this.dialog.show();
|
||||
this.dialog.fields_dict.doctype.input.focus();
|
||||
return false;
|
||||
},
|
||||
set_values: function(lst) {
|
||||
// convert to labels
|
||||
for(var i=0;i<lst.length;i++)
|
||||
lst[i]={label:__(lst[i]), value:lst[i]};
|
||||
|
||||
// set values
|
||||
var sel = this.dialog.fields_dict.doctype.input;
|
||||
$(sel).empty().add_options(lst.sort(function(a, b) {
|
||||
return (a.label > b.label ? 1 : -1) }));
|
||||
}
|
||||
})
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
|
||||
frappe.provide("frappe.ui.toolbar");
|
||||
|
||||
frappe.ui.toolbar.Toolbar = Class.extend({
|
||||
init: function() {
|
||||
|
|
@ -160,3 +161,17 @@ frappe.ui.toolbar.show_about = function() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
frappe.views.show_open_count_list = function(element) {
|
||||
var doctype = $(element).attr("data-doctype");
|
||||
var condition = frappe.boot.notification_info.conditions[doctype];
|
||||
if(condition) {
|
||||
frappe.route_options = condition;
|
||||
var route = frappe.get_route()
|
||||
if(route[0]==="List" && route[1]===doctype) {
|
||||
frappe.pages["List/" + doctype].doclistview.refresh();
|
||||
} else {
|
||||
frappe.set_route("List", doctype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ frappe.standard_replies = {};
|
|||
|
||||
frappe.views.CommunicationComposer = Class.extend({
|
||||
init: function(opts) {
|
||||
$.extend(this, opts)
|
||||
$.extend(this, opts);
|
||||
this.make();
|
||||
},
|
||||
make: function() {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ frappe.views.Container = Class.extend({
|
|||
// show new
|
||||
if(!this.page || this.page != page) {
|
||||
this.page = page;
|
||||
//$(this.page).fadeIn();
|
||||
// $(this.page).fadeIn(300);
|
||||
$(this.page).toggle(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,48 +12,6 @@ frappe.views.ModuleFactory = frappe.views.Factory.extend({
|
|||
},
|
||||
});
|
||||
|
||||
frappe.views.show_open_count_list = function(element) {
|
||||
var doctype = $(element).attr("data-doctype");
|
||||
var condition = frappe.boot.notification_info.conditions[doctype];
|
||||
if(condition) {
|
||||
frappe.route_options = condition;
|
||||
var route = frappe.get_route()
|
||||
if(route[0]==="List" && route[1]===doctype) {
|
||||
frappe.pages["List/" + doctype].doclistview.refresh();
|
||||
} else {
|
||||
frappe.set_route("List", doctype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frappe.get_module = function(m) {
|
||||
var module = frappe.modules[m];
|
||||
if (!module) {
|
||||
return;
|
||||
}
|
||||
|
||||
module.name = m;
|
||||
|
||||
if(module.type==="module" && !module.link) {
|
||||
module.link = "Module/" + m;
|
||||
}
|
||||
|
||||
if(module.link) {
|
||||
module._id = module.link.toLowerCase().replace("/", "-");
|
||||
}
|
||||
|
||||
if(!module.label) {
|
||||
module.label = m;
|
||||
}
|
||||
|
||||
if(!module._label) {
|
||||
module._label = __(module.label || module.name);
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
|
||||
frappe.views.moduleview.ModuleView = Class.extend({
|
||||
init: function(module) {
|
||||
this.module = module;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ $.extend(frappe.report_dump, {
|
|||
frappe.provide("frappe.views");
|
||||
frappe.views.GridReport = Class.extend({
|
||||
init: function(opts) {
|
||||
frappe.require("assets/js/slickgrid.min.js");
|
||||
frappe.assets.views["Report"]();
|
||||
|
||||
this.filter_inputs = {};
|
||||
this.preset_checks = [];
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ frappe.provide("frappe.query_reports");
|
|||
frappe.standard_pages["query-report"] = function() {
|
||||
var wrapper = frappe.container.add_page('query-report');
|
||||
|
||||
frappe.require("assets/js/slickgrid.min.js");
|
||||
frappe.assets.views["Report"]();
|
||||
|
||||
frappe.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ frappe.views.ReportViewPage = Class.extend({
|
|||
return;
|
||||
};
|
||||
|
||||
frappe.require("assets/js/slickgrid.min.js");
|
||||
|
||||
this.doctype = doctype;
|
||||
this.docname = docname;
|
||||
this.page_name = frappe.get_route_str();
|
||||
|
|
|
|||
|
|
@ -75,14 +75,14 @@
|
|||
z-index: 1021;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
max-height: 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
.transition(opacity .2s ease)
|
||||
}
|
||||
|
||||
.grid-row-open .form-in-grid {
|
||||
opacity: 1;
|
||||
max-height: 10000px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.grid-form-heading {
|
||||
|
|
|
|||
|
|
@ -1,42 +1,5 @@
|
|||
@import "variables.less";
|
||||
|
||||
.slick-wrapper, .slick-header {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.slick-headerrow {
|
||||
border: none;
|
||||
border-bottom: 1px solid @border-color;
|
||||
}
|
||||
|
||||
.slick-headerrow-column {
|
||||
background-color: @panel-bg !important;
|
||||
}
|
||||
|
||||
.slick-headerrow-column input {
|
||||
border: 1px solid @border-color;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
padding: 0px 3px !important;
|
||||
}
|
||||
|
||||
.slick-cell {
|
||||
border-color: @border-color !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.slick-header-column, .slick-header-columns {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
background-color: @panel-bg;
|
||||
border-color: @border-color !important;
|
||||
color: @text-muted !important;
|
||||
}
|
||||
|
||||
.slick-row.odd .slick-cell {
|
||||
background-color: @light-bg;
|
||||
}
|
||||
|
||||
// grid report
|
||||
.grid-report .plot {
|
||||
margin: 15px;
|
||||
|
|
|
|||
49
frappe/public/less/slickgrid.less
Normal file
49
frappe/public/less/slickgrid.less
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
@import "variables.less";
|
||||
|
||||
.slick-header-column, .slick-cell {
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.slick-wrapper, .slick-header {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.slick-headerrow {
|
||||
border: none;
|
||||
border-bottom: 1px solid @border-color;
|
||||
}
|
||||
|
||||
.slick-headerrow-column {
|
||||
background-color: @panel-bg !important;
|
||||
text-overflow: clip;
|
||||
}
|
||||
|
||||
.slick-headerrow-column input {
|
||||
border: 1px solid @border-color;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
padding: 0px 3px !important;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
.slick-cell {
|
||||
font-size: 12px;
|
||||
border-color: @border-color !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.slick-header-column, .slick-header-columns {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
background-color: @panel-bg;
|
||||
border-color: @border-color !important;
|
||||
color: @text-muted !important;
|
||||
}
|
||||
|
||||
.slick-row.odd .slick-cell {
|
||||
background-color: @light-bg;
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
href="{{ favicon or "/assets/frappe/images/favicon.ico" }}" type="image/x-icon">
|
||||
<link rel="icon"
|
||||
href="{{ favicon or "/assets/frappe/images/favicon.ico" }}" type="image/x-icon">
|
||||
<style>{% include "public/css/splash.css" %}</style>
|
||||
{% for include in include_css -%}
|
||||
<link type="text/css" rel="stylesheet" href="{{ include }}">
|
||||
{%- endfor -%}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue