Skip to content

Commit

Permalink
fix: remove data- from fetch, pass and filter
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Jul 28, 2021
1 parent 50e1bbe commit 508a13f
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 72 deletions.
70 changes: 35 additions & 35 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,64 +13,64 @@
<div class="display:flex">
<button>
<a target="modal" href="https://server.cocreate.app/CoCreate-adminUI/module_datatable.html"
data-modal_ajax="false"
data-modal_width="520px"
data-modal_height="100%"
data-modal_color="#229954"
data-modal_header="false"
data-modal_x="0px"
data-modal_y="0px"
modal-ajax="false"
modal-width="520px"
modal-height="100%"
modal-color="#229954"
modal-header="false"
modal-x="0px"
modal-y="0px"
data-open_in="page">
Page-1
</a>
</button>

<button>
<a target="modal" href="test2.html"
data-modal_ajax="false"
data-modal_width="320px"
data-modal_height="100%"
data-modal_color="#229954"
data-modal_header="true"
data-modal_x="0px"
data-modal_y="0px"
modal-ajax="false"
modal-width="320px"
modal-height="100%"
modal-color="#229954"
modal-header="true"
modal-x="0px"
modal-y="0px"
data-open_in="page">Page-2</a>
</button>

<button>
<a target="modal" href="test.html"
data-modal_ajax="false"
data-modal_width="320px"
data-modal_height="100%"
data-modal_color="#229954"
data-modal_header="true"
modal-ajax="false"
modal-width="320px"
modal-height="100%"
modal-color="#229954"
modal-header="true"
data-open_in="parent"
data-modal_x="0px"
data-modal_y="0px">Parent</a>
modal-x="0px"
modal-y="0px">Parent</a>
</button>

<button>
<a target="modal" href="test.html"
data-modal_ajax="false"
data-modal_width="320px"
data-modal_height="100%"
data-modal_color="#229954"
data-modal_header="true"
modal-ajax="false"
modal-width="320px"
modal-height="100%"
modal-color="#229954"
modal-header="true"
data-open_in="root"
data-modal_x="0px"
data-modal_y="0px">Root</a>
modal-x="0px"
modal-y="0px">Root</a>
</button>

<button>
<a target="modal" href="test.html"
data-modal_ajax="false"
data-modal_width="320px"
data-modal_height="100%"
data-modal_color="#229954"
data-modal_header="false"
modal-ajax="false"
modal-width="320px"
modal-height="100%"
modal-color="#229954"
modal-header="false"
data-open_in="12345"
data-modal_x="0px"
data-modal_y="0px">PageID-12345</a>
modal-x="0px"
modal-y="0px">PageID-12345</a>
</button>
</div>

Expand Down
2 changes: 1 addition & 1 deletion demo/page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" collection="" document_id="" data-prefix="" data-pass_id="wnd">
<html lang="en" collection="" document_id="" data-prefix="" pass_id="wnd">
<head>
<title>Modal | CocreateJS</title>

