From aae15bf0b4b0695f1270e19f7a88fd2e7cfad0a3 Mon Sep 17 00:00:00 2001 From: Alexander Bryukhov Date: Mon, 28 Dec 2015 23:40:15 +0600 Subject: [PATCH 1/4] ru.xml - UI lang file Added / updated keys for 7.4 --- src/Umbraco.Web.UI/umbraco/config/lang/ru.xml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml index d5bfbaffb1..38e003bc23 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml @@ -386,6 +386,7 @@ Показать страницу при отправке Размер Сортировать + Отправить Тип Что искать? Вверх @@ -400,6 +401,8 @@ Добро пожаловать... Ширина Да + Пересортировать + Пересортировка завершена Цвет фона @@ -409,7 +412,8 @@ Текст - снизу и добавьте Ваш первый элемент]]> + Добавить содержимое + Сбросить содержимое Добавить шаблон сетки Настройте шаблон, задавая ширину колонок или добавляя дополнительные секции Добавить конфигурацию строки @@ -417,9 +421,12 @@ Добавить новые строки Доступны все редакторы Доступны все конфигурации строк + Choose a layout Кликните для встраивания Кликните для вставки изображения Колонки + Недопустимый тип содержимого + Данный тип содержимого разрешен Суммарное число колонок в шаблоне сетки Шаблоны сетки Шаблоны являются рабочим пространством для редактора сетки, обычно Вам понадобится не более одного или двух шаблонов @@ -430,6 +437,7 @@ Строки - это последовательности ячеек с горизонтальным расположением Установки будут сохранены только если они указаны в корректном формате json Установки + Установки применены Задайте установки, доступные редакторам для изменения Стили Задайте стили, доступные редакторам для изменения @@ -965,7 +973,7 @@ Обзор кэша Корзина Созданные пакеты - Типы данных + Типы данных Словарь Установленные пакеты Установить тему @@ -975,10 +983,10 @@ Макросы Типы медиа-материалов Участники - Группы участников + Группы участников Роли участников - Типы участников - Типы документов + Типы участников + Типы документов Пакеты дополнений Пакеты дополнений Скрипты Python From 4574e4291bf4a42c63f45adbdf8dbd79d640edf4 Mon Sep 17 00:00:00 2001 From: Alexander Bryukhov Date: Mon, 28 Dec 2015 23:45:15 +0600 Subject: [PATCH 2/4] Missed keys --- src/Umbraco.Web.UI/umbraco/config/lang/ru.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml index 38e003bc23..bb300dccf3 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml @@ -421,7 +421,7 @@ Добавить новые строки Доступны все редакторы Доступны все конфигурации строк - Choose a layout + Выберите раскладку Кликните для встраивания Кликните для вставки изображения Колонки From 6a1b8f00eb4c8d0a0c6b9f1be294a07888eeedb4 Mon Sep 17 00:00:00 2001 From: Alexander Bryukhov Date: Mon, 28 Dec 2015 23:47:28 +0600 Subject: [PATCH 3/4] Correcing one key translation --- src/Umbraco.Web.UI/umbraco/config/lang/ru.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml index bb300dccf3..a4bfc00cec 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml @@ -421,7 +421,7 @@ Добавить новые строки Доступны все редакторы Доступны все конфигурации строк - Выберите раскладку + Выберите шаблон Кликните для встраивания Кликните для вставки изображения Колонки From ba2fd96e88de76eb0fe2a50371603ffc081aca38 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 26 Jan 2016 15:54:17 +0100 Subject: [PATCH 4/4] U4-7695 Media items are not updated when a new crop is added to Image Cropper --- .../ValueConverters/GridValueConverter.cs | 5 +- .../ImageCropperValueConverter.cs | 67 +++++++++++++++++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + .../propertyeditors/grid/grid.controller.js | 4 +- .../ImageCropperTemplateExtensions.cs | 4 ++ 5 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs index 11f915fabd..b3db026c89 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs @@ -12,6 +12,9 @@ using Umbraco.Core.Models.PublishedContent; namespace Umbraco.Core.PropertyEditors.ValueConverters { + /// + /// This ensures that the grid config is merged in with the front-end value + /// [DefaultPropertyValueConverter(typeof(JsonValueConverter))] //this shadows the JsonValueConverter [PropertyValueType(typeof(JToken))] [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] @@ -90,7 +93,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters } catch (Exception ex) { - LogHelper.Error("Could not parse the string " + sourceString + " to a json object", ex); + LogHelper.Error("Could not parse the string " + sourceString + " to a json object", ex); } } diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs new file mode 100644 index 0000000000..8ad0b7d69d --- /dev/null +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs @@ -0,0 +1,67 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Umbraco.Core.Logging; +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Core.PropertyEditors.ValueConverters +{ + /// + /// This ensures that the cropper config (pre-values/crops) are merged in with the front-end value. + /// + [DefaultPropertyValueConverter(typeof (JsonValueConverter))] //this shadows the JsonValueConverter + [PropertyValueType(typeof (JToken))] + [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] + public class ImageCropperValueConverter : JsonValueConverter + { + public override bool IsConverter(PublishedPropertyType propertyType) + { + return propertyType.PropertyEditorAlias.InvariantEquals(Constants.PropertyEditors.ImageCropperAlias); + } + + public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) + { + if (source == null) return null; + var sourceString = source.ToString(); + + if (sourceString.DetectIsJson()) + { + JObject obj; + try + { + obj = JsonConvert.DeserializeObject(sourceString); + } + catch (Exception ex) + { + LogHelper.Error("Could not parse the string " + sourceString + " to a json object", ex); + return sourceString; + } + + //need to lookup the pre-values for this data type + //TODO: Change all singleton access to use ctor injection in v8!!! + var dt = ApplicationContext.Current.Services.DataTypeService.GetPreValuesCollectionByDataTypeId(propertyType.DataTypeId); + + if (dt != null && dt.IsDictionaryBased && dt.PreValuesAsDictionary.ContainsKey("crops")) + { + var cropsString = dt.PreValuesAsDictionary["crops"].Value; + JArray crops; + try + { + crops = JsonConvert.DeserializeObject(cropsString); + } + catch (Exception ex) + { + LogHelper.Error("Could not parse the string " + cropsString + " to a json object", ex); + return sourceString; + } + obj["crops"] = crops; + } + + return obj; + } + + //it's not json, just return the string + return sourceString; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 3476d1fcc3..cee2f8ee3f 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -488,6 +488,7 @@ + diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js index 8272f032ee..29176da102 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js @@ -580,11 +580,11 @@ angular.module("umbraco") // ********************************************* - // INITIALISATION + // Initialization // these methods are called from ng-init on the template // so we can controll their first load data // - // intialisation sets non-saved data like percentage sizing, allowed editors and + // intialization sets non-saved data like percentage sizing, allowed editors and // other data that should all be pre-fixed with $ to strip it out on save // ********************************************* diff --git a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs index a76b39f187..e592c157aa 100644 --- a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs +++ b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs @@ -119,6 +119,10 @@ if (mediaItem.HasProperty(propertyAlias) && mediaItem.HasValue(propertyAlias)) { + //TODO: We should change this, the default value is JObject now, this means we are ToString() ing the value, + // then re-deserializing it back to json and then to a strongly typed model. + // With a tiny bit of work we can make this more efficient since it's already a JObject. + imageCropperValue = mediaItem.GetPropertyValue(propertyAlias); // get the raw value (this will be json)