Skip to content

Commit

Permalink
Update nuget and dist
Browse files Browse the repository at this point in the history
  • Loading branch information
mwhouser committed Aug 27, 2015
1 parent ec07484 commit eb01a69
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 39 deletions.
44 changes: 26 additions & 18 deletions dist/conditional-visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// data-visibility-target="..." - ID of the control upon which this controls visibility depends
// data-visibility-action="show|hide" - Whether to show or hide, default is to show
// data-visibility-value="..." - Value upon which to show (or hide) the control
// data-visibility-value="..." - Comma-separated list of values upon which to show (or hide) the control

var ConditionalVisibility = ConditionalVisibility || {}

Expand All @@ -22,27 +22,35 @@ ConditionalVisibility.init = function() {

if (tagType == 'SELECT') {

var visibleValue = self.attr('data-visibility-value');
if (visibleValue == null) {
visibleValue = '';
var valueField = self.attr('data-visibility-value');
if (valueField == null) {
valueField = '';
}
var visibleValues = valueField.split(',');

// When the target changes
var callback = function () {
var value = target.val().toString();
if (value == visibleValue) {
if (action == 'show') {
self.show();
} else if (action == 'hide') {
self.hide();
}
} else {
if (action == 'show') {
self.hide();
} else if (action == 'hide') {
self.show();
}
}
var value = target.val().toString();
for (var i = 0; i < visibleValues.length; ++i) {
var visibleValue = visibleValues[i];
if (value == visibleValue) {
// A valid value was found.
if (action == 'show') {
self.show();
} else if (action == 'hide') {
self.hide();
}

return;
}
}

// IF we get here, then a valid value was not found
if (action == 'show') {
self.hide();
} else if (action == 'hide') {
self.show();
}
};

target.change(callback);
Expand Down
2 changes: 1 addition & 1 deletion dist/conditional-visibility.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nuget/conditional-visibility.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>conditional-visibility</id>
<version>1.1.0</version>
<version>1.2.0</version>
<authors>eleven41</authors>
<owners>eleven41</owners>
<projectUrl>https://github.com/eleven41/conditional-visibility</projectUrl>
Expand Down
44 changes: 26 additions & 18 deletions nuget/content/Scripts/conditional-visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// data-visibility-target="..." - ID of the control upon which this controls visibility depends
// data-visibility-action="show|hide" - Whether to show or hide, default is to show
// data-visibility-value="..." - Value upon which to show (or hide) the control
// data-visibility-value="..." - Comma-separated list of values upon which to show (or hide) the control

var ConditionalVisibility = ConditionalVisibility || {}

Expand All @@ -22,27 +22,35 @@ ConditionalVisibility.init = function() {

if (tagType == 'SELECT') {

var visibleValue = self.attr('data-visibility-value');
if (visibleValue == null) {
visibleValue = '';
var valueField = self.attr('data-visibility-value');
if (valueField == null) {
valueField = '';
}
var visibleValues = valueField.split(',');

// When the target changes
var callback = function () {
var value = target.val().toString();
if (value == visibleValue) {
if (action == 'show') {
self.show();
} else if (action == 'hide') {
self.hide();
}
} else {
if (action == 'show') {
self.hide();
} else if (action == 'hide') {
self.show();
}
}
var value = target.val().toString();
for (var i = 0; i < visibleValues.length; ++i) {
var visibleValue = visibleValues[i];
if (value == visibleValue) {
// A valid value was found.
if (action == 'show') {
self.show();
} else if (action == 'hide') {
self.hide();
}

return;
}
}

// IF we get here, then a valid value was not found
if (action == 'show') {
self.hide();
} else if (action == 'hide') {
self.show();
}
};

target.change(callback);
Expand Down
2 changes: 1 addition & 1 deletion nuget/content/Scripts/conditional-visibility.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eb01a69

Please sign in to comment.