mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
parent
82d5952ddd
commit
6b53fd2bd4
@ -41,6 +41,7 @@ from .views import SettingsView, EditUserView, SetPasswordView, CustomEmailView,
|
|||||||
from .views import CurrencyRefreshView
|
from .views import CurrencyRefreshView
|
||||||
from .views import AppearanceSelectView, SettingCategorySelectView
|
from .views import AppearanceSelectView, SettingCategorySelectView
|
||||||
from .views import DynamicJsView
|
from .views import DynamicJsView
|
||||||
|
from .views import NotificationsView
|
||||||
|
|
||||||
from .api import InfoView, NotFoundView
|
from .api import InfoView, NotFoundView
|
||||||
from .api import ActionPluginView
|
from .api import ActionPluginView
|
||||||
@ -87,6 +88,12 @@ settings_urls = [
|
|||||||
url(r'^.*$', SettingsView.as_view(template_name='InvenTree/settings/settings.html'), name='settings'),
|
url(r'^.*$', SettingsView.as_view(template_name='InvenTree/settings/settings.html'), name='settings'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
notifications_urls = [
|
||||||
|
|
||||||
|
# Catch any other urls
|
||||||
|
url(r'^.*$', NotificationsView.as_view(), name='notifications'),
|
||||||
|
]
|
||||||
|
|
||||||
# These javascript files are served "dynamically" - i.e. rendered on demand
|
# These javascript files are served "dynamically" - i.e. rendered on demand
|
||||||
dynamic_javascript_urls = [
|
dynamic_javascript_urls = [
|
||||||
url(r'^calendar.js', DynamicJsView.as_view(template_name='js/dynamic/calendar.js'), name='calendar.js'),
|
url(r'^calendar.js', DynamicJsView.as_view(template_name='js/dynamic/calendar.js'), name='calendar.js'),
|
||||||
@ -138,6 +145,8 @@ urlpatterns = [
|
|||||||
|
|
||||||
url(r'^settings/', include(settings_urls)),
|
url(r'^settings/', include(settings_urls)),
|
||||||
|
|
||||||
|
url(r'^notifications/', include(notifications_urls)),
|
||||||
|
|
||||||
url(r'^edit-user/', EditUserView.as_view(), name='edit-user'),
|
url(r'^edit-user/', EditUserView.as_view(), name='edit-user'),
|
||||||
url(r'^set-password/', SetPasswordView.as_view(), name='set-password'),
|
url(r'^set-password/', SetPasswordView.as_view(), name='set-password'),
|
||||||
|
|
||||||
|
@ -884,3 +884,18 @@ class DatabaseStatsView(AjaxView):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationsView(TemplateView):
|
||||||
|
""" View for showing notifications
|
||||||
|
"""
|
||||||
|
|
||||||
|
template_name = "InvenTree/notifications/notifications.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
|
||||||
|
ctx = super().get_context_data(**kwargs).copy()
|
||||||
|
|
||||||
|
# ctx['settings'] = InvenTreeSetting.objects.all().order_by('key')
|
||||||
|
|
||||||
|
return ctx
|
||||||
|
25
InvenTree/templates/InvenTree/notifications/history.html
Normal file
25
InvenTree/templates/InvenTree/notifications/history.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{% extends "panel.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load inventree_extras %}
|
||||||
|
|
||||||
|
{% block label %}history{% endblock %}
|
||||||
|
|
||||||
|
{% block heading %}
|
||||||
|
{% trans "History" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block actions %}
|
||||||
|
<div class='btn btn-secondary' type='button' id='history-refresh' title='{% trans "Refresh History" %}'>
|
||||||
|
<span class='fa fa-sync'></span> {% trans "Refresh History" %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<table class='table table-striped table-condensed' id='history-table'>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
25
InvenTree/templates/InvenTree/notifications/inbox.html
Normal file
25
InvenTree/templates/InvenTree/notifications/inbox.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{% extends "panel.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load inventree_extras %}
|
||||||
|
|
||||||
|
{% block label %}inbox{% endblock %}
|
||||||
|
|
||||||
|
{% block heading %}
|
||||||
|
{% trans "Inbox" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block actions %}
|
||||||
|
<div class='btn btn-secondary' type='button' id='inbox-refresh' title='{% trans "Refresh Inbox" %}'>
|
||||||
|
<span class='fa fa-sync'></span> {% trans "Refresh Inbox" %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<table class='table table-striped table-condensed' id='inbox-table'>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
119
InvenTree/templates/InvenTree/notifications/notifications.html
Normal file
119
InvenTree/templates/InvenTree/notifications/notifications.html
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load inventree_extras %}
|
||||||
|
|
||||||
|
{% block breadcrumb_list %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_title %}
|
||||||
|
{% inventree_title %} | {% trans "Notifications" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block sidebar %}
|
||||||
|
{% include "InvenTree/notifications/sidebar.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% include "InvenTree/notifications/inbox.html" %}
|
||||||
|
{% include "InvenTree/notifications/history.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js_ready %}
|
||||||
|
{{ block.super }}
|
||||||
|
|
||||||
|
$("#inbox-table").inventreeTable({
|
||||||
|
url: "{% url 'api-part-parameter-template-list' %}",
|
||||||
|
queryParams: {
|
||||||
|
ordering: 'name',
|
||||||
|
},
|
||||||
|
formatNoMatches: function() { return '{% trans "No part parameter templates found" %}'; },
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
field: 'pk',
|
||||||
|
title: '{% trans "ID" %}',
|
||||||
|
visible: false,
|
||||||
|
switchable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
title: '{% trans "Name" %}',
|
||||||
|
sortable: 'true',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'units',
|
||||||
|
title: '{% trans "Units" %}',
|
||||||
|
sortable: 'true',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
|
||||||
|
var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
|
||||||
|
|
||||||
|
var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#inbox-table").on('click', '.template-edit', function() {
|
||||||
|
var button = $(this);
|
||||||
|
|
||||||
|
var url = "/part/parameter/template/" + button.attr('pk') + "/edit/";
|
||||||
|
|
||||||
|
launchModalForm(url, {
|
||||||
|
success: function() {
|
||||||
|
$("#inbox-table").bootstrapTable('refresh');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#inbox-refresh").on('click', function() {
|
||||||
|
$("#inbox-table").bootstrapTable('refresh');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#history-table").inventreeTable({
|
||||||
|
url: "{% url 'api-part-parameter-template-list' %}",
|
||||||
|
queryParams: {
|
||||||
|
ordering: 'name',
|
||||||
|
},
|
||||||
|
formatNoMatches: function() { return '{% trans "No part parameter templates found" %}'; },
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
field: 'pk',
|
||||||
|
title: '{% trans "ID" %}',
|
||||||
|
visible: false,
|
||||||
|
switchable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
title: '{% trans "Name" %}',
|
||||||
|
sortable: 'true',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'units',
|
||||||
|
title: '{% trans "Units" %}',
|
||||||
|
sortable: 'true',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
|
||||||
|
var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
|
||||||
|
|
||||||
|
var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#history-refresh").on('click', function() {
|
||||||
|
$("#history-table").bootstrapTable('refresh');
|
||||||
|
});
|
||||||
|
|
||||||
|
enableSidebar('notifications');
|
||||||
|
{% endblock %}
|
11
InvenTree/templates/InvenTree/notifications/sidebar.html
Normal file
11
InvenTree/templates/InvenTree/notifications/sidebar.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
|
{% load inventree_extras %}
|
||||||
|
|
||||||
|
{% trans "Notifications" as text %}
|
||||||
|
{% include "sidebar_header.html" with text=text icon='fa-user' %}
|
||||||
|
|
||||||
|
{% trans "Inbox" as text %}
|
||||||
|
{% include "sidebar_item.html" with label='inbox' text=text icon="fa-cog" %}
|
||||||
|
{% trans "History" as text %}
|
||||||
|
{% include "sidebar_item.html" with label='history' text=text icon="fa-desktop" %}
|
Loading…
Reference in New Issue
Block a user