From b7fb14405f6322d193d16de41c5bcfbd6c71fe85 Mon Sep 17 00:00:00 2001 From: Kevin Giszewski Date: Thu, 29 May 2014 17:13:28 -0400 Subject: [PATCH] Add defaultType radio to prevalues --- urlpicker/Gruntfile.js | 3 ++- urlpicker/app/scripts/controllers/default.type.js | 3 +++ .../app/scripts/controllers/url.picker.controller.js | 9 ++------- urlpicker/app/views/default.type.html | 5 +++++ urlpicker/config/package.manifest | 6 ++++++ 5 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 urlpicker/app/scripts/controllers/default.type.js create mode 100644 urlpicker/app/views/default.type.html diff --git a/urlpicker/Gruntfile.js b/urlpicker/Gruntfile.js index d70bc78..525d3bb 100644 --- a/urlpicker/Gruntfile.js +++ b/urlpicker/Gruntfile.js @@ -10,7 +10,8 @@ module.exports = function(grunt) { concat: { dist: { src: [ - 'app/scripts/controllers/url.picker.controller.js' + 'app/scripts/controllers/url.picker.controller.js', + 'app/scripts/controllers/default.type.js' ], dest: '<%= dest %>/<%= basePath %>/js/url.picker.js', nonull: true diff --git a/urlpicker/app/scripts/controllers/default.type.js b/urlpicker/app/scripts/controllers/default.type.js new file mode 100644 index 0000000..65fcf76 --- /dev/null +++ b/urlpicker/app/scripts/controllers/default.type.js @@ -0,0 +1,3 @@ +angular.module('umbraco').controller('UrlPickerDefaultTypeController', function($scope) { + $scope.model.value = $scope.model.value || "content"; +}); \ No newline at end of file diff --git a/urlpicker/app/scripts/controllers/url.picker.controller.js b/urlpicker/app/scripts/controllers/url.picker.controller.js index 10614a2..3519140 100644 --- a/urlpicker/app/scripts/controllers/url.picker.controller.js +++ b/urlpicker/app/scripts/controllers/url.picker.controller.js @@ -67,13 +67,8 @@ angular.module('umbraco').controller('UrlPickerController', function($scope, dia if (!$scope.model.value || !$scope.model.value.type) { var defaultType = "content"; - if($scope.model.config.hideContent == '1') { - if($scope.model.config.hideUrl == '0') { - defaultType = "url"; - } - else { - defaultType = "media"; - } + if($scope.model.config.defaultType) { + defaultType = $scope.model.config.defaultType; } $scope.model.value = { "type": defaultType, "meta": { "title": "", "newWindow": false }, "typeData": { "url": "", "contentId": null, "mediaId": null } }; diff --git a/urlpicker/app/views/default.type.html b/urlpicker/app/views/default.type.html new file mode 100644 index 0000000..ff25ac3 --- /dev/null +++ b/urlpicker/app/views/default.type.html @@ -0,0 +1,5 @@ +
+ Content
+ URL
+ Media +
\ No newline at end of file diff --git a/urlpicker/config/package.manifest b/urlpicker/config/package.manifest index fbcd6d8..54352b6 100644 --- a/urlpicker/config/package.manifest +++ b/urlpicker/config/package.manifest @@ -50,6 +50,12 @@ description: "Hides the 'URL' option", key: "hideUrl", view: "boolean" + }, + { + label: "Default Type", + description: "Choose which type the picker defaults to.", + key: "defaultType", + view: "~/App_Plugins/UrlPicker/views/default.type.html" } ] }