Skip to content

Commit 99b1baa

Browse files
author
Ryan Thompson
committed
Updates and improvements
1 parent fe81f0d commit 99b1baa

File tree

4 files changed

+74
-108
lines changed

4 files changed

+74
-108
lines changed

Diff for: language/english/color_lang.php

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
// Details
4+
$lang['streams.color.name'] = 'Color Picker';

Diff for: language/english/color_picker_lang.php

-9
This file was deleted.

Diff for: src/Pyro/FieldType/Color.php

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php namespace Pyro\FieldType;
2+
3+
use Pyro\Module\Streams\FieldType\FieldTypeAbstract;
4+
5+
class ColorPicker extends FieldTypeAbstract
6+
{
7+
/**
8+
* Field type slug
9+
*
10+
* @var string
11+
*/
12+
public $field_type_slug = 'color';
13+
14+
/**
15+
* DB col type
16+
*
17+
* @var string
18+
*/
19+
public $db_col_type = 'string';
20+
21+
/**
22+
* Version
23+
*
24+
* @var string
25+
*/
26+
public $version = '1.0';
27+
28+
/**
29+
* Author
30+
*
31+
* @var array
32+
*/
33+
public $author = array(
34+
'name' => 'Ryan Thompson - AI Web Systems, Inc.',
35+
);
36+
37+
/**
38+
* Event
39+
*/
40+
public function event()
41+
{
42+
$this->js('colorpicker.js');
43+
$this->css('colorpicker.css');
44+
}
45+
46+
/**
47+
* Form input
48+
* @return string
49+
*/
50+
public function formInput()
51+
{
52+
$out = form_input($this->form_slug, $this->value);
53+
54+
$out .= '
55+
<script type="text/javascript">
56+
$(document).ready(function(){
57+
$("input[name=\"'.$this->form_slug.'\"]").ColorPicker({
58+
onChange: function (hsb, hex, rgb) {
59+
$("input[name=\''.$this->form_slug.'\']").val("#" + hex);
60+
},
61+
onBeforeShow: function () {
62+
$(this).ColorPickerSetColor(this.value);
63+
}
64+
});
65+
});
66+
</script>';
67+
68+
return $out;
69+
}
70+
}

Diff for: src/Pyro/FieldType/ColorPicker.php

-99
This file was deleted.

0 commit comments

Comments
 (0)