2017 © Pedro Peláez
 

yima-core-module yima-jquery

jQuery view helper for integration into application.

image

rayamedia/yima-jquery

jQuery view helper for integration into application.

  • Monday, September 8, 2014
  • by Payam
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

jQuery Integration View Helper Module

this module is part of Yima Application Framework, (*1)

The jQuery() view helper simplifies setup of your jQuery environment in your application. All jQuery view helpers put their javascript code onto this stack. It acts as a collector for js scripts in your application., (*2)

Why we need this?

We working on modular system and each module can plugged into application and played his role, if module need some jQuery script in view then we have to use up jquery library, how to know that library not attached before, or which version from which address attached ?, (*3)

In other hand we may used another js library like mootools in theme layout of site, and we need to use no conflict mode for jQuery scripts. Are we must edit whole modules script for this?, (*4)

Also we have a collector of whole jQuery scripts, you can do more if thinking more., (*5)

Usage

Basic usage in view layout: php jQuery() ->setNoConflict() ->setNoConflictHandler('$j') ->appendScript(' $(document).ready(function() { console.log($.fn); }); (function ($) { var SlickEditor = { TextCellEditor: function (args) { }, LongTextCellEditor: function (args) { } }; // $ inside immediately functions not replaced with noConflict handler $.extend(window, SlickEditor); })(jQuery); '); ?> this will output: ```html , (*6)

<script type="text/javascript">var $j = jQuery.noConflict();</script>
<script type="text/javascript">
    $j(document).ready(function() {
        console.log($j.fn);
    });

    (function ($) {
        var SlickEditor = {
            TextCellEditor: function (args) {
            },
            LongTextCellEditor: function (args) {
            }
        };
        // $ inside immediately functions not replaced with noConflict handler
        $.extend(window, SlickEditor);
    })(jQuery);
</script>

```, (*7)

Configuration

    return array(
        'yima-jquery' => array(
            /**
             * Each Delivery Resolve to a jQuery version library address
             *
             * foreach deliveries key we must have a service in serviceManager
             * with name 'YimaJquery\Deliveries\[ServiceName]' in example for key 'service-name'
             *
             */
            'deliveries'       => array(
                'cdn',
                // or with construct options
                /*
                'cdn' => array(
                    'cdn-base'      => '//cdnjs.cloudflare.com/ajax/libs',
                    'cdn-subfolder' => 'jquery/',
                    'cdn-file-path' => '/jquery.min.js',
                ),
                */
            ),

            // decorator class or registered service
            // decorators get container of scripts and render as html or whatever else
            'decorator' => 'yimaJquery\Decorator\DefaultDecorator'
        ),
    );

Instruction

No more instruction yet! explore codes see comments and the way it works., (*8)

Installation

Composer installation:, (*9)

require rayamedia/yima-jquery in your composer.json, (*10)

Or clone to modules folder, (*11)

Enable module in application config, (*12)

Support

To report bugs or request features, please visit the Issue Tracker., (*13)

  • Please feel free to contribute with new issues, requests and code fixes or new features. *

The Versions

08/09 2014

dev-master

9999999-dev

jQuery view helper for integration into application.

  Sources   Download

The Requires

 

by Payam Naderi

jquery zf2 zf2 module raya media yima jquery integration jquery view helper