Skip to content

Commit

Permalink
gallery-2013.12.20-18-06 ItsAsbreuk gallery-itsaviewmodelpanel
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Kashida committed Dec 20, 2013
1 parent a7b4bdd commit 263dd95
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 41 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ ITSAViewModelPanel.prototype.bindUI = function() {
if (model.toJSONUI) {
ITSAFORMELEMENT.tipsyOK._lastnode && model._FORM_elements[ITSAFORMELEMENT.tipsyOK._lastnode.get(ID)] && ITSAFORMELEMENT.tipsyOK.hideTooltip();
ITSAFORMELEMENT.tipsyInvalid._lastnode && model._FORM_elements[ITSAFORMELEMENT.tipsyInvalid._lastnode.get(ID)] && ITSAFORMELEMENT.tipsyInvalid.hideTooltip();
ITSAFORMELEMENT.tipsyOK._lastnode = null;
ITSAFORMELEMENT.tipsyInvalid._lastnode = null;
}
}
/*jshint expr:false */
Expand Down Expand Up @@ -580,6 +582,7 @@ ITSAViewModelPanel.prototype.bindUI = function() {
// first enable the UI again, this is done within the submit-defaultfunc of the model as well, but that code comes LATER.
// and we need enabled element to set the focus
model.enableUI();
model._disableSaveBtns();
if (contentBox.hasClass(FOCUSED_CLASS)) {
itsatabkeymanager.focusInitialItem();
}
Expand Down Expand Up @@ -656,13 +659,17 @@ ITSAViewModelPanel.prototype.bindUI = function() {
var node = e.target,
value = node.get(VALUE),
panelCloseButton = node.hasClass(ITSA_PANELCLOSEBTN); // this node must not fire the event, because it already is done by ITSAPanel
/*jshint expr:true */
// value===CLOSE will be handled by the '*:'+CLOSE_CLICK eventlistener
!panelCloseButton && instance.get('hideOnBtn') && (value!==CLOSE) &&
(!instance.get(NO_HIDE_ON_RESET) || (value!==RESET)) && (!instance.get(NO_HIDE_ON_LOAD) || (value!==LOAD)) &&
(!instance.get(NO_HIDE_ON_SUBMIT) || (value!==SUBMIT)) && (!instance.get(NO_HIDE_ON_SAVE) || (value!==SAVE)) &&
instance.fire(BUTTON_HIDE_EVENT, {buttonNode: node});
if (!panelCloseButton && instance.get('hideOnBtn') && (value!==CLOSE) &&
(!instance.get(NO_HIDE_ON_RESET) || (value!==RESET)) && (!instance.get(NO_HIDE_ON_LOAD) || (value!==LOAD)) &&
(!instance.get(NO_HIDE_ON_SUBMIT) || (value!==SUBMIT)) && (!instance.get(NO_HIDE_ON_SAVE) || (value!==SAVE))) {
instance.fire(BUTTON_HIDE_EVENT, {buttonNode: node});
}
else {
/*jshint expr:true */
(value===SAVE) && instance.get(MODEL)._disableSaveBtns();
/*jshint expr:false */
}
},
BUTTON
)
Expand Down Expand Up @@ -1282,7 +1289,7 @@ ITSAViewModelPanel.prototype._setSpin = function(buttonType, spin) {
buttonicons.toggleClass('itsa-busy', spin);
};

}, '@VERSION@', {
}, 'gallery-2013.12.20-18-06', {
"requires": [
"node-pluginhost",
"yui-base",
Expand Down

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions build/gallery-itsaviewmodelpanel/gallery-itsaviewmodelpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ ITSAViewModelPanel.prototype.bindUI = function() {
if (model.toJSONUI) {
ITSAFORMELEMENT.tipsyOK._lastnode && model._FORM_elements[ITSAFORMELEMENT.tipsyOK._lastnode.get(ID)] && ITSAFORMELEMENT.tipsyOK.hideTooltip();
ITSAFORMELEMENT.tipsyInvalid._lastnode && model._FORM_elements[ITSAFORMELEMENT.tipsyInvalid._lastnode.get(ID)] && ITSAFORMELEMENT.tipsyInvalid.hideTooltip();
ITSAFORMELEMENT.tipsyOK._lastnode = null;
ITSAFORMELEMENT.tipsyInvalid._lastnode = null;
}
}
/*jshint expr:false */
Expand Down Expand Up @@ -568,6 +570,7 @@ ITSAViewModelPanel.prototype.bindUI = function() {
// first enable the UI again, this is done within the submit-defaultfunc of the model as well, but that code comes LATER.
// and we need enabled element to set the focus
model.enableUI();
model._disableSaveBtns();
if (contentBox.hasClass(FOCUSED_CLASS)) {
itsatabkeymanager.focusInitialItem();
}
Expand Down Expand Up @@ -641,13 +644,17 @@ ITSAViewModelPanel.prototype.bindUI = function() {
var node = e.target,
value = node.get(VALUE),
panelCloseButton = node.hasClass(ITSA_PANELCLOSEBTN); // this node must not fire the event, because it already is done by ITSAPanel
/*jshint expr:true */
// value===CLOSE will be handled by the '*:'+CLOSE_CLICK eventlistener
!panelCloseButton && instance.get('hideOnBtn') && (value!==CLOSE) &&
(!instance.get(NO_HIDE_ON_RESET) || (value!==RESET)) && (!instance.get(NO_HIDE_ON_LOAD) || (value!==LOAD)) &&
(!instance.get(NO_HIDE_ON_SUBMIT) || (value!==SUBMIT)) && (!instance.get(NO_HIDE_ON_SAVE) || (value!==SAVE)) &&
instance.fire(BUTTON_HIDE_EVENT, {buttonNode: node});
if (!panelCloseButton && instance.get('hideOnBtn') && (value!==CLOSE) &&
(!instance.get(NO_HIDE_ON_RESET) || (value!==RESET)) && (!instance.get(NO_HIDE_ON_LOAD) || (value!==LOAD)) &&
(!instance.get(NO_HIDE_ON_SUBMIT) || (value!==SUBMIT)) && (!instance.get(NO_HIDE_ON_SAVE) || (value!==SAVE))) {
instance.fire(BUTTON_HIDE_EVENT, {buttonNode: node});
}
else {
/*jshint expr:true */
(value===SAVE) && instance.get(MODEL)._disableSaveBtns();
/*jshint expr:false */
}
},
BUTTON
)
Expand Down Expand Up @@ -1248,7 +1255,7 @@ ITSAViewModelPanel.prototype._setSpin = function(buttonType, spin) {
buttonicons.toggleClass('itsa-busy', spin);
};

}, '@VERSION@', {
}, 'gallery-2013.12.20-18-06', {
"requires": [
"node-pluginhost",
"yui-base",
Expand Down
7 changes: 7 additions & 0 deletions src/gallery-itsaviewmodelpanel/docs/advanced-form.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
</p>
</div>

<style type="text/css">
{{>advanced-form-css}}
</style>

<h2>Code</h2>
```
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.2.1/pure-min.css">
<style type="text/css">
{{>advanced-form-css}}
</style>

<script>
{{>advanced-form-js}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#partnerdata {
overflow: hidden;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
YUI(yuiconfig).use('node-base', 'gallery-itsaformmodel', 'gallery-itsaviewmodelpanel', 'gallery-itsacheckbox', 'transition', function(Y) {
YUI(yuiconfig).use('node-base', 'gallery-itsaformmodel', 'gallery-itsaviewmodelpanel',
'gallery-itsacheckbox', 'editor', 'transition', function(Y) {
var panel, user, template, spinnericon, firsterror = true;
// adding skin sam to body for getting the right skin for the widgets
Expand All @@ -12,7 +13,8 @@ YUI(yuiconfig).use('node-base', 'gallery-itsaformmodel', 'gallery-itsaviewmodelp
case 'submit':
Y.later(300000, null, function() {
// normally you need to invest the response on the server, but now we do this here:
var loginok = ((instance.get('username')==='marco') && (instance.get('password')==='panel'));
var loginok = ((instance.get('username')==='marco') &&
(instance.get('password')==='panel'));
if (loginok) {
callback();
}
Expand Down Expand Up @@ -52,6 +54,12 @@ YUI(yuiconfig).use('node-base', 'gallery-itsaformmodel', 'gallery-itsaviewmodelp
},
validationerror: 'Enter a valid name'
},
notes: {
formtype: Y.EditorBase,
formconfig: {
label: 'Notes'
}
},
maried: {
value: false,
formtype: Y.ITSACheckbox,
Expand Down Expand Up @@ -98,20 +106,22 @@ YUI(yuiconfig).use('node-base', 'gallery-itsaformmodel', 'gallery-itsaviewmodelp
// We also could left this false and listen to panel.after('*:uichanged')
user.setLifeUpdate(true);

template = '<legend>User</legend>'+
'<fieldset>'+
'<div class="pure-control-group"><%== data.firstname %></div>'+
'<div class="pure-control-group"><%== data.lastname %></div>'+
'<div class="pure-control-group"><%== data.maried %></div>'+
'</fieldset>'+
'<div id="partnerdata"<% if (data._maried===false) { %>style="display: none; height: 0;"<% } %>>'+
'<legend>Partner</legend>'+
'<fieldset>'+
'<div class="pure-control-group"><%== data.firstnamePartner %></div>'+
'<div class="pure-control-group"><%== data.lastnamePartner %></div>'+
'<div class="pure-control-group"><%== data.weddingdate %></div>'+
'</fieldset>'+
'</div>';
template =
'<legend>User</legend>'+
'<fieldset>'+
'<div class="pure-control-group"><%== data.firstname %></div>'+
'<div class="pure-control-group"><%== data.lastname %></div>'+
'<div class="pure-control-group"><%== data.notes %></div>'+
'<div class="pure-control-group"><%== data.maried %></div>'+
'</fieldset>'+
'<div id="partnerdata"<% if (data._maried===false) { %>style="display: none; height: 0;"<% } %>>'+
'<legend>Partner</legend>'+
'<fieldset>'+
'<div class="pure-control-group"><%== data.firstnamePartner %></div>'+
'<div class="pure-control-group"><%== data.lastnamePartner %></div>'+
'<div class="pure-control-group"><%== data.weddingdate %></div>'+
'</fieldset>'+
'</div>';

panel = new Y.ITSAViewModelPanel({
model: user,
Expand All @@ -126,7 +136,8 @@ YUI(yuiconfig).use('node-base', 'gallery-itsaformmodel', 'gallery-itsaviewmodelp

user.after('mariedChange', function(e) {
var partnerdata = panel.get('contentBox').one('#partnerdata');
e.newVal ? partnerdata.show('ease-in', {height: '145px', duration: 0.5}) : partnerdata.hide('ease-out', {height: 0, duration: 0.5});
e.newVal ? partnerdata.show('ease-in', {height: '145px', duration: 0.5}) :
partnerdata.hide('ease-out', {height: 0, duration: 0.5});
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var itsagallerydir = (itsagalleryversion ? itsagalleryversion+'/' : ''),
comboBase: loaderdomain+'/combo?',
root : 'yui3/'+yui3version+'/build/',
combine : combine,
filter : filter,
filter : 'raw',
// filter : 'debug',
coverage : coverage,
groups : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ YUI(yuiconfig).use('gallery-itsaformmodel', 'gallery-itsaviewmodelpanel', 'slide
// when 'syncPromise' is defined, Y.ITSAFormModel will use this method instead of 'sync'
syncPromise: function (action, options) {
if (action==='submit') {
return Y.io.post('http://mydomain.com/senddata.php?model='+Y.JSON.stringify(this.toJSON()));
// The code should look like this:
//
// return Y.io.post('http://mydomain.com/senddata.php', {data: this.toJSON()});
//
// But now we simulate through a timeout:
return new Y.Promise(function (resolve, reject) {
Y.later(1000, null, resolve);
});
}
// do not forget to reject the promise in case an invalid 'action' is defined
return new Y.Promise(function (resolve, reject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="intro">
<p>
{{description}} Because the submission is done to an unexisting url, this example will throw an error.
{{description}} Submission is simulated by timeout. Look at the commented code to find out how the setup reaally should be..
</p>
</div>

Expand Down
17 changes: 12 additions & 5 deletions src/gallery-itsaviewmodelpanel/js/gallery-itsaviewmodelpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ ITSAViewModelPanel.prototype.bindUI = function() {
if (model.toJSONUI) {
ITSAFORMELEMENT.tipsyOK._lastnode && model._FORM_elements[ITSAFORMELEMENT.tipsyOK._lastnode.get(ID)] && ITSAFORMELEMENT.tipsyOK.hideTooltip();
ITSAFORMELEMENT.tipsyInvalid._lastnode && model._FORM_elements[ITSAFORMELEMENT.tipsyInvalid._lastnode.get(ID)] && ITSAFORMELEMENT.tipsyInvalid.hideTooltip();
ITSAFORMELEMENT.tipsyOK._lastnode = null;
ITSAFORMELEMENT.tipsyInvalid._lastnode = null;
}
}
/*jshint expr:false */
Expand Down Expand Up @@ -578,6 +580,7 @@ ITSAViewModelPanel.prototype.bindUI = function() {
// first enable the UI again, this is done within the submit-defaultfunc of the model as well, but that code comes LATER.
// and we need enabled element to set the focus
model.enableUI();
model._disableSaveBtns();
if (contentBox.hasClass(FOCUSED_CLASS)) {
itsatabkeymanager.focusInitialItem();
}
Expand Down Expand Up @@ -654,13 +657,17 @@ ITSAViewModelPanel.prototype.bindUI = function() {
var node = e.target,
value = node.get(VALUE),
panelCloseButton = node.hasClass(ITSA_PANELCLOSEBTN); // this node must not fire the event, because it already is done by ITSAPanel
/*jshint expr:true */
// value===CLOSE will be handled by the '*:'+CLOSE_CLICK eventlistener
!panelCloseButton && instance.get('hideOnBtn') && (value!==CLOSE) &&
(!instance.get(NO_HIDE_ON_RESET) || (value!==RESET)) && (!instance.get(NO_HIDE_ON_LOAD) || (value!==LOAD)) &&
(!instance.get(NO_HIDE_ON_SUBMIT) || (value!==SUBMIT)) && (!instance.get(NO_HIDE_ON_SAVE) || (value!==SAVE)) &&
instance.fire(BUTTON_HIDE_EVENT, {buttonNode: node});
if (!panelCloseButton && instance.get('hideOnBtn') && (value!==CLOSE) &&
(!instance.get(NO_HIDE_ON_RESET) || (value!==RESET)) && (!instance.get(NO_HIDE_ON_LOAD) || (value!==LOAD)) &&
(!instance.get(NO_HIDE_ON_SUBMIT) || (value!==SUBMIT)) && (!instance.get(NO_HIDE_ON_SAVE) || (value!==SAVE))) {
instance.fire(BUTTON_HIDE_EVENT, {buttonNode: node});
}
else {
/*jshint expr:true */
(value===SAVE) && instance.get(MODEL)._disableSaveBtns();
/*jshint expr:false */
}
},
BUTTON
)
Expand Down
1 change: 1 addition & 0 deletions src/gallery-itsaviewmodelpanel/logs/yogi.stderr.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please install the phantomjs binary in your path!
30 changes: 30 additions & 0 deletions src/gallery-itsaviewmodelpanel/logs/yogi.stdout.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
yogi [info] using yogi@0.1.11 on node@0.10.23
yogi [info] using module: gallery-itsaviewmodelpanel
yogi [info] running with shifter
shifter [info] racing to find the closest .shifter.json file
shifter [info] revving up
shifter [info] looking for build.json file
shifter [info] found build.json file, shifting
shifter [info] putting the hammer down, let's build this thing!
shifter [info] munging in loader meta data into build.json
shifter [info] putting the hammer down
shifter [info] shifting into gear for gallery-itsaviewmodelpanel
shifter [queu] file has changed, continuing build
shifter [queu] writing RAW file
shifter [queu] compressing gallery-itsaviewmodelpanel/gallery-itsaviewmodelpanel.js with UglifyJS
shifter [queu] writing -min file
shifter [info] shifting for coverage
shifter [queu] coverage file read, starting coverage for: gallery-itsaviewmodelpanel/gallery-itsaviewmodelpanel.js
shifter [info] istanbul providing coverage
shifter [queu] instrumenting with istanbul
shifter [queu] writing coverage file to gallery-itsaviewmodelpanel/gallery-itsaviewmodelpanel-coverage.js
shifter [info] done racing, the gears are toast
shifter [info] finished in 0.288 seconds, pretty fast huh?
yogi [info] build complete
yogi [info] testing module now
yogi [info] prepping grover tests
yogi [info] adding tests route
yogi [info] launching xdr server on port 5001
yogi [info] listening on: http://127.0.0.1:5000
yogi [info] turning on coverage support in grover
yogi [bail] grover returned a failure

0 comments on commit 263dd95

Please sign in to comment.