예제 #1
0
 function requiresJsAndCss()
 {
     $elements = $this->field->headElements(new Parameter('notUsed', new StringType()));
     $this->assert(array_slice($elements, 0, 4), [HeadElements::jquery(), HeadElements::bootstrap(), HeadElements::bootstrapJs(), HeadElements::fontAwesome()]);
     $this->assert->contains((string) $elements[4], 'summernote.min.css');
     $this->assert->contains((string) $elements[5], 'summernote.min.js');
     $this->assert->contains((string) $elements[6], "\$(this).val(\$(this).code());");
 }
예제 #2
0
 function noHeadElements()
 {
     $elements = $this->field->headElements($this->param);
     $this->assert($elements[0], HeadElements::bootstrap());
     $this->assert($elements[1], HeadElements::jquery());
     $this->assert->contains((string) $elements[2], 'bootstrap-switch.min.css');
     $this->assert->contains((string) $elements[3], 'bootstrap-switch.min.js');
     $this->assert->contains((string) $elements[4], "\$('.boolean-switch').bootstrapSwitch(");
 }
예제 #3
0
 function requiresLibraries()
 {
     $headElements = implode('', $this->field->headElements(new Parameter('foo', new UnknownType())));
     $this->assert->contains($headElements, (string) HeadElements::jquery());
     $this->assert->contains($headElements, (string) HeadElements::bootstrap());
     $this->assert->contains($headElements, (string) HeadElements::bootstrapJs());
     $this->assert->contains($headElements, 'moment.js');
     $this->assert->contains($headElements, 'bootstrap-datetimepicker.min.js');
     $this->assert->contains($headElements, 'bootstrap-datetimepicker.min.css');
 }
예제 #4
0
 function collectHeadElements()
 {
     $this->action->givenTheAction('foo');
     $this->givenAWebFieldRequiringTheHeadElements(function (Parameter $parameter) {
         return [new Element('one'), new Element($parameter->getName())];
     });
     $this->whenIExecute('foo');
     $this->thenThereShouldBeAHeadElement(HeadElements::jquery());
     $this->thenThereShouldBeAHeadElement(HeadElements::jqueryUi());
     $this->thenThereShouldBeAHeadElement(HeadElements::bootstrap());
     $this->thenThereShouldBeAHeadElement(HeadElements::bootstrapJs());
     $this->thenThereShouldBeAHeadElement('<one></one>');
     $this->thenThereShouldBeAHeadElement('<foo></foo>');
 }
예제 #5
0
 /**
  * @param WebRequest $request <-
  * @return array
  */
 public function doGet(WebRequest $request)
 {
     $this->resetBreadCrumbs();
     return ['name' => $this->app->name, 'menu' => $this->app->menu->render($request), 'action' => $this->assembleActions($request->getContext()), 'headElements' => [(string) HeadElements::jquery(), (string) HeadElements::bootstrap(), (string) HeadElements::bootstrapJs()]];
 }
예제 #6
0
파일: ImageField.php 프로젝트: jonfm/domin
 /**
  * @param Parameter $parameter
  * @return array|\rtens\domin\delivery\web\Element[]
  */
 public function headElements(Parameter $parameter)
 {
     $script = file_get_contents(__DIR__ . '/js/ImageField.js');
     $script = str_replace('$cropperOptions$', json_encode($this->getCropperOptions()), $script);
     $script = str_replace('$webcamjsOptions$', json_encode($this->getWebcamOptions()), $script);
     return [HeadElements::jquery(), HeadElements::bootstrapJs(), HeadElements::bootstrap(), HeadElements::script('//cdnjs.cloudflare.com/ajax/libs/cropper/0.9.3/cropper.min.js'), HeadElements::style('//cdnjs.cloudflare.com/ajax/libs/cropper/0.9.3/cropper.min.css'), HeadElements::script('http://pixlcore.com/demos/webcamjs/webcam.js'), new Element('script', [], [$script])];
 }
예제 #7
0
 private static function baseHeadElements()
 {
     return [HeadElements::jquery(), HeadElements::jqueryUi(), HeadElements::bootstrap(), HeadElements::bootstrapJs()];
 }
예제 #8
0
 /**
  * @param Parameter $parameter
  * @return array|Element[]
  */
 public function headElements(Parameter $parameter)
 {
     return [HeadElements::bootstrap(), HeadElements::jquery(), HeadElements::style('//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.min.css'), HeadElements::script('//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js'), new Element('script', [], ["\n                \$(function () {\n                    \$('.boolean-switch').bootstrapSwitch({\n                        size: 'small',\n                        onColor: 'success',\n                        onText: 'Yes',\n                        offText: 'No'\n                    });\n                });"])];
 }
예제 #9
0
 /**
  * @param Parameter $parameter
  * @return array|Element[]
  */
 public function headElements(Parameter $parameter)
 {
     return [HeadElements::jquery(), HeadElements::bootstrap(), HeadElements::bootstrapJs(), HeadElements::script('//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js'), HeadElements::script('//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.14.30/js/bootstrap-datetimepicker.min.js'), HeadElements::style('//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.14.30/css/bootstrap-datetimepicker.min.css'), new Element('script', [], ['var dateTimePickerSettings = ' . json_encode($this->getOptions()) . ';'])];
 }
예제 #10
0
 /**
  * @param ActionList $value
  * @return array|Element[]
  */
 public function headElements($value)
 {
     return [HeadElements::jquery(), HeadElements::bootstrap(), HeadElements::bootstrapJs()];
 }
예제 #11
0
파일: HtmlField.php 프로젝트: jonfm/domin
 /**
  * @param Parameter $parameter
  * @return array|Element[]
  */
 public function headElements(Parameter $parameter)
 {
     return [HeadElements::jquery(), HeadElements::bootstrap(), HeadElements::bootstrapJs(), HeadElements::fontAwesome(), HeadElements::style('//cdnjs.cloudflare.com/ajax/libs/summernote/0.6.10/summernote.min.css'), HeadElements::script('//cdnjs.cloudflare.com/ajax/libs/summernote/0.6.10/summernote.min.js'), new Element('script', [], ["\n                \$(function() {\n                    \$('.summernote').summernote({\n                        onKeyup: function(e) {\n                            \$(this).val(\$(this).code());\n                        }\n                    });\n                    \$('.summernote').on('invalid', function (e) {\n                        var editor = \$(e.target).siblings('.note-editor');\n                        editor.popover({\n                            content: 'Please fill out this field.',\n                            placement: 'bottom',\n                            trigger: 'manual'\n                        });\n                        editor.popover('show');\n\n                        editor.click(function () {\n                            editor.popover('hide');\n                        });\n                    });\n                });\n            "])];
 }