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
313 314 315 316 317 318 319 |
# File 'lib/zena/use/dates.rb', line 313 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
329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/zena/use/dates.rb', line 329 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
321 322 323 324 325 326 327 |
# File 'lib/zena/use/dates.rb', line 321 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
344 345 346 347 348 349 350 |
# File 'lib/zena/use/dates.rb', line 344 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
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/zena/use/dates.rb', line 354 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 |