Sha256: 733e8166f6494d83408220df4f93294305ffedd6f7be90c875dbc108b20f4e67

Contents?: true

Size: 869 Bytes

Versions: 42

Compression:

Stored size: 869 Bytes

Contents

# -*- encoding : utf-8 -*-
InlineForms::SPECIAL_COLUMN_TYPES[:date_select]=:date

# date
def date_select_show(object, attribute)
  link_to_inline_edit object, attribute, object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y")
end

def date_select_edit(object, attribute)
  css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
  out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => css_id
  out << '<SCRIPT>'.html_safe
  out << "$(function() { ".html_safe
  out << '$("#'.html_safe + css_id.html_safe + '").datepicker({ yearRange: "-100:+5" });'.html_safe
  out << '});'.html_safe
  out << '</SCRIPT>'.html_safe
  return out
end

def date_select_update(object, attribute)
  object[attribute.to_sym] = params[attribute.to_sym]
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
inline_forms-1.6.41 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.40 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.39 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.38 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.37 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.36 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.35 lib/app/helpers/form_elements/date.rb
inline_forms-2.23 lib/app/helpers/form_elements/date.rb
inline_forms-2.22 lib/app/helpers/form_elements/date.rb
inline_forms-2.21 lib/app/helpers/form_elements/date.rb
inline_forms-2.2 lib/app/helpers/form_elements/date.rb
inline_forms-2.1 lib/app/helpers/form_elements/date.rb
inline_forms-2.0 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.33 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.32 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.31 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.30 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.29 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.28 lib/app/helpers/form_elements/date.rb
inline_forms-1.6.27 lib/app/helpers/form_elements/date.rb