Skip to content

Commit 35c111f

Browse files
author
rpjengaard
committed
[Skybrud] added nocrop option
1 parent 497bcf9 commit 35c111f

File tree

11 files changed

+57
-9
lines changed

11 files changed

+57
-9
lines changed

src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Controllers/ImagePickerPreValues.js

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
$scope.descriptionMode = $scope.propertyModes[0];
4141
$scope.linkMode = $scope.propertyModes[0];
4242

43+
4344
// Update the values for "titleMode", "descriptionMode" and "linkMode"
4445
angular.forEach($scope.propertyModes, function (mode) {
4546
if (cfg.items.title && cfg.items.title.mode == mode.alias) $scope.titleMode = mode;

src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Directives/ImagePicker.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
scope.cfg.items.description.hidden = scope.cfg.items.description.mode == 'hidden';
113113
scope.cfg.items.link.required = scope.cfg.items.link.mode == 'required';
114114
scope.cfg.items.link.hidden = scope.cfg.items.link.mode == 'hidden';
115+
116+
if (!scope.cfg.items.nocrop) scope.cfg.items.nocrop = {};
117+
scope.cfg.items.nocrop.visible = scope.cfg.items.nocrop.mode === 'visible';
118+
scope.cfg.items.nocrop.default = scope.cfg.items.nocrop.default === true;
115119

116120
scope.itemStyles = {
117121
width: scope.cfg.image.width + 'px',
@@ -189,7 +193,8 @@
189193
title: '',
190194
description: '',
191195
imageId: 0,
192-
link: null
196+
link: null,
197+
nocrop: scope.cfg.items.nocrop.default
193198
};
194199

195200
// Collapse all open rows
@@ -235,7 +240,8 @@
235240
imageId: image.id,
236241
$image: image,
237242
link: null,
238-
$showInfo: scope.layout == 'list' && model.selectedImages.length == 1
243+
$showInfo: scope.layout == 'list' && model.selectedImages.length == 1,
244+
nocrop: scope.cfg.items.nocrop.default
239245
};
240246

241247
item.$imageUrl = item.imageUrl = getImageUrl(item);

src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Lang/da-DK.xml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<key alias="labelTitle_placeholder">Angiv titel her</key>
2323
<key alias="labelDescription">Beskrivelse</key>
2424
<key alias="labelDescriptionPlaceholder">Angiv beskrivelse her</key>
25+
<key alias="labelNoCrop">Beskær ikke billede</key>
2526

2627
<key alias="labelLink">Link</key>
2728
<key alias="labelLinkType">Type</key>

src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Lang/en-GB.xml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<key alias="labelTitlePlaceholder">Specify title here</key>
2323
<key alias="labelDescription">Description</key>
2424
<key alias="labelDescriptionPlaceholder">Specify description here</key>
25+
<key alias="labelNoCrop">Don´t crop image</key>
2526

2627
<key alias="labelLink">Link</key>
2728
<key alias="labelLinkType">Type</key>

src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Lang/en-US.xml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<key alias="labelTitlePlaceholder">Specify title here</key>
2323
<key alias="labelDescription">Description</key>
2424
<key alias="labelDescriptionPlaceholder">Specify description here</key>
25+
<key alias="labelNoCrop">Don´t crop image</key>
2526

2627
<key alias="labelLink">Link</key>
2728
<key alias="labelLinkType">Type</key>

src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Views/Partials/ImagePickerDebugger.html

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
<label>
6363
<input type="checkbox" ng-model="config.items.hideLink" /> Hide link
6464
</label>
65+
<label>
66+
<input type="checkbox" ng-model="config.items.nocrop.default" /> NoCrop default
67+
</label>
6568
</div>
6669
</div>
6770
</div>

src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Views/Partials/ImagePickerList.html

+6
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@
145145
</div>
146146
<input type="hidden" ng-model="item.$link" ng-required="cfg.items.link.required" id="imagePickerRowLink{{item.$uniqueId}}" />
147147
</div>
148+
<div class="subpart" ng-hide="!config.items.nocrop.visible">
149+
<div class="title">
150+
<localize key="imagepicker_labelNoCrop">Don´t crop image</localize>
151+
</div>
152+
<input type="checkbox" ng-model="item.nocrop" />
153+
</div>
148154
</div>
149155
</div>
150156
</div>

src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Views/Partials/ImagePickerTiles.html

+6
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@
7676
</a>
7777
</div>
7878
</div>
79+
<div class="subpart" ng-hide="!config.items.nocrop.visible">
80+
<div class="title">
81+
<localize key="imagepicker_labelNoCrop">No crop</localize>
82+
</div>
83+
<input type="checkbox" ng-model="item.nocrop" />
84+
</div>
7985
<input type="hidden" ng-model="item.imageUrl" required id="imagePickerRowImage{{item.$uniqueId}}" />
8086
<input type="hidden" ng-model="item.$link" ng-required="cfg.items.link.required" id="imagePickerRowLink{{item.$uniqueId}}" />
8187
</div>

src/Skybrud.ImagePicker/ImagePickerItem.cs

+24-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ public class ImagePickerItem {
6464
[JsonConverter(typeof(LinkPickerItemConverter))]
6565
public LinkPickerItem Link { get; private set; }
6666

67-
/// <summary>
67+
[JsonProperty("noCrop")]
68+
public bool NoCrop { get; private set; }
69+
70+
71+
72+
/// <summary>
6873
/// Gets whether a valid link has been specified for this item.
6974
/// </summary>
7075
[JsonIgnore]
@@ -104,6 +109,23 @@ public ImagePickerItem(ImagePickerImage image, string title, string description,
104109
Link = link ?? LinkPickerItem.Parse(new JObject());
105110
}
106111

112+
/// <summary>
113+
/// Initializes a new image picker item based on the specified <paramref name="image"/>, <paramref name="title"/>,
114+
/// <paramref name="description"/> and <paramref name="link"/>.
115+
/// </summary>
116+
/// <param name="image">An instance of <see cref="IPublishedContent"/> representing the selected image.</param>
117+
/// <param name="title">The title of the item.</param>
118+
/// <param name="description">The description of the item.</param>
119+
/// <param name="link">An instance of <see cref="LinkPickerItem"/> representing the link of the item.</param>
120+
/// <param name="noCrop">The NoCrop property value</param>
121+
public ImagePickerItem(ImagePickerImage image, string title, string description, LinkPickerItem link, bool noCrop) {
122+
Image = image;
123+
Title = title;
124+
Description = description;
125+
Link = link ?? LinkPickerItem.Parse(new JObject());
126+
NoCrop = noCrop;
127+
}
128+
107129
/// <summary>
108130
/// Initializes a new image picker item based on the specified <see cref="JObject"/>.
109131
/// </summary>
@@ -114,6 +136,7 @@ protected ImagePickerItem(JObject obj) {
114136
Title = obj.GetString("title") ?? "";
115137
Description = obj.GetString("description") ?? "";
116138
Link = obj.GetObject("link", LinkPickerItem.Parse) ?? LinkPickerItem.Parse(new JObject());
139+
NoCrop = obj.GetBoolean("nocrop");
117140
}
118141

119142
#endregion

src/Skybrud.ImagePicker/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyInformationalVersion("1.1.7")]
35-
[assembly: AssemblyVersion("1.1.7.0")]
36-
[assembly: AssemblyFileVersion("1.1.7.0")]
34+
[assembly: AssemblyInformationalVersion("1.1.8")]
35+
[assembly: AssemblyVersion("1.1.8.0")]
36+
[assembly: AssemblyFileVersion("1.1.8.0")]

src/Skybrud.ImagePicker/Properties/AssemblyInfo.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"company": "Skybrud.dk",
55
"product": "Skybrud.ImagePicker",
66
"copyright": "Copyright © 2018",
7-
"version": "1.1.7.0",
8-
"informationalVersion": "1.1.7",
9-
"fileVersion": "1.1.7.0"
7+
"version": "1.1.8.0",
8+
"informationalVersion": "1.1.8",
9+
"fileVersion": "1.1.8.0"
1010
}

0 commit comments

Comments
 (0)