Skip to content

Commit

Permalink
V8: Change "Include subfolders in search" to "Search only in th… (#4720)
Browse files Browse the repository at this point in the history
Lots of lovely work here - this is one of those PRs that show how good communication can really make the experience of contributing one of learning for all parties. Thanks Kenn and all who contributed their time here
  • Loading branch information
Kenn Jacobsen authored Jan 30, 2020
1 parent e39c0ef commit da20bf0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//used for the media picker dialog
angular.module("umbraco")
.controller("Umbraco.Editors.MediaPickerController",
function ($scope, $timeout, mediaResource, entityResource, userService, mediaHelper, mediaTypeHelper, eventsService, treeService, localStorageService, localizationService) {
function ($scope, mediaResource, entityResource, userService, mediaHelper, mediaTypeHelper, eventsService, treeService, localStorageService, localizationService, editorService, umbSessionStorage) {

var vm = this;

Expand Down Expand Up @@ -37,6 +37,11 @@ angular.module("umbraco")
$scope.cropSize = dialogOptions.cropSize;
$scope.lastOpenedNode = localStorageService.get("umbLastOpenedMediaNodeId");
$scope.lockedFolder = true;
$scope.allowMediaEdit = dialogOptions.allowMediaEdit ? dialogOptions.allowMediaEdit : false;

$scope.filterOptions = {
excludeSubFolders: umbSessionStorage.get("mediaPickerExcludeSubFolders") || false
};

var userStartNodes = [];

Expand Down Expand Up @@ -392,6 +397,7 @@ angular.module("umbraco")
}

function toggle() {
umbSessionStorage.set("mediaPickerExcludeSubFolders", $scope.filterOptions.excludeSubFolders);
// Make sure to activate the changeSearch function everytime the toggle is clicked
changeSearch();
}
Expand All @@ -404,7 +410,7 @@ angular.module("umbraco")

function searchMedia() {
vm.loading = true;
entityResource.getPagedDescendants($scope.currentFolder.id, "Media", vm.searchOptions)
entityResource.getPagedDescendants($scope.filterOptions.excludeSubFolders ? $scope.currentFolder.id : $scope.startNodeId, "Media", vm.searchOptions)
.then(function (data) {
// update image data to work with image grid
angular.forEach(data.items, function (mediaItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@

<div class="form-search__toggle">
<umb-checkbox
model="showChilds"
model="filterOptions.excludeSubFolders"
on-change="vm.toggle()"
text="Include subfolders in search"
label-key="general_includeFromsubFolders">
label-key="general_excludeFromSubFolders">
</umb-checkbox>
</div>
</div>
Expand Down Expand Up @@ -112,9 +112,8 @@
disable-folder-select={{disableFolderSelect}}
only-images={{onlyImages}}
only-folders={{onlyFolders}}
include-sub-folders={{showChilds}}
current-folder-id="{{currentFolder.id}}"
allow-open-folder="!disableFolderSelect">
include-sub-folders={{!filterOptions.excludeSubFolders}}
current-folder-id="{{currentFolder.id}}">
</umb-media-grid>


Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@
<key alias="icon">Ikon</key>
<key alias="id">Id</key>
<key alias="import">Importer</key>
<key alias="includeFromsubFolders">Inkludér undermapper i søgning</key>
<key alias="excludeFromSubFolders">Søg kun i denne mappe</key>
<key alias="info">Info</key>
<key alias="innerMargin">Indre margen</key>
<key alias="insert">Indsæt</key>
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@
<key alias="icon">Icon</key>
<key alias="id">Id</key>
<key alias="import">Import</key>
<key alias="includeFromsubFolders">Include subfolders in search</key>
<key alias="excludeFromSubFolders">Search only this folder</key>
<key alias="info">Info</key>
<key alias="innerMargin">Inner margin</key>
<key alias="insert">Insert</key>
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@
<key alias="icon">Icon</key>
<key alias="id">Id</key>
<key alias="import">Import</key>
<key alias="includeFromsubFolders">Include subfolders in search</key>
<key alias="excludeFromSubFolders">Search only this folder</key>
<key alias="info">Info</key>
<key alias="innerMargin">Inner margin</key>
<key alias="insert">Insert</key>
Expand Down

0 comments on commit da20bf0

Please sign in to comment.