Expand Down
32 changes: 16 additions & 16 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ <h2 class="padding:5px_0px">Usage</h2>
<code class="language-html">
&lt;button&gt;
&lt;a target="modal" href="https://server.cocreate.app/CoCreate-adminUI/module_datatable.html"
data-modal_ajax="false"
data-modal_width="520px"
data-modal_height="100%"
data-modal_color="#229954"
data-modal_header="false"
data-modal_x="0px"
data-modal_y="0px"
modal-ajax="false"
modal-width="520px"
modal-height="100%"
modal-color="#229954"
modal-header="false"
modal-x="0px"
modal-y="0px"
data-open_in="page"&gt;
Show Modal On Page
&lt;/a&gt;
Expand All @@ -95,31 +95,31 @@ <h4><span>href</span> <span class="cocreate-badge success">string</span> <span c
<p>Href attribute indicates html file to set in modal.</p>
</li>
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
<h4><span>data-modal_ajax</span> <span class="cocreate-badge success">boolean</span> <span class="cocreate-badge warning">optional</span></h4>
<h4><span>modal-ajax</span> <span class="cocreate-badge success">boolean</span> <span class="cocreate-badge warning">optional</span></h4>
<p>Attribute whether to use ajax or not.</p>
</li>
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
<h4><span>data-modal_width</span> <span class="cocreate-badge success">string</span> <span class="cocreate-badge warning">optional</span></h4>
<h4><span>modal-width</span> <span class="cocreate-badge success">string</span> <span class="cocreate-badge warning">optional</span></h4>
<p>Width of modal. Unit can be pixel or percent.</p>
</li>
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
<h4><span>data-modal_height</span> <span class="cocreate-badge success">string</span> <span class="cocreate-badge warning">optional</span></h4>
<h4><span>modal-height</span> <span class="cocreate-badge success">string</span> <span class="cocreate-badge warning">optional</span></h4>
<p>Height of modal. Unit can be pixel or percent.</p>
</li>
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
<h4><span>data-modal_color</span> <span class="cocreate-badge success">color</span> <span class="cocreate-badge warning">optional</span></h4>
<h4><span>modal-color</span> <span class="cocreate-badge success">color</span> <span class="cocreate-badge warning">optional</span></h4>
<p>Color of modal border.</p>
</li>
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
<h4><span>data-modal_header</span> <span class="cocreate-badge success">boolean</span> <span class="cocreate-badge warning">optional</span></h4>
<h4><span>modal-header</span> <span class="cocreate-badge success">boolean</span> <span class="cocreate-badge warning">optional</span></h4>
<p>Attribute whether to show header or not.</p>
</li>
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
<h4><span>data-modal_x</span> <span class="cocreate-badge success">string</span> <span class="cocreate-badge warning">optional</span></h4>
<h4><span>modal-x</span> <span class="cocreate-badge success">string</span> <span class="cocreate-badge warning">optional</span></h4>
<p>Position X of modal.</p>
</li>
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
<h4><span>data-modal_y</span> <span class="cocreate-badge success">string</span> <span class="cocreate-badge warning">optional</span></h4>
<h4><span>modal-y</span> <span class="cocreate-badge success">string</span> <span class="cocreate-badge warning">optional</span></h4>
<p>Position Y of modal.</p>
</li>
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
Expand All @@ -143,8 +143,8 @@ <h2 class="padding:5px_0px">Demo</h2>
<a class="margin-right:10px" id="preview" data-show="preview" data-hide="code"><i class="far fa-eye"></i></a>
<a class="margin-right:10px hidden" id="code" data-show="code" data-hide="preview"><i class="fas fa-code"></i></a>
<!--<a class="margin-right:10px"><i class="far fa-window-maximize"></i></a>-->
<a target="modal" href="module_activity_datatable.html" data-pass_collection="modules" data-pass_document_id="" data-pass_fetch_value="" data-pass_prefix="" data-pass_to="render" data-modal_width="600px" data-modal_height="400px" data-modal_color="#229954"
data-modal_header="false" class="margin-right:10px">
<a target="modal" href="module_activity_datatable.html" pass-collection="modules" pass-document_id="" pass-fetch_value="" pass-prefix="" pass_to="render" modal-width="600px" modal-height="400px" modal-color="#229954"
modal-header="false" class="margin-right:10px">
<i class="fas fa-external-link-alt"></i>
</a>
<a class="margin-right:5px" data-fullscreen target="#playground-1"><i class="fas fa-expand"></i></a>
Expand Down
16 changes: 8 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ CoCreateWindow.prototype = {

var attr = {
url: aTag.href,
x: aTag.getAttribute('data-modal_x'),
y: aTag.getAttribute('data-modal_y'),
width: aTag.getAttribute('data-modal_width'),
height: aTag.getAttribute('data-modal_height'),
ajax: aTag.getAttribute('data-modal_ajax'),
color: aTag.getAttribute('data-modal_color'),
header: aTag.getAttribute('data-modal_header'),
x: aTag.getAttribute('modal-x'),
y: aTag.getAttribute('modal-y'),
width: aTag.getAttribute('modal-width'),
height: aTag.getAttribute('modal-height'),
ajax: aTag.getAttribute('modal-ajax'),
color: aTag.getAttribute('modal-color'),
header: aTag.getAttribute('modal-header'),

attributes: utils.getAttributes(aTag)
}

var open_type = aTag.getAttribute('data-modal_open');
var open_type = aTag.getAttribute('modal-open');
open_type = open_type ? open_type : 'root';

ModalStorage.rootPageId = this.rootId;
Expand Down
24 changes: 12 additions & 12 deletions src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ Modal.prototype = {
_init : function() {
var opt = this.options;

this.isAjax = opt.ajax ? opt.ajax : this.el.getAttribute("data-modal_ajax")
this.isAjax = opt.ajax ? opt.ajax : this.el.getAttribute("modal-ajax")
var windowURL = opt.url ? opt.url : this.el.getAttribute("href");
var width = opt.width ? opt.width : this.el.getAttribute("data-modal_width");
var height = opt.height? opt.height : this.el.getAttribute("data-modal_height");
var color = opt.color ? opt.color : this.el.getAttribute("data-modal_color");
var x = opt.x ? opt.x : this.el.getAttribute("data-modal_x")
var y = opt.y ? opt.y : this.el.getAttribute("data-modal_y")
var showHeader= opt.header? opt.header : this.el.getAttribute("data-modal_header")
var width = opt.width ? opt.width : this.el.getAttribute("modal-width");
var height = opt.height? opt.height : this.el.getAttribute("modal-height");
var color = opt.color ? opt.color : this.el.getAttribute("modal-color");
var x = opt.x ? opt.x : this.el.getAttribute("modal-x")
var y = opt.y ? opt.y : this.el.getAttribute("modal-y")
var showHeader= opt.header? opt.header : this.el.getAttribute("modal-header")

var attributes = opt.attributes;

Expand Down Expand Up @@ -143,15 +143,15 @@ Modal.prototype = {
iframe = this.__createContainer(this.headerArea);
iframe.src = windowURL;
} else if (attributes) {
iframe = this.__createContainer(this.headerArea, attributes['data-modal_iframe'] === "false" ? "div" : "iframe");
if (attributes['data-pass_to']) {
iframe.setAttribute('data-pass_id', attributes['data-pass_to']);
iframe = this.__createContainer(this.headerArea, attributes['modal-iframe'] === "false" ? "div" : "iframe");
if (attributes['pass_to']) {
iframe.setAttribute('pass_id', attributes['pass_to']);
iframe.setAttribute('collection', "");
iframe.setAttribute('document_id', "");
// iframe.setAttribute('data-request_id', uuid.generate());
}
if (attributes['data-pass_name']) {
iframe.setAttribute('name', attributes['data-pass_name']);
if (attributes['pass-name']) {
iframe.setAttribute('name', attributes['pass-name']);
}
} else {
return;
Expand Down

0 comments on commit 508a13f

Please sign in to comment.