Ver código fonte

[fix] module ordering and all applications fixes

version-14
Rushabh Mehta 9 anos atrás
pai
commit
b8fc4da140
7 arquivos alterados com 47 adições e 20 exclusões
  1. +9
    -2
      frappe/boot.py
  2. +18
    -13
      frappe/config/desktop.py
  3. +2
    -1
      frappe/core/page/desktop/all_applications_dialog.html
  4. +10
    -0
      frappe/core/page/desktop/desktop.js
  5. +3
    -0
      frappe/public/js/frappe/defaults.js
  6. +1
    -1
      frappe/public/js/frappe/misc/user.js
  7. +4
    -3
      frappe/utils/boilerplate.py

+ 9
- 2
frappe/boot.py Ver arquivo

@@ -9,7 +9,7 @@ bootstrap client session
import frappe
import frappe.defaults
import frappe.desk.desk_page
from frappe.utils import get_gravatar, get_url
from frappe.utils import get_gravatar
from frappe.desk.form.load import get_meta_bundle
from frappe.utils.change_log import get_versions

@@ -32,9 +32,16 @@ def get_bootinfo():
bootinfo['sid'] = frappe.session['sid'];

bootinfo.modules = {}
bootinfo.module_list = []
for app in frappe.get_installed_apps():
try:
bootinfo.modules.update(frappe.get_attr(app + ".config.desktop.get_data")() or {})
modules = frappe.get_attr(app + ".config.desktop.get_data")() or {}
if isinstance(modules, dict):
bootinfo.modules.update(modules)
else:
for m in modules:
bootinfo.modules[m['module_name']] = m
bootinfo.module_list.append(m['module_name'])
except ImportError:
pass
except AttributeError:


+ 18
- 13
frappe/config/desktop.py Ver arquivo

@@ -2,8 +2,17 @@ from __future__ import unicode_literals
from frappe import _

def get_data():
return {
"File Manager": {
return [
{
"module_name": "Desk",
"label": _("Tools"),
"color": "#FFF5A7",
"reverse": 1,
"icon": "octicon octicon-calendar",
"type": "module"
},
{
"module_name": "File Manager",
"color": "#AA784D",
"doctype": "File",
"icon": "octicon octicon-file-directory",
@@ -11,30 +20,26 @@ def get_data():
"link": "List/File",
"type": "list"
},
"Website": {
{
"module_name": "Website",
"color": "#16a085",
"icon": "octicon octicon-globe",
"type": "module"
},
"Setup": {
{
"module_name": "Setup",
"color": "#bdc3c7",
"reverse": 1,
"icon": "octicon octicon-settings",
"type": "module"
},
"Core": {
{
"module_name": "Core",
"label": _("Developer"),
"color": "#589494",
"icon": "icon-cog",
"icon": "octicon octicon-circuit-board",
"type": "module",
"system_manager": 1
},
"Desk": {
"label": _("Tools"),
"color": "#FFF5A7",
"reverse": 1,
"icon": "octicon octicon-calendar",
"type": "module"
}
}
]

+ 2
- 1
frappe/core/page/desktop/all_applications_dialog.html Ver arquivo

@@ -17,7 +17,8 @@
<div class="checkbox">
<label>
<input type="checkbox" {% if (user_desktop_items.indexOf(module.name)!==-1) { %} checked {% } %}
data-name="{%= module.name %}"> {%= __(module.label) %}
data-name="{%= module.name %}"
{{ module.force_show ? "disabled" : ""}}> {%= __(module.label) %}
</label>
</div>
</div>


+ 10
- 0
frappe/core/page/desktop/desktop.js Ver arquivo

@@ -1,6 +1,7 @@
frappe.provide('frappe.desktop');

frappe.pages['desktop'].on_page_load = function(wrapper) {

// load desktop
if(!frappe.list_desktop) {
frappe.desktop.set_background();
@@ -78,6 +79,9 @@ $.extend(frappe.desktop, {
desktop_items.push('Core');
}

remove_from_list(desktop_items, "All Applications");
desktop_items.push('All Applications');

return desktop_items;
},

@@ -199,6 +203,12 @@ $.extend(frappe.desktop, {

this.dialog_body.find('input[type="checkbox"]').on("click", function() {
me.save_user_desktop_items();

frappe.user.modules = null;

frappe.after_ajax(function() {
frappe.desktop.refresh();
});
});
},



+ 3
- 0
frappe/public/js/frappe/defaults.js Ver arquivo

@@ -49,6 +49,9 @@ frappe.defaults = {
callback: callback || function(r) {}
});
},
set_user_default_local: function(key, value) {
frappe.boot.user.defaults[key] = value;
},
get_default: function(key) {
var defaults = frappe.boot.user.defaults;
var value = defaults[key];


+ 1
- 1
frappe/public/js/frappe/misc/user.js Ver arquivo

@@ -123,7 +123,7 @@ $.extend(frappe.user, {

if(!modules_list || !modules_list.length) {
// all modules
modules_list = keys(frappe.modules).sort();
modules_list = frappe.boot.module_list;
}

// filter hidden modules


+ 4
- 3
frappe/utils/boilerplate.py Ver arquivo

@@ -227,14 +227,15 @@ from __future__ import unicode_literals
from frappe import _

def get_data():
return {{
"{app_title}": {{
return [
{{
"module_name": "{app_title}",
"color": "{app_color}",
"icon": "{app_icon}",
"type": "module",
"label": _("{app_title}")
}}
}}
]
"""

setup_template = """# -*- coding: utf-8 -*-


Carregando…
Cancelar
Salvar