@@ -0,0 +1,19 @@ | |||||
<input class="form-control desktop-app-search" type="text" placeholder="{%= __("Search Application") %}"> | |||||
<hr> | |||||
<p class="text-muted small">{%= __("Checked items will be shown on desktop") %}</p> | |||||
<div class="list-group all-applications-list"> | |||||
{% for(var i=0, l=all_modules.length; i < l; i++) { | |||||
var module_name = all_modules[i]; | |||||
if (desktop_items.indexOf(module_name)===-1 || module_name==="All Applications") { continue; } | |||||
var module = frappe.get_module(module_name); | |||||
%} | |||||
<div class="list-group-item" data-label="{%= module.label %}" data-name="{%= module.name %}"> | |||||
<div class="checkbox"> | |||||
<label> | |||||
<input type="checkbox" {% if (user_desktop_items.indexOf(module.name)!==-1) { %} checked {% } %} | |||||
data-name="{%= module.name %}"> {%= __(module.label) %} | |||||
</label> | |||||
</div> | |||||
</div> | |||||
{% } %} | |||||
</div> |
@@ -1,224 +1,205 @@ | |||||
frappe.provide('frappe.desktop'); | frappe.provide('frappe.desktop'); | ||||
frappe.pages['desktop'].on_page_load = function(wrapper) { | frappe.pages['desktop'].on_page_load = function(wrapper) { | ||||
frappe.desktop.background = $('<div style="background: none; text-align: center; \ | |||||
margin: 0px auto;"> \ | |||||
<div id="icon-grid">\ | |||||
</div>\ | |||||
</div>\ | |||||
<div style="clear: both"></div>').appendTo(wrapper); | |||||
// load desktop | // load desktop | ||||
frappe.desktop.refresh(); | |||||
frappe.desktop.refresh(wrapper); | |||||
}; | |||||
$(window).on("resize", function() { | |||||
frappe.desktop.resize(); | |||||
}) | |||||
$.extend(frappe.desktop, { | |||||
refresh: function(wrapper) { | |||||
if (wrapper) { | |||||
this.wrapper = $(wrapper); | |||||
} | |||||
frappe.desktop.resize = function() { | |||||
$("#page-desktop").css({"min-height": ($(window).height() - 48) + "px" }); | |||||
} | |||||
this.render(); | |||||
this.make_sortable(); | |||||
}, | |||||
frappe.desktop.resize(); | |||||
} | |||||
render: function() { | |||||
var me = this; | |||||
document.title = "Desktop"; | |||||
frappe.pages['desktop'].refresh = function(wrapper) { | |||||
}; | |||||
this.wrapper.html(frappe.render_template("desktop_icon_grid", { | |||||
// all visible icons | |||||
desktop_items: frappe.user.get_desktop_items(), | |||||
frappe.desktop.refresh = function() { | |||||
frappe.desktop.render(); | |||||
// user visible icons | |||||
user_desktop_items: this.get_user_desktop_items(), | |||||
})); | |||||
frappe.desktop.make_sortable(); | |||||
} | |||||
this.setup_icon_click(); | |||||
frappe.desktop.make_sortable = function() { | |||||
if ('ontouchstart' in window) { | |||||
return; | |||||
} | |||||
// notifications | |||||
this.show_pending_notifications(); | |||||
$(document).on("notification-update", function() { | |||||
me.show_pending_notifications(); | |||||
}); | |||||
new Sortable($("#icon-grid").get(0), { | |||||
onUpdate: function(event) { | |||||
new_order = []; | |||||
$("#icon-grid .case-wrapper").each(function(i, e) { | |||||
new_order.push($(this).attr("data-name")); | |||||
}); | |||||
frappe.defaults.set_default("_desktop_items", new_order); | |||||
} | |||||
}); | |||||
} | |||||
$(document).trigger("desktop-render"); | |||||
}, | |||||
frappe.desktop.render = function() { | |||||
$("#icon-grid").empty(); | |||||
get_user_desktop_items: function() { | |||||
var me = this; | |||||
document.title = "Desktop"; | |||||
var add_icon = function(m) { | |||||
var module = frappe.get_module(m); | |||||
var user_desktop_items = [].concat(frappe.user.get_user_desktop_items()); | |||||
if(!module || (module.type!=="module" && !module.link && !module.onclick) || module.is_app) { | |||||
return; | |||||
remove_from_list(user_desktop_items, "Setup"); | |||||
remove_from_list(user_desktop_items, "Core"); | |||||
if(user_roles.indexOf('System Manager')!=-1) { | |||||
user_desktop_items.push('Setup'); | |||||
} | } | ||||
if(module._id && $("#module-icon-" + module._id).length) { | |||||
// icon already exists! | |||||
return; | |||||
if(user_roles.indexOf('Administrator')!=-1) { | |||||
user_desktop_items.push('Core'); | |||||
} | } | ||||
module.app_icon = frappe.ui.app_icon.get_html(m); | |||||
frappe.modules["All Applications"] = { | |||||
icon: "octicon octicon-three-bars", | |||||
label: "All Applications", | |||||
_label: __("All Applications"), | |||||
_id: "all_applications", | |||||
color: "#4aa3df", | |||||
link: "", | |||||
onclick: function() { | |||||
me.all_applications.show(); | |||||
} | |||||
} | |||||
$icon_wrapper = $(frappe.render_template("desktop_module_icon", | |||||
module)).appendTo("#icon-grid"); | |||||
} | |||||
user_desktop_items.push("All Applications") | |||||
// modules | |||||
var modules_list = frappe.user.get_desktop_items(); | |||||
var user_list = frappe.user.get_user_desktop_items(); | |||||
// filter valid icons | |||||
for (var i=0, l=user_desktop_items.length; i < l; i++) { | |||||
var m = user_desktop_items[i]; | |||||
var module = frappe.get_module(m); | |||||
$.each(modules_list, function(i, m) { | |||||
var module = frappe.modules[m]; | |||||
if(module) { | |||||
if(!in_list(["Setup", "Core"], m) && user_list.indexOf(m)!==-1) | |||||
add_icon(m); | |||||
} | |||||
}) | |||||
// setup | |||||
if(user_roles.indexOf('System Manager')!=-1) | |||||
add_icon('Setup') | |||||
if(user_roles.indexOf('Administrator')!=-1) | |||||
add_icon('Core') | |||||
// all applications | |||||
frappe.modules["All Applications"] = { | |||||
icon: "octicon octicon-three-bars", | |||||
label: "All Applications", | |||||
_label: __("All Applications"), | |||||
_id: "all_applications", | |||||
color: "#4aa3df", | |||||
link: "", | |||||
onclick: function() { | |||||
frappe.desktop.show_all_modules(); | |||||
} | |||||
} | |||||
add_icon("All Applications"); | |||||
// notifications | |||||
frappe.desktop.show_pending_notifications(); | |||||
$(document).on("notification-update", function() { | |||||
frappe.desktop.show_pending_notifications(); | |||||
}); | |||||
// bind click | |||||
$("#icon-grid").on("click", ".app-icon", function() { | |||||
var parent = $(this).parent(); | |||||
var link = parent.attr("data-link"); | |||||
if(link) { | |||||
if(link.substr(0, 1)==="/") { | |||||
window.open(link.substr(1)) | |||||
var is_invalid_item = (!module || (module.type!=="module" && !module.link && !module.onclick) || module.is_app); | |||||
if (is_invalid_item) { | |||||
remove_from_list(user_desktop_items, m); | |||||
} | } | ||||
frappe.set_route(link); | |||||
return false; | |||||
} else { | |||||
module = frappe.get_module(parent.attr("data-name")); | |||||
if (module && module.onclick) { | |||||
module.onclick(); | |||||
module.app_icon = frappe.ui.app_icon.get_html(m); | |||||
} | |||||
return user_desktop_items; | |||||
}, | |||||
setup_icon_click: function() { | |||||
this.wrapper.on("click", ".app-icon", function() { | |||||
var parent = $(this).parent(); | |||||
var link = parent.attr("data-link"); | |||||
if(link) { | |||||
if(link.substr(0, 1)==="/") { | |||||
window.open(link.substr(1)) | |||||
} | |||||
frappe.set_route(link); | |||||
return false; | return false; | ||||
} else { | |||||
module = frappe.get_module(parent.attr("data-name")); | |||||
if (module && module.onclick) { | |||||
module.onclick(); | |||||
return false; | |||||
} | |||||
} | } | ||||
} | |||||
}); | |||||
}); | |||||
}, | |||||
$(document).trigger("desktop-render"); | |||||
} | |||||
make_sortable: function() { | |||||
if ('ontouchstart' in window) { | |||||
return; | |||||
} | |||||
frappe.desktop.show_all_modules = function() { | |||||
if(!frappe.desktop.all_modules_dialog) { | |||||
var d = new frappe.ui.Dialog({ | |||||
title: '<i class="icon-th text-muted"></i> '+ __("All Applications") | |||||
new Sortable($("#icon-grid").get(0), { | |||||
onUpdate: function(event) { | |||||
new_order = []; | |||||
$("#icon-grid .case-wrapper").each(function(i, e) { | |||||
new_order.push($(this).attr("data-name")); | |||||
}); | |||||
frappe.defaults.set_default("_desktop_items", new_order); | |||||
} | |||||
}); | }); | ||||
}, | |||||
var desktop_items = frappe.user.get_desktop_items(true); | |||||
var user_desktop_items = frappe.user.get_user_desktop_items(); | |||||
all_applications: { | |||||
show: function() { | |||||
if(!this.dialog) { | |||||
this.make_dialog(); | |||||
} | |||||
$(this.dialog.body).find(".desktop-app-search").val("").trigger("keyup"); | |||||
this.dialog.show(); | |||||
}, | |||||
$('<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); | |||||
}) | |||||
make_dialog: function() { | |||||
this.dialog = new frappe.ui.Dialog({ | |||||
title: __("All Applications") | |||||
}); | }); | ||||
$('<p class="text-right text-muted text-small">'+__("Checked items shown on desktop")+'</p>') | |||||
.appendTo(d.body); | |||||
$wrapper = $('<div class="list-group">').appendTo(d.body); | |||||
// list of applications (frappe.user.get_desktop_items()) | |||||
var items = keys(frappe.modules).sort(); | |||||
$.each(items, function(i, m) { | |||||
var module = frappe.get_module(m); | |||||
if(module.link && desktop_items.indexOf(m)!==-1) { | |||||
module.app_icon = frappe.ui.app_icon.get_html(m, true); | |||||
module.label = __(module.label); | |||||
$(repl('<div class="list-group-item" data-label="%(name)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 class="grey" href="#%(link)s">%(label)s</a>\ | |||||
<input class="pull-right" type="checkbox" data-name="%(name)s" />\ | |||||
</div>\ | |||||
</div>\ | |||||
</div>', module)).appendTo($wrapper); | |||||
} | |||||
}); | |||||
this.dialog.$wrapper.addClass("all-applications-dialog"); | |||||
this.dialog_body = $(this.dialog.body); | |||||
$(frappe.render_template("all_applications_dialog", { | |||||
all_modules: keys(frappe.modules).sort(), | |||||
desktop_items: frappe.user.get_desktop_items(true), | |||||
user_desktop_items: frappe.user.get_user_desktop_items() | |||||
})).appendTo(this.dialog_body); | |||||
this.bind_events(); | |||||
}, | |||||
// check shown items | |||||
$wrapper.find('[type="checkbox"]') | |||||
.on("click", function() { | |||||
var user_desktop_items = []; | |||||
$wrapper.find('[type="checkbox"]:checked').each(function(i,ele) { | |||||
user_desktop_items.push($(ele).attr("data-name")); | |||||
bind_events: function() { | |||||
var me = this; | |||||
this.dialog_body.find(".desktop-app-search").on("keyup", function() { | |||||
var val = ($(this).val() || "").toLowerCase(); | |||||
me.dialog_body.find(".list-group-item").each(function() { | |||||
$(this).toggle($(this).attr("data-label").toLowerCase().indexOf(val)!==-1 | |||||
|| $(this).attr("data-name").toLowerCase().indexOf(val)!==-1); | |||||
}) | }) | ||||
frappe.defaults.set_default("_user_desktop_items", user_desktop_items); | |||||
frappe.desktop.refresh(); | |||||
}) | |||||
.prop("checked", false); | |||||
$.each(user_desktop_items, function(i, m) { | |||||
$wrapper.find('[data-label="'+m+'"] [type="checkbox"]').prop("checked", true); | |||||
}) | |||||
frappe.desktop.all_modules_dialog = d; | |||||
} | |||||
$(frappe.desktop.all_modules_dialog.body).find(".desktop-app-search").val("").trigger("keyup"); | |||||
frappe.desktop.all_modules_dialog.show(); | |||||
} | |||||
}); | |||||
frappe.desktop.show_pending_notifications = function() { | |||||
this.dialog_body.find('input[type="checkbox"]').on("click", function() { | |||||
me.save_user_desktop_items(); | |||||
}); | |||||
}, | |||||
if (!frappe.boot.notification_info.module_doctypes) { | |||||
return; | |||||
} | |||||
save_user_desktop_items: function() { | |||||
var user_desktop_items = []; | |||||
this.dialog_body.find('input[type="checkbox"]:checked').each(function(i, element) { | |||||
user_desktop_items.push($(element).attr("data-name")); | |||||
}); | |||||
frappe.defaults.set_default("_user_desktop_items", user_desktop_items); | |||||
frappe.desktop.refresh(); | |||||
} | |||||
}, | |||||
var modules_list = frappe.user.get_desktop_items(); | |||||
$.each(modules_list, function(i, module) { | |||||
var module_doctypes = frappe.boot.notification_info.module_doctypes[module]; | |||||
show_pending_notifications: function() { | |||||
var sum = 0; | |||||
if(module_doctypes) { | |||||
if(frappe.boot.notification_info.open_count_doctype) { | |||||
$.each(module_doctypes, function(j, doctype) { | |||||
sum += (frappe.boot.notification_info.open_count_doctype[doctype] || 0); | |||||
}); | |||||
} | |||||
} else if(frappe.boot.notification_info.open_count_module | |||||
&& frappe.boot.notification_info.open_count_module[module]!=null) { | |||||
sum = frappe.boot.notification_info.open_count_module[module]; | |||||
if (!frappe.boot.notification_info.module_doctypes) { | |||||
return; | |||||
} | } | ||||
if (frappe.modules[module]) { | |||||
var notifier = $("#module-count-" + frappe.get_module(module)._id); | |||||
if(notifier.length) { | |||||
notifier.toggle(sum ? true : false); | |||||
notifier.find(".circle-text").html(sum || ""); | |||||
var modules_list = frappe.user.get_desktop_items(); | |||||
$.each(modules_list, function(i, module) { | |||||
var module_doctypes = frappe.boot.notification_info.module_doctypes[module]; | |||||
var sum = 0; | |||||
if(module_doctypes) { | |||||
if(frappe.boot.notification_info.open_count_doctype) { | |||||
$.each(module_doctypes, function(j, doctype) { | |||||
sum += (frappe.boot.notification_info.open_count_doctype[doctype] || 0); | |||||
}); | |||||
} | |||||
} else if(frappe.boot.notification_info.open_count_module | |||||
&& frappe.boot.notification_info.open_count_module[module]!=null) { | |||||
sum = frappe.boot.notification_info.open_count_module[module]; | |||||
} | } | ||||
} | |||||
}); | |||||
} | |||||
if (frappe.modules[module]) { | |||||
var notifier = $("#module-count-" + frappe.get_module(module)._id); | |||||
if(notifier.length) { | |||||
notifier.toggle(sum ? true : false); | |||||
notifier.find(".circle-text").html(sum || ""); | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
}); |
@@ -0,0 +1,11 @@ | |||||
<div style="background: none; text-align: center; margin: 0px auto;"> | |||||
<div id="icon-grid"> | |||||
{% for (var i=0, l=desktop_items.length; i < l; i++) { | |||||
var module = frappe.get_module(desktop_items[i]); | |||||
if (user_desktop_items.indexOf(module.name)===-1) { continue; } | |||||
%} | |||||
{%= frappe.render_template("desktop_module_icon", module) %} | |||||
{% } %} | |||||
</div> | |||||
</div> | |||||
<div style="clear: both"></div> |
@@ -226,6 +226,12 @@ ul.linked-with-list li { | |||||
opacity: 0.5; | opacity: 0.5; | ||||
position: fixed; | position: fixed; | ||||
} | } | ||||
.modal-header { | |||||
padding: 10px 15px; | |||||
} | |||||
.modal-title { | |||||
margin-top: 5px; | |||||
} | |||||
.form-group { | .form-group { | ||||
margin-bottom: 7px; | margin-bottom: 7px; | ||||
} | } | ||||
@@ -70,8 +70,10 @@ body[data-route="desktop"] .navbar-default { | |||||
line-height: 1; | line-height: 1; | ||||
border-radius: 25px; | border-radius: 25px; | ||||
min-width: 25px; | min-width: 25px; | ||||
height: 25px; | |||||
text-align: center; | text-align: center; | ||||
text-shadow: none; | text-shadow: none; | ||||
letter-spacing: normal; | |||||
} | } | ||||
.app-icon:hover path { | .app-icon:hover path { | ||||
fill: #ffffff; | fill: #ffffff; | ||||
@@ -150,3 +152,13 @@ body[data-route="desktop"] .navbar-default { | |||||
height: 90px; | height: 90px; | ||||
} | } | ||||
} | } | ||||
.all-applications-dialog .desktop-app-search { | |||||
margin-bottom: 15px; | |||||
} | |||||
.all-applications-dialog hr { | |||||
margin: 10px -15px; | |||||
} | |||||
.all-applications-dialog .checkbox { | |||||
margin-top: 3px; | |||||
margin-bottom: 3px; | |||||
} |
@@ -101,6 +101,12 @@ | |||||
margin: 0px -15px; | margin: 0px -15px; | ||||
padding: 5px 15px; | padding: 5px 15px; | ||||
} | } | ||||
.listview-main-section .icon-star { | |||||
cursor: pointer; | |||||
} | |||||
.list-row-head .icon-star { | |||||
vertical-align: middle; | |||||
} | |||||
.star-action.icon-star { | .star-action.icon-star { | ||||
color: #ffdb4c; | color: #ffdb4c; | ||||
} | } | ||||
@@ -233,7 +233,7 @@ | |||||
body[data-route^="Module"] .navbar-center { | body[data-route^="Module"] .navbar-center { | ||||
display: block !important; | display: block !important; | ||||
position: absolute; | position: absolute; | ||||
top: 11px; | |||||
top: 10px; | |||||
left: 25%; | left: 25%; | ||||
right: 25%; | right: 25%; | ||||
text-align: center; | text-align: center; | ||||
@@ -61,7 +61,6 @@ | |||||
} | } | ||||
.navbar-center { | .navbar-center { | ||||
float: left; | float: left; | ||||
font-weight: bold; | |||||
color: #6c7680; | color: #6c7680; | ||||
} | } | ||||
#navbar-breadcrumbs > li > a:before { | #navbar-breadcrumbs > li > a:before { | ||||
@@ -76,10 +75,10 @@ | |||||
color: #c0c9d2; | color: #c0c9d2; | ||||
font-size: 14px; | font-size: 14px; | ||||
transition: 0.2s; | transition: 0.2s; | ||||
content: "\f054"; | |||||
margin-right: 15px; | |||||
position: relative; | position: relative; | ||||
top: 1px; | top: 1px; | ||||
content: "\f054"; | |||||
margin-right: 15px; | |||||
} | } | ||||
#navbar-breadcrumbs > li > a:hover:before, | #navbar-breadcrumbs > li > a:hover:before, | ||||
#navbar-breadcrumbs > li > a:focus:before, | #navbar-breadcrumbs > li > a:focus:before, | ||||
@@ -80,18 +80,24 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ | |||||
this.init_list(false); | this.init_list(false); | ||||
this.init_stats(); | this.init_stats(); | ||||
this.init_menu(); | this.init_menu(); | ||||
this.init_star(); | |||||
this.show_match_help(); | this.show_match_help(); | ||||
this.init_listview(); | this.init_listview(); | ||||
this.setup_filterable(); | this.setup_filterable(); | ||||
this.init_filters(); | this.init_filters(); | ||||
this.init_headers(); | this.init_headers(); | ||||
this.init_star(); | |||||
this.init_select_all(); | |||||
}, | }, | ||||
init_headers: function() { | init_headers: function() { | ||||
var main = frappe.render_template("list_item_main_head", | |||||
{ columns: this.listview.columns, right_column: this.listview.settings.right_column }); | |||||
$(frappe.render_template("list_item_row_head",{ main:main, list:this })) | |||||
var main = frappe.render_template("list_item_main_head", { | |||||
columns: this.listview.columns, | |||||
right_column: this.listview.settings.right_column, | |||||
_checkbox: ((frappe.model.can_delete(this.doctype) || this.listview.settings.selectable) | |||||
&& !this.listview.no_delete) | |||||
}); | |||||
this.list_header = $(frappe.render_template("list_item_row_head", { main:main, list:this })) | |||||
.appendTo(this.page.main.find(".list-headers")); | .appendTo(this.page.main.find(".list-headers")); | ||||
}, | }, | ||||
@@ -125,15 +131,15 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ | |||||
}); | }); | ||||
added && me.run(); | added && me.run(); | ||||
}); | }); | ||||
this.$page.on("click", ".doclist-row", function(e) { | |||||
this.$page.find(".result-list").on("click", ".list-row-left", function(e) { | |||||
// don't open in case of checkbox, star, filterable | // don't open in case of checkbox, star, filterable | ||||
if ((e.target.class || "").indexOf("filterable")!==-1 | |||||
|| (e.target.class || "").indexOf("icon-star")!==-1 | |||||
if ((e.target.className || "").indexOf("filterable")!==-1 | |||||
|| (e.target.className || "").indexOf("icon-star")!==-1 | |||||
|| e.target.type==="checkbox") { | || e.target.type==="checkbox") { | ||||
return; | return; | ||||
} | } | ||||
var link = $(this).find("a.list-id").get(0); | |||||
var link = $(this).parent().find("a.list-id").get(0); | |||||
window.location.href = link.href; | window.location.href = link.href; | ||||
return false; | return false; | ||||
}); | }); | ||||
@@ -260,6 +266,10 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ | |||||
me.set_filter(key, val, true); | me.set_filter(key, val, true); | ||||
}); | }); | ||||
} | } | ||||
this.list_header.find(".list-starred-by-me") | |||||
.toggleClass("text-extra-muted not-starred", !this.is_star_filtered()); | |||||
this.last_updated_on = new Date(); | this.last_updated_on = new Date(); | ||||
this.dirty = false; | this.dirty = false; | ||||
this._super(more); | this._super(more); | ||||
@@ -304,6 +314,12 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ | |||||
this.filter_list.add_filter(this.doctype, "_starred_by", 'like', '%' + user + '%'); | this.filter_list.add_filter(this.doctype, "_starred_by", 'like', '%' + user + '%'); | ||||
this.run(); | this.run(); | ||||
}, | }, | ||||
remove_starred_by_me: function() { | |||||
this.filter_list.get_filter("_starred_by").remove(); | |||||
}, | |||||
is_star_filtered: function() { | |||||
return this.filter_list.filter_exists(this.doctype, "_starred_by", 'like', '%' + user + '%'); | |||||
}, | |||||
init_menu: function() { | init_menu: function() { | ||||
var me = this; | var me = this; | ||||
this.$page.on("click", ".list-tag-preview", function() { me.toggle_tags(); }); | this.$page.on("click", ".list-tag-preview", function() { me.toggle_tags(); }); | ||||
@@ -312,15 +328,6 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ | |||||
me.run(); | me.run(); | ||||
}, "octicon octicon-sync"); | }, "octicon octicon-sync"); | ||||
if(this.can_delete || this.listview.settings.selectable) { | |||||
this.page.add_menu_item(__('Select All'), function() { | |||||
me.$page.find('.list-delete').prop("checked", | |||||
me.$page.find('.list-delete:checked').length ? false : true); | |||||
}, true); | |||||
this.page.add_menu_item(__('Delete'), | |||||
function() { me.delete_items(); }, true); | |||||
} | |||||
this.page.add_divider(); | |||||
if(frappe.model.can_import(this.doctype)) { | if(frappe.model.can_import(this.doctype)) { | ||||
this.page.add_menu_item(__("Import"), function() { | this.page.add_menu_item(__("Import"), function() { | ||||
frappe.set_route("data-import-tool", { | frappe.set_route("data-import-tool", { | ||||
@@ -353,10 +360,45 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ | |||||
init_star: function() { | init_star: function() { | ||||
var me = this; | var me = this; | ||||
this.$page.on("click", ".star-action", function() { | |||||
this.$page.find(".result-list").on("click", ".star-action", function() { | |||||
frappe.ui.toggle_star($(this), me.doctype, $(this).attr("data-name")); | frappe.ui.toggle_star($(this), me.doctype, $(this).attr("data-name")); | ||||
return false; | return false; | ||||
}); | }); | ||||
this.list_header.find(".list-starred-by-me").on("click", function() { | |||||
if (me.is_star_filtered()) { | |||||
me.remove_starred_by_me(); | |||||
} else { | |||||
me.starred_by_me(); | |||||
} | |||||
}); | |||||
}, | |||||
init_select_all: function() { | |||||
var me = this; | |||||
if(this.can_delete || this.listview.settings.selectable) { | |||||
this.list_header.find(".list-select-all").on("click", function() { | |||||
console.log('select all clicked!'); | |||||
me.$page.find('.list-delete').prop("checked", $(this).prop("checked")); | |||||
me.toggle_delete(); | |||||
}); | |||||
this.$page.on("click", ".list-delete", function() { | |||||
me.toggle_delete(); | |||||
}); | |||||
} | |||||
}, | |||||
toggle_delete: function() { | |||||
var me = this; | |||||
if (this.$page.find(".list-delete:checked").length) { | |||||
this.page.set_primary_action(__("Delete"), function() { me.delete_items() }, | |||||
"octicon octicon-trashcan"); | |||||
this.page.btn_primary.addClass("btn-danger"); | |||||
} else { | |||||
this.page.btn_primary.removeClass("btn-danger"); | |||||
this.set_primary_action(); | |||||
} | |||||
}, | }, | ||||
toggle_tags: function() { | toggle_tags: function() { | ||||
@@ -15,6 +15,19 @@ | |||||
hidden-xs | hidden-xs | ||||
{% } %} | {% } %} | ||||
{% if(col.df && ["Int", "Float", "Currency", "Percent"].indexOf(col.df.fieldtype)!==-1) { %}text-right{% } %}"> | {% if(col.df && ["Int", "Float", "Currency", "Percent"].indexOf(col.df.fieldtype)!==-1) { %}text-right{% } %}"> | ||||
{% if (col.type==="Subject") { %} | |||||
{% if (_checkbox) { %} | |||||
<input class="list-select-all" type="checkbox" style="margin-right: 7px; margin-top: 2px;" | |||||
title="{%= __("Select All") %}"> | |||||
{% } %} | |||||
<i class="icon-fixed-width icon-star text-extra-muted not-starred star-action list-starred-by-me" | |||||
title="{%= __("Starred By Me") %}"></i> | |||||
{% } %} | |||||
<span class="list-value">{%= col.title || col.label || "" %}</span> | <span class="list-value">{%= col.title || col.label || "" %}</span> | ||||
</div> | </div> | ||||
{% } %} | {% } %} | ||||
@@ -12,7 +12,7 @@ | |||||
<!-- id --> | <!-- id --> | ||||
{% if (list.meta.title_field) { %} | {% if (list.meta.title_field) { %} | ||||
<div class="list-col col-sm-2 text-right"> | |||||
<div class="list-col col-sm-2 hidden-xs text-right"> | |||||
</div> | </div> | ||||
{% } %} | {% } %} | ||||
@@ -3,8 +3,7 @@ | |||||
{% } %} | {% } %} | ||||
<i class="icon-star {% if (_starred_by.indexOf(_user)===-1) { | <i class="icon-star {% if (_starred_by.indexOf(_user)===-1) { | ||||
%}text-extra-muted not-starred{% } else { %}{% }%} | %}text-extra-muted not-starred{% } else { %}{% }%} | ||||
icon-fixed-width star-action" | |||||
style="cursor: pointer" data-name="{%= _name %}"> | |||||
icon-fixed-width star-action" data-name="{%= _name %}"> | |||||
</i> | </i> | ||||
<a class="grey list-id" style="margin-right: 7px;" | <a class="grey list-id" style="margin-right: 7px;" | ||||
href="#Form/{%= _doctype_encoded %}/{%= _name_encoded %}" title="{%= _full_title %}">{%= _title %}</a> | href="#Form/{%= _doctype_encoded %}/{%= _name_encoded %}" title="{%= _full_title %}">{%= _title %}</a> | ||||
@@ -7,7 +7,6 @@ | |||||
<li class="hide calendar-link"><a href="#Calendar/{%= doctype %}">{%= __("Calendar") %}</a></li> | <li class="hide calendar-link"><a href="#Calendar/{%= doctype %}">{%= __("Calendar") %}</a></li> | ||||
<li class="hide gantt-link"><a href="#Gantt/{%= doctype %}">{%= __("Gantt") %}</a></li> | <li class="hide gantt-link"><a href="#Gantt/{%= doctype %}">{%= __("Gantt") %}</a></li> | ||||
<li><a onclick="cur_list.assigned_to_me()">{%= __("Assigned To Me") %}</a></li> | <li><a onclick="cur_list.assigned_to_me()">{%= __("Assigned To Me") %}</a></li> | ||||
<li><a onclick="cur_list.starred_by_me()">{%= __("Starred By Me") %}</a></li> | |||||
</ul> | </ul> | ||||
@@ -108,16 +108,20 @@ frappe.ui.Listing = Class.extend({ | |||||
} | } | ||||
// new | // new | ||||
if(this.new_doctype) { | |||||
var make_new_doc = function() { (me.custom_new_doc || me.make_new_doc).apply(me, [me.new_doctype]); }; | |||||
this.page.set_primary_action(__("New"), function() { make_new_doc(); }, "octicon octicon-plus"); | |||||
} | |||||
this.set_primary_action(); | |||||
if(me.no_toolbar || me.hide_toolbar) { | if(me.no_toolbar || me.hide_toolbar) { | ||||
me.$w.find('.list-toolbar-wrapper').toggle(false); | me.$w.find('.list-toolbar-wrapper').toggle(false); | ||||
} | } | ||||
}, | }, | ||||
set_primary_action: function() { | |||||
if(this.new_doctype) { | |||||
var make_new_doc = function() { (me.custom_new_doc || me.make_new_doc).apply(me, [me.new_doctype]); }; | |||||
this.page.set_primary_action(__("New"), function() { make_new_doc(); }, "octicon octicon-plus"); | |||||
} | |||||
}, | |||||
make_new_doc: function(doctype) { | make_new_doc: function(doctype) { | ||||
var me = this; | var me = this; | ||||
frappe.model.with_doctype(doctype, function() { | frappe.model.with_doctype(doctype, function() { | ||||
@@ -1,13 +1,13 @@ | |||||
<div class="page-head"> | <div class="page-head"> | ||||
<div class="container"> | <div class="container"> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-xs-7 page-title"> | |||||
<div class="col-sm-7 col-xs-6 page-title"> | |||||
<h1 class="text-ellipsis"> | <h1 class="text-ellipsis"> | ||||
<span class="title-text"></span> | <span class="title-text"></span> | ||||
<span class="indicator hide"></span> | <span class="indicator hide"></span> | ||||
</h1> | </h1> | ||||
</div> | </div> | ||||
<div class="text-right col-xs-5 page-actions"> | |||||
<div class="text-right col-sm-5 col-xs-6 page-actions"> | |||||
<h6 class="sub-heading hide text-muted"></h6> | <h6 class="sub-heading hide text-muted"></h6> | ||||
<span class="page-icon-group hide hidden-xs hidden-sm"></span> | <span class="page-icon-group hide hidden-xs hidden-sm"></span> | ||||
<div class="btn-group menu-btn-group hide"> | <div class="btn-group menu-btn-group hide"> | ||||
@@ -144,3 +144,8 @@ function add_lists(l1, l2) { | |||||
function docstring(obj) { | function docstring(obj) { | ||||
return JSON.stringify(obj); | return JSON.stringify(obj); | ||||
} | } | ||||
function remove_from_list(list, val) { | |||||
list.splice(list.indexOf(val), 1); | |||||
return list | |||||
} |
@@ -266,6 +266,14 @@ ul.linked-with-list li { | |||||
position: fixed; | position: fixed; | ||||
} | } | ||||
.modal-header { | |||||
padding: 10px 15px; | |||||
} | |||||
.modal-title { | |||||
margin-top: 5px; | |||||
} | |||||
.form-group { | .form-group { | ||||
margin-bottom: 7px; | margin-bottom: 7px; | ||||
} | } | ||||
@@ -81,8 +81,10 @@ body[data-route=""] .navbar-default, body[data-route="desktop"] .navbar-default | |||||
line-height: 1; | line-height: 1; | ||||
border-radius: 25px; | border-radius: 25px; | ||||
min-width: 25px; | min-width: 25px; | ||||
height: 25px; | |||||
text-align: center; | text-align: center; | ||||
text-shadow: none; | text-shadow: none; | ||||
letter-spacing: normal; | |||||
} | } | ||||
.app-icon:hover path { | .app-icon:hover path { | ||||
@@ -184,3 +186,18 @@ body[data-route=""] .navbar-default, body[data-route="desktop"] .navbar-default | |||||
height: 90px; | height: 90px; | ||||
} | } | ||||
} | } | ||||
.all-applications-dialog { | |||||
.desktop-app-search { | |||||
margin-bottom: 15px; | |||||
} | |||||
hr { | |||||
margin: 10px -15px | |||||
} | |||||
.checkbox { | |||||
margin-top: 3px; | |||||
margin-bottom: 3px; | |||||
} | |||||
} |
@@ -129,6 +129,14 @@ | |||||
padding: 5px 15px; | padding: 5px 15px; | ||||
} | } | ||||
.listview-main-section .icon-star { | |||||
cursor: pointer; | |||||
} | |||||
.list-row-head .icon-star { | |||||
vertical-align: middle; | |||||
} | |||||
.star-action.icon-star { | .star-action.icon-star { | ||||
color: #ffdb4c; | color: #ffdb4c; | ||||
} | } | ||||
@@ -282,7 +282,7 @@ | |||||
.navbar-center { | .navbar-center { | ||||
display: block !important; | display: block !important; | ||||
position: absolute; | position: absolute; | ||||
top: 11px; | |||||
top: 10px; | |||||
left: 25%; | left: 25%; | ||||
right: 25%; | right: 25%; | ||||
text-align: center; | text-align: center; | ||||
@@ -82,7 +82,6 @@ | |||||
.navbar-center { | .navbar-center { | ||||
float: left; | float: left; | ||||
font-weight: bold; | |||||
color: @navbar-default-color; | color: @navbar-default-color; | ||||
} | } | ||||