Simple wrapper extension for the simple and excellent miniColors jQuery color picker plugin
Yii 1.1 or above (I assume - built with Yii 1.1.8)
Extract / checkout these files into the SMiniColors directory under protected/extensions in your Yii project
This extension contains two classes:
Generates a standard HTML input tag with the ID you specify
$this->widget('ext.SMiniColors.SColorPicker', array( 'id' => 'myInputId', 'defaultValue'=>'#000000', 'hidden'=>false, // defaults to false - can be set to hide the textarea with the hex 'options' => array(), // jQuery plugin options 'htmlOptions' => array(), // html attributes ));
Generates an "Active" HTML input for the CActiveRecord model you specify
$this->widget('ext.SMiniColors.SActiveColorPicker', array( 'model' => $model, 'attribute' => 'myModelAttribute', 'hidden'=>false, // defaults to false - can be set to hide the textarea with the hex 'options' => array(), // jQuery plugin options 'htmlOptions' => array(), // html attributes ));
Total 7 comments
I removed the version control folders - I think they actually came with the jQuery plugin! Anyway the .zip is clean now. Thanks!
Thank you for this nice extension, it works better and is smaller than some others I've tried.
One minor annoyance : the zip file has .svn folders in it (in the "source" folder), this conflicts with my own subversion settings.
Had the wrong documentation for the SActiveColorPicker picker. Fixed now! Thanks
;)
Thanks for the tip Raoul, an easy and handy improvement! It's in the 0.2 release now. Cheers
Thanks for this nice extension thaddeusmt.
I played a little with it but could get it to attach the color picker icon to a hidden input. To support hidden fields, here is a small modification of your extension.
First, add public member to both ColorPicker classes
Second replace the run() code with :
SColorPicker:
SActiveColorPicker:
This is very simple modification, and (tada) : hidden field are available ! ciao
Leave a comment
Please login to leave your comment.