Sha256: fe7a0140ce50fa83e9dbc850f9d19d163d1c17b1fe5a4d11089a0b4bead119de

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

/*
---
 
script: Dialog.js
 
description: A multipurpose yes/no dialog
 
license: Public domain (http://unlicense.org).

authors: Yaroslaff Fedin
 
requires:
  - LSD.Widget.Body.Page
  - LSD/LSD.Mixin.Fieldset
  - LSD/LSD.Mixin.Submittable
  - LSD/LSD.Mixin.Command
  - LSD/LSD.Mixin.Invokable

provides:
  - LSD.Widget.Body.Dialog

...
*/

LSD.Widget.Body.Dialog = new Class({
  Extends: LSD.Widget.Body.Page,
  
  options: {
    element: {
      tag: 'section'
    },
    classes: Array.object('dialog'),
    pseudos: Array.object('fieldset', 'submittable', 'invokable', 'command', 'focusable'),
    clone: true,
    events: {
      _dialog: {
        element: {
          'click:relay(.cancel)': 'cancel'
        },
        self: {
          submit: function() {
            this.hide();
          },
          cancel: 'hide'
        },
        setRole: function() {
          var kind = this.attributes.kind;
            console.error('set role', kind, this.element, this.attributes);
          if (!kind) return;
          var element = Slick.find(document.body, 'dialog#' + kind);
          if (element) return {origin: element};
        }
      }
    },
    has: {
      one: {
        form: {
          selector: 'form',
          as: 'invoker',
          pseudos: Array.object('invokable')
        }
      }
    }
  },
  
  getParentElement: function() {
    return document.body;
  },
  
  hidden: true
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/lsd-widgets/Source/Body/Dialog.js
lsd_rails-0.1.5 Packages/lsd-widgets/Source/Body/Dialog.js
lsd_rails-0.1.4 Packages/lsd-widgets/Source/Body/Dialog.js
lsd_rails-0.1.3 Packages/lsd-widgets/Source/Body/Dialog.js