Skip to content

Commit

Permalink
Filter Panl Fix for Issue #43 (IE html attribute with no quotes)
Browse files Browse the repository at this point in the history
- Split filter panel html into seperate html files
- updated version number in package and bower files
  • Loading branch information
purtuga committed Mar 5, 2015
1 parent a3cdedd commit 0e66aea
Show file tree
Hide file tree
Showing 12 changed files with 396 additions and 390 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SPWidgets",
"version": "2.5.0",
"version": "2.5.1",
"authors": ["Paul T."],
"description": "SharePoint widgets and tools for custom client side web solutions",
"license": "MIT",
Expand Down
540 changes: 294 additions & 246 deletions dist/jquery.SPWidgets.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/jquery.SPWidgets.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jquery.SPWidgets.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SPWidgets",
"version": "2.5.0",
"version": "2.5.1",
"description": "SharePoint widgets and tools for custom client side web solutions",
"main": "dist/jquery.SPWidgets.js",
"scripts": {
Expand Down
68 changes: 5 additions & 63 deletions src/filterPanelWidget/filterPanel.html
Original file line number Diff line number Diff line change
@@ -1,65 +1,7 @@
<div id="filter_main_ui">
<div class="spwidget-filter" style="display: none;">
<div class="spwidget-filter-column-cntr ui-widget-content"></div>
<div class="spwidget-filter-button-cntr">
<button type="button" class="spwidget-button ui-priority-secondary" name='reset'>Reset</button>
<button type="button" class="spwidget-button" name='filter'>Filter</button>
</div>
<div class="spwidget-filter" style="display: none;">
<div class="spwidget-filter-column-cntr ui-widget-content"></div>
<div class="spwidget-filter-button-cntr">
<button type="button" class="spwidget-button ui-priority-secondary" name='reset'>Reset</button>
<button type="button" class="spwidget-button" name='filter'>Filter</button>
</div>
</div>
<div id="filter_column">
<div class="spwidget-column spwidget-type-{{type}}"
data-spwidget_column_type="{{type}}"
data-spwidget_list="{{list}}"
data-spwidget_sp_type="{{sp_type}}"
data-spwidget_sp_format="{{sp_format}}" >
<div class="spwidget-filter-value-cntr">
<label>{{DisplayName}}</label>
<div class="spwidget-filter-value-input">
__COLUMN__UI__
</div>
</div>
<div class="spwidget-filter-type-cntr" title="Match Options">
<select name="{{Name}}_type" class="spwidget-filter-type" tabindex="-1">
<option value="Contains">Contains</option>
<option value="Eq" selected="selected">Equal</option>
<option value="Neq">Not Equal</option>
<option value="IsNull">Is Blank</option>
<option value="IsNotNull">Is Not Blank</option>
__OTHER_FILTER_TYPES__
</select>
<select name="{{Name}}_match" class="spwidget-match-type" tabindex="-1">
<option value="Or" selected="selected">Any</option>
<option value="And">All</option>
</select>
<select name="{{Name}}_order" class="spwidget-sort-order" tabindex="-1">
<option value="" selected="selected">Sort</option>
<option value="Asc">&#9650; Ascending</option>
<option value="Des">&#9660; Descending</option>
</select>
</div>
<div class="spwidget-column-actions">
<a style="display:none;" href="javascript:" tabindex="-1" data-action="remove" class="spwidget-column-action">
<span class="ui-icon ui-icon-circle-close">remove</span>
</a>
<div class="spwidget-column-sort-actions">
<a href="javascript:" tabindex="-1" data-action="up" class="spwidget-column-action" title="Move up">
<span class="ui-icon ui-icon-circle-arrow-n">Move Up</span>
</a>
<a href="javascript:" tabindex="-1" data-action="down" class="spwidget-column-action" title="Move down">
<span class="ui-icon ui-icon-circle-arrow-s">Move Down</span>
</a>
</div>
</div>
</div>
</div>
<div id="filter_text_field">
<input name="{{Name}}" title="{{DisplayName}}" type="text" value="" class="spwidget-input spwidget-filter-input" />
<span class="spwidget-tooltip">{{tooltip}}</span>
</div>
<div id="filter_choice_field">
<label>
<input name="{{Name}}" title="{{DisplayName}}" type="checkbox" value="{{value}}" class="spwidget-input spwidget-filter-input" />
{{value}}
</label>
</div>
74 changes: 25 additions & 49 deletions src/filterPanelWidget/filterPanel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
define([
'jquery',
'text!./filterPanel.html',
'text!./filterPanelColumn.html',
'text!./filterPanelChoiceField.html',
'text!./filterPanelTextField.html',
'../spapi/getSiteUrl',
'../spapi/getList',
'../sputils/parseLookupFieldValue',
Expand All @@ -17,6 +20,9 @@ define([
], function(
$,
filterPanelTemplate,
filterPanelColumnTemplate,
filterPanelChoiceFieldTemplate,
filterPanelTextFieldTemplate,
getSiteUrl,
getList,
parseLookupFieldValue,
Expand All @@ -34,12 +40,6 @@ define([
var Filter = {},
filterPanel;

/** @property {Boolean} Is initialization done */
Filter.isInitDone = false;

/** @property {jQuery} jQuery object with templates.*/
Filter.templates = null;

/**
* Default options.
*/
Expand Down Expand Up @@ -104,14 +104,6 @@ define([
var arg = Array.prototype.slice.call(arguments, 1),
$this = $(containers);

// If initialization is not yet done, then do it now
if ( !Filter.isInitDone ) {

Filter.isInitDone = true;
Filter.templates = $( filterPanelTemplate );

}

// If input was a string, then must be a method.
if (typeof options === "string") {

Expand Down Expand Up @@ -269,19 +261,12 @@ define([

var $list = this,
columns = '',
colUI = Filter.templates.filter("#filter_column").html();
colUI =$.trim(filterPanelColumnTemplate);

// Insert the UI into the page and set
// pointer ($ui) to it.
Inst.$ui = $(
Filter.templates
.filter("#filter_main_ui").html()
)
.appendTo(
Inst.$ele
.empty()
.addClass("hasSPFilterPanel")
);
Inst.$ui = $($.trim(filterPanelTemplate)).appendTo(
Inst.$ele.empty().addClass("hasSPFilterPanel") );

Inst.$uiFilterColumnCntr = Inst.$ui.find("div.spwidget-filter-column-cntr");
Inst.$uiFilterSortCntr = Inst.$ui.find("div.spwidget-filter-sort-cntr");
Expand Down Expand Up @@ -343,15 +328,13 @@ define([
$thisCol.find("CHOICES CHOICE").each(function(i,v){

inputUI += fillTemplate(
Filter.templates
.filter("#filter_choice_field")
.html(),
{
DisplayName: $thisCol.attr("DisplayName"),
Name: $thisCol.attr("Name"),
value: $(v).text()
}
);
$.trim(filterPanelChoiceFieldTemplate),
{
DisplayName: $thisCol.attr("DisplayName"),
Name: $thisCol.attr("Name"),
value: $(v).text()
}
);

});

Expand Down Expand Up @@ -478,24 +461,17 @@ define([
} //end: switch(): set the model.type only

// BUILD the input field for this.
inputUI = Filter.templates
.filter("#filter_text_field")
.html();

thisColUI = thisColUI
inputUI = $.trim(filterPanelTextFieldTemplate);
thisColUI = thisColUI
.replace(/__COLUMN__UI__/, inputUI)
.replace(/__OTHER_FILTER_TYPES__/, model.otherFilterTypes);

thisColUI = fillTemplate(
thisColUI,
$.extend(
model,
{
DisplayName: $thisCol.attr("DisplayName"),
Name: $thisCol.attr("Name"),
tooltip: Inst.opt.textFieldTooltip
})
);
thisColUI = fillTemplate(thisColUI,
$.extend(model, {
DisplayName: $thisCol.attr("DisplayName"),
Name: $thisCol.attr("Name"),
tooltip: Inst.opt.textFieldTooltip
})
);

break;

Expand Down
4 changes: 4 additions & 0 deletions src/filterPanelWidget/filterPanelChoiceField.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<label>
<input name="{{Name}}" title="{{DisplayName}}" type="checkbox"
value="{{value}}" class="spwidget-input spwidget-filter-input" /> {{value}}
</label>
44 changes: 44 additions & 0 deletions src/filterPanelWidget/filterPanelColumn.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div class="spwidget-column spwidget-type-{{type}}"
data-spwidget_column_type="{{type}}"
data-spwidget_list="{{list}}"
data-spwidget_sp_type="{{sp_type}}"
data-spwidget_sp_format="{{sp_format}}" >
<div class="spwidget-filter-value-cntr">
<label>{{DisplayName}}</label>
<div class="spwidget-filter-value-input">
__COLUMN__UI__
</div>
</div>
<div class="spwidget-filter-type-cntr" title="Match Options">
<select name="{{Name}}_type" class="spwidget-filter-type" tabindex="-1">
<option value="Contains">Contains</option>
<option value="Eq" selected="selected">Equal</option>
<option value="Neq">Not Equal</option>
<option value="IsNull">Is Blank</option>
<option value="IsNotNull">Is Not Blank</option>
__OTHER_FILTER_TYPES__
</select>
<select name="{{Name}}_match" class="spwidget-match-type" tabindex="-1">
<option value="Or" selected="selected">Any</option>
<option value="And">All</option>
</select>
<select name="{{Name}}_order" class="spwidget-sort-order" tabindex="-1">
<option value="" selected="selected">Sort</option>
<option value="Asc">&#9650; Ascending</option>
<option value="Des">&#9660; Descending</option>
</select>
</div>
<div class="spwidget-column-actions">
<a style="display:none;" href="javascript:" tabindex="-1" data-action="remove" class="spwidget-column-action">
<span class="ui-icon ui-icon-circle-close">remove</span>
</a>
<div class="spwidget-column-sort-actions">
<a href="javascript:" tabindex="-1" data-action="up" class="spwidget-column-action" title="Move up">
<span class="ui-icon ui-icon-circle-arrow-n">Move Up</span>
</a>
<a href="javascript:" tabindex="-1" data-action="down" class="spwidget-column-action" title="Move down">
<span class="ui-icon ui-icon-circle-arrow-s">Move Down</span>
</a>
</div>
</div>
</div>
4 changes: 4 additions & 0 deletions src/filterPanelWidget/filterPanelTextField.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<input name="{{Name}}" title="{{DisplayName}}" type="text" value="" class="spwidget-input spwidget-filter-input" />
<span class="spwidget-tooltip">{{tooltip}}</span>
</div>
14 changes: 12 additions & 2 deletions src/spapi/resolvePrincipals.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ define([
* @return {jQuery.Promise}
* The jquery .ajax() Promise is returned.
*
* Depends on:
* @example
*
* .getSiteUrl()
* SPAPI.resolvePrincipals({
* principalKeys: "domain\\userid"
* })
* .then(function(xmlDoc, status){
*
* var userSiteUID = $(xmlDoc)
* .find("AccountName:contains('domain\\userid')")
* .parent()
* .find("UserInfoID")
* .text();
* alert("User was Resolved. His ID is: " + userSisteID);
* });
*/
var resolvePrincipals = (function() {

Expand Down
22 changes: 0 additions & 22 deletions src/spapi/searchPrincipals.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,6 @@ define([
* Promise is resolved with two input params:
* XMLDocument : Response from Sharepoint
* status : the ajax status string (error or success)
*
* @example
*
* SPAPI.resolvePrincipals({
* principalKeys: "domain\\userid"
* })
* .then(function(xmlDoc, status){
*
* var userSiteUID = $(xmlDoc)
* .find("AccountName:contains('domain\\userid')")
* .parent()
* .find("UserInfoID")
* .text();
* alert("User was Resolved. His ID is: " + userSisteID);
* });
*
* Depends on:
*
* .getSiteUrl()
* .doesMsgHaveError()
* .cache()
*/
var searchPrincipals = (function(){

Expand Down

0 comments on commit 0e66aea

Please sign in to comment.