Exemplo n.º 1
0
 /**
  * cropit
  *
  * @return  void
  */
 public static function cropit()
 {
     if (!static::inited(__METHOD__)) {
         JQueryScript::core();
         static::addJS(static::packageName() . '/js/jquery.cropit.min.js');
     }
 }
Exemplo n.º 2
0
    /**
     * instance
     *
     * @param string $selector
     * @param array  $data
     * @param array  $properties
     *
     * @return  void
     */
    public static function instance($selector, array $data = [], array $properties = [])
    {
        static::core();
        JQueryScript::core();
        $var = lcfirst(StringNormalise::toCamelCase(trim($selector, '.#[]')));
        $instance = ['el' => $selector, 'data' => $data];
        $instance = static::getJSObject($instance, $properties);
        static::internalJS(<<<JS
jQuery(function(\$) {
    window.vueInstances = window.vueInstances || {};
    window.vueInstances.{$var} = new Vue({$instance});
});
JS
);
    }
    /**
     * prepareScript
     *
     * @return  void
     */
    protected function prepareScript()
    {
        static $inited = false;
        if ($inited) {
            return;
        }
        JQueryScript::ui(array('effect'));
        $js = <<<JS
// Phoenix.Field.Modal
var Natika;
(function(Natika, \$)
{
    (function()
    {
        Natika.Field.Modal = {
            select: function(selector, id, title)
            {
                var ele = \$(selector);

                ele.find('.input-group input').attr('value', title).delay(250).effect('highlight');
                ele.find('input[data-value-store]').attr('value', id);

                ele.find('.icon-preview > span').attr('class', id);

                \$('#phoenix-iframe-modal').modal('hide');
            }
        };
    })(Natika.Field || (Natika.Field = {}));
})(Natika || (Natika = {}), jQuery);

jQuery(document).ready(function(\$) {
    var inputs = \$('.icon-input-field');

    inputs.each(function(i) {
        var \$this = \$(this);

        var value = \$this.val();
        var icon = '<span class="' + value + '"></span>';

\t\t\$this.parent('.input-group').prepend('<span class="input-group-addon icon-preview">' + icon + '</span>');
    });
});
JS;
        Asset::internalScript($js);
        $inited = true;
    }
Exemplo n.º 4
0
 /**
  * backbone
  *
  * @param bool  $noConflict
  * @param array $options
  *
  * @return  void
  */
 public static function backbone($noConflict = false, $options = array())
 {
     $asset = static::getAsset();
     if (!static::inited(__METHOD__)) {
         JQueryScript::core(ArrayHelper::getValue($options, 'jquery_no_conflict', false));
         static::underscore(ArrayHelper::getValue($options, 'jquery_no_conflict', true));
         $asset->addScript(static::phoenixName() . '/js/core/backbone.min.js');
     }
     if (!static::inited(__METHOD__, (bool) $noConflict) && $noConflict) {
         $asset->internalScript(';var backbone = Backbone.noConflict();');
     }
 }
Exemplo n.º 5
0
 /**
  * prepareScripts
  *
  * @return  void
  */
 protected function prepareScripts()
 {
     parent::prepareScripts();
     JQueryScript::colorPicker('#input-item-params-bg_color');
 }
Exemplo n.º 6
0
{{-- Part of natika project. --}}

<?php 
\Natika\Script\EditorScript::codeMirror('editor', '#input-body');
\Phoenix\Script\JQueryScript::core();
\Phoenix\Asset\Asset::addScript('js/inline-uploader/inline-uploader.js');
\Phoenix\Asset\Asset::addScript('js/inline-uploader/adapter/codemirror-adapter.js');
\Phoenix\Asset\Asset::addScript('js/markdown/js-markdown-extra.min.js');
?>

<div id="editor" class="panel panel-default">
    <div class="panel-heading clearfix">
        <div class="pull-left">
            Editor
        </div>
        <div class="pull-right">

        </div>
    </div>
    <div class="panel-body">
        @if (!empty($title_field))
        <div class="form-group">
            <label for="input-title" class="sr-only">Title</label>
            <input type="text" class="form-control input-lg" id="input-title" name="item[title]" placeholder="Title" value="{{ $post->title }}">
        </div>
        @endif

            <div class="toolbar">
                <div class="btn-group">
                    <button id="button-h1" class="btn btn-default btn-sm">H1</button>
                    <button id="button-h2" class="btn btn-default btn-sm">H2</button>
