Custom fields additions

This commit is contained in:
snipe 2016-08-23 18:52:54 -07:00
parent ad22293f4b
commit f38912a5cf
2 changed files with 29 additions and 13 deletions

View file

@ -237,7 +237,7 @@ class Helper
{
$keys=array_keys(CustomField::$PredefinedFormats);
$stuff=array_combine($keys, $keys);
return $stuff+["" => "Custom Format..."];
return $stuff+["custom" => "Custom Format..."];
}
public static function barcodeDimensions($barcode_type = 'QRCODE')

View file

@ -28,10 +28,9 @@
<!-- Name -->
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_name') }}
<i class='fa fa-asterisk'></i></label>
<label for="name" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_name') }} </label>
</label>
<div class="col-md-6">
<div class="col-md-6 required">
<input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name') }}" />
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
@ -39,12 +38,11 @@
<!-- Type -->
<div class="form-group {{ $errors->has('element') ? ' has-error' : '' }}">
<label for="element" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_element') }}
<i class='fa fa-asterisk'></i></label>
<label for="element" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_element') }}</label>
</label>
<div class="col-md-6">
<div class="col-md-6 required">
{{ Form::select("element",["text" => "Text Box"],"text", array('class'=>'select2 form-control')) }}
{!! Form::customfield_elements('customfield_element', Input::old('customfield_element'), 'select2 form-control') !!}
{!! $errors->first('element', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
@ -52,17 +50,16 @@
<!-- Format -->
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}">
<label for="format" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_format') }}
<i class='fa fa-asterisk'></i></label>
<label for="format" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_format') }}</label>
</label>
<div class="col-md-6">
{{ Form::select("format",\App\Helpers\Helper::predefined_formats(),"ANY", array('class'=>'select2 form-control')) }}
<div class="col-md-6 required">
{{ Form::select("format",\App\Helpers\Helper::predefined_formats(),"ANY", array('class'=>'format select2 form-control')) }}
{!! $errors->first('format', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Custom Format -->
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}">
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}" id="custom_regex" style="display:none;">
<label for="custom_format" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_custom_format') }}
</label>
</label>
@ -91,4 +88,23 @@
<p>Custom fields allow you to add arbitrary attributes to assets.</p>
</div>
@section('moar_scripts')
<script>
$(document).ready(function(){
$(".format").change(function(){
$(this).find("option:selected").each(function(){
console.warn($(this).attr("value"));
if($(this).attr("value")=="custom"){
$("#custom_regex").show();
} else{
$("#custom_regex").hide();
}
});
}).change();
});
</script>
@stop
@stop