Add no results help text to the document type -> metadata type association view.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
3.1.3 (2018-09-26)
|
||||
==================
|
||||
* Make sure template API renders in non US languages.
|
||||
* Fix Fix user groups view.
|
||||
|
||||
* Fix user groups view.
|
||||
* Add no results help text to the document type -> metadata type
|
||||
association view.
|
||||
|
||||
3.1.2 (2018-09-21)
|
||||
==================
|
||||
|
||||
@@ -669,32 +669,29 @@ class SetupDocumentTypeMetadataTypes(FormView):
|
||||
SetupDocumentTypeMetadataTypes, self
|
||||
).form_valid(form=form)
|
||||
|
||||
def get_form_extra_kwargs(self):
|
||||
return {
|
||||
'_user': self.request.user,
|
||||
}
|
||||
|
||||
def get_object(self):
|
||||
obj = get_object_or_404(self.model, pk=self.kwargs['pk'])
|
||||
|
||||
AccessControlList.objects.check_access(
|
||||
permissions=(permission_metadata_type_edit,),
|
||||
user=self.request.user, obj=obj
|
||||
)
|
||||
return obj
|
||||
|
||||
def get_extra_context(self):
|
||||
return {
|
||||
'form_display_mode_table': True,
|
||||
'form_empty_label': _(
|
||||
'No metadata types available. Add at least one.'
|
||||
'no_results_icon': icon_metadata,
|
||||
'no_results_main_link': link_setup_metadata_type_create.resolve(
|
||||
context=RequestContext(request=self.request)
|
||||
),
|
||||
'no_results_text': _(
|
||||
'Create metadata types to be able to associates them '
|
||||
'to this document type.'
|
||||
),
|
||||
'no_results_title': _('There are no metadata types available'),
|
||||
'object': self.get_object(),
|
||||
'title': _(
|
||||
'Metadata types for document type: %s'
|
||||
) % self.get_object()
|
||||
}
|
||||
|
||||
def get_form_extra_kwargs(self):
|
||||
return {
|
||||
'_user': self.request.user,
|
||||
}
|
||||
|
||||
def get_initial(self):
|
||||
obj = self.get_object()
|
||||
initial = []
|
||||
@@ -707,6 +704,15 @@ class SetupDocumentTypeMetadataTypes(FormView):
|
||||
})
|
||||
return initial
|
||||
|
||||
def get_object(self):
|
||||
obj = get_object_or_404(self.model, pk=self.kwargs['pk'])
|
||||
|
||||
AccessControlList.objects.check_access(
|
||||
permissions=(permission_metadata_type_edit,),
|
||||
user=self.request.user, obj=obj
|
||||
)
|
||||
return obj
|
||||
|
||||
def get_post_action_redirect(self):
|
||||
return reverse('documents:document_type_list')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user