Module: Zena::Use::Dates::ZafuMethods
- Includes:
- RubyLess
- Defined in:
- lib/zena/use/dates.rb
Instance Method Summary collapse
- #get_date(signature) ⇒ Object
- #get_parse_date(signature) ⇒ Object
- #get_tz(signature) ⇒ Object
- #r_default ⇒ Object
-
#r_uses_datebox ⇒ Object
date_box seizure setup.
Instance Method Details
#get_date(signature) ⇒ Object
402 403 404 405 406 407 408 |
# File 'lib/zena/use/dates.rb', line 402 def get_date(signature) if var = get_context_var('set_var', 'date') {:class => var.klass, :method => var, :nil => var.could_be_nil?} else {:class => Time, :method => 'main_date'} end end |
#get_parse_date(signature) ⇒ Object
418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/zena/use/dates.rb', line 418 def get_parse_date(signature) tz_var = get_context_var('set_var', 'tz') if signature == ['parse_date', String] append = [ RubyLess::TypedString.new(_(DATETIME).inspect, :class => String), tz_var || RubyLess::TypedString.new('visitor.tz', :class => TZInfo::Timezone), ] elsif signature = ['parse_date', String, String] append = tz_var || RubyLess::TypedString.new('visitor.tz', :class => TZInfo::Timezone) else append = nil end {:method => 'parse_date', :class => Time, :nil => true, :accept_nil => true, :append_args => append} end |
#get_tz(signature) ⇒ Object
410 411 412 413 414 415 416 |
# File 'lib/zena/use/dates.rb', line 410 def get_tz(signature) if var = get_context_var('set_var', 'tz') {:class => var.klass, :method => var, :nil => var.could_be_nil?} else {:class => TZInfo::Timezone, :method => 'visitor.tz'} end end |
#r_default ⇒ Object
433 434 435 436 437 438 439 |
# File 'lib/zena/use/dates.rb', line 433 def r_default if tz_name = @params.delete(:tz) set_tz_code, tz_var = set_tz_var(tz_name) out set_tz_code end super end |
#r_uses_datebox ⇒ Object
date_box seizure setup
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/zena/use/dates.rb', line 443 def r_uses_datebox if ZENA_CALENDAR_LANGS.include?(visitor.lang) l = visitor.lang else l = visitor.site[:default_lang] end <<-EOL <script src="#{helper.send(:compute_public_path, 'calendar', 'calendar', 'js')}" type="text/javascript"></script> <script src="#{helper.send(:compute_public_path, 'calendar-setup', 'calendar', 'js')}" type="text/javascript"></script> <script src="#{helper.send(:compute_public_path, "calendar-#{l}-utf8", 'calendar/lang', 'js')}" type="text/javascript"></script> <link href="#{helper.send(:compute_public_path, "calendar-brown", 'calendar', 'css')}" media="screen" rel="Stylesheet" type="text/css" /> <% js_data << %Q{Calendar._TT["DEF_DATE_FORMAT"] = "#{_('datetime')}";} -%> <% js_data << %Q{Calendar._TT["FIRST_DAY"] = #{_('week_start_day')};} -%> EOL end |