Localization and several UI changes #51

Open
rskthomas wants to merge 55 commits from ux-changes_rebase into main
5 changed files with 36 additions and 27 deletions
Showing only changes of commit d8ce10b972 - Show all commits

View file

@ -31,7 +31,7 @@ class AdminView(DashboardView):
class PanelView(AdminView, TemplateView): class PanelView(AdminView, TemplateView):
template_name = "admin_panel.html" template_name = "admin_panel.html"
title = _("Admin") title = _("Admin")
breadcrumb = _("admin") + " /" breadcrumb = _("Admin") + " / " + _("Panel") + " /"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
@ -41,7 +41,7 @@ class PanelView(AdminView, TemplateView):
class UsersView(AdminView, TemplateView): class UsersView(AdminView, TemplateView):
template_name = "admin_users.html" template_name = "admin_users.html"
title = _("Users") title = _("Users")
breadcrumb = _("admin / Users") + " /" breadcrumb = _("Admin") + " / " + _("Panel") + " / " + _("Users")
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
@ -54,7 +54,7 @@ class UsersView(AdminView, TemplateView):
class CreateUserView(AdminView, NotifyActivateUserByEmail, CreateView): class CreateUserView(AdminView, NotifyActivateUserByEmail, CreateView):
template_name = "user.html" template_name = "user.html"
title = _("User") title = _("User")
breadcrumb = _("admin / User") + " /" breadcrumb = _("Admin") + " / " + _("Users") + " / " +_("New")
success_url = reverse_lazy('admin:users') success_url = reverse_lazy('admin:users')
model = User model = User
fields = ( fields = (
@ -79,7 +79,7 @@ class CreateUserView(AdminView, NotifyActivateUserByEmail, CreateView):
class DeleteUserView(AdminView, DeleteView): class DeleteUserView(AdminView, DeleteView):
template_name = "delete_user.html" template_name = "delete_user.html"
title = _("Delete user") title = _("Delete user")
breadcrumb = "admin / Delete user" breadcrumb = _("Admin") + " / " + _("Users") + " / " +_("Delete")
success_url = reverse_lazy('admin:users') success_url = reverse_lazy('admin:users')
model = User model = User
fields = ( fields = (
@ -96,7 +96,7 @@ class DeleteUserView(AdminView, DeleteView):
class EditUserView(AdminView, UpdateView): class EditUserView(AdminView, UpdateView):
template_name = "user.html" template_name = "user.html"
title = _("Edit user") title = _("Edit user")
breadcrumb = "admin / Edit user" breadcrumb = _("Admin") + " / " + _("Users") + " / " +_("Edit")
success_url = reverse_lazy('admin:users') success_url = reverse_lazy('admin:users')
model = User model = User
fields = ( fields = (
@ -116,6 +116,7 @@ class InstitutionView(AdminView, UpdateView):
template_name = "institution.html" template_name = "institution.html"
title = _("Edit institution") title = _("Edit institution")
section = "admin" section = "admin"
breadcrumb = _("Admin") + " / " + _("Institution") + " / "
subtitle = _('Edit institution') subtitle = _('Edit institution')
model = Institution model = Institution
success_url = reverse_lazy('admin:panel') success_url = reverse_lazy('admin:panel')
@ -156,7 +157,7 @@ class StateDefinitionContextMixin(ContextMixin):
class StatesPanelView(AdminView, StateDefinitionContextMixin, TemplateView): class StatesPanelView(AdminView, StateDefinitionContextMixin, TemplateView):
template_name = "states_panel.html" template_name = "states_panel.html"
title = _("States Panel") title = _("States Panel")
breadcrumb = _("admin / States Panel") + " /" breadcrumb = _("Admin") + " / " + _("States") + " / "
class AddStateDefinitionView(AdminView, StateDefinitionContextMixin, CreateView): class AddStateDefinitionView(AdminView, StateDefinitionContextMixin, CreateView):

View file

@ -16,7 +16,7 @@ class UnassignedDevicesView(InventaryMixin):
template_name = "unassigned_devices.html" template_name = "unassigned_devices.html"
section = "Unassigned" section = "Unassigned"
title = _("Unassigned Devices") title = _("Unassigned Devices")
breadcrumb = "Devices / Unassigned Devices" breadcrumb = _("Devices") + " / " + _("Unassigned") + " / "
def get_devices(self, user, offset, limit): def get_devices(self, user, offset, limit):
return Device.get_unassigned(self.request.user.institution, offset, limit) return Device.get_unassigned(self.request.user.institution, offset, limit)
@ -26,7 +26,7 @@ class LotDashboardView(InventaryMixin, DetailsMixin):
template_name = "unassigned_devices.html" template_name = "unassigned_devices.html"
section = "dashboard_lot" section = "dashboard_lot"
title = _("Lot Devices") title = _("Lot Devices")
breadcrumb = "Lot / Devices" breadcrumb = _("Lot") + " / " + _("Devices") + " / "
model = Lot model = Lot
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
@ -50,7 +50,7 @@ class SearchView(InventaryMixin):
template_name = "unassigned_devices.html" template_name = "unassigned_devices.html"
section = "Search" section = "Search"
title = _("Search Devices") title = _("Search Devices")
breadcrumb = "Devices / Search Devices" breadcrumb = _("Devices") + " / " + _("Search") + " / "
def get_devices(self, user, offset, limit): def get_devices(self, user, offset, limit):
post = dict(self.request.POST) post = dict(self.request.POST)

View file

@ -40,7 +40,7 @@ class DeviceLogMixin(DashboardView):
class NewDeviceView(DashboardView, FormView): class NewDeviceView(DashboardView, FormView):
template_name = "new_device.html" template_name = "new_device.html"
title = _("New Device") title = _("New Device")
breadcrumb = "Device / New Device" breadcrumb = _("Device") + " / " + _("New") + " / "
success_url = reverse_lazy('dashboard:unassigned_devices') success_url = reverse_lazy('dashboard:unassigned_devices')
form_class = DeviceFormSet form_class = DeviceFormSet
@ -57,7 +57,7 @@ class NewDeviceView(DashboardView, FormView):
class EditDeviceView(DashboardView, UpdateView): class EditDeviceView(DashboardView, UpdateView):
template_name = "new_device.html" template_name = "new_device.html"
title = _("Update Device") title = _("Update Device")
breadcrumb = "Device / Update Device" breadcrumb = _("Device") + " / " + _("Update") + " / "
success_url = reverse_lazy('dashboard:unassigned_devices') success_url = reverse_lazy('dashboard:unassigned_devices')
model = SystemProperty model = SystemProperty
@ -76,7 +76,7 @@ class EditDeviceView(DashboardView, UpdateView):
class DetailsView(DashboardView, TemplateView): class DetailsView(DashboardView, TemplateView):
template_name = "details.html" template_name = "details.html"
title = _("Device") title = _("Device")
breadcrumb = "Device / Details" breadcrumb = _("Device") + " / " + _("Details") + " / "
model = SystemProperty model = SystemProperty
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
@ -192,7 +192,7 @@ class PublicDeviceWebView(TemplateView):
class AddUserPropertyView(DeviceLogMixin, CreateView): class AddUserPropertyView(DeviceLogMixin, CreateView):
template_name = "new_user_property.html" template_name = "new_user_property.html"
title = _("New User Property") title = _("New User Property")
breadcrumb = "Device / New Property" breadcrumb = _("Device") + " / " + _("Property") + " / " + _("New")
model = UserProperty model = UserProperty
fields = ("key", "value") fields = ("key", "value")
@ -239,7 +239,7 @@ class AddUserPropertyView(DeviceLogMixin, CreateView):
class UpdateUserPropertyView(DeviceLogMixin, UpdateView): class UpdateUserPropertyView(DeviceLogMixin, UpdateView):
template_name = "new_user_property.html" template_name = "new_user_property.html"
title = _("Update User Property") title = _("Update User Property")
breadcrumb = "Device / Update Property" breadcrumb = _("Device") + " / " + _("Property") + " / " + _("Update")
model = UserProperty model = UserProperty
fields = ("key", "value") fields = ("key", "value")

View file

@ -27,7 +27,7 @@ class ListEvidencesView(DashboardView, TemplateView):
template_name = "evidences.html" template_name = "evidences.html"
section = "evidences" section = "evidences"
title = _("Evidences") title = _("Evidences")
breadcrumb = "Evidences" breadcrumb = _("Evidence") + " / " + _("All") + " / "
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
@ -43,10 +43,18 @@ class UploadView(DashboardView, FormView):
template_name = "upload.html" template_name = "upload.html"
section = "evidences" section = "evidences"
title = _("Upload Evidence") title = _("Upload Evidence")
breadcrumb = "Evidences / Upload" breadcrumb = _("Evidence") + " / " + _("Upload") + " / "
success_url = reverse_lazy('evidence:list') success_url = reverse_lazy('evidence:list')
form_class = UploadForm form_class = UploadForm
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update({
"help_text": _('Upload the snapshots generated by Workbench.'),
})
return context
def form_valid(self, form): def form_valid(self, form):
form.save(self.request.user) form.save(self.request.user)
messages.success(self.request, _("Evidence uploaded successfully.")) messages.success(self.request, _("Evidence uploaded successfully."))
@ -62,7 +70,7 @@ class ImportView(DashboardView, FormView):
template_name = "upload.html" template_name = "upload.html"
section = "evidences" section = "evidences"
title = _("Import Evidence") title = _("Import Evidence")
breadcrumb = "Evidences / Import" breadcrumb = _("Evidence") + " / " + _("Import") + " / "
success_url = reverse_lazy('evidence:list') success_url = reverse_lazy('evidence:list')
form_class = ImportForm form_class = ImportForm
@ -86,7 +94,7 @@ class EvidenceView(DashboardView, FormView):
template_name = "ev_details.html" template_name = "ev_details.html"
section = "evidences" section = "evidences"
title = _("Evidences") title = _("Evidences")
breadcrumb = "Evidences / Details" breadcrumb = _("Evidence") + " / " + _("Details") + " / "
success_url = reverse_lazy('evidence:list') success_url = reverse_lazy('evidence:list')
form_class = UserTagForm form_class = UserTagForm

View file

@ -17,7 +17,7 @@ from lot.forms import LotsForm
class NewLotView(DashboardView, CreateView): class NewLotView(DashboardView, CreateView):
template_name = "new_lot.html" template_name = "new_lot.html"
title = _("New lot") title = _("New lot")
breadcrumb = "lot / New lot" breadcrumb = _("Lot") + " / " + _("New") + " / "
success_url = reverse_lazy('dashboard:unassigned_devices') success_url = reverse_lazy('dashboard:unassigned_devices')
model = Lot model = Lot
fields = ( fields = (
@ -38,7 +38,7 @@ class NewLotView(DashboardView, CreateView):
class DeleteLotView(DashboardView, DeleteView): class DeleteLotView(DashboardView, DeleteView):
template_name = "delete_lot.html" template_name = "delete_lot.html"
title = _("Delete lot") title = _("Delete lot")
breadcrumb = "lot / Delete lot" breadcrumb = _("Lot") + " / " + _("Delete") + " / "
success_url = reverse_lazy('dashboard:unassigned_devices') success_url = reverse_lazy('dashboard:unassigned_devices')
model = Lot model = Lot
fields = ( fields = (
@ -57,7 +57,7 @@ class DeleteLotView(DashboardView, DeleteView):
class EditLotView(DashboardView, UpdateView): class EditLotView(DashboardView, UpdateView):
template_name = "new_lot.html" template_name = "new_lot.html"
title = _("Edit lot") title = _("Edit lot")
breadcrumb = "Lot / Edit lot" breadcrumb = _("Lot") + " / " + _("Edit") + " / "
success_url = reverse_lazy('dashboard:unassigned_devices') success_url = reverse_lazy('dashboard:unassigned_devices')
model = Lot model = Lot
fields = ( fields = (
@ -83,7 +83,7 @@ class EditLotView(DashboardView, UpdateView):
class AddToLotView(DashboardView, FormView): class AddToLotView(DashboardView, FormView):
template_name = "list_lots.html" template_name = "list_lots.html"
title = _("Add to lots") title = _("Add to lots")
breadcrumb = "lot / add to lots" breadcrumb = _("Lot") + " / " + _("Assign Device") + " / "
success_url = reverse_lazy('dashboard:unassigned_devices') success_url = reverse_lazy('dashboard:unassigned_devices')
form_class = LotsForm form_class = LotsForm
@ -112,7 +112,7 @@ class AddToLotView(DashboardView, FormView):
class DelToLotView(AddToLotView): class DelToLotView(AddToLotView):
title = _("Remove from lots") title = _("Remove from lots")
breadcrumb = "lot / remove from lots" breadcrumb = _("Lot") + " / " + _("Unassign Device") + " / "
def form_valid(self, form): def form_valid(self, form):
form.devices = self.get_session_devices() form.devices = self.get_session_devices()
@ -124,7 +124,7 @@ class DelToLotView(AddToLotView):
class LotsTagsView(DashboardView, TemplateView): class LotsTagsView(DashboardView, TemplateView):
template_name = "lots.html" template_name = "lots.html"
title = _("lots") title = _("lots")
breadcrumb = _("lots") + " /" breadcrumb = _("Lot") + " / "
success_url = reverse_lazy('dashboard:unassigned_devices') success_url = reverse_lazy('dashboard:unassigned_devices')
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
@ -149,7 +149,7 @@ class LotsTagsView(DashboardView, TemplateView):
class LotPropertiesView(DashboardView, TemplateView): class LotPropertiesView(DashboardView, TemplateView):
template_name = "properties.html" template_name = "properties.html"
title = _("New Lot Property") title = _("New Lot Property")
breadcrumb = "Lot / New property" breadcrumb = _("Lot") + " / " + _("Property") + " / "
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
self.pk = kwargs.get('pk') self.pk = kwargs.get('pk')
@ -172,7 +172,7 @@ class LotPropertiesView(DashboardView, TemplateView):
class AddLotPropertyView(DashboardView, CreateView): class AddLotPropertyView(DashboardView, CreateView):
template_name = "new_property.html" template_name = "new_property.html"
title = _("New Lot Property") title = _("New Lot Property")
breadcrumb = "Device / New property" breadcrumb = _("Lot") + " / " + _("Property") + " / " +_("New")
success_url = reverse_lazy('dashboard:unassigned_devices') success_url = reverse_lazy('dashboard:unassigned_devices')
model = LotProperty model = LotProperty
fields = ("key", "value") fields = ("key", "value")
@ -206,7 +206,7 @@ class AddLotPropertyView(DashboardView, CreateView):
class UpdateLotPropertyView(DashboardView, UpdateView): class UpdateLotPropertyView(DashboardView, UpdateView):
template_name = "properties.html" template_name = "properties.html"
title = _("Update lot Property") title = _("Update lot Property")
breadcrumb = "Lot / Update Property" breadcrumb = _("Lot") + " / " + _("Property") + " / " +_("Update")
model = LotProperty model = LotProperty
fields = ("key", "value") fields = ("key", "value")