Skip to content

Commit

Permalink
Merge pull request #4 from Lombiq/issue/COLI-234
Browse files Browse the repository at this point in the history
COLI-234: Patient and Caregiver Advanced Search
  • Loading branch information
BenedekFarkas authored Oct 26, 2020
2 parents e212701 + 8ec2c2d commit 3b92b90
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Scripts/lombiq-checkboxlisteditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
},

val: function () {
return $(this.settings.checkboxInputElementClass).filter(":checked:not(:disabled)").map(function () {
return $(this.element).find(this.settings.checkboxInputElementClass).filter(":checked:not(:disabled)").map(function () {
return $(this).val();
}).toArray();
}
Expand Down
6 changes: 6 additions & 0 deletions Scripts/lombiq-connectedelementvisibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
else if (Array.isArray(plugin.settings.valueHide) && plugin.settings.valueHide.includes(value)) {
show = false;
}
else if (Array.isArray(plugin.settings.valueShow) && Array.isArray(value) && plugin.settings.valueShow.some(item => value.includes(item))) {
show = true;
}
else if (Array.isArray(plugin.settings.valueHide) && Array.isArray(value) && plugin.settings.valueHide.some(item => value.includes(item))) {
show = false;
}
else if (typeof value === "number") {
if (number === 0) {
show = false;
Expand Down
20 changes: 9 additions & 11 deletions Scripts/lombiq-replaceelementattribute.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
; (function ($, window, document, undefined) {
$(function () {
$.fn.extend({
replaceElementAttribute: function (selector, attribute, newAttribute) {
$(selector).find("[" + attribute + "]").each(function () {
var $element = $(this);
var attributeValue = $element.attr(attribute);
$element.removeAttr(attribute);
$element.attr(newAttribute, attributeValue);
});
}
});
$.fn.extend({
replaceElementAttribute: function (selector, attribute, newAttribute) {
$(selector).find("[" + attribute + "]").each(function () {
var $element = $(this);
var attributeValue = $element.attr(attribute);
$element.removeAttr(attribute);
$element.attr(newAttribute, attributeValue);
});
}
});
})(jQuery, window, document);
12 changes: 9 additions & 3 deletions ViewModels/CheckboxListEditorViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Piedone.HelpfulExtensions;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
Expand Down Expand Up @@ -27,11 +28,13 @@ public class CheckboxListEditorViewModel : FieldViewModel, IElementValueFilterRe

#endregion

public CheckboxListEditorViewModel(string technicalName, IEnumerable<string> values)
: this(new NameValueCollection(), technicalName, values) { }

public CheckboxListEditorViewModel(
NameValueCollection queryString, string technicalName, IEnumerable<string> values)
{
var checkedItems = queryString.GetValues(technicalName);
var checkedItems = queryString.GetQueryStringParameterValues(technicalName) ?? Enumerable.Empty<string>();

foreach (var value in values)
Items.Add(new CheckboxListFieldItemViewModel
Expand All @@ -43,10 +46,13 @@ public CheckboxListEditorViewModel(
TechnicalName = technicalName;
}

public CheckboxListEditorViewModel(string technicalName, IEnumerable<KeyValuePair<string, string>> valueLabelDictionary)
: this(new NameValueCollection(), technicalName, valueLabelDictionary) { }

public CheckboxListEditorViewModel(
NameValueCollection queryString, string technicalName, IEnumerable<KeyValuePair<string, string>> valueLabelDictionary)
{
var checkedItems = queryString.GetValues(technicalName);
var checkedItems = queryString.GetQueryStringParameterValues(technicalName) ?? Enumerable.Empty<string>();

foreach (var valueLabelItem in valueLabelDictionary)
Items.Add(new CheckboxListFieldItemViewModel
Expand Down
3 changes: 3 additions & 0 deletions ViewModels/DropdownEditorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public DropdownEditorViewModel(IEnumerable<string> values, params string[] selec
});
}

public DropdownEditorViewModel(string technicalName, IEnumerable<string> values)
: this(new NameValueCollection(), technicalName, values) { }

public DropdownEditorViewModel(NameValueCollection queryString, string technicalName, IEnumerable<string> values)
{
var selectedValues = queryString.GetQueryStringParameterValues(technicalName) ?? Enumerable.Empty<string>();
Expand Down

0 comments on commit 3b92b90

Please sign in to comment.