Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Release02x01'
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Dec 12, 2016
2 parents 20c3228 + a962f56 commit 7edb449
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 39 deletions.
14 changes: 2 additions & 12 deletions JQueryPlugin/data/System/JQueryUIDialog.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1456220586" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1481544450" format="1.1" version="1"}%
%META:TOPICPARENT{name="JQueryPlugin"}%
---+!! %TOPIC%

Expand Down Expand Up @@ -71,14 +71,6 @@ To load a dialog asynchronously use a fully quallified hyperref as in
</verbatim>

This will fetch the content of the dialog from the given url and add it to the page before opening it.
Once the dialog has been loaded it will be cached as part of the current page unless the =cache= option
to the =jqUIDialogLink= has been disabled:

<verbatim class="tml">
<a href="http://...." class="jqUIDialogLink {cache:false}">Open Dialog</a>
</verbatim>

In this case the dialog will alwas be fetched again from the backend using the given url.

---++ Button Click Actions
When the button is clicked:
Expand Down Expand Up @@ -164,9 +156,7 @@ $("#mydialog").bind("dialogclose", function() {

<a href="%SCRIPTURL{"view"}%/%WEB%/%TOPIC%?skin=text&section=dialog" class="jqUIDialogLink">Open Dialog</a>

<a href="%SCRIPTURL{"view"}%/%WEB%/%TOPIC%?skin=text&section=dialog" class="jqUIDialogLink {cache:false}">Open Dialog (no cache)</a>

<verbatim class="foswikiHidden">
<verbatim class="tml">
%STARTSECTION{"dialog"}%
<div title="From Ajax call" class="jqUIDialog { modal:true, resizable:true, draggable:true, height:300, width:600}">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
Expand Down
@@ -1,19 +1,17 @@
// initializer for the ui-dialog plugin
"use strict";
jQuery(function($) {
'use strict';

var dialogDefaults = {
width: 300,
cached:false,
autoOpen:false,
draggable:false,
resizable:false,
closeOnEscape:false,
show:'fade'
},

dialogLinkDefaults = {
cache: true
show:'fade',
close: function() {
$(this).dialog("destroy").remove();
}
};

// dialog
Expand All @@ -22,13 +20,6 @@ jQuery(function($) {
opts = $.extend({}, dialogDefaults, $this.data(), $this.metadata()),
buttons = [];

if (!opts.cached) {
opts.close = function() {
$this.dialog("destroy");
$this.remove();
}
}

$this.find(".jqUIDialogButton").each(function() {
var $button = $(this),
button = {},
Expand Down Expand Up @@ -109,25 +100,14 @@ jQuery(function($) {
$(document).on("click", ".jqUIDialogLink", function() {
var $this = $(this),
href = $this.attr("href"),
opts = $.extend({}, dialogLinkDefaults, $this.data(), $this.metadata());
opts = $.extend({}, $this.data(), $this.metadata());

if (href.match(/^(https?:)|\//)) {
// this is a link to remote data
$.ajax({
url: href,
success: function(content) {
var $content = $(content),
id = $content.attr('id');
if (!id) {
id = 'dialog-'+foswiki.getUniqueID();
$content.attr('id', id);
}
if (opts.cache) {
$this.attr("href", "#"+id);
$content.data("cached", true);
} else {
$content.data("cached", false);
}
var $content = $(content);
$content.hide();
$("body").append($content);
$content.data("autoOpen", true);
Expand Down

0 comments on commit 7edb449

Please sign in to comment.