diff --git a/frappe/boot.py b/frappe/boot.py
index b471f10901..1cb77064e9 100644
--- a/frappe/boot.py
+++ b/frappe/boot.py
@@ -37,8 +37,6 @@ def get_bootinfo():
load_desktop_icons(bootinfo)
bootinfo.module_app = frappe.local.module_app
- bootinfo.doctype_icons = dict(frappe.db.sql("""select name, icon from
- tabDocType where ifnull(icon,'')!=''"""))
bootinfo.single_types = frappe.db.sql_list("""select name from tabDocType where issingle=1""")
add_home_page(bootinfo, doclist)
bootinfo.page_info = get_allowed_pages()
@@ -66,7 +64,7 @@ def get_bootinfo():
bootinfo.error_report_email = frappe.get_hooks("error_report_email")
bootinfo.calendars = sorted(frappe.get_hooks("calendars"))
bootinfo["lang_dict"] = get_lang_dict()
-
+
return bootinfo
def load_conf_settings(bootinfo):
diff --git a/frappe/config/website.py b/frappe/config/website.py
index 8d5f44f6ac..a9d9bdf2eb 100644
--- a/frappe/config/website.py
+++ b/frappe/config/website.py
@@ -4,7 +4,7 @@ from frappe import _
def get_data():
return [
{
- "label": _("Documents"),
+ "label": _("Web Site"),
"icon": "icon-star",
"items": [
{
@@ -12,11 +12,6 @@ def get_data():
"name": "Web Page",
"description": _("Content web page."),
},
- {
- "type": "doctype",
- "name": "Blog Post",
- "description": _("Single Post (article)."),
- },
{
"type": "doctype",
"name": "Web Form",
@@ -24,13 +19,28 @@ def get_data():
},
{
"type": "doctype",
- "name": "Blogger",
- "description": _("User ID of a blog writer."),
+ "name": "Website Slideshow",
+ "description": _("Embed image slideshows in website pages."),
+ },
+ ]
+ },
+ {
+ "label": _("Blog"),
+ "items": [
+ {
+ "type": "doctype",
+ "name": "Blog Post",
+ "description": _("Single Post (article)."),
},
{
"type": "doctype",
- "name": "Website Slideshow",
- "description": _("Embed image slideshows in website pages."),
+ "name": "Blog Settings",
+ "description": _("Write titles and introductions to your blog."),
+ },
+ {
+ "type": "doctype",
+ "name": "Blog Category",
+ "description": _("Categorize blog posts."),
},
]
},
@@ -45,24 +55,14 @@ def get_data():
},
{
"type": "doctype",
- "name": "Style Settings",
- "description": _("Setup of fonts and background."),
+ "name": "Website Theme",
+ "description": _("List of themes for Website."),
},
{
"type": "doctype",
"name": "Website Script",
"description": _("Javascript to append to the head section of the page."),
},
- {
- "type": "doctype",
- "name": "Blog Settings",
- "description": _("Write titles and introductions to your blog."),
- },
- {
- "type": "doctype",
- "name": "Blog Category",
- "description": _("Categorize blog posts."),
- },
{
"type": "doctype",
"name": "About Us Settings",
@@ -73,11 +73,6 @@ def get_data():
"name": "Contact Us Settings",
"description": _("Settings for Contact Us Page."),
},
- {
- "type": "doctype",
- "name": "Website Theme",
- "description": _("List of themes for Website."),
- }
]
},
]
diff --git a/frappe/core/page/desktop/desktop.js b/frappe/core/page/desktop/desktop.js
index 763ae40e11..c45d97781e 100644
--- a/frappe/core/page/desktop/desktop.js
+++ b/frappe/core/page/desktop/desktop.js
@@ -34,7 +34,7 @@ $.extend(frappe.desktop, {
frappe.desktop.wrapper.html(frappe.render_template(template, {
// all visible icons
- desktop_items: frappe.desktop.get_desktop_items(),
+ desktop_items: frappe.get_desktop_icons(),
}));
frappe.desktop.setup_module_click();
@@ -48,44 +48,6 @@ $.extend(frappe.desktop, {
$(document).trigger("desktop-render");
},
- get_desktop_items: function() {
- // filter valid icons
- var out = [];
-
- var add_to_out = function(module) {
- var module = frappe.get_module(module.module_name, module);
- module.app_icon = frappe.ui.app_icon.get_html(module);
- out.push(module);
- }
-
- var is_permitted = function(module) {
- if(m._doctype) {
- return frappe.model.can_read(m._doctype);
- } else {
- return frappe.boot.user.allow_modules.indexOf(m.module_name) !== -1
- }
- }
-
- for (var i=0, l=frappe.boot.desktop_icons.length; i < l; i++) {
- var m = frappe.boot.desktop_icons[i];
- if ((['Setup', 'Core'].indexOf(m.module_name) === -1)
- && is_permitted(m)
- && !m.hidden) {
- add_to_out(m)
- }
- }
-
- if(user_roles.indexOf('System Manager')!=-1) {
- add_to_out(frappe.get_module('Setup'))
- }
-
- if(user_roles.indexOf('Administrator')!=-1) {
- add_to_out(frappe.get_module('Core'))
- }
-
- return out;
- },
-
setup_module_click: function() {
if(frappe.list_desktop) {
frappe.desktop.wrapper.on("click", ".desktop-list-item", function() {
diff --git a/frappe/core/page/modules_setup/modules_setup.py b/frappe/core/page/modules_setup/modules_setup.py
index 87da9b2731..43704dda88 100644
--- a/frappe/core/page/modules_setup/modules_setup.py
+++ b/frappe/core/page/modules_setup/modules_setup.py
@@ -42,13 +42,20 @@ def get_user_icons(user):
user_perms = UserPermissions(user)
user_perms.build_permissions()
+ from frappe.boot import get_allowed_pages
+
+ allowed_pages = get_allowed_pages()
+
icons = []
for icon in get_desktop_icons(user):
- print icon.module_name
if icon.hidden_in_standard:
continue
- if not icon.custom and not icon.module_name in user_perms.allow_modules:
- continue
+ if not icon.custom:
+ if icon.type=="page" and icon.link not in allowed_pages:
+ continue
+
+ elif icon.type=="module" and icon.module_name not in user_perms.allow_modules:
+ continue
icons.append(icon)
diff --git a/frappe/desk/doctype/desktop_icon/desktop_icon.py b/frappe/desk/doctype/desktop_icon/desktop_icon.py
index e6e5af1b60..11ce85a5ae 100644
--- a/frappe/desk/doctype/desktop_icon/desktop_icon.py
+++ b/frappe/desk/doctype/desktop_icon/desktop_icon.py
@@ -49,7 +49,7 @@ def get_desktop_icons(user=None):
# override properties from standard icon
if standard_icon:
- for key in ('route', 'label', 'color', 'icon'):
+ for key in ('route', 'label', 'color', 'icon', 'link'):
if standard_icon.get(key):
icon[key] = standard_icon.get(key)
diff --git a/frappe/desk/doctype/event/event.js b/frappe/desk/doctype/event/event.js
index 7844e75449..cbfaa0a264 100644
--- a/frappe/desk/doctype/event/event.js
+++ b/frappe/desk/doctype/event/event.js
@@ -15,7 +15,7 @@ frappe.ui.form.on("Event", {
if(frm.doc.ref_type && frm.doc.ref_name) {
frm.add_custom_button(__(frm.doc.ref_name), function() {
frappe.set_route("Form", frm.doc.ref_type, frm.doc.ref_name);
- }, frappe.boot.doctype_icons[frm.doc.ref_type]);
+ });
}
},
repeat_on: function(frm) {
diff --git a/frappe/desk/doctype/todo/todo.js b/frappe/desk/doctype/todo/todo.js
index 3a204408f7..61d8133088 100644
--- a/frappe/desk/doctype/todo/todo.js
+++ b/frappe/desk/doctype/todo/todo.js
@@ -14,7 +14,7 @@ frappe.ui.form.on("ToDo", {
if(frm.doc.reference_type && frm.doc.reference_name) {
frm.add_custom_button(__(frm.doc.reference_name), function() {
frappe.set_route("Form", frm.doc.reference_type, frm.doc.reference_name);
- }, frappe.boot.doctype_icons[frm.doc.reference_type]);
+ });
}
if (!frm.doc.__islocal) {
diff --git a/frappe/desk/moduleview.py b/frappe/desk/moduleview.py
index 34271935d2..ace49d6769 100644
--- a/frappe/desk/moduleview.py
+++ b/frappe/desk/moduleview.py
@@ -34,7 +34,7 @@ def get_data(module):
data = combine_common_sections(data)
data = apply_permissions(data)
- set_last_modified(data)
+ #set_last_modified(data)
return data
diff --git a/frappe/desk/page/activity/activity.js b/frappe/desk/page/activity/activity.js
index 9b01a8611d..caa238a066 100644
--- a/frappe/desk/page/activity/activity.js
+++ b/frappe/desk/page/activity/activity.js
@@ -124,12 +124,6 @@ frappe.activity.Feed = Class.extend({
data.imgsrc = frappe.utils.get_file_link(frappe.user_info(data.owner).image);
data.icon = "icon-flag";
- // if(data.doc_type) {
- // data.feed_type = data.doc_type;
- // data.icon = frappe.boot.doctype_icons[data.doc_type];
- // }
-
- // data.feed_type = data.feed_type || "Comment";
// color for comment
data.add_class = {
diff --git a/frappe/desk/page/modules/modules.js b/frappe/desk/page/modules/modules.js
index 8a01236ed3..9f3d2f82b3 100644
--- a/frappe/desk/page/modules/modules.js
+++ b/frappe/desk/page/modules/modules.js
@@ -6,34 +6,116 @@ frappe.pages['modules'].on_page_load = function(wrapper) {
});
frappe.modules_page = page;
+ page.section_data = {};
- page.wrapper.find('.page-head').toggle(false);
- page.wrapper.find('.page-content').css({'margin-top': '0px'});
+ page.wrapper.find('.page-head h1').css({'padding-left': '15px'});
+ // page.wrapper.find('.page-content').css({'margin-top': '0px'});
// render sidebar
page.sidebar.html(frappe.render_template('modules_sidebar', {modules: frappe.get_desktop_icons()}));
- page.wrapper.find('.module-link').on('click', function() {
- render_section($(this).attr('data-name'));
- });
+ page.activate_link = function(link) {
+ page.wrapper.find('.module-sidebar-item.active, .module-link.active').removeClass('active');
+ $(link).addClass('active').parent().addClass("active");
+ show_section($(link).attr('data-name'));
+ }
- var render_section = function(module_name) {
- return frappe.call({
- method: "frappe.desk.moduleview.get",
- args: {
- module: module_name
- },
- callback: function(r) {
- m = frappe.get_module(module_name);
- m.data = r.message.data;
- console.log(m);
- page.main.html(frappe.render_template('modules_section', m));
- },
- freeze: true,
+ var show_section = function(module_name) {
+ if(module_name in page.section_data) {
+ render_section(page.section_data[module_name]);
+ } else {
+ page.main.empty();
+ return frappe.call({
+ method: "frappe.desk.moduleview.get",
+ args: {
+ module: module_name
+ },
+ callback: function(r) {
+ m = frappe.get_module(module_name);
+ m.data = r.message.data;
+ process_data(m.data);
+ page.section_data[module_name] = m;
+ render_section(m);
+ },
+ freeze: true,
+ });
+ }
+
+ }
+
+ var render_section = function(m) {
+ page.set_title(__(m.label));
+ page.main.html(frappe.render_template('modules_section', m));
+
+ if(frappe.utils.is_mobile()) {
+ $(document).scrollTop($('.module-body').offset().top - 100);
+ }
+
+ //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;
+ }
});
+ }
+ var process_data = function(data) {
+ data.forEach(function(section) {
+ section.items.forEach(function(item) {
+ item.style = '';
+ if(item.type==="doctype") {
+ item.doctype = item.name;
+ }
+ if(!item.route) {
+ if(item.link) {
+ item.route=strip(item.link, "#")
+ }
+ else if(item.type==="doctype") {
+ item.route="List/" + item.doctype
+ item.style = 'text-decoration: underline;';
+ // item.style = 'font-weight: bold;';
+ }
+ else if(item.type==="report" && item.is_query_report) {
+ item.route="query-report/" + item.name
+ }
+ else if(item.type==="report") {
+ item.route="Report/" + item.doctype + "/" + item.name
+ }
+ else if(item.type==="page") {
+ item.route=item.name;
+ }
+ }
+
+ if(item.route_options) {
+ item.route += "?" + $.map(item.route_options, function(value, key) {
+ return encodeURIComponent(key) + "=" + encodeURIComponent(value) }).join('&')
+ }
+
+ if(item.type==="page" || item.type==="help" ||
+ (item.doctype && frappe.model.can_read(item.doctype))) {
+ item.shown = true;
+ }
+
+ });
+ });
}
}
+frappe.pages['modules'].on_page_show = function(wrapper) {
+ var route = frappe.get_route();
+ if(route.length > 1) {
+ var link = frappe.modules_page.sidebar.find('.module-link[data-name="'+ route[1] +'"]');
+ frappe.modules_page.activate_link(link);
+ }
+}
diff --git a/frappe/desk/page/modules/modules_section.html b/frappe/desk/page/modules/modules_section.html
index e2c9ce1a8b..d74e683eb4 100644
--- a/frappe/desk/page/modules/modules_section.html
+++ b/frappe/desk/page/modules/modules_section.html
@@ -1,36 +1,29 @@
-
-
-
-
{{ label }}
- {% for (var i=0; i < data.length; i++) { var section = data[i]; %}
-
-
{{ section.label }}
- {% for (var j=0; j < section.items.length; j++) {
- var item = section.items[j];
- if(item.type==="doctype") {
- item.doctype = item.name;
- }
- if(item.doctype && frappe.model.can_read(item.doctype)) {
- if(item.link) {
- item.route=strip(item.link, "#")
- }
- else if(item.type==="doctype") {
- item.route="List/" + item.doctype
- }
- else if(item.type==="report" && item.is_query_report) {
- item.route="query-report/" + item.name
- }
- else if(item.type==="report") {
- item.route="Report/" + item.doctype + "/" + item.name
- }
- else if(item.type==="page") {
- item.route=item.name;
- }
- %}
-
{{ item.label }}
- {% } %}
+
+{% for (var i=0; i < data.length; i++) { var section = data[i]; %}
+{% if ((i % 2)===0) { %}
{% } %}
+
+
+ {{ section.label }}
+
+
+ {% for (var j=0; j < section.items.length; j++) {
+ var item = section.items[j];
+ if(item.shown) { %}
+
{% } %}
{% } %}
+
-
+{% if ((i % 2)===1 || i===data.length-1) { %}
{% } %}
+{% } %}
diff --git a/frappe/desk/page/modules/modules_sidebar.html b/frappe/desk/page/modules/modules_sidebar.html
index 4deedacc01..28a6df4866 100644
--- a/frappe/desk/page/modules/modules_sidebar.html
+++ b/frappe/desk/page/modules/modules_sidebar.html
@@ -1,10 +1,12 @@
diff --git a/frappe/hooks.py b/frappe/hooks.py
index 2bf769a957..14717d4983 100644
--- a/frappe/hooks.py
+++ b/frappe/hooks.py
@@ -21,8 +21,7 @@ app_include_js = [
"assets/js/editor.min.js",
"assets/js/list.min.js",
"assets/js/form.min.js",
- "assets/js/report.min.js",
- "assets/js/module.min.js"
+ "assets/js/report.min.js"
]
app_include_css = [
"assets/css/desk.min.css",
diff --git a/frappe/installer.py b/frappe/installer.py
index e7a786cc6f..5403d35b0f 100755
--- a/frappe/installer.py
+++ b/frappe/installer.py
@@ -186,19 +186,17 @@ def remove_app(app_name, dry_run=False):
if not dry_run:
frappe.delete_doc("Module Def", module_name)
+ # delete desktop icons
+ frappe.db.sql('delete from `tabDesktop Icon` where app=%s', app_name)
+
remove_from_installed_apps(app_name)
-<<<<<<< HEAD
if not dry_run:
# drop tables after a commit
frappe.db.commit()
for doctype in set(drop_doctypes):
frappe.db.sql("drop table `tab{0}`".format(doctype))
-=======
- # delete desktop icons
- frappe.db.sql('delete from `tabDesktop Icon` where app=%s', app_name)
->>>>>>> [enhancement] desktop icons DocType
def post_install(rebuild_website=False):
if rebuild_website:
diff --git a/frappe/patches/v6_24/sync_desktop_icons.py b/frappe/patches/v6_24/sync_desktop_icons.py
index ae8ae6d2e7..51e91bef0b 100644
--- a/frappe/patches/v6_24/sync_desktop_icons.py
+++ b/frappe/patches/v6_24/sync_desktop_icons.py
@@ -30,6 +30,5 @@ def execute():
# set remaining icons as hidden
for module_name in list(set([m['module_name'] for m in modules_list]) - set(user_list)):
- print user, module_name
desktop_icon = get_user_copy(module_name, user=user.name)
desktop_icon.db_set('hidden', 1)
diff --git a/frappe/public/build.json b/frappe/public/build.json
index c564ed48e7..a6326d1668 100644
--- a/frappe/public/build.json
+++ b/frappe/public/build.json
@@ -137,12 +137,6 @@
"css/module.min.css": [
"public/css/module.css"
],
- "js/module.min.js": [
- "public/js/frappe/views/module/module_title.html",
- "public/js/frappe/views/module/module_section.html",
- "public/js/frappe/views/module/module_sidebar.html",
- "public/js/frappe/views/module/moduleview.js"
- ],
"css/form.min.css": [
"public/css/form_grid.css"
],
diff --git a/frappe/public/css/common.css b/frappe/public/css/common.css
index 45f69aff6a..20d00d7f3c 100644
--- a/frappe/public/css/common.css
+++ b/frappe/public/css/common.css
@@ -1,7 +1,3 @@
-@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
-body {
- font-family: "Open Sans", "Helvetica", Arial, "sans-serif";
-}
a {
cursor: pointer;
}
diff --git a/frappe/public/css/desk.css b/frappe/public/css/desk.css
index afd521bbeb..a7be95bad8 100644
--- a/frappe/public/css/desk.css
+++ b/frappe/public/css/desk.css
@@ -1,7 +1,3 @@
-@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
-body {
- font-family: "Open Sans", "Helvetica", Arial, "sans-serif";
-}
a {
cursor: pointer;
}
diff --git a/frappe/public/css/module.css b/frappe/public/css/module.css
index 066f7f0dbe..3eff8f2a43 100644
--- a/frappe/public/css/module.css
+++ b/frappe/public/css/module.css
@@ -1,6 +1,32 @@
+.module-head {
+ padding: 15px 30px;
+ border-bottom: 1px solid #EBEFF2;
+}
+.module-head h1 {
+ padding: 0px;
+ margin: 0px;
+}
+.module-body {
+ padding: 0px 15px;
+}
+.module-body .section-head {
+ margin-bottom: 15px;
+}
+.module-section {
+ padding: 15px;
+ padding-top: 0px;
+}
+.module-section .module-section-link {
+ line-height: 1.5em;
+ font-size: 12px;
+}
+.module-section .section-head {
+ margin-top: 30px;
+}
.module-item {
margin: 0px;
padding: 7px;
+ font-weight: 400;
border-bottom: 1px solid #d1d8dd;
cursor: pointer;
transition: 0.2s;
@@ -23,8 +49,8 @@
.module-item:last-child {
border: none;
}
-.module-sidebar-item.active .icon-chevron-right {
- margin-top: 2px;
+.module-link.active .icon-chevron-right {
+ margin-top: 4px;
display: block !important;
}
.module-item-progress {
@@ -42,6 +68,10 @@
width: 0px;
}
@media (max-width: 767px) {
+ .module-body {
+ border-top: 1px solid #EBEFF2;
+ margin-top: 15px;
+ }
body[data-route^="Module"] .page-title {
width: 100%;
}
diff --git a/frappe/public/css/page.css b/frappe/public/css/page.css
index 543410912b..133e669727 100644
--- a/frappe/public/css/page.css
+++ b/frappe/public/css/page.css
@@ -113,7 +113,7 @@ select.input-sm {
}
@media (max-width: 767px) {
.page-actions {
- width: 100px;
+ width: 105px;
float: right;
}
.page-title {
diff --git a/frappe/public/css/website.css b/frappe/public/css/website.css
index a39b74c513..33e269e7b2 100644
--- a/frappe/public/css/website.css
+++ b/frappe/public/css/website.css
@@ -1,7 +1,3 @@
-@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
-body {
- font-family: "Open Sans", "Helvetica", Arial, "sans-serif";
-}
a {
cursor: pointer;
}
diff --git a/frappe/public/js/frappe/desk.js b/frappe/public/js/frappe/desk.js
index 6145d9f53f..7237d0f401 100644
--- a/frappe/public/js/frappe/desk.js
+++ b/frappe/public/js/frappe/desk.js
@@ -326,7 +326,7 @@ frappe.get_module = function(m, default_module) {
}
if(module.type==="module" && !module.link) {
- module.link = "Module/" + module.module_name;
+ module.link = "modules/" + module.module_name;
}
if(module.type==="list" && !module.link) {
@@ -353,6 +353,47 @@ frappe.get_module = function(m, default_module) {
return module;
};
+frappe.get_desktop_icons = function() {
+ // filter valid icons
+ var out = [];
+
+ var add_to_out = function(module) {
+ var module = frappe.get_module(module.module_name, module);
+ module.app_icon = frappe.ui.app_icon.get_html(module);
+ out.push(module);
+ }
+
+ var is_permitted = function(module) {
+ if(m.type==="page") {
+ return m.link in frappe.boot.page_info;
+ }
+ if(m._doctype) {
+ return frappe.model.can_read(m._doctype);
+ } else {
+ return frappe.boot.user.allow_modules.indexOf(m.module_name) !== -1
+ }
+ }
+
+ for (var i=0, l=frappe.boot.desktop_icons.length; i < l; i++) {
+ var m = frappe.boot.desktop_icons[i];
+ if ((['Setup', 'Core'].indexOf(m.module_name) === -1)
+ && is_permitted(m)
+ && !m.hidden) {
+ add_to_out(m)
+ }
+ }
+
+ if(user_roles.indexOf('System Manager')!=-1) {
+ add_to_out(frappe.get_module('Setup'))
+ }
+
+ if(user_roles.indexOf('Administrator')!=-1) {
+ add_to_out(frappe.get_module('Core'))
+ }
+
+ return out;
+};
+
frappe.add_to_desktop = function(label, doctype) {
frappe.call({
method: 'frappe.desk.doctype.desktop_icon.desktop_icon.add_user_icon',
diff --git a/frappe/public/js/frappe/form/dashboard.js b/frappe/public/js/frappe/form/dashboard.js
index 6830aee93b..d4f59dd6cc 100644
--- a/frappe/public/js/frappe/form/dashboard.js
+++ b/frappe/public/js/frappe/form/dashboard.js
@@ -44,7 +44,7 @@ frappe.ui.form.Dashboard = Class.extend({
', {label:label, icon: frappe.boot.doctype_icons[doctype]}))
+
', {label:label}))
.appendTo(this.body)
badge.find(".badge-link").click(onclick);
diff --git a/frappe/public/js/frappe/list/doclistview.js b/frappe/public/js/frappe/list/doclistview.js
index f060baf588..200d4c3473 100644
--- a/frappe/public/js/frappe/list/doclistview.js
+++ b/frappe/public/js/frappe/list/doclistview.js
@@ -27,10 +27,20 @@ frappe.views.ListFactory = frappe.views.Factory.extend({
});
},
show: function() {
+ this.set_module_breadcrumb();
this._super();
this.set_cur_list();
cur_list && cur_list.refresh();
},
+ set_module_breadcrumb: function() {
+ if(frappe.route_history.length > 1) {
+ var prev_route = frappe.route_history[frappe.route_history.length-2];
+ if(prev_route[0]==="modules") {
+ // save the last page from the breadcrumb was accessed
+ frappe.breadcrumbs.set_doctype_module(frappe.get_route()[1], prev_route[1]);
+ }
+ }
+ },
set_cur_list: function() {
var route = frappe.get_route();
cur_list = frappe.container.page && frappe.container.page.doclistview;
diff --git a/frappe/public/js/frappe/misc/user.js b/frappe/public/js/frappe/misc/user.js
index 1e832745f7..73aeffd77a 100644
--- a/frappe/public/js/frappe/misc/user.js
+++ b/frappe/public/js/frappe/misc/user.js
@@ -141,9 +141,10 @@ $.extend(frappe.user, {
},
is_module: function(m) {
- frappe.boot.desktop_icons.forEach(function(module) {
- if(m===module.module_name) return true;
- });
+ var icons = frappe.get_desktop_icons();
+ for(var i=0; i\s*<\/p>/g, "").replace(/
(\s*
\s*)+/g, "
");
},
diff --git a/frappe/public/js/frappe/ui/dialog.js b/frappe/public/js/frappe/ui/dialog.js
index b430fd8b2d..496d997634 100644
--- a/frappe/public/js/frappe/ui/dialog.js
+++ b/frappe/public/js/frappe/ui/dialog.js
@@ -37,6 +37,9 @@ frappe.ui.Dialog = frappe.ui.FieldGroup.extend({
var me = this;
this.$wrapper
.on("hide.bs.modal", function() {
+ if(me.body_hidden) {
+ $("#body_div").toggle(true);
+ }
me.display = false;
if(frappe.ui.open_dialogs[frappe.ui.open_dialogs.length-1]===me) {
frappe.ui.open_dialogs.pop();
@@ -49,6 +52,10 @@ frappe.ui.Dialog = frappe.ui.FieldGroup.extend({
})
.on("shown.bs.modal", function() {
// focus on first input
+ if(frappe.utils.is_mobile()) {
+ $("#body_div").toggle(false);
+ me.body_hidden = true;
+ }
me.display = true;
cur_dialog = me;
frappe.ui.open_dialogs.push(me);
diff --git a/frappe/public/js/frappe/ui/page.js b/frappe/public/js/frappe/ui/page.js
index 2899eeea02..44e980ab0f 100644
--- a/frappe/public/js/frappe/ui/page.js
+++ b/frappe/public/js/frappe/ui/page.js
@@ -53,6 +53,9 @@ frappe.ui.Page = Class.extend({
\
\
');
+ // this.wrapper.find('.page-title')
+ // .removeClass('col-md-7').addClass('col-md-offset-2 col-md-5')
+ // .css({'padding-left': '45px'});
}
this.$title_area = this.wrapper.find("h1");
@@ -299,25 +302,6 @@ frappe.ui.Page = Class.extend({
this.$sub_title_area.html(txt).toggleClass("hide", !!!txt);
},
- add_module_icon: function(module, doctype, onclick, sub_title) {
- var module_info = frappe.get_module(module);
- if(!module_info) {
- module_info = {
- icon: "icon-question-sign",
- color: "#ddd"
- }
- }
- var icon = frappe.boot.doctype_icons[doctype] || module_info.icon;
-
- this.get_main_icon(icon)
- .attr("doctype-name", doctype);
-
- this.set_title_left(function() {
- var route = frappe.get_route()[0]==module_info.link ? "" : module_info.link;
- frappe.set_route(route);
- });
- },
-
get_main_icon: function(icon) {
return this.$title_area.find(".title-icon")
.html(' ')
diff --git a/frappe/public/js/frappe/ui/toolbar/notifications.js b/frappe/public/js/frappe/ui/toolbar/notifications.js
index 4bd4b672dd..2b70172e4b 100644
--- a/frappe/public/js/frappe/ui/toolbar/notifications.js
+++ b/frappe/public/js/frappe/ui/toolbar/notifications.js
@@ -69,7 +69,6 @@ frappe.ui.notifications.add_notification = function(doctype, notifications_map)
%(count)s \
%(label)s ', {
label: __(label),
- icon: frappe.boot.doctype_icons[doctype],
count: count > 99 ? '99+' : count,
data_doctype: doctype
});
diff --git a/frappe/public/js/frappe/views/breadcrumbs.js b/frappe/public/js/frappe/views/breadcrumbs.js
index 2cc51f791b..5eb1f10f06 100644
--- a/frappe/public/js/frappe/views/breadcrumbs.js
+++ b/frappe/public/js/frappe/views/breadcrumbs.js
@@ -50,8 +50,9 @@ frappe.breadcrumbs = {
icon = module_info && module_info.icon,
label = module_info ? module_info.label : breadcrumbs.module;
+
if(module_info) {
- $(repl('%(label)s',
+ $(repl('%(label)s',
{ module: breadcrumbs.module, label: __(label) }))
.appendTo($breadcrumbs);
}
diff --git a/frappe/public/js/frappe/views/module/module_section.html b/frappe/public/js/frappe/views/module/module_section.html
deleted file mode 100644
index f4ed7affcc..0000000000
--- a/frappe/public/js/frappe/views/module/module_section.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
- {% for(var i=0, j= data.items.length; i < j; i++) { var item = data.items[i]; %}
-
- {% if (item.description) { %}
-
-
{%= item.label || item.name %}
- {% if (item.type==="doctype" || item.type==="page") { %}
-
- {% } %}
-
{%= item.description %}
-
-
- {% if (item.last_modified) { %}
- {%= comment_when(item.last_modified) %}
- {% } %}
-
- {% } else { %}
-
-
{%= item.label || item.name %}
-
- {% } %}
-
- {% } %}
-
-
diff --git a/frappe/public/js/frappe/views/module/module_sidebar.html b/frappe/public/js/frappe/views/module/module_sidebar.html
deleted file mode 100644
index 495b3bcd07..0000000000
--- a/frappe/public/js/frappe/views/module/module_sidebar.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
diff --git a/frappe/public/js/frappe/views/module/module_title.html b/frappe/public/js/frappe/views/module/module_title.html
deleted file mode 100644
index 53e9c90665..0000000000
--- a/frappe/public/js/frappe/views/module/module_title.html
+++ /dev/null
@@ -1,20 +0,0 @@
-{%= title %}
-
diff --git a/frappe/public/js/frappe/views/module/moduleview.js b/frappe/public/js/frappe/views/module/moduleview.js
deleted file mode 100644
index a819d89266..0000000000
--- a/frappe/public/js/frappe/views/module/moduleview.js
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// MIT License. See license.txt
-
-frappe.provide("frappe.views.moduleview");
-frappe.provide("frappe.module_page");
-
-frappe.views.ModuleFactory = frappe.views.Factory.extend({
- make: function(route) {
- var module = route[1];
- frappe.views.moduleview[module] = parent;
- new frappe.views.moduleview.ModuleView(module);
- this.on_show();
- },
- on_show: function() {
- frappe.breadcrumbs.last_module = frappe.get_route()[1];
- }
-});
-
-frappe.views.moduleview.ModuleView = Class.extend({
- init: function(module) {
- this.module = module;
- this.module_info = frappe.get_module(module) || {};
- this.module_label = __(this.module_info.label || this.module);
- this.sections = {};
- this.current_section = null;
- this.make();
- $(".navbar-center").html(this.module_label);
- },
-
- make: function() {
- var me = this;
- return frappe.call({
- method: "frappe.desk.moduleview.get",
- args: {
- module: this.module
- },
- callback: function(r) {
- me.data = r.message;
- me.parent = frappe.make_page(true);
- frappe.views.moduleview[me.module] = me.parent;
- me.page = me.parent.page;
- me.parent.moduleview = me;
- me.render();
- },
- freeze: true,
- });
- },
-
- render: function() {
- this.page.main.empty();
- this.make_sidebar();
- this.sections_by_label = {};
-
- // index by label
- for(var i in this.data.data) {
- this.sections_by_label[this.data.data[i].label] = this.data.data[i];
- }
- this.activate(this.data.data[0].label);
- },
-
- make_sidebar: function(name) {
- var me = this;
- var sidebar_content = frappe.render_template("module_sidebar", {data:this.data});
- var module_sidebar = $(sidebar_content)
- .addClass("nav nav-pills nav-stacked")
- .appendTo(this.page.sidebar.addClass("hidden-xs hidden-sm"));
- var offcanvas_module_sidebar = $(sidebar_content)
- .addClass("list-unstyled sidebar-menu")
- .appendTo($(".sidebar-left .module-sidebar").empty());
-
- this.sidebar = offcanvas_module_sidebar.add(module_sidebar);
- this.sidebar.on("click", ".module-link", function() {
- me.activate($(this).parent().attr("data-label"));
- });
- },
-
- activate: function(name) {
- var me = this;
- if(this.current_section) {
- this.current_section.addClass("hide");
- }
- if(!this.sections[name]) {
- var data = this.sections_by_label[name];
- this.sections[name] = $(frappe.render_template("module_section", { data: data }))
- .appendTo(this.page.main);
-
- $(this.sections[name]).find(".module-item").each(function(i, mi) {
- var item = data.items[$(mi).attr("data-item-index")];
- $(mi)
- .attr("data-route", me.get_route(item).join("/"))
- .attr("data-label", item.name)
- .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];
- }
- if(item.type==="help") {
- frappe.help.show_video(item.youtube_id);
- return false;
- } else {
- frappe.set_route(me.get_route(item));
- }
- });
- });
- }
-
- // set title
- this.page.set_title(repl('%(module)s\
- %(section)s',
- {module: this.module_label, section: name}));
-
- this.current_section = this.sections[name];
- this.current_section.removeClass("hide");
-
- // active
- this.sidebar.find("li.active").removeClass("active");
- this.sidebar.find('[data-label="'+ name +'"]').addClass("active");
-
- frappe.app.update_notification_count_in_modules();
- },
-
- get_route: function(item) {
- var route = [item.route || item.link];
- if (!route[0]) {
- if (item.type == "doctype") {
- // save the last page from the breadcrumb was accessed
- frappe.breadcrumbs.set_doctype_module(item.name, this.module);
- if(!item.view) item.view = "List"
- route = [item.view, item.name];
- } else if (item.type == "page") {
- route = [item.name]
- } else if (item.type == "report") {
- if(item.is_query_report) {
- route = ["query-report", item.name];
- } else {
- route = ["Report", item.doctype, item.name];
- }
- }
- }
- return route;
- }
-});
diff --git a/frappe/public/less/common.less b/frappe/public/less/common.less
index 075f84d658..7449d72b29 100644
--- a/frappe/public/less/common.less
+++ b/frappe/public/less/common.less
@@ -1,11 +1,11 @@
@import "variables.less";
@import "mixins.less";
-@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
-
-body {
- font-family: "Open Sans", "Helvetica", Arial, "sans-serif";
-}
+// @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
+//
+// body {
+// font-family: "Open Sans", "Helvetica", Arial, "sans-serif";
+// }
a {
cursor: pointer;
diff --git a/frappe/public/less/module.less b/frappe/public/less/module.less
index 9d3cd8a16a..f96a911005 100644
--- a/frappe/public/less/module.less
+++ b/frappe/public/less/module.less
@@ -1,8 +1,41 @@
@import "variables.less";
+.module-head {
+ padding: 15px 30px;
+ border-bottom: 1px solid @light-border-color;
+}
+
+.module-head h1 {
+ padding: 0px;
+ margin: 0px;
+}
+
+.module-body {
+ padding: 0px 15px;
+
+ .section-head {
+ margin-bottom: 15px;
+ }
+}
+
+.module-section {
+ padding: 15px;
+ padding-top: 0px;
+
+ .module-section-link {
+ line-height: 1.5em;
+ font-size: 12px;
+ }
+}
+
+.module-section .section-head {
+ margin-top: 30px;
+}
+
.module-item {
margin: 0px;
padding: 7px;
+ font-weight: 400;
border-bottom: 1px solid @border-color;
cursor: pointer;
transition: 0.2s;
@@ -30,8 +63,8 @@
border: none;
}
-.module-sidebar-item.active .icon-chevron-right {
- margin-top: 2px;
+.module-link.active .icon-chevron-right {
+ margin-top: 4px;
display: block !important;
}
@@ -53,11 +86,17 @@
}
@media(max-width: 767px) {
+ .module-body {
+ border-top: 1px solid @light-border-color;
+ margin-top: 15px;
+ }
+
body[data-route^="Module"] {
.page-title {
width: 100%;
}
+
.page-actions {
display: none !important;
}
diff --git a/frappe/public/less/page.less b/frappe/public/less/page.less
index 8f7652fb2c..379e61056f 100644
--- a/frappe/public/less/page.less
+++ b/frappe/public/less/page.less
@@ -146,7 +146,7 @@ select.input-sm {
@media(max-width: @screen-xs) {
.page-actions {
- width: 100px;
+ width: 105px;
float: right;
}
diff --git a/frappe/utils/jinja.py b/frappe/utils/jinja.py
index b36343907a..5b05e80c89 100644
--- a/frappe/utils/jinja.py
+++ b/frappe/utils/jinja.py
@@ -42,7 +42,9 @@ def render_template(template, context, is_path=None):
:param is_path: (optional) assert that the `template` parameter is a path'''
# if it ends with .html then its a freaking path, not html
- if is_path or (template.endswith('.html') and '\n' not in template):
+ if (is_path
+ or template.startswith("templates/")
+ or (template.endswith('.html') and '\n' not in template)):
return get_jenv().get_template(template).render(context)
else:
return get_jenv().from_string(template).render(context)