示例#1
0
 public function render()
 {
     if ($this->callback instanceof Closure) {
         $this->value = call_user_func($this->callback, $this->value);
     }
     return parent::render();
 }
示例#2
0
 public function render()
 {
     $this->options['format'] = $this->format;
     $this->options['locale'] = 'zh-cn';
     $this->script = "\$('#{$this->id}').datetimepicker(" . json_encode($this->options) . ");";
     return parent::render();
 }
示例#3
0
 public function render()
 {
     $this->options['format'] = $this->format;
     $this->options['locale'] = config('app.locale');
     $this->script = "\$('#{$this->id}').datetimepicker(" . json_encode($this->options) . ');';
     return parent::render();
 }
示例#4
0
    public function render()
    {
        $this->script = <<<EOT

\$('#{$this->id}').inputmask("currency", {radixPoint: '.', prefix:''})

EOT;
        return parent::render()->with(['symbol' => $this->symbol]);
    }
示例#5
0
    public function render()
    {
        if (empty($this->format)) {
            $this->format();
        }
        $options = json_encode(['mask' => $this->format]);
        $this->script = <<<EOT

\$('#{$this->id}').inputmask({$options});
EOT;
        return parent::render();
    }
示例#6
0
 public function render()
 {
     if ($this->form->builder()->isMode('create')) {
         return;
     }
     $model = $this->form->model();
     $relation = call_user_func([$model, $this->relationName]);
     if (!$relation instanceof Relation) {
         throw new \Exception('embedsMany field must be a EmbedsMany relation.');
     }
     $form = new Form($relation->getRelated(), $this->builder);
     $form->build();
     return parent::render()->with(['form' => $form->builder()])->render();
 }
示例#7
0
    public function render()
    {
        $this->default(0);
        $this->script = <<<EOT

\$('#{$this->id}').bootstrapNumber({
\tupClass: 'success',
\tdownClass: 'primary',
\tcenter: true
});

EOT;
        return parent::render();
    }
示例#8
0
 public function render()
 {
     if ($this->form->builder()->isMode('create')) {
         return;
     }
     $model = $this->form->model();
     $relation = call_user_func([$model, $this->relationName]);
     if (!$relation instanceof Relation) {
         throw new \Exception('hasMany field must be a HasMany relation.');
     }
     $grid = new Grid($relation->getRelated(), $this->builder);
     $grid->build();
     return parent::render()->with(['grid' => $grid]);
 }
示例#9
0
    public function render()
    {
        $this->script = <<<EOT

var editor = CodeMirror.fromTextArea(document.getElementById("{$this->id}"), {
    lineNumbers: true,
    mode: "application/ld+json",
    lineWrapping: true,
    matchBrackets: true,
    autoCloseBrackets: true,
});

EOT;
        return parent::render();
    }
示例#10
0
    public function render()
    {
        $key = array_search($this->value, $this->states);
        $this->value = $key == 'on' ? 'on' : 'off';
        $this->script = <<<EOT

\$('#{$this->id}_checkbox').bootstrapSwitch({
    size:'small',
    onSwitchChange: function(event, state) {
        \$('#{$this->id}').val(state ? 'on' : 'off');
    }
});;

EOT;
        return parent::render();
    }
示例#11
0
    public function render()
    {
        $this->options['locale'] = 'zh-cn';
        $startOptions = json_encode($this->options);
        $endOptions = json_encode($this->options + ['useCurrent' => false]);
        $this->script = <<<EOT
            \$('#{$this->id['start']}').datetimepicker({$startOptions});
            \$('#{$this->id['end']}').datetimepicker({$endOptions});
            \$("#{$this->id['start']}").on("dp.change", function (e) {
                \$('#{$this->id['end']}').data("DateTimePicker").minDate(e.date);
            });
            \$("#{$this->id['end']}").on("dp.change", function (e) {
                \$('#{$this->id['start']}').data("DateTimePicker").maxDate(e.date);
            });
EOT;
        return parent::render();
    }
