Commit 614256b8 authored by Thibaut Frain's avatar Thibaut Frain Committed by Jérome Perrin

Refactored jsPlumb gadget (works with one instance of jsPlumb per gadget)

parent c7ccdf82
...@@ -66,7 +66,9 @@ module.exports = function (grunt) { ...@@ -66,7 +66,9 @@ module.exports = function (grunt) {
}, },
files: { files: {
"<%= global_config.dest %>/dream/index.css": "<%= global_config.dest %>/dream/index.css":
"<%= global_config.src %>/dream/index.less" "<%= global_config.src %>/dream/index.less",
"<%= global_config.dest %>/jsplumb/jsplumb.css":
"<%= global_config.src %>/jsplumb/jsplumb.css"
} }
} }
}, },
......
/*global window, rJS, RSVP, initDocumentPageMixin */ /*global console, rJS, RSVP, initDocumentPageMixin */
/*jslint nomen: true */
(function (window, rJS, RSVP, initDocumentPageMixin) { (function (window, rJS, RSVP, initDocumentPageMixin) {
"use strict"; "use strict";
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass gadget_klass
.ready(function (g) { .ready(function (g) {
g.props = {}; g.props = {};
}) })
.ready(function (g) { .ready(function (g) {
return g.getElement() return g.getElement()
.push(function (element) { .push(function (element) {
g.props.element = element; g.props.element = element;
}); });
}) })
.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment") .declareAcquiredMethod("aq_getAttachment", "jio_getAttachment")
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key; gadget.props.jio_key = jio_key;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
/*jslint nomen: true*/
return RSVP.all([ return RSVP.all([
gadget.aq_getAttachment({ gadget.aq_getAttachment({
_id: jio_key, _id: jio_key,
_attachment: "body.json" _attachment: "body.json"
}), }), gadget.getDeclaredGadget("productionline") ]);
gadget.getDeclaredGadget("productionline") })
]); .push(function (result_list) {
}).push(function (result_list) { console.log(result_list);
console.log(result_list[0]);
console.log(result_list[1]);
console.log(result_list.length);
window.r = result_list[1];
return result_list[1].render(result_list[0]); return result_list[1].render(result_list[0]);
}); });
}) })
.declareMethod("startService", function () { .declareMethod("startService", function () {
return this.getDeclaredGadget("productionline") return this.getDeclaredGadget("productionline")
.push(function (productionline) { .push(function (productionline) {
......
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<!--link rel="stylesheet" href="<%= curl.jqueryuicss.relative_dest %>"--> <link rel="stylesheet" href="../<%= curl.jqueryuicss.relative_dest %>">
<link rel="stylesheet" href="jsplumb.css">
<!--script src="curl.jquery.relative_dest %>"></script--> <script src="../<%= curl.jquery.relative_dest %>"></script>
<!--script src="curl.jqueryuijs.relative_dest %>"></script--> <script src="../<%= curl.jqueryuijs.relative_dest %>"></script>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script> <script src="../<%= copy.rsvp.relative_dest %>"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script> <script src="../<%= copy.renderjs.relative_dest %>"></script>
<script src="../<%= curl.jsplumbjs.relative_dest %>" type="text/javascript"></script> <script src="../<%= curl.jsplumbjs.relative_dest %>"></script>
<script src="jsplumb.js"></script> <script src="jsplumb.js"></script>
</head> </head>
......
/* /\* body { *\/ */
/* /\* padding:0; *\/ */
/* /\* margin:0; *\/ */
/* /\* background-color:white; *\/ */
/* /\* font-family:'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; *\/ */
/* /\* text-align:center; *\/ */
/* /\* } *\/ */
/* /\* #headerWrapper { *\/ */
/* /\* display:none; *\/ */
/* /\* width:100%; *\/ */
/* /\* background-color:black; *\/ */
/* /\* position:fixed; *\/ */
/* /\* top:0; *\/ */
/* /\* left:0; *\/ */
/* /\* height:44px; *\/ */
/* /\* padding:0; *\/ */
/* /\* border-bottom:1px solid #999; *\/ */
/* /\* box-shadow: 0px 2px 19px #aaa; *\/ */
/* /\* -o-box-shadow: 0px 2px 19px #aaa; *\/ */
/* /\* -webkit-box-shadow: 0px 2px 19px #aaa; *\/ */
/* /\* -moz-box-shadow: 0px 2px 19px #aaa; *\/ */
/* /\* opacity:0.8; *\/ */
/* /\* } *\/ */
/* #intro { */
/* margin-top:59px; */
/* } */
#main { #main {
/* these two margins settings are here just to ensure that jsPlumb handles /* these two margins settings are here just to ensure that jsPlumb handles
margins properly.*/ margins properly.*/
...@@ -42,102 +13,6 @@ ...@@ -42,102 +13,6 @@
text-align: center; text-align: center;
} }
/* /\* Setting for dialog *\/ */
/* label, input { */
/* display:block; */
/* } */
/* input.text, select { */
/* margin:4px; */
/* padding:0; */
/* width:95%; */
/* } */
/* fieldset { */
/* padding:0; */
/* border:0; */
/* margin-top:25px; */
/* } */
h1 {
font-size: 1.2em;
margin: .6em 0;
}
/* div#users-contain { */
/* width: 350px; */
/* margin: 20px 0; */
/* } */
/* div#users-contain table { */
/* margin: 1em 0; */
/* border-collapse: collapse; */
/* width: 100%; */
/* } */
/* div#users-contain table td, div#users-contain table th { */
/* border: 1px solid #eee; */
/* padding: .6em 10px; */
/* text-align: left; */
/* } */
/* .ui-dialog .ui-state-error { */
/* padding: .3em; */
/* } */
/* .validateTips { */
/* border: 1px solid transparent; */
/* padding: 0.3em; */
/* } */
/* /\* End of dialog setting *\/ */
/* #main li { */
/* margin: 3px; */
/* /\*padding: 1px;*\/ */
/* /\*text-align: -webkit-match-parent;*\/ */
/* background: #e6e6e6; */
/* border: 1px solid #d3d3d3; */
/* list-style-type: none; */
/* width: 120px; */
/* } */
/* #sidebar { */
/* font-size:13px; */
/* } */
/* /\* demo elements *\/ */
/* .menu, #explanation { */
/* background-color:#fff; */
/* } */
/* .menu { */
/* height: 15px; */
/* float:right; */
/* padding-top:1em; */
/* padding-bottom:0.4em; */
/* background-color: transparent; */
/* margin-right:30px; */
/* } */
/* .otherLibraries { */
/* display:inline; */
/* } */
/* a, a:visited { */
/* text-decoration:none; */
/* color:#01a3c6; */
/* font-family:helvetica; */
/* padding:0.3em; */
/* border-radius:0.2em; */
/* } */
/* a:hover { */
/* color:#1b911b; */
/* } */
.selected { .selected {
color:rgb(189, 11, 11) !important; color:rgb(189, 11, 11) !important;
} }
...@@ -197,88 +72,6 @@ path, ._jsPlumb_endpoint { ...@@ -197,88 +72,6 @@ path, ._jsPlumb_endpoint {
padding:0.5em; padding:0.5em;
} }
/* /\* DREAM specific css *\/ */
/* #available { */
/* position: absolute; */
/* width: 200px; */
/* height: 200px; */
/* border: 2px solid; */
/* margin-top: 350px; */
/* margin-left: 150px; */
/* border-radius: 10px; */
/* } */
/* #tools { */
/* /\* position: absolute; */
/* width: 200px; */
/* height: 400px; *\/ */
/* width: 100%; */
/* border: 1px solid #999; */
/* margin: 20px 0; */
/* border-radius: 10px; */
/* padding-bottom: 20px; */
/* } */
/* #tools-container { */
/* margin-bottom: 4px; */
/* } */
/* #simulation_controls { */
/* /\* position: absolute; */
/* width: 200px; */
/* height: 300px; */
/* margin-top: 550px; */
/* margin-left: 35px; */
/* font-size:13px; *\/ */
/* width: 100%; */
/* border: 1px solid #999; */
/* border-radius: 10px; */
/* } */
/* .tool { */
/* border: 1px solid lightgray; */
/* box-shadow: 1px 1px 2px #aaa; */
/* /\*margin-top: 20px; */
/* margin-left: 35px;*\/ */
/* min-width:7em; */
/* height:2em; */
/* z-index: 10001; */
/* color: gray; */
/* font-family:serif; */
/* font-style:italic; */
/* padding-top:0.9em; */
/* font-size:0.9em; */
/* margin:0.5em; */
/* display: inline-block; */
/* border-radius: 5px; */
/* } */
/* #graph { */
/* width: 70%; */
/* height: 250px; */
/* text-align: center; */
/* margin-left:auto; */
/* margin-right:auto; */
/* padding-top:2px; */
/* margin-top:0px; */
/* } */
/* #queue_stat_graph { */
/* width: 70%; */
/* height: 250px; */
/* text-align: center; */
/* margin-left:auto; */
/* margin-right:auto; */
/* padding-top:2px; */
/* margin-top:0px; */
/* } */
/* #tools .ui-button { */
/* width:80%; */
/* margin:4px 0; */
/* } */
.Dream-Source, .Dream-BatchSource { .Dream-Source, .Dream-BatchSource {
border: 1px solid #bbc; border: 1px solid #bbc;
background-color:#ffe; background-color:#ffe;
...@@ -321,14 +114,6 @@ path, ._jsPlumb_endpoint { ...@@ -321,14 +114,6 @@ path, ._jsPlumb_endpoint {
background-image: linear-gradient(to bottom, #fdd 0%, #dcc 100%); background-image: linear-gradient(to bottom, #fdd 0%, #dcc 100%);
} }
/* #exit_stat { */
/* display: inline-block; */
/* } */
/* #exit_stat table, #exit_stat td { */
/* border: 1px solid black; */
/* } */
.window, .dummy_window { .window, .dummy_window {
border:1px solid lightgray; border:1px solid lightgray;
width:100px; width:100px;
...@@ -360,14 +145,6 @@ path, ._jsPlumb_endpoint { ...@@ -360,14 +145,6 @@ path, ._jsPlumb_endpoint {
visibility: hidden; visibility: hidden;
} }
/* #debug_json textarea { */
/* width:95%; */
/* } */
/* #error{ */
/* text-align: left; */
/* } */
.ep { .ep {
position:absolute; position:absolute;
bottom:37%; bottom:37%;
...@@ -391,27 +168,3 @@ path, ._jsPlumb_endpoint { ...@@ -391,27 +168,3 @@ path, ._jsPlumb_endpoint {
path { path {
cursor:pointer; cursor:pointer;
} }
/* #spreadsheet_output { */
/* margin: 20px 0; */
/* } */
/* #gantt_output { */
/* height: 400px; */
/* margin: 20px 0; */
/* } */
/* .sub_task { */
/* background-color: #3DD388; */
/* border-color: #28B06C; */
/* } */
/* li.result { */
/* width: 100%; */
/* text-align: left; */
/* cursor:pointer; */
/* } */
/* li.result.active { */
/* background:#fcc; */
/* } */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment