Skip to content

Commit

Permalink
Added ability to specify button image for the datepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
David McReynolds committed Oct 23, 2014
1 parent 921166b commit b4a7254
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions fuel/modules/fuel/assets/js/fuel/custom_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ fuel.fields.datetime_field = function(context){
firstDay : $(this).attr('data-first_day'),
showOn : $(this).attr('data-show_on')
};
if ($(this).attr('data-button_image')){
options.buttonImage = $(this).attr('data-button_image');
}
var opts = $.extend(o, options);
$.datepicker.regional[o.region];

Expand Down
17 changes: 8 additions & 9 deletions fuel/modules/fuel/libraries/Form_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,8 @@ public function create_date($params)
'min_date' => date($params['date_format'], strtotime('01/01/2000')),
'max_date' => date($params['date_format'], strtotime('12/31/2030')),
'first_day' => 0,
'show_on' => 'button'
'show_on' => 'button',
'button_image' => NULL,
);

$params = $this->normalize_params($params, $defaults);
Expand Down Expand Up @@ -2242,6 +2243,10 @@ public function create_date($params)
$params['data']['max_date'] = $params['max_date'];
$params['data']['first_day'] = $params['first_day'];
$params['data']['show_on'] = $params['show_on'];
if (!empty($params['button_image']))
{
$params['data']['button_image'] = $params['button_image'];
}
$params['placeholder'] = $format;
$params['type'] = 'text';
return $this->create_text($params);
Expand Down Expand Up @@ -3524,7 +3529,7 @@ public function get_js($js = NULL)
*
* @access public
* @param string A CSS file name
* @param mixed A key value to associate with the CSS file (so it only gets loaded once). Or an associative array of keyed javascript file names
* @param mixed A key value to associate with the CSS file (so it only gets loaded once). Or an associative array of keyed CSS file names
* @return void
*/
public function add_css($css = NULL, $key = NULL)
Expand All @@ -3548,15 +3553,10 @@ public function add_css($css = NULL, $key = NULL)
{
if (empty($key))
{
if (is_array($css))
{
$this->css = array_merge($this->css, $css);
}
else if (!in_array($css, $this->css))
if (!in_array($css, $this->css))
{
$this->css[] = $css;
}

}
else if (!in_array($css, $this->css))
{
Expand Down Expand Up @@ -3929,7 +3929,6 @@ protected function _apply_css()
foreach($css as $k => $c)
{
$module = (is_string($k)) ? $k : NULL;

if (is_array($c))
{
foreach($c as $file)
Expand Down

0 comments on commit b4a7254

Please sign in to comment.