Permalink
Browse files

adding a base class

  • Loading branch information...
1 parent 3690ebe commit 5ff31943bdcaf62c76960f244849650efb20a91b @rchavik committed Jun 23, 2011
Showing with 62 additions and 15 deletions.
  1. +5 −0 README
  2. +9 −0 config/jqtools.php
  3. +43 −0 views/helpers/jqtools.php
  4. +5 −15 views/helpers/tabs.php
View
5 README
@@ -0,0 +1,5 @@
+Jquerytools for cakephp Plugin Version 0.1
+------------------------------------------
+
+Good luck and have fun.
+-- rchavik
View
@@ -0,0 +1,9 @@
+<?php
+
+$config = array(
+ 'Jqtools' => array(
+ 'version' => '1.2.5',
+ 'minified' => true,
+ 'full' => true,
+ ),
+ );
View
@@ -0,0 +1,43 @@
+<?php
+
+class JqtoolsHelper extends AppHelper {
+
+ var $script = false;
+
+ var $View = null;
+
+ var $helpers = array(
+ 'Html',
+ 'Js' => array(
+ 'Jquery',
+ ),
+ );
+
+ public function __construct($options = array()) {
+ $this->View =& ClassRegistry::getObject('view');
+ Configure::load('Jqtools.jqtools');
+ return parent::__construct($options);
+ }
+
+ public function beforeRender() {
+ if (isset($params['isAjax']) && $params['isAjax'] === true) {
+ return;
+ }
+ if (isset($params['admin']) && $params['admin'] === true) {
+ return;
+ }
+ extract(Configure::read('Jqtools'));
+ if ($full) {
+ $minified = true;
+ $script = '/jqtools/js/build/' . $version . '/jquery.tools';
+ } else {
+ $script = '/jqtools/js/build/' . $version . '/' . $this->script;
+ }
+ if ($minified) {
+ $script .= '.min';
+ }
+
+ $this->Html->script($script, array('inline' => false, 'once' => true));
+ }
+
+}
View
@@ -1,25 +1,15 @@
<?php
-class TabsHelper extends AppHelper {
+App::import('Helper', 'Jqtools.Jqtools');
+class TabsHelper extends JqtoolsHelper {
+
+ var $script = 'tabs/tabs';
var $tab = false;
var $tabs = array();
- var $View = null;
-
- var $helpers = array(
- 'Html',
- 'Js' => array(
- 'Jquery',
- ),
- );
-
- public function __construct($options = array()) {
- $this->View =& ClassRegistry::getObject('view');
- return parent::__construct($options);
- }
-
function beforeRender() {
+ parent::beforeRender();
$params = $this->View->params;
if (isset($params['isAjax']) && $params['isAjax'] === true) {
return;

0 comments on commit 5ff3194

Please sign in to comment.