Пример #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]);
 }