[fix] open filtered list when clicked on notifications circle

This commit is contained in:
Rushabh Mehta 2016-04-11 12:42:12 +05:30
parent d58a5773ba
commit addda4a30c
13 changed files with 42 additions and 18 deletions

View file

@ -37,6 +37,7 @@ $.extend(frappe.desktop, {
label: 'Explore',
_label: __('Explore'),
_id: 'Explore',
_doctype: '',
icon: 'octicon octicon-telescope',
color: '#7578f6',
link: 'modules'
@ -71,6 +72,12 @@ $.extend(frappe.desktop, {
frappe.desktop.open_module($(this).parent());
});
}
frappe.desktop.wrapper.on("click", ".circle", function() {
var doctype = $(this).attr('data-doctype');
if(doctype) {
frappe.set_route('List', doctype, frappe.ui.notifications.get_filters(doctype));
}
});
},
open_module: function(parent) {
@ -122,7 +129,6 @@ $.extend(frappe.desktop, {
},
show_pending_notifications: function() {
if (!frappe.boot.notification_info.module_doctypes) {
return;
}

View file

@ -2,7 +2,7 @@
data-name="{{ module_name }}" data-link="{{ link }}" title="{{ _label }}">
{{ app_icon }}
<div class="case-label text-ellipsis">
<div class="circle module-count-{{ _id }}" style="display: none;">
<div class="circle module-count-{{ _id }}" data-doctype="{{ _doctype }}" style="display: none;">
<span class="circle-text"></span>
</div>
<!-- <span id="module-count-{{ _id }}" class="octicon octicon-primitive-dot circle" style="display: None"></span> -->

View file

@ -72,19 +72,20 @@ frappe.pages['modules'].on_page_load = function(wrapper) {
//setup_section_toggle();
frappe.app.update_notification_count_in_modules();
page.main.find('.module-section-link').on("click", function(event) {
// if clicked on open notification!
if (event.target.classList.contains("open-notification")) {
var doctype = event.target.getAttribute("data-doctype");
frappe.route_options = frappe.boot.notification_info.conditions[doctype];
return false;
}
if($(this).attr("data-type")==="help") {
frappe.help.show_video($(this).attr("data-youtube-id"));
return false;
// notifications click
page.main.on("click", '.open-notification', function(event) {
var doctype = $(this).attr('data-doctype');
if(doctype) {
frappe.set_route('List', doctype, frappe.ui.notifications.get_filters(doctype));
}
});
// help click
page.main.on("click", '.module-section-link[data-type="help"]', function(event) {
frappe.help.show_video($(this).attr("data-youtube-id"));
return false;
});
}
var process_data = function(data) {

View file

@ -10,7 +10,7 @@
var item = section.items[j];
if(item.shown) { %}
<div style="min-height: 22px; margin-top: 8px;">
<a class="module-section-link" data-type="{{ item.type }}"
<a class="module-section-link small" data-type="{{ item.type }}"
{% if(item.type==="help") { %}
data-youtube-id="{{ item.youtube_id }}"{% } %}
href="#{{ item.route }}" style="{{ item.style }}">

View file

@ -356,6 +356,8 @@ class BaseDocument(object):
frappe.db.set_value(self.doctype, self.name, fieldname, value,
self.modified, self.modified_by, update_modified=update_modified)
self.run_trigger('on_change')
def _fix_numeric_types(self):
for df in self.meta.get("fields"):
if df.fieldtype == "Check":

View file

@ -448,6 +448,7 @@ textarea.form-control {
padding: 0 8px;
color: #fff;
border-radius: 10px;
cursor: pointer;
}
/* on small screens, show only icons on top */
@media (max-width: 767px) {

View file

@ -78,6 +78,7 @@ body[data-route="desktop"] .navbar-default {
text-align: center;
text-shadow: none;
letter-spacing: normal;
cursor: pointer;
}
.app-icon:hover path {
fill: #fff;

View file

@ -18,7 +18,6 @@
}
.module-section .module-section-link {
line-height: 1.5em;
font-size: 14px;
}
.module-section-column {
padding: 30px;

View file

@ -370,6 +370,10 @@ frappe.get_module = function(m, default_module) {
module._label = __(module.label);
}
if(!module._doctype) {
module._doctype = '';
}
module._setup = true;
return module;

View file

@ -103,10 +103,10 @@ frappe.ui.notifications.config = {
frappe.views.show_open_count_list = function(element) {
var doctype = $(element).attr("data-doctype");
var condition = frappe.boot.notification_info.conditions[doctype];
var filters = frappe.ui.notifications.get_filters(doctype);
if(condition && $.isPlainObject(condition)) {
frappe.route_options = condition;
if(filters) {
frappe.route_options = filters;
}
var route = frappe.get_route();
@ -116,3 +116,11 @@ frappe.views.show_open_count_list = function(element) {
frappe.set_route("List", doctype);
}
}
frappe.ui.notifications.get_filters = function(doctype) {
var conditions = frappe.boot.notification_info.conditions[doctype];
if(conditions && $.isPlainObject(conditions)) {
return conditions;
}
}

View file

@ -286,6 +286,7 @@ textarea.form-control {
padding:0 8px;
color:#fff;
border-radius:10px;
cursor: pointer;
}
/* on small screens, show only icons on top */

View file

@ -90,6 +90,7 @@ body[data-route=""] .navbar-default, body[data-route="desktop"] .navbar-default
text-align: center;
text-shadow: none;
letter-spacing: normal;
cursor: pointer;
}
.app-icon:hover path {

View file

@ -24,7 +24,7 @@
.module-section-link {
line-height: 1.5em;
font-size: 14px;
// font-size: 14px;
}
}