Sha256: 88219b272a6108e310ce67560e1627a4e81fd47e968adaa2f203115b2f526683

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 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.fast('dialog'),
    pseudos: Array.fast('fieldset', 'submittable', 'invokable', 'command'),
    clone: true,
    interpolate: function(string) {
      this.options.interpolate = LSD.Interpolation.from(this.attributes, this, this.dataset)
    },
    events: {
      _dialog: {
        element: {
          'click:relay(.cancel)': 'cancel'
        },
        self: {
          submit: function() {
            this.hide();
          },
          cancel: 'hide'
        },
        setRole: function() {
          var kind = this.attributes.kind;
          if (!kind) return;
          var element = Slick.find(document.body, 'dialog#' + kind);
          if (element) return {origin: element};
        }
      }
    },
    has: {
      one: {
        form: {
          selector: 'form',
          as: 'invoker'
        }
      }
    }
  },
  
  hidden: true
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lsd_rails-0.1.2 Packages/lsd-widgets/Source/Body/Dialog.js
lsd_rails-0.1.1 Packages/lsd-widgets/Source/Body/Dialog.js
lsd_rails-0.1 Packages/lsd-widgets/Source/Body/Dialog.js