Sha256: a6cdfb9a7546b047aca83ef32b775136845576dd13861871ef599ad6ebfa0a34

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

/*
---
 
script: Date.js
 
description: Date picker
 
license: Public domain (http://unlicense.org).

authors: Yaroslaff Fedin
 
requires:
  - LSD.Widget.Input
  - LSD.Widget.Table.Calendar

provides: [LSD.Widget.Input.Date]
 
...
*/

LSD.Widget.Input.Date = new Class({
  Extends: LSD.Widget.Input,
  
  options: {
    attributes: {
      type: 'date'
    },
    pseudos: Array.object('date'),
    layout: {
      'if &:focused': {
        '::dialog:of-kind(input-date)': {
          'button.previous': 'Previous month',
          'button.next': 'Next month',
          'table[type=calendar]': true
        }
      }
    },
    relations: {
      decrementor: {
        selector: '.previous',
        events: {
          click: 'decrement'
        }
      },
      incrementor: {
        selector: '.next',
        events: {
          click: 'increment'
        }
      },
      calendar: {
        selector: 'table',
        events: {
          click: 'increment',
          set: 'setDate'
        }
      }
    },
    events: {
      _date: {
        build: function() {
          this.setDate(this.getDate());
        },
        setDate: function(date, source) {
          if (date && !source) this.element.set('value', this.formatDate(date));
          if (this.calendar) this.calendar.setDate(date);
        },
        change: 'setDate'
      }
    }
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/lsd-widgets/Source/Input/Date.js
lsd_rails-0.1.5 Packages/lsd-widgets/Source/Input/Date.js
lsd_rails-0.1.4 Packages/lsd-widgets/Source/Input/Date.js
lsd_rails-0.1.3 Packages/lsd-widgets/Source/Input/Date.js