diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js index ed4a539cba..9aa0d39040 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js @@ -206,18 +206,19 @@ function entityResource($q, $http, umbRequestHelper) { * @methodOf umbraco.resources.entityResource * * @description - * Gets an array of entities, given a lucene query + * Gets an array of entities, given a lucene query and a type * * ##usage *
- * entityResource.search("news")
+ * entityResource.search("news", "Media")
* .then(function(mediaArray) {
* var myDoc = mediaArray;
* alert('they are here!');
* });
*
*
- * @param {String} Query search query
+ * @param {String} Query search query
+ * @param {String} Type type of conten to search
* @returns {Promise} resourcePromise object containing the entity array.
*
*/
@@ -227,7 +228,7 @@ function entityResource($q, $http, umbRequestHelper) {
$http.get(
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
- "SearchMedia",
+ "Search",
[{ query: query }, {type: type}])),
'Failed to retreive entity data for query ' + query);
}
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/search.service.js b/src/Umbraco.Web.UI.Client/src/common/services/search.service.js
index 2d74477de3..4f92417612 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/search.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/search.service.js
@@ -1,39 +1,48 @@
angular.module('umbraco.services')
-.factory('searchService', function () {
+.factory('searchService', function ($q, $log, entityResource) {
+ var m = {results: []};
return {
- search: function(term, section){
- return [
- {
- section: "settings",
- tree: "documentTypes",
- matches:[
- { name: "News archive", path:"/News Archive", id: 1234, icon: "icon-list-alt", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 },
- { name: "Meta Data", path:"/Seo/Meta Data", id: 1234, icon: "icon-list-alt", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 },
- { name: "Dooo", path:"/Woop/dee/dooo", id: 1234, icon: "icon-list-alt red", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 }
-
- ]
- },
-
- {
- section: "content",
- tree: "content",
- matches:[
- { name: "News", path:"/archive/news", id: 1234, icon: "icon-file", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 },
- { name: "Data types", path:"/Something/About/Data-Types", id: 1234, icon: "icon-file", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 },
- { name: "Dooo", path:"/Woop/dee/dooo", id: 1234, icon: "icon-file", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 }
- ]
- },
+ results: m,
+ search: function(term){
+ m.results.length = 0;
- {
- section: "developer",
- tree: "macros",
- matches:[
- { name: "Navigation", path:"/Macros/Navigation.xslt", id: 1234, icon: "icon-cogs", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 },
- { name: "List of stuff", path:"/Macros/Navigation.xslt", id: 1234, icon: "icon-cogs", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 },
- { name: "Something else", path:"/Macros/Navigation.xslt",id: 1234, icon: "icon-cogs", view: section + "/edit/" + 1234, children: [], expanded: false, level: 1 }
- ]
- }
- ];
+ var deferred = $q.defer();
+ var i = 0;
+
+ entityResource.search(term, "Document").then(function(data){
+ $log.log(data);
+
+ m.results.push({
+ icon: "icon-document",
+ editor: "content/content/edit/",
+ matches: data
+ });
+ i++;
+
+ //deferred.notify(results);
+
+
+ if(i === 2){
+ deferred.resolve(m);
+ }
+ });
+
+ entityResource.search(term, "Media").then(function(data){
+ $log.log(data);
+
+ m.results.push({
+ icon: "icon-picture",
+ editor: "media/media/edit/",
+ matches: data
+ });
+ i++;
+
+ if(i === 2){
+ deferred.resolve(m);
+ }
+ });
+
+ return deferred.promise;
},
setCurrent: function(sectionAlias){
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/search.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/search.controller.js
index 00fce48af6..162398e26f 100644
--- a/src/Umbraco.Web.UI.Client/src/views/common/search.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/common/search.controller.js
@@ -8,21 +8,21 @@
*
*/
function SearchController($scope, searchService, $log, navigationService) {
+
+
var currentTerm = "";
+ navigationService.ui.search = searchService.results;
+
$scope.deActivateSearch = function () {
currentTerm = "";
};
$scope.performSearch = function (term) {
if (term != undefined && term != currentTerm) {
- if (term.length > 3) {
navigationService.ui.selectedSearchResult = -1;
navigationService.showSearch();
currentTerm = term;
- navigationService.ui.searchResults = searchService.search(term, navigationService.currentSection);
- } else {
- navigationService.ui.searchResults = [];
- }
+ searchService.search(term);
}
};
diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
index 28746df55e..3b8d9da4ba 100644
--- a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
@@ -39,6 +39,8 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont
//TODO: Need to figure out a way to share the saving and event broadcasting with all editors!
$scope.saveAndPublish = function () {
+
+ $scope.setStatus("Publishing...");
$scope.$broadcast("saving", { scope: $scope });
var currentForm = angularHelper.getRequiredCurrentForm($scope);
diff --git a/src/Umbraco.Web.UI.Client/src/views/directives/umb-navigation.html b/src/Umbraco.Web.UI.Client/src/views/directives/umb-navigation.html
index 7958387aef..8314ce4557 100644
--- a/src/Umbraco.Web.UI.Client/src/views/directives/umb-navigation.html
+++ b/src/Umbraco.Web.UI.Client/src/views/directives/umb-navigation.html
@@ -43,7 +43,7 @@
@@ -55,16 +55,14 @@
ng-show="nav.ui.showSearchResults">