Merge branch 'features/textarea-custom-field' into develop

# Conflicts:
#	public/js/build/all.js
#	public/js/build/vue.js
#	public/js/build/vue.js.map
#	public/js/dist/all.js
#	public/mix-manifest.json
This commit is contained in:
snipe 2018-07-05 12:37:07 -07:00
commit f3526eccb9
12 changed files with 21 additions and 13 deletions

View file

@ -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;
}
/**

View file

@ -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.

View file

@ -1,14 +1,14 @@
{
"/js/build/vue.js": "/js/build/vue.js?id=886005d54e9097be1aa2",
"/js/build/vue.js": "/js/build/vue.js?id=878e94edf00128463de2",
"/css/AdminLTE.css": "/css/AdminLTE.css?id=5e72463a66acbcc740d5",
"/css/app.css": "/css/app.css?id=407edb63cc6b6dc62405",
"/css/overrides.css": "/css/overrides.css?id=2d81c3704393bac77011",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=43e461db5a50dbd76462",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map?id=0be7790b84909dca6a0a",
"/css/app.css.map": "/css/app.css.map?id=96b5c985e860716e6a16",
"/css/overrides.css.map": "/css/overrides.css.map?id=f7ce9ca49027594ac402",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=93eb69a65180f0c7f022",
"/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=98db4e9b7650453c8b00",
"/js/dist/all.js": "/js/dist/all.js?id=2d0469b07a6bc188bedd",
"/js/dist/all.js": "/js/dist/all.js?id=b1abf701b13d5fc138a3",
"/css/build/all.css": "/css/build/all.css?id=98db4e9b7650453c8b00",
"/js/build/all.js": "/js/build/all.js?id=2d0469b07a6bc188bedd"
"/js/build/all.js": "/js/build/all.js?id=b1abf701b13d5fc138a3"
}

View file

@ -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>

View file

@ -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',
);

View file

@ -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();

View file

@ -281,7 +281,7 @@
@if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
<a href="{{ $asset->{$field->db_column_name()} }}" target="_new">{{ $asset->{$field->db_column_name()} }}</a>
@else
{{ $asset->{$field->db_column_name()} }}
{!! nl2br(e($asset->{$field->db_column_name()})) !!}
@endif
@endif
</td>

View file

@ -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)

View file

@ -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>