mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Adds textarea as a custom field type
This commit is contained in:
parent
5975c9fac7
commit
9442736518
|
@ -413,7 +413,7 @@ class Helper
|
|||
{
|
||||
$keys = array_keys(CustomField::$PredefinedFormats);
|
||||
$stuff = array_combine($keys, $keys);
|
||||
return $stuff+["" => trans('admin/custom_fields/general.custom_format')];
|
||||
return $stuff;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,7 @@ class CustomField extends Model
|
|||
public $guarded=["id"];
|
||||
public static $PredefinedFormats=[
|
||||
"ANY" => "",
|
||||
"CUSTOM REGEX" => "",
|
||||
"ALPHA" => "alpha",
|
||||
"ALPHA-DASH" => "alpha_dash",
|
||||
"NUMERIC" => "numeric",
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
public/js/dist/all.js
vendored
BIN
public/js/dist/all.js
vendored
Binary file not shown.
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"/js/build/vue.js": "/js/build/vue.js?id=992bcb968a7f2da998b5",
|
||||
"/js/build/vue.js": "/js/build/vue.js?id=8e0a9017cf028e8f66a8",
|
||||
"/css/AdminLTE.css": "/css/AdminLTE.css?id=5e72463a66acbcc740d5",
|
||||
"/css/app.css": "/css/app.css?id=407edb63cc6b6dc62405",
|
||||
"/css/overrides.css": "/css/overrides.css?id=d85394a0b4f58e81bb78",
|
||||
"/js/build/vue.js.map": "/js/build/vue.js.map?id=e0eb0edc0b761965973f",
|
||||
"/js/build/vue.js.map": "/js/build/vue.js.map?id=126dccfb286c6d1f809a",
|
||||
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map?id=99f5a5a03c4155cf69f6",
|
||||
"/css/app.css.map": "/css/app.css.map?id=bdbe05e6ecd70ccfac72",
|
||||
"/css/overrides.css.map": "/css/overrides.css.map?id=898c91d4a425b01b589b",
|
||||
"/css/dist/all.css": "/css/dist/all.css?id=0e3642f1b6a8a436d558",
|
||||
"/js/dist/all.js": "/js/dist/all.js?id=39b95992f478d68c44a8",
|
||||
"/js/dist/all.js": "/js/dist/all.js?id=39b69f6a05c1d81dc4bb",
|
||||
"/css/build/all.css": "/css/build/all.css?id=0e3642f1b6a8a436d558",
|
||||
"/js/build/all.js": "/js/build/all.js?id=39b95992f478d68c44a8"
|
||||
"/js/build/all.js": "/js/build/all.js?id=39b69f6a05c1d81dc4bb"
|
||||
}
|
|
@ -44,6 +44,8 @@
|
|||
</div>
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
<input v-if="field.type == 'text'" class="form-control m-b-xs" type="text" :value="getValue(field)" :id="'default-value' + field.id" :name="'default_values[' + field.id + ']'">
|
||||
<textarea v-if="field.type == 'textarea'" class="form-control" :value="getValue(field)" :id="'default-value' + field.id" :name="'default_values[' + field.id + ']'"></textarea>
|
||||
|
||||
<select v-if="field.type == 'listbox'" class="form-control m-b-xs" :name="'default_values[' + field.id + ']'">
|
||||
<option value="0"></option>
|
||||
<option v-for="field_value in field.field_values_array" :value="field_value" :selected="getValue(field) == field_value">{{ field_value }}</option>
|
||||
|
|
|
@ -504,6 +504,7 @@ Form::macro('customfield_elements', function ($name = "customfield_elements", $s
|
|||
$formats = array(
|
||||
'text' => 'Text Box',
|
||||
'listbox' => 'List Box',
|
||||
'textarea' => 'Textarea (multi-line) ',
|
||||
// 'checkbox' => 'Checkbox',
|
||||
// 'radio' => 'Radio Buttons',
|
||||
);
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
// Only display the custom format field if it's a custom format validation type
|
||||
$(".format").change(function(){
|
||||
$(this).find("option:selected").each(function(){
|
||||
if (($(this).attr("value")=="") && $('.format').prop("selectedIndex") != 0) {
|
||||
if ($('.format').prop("selectedIndex") == 1) {
|
||||
$("#custom_regex").show();
|
||||
} else{
|
||||
$("#custom_regex").hide();
|
||||
|
@ -178,7 +178,7 @@
|
|||
// Only display the field element if the type is not text
|
||||
$(".field_element").change(function(){
|
||||
$(this).find("option:selected").each(function(){
|
||||
if($(this).attr("value")!="text"){
|
||||
if (($(this).attr("value")!="text") && ($(this).attr("value")!="textarea")){
|
||||
$("#field_values_text").show();
|
||||
} else{
|
||||
$("#field_values_text").hide();
|
||||
|
|
|
@ -4,12 +4,17 @@
|
|||
<label for="{{ $field->db_column_name() }}" class="col-md-3 control-label">{{ $field->name }} </label>
|
||||
<div class="col-md-7 col-sm-12{{ ($field->pivot->required=='1') ? ' required' : '' }}">
|
||||
|
||||
|
||||
@if ($field->element!='text')
|
||||
<!-- Listbox -->
|
||||
@if ($field->element=='listbox')
|
||||
{{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(),
|
||||
Input::old($field->db_column_name(),(isset($item) ? $item->{$field->db_column_name()} : $field->defaultValue($model->id))), ['class'=>'format select2 form-control']) }}
|
||||
|
||||
@elseif ($field->element=='textarea')
|
||||
<textarea class="col-md-6 form-control" id="{{ $field->db_column_name() }}" name="{{ $field->db_column_name() }}">{{ Input::old($field->db_column_name(),(isset($item) ? $item->{$field->db_column_name()} : $field->defaultValue($model->id))) }}</textarea>
|
||||
|
||||
|
||||
@elseif ($field->element=='checkbox')
|
||||
<!-- Checkboxes -->
|
||||
@foreach ($field->formatFieldValuesAsArray() as $key => $value)
|
||||
|
|
|
@ -49,8 +49,7 @@
|
|||
<fieldset-default-values
|
||||
model-id="{{ $item->id ?: '' }}"
|
||||
fieldset-id="{{ !empty($item->fieldset) ? $item->fieldset->id : Input::old('custom_fieldset') }}"
|
||||
previous-input="{{ json_encode(Input::old('default_values')) }}"
|
||||
>
|
||||
previous-input="{{ json_encode(Input::old('default_values')) }}">
|
||||
</fieldset-default-values>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue