Finished conversion of Mayan to the new document grouping app and paradigm
This commit is contained in:
@@ -118,7 +118,7 @@ class ImageWidget(forms.widgets.Widget):
|
||||
|
||||
for page in value.documentpage_set.all():
|
||||
output.append(
|
||||
u'''<div style="display: inline-block; margin: 5px 10px 0px 10px;">
|
||||
u'''<div style="display: inline-block; margin: 5px 10px 10px 10px;">
|
||||
<div class="tc">%(page_string)s %(page)s</div>
|
||||
<div class="tc" style="border: 1px solid black; margin: 5px 0px 5px 0px;">
|
||||
<a rel="page_gallery" class="fancybox-noscaling" href="%(view_url)s?page=%(page)d">
|
||||
@@ -325,85 +325,6 @@ class DocumentCreateWizard(BoundFormWizard):
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
|
||||
class MetaDataImageWidget(forms.widgets.Widget):
|
||||
def render(self, name, value, attrs=None):
|
||||
output = []
|
||||
if value['links']:
|
||||
output.append(u'<div class="group navform wat-cf">')
|
||||
for link in value['links']:
|
||||
output.append(u'''
|
||||
<button class="button" type="submit" name="action" value="%(action)s">
|
||||
<span class="famfam active famfam-%(famfam)s"></span>%(text)s
|
||||
</button>
|
||||
''' % {
|
||||
'famfam': link.get('famfam', u'link'),
|
||||
'text': capfirst(link['text']),
|
||||
'action': reverse('metadatagroup_view', args=[value['current_document'].pk, value['group'].pk])
|
||||
})
|
||||
output.append(u'</div>')
|
||||
|
||||
output.append(u'<div style="white-space:nowrap; overflow: auto;">')
|
||||
for document in value['group_data']:
|
||||
tags_template = get_tags_inline_widget(document)
|
||||
|
||||
output.append(
|
||||
u'''<div style="display: inline-block; margin: 10px; %(current)s">
|
||||
<div class="tc">%(document_name)s</div>
|
||||
<div class="tc">%(page_string)s: %(document_pages)d</div>
|
||||
%(tags_template)s
|
||||
<div class="tc">
|
||||
<a rel="group_%(group_id)d_documents_gallery" class="fancybox-noscaling" href="%(view_url)s">
|
||||
<img class="lazy-load" style="border: 1px solid black; margin: 10px;" src="%(media_url)s/images/ajax-loader.gif" data-href="%(img)s" alt="%(string)s" />
|
||||
<noscript>
|
||||
<img style="border: 1px solid black; margin: 10px;" src="%(img)s" alt="%(string)s" />
|
||||
</noscript>
|
||||
</a>
|
||||
</div>
|
||||
<div class="tc">
|
||||
<a href="%(url)s"><span class="famfam active famfam-page_go"></span>%(details_string)s</a>
|
||||
</div>
|
||||
</div>''' % {
|
||||
'url': reverse('document_view_simple', args=[document.pk]),
|
||||
'img': reverse('document_preview_multipage', args=[document.pk]),
|
||||
'current': u'border: 5px solid black; padding: 3px;' if value['current_document'] == document else u'',
|
||||
'view_url': reverse('document_display', args=[document.pk]),
|
||||
'document_pages': document.documentpage_set.count(),
|
||||
'page_string': ugettext(u'Pages'),
|
||||
'details_string': ugettext(u'Select'),
|
||||
'group_id': value['group'].pk,
|
||||
'document_name': document,
|
||||
'media_url': settings.MEDIA_URL,
|
||||
'tags_template': tags_template if tags_template else u'',
|
||||
'string': _(u'group document'),
|
||||
})
|
||||
output.append(u'</div>')
|
||||
output.append(
|
||||
u'<br /><span class="famfam active famfam-magnifier"></span>%s' %
|
||||
ugettext(u'Click on the image for full size view of the first page.'))
|
||||
|
||||
return mark_safe(u''.join(output))
|
||||
|
||||
|
||||
class MetaDataGroupForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
groups = kwargs.pop('groups', None)
|
||||
links = kwargs.pop('links', None)
|
||||
current_document = kwargs.pop('current_document', None)
|
||||
super(MetaDataGroupForm, self).__init__(*args, **kwargs)
|
||||
for group, data in groups.items():
|
||||
self.fields['preview-%s' % group] = forms.CharField(
|
||||
widget=MetaDataImageWidget(),
|
||||
label=u'%s (%d)' % (unicode(group), len(data)),
|
||||
required=False,
|
||||
initial={
|
||||
'group': group,
|
||||
'group_data': data,
|
||||
'current_document': current_document,
|
||||
'links': links
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class PrintForm(forms.Form):
|
||||
page_size = forms.ChoiceField(choices=PAGE_SIZE_CHOICES, initial=DEFAULT_PAPER_SIZE, label=_(u'Page size'), required=False)
|
||||
custom_page_width = forms.CharField(label=_(u'Custom page width'), required=False)
|
||||
|
||||
Reference in New Issue
Block a user