示例#12
0
    public function render()
    {
        $this->script = <<<EOT
            var lat = \$('#{$this->id['lat']}').val();
            var lng = \$('#{$this->id['lng']}').val();

            var center = new qq.maps.LatLng(lat, lng);

            var container = document.getElementById("container");
            var map = new qq.maps.Map(container, {
                center: center,
                zoom: 13
            });

            var marker = new qq.maps.Marker({
                position: center,
                draggable: true,
                map: map
            });

            if( ! lat || ! lng) {
                var citylocation = new qq.maps.CityService({
                    complete : function(result){
                        map.setCenter(result.detail.latLng);
                        marker.setPosition(result.detail.latLng);
                    }
                });

                citylocation.searchLocalCity();
            }

            qq.maps.event.addListener(map, 'click', function(event) {
                marker.setPosition(event.latLng);
            });

            qq.maps.event.addListener(marker, 'position_changed', function(event) {
                var position = marker.getPosition();
                \$('#{$this->id['lat']}').val(position.getLat());
                \$('#{$this->id['lng']}').val(position.getLng());
            });
EOT;
        return parent::render();
    }
示例#13
0
    public function render()
    {
        if (empty($this->mode)) {
            $this->lang();
        }
        $this->script = <<<EOT

var editor = CodeMirror.fromTextArea(document.getElementById("{$this->id}"), {
    lineNumbers: true,
    mode: "{$this->mode}",
    extraKeys: {
        "Tab": function(cm){
            cm.replaceSelection("    " , "end");
        }
     }
});

EOT;
        return parent::render();
    }
示例#14
0
 public function render()
 {
     $this->options['checkboxClass'] = 'icheckbox_minimal-blue';
     $this->script = "\$('.{$this->column}').iCheck(" . json_encode($this->options) . ");";
     return parent::render()->with(['values' => $this->values]);
 }
示例#15
0
 /**
  * @param Field $field
  *
  * @return $this
  */
 public function pushField(Field $field)
 {
     $field->setForm($this);
     $this->builder->fields()->push($field);
     return $this;
 }
示例#16
0
 public function render()
 {
     $this->script = "\$('#{$this->id}').inputmask('decimal', {\n    rightAlign: true\n  });";
     return parent::render();
 }
示例#17
0
 public function render()
 {
     $this->script = '$("[data-mask]").inputmask();';
     return parent::render();
 }
示例#18
0
 public function render()
 {
     $this->script = "\$('#{$this->id}').colorpicker();";
     return parent::render();
 }
示例#19
0
 public function render()
 {
     Admin::script('$("[data-mask]").inputmask();');
     return parent::render();
 }
示例#20
0
 public function render()
 {
     $option = json_encode($this->options);
     $this->script = "\$('#{$this->id}').ionRangeSlider({$option})";
     return parent::render();
 }
示例#21
0
 public function render()
 {
     $this->script = "CKEDITOR.replace('{$this->column}');";
     return parent::render();
 }
示例#22
0
 public function render()
 {
     $this->script = "\$('.{$this->id}').bootstrapSwitch();";
     return parent::render()->with(['values' => $this->values]);
 }
示例#23
0
    public function render()
    {
        $this->js[] = 'bootstrap-fileinput/js/fileinput_locale_' . config('app.locale') . '.js';
        $this->options['initialCaption'] = basename($this->value);
        if (!empty($this->value)) {
            $this->options['initialPreview'] = $this->preview();
        }
        $options = json_encode($this->options);
        $this->script = <<<EOT

\$("#{$this->id}").fileinput({$options});

\$("#{$this->id}").on('filecleared', function(event) {
    \$("#{$this->id}_action").val(1);
});

EOT;
        return parent::render();
    }
示例#24
0
 public function render()
 {
     $this->script .= "\$(\"#{$this->id}\").select2({allowClear: true});";
     return parent::render()->with(['options' => $this->options]);
 }
示例#25
-2
 public function render()
 {
     $this->options['radioClass'] = 'iradio_minimal-blue';
     Admin::script("\$('.{$this->id}').iCheck(" . json_encode($this->options) . ");");
     return parent::render()->with(['values' => $this->values]);
 }