@@ -8,27 +8,43 @@ wn.pages['applications'].onload = function(wrapper) { | |||||
wn.call({ | wn.call({ | ||||
method:"webnotes.core.page.applications.applications.get_app_list", | method:"webnotes.core.page.applications.applications.get_app_list", | ||||
callback: function(r) { | callback: function(r) { | ||||
var $main = $(wrapper).find(".layout-main") | |||||
var $main = $(wrapper).find(".layout-main"); | |||||
if(!keys(r.message).length) { | if(!keys(r.message).length) { | ||||
$main.html('<div class="alert alert-info">No Apps Installed</div>'); | $main.html('<div class="alert alert-info">No Apps Installed</div>'); | ||||
return; | return; | ||||
} | } | ||||
$main.empty(); | $main.empty(); | ||||
// search | |||||
$('<div class="row">\ | |||||
<div class="col-md-6">\ | |||||
<input type="text" class="form-control app-search" placeholder="Search" name="search"/>\ | |||||
</div>\ | |||||
</div><hr>').appendTo($main).find(".app-search").on("keyup", function() { | |||||
var val = $(this).val(); | |||||
$main.find(".app-listing").each(function() { | |||||
$(this).toggle($(this).attr("data-title").toLowerCase().indexOf(val)!==-1); | |||||
}); | |||||
}) | |||||
$.each(r.message, function(app_key, app) { | $.each(r.message, function(app_key, app) { | ||||
$.extend(app, app.app_icon); | |||||
$app = $($r('<div style="border-bottom: 1px solid #c7c7c7; margin-bottom: 10px;">\ | |||||
<div style="float: left; width: 50px;">\ | |||||
<span style="padding: 10px; background-color: %(app_color)s; \ | |||||
border-radius: 5px; display: inline-block; ">\ | |||||
<i class="%(app_icon)s icon-fixed-width" \ | |||||
style="font-size: 30px; color: white; \ | |||||
text-align: center; padding-right: 0px;"></i>\ | |||||
</span>\ | |||||
wn.modules[app_key] = { | |||||
label: app.app_title, | |||||
icon: app.app_icon, | |||||
color: app.app_color, | |||||
is_app: true | |||||
} | |||||
app.app_icon = wn.ui.app_icon.get_html(app_key); | |||||
$app = $($r('<div style="border-bottom: 1px solid #c7c7c7; margin-bottom: 10px;" \ | |||||
class="app-listing" data-title="%(app_title)s">\ | |||||
<div style="float: left; width: 80px;">\ | |||||
%(app_icon)s\ | |||||
</div>\ | </div>\ | ||||
<div style="margin-left: 70px;">\ | |||||
<div style="margin-left: 95px;">\ | |||||
<div class="row">\ | <div class="row">\ | ||||
<div class="col-xs-10">\ | <div class="col-xs-10">\ | ||||
<p><b>%(app_title)s</b></p>\ | |||||
<p><b class="title">%(app_title)s</b></p>\ | |||||
<p class="text-muted">%(app_description)s\ | <p class="text-muted">%(app_description)s\ | ||||
<br>Publisher: %(app_publisher)s; Version: %(app_version)s</p>\ | <br>Publisher: %(app_publisher)s; Version: %(app_version)s</p>\ | ||||
</div>\ | </div>\ | ||||
@@ -13,7 +13,8 @@ def get_app_list(): | |||||
app_hooks = webnotes.get_hooks(app_name=app) | app_hooks = webnotes.get_hooks(app_name=app) | ||||
for key in ("app_name", "app_title", "app_description", "app_icon", | for key in ("app_name", "app_title", "app_description", "app_icon", | ||||
"app_publisher", "app_version", "app_url", "app_color"): | "app_publisher", "app_version", "app_url", "app_color"): | ||||
out[app][key] = app_hooks.get(key) | |||||
val = app_hooks.get(key) or [] | |||||
out[app][key] = val[0] if len(val) else "" | |||||
if app in installed: | if app in installed: | ||||
out[app]["installed"] = 1 | out[app]["installed"] = 1 | ||||
@@ -10,21 +10,6 @@ | |||||
height: 100px; | height: 100px; | ||||
} | } | ||||
.case-border { | |||||
border-radius: 5px; | |||||
padding: 20px; | |||||
display: inline-block; | |||||
margin: auto; | |||||
text-align: center; | |||||
} | |||||
.case-wrapper i { | |||||
font-size: 32px; | |||||
min-width: 32px; | |||||
color: #f8f8f8; | |||||
display: inline-block; | |||||
} | |||||
.case-label { | .case-label { | ||||
color: white; | color: white; | ||||
padding-top: 5px; | padding-top: 5px; | ||||
@@ -32,33 +17,26 @@ | |||||
text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.6); | text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.6); | ||||
} | } | ||||
@media (max-width: 768px) { | @media (max-width: 768px) { | ||||
.case-wrapper { | .case-wrapper { | ||||
margin: 12px; | margin: 12px; | ||||
width: 70px; | width: 70px; | ||||
height: 80px; | height: 80px; | ||||
} | } | ||||
.case-border { | |||||
padding: 12px; | |||||
} | |||||
.case-label { | .case-label { | ||||
padding-top: 2px; | padding-top: 2px; | ||||
font-size: 85%; | font-size: 85%; | ||||
} | } | ||||
} | } | ||||
/* Hover and click effects */ | /* Hover and click effects */ | ||||
.case-border:hover, .hover-effect { | |||||
.app-icon:hover, .hover-effect { | |||||
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2); | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2); | ||||
-o-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2); | -o-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2); | ||||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2); | box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2); | ||||
} | } | ||||
.case-border:active, .case-border:focus, .case-border-click { | |||||
.app-icon:active, .app-icon:focus, .case-border-click { | |||||
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.3); | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.3); | ||||
-o-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.3); | -o-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.3); | ||||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.3); | box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.3); | ||||
@@ -1,7 +1,21 @@ | |||||
wn.provide('wn.core.pages.desktop'); | |||||
wn.provide('wn.desktop'); | |||||
wn.core.pages.desktop.refresh = function() { | |||||
wn.core.pages.desktop.render(); | |||||
wn.pages['desktop'].onload = function(wrapper) { | |||||
// setup dialog | |||||
// load desktop | |||||
wn.desktop.refresh(); | |||||
} | |||||
wn.pages['desktop'].refresh = function(wrapper) { | |||||
wn.ui.toolbar.add_dropdown_button("File", wn._("All Applications"), function() { | |||||
wn.desktop.show_all_modules(); | |||||
}, 'icon-th'); | |||||
} | |||||
wn.desktop.refresh = function() { | |||||
wn.desktop.render(); | |||||
$("#icon-grid").sortable({ | $("#icon-grid").sortable({ | ||||
update: function() { | update: function() { | ||||
@@ -14,60 +28,149 @@ wn.core.pages.desktop.refresh = function() { | |||||
}); | }); | ||||
} | } | ||||
wn.core.pages.desktop.render = function() { | |||||
wn.desktop.render = function() { | |||||
$("#icon-grid").empty(); | |||||
document.title = "Desktop"; | document.title = "Desktop"; | ||||
var add_icon = function(m) { | var add_icon = function(m) { | ||||
var module = wn.modules[m]; | var module = wn.modules[m]; | ||||
if(!module || !module.link) | |||||
if(!module || (!module.link && !module.onclick) || module.is_app) | |||||
return; | return; | ||||
if(!module.label) | |||||
module.label = m; | |||||
module.name = m; | |||||
module.label = wn._(module.label); | |||||
//module.gradient_css = wn.get_gradient_css(module.color, 45); | |||||
module._link = module.link.toLowerCase().replace("/", "-"); | |||||
if(module.link) | |||||
module._link = module.link.toLowerCase().replace("/", "-"); | |||||
module.app_icon = wn.ui.app_icon.get_html(m); | |||||
$module_icon = $(repl('<div id="module-icon-%(_link)s" class="case-wrapper" \ | $module_icon = $(repl('<div id="module-icon-%(_link)s" class="case-wrapper" \ | ||||
data-name="%(name)s" data-link="%(link)s">\ | |||||
<div id="module-count-%(_link)s" class="circle" style="display: None">\ | |||||
<span class="circle-text"></span>\ | |||||
</div>\ | |||||
<div class="case-border" style="background-color: %(color)s">\ | |||||
<i class="%(icon)s"></i>\ | |||||
</div>\ | |||||
<div class="case-label">%(label)s</div>\ | |||||
</div>', module)).click(function() { | |||||
data-name="%(name)s" data-link="%(link)s">\ | |||||
<div id="module-count-%(_link)s" class="circle" style="display: None">\ | |||||
<span class="circle-text"></span>\ | |||||
</div>\ | |||||
%(app_icon)s\ | |||||
<div class="case-label">%(_label)s</div>\ | |||||
</div>', module)).click(module.link ? function() { | |||||
var link = $(this).attr("data-link"); | var link = $(this).attr("data-link"); | ||||
if(link.substr(0, 1)==="/") { | |||||
window.open(link.substr(1)) | |||||
if(link) { | |||||
if(link.substr(0, 1)==="/") { | |||||
window.open(link.substr(1)) | |||||
} | |||||
wn.set_route(link); | |||||
} | } | ||||
wn.set_route(link); | |||||
}).css({ | |||||
} : module.onclick).css({ | |||||
cursor:"pointer" | cursor:"pointer" | ||||
}).appendTo("#icon-grid"); | }).appendTo("#icon-grid"); | ||||
} | } | ||||
// modules | // modules | ||||
var modules_list = wn.user.get_desktop_items(); | var modules_list = wn.user.get_desktop_items(); | ||||
var user_list = wn.user.get_user_desktop_items(); | |||||
$.each(modules_list, function(i, m) { | $.each(modules_list, function(i, m) { | ||||
if(m!="Setup") | |||||
add_icon(m); | |||||
var module = wn.modules[m]; | |||||
if(module) { | |||||
if(!module.label) { | |||||
module.label = m; | |||||
} | |||||
module.name = m; | |||||
module._label = wn._(module.label); | |||||
if(m!="Setup" && user_list.indexOf(m)!==-1) | |||||
add_icon(m); | |||||
} | |||||
}) | }) | ||||
// setup | // setup | ||||
if(user_roles.indexOf('System Manager')!=-1) | if(user_roles.indexOf('System Manager')!=-1) | ||||
add_icon('Setup') | add_icon('Setup') | ||||
// all applications | |||||
wn.modules["All Applications"] = { | |||||
icon: "icon-th", | |||||
label: "All Applications", | |||||
_label: wn._("All Applications"), | |||||
color: "#4aa3df", | |||||
link: "", | |||||
onclick: function() { | |||||
wn.desktop.show_all_modules(); | |||||
} | |||||
} | |||||
add_icon("All Applications") | |||||
// notifications | // notifications | ||||
wn.core.pages.desktop.show_pending_notifications(); | |||||
wn.desktop.show_pending_notifications(); | |||||
$(document).on("notification-update", function() { | $(document).on("notification-update", function() { | ||||
wn.core.pages.desktop.show_pending_notifications(); | |||||
wn.desktop.show_pending_notifications(); | |||||
}) | }) | ||||
} | } | ||||
wn.core.pages.desktop.show_pending_notifications = function() { | |||||
wn.desktop.show_all_modules = function() { | |||||
if(!wn.desktop.all_modules_dialog) { | |||||
var d = new wn.ui.Dialog({ | |||||
title: '<i class="icon-th text-muted"></i> All Applications' | |||||
}); | |||||
var desktop_items = wn.user.get_desktop_items(); | |||||
var user_desktop_items = wn.user.get_user_desktop_items(); | |||||
$('<input class="form-control desktop-app-search" \ | |||||
type="text" placeholder="Search Filter">') | |||||
.appendTo(d.body) | |||||
.on("keyup", function() { | |||||
var val = $(this).val(); | |||||
$(d.body).find(".list-group-item").each(function() { | |||||
$(this).toggle($(this).attr("data-label").toLowerCase().indexOf(val)!==-1); | |||||
}) | |||||
}); | |||||
$('<hr><p class="text-right text-muted text-small">'+wn._("Checked items shown on desktop")+'</p>') | |||||
.appendTo(d.body); | |||||
$wrapper = $('<div class="list-group">').appendTo(d.body); | |||||
// list of applications (wn.user.get_desktop_items()) | |||||
$.each(keys(wn.modules).sort(), function(i, m) { | |||||
var module = wn.modules[m]; | |||||
if(module.link && desktop_items.indexOf(m)!==-1) { | |||||
module.app_icon = wn.ui.app_icon.get_html(m, true); | |||||
$(repl('<div class="list-group-item" data-label="%(label)s">\ | |||||
<div class="row">\ | |||||
<div class="col-xs-2"><a href="#%(link)s">%(app_icon)s</a></div>\ | |||||
<div class="col-xs-10" style="padding-top: 14px;">\ | |||||
<a href="#%(link)s">%(label)s</a>\ | |||||
<input class="pull-right" type="checkbox" data-name="%(name)s" />\ | |||||
</div>\ | |||||
</div>\ | |||||
</div>', module)).appendTo($wrapper); | |||||
} | |||||
}); | |||||
// check shown items | |||||
$wrapper.find('[type="checkbox"]') | |||||
.on("click", function() { | |||||
// update user_desktop_items (when checked or un-checked) | |||||
var user_desktop_items = wn.user.get_user_desktop_items(); | |||||
var module = $(this).attr("data-name"); | |||||
if($(this).prop("checked")) { | |||||
user_desktop_items.push(module); | |||||
} else { | |||||
if(user_desktop_items.indexOf(module)!==-1) { | |||||
user_desktop_items.splice(user_desktop_items.indexOf(module), 1); | |||||
} | |||||
} | |||||
wn.defaults.set_default("_user_desktop_items", user_desktop_items); | |||||
wn.desktop.refresh(); | |||||
}) | |||||
.prop("checked", false); | |||||
$.each(user_desktop_items, function(i, m) { | |||||
$wrapper.find('[data-label="'+m+'"] [type="checkbox"]').prop("checked", true); | |||||
}) | |||||
wn.desktop.all_modules_dialog = d; | |||||
} | |||||
$(wn.desktop.all_modules_dialog.body).find(".desktop-app-search").val("").trigger("keyup"); | |||||
wn.desktop.all_modules_dialog.show(); | |||||
} | |||||
wn.desktop.show_pending_notifications = function() { | |||||
if (!wn.boot.notification_info.module_doctypes) { | if (!wn.boot.notification_info.module_doctypes) { | ||||
return; | return; | ||||
@@ -97,9 +200,3 @@ wn.core.pages.desktop.show_pending_notifications = function() { | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
pscript.onload_desktop = function(wrapper) { | |||||
// load desktop | |||||
wn.core.pages.desktop.refresh(); | |||||
} | |||||
@@ -1,205 +0,0 @@ | |||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | |||||
// MIT License. See license.txt | |||||
// todo | |||||
// - basic search in documents | |||||
wn.pages['finder'].onload = function(wrapper) { | |||||
wn.ui.make_app_page({ | |||||
parent: wrapper, | |||||
title: wn._('Finder'), | |||||
single_column: true | |||||
}); | |||||
wrapper.appframe.add_module_icon("Finder"); | |||||
var $body = $(wrapper).find(".layout-main").addClass("row"); | |||||
var start = 0, | |||||
doctype = null, | |||||
module = null; | |||||
var get_col = function(colsize, icon, label, panel_class) { | |||||
return $('<div class="col-sm-'+colsize+'">\ | |||||
<div class="panel panel-'+panel_class+'">\ | |||||
<div class="panel-heading"><i class="icon-'+icon+'"></i> \ | |||||
<span class="col-heading">'+label+'</span>\ | |||||
<span class="pull-right"></span>\ | |||||
</div>\ | |||||
<div class="list-group">\ | |||||
</div>\ | |||||
</div>\ | |||||
</div>').appendTo($body); | |||||
} | |||||
var $modules = get_col(3, "briefcase", wn._("Modules"), "default").find(".list-group"); | |||||
var $doctypes = get_col(3, "folder-close", wn._("Document Types"), "default").find(".list-group"); | |||||
var $list = get_col(6, "file", wn._("Documents"), "info"); | |||||
var $doctype_label = $list.find(".col-heading") | |||||
var $list_link = $list.find(".panel-heading .pull-right") | |||||
.append('<a class="list-link"><i class="icon-list"></i></a>') | |||||
.find(".list-link") | |||||
.click(function() { wn.set_route("List", doctype); }) | |||||
.toggle(false); | |||||
var $new_link = $list.find(".panel-heading .pull-right") | |||||
.append(' <a class="new-link"><i class="icon-plus"></i></a>') | |||||
.find(".new-link") | |||||
.click(function() { new_doc(doctype); }) | |||||
.toggle(false); | |||||
$list = $list.find(".list-group"); | |||||
var reset_module = function() { | |||||
$doctypes.empty(); | |||||
$('<div class="list-group-item row-select text-muted text-center">'+ | |||||
wn._("Select Module")+'</div>').appendTo($doctypes); | |||||
module = null; | |||||
reset_doctype(); | |||||
} | |||||
var reset_doctype = function() { | |||||
$list.empty(); | |||||
$new_link.toggle(false); | |||||
$list_link.toggle(false); | |||||
$doctype_label.html(wn._("Documents")); | |||||
$('<div class="list-group-item row-select text-muted text-center">'+ | |||||
wn._("Select Document Type")+'</div>').appendTo($list); | |||||
start=0; | |||||
} | |||||
reset_module(); | |||||
// modules | |||||
$.each(keys(wn.boot.notification_info.module_doctypes).sort(), function(i, module) { | |||||
$($r('<a class="list-group-item row-select module-link" \ | |||||
data-module="%(module)s">%(module)s\ | |||||
<span class="pull-right"><i class="icon-chevron-right"></i></span></a>', | |||||
{module: module})).appendTo($modules); | |||||
}); | |||||
$modules.on("click", ".module-link", function() { | |||||
// list doctypes | |||||
reset_module(); | |||||
// select module | |||||
$modules.find(".list-group-item.active").removeClass("active"); | |||||
$(this).addClass("active"); | |||||
// show doctypes | |||||
$doctypes.find(".row-select").remove(); | |||||
module = $(this).attr("data-module"); | |||||
$.each(wn.boot.notification_info.module_doctypes[module].sort(), function(i, doctype) { | |||||
$($r('<a class="list-group-item doctype-link" \ | |||||
data-doctype="%(doctype)s">%(doctype)s\ | |||||
<span class="pull-right"><i class="icon-chevron-right"></i></a>', | |||||
{doctype: doctype})).appendTo($doctypes) | |||||
}); | |||||
}); | |||||
$doctypes.on("click", ".doctype-link", function() { | |||||
reset_doctype(); | |||||
// select doctype | |||||
$doctypes.find(".list-group-item.active").removeClass("active"); | |||||
$(this).addClass("active"); | |||||
doctype = $(this).attr("data-doctype"); | |||||
// label | |||||
$doctype_label.html(wn._(doctype)); | |||||
// new link | |||||
$new_link.toggle(!!wn.model.can_create(doctype)); | |||||
$list_link.toggle(!!wn.model.can_read(doctype)); | |||||
render_list(); | |||||
}) | |||||
$list.on("click", ".btn-more", function() { | |||||
start = start+20; | |||||
render_list(); | |||||
}); | |||||
$list.on("click", ".btn-search", function() { | |||||
filter_list(); | |||||
}) | |||||
$list.on("keypress", ".input-search", function(e) { | |||||
if(e.which===13) | |||||
filter_list(); | |||||
}) | |||||
var filter_list = function() { | |||||
start = 0; | |||||
$list.find(".document-item, .row-empty").remove(); | |||||
render_list(); | |||||
} | |||||
var render_list = function() { | |||||
// remove more btn if any | |||||
$list.find(".row-more, .row-select").remove(); | |||||
// loading indicator... | |||||
add_list_row('<i class="icon-refresh icon-spin text-muted"></i>') | |||||
.addClass("row-loading text-center") | |||||
var args = { | |||||
doctype: doctype, | |||||
fields: ["name", "modified", "owner"], | |||||
limit_start: start || 0, | |||||
limit_page_length: 20 | |||||
}; | |||||
if($(".input-search").val()) { | |||||
args.filters = [[doctype, "name", "like", "%" + $(".input-search").val() + "%"]] | |||||
} | |||||
wn.call({ | |||||
method: "webnotes.widgets.reportview.get", | |||||
args: args, | |||||
callback: function(r) { | |||||
$list.find(".row-loading").remove(); | |||||
if(!$list.find(".input-search").length) { | |||||
// make search | |||||
$('<div class="list-group-item">\ | |||||
<div class="input-group">\ | |||||
<input type="text" class="form-control input-search">\ | |||||
<span class="input-group-btn">\ | |||||
<button class="btn btn-default btn-search" type="button">\ | |||||
<i class="icon-search"></i></button>\ | |||||
</span>\ | |||||
</div>\ | |||||
</div>').appendTo($list); | |||||
} | |||||
if(r.message.values) { | |||||
$.each(r.message.values, function(i, v) { | |||||
$($r('<a class="list-group-item document-item" \ | |||||
data-name="%(name)s" href="#Form/%(doctype)s/%(name)s">%(name)s\ | |||||
<span class="text-muted text-small">%(owner)s</span>\ | |||||
<span class="text-muted pull-right">%(modified)s</span></a>', { | |||||
doctype: doctype, | |||||
name: v[1], | |||||
owner: v[0], | |||||
modified: comment_when(v[2]) | |||||
})).appendTo($list); | |||||
}) | |||||
if(r.message.values.length==20) { | |||||
add_list_row('More...').addClass("row-more text-center btn-more text-muted"); | |||||
} | |||||
} else { | |||||
add_list_row('<i class="icon-ban-circle"></i>').addClass("text-center text-muted row-empty"); | |||||
} | |||||
} | |||||
}) | |||||
} | |||||
var add_list_row = function(html) { | |||||
return $('<a class="list-group-item">'+html+'</a>').appendTo($list); | |||||
} | |||||
} |
@@ -1,33 +0,0 @@ | |||||
[ | |||||
{ | |||||
"creation": "2013-09-06 11:53:22", | |||||
"docstatus": 0, | |||||
"modified": "2013-09-06 16:33:10", | |||||
"modified_by": "Administrator", | |||||
"owner": "Administrator" | |||||
}, | |||||
{ | |||||
"doctype": "Page", | |||||
"icon": "icon-folder-open", | |||||
"module": "Core", | |||||
"name": "__common__", | |||||
"page_name": "Finder", | |||||
"standard": "Yes", | |||||
"title": "Finder" | |||||
}, | |||||
{ | |||||
"doctype": "Page Role", | |||||
"name": "__common__", | |||||
"parent": "finder", | |||||
"parentfield": "roles", | |||||
"parenttype": "Page", | |||||
"role": "All" | |||||
}, | |||||
{ | |||||
"doctype": "Page", | |||||
"name": "finder" | |||||
}, | |||||
{ | |||||
"doctype": "Page Role" | |||||
} | |||||
] |
@@ -21,7 +21,7 @@ wn.modules_setup = { | |||||
$('#modules-list').empty(); | $('#modules-list').empty(); | ||||
$.each(keys(wn.modules).sort(), function(i, m) { | $.each(keys(wn.modules).sort(), function(i, m) { | ||||
if(m!="Setup") { | |||||
if(m!="Setup" && !wn.modules[m].is_app) { | |||||
var $chk = $("<input type='checkbox' data-module='"+m+"' style='margin-top: -2px'>") | var $chk = $("<input type='checkbox' data-module='"+m+"' style='margin-top: -2px'>") | ||||
.prependTo($('<p><span> '+m+'</span></p>').appendTo("#modules-list")); | .prependTo($('<p><span> '+m+'</span></p>').appendTo("#modules-list")); | ||||
if(!wn.boot.hidden_modules || wn.boot.hidden_modules.indexOf(m)==-1) { | if(!wn.boot.hidden_modules || wn.boot.hidden_modules.indexOf(m)==-1) { | ||||
@@ -6,13 +6,6 @@ | |||||
"link": "Calendar/Event", | "link": "Calendar/Event", | ||||
"type": "view" | "type": "view" | ||||
}, | }, | ||||
"Finder": { | |||||
"color": "#14C7DE", | |||||
"icon": "icon-folder-open", | |||||
"label": "Finder", | |||||
"link": "finder", | |||||
"type": "page" | |||||
}, | |||||
"Messages": { | "Messages": { | ||||
"color": "#9b59b6", | "color": "#9b59b6", | ||||
"icon": "icon-comments", | "icon": "icon-comments", | ||||
@@ -1,8 +1,8 @@ | |||||
app_name = webnotes | app_name = webnotes | ||||
app_title = Web Notes | |||||
app_title = Frappe Framework | |||||
app_publisher = Web Notes Technologies | app_publisher = Web Notes Technologies | ||||
app_description = Full Stack Web Application Framwork in Python | app_description = Full Stack Web Application Framwork in Python | ||||
app_icon = icon-cog | |||||
app_icon = assets/webnotes/images/frappe.svg | |||||
app_version = 4.0.0-wip | app_version = 4.0.0-wip | ||||
app_color = #3498db | app_color = #3498db | ||||
@@ -40,4 +40,4 @@ permission_query_conditions:Event = webnotes.core.doctype.event.event.get_permis | |||||
has_permission:Event = webnotes.core.doctype.event.event.has_permission | has_permission:Event = webnotes.core.doctype.event.event.has_permission | ||||
permission_query_conditions:ToDo = webnotes.core.doctype.todo.todo.get_permission_query_conditions | permission_query_conditions:ToDo = webnotes.core.doctype.todo.todo.get_permission_query_conditions | ||||
has_permission:ToDo = webnotes.core.doctype.todo.todo.has_permission | |||||
has_permission:ToDo = webnotes.core.doctype.todo.todo.has_permission |
@@ -34,8 +34,12 @@ | |||||
"public/css/bootstrap.css", | "public/css/bootstrap.css", | ||||
"public/css/bootstrap-responsive.css", | "public/css/bootstrap-responsive.css", | ||||
"public/css/font-awesome.css", | "public/css/font-awesome.css", | ||||
"public/css/forms.css", | |||||
"public/css/common.css", | |||||
"public/css/app.css", | |||||
"public/css/appframe.css", | |||||
"public/css/app_icon.css", | |||||
"public/css/avatar.css", | |||||
"public/css/navbar.css", | |||||
"public/css/slickgrid.css", | |||||
"public/css/tree_grid.css", | "public/css/tree_grid.css", | ||||
"public/css/nprogress.css" | "public/css/nprogress.css" | ||||
], | ], | ||||
@@ -74,6 +78,7 @@ | |||||
"public/js/wn/ui/field_group.js", | "public/js/wn/ui/field_group.js", | ||||
"public/js/wn/ui/dialog.js", | "public/js/wn/ui/dialog.js", | ||||
"public/js/wn/ui/button.js", | "public/js/wn/ui/button.js", | ||||
"public/js/wn/ui/app_icon.js", | |||||
"public/js/wn/model/model.js", | "public/js/wn/model/model.js", | ||||
"public/js/wn/model/meta.js", | "public/js/wn/model/meta.js", | ||||
@@ -92,7 +97,6 @@ | |||||
"public/js/wn/upload.js", | "public/js/wn/upload.js", | ||||
"public/js/wn/ui/filters.js", | "public/js/wn/ui/filters.js", | ||||
"public/js/wn/ui/search.js", | |||||
"public/js/wn/ui/tree.js", | "public/js/wn/ui/tree.js", | ||||
"public/js/wn/ui/tags.js", | "public/js/wn/ui/tags.js", | ||||
@@ -166,196 +166,6 @@ div#freeze { | |||||
width: 0px; | width: 0px; | ||||
} | } | ||||
/* appframe header */ | |||||
.appframe { | |||||
padding-top: 15px; | |||||
} | |||||
.appframe-titlebar { | |||||
min-height: 30px; | |||||
background-color: #e7e7e7; | |||||
} | |||||
.titlebar-item { | |||||
padding-top: 10px; | |||||
padding-bottom: 10px; | |||||
} | |||||
.titlebar-item h4 { | |||||
width: 100%; | |||||
white-space: nowrap; | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
margin: 0px; | |||||
} | |||||
.titlebar-center-item { | |||||
} | |||||
.appframe-header { | |||||
margin-bottom: 20px; | |||||
} | |||||
.appframe-toolbar { | |||||
margin-bottom: 0px; | |||||
} | |||||
.appframe-header .status-bar { | |||||
text-align: right; | |||||
} | |||||
/* fixed navbar in appframe */ | |||||
.appframe .navbar { | |||||
margin-left: -15px; | |||||
margin-right: -15px; | |||||
margin-bottom: 0px; | |||||
border-radius: 0px; | |||||
border-bottom: 1px solid #e7e7e7; | |||||
min-height: 51px; | |||||
} | |||||
.appframe .navbar-form select, | |||||
.appframe .navbar-form input, | |||||
.appframe .navbar-form button, | |||||
.appframe .navbar-form label { | |||||
margin-bottom: 5px; | |||||
} | |||||
.appframe .navbar-form { | |||||
margin-bottom: 2px; | |||||
width: 100%; | |||||
} | |||||
.appframe-iconbar, .appframe-form { | |||||
border-bottom: 1px solid #c7c7c7; | |||||
} | |||||
.appframe-form { | |||||
padding: 5px 0px; | |||||
} | |||||
.appframe-form input, .appframe-form select, .appframe-form label { | |||||
font-size: 90%; | |||||
padding: 4px; | |||||
margin: 3px 0px; | |||||
} | |||||
.appframe-form .form-group { | |||||
margin-bottom: 0px; | |||||
} | |||||
.appframe-form .form-control { | |||||
height: 28px; | |||||
} | |||||
.iconbar { | |||||
display: inline-block; | |||||
padding: 9px 0px; | |||||
} | |||||
.iconbar ul { | |||||
list-style: none; | |||||
margin: 0 0 0 0; | |||||
padding: 0 0 0 0; | |||||
} | |||||
.iconbar li { | |||||
display: inline-block; | |||||
padding-left: 4px; | |||||
padding-right: 4px; | |||||
} | |||||
.iconbar i { | |||||
margin-top: 4px; | |||||
margin-right: 4px; | |||||
color: #888; | |||||
cursor: pointer; | |||||
font-size: 16px; | |||||
} | |||||
.iconbar i:hover { | |||||
color: #000; | |||||
} | |||||
.iconbar i:active { | |||||
color: #5bc0de; | |||||
} | |||||
.iconbar .appframe-iconbar-active i { | |||||
font-weight: bold; | |||||
color: orange; | |||||
} | |||||
.appframe-titlebar .title-text { | |||||
font-weight: bold; | |||||
} | |||||
.appframe-footer { | |||||
margin-top: 15px; | |||||
} | |||||
/* home icon in main nav */ | |||||
.navbar-icon-home { | |||||
vertical-align: middle; | |||||
} | |||||
.navbar-icon-home:hover, | |||||
.navbar-icon-home:focus, | |||||
.navbar-icon-home:active, | |||||
.navbar-icon-home-hover{ | |||||
opacity:1; | |||||
Filter:alpha(opacity=100); /* For IE8 and earlier */ | |||||
} | |||||
.navbar .brand { | |||||
max-height: 15px; | |||||
} | |||||
.navbar-brand { | |||||
min-height: 20px; | |||||
height: auto; | |||||
} | |||||
.navbar #spinner { | |||||
display: block; | |||||
float: right; | |||||
width: 20px; | |||||
margin-bottom: -5px; | |||||
margin-top: 14px; | |||||
visibility: hidden; | |||||
} | |||||
.navbar-new-comments { | |||||
margin: -3px 0px; | |||||
padding: 2px 5px; | |||||
min-width: 20px; | |||||
text-align: center; | |||||
display: inline-block; | |||||
border-radius: 2px; | |||||
color: #999999; | |||||
background-color: #333131; | |||||
} | |||||
.navbar-new-comments:hover, | |||||
.navbar-new-comments:active, | |||||
.navbar-new-comments:focus { | |||||
color: #fff; | |||||
} | |||||
.navbar-new-comments-true { | |||||
color: #fff; | |||||
background-color: #e74c3c; | |||||
} | |||||
.btn [class^="icon-"], .nav [class^="icon-"], .btn [class*=" icon-"], .nav [class*=" icon-"] { | |||||
display: inline-block; | |||||
} | |||||
.badge-important { | .badge-important { | ||||
background-color: #e74c3c; | background-color: #e74c3c; | ||||
@@ -394,58 +204,6 @@ div#freeze { | |||||
white-space: nowrap; | white-space: nowrap; | ||||
} | } | ||||
/* avatar */ | |||||
.avatar { | |||||
display: inline-block; | |||||
vertical-align: middle; | |||||
border-radius: 50%; | |||||
overflow: hidden; | |||||
background-color: #ddd; | |||||
border: 1px solid #eee; | |||||
} | |||||
.avatar img { | |||||
width: 100%; | |||||
height: auto; | |||||
} | |||||
.avatar-small { | |||||
margin-right: 5px; | |||||
width: 30px; | |||||
height: 30px; | |||||
} | |||||
.avatar-large { | |||||
margin-right: 10px; | |||||
width: 72px; | |||||
height: 72px; | |||||
} | |||||
/* slickgrid */ | |||||
.slick-cell { | |||||
font-size: 12px; | |||||
} | |||||
.slick-header-column, .slick-cell { | |||||
-webkit-box-sizing: content-box; | |||||
-moz-box-sizing: content-box; | |||||
box-sizing: content-box; | |||||
} | |||||
.slick-headerrow-column { | |||||
background: #87ceeb; | |||||
text-overflow: clip; | |||||
} | |||||
.slick-headerrow-column input { | |||||
margin: 0; | |||||
padding: 0; | |||||
width: 100%; | |||||
min-height: 20px; | |||||
} | |||||
.missing-image { | .missing-image { | ||||
background-color: #eee; | background-color: #eee; | ||||
display: table-cell; | display: table-cell; | ||||
@@ -590,4 +348,11 @@ ul.linked-with-list li { | |||||
padding: 2px 5px; | padding: 2px 5px; | ||||
margin-left: 15px; | margin-left: 15px; | ||||
border-radius: 3px; | border-radius: 3px; | ||||
background-color: #ddd; | |||||
background-color: #ddd; | |||||
} | |||||
.print-preview { | |||||
padding: 50px 20px; | |||||
margin: 0px -15px; | |||||
box-shadow: 1px 1px 5px rgba(0,0,0,0.5); | |||||
} |
@@ -0,0 +1,34 @@ | |||||
.app-icon { | |||||
border-radius: 5px; | |||||
padding: 20px; | |||||
display: inline-block; | |||||
margin: auto; | |||||
text-align: center; | |||||
} | |||||
.app-icon i { | |||||
font-size: 30px; | |||||
min-width: 30px; | |||||
color: #f8f8f8; | |||||
display: inline-block; | |||||
} | |||||
.app-icon svg { | |||||
height: 30px; | |||||
width: 30px; | |||||
} | |||||
.app-icon path { | |||||
fill: #f8f8f8; | |||||
} | |||||
.app-icon-small { | |||||
padding: 12px; | |||||
} | |||||
@media (max-width: 768px) { | |||||
.app-icon { | |||||
padding: 12px; | |||||
} | |||||
} |
@@ -0,0 +1,131 @@ | |||||
/* appframe header */ | |||||
.appframe { | |||||
padding-top: 15px; | |||||
} | |||||
.appframe-titlebar { | |||||
min-height: 30px; | |||||
background-color: #e7e7e7; | |||||
} | |||||
.titlebar-item { | |||||
padding-top: 10px; | |||||
padding-bottom: 10px; | |||||
} | |||||
.titlebar-item h4 { | |||||
width: 100%; | |||||
white-space: nowrap; | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
margin: 0px; | |||||
} | |||||
.titlebar-center-item { | |||||
} | |||||
.appframe-header { | |||||
margin-bottom: 20px; | |||||
} | |||||
.appframe-toolbar { | |||||
margin-bottom: 0px; | |||||
} | |||||
.appframe-header .status-bar { | |||||
text-align: right; | |||||
} | |||||
/* fixed navbar in appframe */ | |||||
.appframe .navbar { | |||||
margin-left: -15px; | |||||
margin-right: -15px; | |||||
margin-bottom: 0px; | |||||
border-radius: 0px; | |||||
border-bottom: 1px solid #e7e7e7; | |||||
min-height: 51px; | |||||
} | |||||
.appframe .navbar-form select, | |||||
.appframe .navbar-form input, | |||||
.appframe .navbar-form button, | |||||
.appframe .navbar-form label { | |||||
margin-bottom: 5px; | |||||
} | |||||
.appframe .navbar-form { | |||||
margin-bottom: 2px; | |||||
width: 100%; | |||||
} | |||||
.appframe-iconbar, .appframe-form { | |||||
border-bottom: 1px solid #c7c7c7; | |||||
} | |||||
.appframe-form { | |||||
padding: 5px 0px; | |||||
} | |||||
.appframe-form input, .appframe-form select, .appframe-form label { | |||||
font-size: 90%; | |||||
padding: 4px; | |||||
margin: 3px 0px; | |||||
} | |||||
.appframe-form .form-group { | |||||
margin-bottom: 0px; | |||||
} | |||||
.appframe-form .form-control { | |||||
height: 28px; | |||||
} | |||||
.iconbar { | |||||
display: inline-block; | |||||
padding: 9px 0px; | |||||
} | |||||
.iconbar ul { | |||||
list-style: none; | |||||
margin: 0 0 0 0; | |||||
padding: 0 0 0 0; | |||||
} | |||||
.iconbar li { | |||||
display: inline-block; | |||||
padding-left: 4px; | |||||
padding-right: 4px; | |||||
} | |||||
.iconbar i { | |||||
margin-top: 4px; | |||||
margin-right: 4px; | |||||
color: #888; | |||||
cursor: pointer; | |||||
font-size: 16px; | |||||
} | |||||
.iconbar i:hover { | |||||
color: #000; | |||||
} | |||||
.iconbar i:active { | |||||
color: #5bc0de; | |||||
} | |||||
.iconbar .appframe-iconbar-active i { | |||||
font-weight: bold; | |||||
color: orange; | |||||
} | |||||
.appframe-titlebar .title-text { | |||||
font-weight: bold; | |||||
} | |||||
.appframe-footer { | |||||
margin-top: 15px; | |||||
} |
@@ -0,0 +1,25 @@ | |||||
.avatar { | |||||
display: inline-block; | |||||
vertical-align: middle; | |||||
border-radius: 50%; | |||||
overflow: hidden; | |||||
background-color: #ddd; | |||||
border: 1px solid #eee; | |||||
} | |||||
.avatar img { | |||||
width: 100%; | |||||
height: auto; | |||||
} | |||||
.avatar-small { | |||||
margin-right: 5px; | |||||
width: 30px; | |||||
height: 30px; | |||||
} | |||||
.avatar-large { | |||||
margin-right: 10px; | |||||
width: 72px; | |||||
height: 72px; | |||||
} |
@@ -1,132 +0,0 @@ | |||||
/* FORMS */ | |||||
div.form-title { | |||||
/*background-color: #e0eeff;*/ | |||||
padding: 5px 19px 15px 19px; | |||||
border-bottom: 1px solid #eee; | |||||
} | |||||
.appframe-titlebar .label { | |||||
vertical-align: middle; | |||||
margin-right: 7px; | |||||
} | |||||
div.form-section-head { | |||||
border-top: 1px solid #ccc; | |||||
padding: 11px 23px 0px 23px; | |||||
} | |||||
div.form-layout-row:first-child .form-section-head { | |||||
border-top: 0px solid #ccc !important; | |||||
margin-top: 0px; | |||||
padding-top: 0px; | |||||
} | |||||
div.form-section-head h3 { | |||||
line-height: 20px; | |||||
} | |||||
div.form-section-head hr { | |||||
margin: 9px 0px; | |||||
} | |||||
div.frm_print_wrapper { | |||||
background-color:#FFF; | |||||
border:1px solid #444; | |||||
padding: 40px; | |||||
box-shadow:1px 1px 8px #229; | |||||
-moz-box-shadow: 1px 1px 8px #229; | |||||
-webkit-box-shadow: 1px 1px 8px #229; | |||||
} | |||||
div.page_break { | |||||
margin: 24px 0px; | |||||
border-top: 1px dashed #888; | |||||
} | |||||
div.dialog_frm { | |||||
position: relative; | |||||
margin: 10px; | |||||
} | |||||
.top_cell { | |||||
height: 50px; | |||||
} | |||||
div.attach_area { | |||||
padding: 8px; | |||||
margin: 8px; | |||||
background-color: #EEE; | |||||
} | |||||
div.attach_area table { | |||||
width: 100%; | |||||
} | |||||
.tablabel_normal { | |||||
margin: 0 4px 0 0; | |||||
padding: 3px 5px; | |||||
line-height: 1.3em; | |||||
display: inline; | |||||
cursor: pointer; | |||||
} | |||||
.tablabel_selected { | |||||
margin: 0 4px 0 0; | |||||
padding: 3px 5px; | |||||
line-height: 1.3em; | |||||
font-weight: bold; | |||||
display: inline; | |||||
cursor: pointer; | |||||
color: #000; | |||||
} | |||||
.sectionCell { | |||||
padding: 5px; | |||||
vertical-align: top; | |||||
} | |||||
.code_area { | |||||
width: 80%; | |||||
margin: 8px; | |||||
padding: 4px; | |||||
background-color: #F8F8F8; | |||||
border: 1px solid #CCC; | |||||
overflow-x: auto; | |||||
} | |||||
.code_text { | |||||
width: 100%; | |||||
height: 360px; | |||||
margin-top: 3px; | |||||
font-family: Courier, Fixed; | |||||
font-size: 12px; | |||||
} | |||||
div.time_field select{ | |||||
display: inline; | |||||
margin: 2px; | |||||
width: 45px; | |||||
} | |||||
/* sidebar */ | |||||
div.sidebar-comment-wrapper input { | |||||
width: 70%; | |||||
} | |||||
div.sidebar-comment-message { | |||||
margin-top: 8px; | |||||
color: #777; | |||||
} | |||||
div.sidebar-comment-text { | |||||
font-size: 12px; | |||||
font-weight: bold; | |||||
margin-top: 8px; | |||||
color: #444; | |||||
} | |||||
div.sidebar-comment-info { | |||||
color: #777; | |||||
} |
@@ -0,0 +1,56 @@ | |||||
.navbar-icon-home { | |||||
vertical-align: middle; | |||||
} | |||||
.navbar-icon-home:hover, | |||||
.navbar-icon-home:focus, | |||||
.navbar-icon-home:active, | |||||
.navbar-icon-home-hover{ | |||||
opacity:1; | |||||
Filter:alpha(opacity=100); /* For IE8 and earlier */ | |||||
} | |||||
.navbar .brand { | |||||
max-height: 15px; | |||||
} | |||||
.navbar-brand { | |||||
min-height: 20px; | |||||
height: auto; | |||||
} | |||||
.navbar #spinner { | |||||
display: block; | |||||
float: right; | |||||
width: 20px; | |||||
margin-bottom: -5px; | |||||
margin-top: 14px; | |||||
visibility: hidden; | |||||
} | |||||
.navbar-new-comments { | |||||
margin: -3px 0px; | |||||
padding: 2px 5px; | |||||
min-width: 20px; | |||||
text-align: center; | |||||
display: inline-block; | |||||
border-radius: 2px; | |||||
color: #999999; | |||||
background-color: #333131; | |||||
} | |||||
.navbar-new-comments:hover, | |||||
.navbar-new-comments:active, | |||||
.navbar-new-comments:focus { | |||||
color: #fff; | |||||
} | |||||
.navbar-new-comments-true { | |||||
color: #fff; | |||||
background-color: #e74c3c; | |||||
} | |||||
.btn [class^="icon-"], .nav [class^="icon-"], .btn [class*=" icon-"], .nav [class*=" icon-"] { | |||||
display: inline-block; | |||||
} |
@@ -0,0 +1,21 @@ | |||||
.slick-cell { | |||||
font-size: 12px; | |||||
} | |||||
.slick-header-column, .slick-cell { | |||||
-webkit-box-sizing: content-box; | |||||
-moz-box-sizing: content-box; | |||||
box-sizing: content-box; | |||||
} | |||||
.slick-headerrow-column { | |||||
background: #87ceeb; | |||||
text-overflow: clip; | |||||
} | |||||
.slick-headerrow-column input { | |||||
margin: 0; | |||||
padding: 0; | |||||
width: 100%; | |||||
min-height: 20px; | |||||
} |
@@ -1,45 +0,0 @@ | |||||
.typeahead, | |||||
.tt-query, | |||||
.tt-hint { | |||||
} | |||||
.tt-hint { | |||||
color: #999; | |||||
} | |||||
.tt-dropdown-menu { | |||||
width: 100%; | |||||
margin-top: 3px; | |||||
padding: 3px 0; | |||||
background-color: #fff; | |||||
border: 1px solid #ccc; | |||||
border: 1px solid rgba(0, 0, 0, 0.2); | |||||
-webkit-border-radius: 8px; | |||||
-moz-border-radius: 8px; | |||||
border-radius: 8px; | |||||
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2); | |||||
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2); | |||||
box-shadow: 0 5px 10px rgba(0,0,0,.2); | |||||
} | |||||
.tt-suggestion { | |||||
padding: 3px 20px; | |||||
} | |||||
.tt-suggestion.tt-is-under-cursor { | |||||
color: #fff; | |||||
background-color: #0097cf; | |||||
} | |||||
.tt-suggestion.tt-is-under-cursor .text-muted { | |||||
color: #ddd; | |||||
} | |||||
.input-group input.tt-query { | |||||
border-top-left-radius: 4px !important; | |||||
border-bottom-left-radius: 4px !important; | |||||
} | |||||
.tt-suggestion p { | |||||
margin: 0; | |||||
} |
@@ -71,8 +71,8 @@ $.extend(wn.user, { | |||||
if(modules_list) { | if(modules_list) { | ||||
// add missing modules - they will be hidden anyways by the view | // add missing modules - they will be hidden anyways by the view | ||||
$.each(wn.modules, function(m, data) { | |||||
if(modules_list.indexOf(m)==-1) { | |||||
$.each(wn.modules, function(m, module) { | |||||
if(module.link && modules_list.indexOf(m)==-1) { | |||||
modules_list.push(m); | modules_list.push(m); | ||||
} | } | ||||
}); | }); | ||||
@@ -122,6 +122,13 @@ $.extend(wn.user, { | |||||
return modules_list; | return modules_list; | ||||
}, | }, | ||||
get_user_desktop_items: function() { | |||||
var user_list = wn.defaults.get_default("_user_desktop_items"); | |||||
if(!user_list) { | |||||
user_list = ["Calendar", "To Do", "Activity", "Messages"]; | |||||
} | |||||
return user_list; | |||||
}, | |||||
is_report_manager: function() { | is_report_manager: function() { | ||||
return wn.user.has_role(['Administrator', 'System Manager', 'Report Manager']); | return wn.user.has_role(['Administrator', 'System Manager', 'Report Manager']); | ||||
}, | }, | ||||
@@ -200,6 +200,19 @@ wn.utils = { | |||||
return arr; | return arr; | ||||
}, | }, | ||||
dict: function(keys,values) { | |||||
// make dictionaries from keys and values | |||||
var out = []; | |||||
$.each(values, function(row_idx, row) { | |||||
var new_row = {}; | |||||
$.each(keys, function(key_idx, key) { | |||||
new_row[key] = row[key_idx]; | |||||
}) | |||||
out.push(new_row); | |||||
}); | |||||
return out; | |||||
}, | |||||
sum: function(list) { | sum: function(list) { | ||||
return list.reduce(function(previous_value, current_value) { return flt(previous_value) + flt(current_value); }, 0.0); | return list.reduce(function(previous_value, current_value) { return flt(previous_value) + flt(current_value); }, 0.0); | ||||
}, | }, | ||||
@@ -0,0 +1,26 @@ | |||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | |||||
// MIT License. See license.txt | |||||
wn.provide("wn.ui") | |||||
wn.ui.app_icon = { | |||||
get_html: function(app, small) { | |||||
var icon = wn.modules[app].icon; | |||||
var color = wn.modules[app].color; | |||||
if(icon.split(".").slice(-1)[0]==="svg") { | |||||
$.ajax({ | |||||
url: icon, | |||||
dataType: "text", | |||||
async: false, | |||||
success: function(data) { | |||||
icon = data; | |||||
} | |||||
}) | |||||
icon = '<object>'+icon+'</object>'; | |||||
} else { | |||||
icon = '<i class="'+icon+'"></i>' | |||||
} | |||||
return '<div class="app-icon'+ (small ? " app-icon-small" : "") | |||||
+'" style="background-color:'+color+'">'+icon+'</div>' | |||||
} | |||||
} |
@@ -230,29 +230,8 @@ wn.ui.AppFrame = Class.extend({ | |||||
return this.iconbar.add_btn("1", icon, wn._(label), click); | return this.iconbar.add_btn("1", icon, wn._(label), click); | ||||
}, | }, | ||||
// appframe::navbar links | |||||
add_dropdown_button: function(parent, label, click, icon) { | add_dropdown_button: function(parent, label, click, icon) { | ||||
var menu = this.get_menu(parent); | |||||
if(menu.find("li:not(.custom-menu)").length && !menu.find(".divider").length) { | |||||
this.add_menu_divider(menu); | |||||
} | |||||
return $('<li class="custom-menu"><a><i class="' | |||||
+icon+'"></i> '+label+'</a></li>') | |||||
.insertBefore(menu.find(".divider")) | |||||
.find("a") | |||||
.click(function() { | |||||
click(); | |||||
}); | |||||
}, | |||||
get_menu: function(label) { | |||||
return $("#navbar-" + label.toLowerCase()); | |||||
}, | |||||
add_menu_divider: function(menu) { | |||||
menu = typeof menu == "string" ? | |||||
this.get_menu(menu) : menu; | |||||
$('<li class="divider custom-menu"></li>').prependTo(menu); | |||||
wn.ui.toolbar.add_dropdown_button(parent, label, click, icon); | |||||
}, | }, | ||||
// appframe::form | // appframe::form | ||||
@@ -294,15 +294,7 @@ wn.ui.Listing = Class.extend({ | |||||
get_values_from_response: function(data) { | get_values_from_response: function(data) { | ||||
// make dictionaries from keys and values | // make dictionaries from keys and values | ||||
if(data.keys) { | if(data.keys) { | ||||
var values = []; | |||||
$.each(data.values, function(row_idx, row) { | |||||
var new_row = {}; | |||||
$.each(data.keys, function(key_idx, key) { | |||||
new_row[key] = row[key_idx]; | |||||
}) | |||||
values.push(new_row); | |||||
}); | |||||
return values; | |||||
return wn.utils.dict(data.keys, data.values); | |||||
} else { | } else { | ||||
return data; | return data; | ||||
} | } | ||||
@@ -1,93 +0,0 @@ | |||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | |||||
// MIT License. See license.txt | |||||
// search widget | |||||
// options: doctype, callback, query (if applicable) | |||||
wn.ui.Search = Class.extend({ | |||||
init: function(opts) { | |||||
$.extend(this, opts); | |||||
var me = this; | |||||
wn.model.with_doctype(this.doctype, function(r) { | |||||
me.make(); | |||||
me.dialog.show(); | |||||
me.list.$w.find('.list-filters input[type="text"]').focus(); | |||||
}); | |||||
}, | |||||
make: function() { | |||||
var me = this; | |||||
this.dialog = new wn.ui.Dialog({ | |||||
title: this.doctype + ' Search', | |||||
width: 500 | |||||
}); | |||||
var parent = $('<div class="row"><div class="col-md-12"></div></div>') | |||||
.appendTo(this.dialog.body) | |||||
.find(".col-md-12") | |||||
this.list = new wn.ui.Listing({ | |||||
parent: parent, | |||||
appframe: this.dialog.appframe, | |||||
new_doctype: this.doctype, | |||||
doctype: this.doctype, | |||||
type: "GET", | |||||
method: 'webnotes.widgets.reportview.get', | |||||
show_filters: true, | |||||
style: 'compact', | |||||
get_args: function() { | |||||
if(me.query) { | |||||
me.page_length = 50; // there has to be a better way :( | |||||
return { | |||||
query: me.query | |||||
} | |||||
} else { | |||||
return { | |||||
doctype: me.doctype, | |||||
fields: me.get_fields(), | |||||
filters: me.list.filter_list.get_filters(), | |||||
docstatus: ['0','1'] | |||||
} | |||||
} | |||||
}, | |||||
render_row: function(parent, data) { | |||||
$ln = $('<a href="#" data-name="'+data.name+'">' | |||||
+ data.name +'</a>') | |||||
.appendTo(parent) | |||||
.click(function() { | |||||
var val = $(this).attr('data-name'); | |||||
me.dialog.hide(); | |||||
if(me.callback) | |||||
me.callback(val); | |||||
else | |||||
wn.set_route('Form', me.doctype, val); | |||||
return false; | |||||
}); | |||||
// other values | |||||
$.each(data, function(key, value) { | |||||
if(key!=="name") { | |||||
$("<span>") | |||||
.html(value) | |||||
.css({"margin-left": "15px", "display": "block"}) | |||||
.appendTo(parent); | |||||
} | |||||
}) | |||||
if(this.data.length==1) { | |||||
$ln.click(); | |||||
} | |||||
} | |||||
}); | |||||
this.list.filter_list.add_filter(this.doctype, 'name', 'like'); | |||||
this.list.run(); | |||||
}, | |||||
get_fields: function() { | |||||
var me = this; | |||||
var fields = [ '`tab' + me.doctype + '`.name']; | |||||
$.each((wn.model.get("DocType", me.doctype)[0].search_fields || "").split(","), | |||||
function(i, field) { | |||||
if(strip(field)) { | |||||
fields.push('`tab' + me.doctype + '`.' + strip(field)); | |||||
} | |||||
} | |||||
) | |||||
return fields; | |||||
} | |||||
}) |
@@ -6,7 +6,7 @@ wn.ui.toolbar.Search = wn.ui.toolbar.SelectorDialog.extend({ | |||||
this._super({ | this._super({ | ||||
title: wn._("Search"), | title: wn._("Search"), | ||||
execute: function(val) { | execute: function(val) { | ||||
new wn.ui.Search({doctype:val}); | |||||
wn.set_route("List", val); | |||||
}, | }, | ||||
help: wn._("Shortcut") + ": Ctrl+G" | help: wn._("Shortcut") + ": Ctrl+G" | ||||
}); | }); | ||||
@@ -118,6 +118,8 @@ wn.ui.toolbar.Toolbar = Class.extend({ | |||||
wn.ui.toolbar.new_dialog = new wn.ui.toolbar.NewDialog(); | wn.ui.toolbar.new_dialog = new wn.ui.toolbar.NewDialog(); | ||||
wn.ui.toolbar.search = new wn.ui.toolbar.Search(); | wn.ui.toolbar.search = new wn.ui.toolbar.Search(); | ||||
wn.ui.toolbar.report = new wn.ui.toolbar.Report(); | wn.ui.toolbar.report = new wn.ui.toolbar.Report(); | ||||
$('.navbar .nav:first').append('<li class="dropdown">\ | |||||
<a onclick="return wn.ui.toolbar.search.show();"><i class="icon-search"></i><li>'); | |||||
$('.navbar .nav:first').append('<li class="dropdown">\ | $('.navbar .nav:first').append('<li class="dropdown">\ | ||||
<a class="dropdown-toggle" href="#" data-toggle="dropdown"\ | <a class="dropdown-toggle" href="#" data-toggle="dropdown"\ | ||||
title="'+wn._("File")+'"\ | title="'+wn._("File")+'"\ | ||||
@@ -125,8 +127,6 @@ wn.ui.toolbar.Toolbar = Class.extend({ | |||||
<ul class="dropdown-menu" id="navbar-file">\ | <ul class="dropdown-menu" id="navbar-file">\ | ||||
<li><a href="#" onclick="return wn.ui.toolbar.new_dialog.show();">\ | <li><a href="#" onclick="return wn.ui.toolbar.new_dialog.show();">\ | ||||
<i class="icon-plus"></i> '+wn._('New')+'...</a></li>\ | <i class="icon-plus"></i> '+wn._('New')+'...</a></li>\ | ||||
<li><a href="#" onclick="return wn.ui.toolbar.search.show();">\ | |||||
<i class="icon-search"></i> '+wn._('Search')+'...</a></li>\ | |||||
<li><a href="#" onclick="return wn.ui.toolbar.report.show();">\ | <li><a href="#" onclick="return wn.ui.toolbar.report.show();">\ | ||||
<i class="icon-list"></i> '+wn._('Report')+'...</a></li>\ | <i class="icon-list"></i> '+wn._('Report')+'...</a></li>\ | ||||
</ul>\ | </ul>\ | ||||
@@ -167,8 +167,35 @@ wn.ui.toolbar.Toolbar = Class.extend({ | |||||
$('#toolbar-user').append('<li><a href="#" onclick="return wn.app.logout();">\ | $('#toolbar-user').append('<li><a href="#" onclick="return wn.app.logout();">\ | ||||
<i class="icon-fixed-width icon-signout"></i> '+wn._('Logout')+'</a></li>'); | <i class="icon-fixed-width icon-signout"></i> '+wn._('Logout')+'</a></li>'); | ||||
} | } | ||||
}); | }); | ||||
$.extend(wn.ui.toolbar, { | |||||
add_dropdown_button: function(parent, label, click, icon) { | |||||
var menu = wn.ui.toolbar.get_menu(parent); | |||||
if(menu.find("li:not(.custom-menu)").length && !menu.find(".divider").length) { | |||||
wn.ui.toolbar.add_menu_divider(menu); | |||||
} | |||||
return $('<li class="custom-menu"><a><i class="' | |||||
+icon+'"></i> '+label+'</a></li>') | |||||
.insertBefore(menu.find(".divider")) | |||||
.find("a") | |||||
.click(function() { | |||||
click(); | |||||
}); | |||||
}, | |||||
get_menu: function(label) { | |||||
return $("#navbar-" + label.toLowerCase()); | |||||
}, | |||||
add_menu_divider: function(menu) { | |||||
menu = typeof menu == "string" ? | |||||
wn.ui.toolbar.get_menu(menu) : menu; | |||||
$('<li class="divider custom-menu"></li>').prependTo(menu); | |||||
}, | |||||
}) | |||||
wn.ui.toolbar.update_notifications = function() { | wn.ui.toolbar.update_notifications = function() { | ||||
var total = 0; | var total = 0; | ||||
var doctypes = keys(wn.boot.notification_info.open_count_doctype).sort(); | var doctypes = keys(wn.boot.notification_info.open_count_doctype).sort(); | ||||