PHP Classes

File: src/views/crud/fields/edit/json.blade.php

Recommend this page to a friend!
  Classes of TJ Webb   Laravel CRUD Generator   src/views/crud/fields/edit/json.blade.php   Download  
File: src/views/crud/fields/edit/json.blade.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Laravel CRUD Generator
Generate MVC classes for any Laravel model
Author: By
Last change:
Date: 4 years ago
Size: 1,095 bytes
 

Contents

Class file image Download
<div class="col-xs-12 col-sm-12 col-md-12">
    <div class="form-group">
        <strong>{{$fieldDisplayName}}:</strong>

        <textarea
            class="json_text"
            name="{{$fieldColumnName}}"
            id="jsontext_{{$fieldColumnName}}"
            >{!! is_string($value) ? $value : json_encode($value ?? new stdClass()) !!}</textarea>

        <div id="jsoneditor_{{$fieldColumnName}}" class="json_editor"></div>

        <script>
            (function(uid){
                container = document.getElementById("jsoneditor_" + uid)
                options = {
                    modes: ["code", "tree"],
                    onChangeText: function(jsonString){
                        document.getElementById("jsontext_" + uid).value = jsonString;
                    }
                }
                editor = new JSONEditor(this.container, this.options)
                initial = {!! is_string($value) ? $value : json_encode($value ?? new stdClass()) !!}
                editor.set(initial)
            })("{{$fieldColumnName}}");

        </script>
    </div>
</div>