feat(module_links): add condition for modules, show label in title

This commit is contained in:
Prateeksha Singh 2019-02-07 09:17:21 +05:30
parent 09dd85dad6
commit b5a9105e47
4 changed files with 9 additions and 3 deletions

View file

@ -47,6 +47,9 @@ def get_modules_from_app(app):
if module_name not in active_domains:
to_add = False
if "condition" in m and not m["condition"]:
to_add = False
if to_add:
active_modules_list.append(m)

View file

@ -1,4 +1,5 @@
from __future__ import unicode_literals
import frappe
from frappe import _
def get_data():
@ -54,6 +55,7 @@ def get_data():
"icon": "octicon octicon-circuit-board",
"type": "module",
"system_manager": 1,
"condition": getattr(frappe.local.conf, 'developer_mode', 0),
"hidden": 1,
"description": "The Frappe innards of ERPNext. (Only active when developer mode is enabled)"
},

View file

@ -10,7 +10,7 @@
:key="section.label + item.label"
:data-youtube-id="item.type==='help' ? item.youtube_id : false"
v-bind="item"
:open_count="frappe.boot.notification_info.open_count_doctype[item.doctype]"
:open_count="item.type==='doctype' ? frappe.boot.notification_info.open_count_doctype[item.doctype] : false"
>
</module-link-item>
</div>

View file

@ -35,7 +35,8 @@ export default {
let route = frappe.get_route();
if(route[0] === 'modules' || !route[0]) {
this.route = route;
let module_name = route[1];
let module = this.modules_list.filter(m => m.module_name == route[1])[0];
let module_name = module && (module.label || module.module_name);
let title = this.current_module_label ? this.current_module_label : module_name;
frappe.modules.home && frappe.modules.home.page.set_title(title);
@ -47,7 +48,7 @@ export default {
}
if(module_name) {
this.get_module_sections(module_name);
this.get_module_sections(module.module_name);
}
}
},