Merge remote-tracking branch 'origin/master' into merge_master
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -33,6 +33,17 @@
|
||||
{% block stylesheets %}{% endblock %}
|
||||
|
||||
{% endcompress %}
|
||||
<script>
|
||||
function waitForJQuery(func) {
|
||||
if (window.jQuery) {
|
||||
func();
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
waitForJQuery(func)
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
{% if appearance_type == 'plain' %}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.6 on 2017-05-24 04:56
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('document_indexing', '0010_documentindexinstancenode_indexinstance'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='indextemplatenode',
|
||||
name='expression',
|
||||
field=models.TextField(help_text="Enter a template to render. Use Django's default templating language (https://docs.djangoproject.com/en/1.7/ref/templates/builtins/)", verbose_name='Indexing expression'),
|
||||
),
|
||||
]
|
||||
@@ -114,8 +114,7 @@ class IndexTemplateNode(MPTTModel):
|
||||
index = models.ForeignKey(
|
||||
Index, related_name='node_templates', verbose_name=_('Index')
|
||||
)
|
||||
expression = models.CharField(
|
||||
max_length=128,
|
||||
expression = models.TextField(
|
||||
help_text=_(
|
||||
'Enter a template to render. '
|
||||
'Use Django\'s default templating language '
|
||||
|
||||
@@ -16,11 +16,16 @@ class DocumentMetadataForm(forms.Form):
|
||||
label=_('Name'), required=False,
|
||||
widget=forms.TextInput(attrs={'readonly': 'readonly'})
|
||||
)
|
||||
value = forms.CharField(label=_('Value'), required=False)
|
||||
value = forms.CharField(label=_('Value'), required=False,
|
||||
widget=forms.TextInput(attrs={'class': 'metadata-value'})
|
||||
)
|
||||
update = forms.BooleanField(
|
||||
initial=True, label=_('Update'), required=False
|
||||
)
|
||||
|
||||
class Media:
|
||||
js = ('metadata/js/metadata_form.js',)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DocumentMetadataForm, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
11
mayan/apps/metadata/static/metadata/js/metadata_form.js
Normal file
11
mayan/apps/metadata/static/metadata/js/metadata_form.js
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
waitForJQuery(function() {
|
||||
jQuery(document).ready(function() {
|
||||
$('.metadata-value').on('input', function(event) {
|
||||
// Check the checkbox next to a metadata value input when there is
|
||||
// data entry in the value's input.
|
||||
$(event.target).parents('tr').find(':checkbox').prop('checked', true);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -11,6 +11,7 @@ from fuse import FUSE, FuseOSError, Operations
|
||||
from django.core import management
|
||||
from django.core.cache import caches
|
||||
from django.core.exceptions import MultipleObjectsReturned
|
||||
from django.core.management.base import CommandError
|
||||
from django.db.models import Count
|
||||
|
||||
from document_indexing.models import Index, IndexInstanceNode
|
||||
@@ -214,15 +215,35 @@ class Command(management.BaseCommand):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('slug', nargs='?', help='Index slug')
|
||||
|
||||
parser.add_argument('mount_point', nargs='?', help='Mount point')
|
||||
parser.add_argument(
|
||||
'--allow-other', action='store_true', dest='allow_other',
|
||||
default=False,
|
||||
help='All users (including root) can access the index files.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--allow-root', action='store_true', dest='allow_root',
|
||||
default=False,
|
||||
help='Mount access is limited to the user mounting the index and '
|
||||
'root. This option and --allow-other are mutually exclusive.'
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if not options.get('slug') or not options.get('mount_point'):
|
||||
self.stderr.write(self.style.ERROR('Incorrect number of arguments'))
|
||||
exit(1)
|
||||
|
||||
FUSE(
|
||||
operations=IndexFS(index_slug=options['slug']),
|
||||
mountpoint=options['mount_point'], nothreads=True, foreground=True
|
||||
)
|
||||
try:
|
||||
FUSE(
|
||||
operations=IndexFS(index_slug=options['slug']),
|
||||
mountpoint=options['mount_point'], nothreads=True, foreground=True,
|
||||
allow_other=options['allow_other'],
|
||||
allow_root=options['allow_root']
|
||||
)
|
||||
except RuntimeError as exception:
|
||||
if options['allow_other'] or options['allow_root']:
|
||||
raise CommandError(
|
||||
'Make sure \'user_allow_other\' is set in /etc/fuse.conf'
|
||||
)
|
||||
else:
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user