mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
Added new fields to custom fields views
This commit is contained in:
parent
e89fd9b3a2
commit
61aa9beddb
|
@ -36,18 +36,33 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Type -->
|
||||
<!-- Element 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') }}</label>
|
||||
</label>
|
||||
<div class="col-md-6 required">
|
||||
|
||||
{!! Form::customfield_elements('customfield_element', Input::old('customfield_element'), 'select2 form-control') !!}
|
||||
{!! Form::customfield_elements('customfield_element', Input::old('customfield_element'), 'field_element select2 form-control') !!}
|
||||
{!! $errors->first('customfield_element', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
|
||||
{!! $errors->first('element', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Element values -->
|
||||
<div class="form-group {{ $errors->has('element') ? ' has-error' : '' }}" id="field_values_text" style="display:none;">
|
||||
<label for="field_values" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_values') }}</label>
|
||||
</label>
|
||||
<div class="col-md-6 required">
|
||||
|
||||
{!! Form::textarea('field_values', Input::old('field_values'), ['style' => 'width: 100%', 'rows' => 4, 'class' => 'form-control']) !!}
|
||||
{!! $errors->first('field_values', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
|
||||
<p class="help-block">{{ trans('admin/custom_fields/general.field_values_help') }}</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 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') }}</label>
|
||||
|
@ -62,27 +77,37 @@
|
|||
<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>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6 required">
|
||||
<input class="form-control" type="text" name="custom_format" id="custom_format" value="{{ Input::old('custom_format') }}" />
|
||||
{!! $errors->first('custom_format', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Encrypted -->
|
||||
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}">
|
||||
<div class="col-md-8 col-md-offset-4">
|
||||
<label for="field_encrypted">
|
||||
<input type="checkbox" value="1" name="field_encrypted" id="field_encrypted" class="minimal"
|
||||
{{ Input::old('field_encrypted') ? ' checked="checked"' : '' }}> {{ trans('admin/custom_fields/general.encrypt_field') }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Form actions -->
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label"></label>
|
||||
<div class="col-md-7">
|
||||
<a class="btn btn-link" href="{{ route('admin.custom_fields.index') }}">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-md-offset-4" id="encrypt_warning" style="display:none;">
|
||||
<div class="callout callout-danger">
|
||||
<p><i class="fa fa-warning"></i> {{ trans('admin/custom_fields/general.encrypt_field_help') }}</p>
|
||||
</div>
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="box-footer text-right">
|
||||
<button type="submit" class="btn btn-success"> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
<div class="col-md-3">
|
||||
<h4>About Custom Fields</h4>
|
||||
<p>Custom fields allow you to add arbitrary attributes to assets.</p>
|
||||
|
@ -91,18 +116,43 @@
|
|||
@section('moar_scripts')
|
||||
<script>
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// Only display the custom format field if it's a custom format validation type
|
||||
$(".format").change(function(){
|
||||
$(this).find("option:selected").each(function(){
|
||||
console.warn($(this).attr("value"));
|
||||
if($(this).attr("value")=="custom"){
|
||||
//console.warn($(this).attr("value"));
|
||||
if (($(this).attr("value")=="") && $('.format').prop("selectedIndex") != 0) {
|
||||
$("#custom_regex").show();
|
||||
} else{
|
||||
$("#custom_regex").hide();
|
||||
}
|
||||
});
|
||||
}).change();
|
||||
|
||||
// Only display the field element if the type is not text
|
||||
$(".field_element").change(function(){
|
||||
$(this).find("option:selected").each(function(){
|
||||
//console.warn($(this).attr("value"));
|
||||
if($(this).attr("value")!="text"){
|
||||
$("#field_values_text").show();
|
||||
} else{
|
||||
$("#field_values_text").hide();
|
||||
}
|
||||
});
|
||||
}).change();
|
||||
});
|
||||
|
||||
// Checkbox handling
|
||||
$('div.icheckbox_minimal-blue').on('ifChecked', function(event){
|
||||
$("#encrypt_warning").show();
|
||||
});
|
||||
|
||||
$('div.icheckbox_minimal-blue').on('ifUnchecked', function(event){
|
||||
$("#encrypt_warning").hide();
|
||||
});
|
||||
|
||||
</script>
|
||||
@stop
|
||||
|
||||
|
|
Loading…
Reference in a new issue