removes unneeded contentpicker dialog and just uses the standard tree picker that has the correct search built in, now search is working for the link picker.

This commit is contained in:
Shannon
2014-10-09 00:04:25 +11:00
parent 5c5a0e6140
commit 18efe25167
6 changed files with 13 additions and 156 deletions

View File

@@ -368,10 +368,12 @@ angular.module('umbraco.services')
* @param {Function} options.callback callback function
* @returns {Object} modal object
*/
contentPicker: function (options) {
options.template = 'views/common/dialogs/contentPicker.html';
options.show = true;
return openDialog(options);
contentPicker: function (options) {
options.treeAlias = "content";
options.section = "content";
return this.treePicker(options);
},
/**

View File

@@ -1,83 +0,0 @@
//TODO: SD: Pretty sure we don't want this anymore and we should just be using the treepicker.html instead for all tree picking.
//used for the content picker dialog
angular.module("umbraco").controller("Umbraco.Dialogs.ContentPickerController",
function ($scope, eventsService, entityResource, searchService, $log) {
var dialogOptions = $scope.dialogOptions;
$scope.dialogTreeEventHandler = $({});
$scope.results = [];
$scope.selectResult = function (result) {
entityResource.getById(result.id, "Document").then(function (ent) {
if (dialogOptions && dialogOptions.multiPicker) {
$scope.showSearch = false;
$scope.results = [];
$scope.term = "";
$scope.oldTerm = undefined;
$scope.select(ent);
} else {
$scope.submit(ent);
}
});
};
$scope.performSearch = function () {
if ($scope.term) {
if ($scope.oldTerm !== $scope.term) {
$scope.results = [];
searchService.searchContent({ term: $scope.term }).then(function (data) {
$scope.results = data;
});
$scope.showSearch = true;
$scope.oldTerm = $scope.term;
}
} else {
$scope.oldTerm = "";
$scope.showSearch = false;
$scope.results = [];
}
};
function nodeSelectHandler (ev, args) {
args.event.preventDefault();
args.event.stopPropagation();
eventsService.emit("dialogs.contentPicker.select", args);
if (dialogOptions && dialogOptions.multiPicker) {
var c = $(args.event.target.parentElement);
if (!args.node.selected) {
args.node.selected = true;
var temp = "<i class='icon umb-tree-icon sprTree icon-check blue temporary'></i>";
var icon = c.find("i.umb-tree-icon");
if (icon.length > 0) {
icon.hide().after(temp);
} else {
c.prepend(temp);
}
} else {
args.node.selected = false;
c.find(".temporary").remove();
c.find("i.umb-tree-icon").show();
}
$scope.select(args.node);
} else {
$scope.submit(args.node);
}
}
$scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler);
$scope.$on('$destroy', function () {
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
});
});

View File

@@ -1,66 +0,0 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.ContentPickerController">
<div class="umb-panel-header">
<div class="umb-el-wrap umb-panel-buttons">
<div class="form-search">
<i class="icon-search"></i>
<input type="text"
ng-model="term"
class="umb-search-field search-query"
placeholder="Search..."
on-keyup="performSearch()">
</div>
</div>
</div>
<div class="umb-panel-body with-footer">
<!-- Search results -->
<div ng-show="showSearch">
<ul class="umb-tree">
<li class="root">
<ul class="umb-search-group" >
<li ng-repeat="result in results">
<div style="padding-left: 20px">
<a ng-class="{first:$first}" ng-click="selectResult(result)">
<i
class="icon umb-tree-icon sprTree {{result.icon}}"></i>
{{result.name}}
<small class="search-subtitle" ng-show="result.subTitle">
{{result.subTitle}}
</small>
</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
<div ng-hide="showSearch">
<umb-tree
section="content"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler">
</umb-tree>
</div>
</div>
<div class="umb-panel-footer" >
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
<button
class="btn btn-primary"
ng-show="dialogOptions.multiPicker"
ng-click="submit(dialogData)">
<localize key="buttons_select">Select</localize>({{dialogData.selection.length}})
</button>
</div>
</div>
</div>
</div>

View File

@@ -3,7 +3,7 @@
<div class="umb-el-wrap umb-panel-buttons">
<div class="form-search">
<i class="icon icon-search" ng-if="!searchInfo.showSearch"></i>
<a class="icon icon-delete" ng-if="searchInfo.showSearch" title="Cancel" ng-click="hideSearch()"></a>
<a class="icon icon-arrow-left" ng-if="searchInfo.showSearch" title="Back" ng-click="hideSearch()"></a>
<input type="text"
ng-model="searchInfo.term"
class="umb-search-field search-query"