protected function js($objectName, $attrName, $options)
 {
     // setup multiple search
     /*
       all search options (including the option chosenOptions, that is passed for chosen plugin),
       can be overwritten adding "var = multipleSearch<ObjectName>Options = { 'options' : 'val', option2 : '_' };"
       in the script file for the resource controller.
     */
     $resourceOptions = "multipleSearch" . Portabilis_String_Utils::camelize($objectName) . "Options";
     $js = "{$resourceOptions} = typeof {$resourceOptions} == 'undefined' ? {} : {$resourceOptions};\n           multipleSearchHelper.setup('{$objectName}', '{$attrName}', '" . $options['searchPath'] . "', {$resourceOptions});";
     // this script will be executed after the script for the current controller (if it was loaded in the view);
     Portabilis_View_Helper_Application::embedJavascript($this->viewInstance, $js, $afterReady = true);
 }
Beispiel #2
0
 protected function js($objectName, $attrName, $options)
 {
     // load simple search js
     $jsFile = '/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/SimpleSearch.js';
     Portabilis_View_Helper_Application::loadJavascript($this->viewInstance, $jsFile);
     // setup simple search
     /*
       all search options (including the option autocompleteOptions, that is passed for jquery autocomplete plugin),
       can be overwritten adding "var = simpleSearch<ObjectName>Options = { option : '...', optionName : '...' };"
       in the script file for the resource controller.
     */
     $resourceOptions = "simpleSearch" . Portabilis_String_Utils::camelize($objectName) . "Options";
     $js = "{$resourceOptions} = typeof {$resourceOptions} == 'undefined' ? {} : {$resourceOptions};\n           simpleSearchHelper.setup('{$objectName}', '{$attrName}', '" . $options['searchPath'] . "', {$resourceOptions});";
     // this script will be executed after the script for the current controller (if it was loaded in the view);
     Portabilis_View_Helper_Application::embedJavascript($this->viewInstance, $js, $afterReady = true);
 }
 protected function placeholderJs($options)
 {
     $optionsVarName = "multipleSearch" . Portabilis_String_Utils::camelize($options['objectName']) . "Options";
     $js = "if (typeof {$optionsVarName} == 'undefined') { {$optionsVarName} = {} };\n                       {$optionsVarName}.placeholder = safeUtf8Decode('Selecione os assuntos');";
     Portabilis_View_Helper_Application::embedJavascript($this->viewInstance, $js, $afterReady = true);
 }