• This repository has been archived on 31/Jan/2024
  • Stars
    star
    279
  • Rank 147,967 (Top 3 %)
  • Language
    JavaScript
  • Created about 13 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A number of jQuery plugins to ease scripting of bootstrap featured pages.

Contains some nice jQuery plugins to make working with the facilities provided by the bootstrap CSS framework more fun.

Dialog Two, a jQuery dialog plugin based on the bootstrap modal dialog

jquery.dialog2.js uses the modal dialog provided by bootstrap and provides a controlable dialog functionality for web pages as a jQuery plugin.

Features

  • Ajax content
  • Ajax links and form submission in the dialog
  • Loading indicator
  • Localization
  • No dependencies to jQuery.UI
  • Control via html markup possible

Dependencies

Migrating from earlier versions

  • Migration from 1.x:
    • You will need bootstrap 2.x on your page
    • Change your css markup for forms according to the bootstrap 2.0 (buttons always require .btn, .primary to .btn-primary, .actions to .form-actions and so forth.

Controlling a dialog with JavaScript

  • $(selector | element | text).dialog2(options) creates a dialog with the given options from an element or selector. If the selected element exists, it will be turned into the body of the newly created dialog.
  • $(".selector").dialog2("method", argument1, argument2, ...) executes an API method (see below)

Options

The dialog2() method accepts an options object:

{
  id: "my-dialog", // id which (if specified) will be added to the dialog to make it accessible later 
  autoOpen: true | false, // Should the dialog be automatically opened?
  title: "Title of the dialog", 
  buttons: {
    button1Label: callback | object, 
    button2Label: callback, 
    ...
  }, 
  closeOnOverlayClick: true | false, // Should the dialog be closed on overlay click?
  closeOnEscape: true | false, // Should the dialog be closed if [ESCAPE] key is pressed?
  removeOnClose: true | false, // Should the dialog be removed from the document when it is closed?
  showCloseHandle: true | false, // Should a close handle be shown?
  initialLoadText: "" // Text to be displayed when the dialogs contents are loaded
}

When adding buttons to a dialog, a button options object can be passed to it instead of a callback:

{
  click: function() { }, // callback to execute on button click (has this bound to the dialog)
  primary: true | false, // if this button is the primary button (will be styled accordingly)
  type: "info" // basically additional classes to be attached to the button
}

API

  • open(): Opens the dialog (essentially shows it if it is still hidden)
  • close(): Closes the dialog and removes it from the document (if configured)
  • options(options): Applies the given options to the dialog
  • addButton(label, options): Adds a button with the given label to the dialog. If options is a function binds the click or "enter" action of the button to it. Accepts a button options object too to customize the look and feel of the button.
  • removeButton(label): Removes the button with the specified label from the list of buttons

Let the markup rule

The dialog has some distinct features which make it totally controllable via html markup.

  • When the jquery-controls plugin is added to a website, a.open-dialog links will open a dialog which shows in page or ajax content.
  • If the dialog content updates, a dialog will change its title to the contents of the first h1 element found in it. Additionally its buttons are updated based on the buttons found inside the .actions element of the dialog content.
  • .ajax forms will be submitted asynchronously and the result will be displayed in the dialog.

Changing the UI

Dialog width

Override the boostrap styles for .modal which are (as of version 1.3)

.modal {
    ...
    width: 560px;
    top: 50%;
    margin: -250px 0 0 -250px;
}

with your new styles for wide dialogs

.wide-modal {
    ...
    top: 20%;
    width: 800px;
    margin: 0 0 0 -400px; /* -1 * (width / 2) */ 
}

and add the class wide-modal to big dialogs.

Extending the dialog

A user may plug into the dialog behaviour by listening to events, namely

dialog2.ajax-start: fired right before an ajax request is started, 
dialog2.ajax-complete: fired when an ajax request was executed successfully, 
dialog2.content-update: when the dialogs contents are updated (after ajax-complete)

The preferred way to register handlers on these events is $().delegate. The code snipped shown below illustrates how this behaviour can be used to implement a auto-close ability for a dialog (see issue #19).

// If a a.auto-close is contained in the dialogs content, 
// the dialog will close itself automatically and (optionally)
// redirect to a new page
$(document).delegate(".modal", "dialog2.content-update", function() { 
     // got the dialog as this object. Do something with it!
     
    var e = $(this);
    
    var autoclose = e.find("a.auto-close");
    if (autoclose.length > 0) {
        e.dialog("close");
        
        var href = autoclose.attr('href');
        if (href) {
            window.location.href = href;
        }
    }
});

Check out some examples

Go to the plugins web page to check out a number of examples on usage.

More Repositories

1

karma-browserify

A fast Browserify integration for Karma that handles large projects with ease
JavaScript
321
star
2

works-on-my-machine

Continuous integration done right.
261
star
3

wuffle

A multi-repository / multi-organization task board for GitHub issues.
JavaScript
117
star
4

didi

Dependency Injection for JavaScript
JavaScript
87
star
5

camunda-worker-node

Implement your external task workers for Camunda in NodeJS.
JavaScript
51
star
6

node-xsd-schema-validator

A schema (XSD) validator for NodeJS
JavaScript
50
star
7

requirejs-angular-define

A friendly integration of AngularJS into RequireJS powered applications
JavaScript
48
star
8

jquery-tagit

JQuery plugin for auto completion of tags
JavaScript
44
star
9

feelin

A DMN FEEL parser and interpreter written in JavaScript
JavaScript
37
star
10

pfwr

Turns your Markdown file into a beautiful HTML slide deck. Batteries included.
HTML
26
star
11

eslint-plugin-license-header

Rules to validate the presence of license headers in source files.
JavaScript
26
star
12

feel-playground

An interactive playground to try out and learn the DMN FEEL language.
JavaScript
25
star
13

hugo-cli

Run hugo (the static site generator) painlessly from Node
JavaScript
25
star
14

bpmn-js-cli-modeling-dsl

A modeling DSL for bpmn-js
JavaScript
23
star
15

merge-me

A GitHub app that merges your pull requests once all required checks pass.
JavaScript
22
star
16

jquery-controls

Registration of ajax handlers to bind to certain elements of a page
JavaScript
22
star
17

angular-data-depend

A toolkit for implementing complex, data heavy AngularJS applications
JavaScript
19
star
18

nashorn-async

Simple async support for Nashorn (the Java 8 JavaScript Engine)
JavaScript
18
star
19

camunda-playground

Try out and explore Camunda in minutes, not hours.
JavaScript
16
star
20

selection-ranges

Manipulate selection ranges on contenteditable elements.
JavaScript
15
star
21

run-camunda

Download, spin up and shutdown Camunda painlessly from Node.
JavaScript
14
star
22

lezer-feel

Lezer grammar definition for the DMN 1.3 FEEL language
JavaScript
11
star
23

skaat

A Skat game loop
JavaScript
10
star
24

camunda-modeler-plugins-talk-2019

JavaScript
10
star
25

silent-disco

A web-based, collaborative disco
JavaScript
10
star
26

markmark

Markdown language tooling, exposed as a language server
JavaScript
8
star
27

amvn

Maven with change detection and automatic rebuild.
JavaScript
8
star
28

kartoffeldruck

A all-in-one, opinionated, swiss army knife, hackable static site generator.
JavaScript
6
star
29

bpmn-js-debug-overlay

Stepping controls for your BPMN 2.0 processes
JavaScript
6
star
30

camunda-worker-monitor

An external task / worker monitor for Camunda
JavaScript
5
star
31

lang-feel

DMN FEEL language definition for CodeMirror 6
TypeScript
5
star
32

roll-your-own-bpmn-editor

Material for my talk "How to (not) roll your own BPMN editor", given at CamundaCon LIVE 2020.
JavaScript
5
star
33

bpmn-js-copy-paste-example

An example how to copy and paste between multiple instances of bpmn-js
JavaScript
5
star
34

svelte-slot-fill

Slot/Fill for Svelte Apps
JavaScript
4
star
35

bpmn-js-extension-demo

A demo application built around the bpmn-js modeler.
JavaScript
4
star
36

bpmnlint-pack-config

Pack bpmnlint configuration into a browser consumable bundle
JavaScript
4
star
37

image-gallery

A simple to use image gallery
JavaScript
4
star
38

bpmnlint-loader

Consume bpmnlint config files with webpack
JavaScript
3
star
39

action_annotation

Allows to write human readable behavioural descriptions of controller actions which can be accessed inside a rails-app at runtime
Ruby
3
star
40

lordsandknights.automate.js

In-browser automation for Lords and Knights
3
star
41

types-without-typescript

A talk on types without TypeScript
HTML
3
star
42

annotation_security

AnnotationSecurity is a rails plugin which provides a security layer for rails applications. Security policies are set up based on actions and resources and not, as common, based on url patterns.
Ruby
3
star
43

file-drops

A simple in-browser file drop utility.
JavaScript
2
star
44

skaat-app

A simple Skat application
Svelte
2
star
45

bio-dts

Generate type definitions from JavaScript
JavaScript
2
star
46

simple-dialog

A simple dialog component for the browser
HTML
2
star
47

karma-debug-launcher

Launches your favorite browser with your tests in DEBUG view.
JavaScript
2
star
48

2021-token-simulation

Making of token simulation: Understanding bpmn-js extensibility one token at a time
HTML
2
star
49

nixis-commons

Some handy helper libraries for lightweight java web development
Java
2
star
50

create-bpmnlint-plugin

The bpmnlint plug-in scaffolding utility.
JavaScript
2
star
51

kickr.io

A social kicker app. Built with express.js, MongoDB and AngularJS
JavaScript
1
star
52

order-demo-camundacon-2019

JavaScript
1
star
53

skaat-deck

A Skat deck
JavaScript
1
star
54

cockpit-sample-plugin

A sample plugin for camunda cockpit
Java
1
star
55

.github

1
star
56

mons

Stay sane with your multi screen configuration.
JavaScript
1
star
57

wuffle-sync

A friendly bot that synchronizes your Wuffle board
1
star
58

wiredeps

Wire snapshot dependencies during continuous integration builds
JavaScript
1
star
59

kellergucker

A stock value tracker application
Java
1
star
60

lezer-el

Lezer-based EL grammar
JavaScript
1
star
61

camunda-deploy

Deploy to Camunda from the command-line.
JavaScript
1
star
62

split-require-jsx-text

JavaScript
1
star
63

play-2.1.1-testing-samples

Samples for Testing Play 2.1.x applications. Result of Play user group talk in Berlin, 2013-04-15.
Scala
1
star