diff --git a/mayan/apps/document_comments/icons.py b/mayan/apps/document_comments/icons.py index db0a9d2d05..25f210b038 100644 --- a/mayan/apps/document_comments/icons.py +++ b/mayan/apps/document_comments/icons.py @@ -3,4 +3,8 @@ from __future__ import absolute_import, unicode_literals from mayan.apps.appearance.classes import Icon icon_comments_for_document = Icon(driver_name='fontawesome', symbol='comment') -icon_comment_add = Icon(driver_name='fontawesome', symbol='plus') +icon_comment_add = Icon( + driver_name='fontawesome-dual', primary_symbol='comment', + secondary_symbol='plus' +) +icon_comment_delete = Icon(driver_name='fontawesome', symbol='times') diff --git a/mayan/apps/document_comments/links.py b/mayan/apps/document_comments/links.py index 971d956c32..c7cea63471 100644 --- a/mayan/apps/document_comments/links.py +++ b/mayan/apps/document_comments/links.py @@ -4,7 +4,9 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.navigation import Link -from .icons import icon_comment_add, icon_comments_for_document +from .icons import ( + icon_comment_add, icon_comment_delete, icon_comments_for_document +) from .permissions import ( permission_comment_create, permission_comment_delete, permission_comment_view @@ -16,8 +18,9 @@ link_comment_add = Link( view='comments:comment_add', ) link_comment_delete = Link( - args='object.pk', permissions=(permission_comment_delete,), - tags='dangerous', text=_('Delete'), view='comments:comment_delete', + args='object.pk', icon_class=icon_comment_delete, + permissions=(permission_comment_delete,), tags='dangerous', + text=_('Delete'), view='comments:comment_delete', ) link_comments_for_document = Link( args='resolved_object.pk', icon_class=icon_comments_for_document, diff --git a/mayan/apps/document_parsing/apps.py b/mayan/apps/document_parsing/apps.py index 6cf75e8417..48beb7ae02 100644 --- a/mayan/apps/document_parsing/apps.py +++ b/mayan/apps/document_parsing/apps.py @@ -26,7 +26,7 @@ from .handlers import ( from .links import ( link_document_content, link_document_content_download, link_document_page_content, link_document_parsing_errors_list, - link_document_submit, link_document_submit_multiple, + link_document_submit, link_document_multiple_submit, link_document_type_parsing_settings, link_document_type_submit, link_error_list ) @@ -151,10 +151,7 @@ class DocumentParsingApp(MayanAppConfig): links=(link_document_page_content,), sources=(DocumentPage,) ) menu_multi_item.bind_links( - links=(link_document_submit_multiple,), sources=(Document,) - ) - menu_object.bind_links( - links=(link_document_submit,), sources=(Document,) + links=(link_document_multiple_submit,), sources=(Document,) ) menu_object.bind_links( links=(link_document_type_parsing_settings,), sources=(DocumentType,), @@ -162,8 +159,8 @@ class DocumentParsingApp(MayanAppConfig): ) menu_secondary.bind_links( links=( - link_document_content, link_document_parsing_errors_list, - link_document_content_download + link_document_parsing_errors_list, + link_document_content_download, link_document_submit ), sources=( 'document_parsing:document_content', diff --git a/mayan/apps/document_parsing/icons.py b/mayan/apps/document_parsing/icons.py index 85e78ea2ad..77f75f40db 100644 --- a/mayan/apps/document_parsing/icons.py +++ b/mayan/apps/document_parsing/icons.py @@ -4,17 +4,23 @@ from mayan.apps.appearance.classes import Icon icon_document_content = Icon(driver_name='fontawesome', symbol='font') icon_document_parsing_errors_list = Icon( - driver_name='fontawesome', symbol='file-alt' + driver_name='fontawesome', symbol='font' ) icon_document_content_download = Icon( - driver_name='fontawesome', symbol='file-alt' + driver_name='fontawesome', symbol='font' +) +icon_document_multiple_submit = Icon( + driver_name='fontawesome', symbol='font' +) +icon_document_submit = Icon( + driver_name='fontawesome', symbol='font' ) icon_document_type_parsing_settings = Icon( driver_name='fontawesome', symbol='font' ) icon_document_type_submit = Icon( - driver_name='fontawesome', symbol='crosshairs' + driver_name='fontawesome', symbol='font' ) icon_link_error_list = Icon( - driver_name='fontawesome', symbol='file-alt' + driver_name='fontawesome', symbol='font' ) diff --git a/mayan/apps/document_parsing/links.py b/mayan/apps/document_parsing/links.py index 852eed67c2..a4e27960c8 100644 --- a/mayan/apps/document_parsing/links.py +++ b/mayan/apps/document_parsing/links.py @@ -6,7 +6,8 @@ from mayan.apps.navigation import Link, get_cascade_condition from .icons import ( icon_document_content, icon_document_content_download, - icon_document_parsing_errors_list, icon_document_type_parsing_settings, + icon_document_multiple_submit, icon_document_parsing_errors_list, + icon_document_submit, icon_document_type_parsing_settings, icon_document_type_submit, icon_link_error_list ) from .permissions import ( @@ -34,12 +35,13 @@ link_document_content_download = Link( permissions=(permission_content_view,), text=_('Download content'), view='document_parsing:document_content_download' ) -link_document_submit_multiple = Link( - text=_('Submit for parsing'), - view='document_parsing:document_submit_multiple' +link_document_multiple_submit = Link( + icon_class=icon_document_multiple_submit, text=_('Submit for parsing'), + view='document_parsing:document_multiple_submit' ) link_document_submit = Link( - args='resolved_object.id', permissions=(permission_parse_document,), + args='resolved_object.id', icon_class=icon_document_submit, + permissions=(permission_parse_document,), text=_('Submit for parsing'), view='document_parsing:document_submit' ) link_document_type_parsing_settings = Link( diff --git a/mayan/apps/document_parsing/urls.py b/mayan/apps/document_parsing/urls.py index 2e745667ad..ce121d9fa5 100644 --- a/mayan/apps/document_parsing/urls.py +++ b/mayan/apps/document_parsing/urls.py @@ -22,6 +22,19 @@ urlpatterns = [ r'^documents/(?P\d+)/content/download/$', DocumentContentDownloadView.as_view(), name='document_content_download' ), + url( + r'^documents/(?P\d+)/submit/$', DocumentSubmitView.as_view(), + name='document_submit' + ), + url( + r'^documents/multiple/submit/$', DocumentSubmitView.as_view(), + name='document_multiple_submit' + ), + url( + r'^documents/(?P\d+)/errors/$', + DocumentParsingErrorsListView.as_view(), + name='document_parsing_error_list' + ), url( r'^document_types/submit/$', DocumentTypeSubmitView.as_view(), name='document_type_submit' @@ -31,19 +44,6 @@ urlpatterns = [ DocumentTypeSettingsEditView.as_view(), name='document_type_parsing_settings' ), - url( - r'^documents/(?P\d+)/submit/$', DocumentSubmitView.as_view(), - name='document_submit' - ), - url( - r'^documents/multiple/submit/$', DocumentSubmitView.as_view(), - name='document_submit_multiple' - ), - url( - r'^documents/(?P\d+)/errors/$', - DocumentParsingErrorsListView.as_view(), - name='document_parsing_error_list' - ), url(r'^errors/all/$', ParseErrorListView.as_view(), name='error_list'), ] diff --git a/mayan/apps/documents/apps.py b/mayan/apps/documents/apps.py index a92b35f402..46afbccd13 100644 --- a/mayan/apps/documents/apps.py +++ b/mayan/apps/documents/apps.py @@ -256,6 +256,10 @@ class DocumentsApp(MayanAppConfig): ) # DocumentPage + SourceColumn( + attribute='get_label', is_absolute_url=True, is_identifier=True, + source=DocumentPage + ) SourceColumn( func=lambda context: document_page_thumbnail_widget.render( instance=context['object'] @@ -571,10 +575,10 @@ class DocumentsApp(MayanAppConfig): link_document_page_navigation_first, link_document_page_navigation_previous, link_document_page_navigation_next, - link_document_page_navigation_last, link_transformation_list + link_document_page_navigation_last, ), sources=(DocumentPage,) ) - menu_object.bind_links( + menu_list_facet.bind_links( links=(link_transformation_list,), sources=(DocumentPage,) ) diff --git a/mayan/apps/documents/icons.py b/mayan/apps/documents/icons.py index 8b359d40a0..5e3a005029 100644 --- a/mayan/apps/documents/icons.py +++ b/mayan/apps/documents/icons.py @@ -34,6 +34,10 @@ icon_document_favorites_add = Icon( driver_name='fontawesome-dual', primary_symbol='star', secondary_symbol='plus' ) +icon_document_favorites_remove = Icon( + driver_name='fontawesome-dual', primary_symbol='star', + secondary_symbol='minus' +) icon_document_image_loading = Icon( driver_name='fontawesomecss', css_classes='far fa-clock fa-2x' ) diff --git a/mayan/apps/documents/links.py b/mayan/apps/documents/links.py index 3b292b6074..e8388d5212 100644 --- a/mayan/apps/documents/links.py +++ b/mayan/apps/documents/links.py @@ -12,7 +12,8 @@ from .icons import ( icon_document_list_deleted, icon_document_list_favorites, icon_document_list_recent_access, icon_document_list_recent_added, icon_document_delete, icon_document_download, icon_document_edit, - icon_document_favorites_add, icon_document_multiple_delete, + icon_document_favorites_add, icon_document_favorites_remove, + icon_document_multiple_delete, icon_document_multiepl_restore, icon_document_page_navigation_first, icon_document_page_navigation_last, icon_document_page_navigation_next, icon_document_page_navigation_previous, @@ -116,7 +117,7 @@ link_document_favorites_add = Link( view='documents:document_add_to_favorites', ) link_document_favorites_remove = Link( - args='resolved_object.id', + args='resolved_object.id', icon_class=icon_document_favorites_remove, permissions=(permission_document_view,), text=_('Remove from favorites'), view='documents:document_remove_from_favorites', ) diff --git a/mayan/apps/documents/models/document_page_models.py b/mayan/apps/documents/models/document_page_models.py index 4547b9d9b9..24dc445afa 100644 --- a/mayan/apps/documents/models/document_page_models.py +++ b/mayan/apps/documents/models/document_page_models.py @@ -52,13 +52,7 @@ class DocumentPage(models.Model): verbose_name_plural = _('Document pages') def __str__(self): - return _( - 'Page %(page_num)d out of %(total_pages)d of %(document)s' - ) % { - 'document': force_text(self.document), - 'page_num': self.page_number, - 'total_pages': self.document_version.pages.count() - } + return self.get_label() @cached_property def cache_partition(self): @@ -222,6 +216,16 @@ class DocumentPage(models.Model): return converter.get_page() + def get_label(self): + return _( + 'Page %(page_num)d out of %(total_pages)d of %(document)s' + ) % { + 'document': force_text(self.document), + 'page_num': self.page_number, + 'total_pages': self.document_version.pages.count() + } + get_label.short_description = _('Label') + def invalidate_cache(self): self.cache_partition.purge() diff --git a/mayan/apps/documents/views/document_page_views.py b/mayan/apps/documents/views/document_page_views.py index b3ef5dc66a..04f6ea0ad1 100644 --- a/mayan/apps/documents/views/document_page_views.py +++ b/mayan/apps/documents/views/document_page_views.py @@ -84,6 +84,7 @@ class DocumentPageListView(SingleObjectListView): def get_extra_context(self): return { 'column_class': 'col-xs-12 col-sm-6 col-md-4 col-lg-3', + 'hide_object': True, 'list_as_items': True, 'object': self.get_document(), 'table_cell_container_classes': 'td-container-thumbnail', diff --git a/mayan/apps/file_metadata/apps.py b/mayan/apps/file_metadata/apps.py index 7310d6b3e6..9a42d789a3 100644 --- a/mayan/apps/file_metadata/apps.py +++ b/mayan/apps/file_metadata/apps.py @@ -8,7 +8,8 @@ from kombu import Exchange, Queue from mayan.apps.acls import ModelPermission from mayan.apps.common import ( - MayanAppConfig, menu_facet, menu_multi_item, menu_object, menu_tools + MayanAppConfig, menu_facet, menu_multi_item, menu_object, menu_secondary, + menu_tools ) from mayan.apps.common.classes import ModelAttribute, ModelField from mayan.apps.document_indexing.handlers import handler_index_document @@ -29,7 +30,7 @@ from .handlers import ( ) from .links import ( link_document_driver_list, link_document_file_metadata_list, - link_document_submit, link_document_submit_multiple, + link_document_submit, link_document_multiple_submit, link_document_type_file_metadata_settings, link_document_type_submit ) from .methods import ( @@ -170,9 +171,6 @@ class FileMetadataApp(MayanAppConfig): menu_facet.bind_links( links=(link_document_driver_list,), sources=(Document,) ) - menu_object.bind_links( - links=(link_document_submit,), sources=(Document,) - ) menu_object.bind_links( links=(link_document_type_file_metadata_settings,), sources=(DocumentType,) @@ -182,7 +180,13 @@ class FileMetadataApp(MayanAppConfig): sources=(DocumentVersionDriverEntry,) ) menu_multi_item.bind_links( - links=(link_document_submit_multiple,), sources=(Document,) + links=(link_document_multiple_submit,), sources=(Document,) + ) + menu_secondary.bind_links( + links=(link_document_submit,), sources=( + 'file_metadata:document_driver_list', + 'file_metadata:document_version_driver_file_metadata_list' + ) ) menu_tools.bind_links( links=(link_document_type_submit,), diff --git a/mayan/apps/file_metadata/icons.py b/mayan/apps/file_metadata/icons.py index 0382291179..4a52fa32ba 100644 --- a/mayan/apps/file_metadata/icons.py +++ b/mayan/apps/file_metadata/icons.py @@ -2,6 +2,12 @@ from __future__ import absolute_import, unicode_literals from mayan.apps.appearance.classes import Icon +icon_document_submit = Icon( + driver_name='fontawesome', symbol='chess-board' +) +icon_document_multiple_submit = Icon( + driver_name='fontawesome', symbol='chess-board' +) icon_file_metadata = Icon( driver_name='fontawesome', symbol='chess-board' ) diff --git a/mayan/apps/file_metadata/links.py b/mayan/apps/file_metadata/links.py index 2a2449ccb1..59eda9b631 100644 --- a/mayan/apps/file_metadata/links.py +++ b/mayan/apps/file_metadata/links.py @@ -4,7 +4,9 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.navigation import Link -from .icons import icon_file_metadata +from .icons import ( + icon_document_submit, icon_document_multiple_submit, icon_file_metadata +) from .permissions import ( permission_document_type_file_metadata_setup, permission_file_metadata_submit, permission_file_metadata_view @@ -21,12 +23,13 @@ link_document_file_metadata_list = Link( view='file_metadata:document_version_driver_file_metadata_list', ) link_document_submit = Link( - args='resolved_object.id', permissions=(permission_file_metadata_submit,), + args='resolved_object.id', icon_class=icon_document_submit, + permissions=(permission_file_metadata_submit,), text=_('Submit for file metadata'), view='file_metadata:document_submit' ) -link_document_submit_multiple = Link( - text=_('Submit for file metadata'), - view='file_metadata:document_submit_multiple' +link_document_multiple_submit = Link( + icon_class=icon_document_multiple_submit, text=_('Submit for file metadata'), + view='file_metadata:document_multiple_submit' ) link_document_type_file_metadata_settings = Link( args='resolved_object.id', diff --git a/mayan/apps/file_metadata/urls.py b/mayan/apps/file_metadata/urls.py index 48714a21ad..c322d4f1ed 100644 --- a/mayan/apps/file_metadata/urls.py +++ b/mayan/apps/file_metadata/urls.py @@ -18,7 +18,7 @@ urlpatterns = [ ), url( r'^documents/multiple/submit/$', DocumentSubmitView.as_view(), - name='document_submit_multiple' + name='document_multiple_submit' ), url( r'^document_types/(?P\d+)/ocr/settings/$', diff --git a/mayan/apps/ocr/apps.py b/mayan/apps/ocr/apps.py index 9335cf81bd..11646c75d5 100644 --- a/mayan/apps/ocr/apps.py +++ b/mayan/apps/ocr/apps.py @@ -10,8 +10,8 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.acls import ModelPermission from mayan.apps.common import ( - MayanAppConfig, menu_facet, menu_multi_item, menu_object, menu_secondary, - menu_tools + MayanAppConfig, menu_facet, menu_list_facet, menu_multi_item, menu_object, + menu_secondary, menu_tools ) from mayan.apps.common.classes import ModelAttribute, ModelField from mayan.apps.documents.search import document_search, document_page_search @@ -26,7 +26,7 @@ from .handlers import ( from .links import ( link_document_page_ocr_content, link_document_ocr_content, link_document_ocr_download, link_document_ocr_errors_list, - link_document_submit, link_document_submit_multiple, + link_document_submit, link_document_multiple_submit, link_document_type_ocr_settings, link_document_type_submit, link_entry_list ) @@ -143,29 +143,23 @@ class OCRApp(MayanAppConfig): menu_facet.bind_links( links=(link_document_ocr_content,), sources=(Document,) ) - menu_facet.bind_links( + menu_list_facet.bind_links( links=(link_document_page_ocr_content,), sources=(DocumentPage,) ) menu_multi_item.bind_links( - links=(link_document_submit_multiple,), sources=(Document,) - ) - menu_object.bind_links( - links=(link_document_submit,), sources=(Document,) - ) - menu_object.bind_links( - links=(link_document_page_ocr_content,), sources=(DocumentPage,) + links=(link_document_multiple_submit,), sources=(Document,) ) menu_object.bind_links( links=(link_document_type_ocr_settings,), sources=(DocumentType,) ) menu_secondary.bind_links( links=( - link_document_ocr_content, link_document_ocr_errors_list, - link_document_ocr_download + link_document_submit, link_document_ocr_download, + link_document_ocr_errors_list ), sources=( - 'ocr:document_content', 'ocr:document_ocr_error_list', - 'ocr:document_ocr_download', + 'ocr:document_content', 'ocr:document_error_list', + 'ocr:document_download', ) ) menu_secondary.bind_links( diff --git a/mayan/apps/ocr/icons.py b/mayan/apps/ocr/icons.py index 2390e22658..444d9d9f08 100644 --- a/mayan/apps/ocr/icons.py +++ b/mayan/apps/ocr/icons.py @@ -3,14 +3,17 @@ from __future__ import absolute_import, unicode_literals from mayan.apps.appearance.classes import Icon icon_document_content = Icon(driver_name='fontawesome', symbol='font') +icon_document_multiple_submit = Icon(driver_name='fontawesome', symbol='font') icon_document_ocr_download = Icon( - driver_name='fontawesome', symbol='file-alt' + driver_name='fontawesome', symbol='font' ) icon_document_ocr_errors_list = Icon( - driver_name='fontawesome', symbol='file-alt' + driver_name='fontawesome', symbol='font' ) icon_document_type_ocr_settings = Icon( driver_name='fontawesome', symbol='font' ) icon_document_type_submit = Icon(driver_name='fontawesome', symbol='font') -icon_entry_list = Icon(driver_name='fontawesome', symbol='file-alt') +icon_entry_list = Icon(driver_name='fontawesome', symbol='font') + +icon_document_submit = icon_document_multiple_submit diff --git a/mayan/apps/ocr/links.py b/mayan/apps/ocr/links.py index 96de61322a..700554ba40 100644 --- a/mayan/apps/ocr/links.py +++ b/mayan/apps/ocr/links.py @@ -5,8 +5,9 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.navigation import Link from .icons import ( - icon_document_content, icon_document_ocr_download, - icon_document_ocr_errors_list, icon_document_type_ocr_settings, + icon_document_content, icon_document_multiple_submit, + icon_document_ocr_download, icon_document_ocr_errors_list, + icon_document_type_ocr_settings, icon_document_submit, icon_document_type_submit, icon_entry_list ) from .permissions import ( @@ -17,24 +18,26 @@ from .permissions import ( link_document_page_ocr_content = Link( args='resolved_object.id', icon_class=icon_document_content, permissions=(permission_ocr_content_view,), text=_('OCR'), - view='ocr:document_page_ocr_content', + view='ocr:document_page_content', ) link_document_ocr_content = Link( args='resolved_object.id', icon_class=icon_document_content, permissions=(permission_ocr_content_view,), text=_('OCR'), - view='ocr:document_ocr_content', + view='ocr:document_content', ) link_document_submit = Link( - args='resolved_object.id', permissions=(permission_ocr_document,), - text=_('Submit for OCR'), view='ocr:document_submit' + args='resolved_object.id', icon_class=icon_document_submit, + permissions=(permission_ocr_document,), text=_('Submit for OCR'), + view='ocr:document_submit' ) -link_document_submit_multiple = Link( - text=_('Submit for OCR'), view='ocr:document_submit_multiple' +link_document_multiple_submit = Link( + icon_class=icon_document_multiple_submit, text=_('Submit for OCR'), + view='ocr:document_multiple_submit' ) link_document_type_ocr_settings = Link( args='resolved_object.id', icon_class=icon_document_type_ocr_settings, permissions=(permission_document_type_ocr_setup,), text=_('Setup OCR'), - view='ocr:document_type_ocr_settings', + view='ocr:document_type_settings', ) link_document_type_submit = Link( icon_class=icon_document_type_submit, @@ -48,10 +51,10 @@ link_entry_list = Link( link_document_ocr_errors_list = Link( args='resolved_object.id', icon_class=icon_document_ocr_errors_list, permissions=(permission_ocr_content_view,), text=_('OCR errors'), - view='ocr:document_ocr_error_list' + view='ocr:document_error_list' ) link_document_ocr_download = Link( args='resolved_object.id', icon_class=icon_document_ocr_download, permissions=(permission_ocr_content_view,), text=_('Download OCR text'), - view='ocr:document_ocr_download' + view='ocr:document_download' ) diff --git a/mayan/apps/ocr/urls.py b/mayan/apps/ocr/urls.py index 6ae236f16e..760fb2a10e 100644 --- a/mayan/apps/ocr/urls.py +++ b/mayan/apps/ocr/urls.py @@ -15,38 +15,38 @@ from .views import ( urlpatterns = [ url( r'^documents/pages/(?P\d+)/content/$', - DocumentPageOCRContentView.as_view(), name='document_page_ocr_content' + DocumentPageOCRContentView.as_view(), name='document_page_content' ), url( r'^documents/(?P\d+)/content/$', DocumentOCRContentView.as_view(), - name='document_ocr_content' + name='document_content' ), url( r'^documents/(?P\d+)/submit/$', DocumentSubmitView.as_view(), name='document_submit' ), url( - r'^document_types/submit/$', DocumentTypeSubmitView.as_view(), - name='document_type_submit' + r'^documents/(?P\d+)/ocr/errors/$', + DocumentOCRErrorsListView.as_view(), name='document_error_list' + ), + url( + r'^documents/(?P\d+)/ocr/download/$', + DocumentOCRDownloadView.as_view(), name='document_download' ), url( r'^documents/multiple/submit/$', DocumentSubmitView.as_view(), - name='document_submit_multiple' + name='document_multiple_submit' + ), + url( + r'^document_types/submit/$', DocumentTypeSubmitView.as_view(), + name='document_type_submit' ), url( r'^document_types/(?P\d+)/ocr/settings/$', DocumentTypeSettingsEditView.as_view(), name='document_type_ocr_settings' ), - url( - r'^documents/(?P\d+)/ocr/errors/$', - DocumentOCRErrorsListView.as_view(), name='document_ocr_error_list' - ), - url( - r'^documents/(?P\d+)/ocr/download/$', - DocumentOCRDownloadView.as_view(), name='document_ocr_download' - ), - url(r'^all/$', EntryListView.as_view(), name='entry_list'), + url(r'^errors/$', EntryListView.as_view(), name='entry_list'), ] api_urls = [