Skip to content

Commit

Permalink
Add defaultType radio to prevalues
Browse files Browse the repository at this point in the history
  • Loading branch information
kgiszewski committed May 29, 2014
1 parent 5ecf991 commit b7fb144
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion urlpicker/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions urlpicker/app/scripts/controllers/default.type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
angular.module('umbraco').controller('UrlPickerDefaultTypeController', function($scope) {
$scope.model.value = $scope.model.value || "content";
});
9 changes: 2 additions & 7 deletions urlpicker/app/scripts/controllers/url.picker.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } };
Expand Down
5 changes: 5 additions & 0 deletions urlpicker/app/views/default.type.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div ng-controller="UrlPickerDefaultTypeController">
<input type="radio" ng-model="model.value" value="content"> Content<br/>
<input type="radio" ng-model="model.value" value="url"> URL<br/>
<input type="radio" ng-model="model.value" value="media"> Media
</div>
6 changes: 6 additions & 0 deletions urlpicker/config/package.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
Expand Down

0 comments on commit b7fb144

Please sign in to comment.