diff --git a/HISTORY.rst b/HISTORY.rst index 9a54b3602c..ea73e8fd7a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -123,6 +123,7 @@ - Add link to view a specific page's OCR content. - Remove the duplicated setting pdftotext_path from the OCR path. This is now handled by the document parsing app. +- Implement partial refresh of the main menu. 3.0.3 (2018-08-17) ================== diff --git a/mayan/apps/appearance/static/appearance/js/mayan_app.js b/mayan/apps/appearance/static/appearance/js/mayan_app.js index 7dd052e46e..7928164aa3 100644 --- a/mayan/apps/appearance/static/appearance/js/mayan_app.js +++ b/mayan/apps/appearance/static/appearance/js/mayan_app.js @@ -105,6 +105,19 @@ class MayanApp { }); } + doRefreshMainMenu () { + console.log('doRefreshMainMenu'); + $.ajax({ + complete: function() { + setTimeout(app.doRefreshMainMenu, 5000); + }, + success: function(data) { + $('#main-menu').html(data); + }, + url: '/main_menu', + }); + } + doToastrMessages () { toastr.options = { 'closeButton': true, @@ -183,6 +196,7 @@ class MayanApp { this.setupItemsSelector(); this.setupNavbarCollapse(); this.setupNewWindowAnchor(); + this.doRefreshMainMenu(); partialNavigation.initialize(); } diff --git a/mayan/apps/appearance/templates/appearance/main_menu.html b/mayan/apps/appearance/templates/appearance/main_menu.html new file mode 100644 index 0000000000..3bddb21b6f --- /dev/null +++ b/mayan/apps/appearance/templates/appearance/main_menu.html @@ -0,0 +1,38 @@ +{% load i18n %} + +{% load navigation_tags %} +{% load smart_settings_tags %} + + diff --git a/mayan/apps/appearance/templates/appearance/root.html b/mayan/apps/appearance/templates/appearance/root.html index 81c77128d1..7294cedc2b 100644 --- a/mayan/apps/appearance/templates/appearance/root.html +++ b/mayan/apps/appearance/templates/appearance/root.html @@ -33,40 +33,9 @@ {% if appearance_type == 'plain' %} {% block content_plain %}{% endblock %} {% else %} - - +
diff --git a/mayan/apps/common/urls.py b/mayan/apps/common/urls.py index ca7e6e656c..063e1f5680 100644 --- a/mayan/apps/common/urls.py +++ b/mayan/apps/common/urls.py @@ -7,9 +7,10 @@ from .api_views import APIContentTypeList from .views import ( AboutView, CheckVersionView, CurrentUserDetailsView, CurrentUserEditView, CurrentUserLocaleProfileDetailsView, CurrentUserLocaleProfileEditView, - FaviconRedirectView, HomeView, LicenseView, ObjectErrorLogEntryListClearView, - ObjectErrorLogEntryListView, PackagesLicensesView, RootView, SetupListView, - ToolsListView, multi_object_action_view + FaviconRedirectView, HomeView, LicenseView, MainMenuView, + ObjectErrorLogEntryListClearView, ObjectErrorLogEntryListView, + PackagesLicensesView, RootView, SetupListView, ToolsListView, + multi_object_action_view ) urlpatterns = [ @@ -21,6 +22,7 @@ urlpatterns = [ name='check_version_view' ), url(r'^license/$', LicenseView.as_view(), name='license_view'), + url(r'^main_menu/$', MainMenuView.as_view(), name='main_menu_view'), url( r'^packages/licenses/$', PackagesLicensesView.as_view(), name='packages_licenses_view' diff --git a/mayan/apps/common/views.py b/mayan/apps/common/views.py index 0fa384192f..2baf652de0 100644 --- a/mayan/apps/common/views.py +++ b/mayan/apps/common/views.py @@ -168,6 +168,11 @@ class LicenseView(SimpleView): template_name = 'appearance/generic_form.html' +class MainMenuView(SimpleView): + extra_context = {'home_view': settings.HOME_VIEW} + template_name = 'appearance/main_menu.html' + + class ObjectErrorLogEntryListClearView(ConfirmView): def get_extra_context(self): return {