Exemplo n.º 7
0
    /**
     * prepareScript
     *
     * @return  void
     */
    protected function prepareScript()
    {
        static $inited = false;
        if ($inited) {
            return;
        }
        JQueryScript::ui(array('effect'));
        $js = <<<JS
// Phoenix.Field.Modal
var Phoenix;
(function(Phoenix, \$)
{
    (function()
    {
        Phoenix.Field.Modal = {
            select: function(selector, id, title)
            {
                var ele = \$(selector);

                ele.find('.input-group input').attr('value', title).trigger('change').delay(250).effect('highlight');
                ele.find('input[data-value-store]').attr('value', id).trigger('change');

                \$('#phoenix-iframe-modal').modal('hide');
            }
        };
    })(Phoenix.Field || (Phoenix.Field = {}));
})(Phoenix || (Phoenix = {}), jQuery);
JS;
        Asset::internalScript($js);
        $inited = true;
    }
Exemplo n.º 8
0
{{-- Part of natika project. --}}

<?php 
\Phoenix\Script\JQueryScript::colorPicker('#input-color');
//$image = new \Lyrasoft\Luna\Field\Image\SingleImageDragField;
//$image->setName('image')
//    ->set('height', 200)
//    ->set('width', 300);
?>

    <!-- Modal -->
<div class="modal fade" id="categoryModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <form action="{{ $uri['full'] }}" method="post">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="categoryModalLabel">Category</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label for="category-title" class="sr-only">Title</label>
                        <input type="text" name="item[title]" class="form-control input-lg" id="category-title" placeholder="Category Title">
                    </div>

                    <div class="form-group">
                        <label for="category-desc" class="sr-only">Description</label>
                        <textarea rows="6" name="item[description]" class="form-control input-lg" id="category-desc" placeholder="Description"></textarea>
                    </div>

                    <div class="row">
Exemplo n.º 9
0
{{-- Part of phoenix project. --}}

<?php 
\Phoenix\Script\JQueryScript::highlight('.searchable', $state['input.search.content']);
?>

@extends($warderExtends)

@section('toolbar')
    @include('toolbar')
@stop

@section('admin-body')
    <style>
        .user-avatar {
            height: 48px;
            width: 48px;
            border-radius: 50%;
            min-width: 48px;
            margin-right: 10px;
        }
        .user-avatar-default {
            background-image: url('{{ \Windwalker\Warder\Helper\AvatarUploadHelper::getDefaultImage() }}');
            background-size: cover;
            display: inline-block;
            vertical-align: middle;
        }

        .grid-table table.table > tbody > tr > td {
            vertical-align: middle;
        }
Exemplo n.º 10
0
    /**
     * multiSelect
     *
     * @param string $selector
     * @param array  $options
     */
    public static function multiSelect($selector = '#admin-form table', $options = array())
    {
        if (!static::inited(__METHOD__)) {
            JQueryScript::core();
            static::addJS(static::phoenixName() . '/js/phoenix/multiselect.min.js');
        }
        if (!static::inited(__METHOD__, get_defined_vars())) {
            $options = static::getJSObject($options);
            $js = <<<JS
// Chosen select
jQuery(document).ready(function(\$)
{
\t\$('{$selector}').multiselect('{$selector}', {$options});
});
JS;
            static::internalJS($js);
        }
    }
Exemplo n.º 11
0
    /**
     * highlight
     *
     * @param  string  $selector
     * @param  string  $text
     * @param  array   $options
     *
     * @see  http://bartaz.github.io/sandbox.js/jquery.highlight.html
     *
     * @return  void
     */
    public static function highlight($selector = null, $text = null, $options = array())
    {
        $args = get_defined_vars();
        $asset = static::getAsset();
        if (!static::inited(__METHOD__)) {
            JQueryScript::core();
            $asset->addScript(static::phoenixName() . '/js/jquery/jquery.highlight.js');
        }
        if (!static::inited(__METHOD__, $args) && $selector && $text) {
            if (is_array($text)) {
                $text = implode(' ', $text);
            }
            $defaultOptions = array('element' => 'mark', 'className' => 'phoenix-highlight');
            $options = $asset::getJSObject(ArrayHelper::merge($defaultOptions, $options));
            $js = <<<JS
// Highlight Text
jQuery(document).ready(function(\$)
{
\t\$('{$selector}').highlight('{$text}', {$options});
});
JS;
            $asset->internalScript($js);
        }
    }