Revert "Modules dropdown" (#5855)

* Revert "bench use <site> should check if the  site exists (#5849)"

This reverts commit 630858eb96.

* Revert "Add option to convert password to use ASCII instead of Unicode when needed by smtp server config (#5793)"

This reverts commit 191684f6a5.

* Revert "Token based authentication (#5752)"

This reverts commit abd3333bae.

* Revert "[minor] test fix"

This reverts commit b6ba3915a6.

* Revert "allow null when time field is not required (#5832)"

This reverts commit 803f6b0c7b.

* Revert "remove duplicate field entry for fieldname two_factor_authentication (#5846)"

This reverts commit 6a06e65d20.

* Revert "Query Report (#5845)"

This reverts commit f870a0bd25.

* Revert "Modules dropdown (#5767)"

This reverts commit 6f908b3443.
This commit is contained in:
Prateeksha Singh 2018-07-23 15:34:34 +05:30 committed by Rushabh Mehta
parent 630858eb96
commit 0d8b9c8653
8 changed files with 57 additions and 219 deletions

View file

@ -16,7 +16,6 @@ from frappe.desk.form.load import get_meta_bundle
from frappe.utils.change_log import get_versions
from frappe.translate import get_lang_dict
from frappe.email.inbox import get_email_accounts
from frappe.config.desktop import get_data as get_core_modules
from frappe.core.doctype.feedback_trigger.feedback_trigger import get_enabled_feedback_trigger
def get_bootinfo():
@ -40,7 +39,7 @@ def get_bootinfo():
bootinfo.modules = {}
bootinfo.module_list = []
load_desktop_modules(bootinfo)
load_desktop_icons(bootinfo)
bootinfo.letter_heads = get_letter_heads()
bootinfo.active_domains = frappe.get_active_domains()
bootinfo.all_domains = [d.get("name") for d in frappe.get_all("Domain")]
@ -96,17 +95,10 @@ def load_conf_settings(bootinfo):
for key in ('developer_mode', 'socketio_port', 'file_watcher_port'):
if key in conf: bootinfo[key] = conf.get(key)
def load_desktop_modules(bootinfo):
# Get all desktop icons
def load_desktop_icons(bootinfo):
from frappe.desk.doctype.desktop_icon.desktop_icon import get_desktop_icons
bootinfo.desktop_icons = get_desktop_icons()
# Define core modules
bootinfo.core_modules = get_core_modules()
# Add explore links
bootinfo["page_quick_links"] = frappe.get_hooks('page_quick_links') or []
def get_allowed_pages():
return get_user_pages_or_reports('Page')

View file

@ -18,17 +18,6 @@ frappe.pages['modules'].on_page_load = function(wrapper) {
.show(frappe.session.user);
});
let quick_link = frappe.boot.page_quick_links ? frappe.boot.page_quick_links[0] : null;
if(quick_link) {
this.page.set_secondary_action(
quick_link.label,
() => {
frappe.set_route(quick_link.link);
}
);
}
if(frappe.user.has_role('System Manager')) {
page.add_menu_item(__('Install Apps'), function() {
frappe.set_route("applications");

View file

@ -267,6 +267,9 @@ a.no-decoration:active {
height: 40px;
text-align: center;
}
.navbar .octicon {
margin-top: 5px;
}
.frappe-chat > .frappe-chat-popper {
position: fixed;
bottom: 0px;

View file

@ -2633,11 +2633,9 @@ frappe.chat.render = (render = true, force = false) =>
// Render if frappe-chat-toggle doesn't exist.
if ( frappe.utils.is_empty($placeholder.has('.frappe-chat-toggle')) ) {
// Note: custom padding set visually for icon
const $template = $(`
<a class="dropdown-toggle frappe-chat-toggle" data-toggle="dropdown">
<div style="padding-top: 3px;">
<div>
<i class="octicon octicon-comment-discussion"/>
</div>
</a>

View file

@ -1,61 +1,10 @@
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header navbar-desk" style="position: relative">
<ul class="nav navbar-nav">
<li class="dropdown dropdown-explore dropdown-help dropdown-mobile">
<a class="navbar-brand toggle-sidebar visible-xs visible-sm">
<i class="octicon octicon-three-bars"></i>
</a>
<a class="navbar-brand navbar-home hidden-xs hidden-sm dropdown-toggle"
style="padding-left: 15px"
data-toggle="dropdown"
onclick="return false;"
href="#">
<b class="caret"></b>
</a>
<div class="dropdown-menu">
<div class="menu-container">
<ul class="explore-menu modules-menu col-md-6">
<li class="h6 menu-heading text-muted">{{__("MODULES")}}</li>
</ul>
<ul class="explore-menu col-md-6" role="menu">
<li class="h6 menu-heading text-muted">{{ __("PLACES") }}</li>
<li class="places-menu">
<a href="#" class="desk-link-item">{%= __("Desk") %}</a>
</li>
<li><a href="#" style="padding: 25px;"></a></li>
<li class="h6 menu-heading collapsible text-muted">
<span style="margin-right: 10px;">{{ __("HELP") }}</span>
<span class="octicon collapse-indicator octicon-chevron-down"></span>
<span class="octicon collapse-indicator octicon-chevron-up"></span>
</li>
<li>
<ul class="help-menu hide" style="list-style: none; padding: 0;">
<li id="help-links"></li>
<li class="divider"></li>
<li><a href="#">{%= __("Learn") %}</a></li>
<li>
<a data-link-type="documentation"
data-path="/documentation/index" target="_blank" rel="noopener noreferrer">{{ __("Documentation") }}</a>
</li>
<li class="divider documentation-links"></li>
<li><a href="#" onclick="return frappe.ui.toolbar.show_about();">
{%= __("About") %}</a></li>
</ul>
</li>
</ul>
</div>
</li>
</ul>
<div class="navbar-header navbar-desk">
<a class="navbar-brand toggle-sidebar visible-xs visible-sm">
<i class="octicon octicon-three-bars"></i>
</a>
<a class="navbar-brand navbar-home hidden-xs hidden-sm" href="#">Home</a>
<ul class="nav navbar-nav" id="navbar-breadcrumbs">
</ul>
</div>
@ -96,6 +45,30 @@
</ul>
</li>
<li class="dropdown dropdown-help dropdown-mobile">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"
onclick="return false;" style="height: 40px;">
<span class="hidden-xs hidden-sm" style="line-height: 24px;">{{ __("Help") }} <b class="caret"></b></span>
<span class="visible-xs visible-sm standard-image"
style="padding: 50% 7px; font-size: 17px; background-color: #fafbfc; font-weight: 100;">?</span>
</a>
<ul class="dropdown-menu" role="menu">
<div class="input-group" style="border-bottom: 1px solid #d1d8dd;">
<input id="input-help" type="text" placeholder="{{ __("What do you need help with?") }}" autofocus>
<span class="input-group-btn"><button class="btn btn-default">{{ __("Go") }}</button></span>
</div>
<li id="help-links"></li>
<li class="divider"></li>
<li>
<a data-link-type="documentation"
data-path="/documentation/index" target="_blank" rel="noopener noreferrer">{{ __("Documentation") }}</a>
</li>
<li class="divider documentation-links"></li>
<li><a href="#" onclick="return frappe.ui.toolbar.show_about();">
{%= __("About") %}</a></li>
</ul>
</li>
<!-- frappe.chat -->
<!-- "placeholder, to display or not to display." -->
<li class="frappe-chat-dropdown"></li>

View file

@ -4,8 +4,8 @@
frappe.provide("frappe.ui.toolbar");
frappe.provide('frappe.search');
frappe.ui.toolbar.Toolbar = class {
constructor() {
frappe.ui.toolbar.Toolbar = Class.extend({
init: function() {
$('header').append(frappe.render_template("navbar", {
avatar: frappe.avatar(frappe.session.user)
}));
@ -16,78 +16,28 @@ frappe.ui.toolbar.Toolbar = class {
awesome_bar.setup("#modal-search");
this.make();
}
},
make() {
make: function() {
this.setup_sidebar();
this.setup_modules_dropdown();
this.setup_help();
this.setup_modules_dialog();
this.setup_progress_dialog();
this.bind_events();
$(document).trigger('toolbar_setup');
}
},
setup_modules_dropdown() {
const modules_menu = $(".modules-menu");
const places_menu = $(".places-menu");
let get_link = (name, label, link) => {
return $(`<a class="ellipsis" data-name="${name}" href="#${link}">
<span>${label}</span>
</a>`);
};
const core = frappe.boot.core_modules.map(d => d.label || d.module_name);
const all_links = frappe.get_desktop_icons(true)
.filter(d => d.type==='module' && !d.blocked)
.sort((a, b) => {
return (a._label > b._label) ? 1 : -1;
});
let modules = [];
let places = [];
all_links.forEach(m => {
m.name = m.module_name;
m.label = m._label;
if(core.includes(m.label)) {
places.push(m);
} else {
modules.push(m);
}
});
// Add explore links to places
if(frappe.boot.page_quick_links) {
places = frappe.boot.page_quick_links.concat(places);
}
modules.forEach(m => {
modules_menu.append(get_link(m.name, m.label, m.link));
});
places.forEach(m => {
places_menu.append(get_link(m.name, m.label, m.link));
});
$(".menu-heading.collapsible").on('click', function() {
$(".menu-heading.collapsible").toggleClass("open");
$(".help-menu").toggleClass("hide");
return false;
});
}
setup_modules_dialog() {
this.modules_select = new frappe.ui.toolbar.ModulesSelect();
$('.navbar-set-desktop-icons').on('click', () => {
this.modules_select.show();
});
}
},
bind_events() {
bind_events: function() {
$(document).on("notification-update", function() {
frappe.ui.notifications.update_notifications();
});
@ -104,9 +54,9 @@ frappe.ui.toolbar.Toolbar = class {
search_modal.find('#modal-search').focus();
}, 300);
});
}
},
setup_sidebar() {
setup_sidebar: function () {
var header = $('header');
header.find(".toggle-sidebar").on("click", function () {
var layout_side_section = $('.layout-side-section');
@ -140,9 +90,9 @@ frappe.ui.toolbar.Toolbar = class {
});
}
});
}
},
setup_help() {
setup_help: function () {
frappe.provide('frappe.help');
frappe.help.show_results = show_results;
@ -173,11 +123,6 @@ frappe.ui.toolbar.Toolbar = class {
});
$(document).on("page-change", function () {
// Show Desk link if inner route
const desk_link = $(".places-menu .desk-link-item");
const is_route_present = !!frappe.get_route_str().length;
desk_link.toggle(is_route_present);
var $help_links = $(".dropdown-help #help-links");
$help_links.html("");
@ -255,9 +200,9 @@ frappe.ui.toolbar.Toolbar = class {
});
}
}
}
},
setup_progress_dialog() {
setup_progress_dialog: function() {
var me = this;
frappe.call({
method: "frappe.desk.user_progress.get_user_progress_slides",
@ -290,7 +235,7 @@ frappe.ui.toolbar.Toolbar = class {
freeze: false
});
}
};
});
$.extend(frappe.ui.toolbar, {
add_dropdown_button: function(parent, label, click, icon) {

View file

@ -70,6 +70,8 @@
height: @chat-toggle-height;
text-align: center;
}
.octicon { margin-top: 5px; } // Hack, somewhat.
}
.frappe-chat

View file

@ -12,25 +12,9 @@
font-weight: bold;
}
.collapsible {
cursor: pointer;
// default: collapsed
.collapse-indicator.octicon-chevron-up {
display: none;
}
.collapse-indicator.octicon-chevron-down {
display: inline;
}
&.open {
.collapse-indicator.octicon-chevron-up {
display: inline;
}
.collapse-indicator.octicon-chevron-down {
display: none;
}
}
.dropdown-toggle {
padding-top: 8px;
padding-bottom: 8px;
}
// instead of changes within BS3 itself
@ -49,39 +33,6 @@
.badge {
font-weight: normal;
}
#navbar-breadcrumbs a:before {
margin-left: 10px;
}
ul.explore-menu {
list-style: none;
padding: 0;
a {
font-weight: normal;
padding: 14px;
display: block;
}
a:hover {
color: #262626;
text-decoration: none;
background-color: #f0f4f7;
}
.menu-heading {
margin: 0;
padding: 12px 14px;
font-size: 11px;
display: flex;
}
.divider {
margin: 0px 14px;
}
}
}
.navbar-icon-home {
@ -163,16 +114,6 @@
}
}
.dropdown-explore {
.menu-container {
display: flex;
ul:nth-child(2n) {
background-color: @light-bg
}
}
}
.dropdown-help .dropdown-menu {
width: 350px !important;
max-height: 440px;
@ -180,7 +121,8 @@
.input-group {
width: 100%;
padding: 9px 12px;
background-color: #f5f7fa;
padding: 8px 12px;
}
input {
@ -207,12 +149,6 @@
}
}
.dropdown-explore .dropdown-menu {
width: 400px !important;
max-height: 520px;
}
@media (max-width: 767px) {
.dropdown-mobile.open .dropdown-menu {
position: absolute;