diff --git a/LICENSE.md b/LICENSE.md index 6cef29c..9119443 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright © 2014 Umbrella Inc, Our Umbraco and other contributors +Copyright © 2016 UMCO, Our Umbraco and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 65f20d3..6c0de13 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,70 @@ # Stacked Content +[![Build status](https://img.shields.io/appveyor/ci/UMCO/umbraco-stacked-content.svg)](https://ci.appveyor.com/project/UMCO/umbraco-stacked-content) +[![NuGet release](https://img.shields.io/nuget/v/Our.Umbraco.StackedContent.svg)](https://www.nuget.org/packages/Our.Umbraco.StackedContent) +[![Our Umbraco project page](https://img.shields.io/badge/our-umbraco-orange.svg)](https://our.umbraco.org/projects/backoffice-extensions/stacked-content) + An Umbraco property editor for creating stacked content blocks. - + +## Getting Started + +### Installation + +> *Note:* Stacked Content has been developed against **Umbraco v7.4.0** and will support that version and above. + +Stacked Content can be installed from either Our Umbraco or NuGet package repositories, or build manually from the source-code: + +#### Our Umbraco package repository + +To install from Our Umbraco, please download the package from: + +> + +#### NuGet package repository + +To [install from NuGet](https://www.nuget.org/packages/Our.Umbraco.StackedContent), you can run the following command from within Visual Studio: + + PM> Install-Package Our.Umbraco.StackedContent + +We also have a [MyGet package repository](https://www.myget.org/gallery/umbraco-packages) - for bleeding-edge / development releases. + +#### Manual build + +If you prefer, you can compile Stacked Content yourself, you'll need: + +* Visual Studio 2015 (or above) + +To clone it locally click the "Clone in Windows" button above or run the following git commands. + + git clone https://github.com/umco/umbraco-stacked-content.git umbraco-stacked-content + cd umbraco-stacked-content + .\build.cmd + +--- + +## Known Issues + +* _[TBC]_ + +--- + +## Contributing to this project + +Anyone and everyone is welcome to contribute. Please take a moment to review the [guidelines for contributing](CONTRIBUTING.md). + +* [Bug reports](CONTRIBUTING.md#bugs) +* [Feature requests](CONTRIBUTING.md#features) +* [Pull requests](CONTRIBUTING.md#pull-requests) + +--- + +## Contact + +Have a question? + +* [Stacked Content Forum](https://our.umbraco.org/projects/backoffice-extensions/stacked-content/stacked-content-feedback) on Our Umbraco +* [Raise an issue](https://github.com/umco/umbraco-stacked-content/issues) on GitHub + ## Dev Team * [Matt Brailsford](https://github.com/mattbrailsford) @@ -9,6 +72,6 @@ An Umbraco property editor for creating stacked content blocks. ## License -Copyright © 2016 Umco, Our Umbraco and [other contributors](https://github.com/umco/umbraco-stacked-content/graphs/contributors) +Copyright © 2016 UMCO, Our Umbraco and [other contributors](https://github.com/umco/umbraco-stacked-content/graphs/contributors) Licensed under the [MIT License](LICENSE.md) diff --git a/appveyor.yml b/appveyor.yml index 720925c..23d8ae2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ os: Visual Studio 2015 # version format -version: 1.0.3.{build} +version: 1.0.4.{build} # UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha # example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta diff --git a/build-appveyor.cmd b/build-appveyor.cmd index 7d1de61..0910b1b 100644 --- a/build-appveyor.cmd +++ b/build-appveyor.cmd @@ -3,5 +3,5 @@ ECHO APPVEYOR_REPO_TAG: %APPVEYOR_REPO_TAG% ECHO APPVEYOR_BUILD_NUMBER : %APPVEYOR_BUILD_NUMBER% ECHO APPVEYOR_BUILD_VERSION : %APPVEYOR_BUILD_VERSION% -CALL src\.nuget\NuGet.exe restore src\Our.Umbraco.NestedContent.sln +CALL build\tools\NuGet\NuGet.exe restore src\Our.Umbraco.StackedContent.sln CALL "%programfiles(x86)%\MSBuild\14.0\Bin\amd64\MsBuild.exe" build\package.proj \ No newline at end of file diff --git a/build/install.ps1 b/build/install.ps1 index 66d5b93..634d441 100644 --- a/build/install.ps1 +++ b/build/install.ps1 @@ -12,7 +12,7 @@ if (!$contentFolder) $projectPath = Join-Path $projDirectory -ChildPath "App_Plugins" $projectPathExists = Test-Path $projectPath - if ($projectPathExists) { + if ($projectPathExists) { Write-Host "Updating Stacked Content App_Plugin files using PS as they have been excluded from the project" Copy-Item $newPackageFiles $projectPath -Recurse -Force } diff --git a/build/package.nuspec b/build/package.nuspec index 8f25c53..7a45177 100644 --- a/build/package.nuspec +++ b/build/package.nuspec @@ -16,8 +16,7 @@ - - + diff --git a/build/package.proj b/build/package.proj index 29a5cf3..be0f922 100644 --- a/build/package.proj +++ b/build/package.proj @@ -19,7 +19,7 @@ Our.Umbraco.StackedContent Stacked Content 7.4.0 - Stacked Content is a stacked content editing property editor for Umbraco 7.4+ + Stacked Content is an Umbraco property-editor for creating stacked content blocks. Matt Brailsford, Lee Kelleher https://github.com/umco/umbraco-stacked-content/graphs/contributors MIT license @@ -31,7 +31,7 @@ Our.Umbraco.StackedContent Stacked Content for Umbraco - Copyright © 2016 Umco, Our Umbraco and other contributors + Copyright © 2016 UMCO, Our Umbraco and other contributors Matt Brailsford, Lee Kelleher https://raw.githubusercontent.com/umco/umbraco-stacked-content/master/docs/img/logo.png umbraco umco @@ -193,7 +193,7 @@ OutputDirectory="$(ArtifactsDir)" Files="@(PackageFiles)" /> - ))] public class StackedContentValueConverter : InnerContentValueConverter { - public override bool IsConverter(PublishedPropertyType propertyType) { return propertyType.PropertyEditorAlias.InvariantEquals(StackedContentPropertyEditor.PropertyEditorAlias); @@ -26,9 +29,7 @@ public override object ConvertDataToSource(PublishedPropertyType propertyType, o var rawValue = JsonConvert.DeserializeObject(source.ToString()); return ConvertInnerContentDataToSource(rawValue, null, 1, preview); - } - } catch (Exception e) { @@ -38,4 +39,4 @@ public override object ConvertDataToSource(PublishedPropertyType propertyType, o return null; } } -} +} \ No newline at end of file diff --git a/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj b/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj index cc40c4f..9d214d2 100644 --- a/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj +++ b/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj @@ -32,183 +32,183 @@ ..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.dll - True + False ..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.Net4.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\businesslogic.dll - True + False ..\packages\ClientDependency.1.8.4\lib\net45\ClientDependency.Core.dll - True + False ..\packages\ClientDependency-Mvc5.1.8.0.0\lib\net45\ClientDependency.Core.Mvc.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\cms.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\controls.dll - True + False ..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll - True + False ..\packages\Examine.0.1.68.0\lib\Examine.dll - True + False ..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll - True + False ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - True + False ..\packages\ImageProcessor.2.3.3.0\lib\net45\ImageProcessor.dll - True + False ..\packages\ImageProcessor.Web.4.5.3.0\lib\net45\ImageProcessor.Web.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\interfaces.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\log4net.dll - True + False ..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll - True + False ..\packages\Markdown.1.14.4\lib\net45\MarkdownSharp.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\Microsoft.ApplicationBlocks.Data.dll - True + False ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll - True + False ..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll - True + False ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll - True + False ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - True + False ..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll - True + False ..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll - True + False ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll - True + False ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - True + False ..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll - True + False ..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll - True + False ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True + False - - ..\packages\Our.Umbraco.InnerContent.Core.1.0.1\lib\net45\Our.Umbraco.InnerContent.dll - True + + ..\packages\Our.Umbraco.InnerContent.Core.1.0.3\lib\net45\Our.Umbraco.InnerContent.dll + False ..\packages\Owin.1.0\lib\net40\Owin.dll - True + False ..\packages\semver.1.1.2\lib\net451\Semver.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\SQLCE4Umbraco.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\System.Data.SqlServerCe.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\System.Data.SqlServerCe.Entity.dll - True + False ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll - True + False ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll - True + False ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll - True + False ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll - True + False ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll - True + False ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll - True + False ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll - True + False ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll - True + False ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - True + False @@ -218,48 +218,49 @@ ..\packages\UmbracoCms.Core.7.4.0\lib\TidyNet.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\umbraco.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\Umbraco.Core.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\umbraco.DataLayer.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\umbraco.editorControls.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\umbraco.MacroEngines.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\umbraco.providers.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\Umbraco.Web.UI.dll - True + False ..\packages\UmbracoCms.Core.7.4.0\lib\UmbracoExamine.dll - True + False ..\packages\UrlRewritingNet.2.0.7\lib\UrlRewritingNet.UrlRewriter.dll - True + False + diff --git a/src/Our.Umbraco.StackedContent/Properties/AssemblyInfo.cs b/src/Our.Umbraco.StackedContent/Properties/AssemblyInfo.cs index 118d5d4..630178f 100644 --- a/src/Our.Umbraco.StackedContent/Properties/AssemblyInfo.cs +++ b/src/Our.Umbraco.StackedContent/Properties/AssemblyInfo.cs @@ -1,36 +1,14 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. [assembly: AssemblyTitle("Our.Umbraco.StackedContent")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("The Umbraco Community")] [assembly: AssemblyProduct("Our.Umbraco.StackedContent")] -[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyCopyright("Copyright \xa9 The Umbraco Community 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e0f6b57d-f549-4ef0-b5a7-5c1a9b49fd80")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("E0F6B57D-F549-4EF0-B5A7-5C1A9B49FD80")] diff --git a/src/Our.Umbraco.StackedContent/PropertyEditors/StackedContentPropertyEditor.cs b/src/Our.Umbraco.StackedContent/PropertyEditors/StackedContentPropertyEditor.cs index 2d36fa0..b636b27 100644 --- a/src/Our.Umbraco.StackedContent/PropertyEditors/StackedContentPropertyEditor.cs +++ b/src/Our.Umbraco.StackedContent/PropertyEditors/StackedContentPropertyEditor.cs @@ -1,15 +1,10 @@ using System.Collections.Generic; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Our.Umbraco.InnerContent.PropertyEditors; -using Umbraco.Core.Models; -using Umbraco.Core.Models.Editors; using Umbraco.Core.PropertyEditors; -using Umbraco.Core.Services; namespace Our.Umbraco.StackedContent.PropertyEditors { - [PropertyEditor(PropertyEditorAlias, "Stacked Content", "/App_Plugins/StackedContent/views/stackedcontent.html", ValueType = "JSON")] + [PropertyEditor(PropertyEditorAlias, "Stacked Content", "/App_Plugins/StackedContent/views/stackedcontent.html", Group = "rich content", Icon = "icon-umb-contour", ValueType = "JSON")] public class StackedContentPropertyEditor : PropertyEditor { public const string PropertyEditorAlias = "Our.Umbraco.StackedContent"; @@ -28,7 +23,8 @@ public StackedContentPropertyEditor() { {"contentTypes", ""}, {"maxItems", 0}, - {"singleItemMode", "0"} + {"singleItemMode", "0"}, + {"disablePreview", "0"} }; } @@ -46,12 +42,15 @@ internal class StackPreValueEditor : PreValueEditor [PreValueField("maxItems", "Max Items", "number", Description = "Set the maximum number of items allowed in this stack.")] public string MaxItems { get; set; } - + [PreValueField("singleItemMode", "Single Item Mode", "boolean", Description = "Set whether to work in single item mode (only the first defined Doc Type will be used).")] public string SingleItemMode { get; set; } [PreValueField("hideLabel", "Hide Label", "boolean", Description = "Set whether to hide the editor label and have the list take up the full width of the editor window.")] public string HideLabel { get; set; } + + [PreValueField("disablePreview", "Disable Preview", "boolean", Description = "Set whether to disable the preview of the items in the stack.")] + public string DisablePreview { get; set; } } #endregion @@ -60,74 +59,9 @@ internal class StackPreValueEditor : PreValueEditor protected override PropertyValueEditor CreateValueEditor() { - return new StackPropertyValueEditor(base.CreateValueEditor()); - } - - internal class StackPropertyValueEditor : InnerContentPropertyValueEditorWrapper - { - public StackPropertyValueEditor(PropertyValueEditor wrapped) - : base(wrapped) - { } - - public override string ConvertDbToString(Property property, PropertyType propertyType, IDataTypeService dataTypeService) - { - // Convert / validate value - if (property.Value == null || string.IsNullOrWhiteSpace(property.Value.ToString())) - return string.Empty; - - var value = JsonConvert.DeserializeObject(property.Value.ToString()); - if (value == null) - return string.Empty; - - // Process value - ConvertInnerContentDbToString(value); - - // Update the value on the property - property.Value = JsonConvert.SerializeObject(value); - - // Pass the call down - return base.ConvertDbToString(property, propertyType, dataTypeService); - } - - public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) - { - // Convert / validate value - if (property.Value == null || string.IsNullOrWhiteSpace(property.Value.ToString())) - return string.Empty; - - var value = JsonConvert.DeserializeObject(property.Value.ToString()); - if (value == null) - return string.Empty; - - // Process value - ConvertInnerContentDbToEditor(value); - - // Update the value on the property - property.Value = JsonConvert.SerializeObject(value); - - // Pass the call down - return base.ConvertDbToEditor(property, propertyType, dataTypeService); - } - - public override object ConvertEditorToDb(ContentPropertyData editorValue, object currentValue) - { - // Convert / validate value - if (editorValue.Value == null || string.IsNullOrWhiteSpace(editorValue.Value.ToString())) - return null; - - var value = JsonConvert.DeserializeObject(editorValue.Value.ToString()); - if (value == null || value.Count == 0) - return null; - - // Process value - ConvertInnerContentEditorToDb(value); - - // Return value - return JsonConvert.SerializeObject(value); - } + return new SimpleInnerContentPropertyValueEditor(base.CreateValueEditor()); } #endregion - } -} +} \ No newline at end of file diff --git a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs index 01d9a21..957f3cc 100644 --- a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs +++ b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs @@ -43,4 +43,4 @@ public HttpResponseMessage GetPreviewMarkup([FromBody] JObject item, int parentI return response; } } -} +} \ No newline at end of file diff --git a/src/Our.Umbraco.StackedContent/Web/Helpers/ViewHelper.cs b/src/Our.Umbraco.StackedContent/Web/Helpers/ViewHelper.cs index db5038f..97188e6 100644 --- a/src/Our.Umbraco.StackedContent/Web/Helpers/ViewHelper.cs +++ b/src/Our.Umbraco.StackedContent/Web/Helpers/ViewHelper.cs @@ -35,6 +35,5 @@ public static string RenderPartial(string partialName, object model, string[] vi return sw.ToString(); } - } -} +} \ No newline at end of file diff --git a/src/Our.Umbraco.StackedContent/Web/PreviewModel.cs b/src/Our.Umbraco.StackedContent/Web/PreviewModel.cs index dd150bd..5f86309 100644 --- a/src/Our.Umbraco.StackedContent/Web/PreviewModel.cs +++ b/src/Our.Umbraco.StackedContent/Web/PreviewModel.cs @@ -80,4 +80,4 @@ IPublishedProperty IPublishedContent.GetProperty(string alias, bool recurse) #endregion } -} +} \ No newline at end of file diff --git a/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/css/stackedcontent.css b/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/css/stackedcontent.css index a8ab9c9..8e156fa 100644 --- a/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/css/stackedcontent.css +++ b/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/css/stackedcontent.css @@ -1,66 +1,60 @@ -.stacked-content -{ +.stacked-content { position: relative; } -.stack__wrapper -{ +.stacked-content .umb-load-indicator { + margin-top: 10px; +} + +.stack__wrapper { margin-right: 12px; } -.stack__item -{ +.stack__item { position: relative; display: block; margin: 0; z-index: 10; } -.stack__preview-wrapper -{ +.stack__preview-wrapper { position: relative; border: 1px solid #f8f8f8; } -.placeholder, -.stack__preview -{ +.stacked-content .placeholder, +.stack__preview { display: block; text-decoration: none !important; cursor: pointer; } -.placeholder, -.stack__preview--default -{ +.stacked-content .placeholder, +.stack__preview--default { background-color: #f8f8f8; padding: 20px; text-align: center; - transition: background-color .25s ease-in-out; -moz-transition: background-color .25s ease-in-out; -webkit-transition: background-color .25s ease-in-out; } -.placeholder:hover, -.placeholder:active, +.stacked-content .placeholder:hover, +.stacked-content .placeholder:active, .stack__preview--default:hover, -.stack__preview--default:active -{ +.stack__preview--default:active { background-color: #f5f5f5; } -.placeholder .icon, -.stack__preview--default .icon -{ +.stacked-content .placeholder .icon, +.stack__preview--default .icon { font-size: 60px; line-height: 60px; color: rgba(0,0,0, 0.1); } -.placeholder h3, -.stack__preview--default h3 -{ +.stacked-content .placeholder h3, +.stack__preview--default h3 { color: #343434; font-size: 14px; font-weight: bold; @@ -68,52 +62,43 @@ margin: 0; } -.placeholder -{ +.stacked-content .placeholder { border: 2px dashed #d9d9d9; background-color: #fff; } -.placeholder, -.placeholder * -{ +.stacked-content .placeholder, +.stacked-content .placeholder * { transition: .25s ease-in-out; -moz-transition: .25s ease-in-out; -webkit-transition: .25s ease-in-out; } -.placeholder:hover -{ +.stacked-content .placeholder:hover { border-color: #2e8aea; background-color: #fff; } -.placeholder:hover * -{ +.stacked-content .placeholder:hover * { color: #2e8aea; } -.stack__buttons -{ +.stack__buttons { position: absolute; right: -12px; top: 10px; - background-color: #2e8aea; color: white; opacity: 0; - transition: opacity .25s ease-in-out; -moz-transition: opacity .25s ease-in-out; -webkit-transition: opacity .25s ease-in-out; - -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); } -.stack__buttons:after -{ +.stack__buttons:after { position: absolute; bottom: -12px; right: 0; @@ -125,23 +110,19 @@ border-color: #1960ab transparent transparent transparent; } -.stack__buttons .umb_confirm-action__overlay -{ +.stack__buttons .umb_confirm-action__overlay { position: relative; display: inline-block; left: 0; z-index: 5; } -.stack__buttons .umb_confirm-action__overlay-action -{ +.stack__buttons .umb_confirm-action__overlay-action { margin: 0 !important; background-color: #2e8aea; - -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; - -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; @@ -149,8 +130,7 @@ } .stack__preview:hover + .stack__buttons, -.stack__buttons:hover -{ +.stack__buttons:hover { opacity: 1; } @@ -161,8 +141,7 @@ .stack__button, .stack__add-button, -.stack__buttons .umb_confirm-action__overlay-action -{ +.stack__buttons .umb_confirm-action__overlay-action { display: inline-block; background-color: #2e8aea; color: white !important; @@ -178,8 +157,7 @@ .stack__button:hover, .stack__add-button:hover, .stack__buttons .umb_confirm-action__overlay-action.-cancel:hover, -.stack__buttons .umb_confirm-action__overlay-action.-confirm:hover -{ +.stack__buttons .umb_confirm-action__overlay-action.-confirm:hover { color: white !important; text-decoration: none !important; } @@ -192,103 +170,85 @@ background-color: #e74c3c; } -.stack__add-button -{ +.stack__add-button { -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; z-index: 20; } -.stack__add-bar -{ +.stack__add-bar { position: relative; height: 10px; z-index: 15; } -.stack__add-bar .stack__add-button -{ +.stack__add-bar .stack__add-button { position: absolute; left: 50%; top: 50%; margin: -15px 0 0 -15px; opacity: 0; - transition: opacity .0s ease-in-out; -moz-transition: opacity .0s ease-in-out; -webkit-transition: opacity .0s ease-in-out; - -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); } -.stack__add-bar:hover -{ +.stack__add-bar:hover { margin: -10px 0; height: 30px; } -.stack__item:first-child .stack__add-bar--top:hover -{ +.stack__item:first-child .stack__add-bar--top:hover { margin: 0 0 -10px; height: 20px; } -.stack__add-bar:hover .stack__add-button -{ +.stack__add-bar:hover .stack__add-button { opacity: 1; - transition-duration: .25s; -moz-transition-duration: .25s; -webkit-transition-duration: .25s; - -webkit-transition-delay: .05s; -moz-transition-delay: .05s; transition-delay: .05s; } -.stack__item.ui-sortable-placeholder -{ +.stack__item.ui-sortable-placeholder { top: 5px; height: 2px !important; visibility: visible !important; background-color: #2e8aea; } -.stack__sortable-helper -{ +.stack__sortable-helper { overflow: visible; } -.stack__sortable-helper > div -{ +.stack__sortable-helper > div { font-size: 20px; position: absolute; top: -20px; left: 50%; - width: 40px; height: 40px; line-height: 40px; text-align: center; background-color: #2e8aea; color: white; - margin: 0 0 0 -20px; - -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; - -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.25); } -.no-overflow -{ +.stack__buttons .no-overflow { max-width: 100%; overflow: hidden; -} \ No newline at end of file +} diff --git a/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/js/stackedcontent.controllers.js b/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/js/stackedcontent.controllers.js index cfddc6b..5e1d0cb 100644 --- a/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/js/stackedcontent.controllers.js +++ b/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/js/stackedcontent.controllers.js @@ -2,7 +2,6 @@ "$scope", "editorState", - "innerContentService", "Our.Umbraco.StackedContent.Resources.StackedContentResources", @@ -13,7 +12,7 @@ $scope.prompts = {}; $scope.model.value = $scope.model.value || []; - $scope.canAdd = function() { + $scope.canAdd = function () { return (!$scope.model.config.maxItems || $scope.model.config.maxItems == 0 || $scope.model.value.length < $scope.model.config.maxItems) && $scope.model.config.singleItemMode != "1"; } @@ -23,7 +22,7 @@ $scope.addContent = function (evt, idx) { $scope.overlayConfig.event = evt; - $scope.overlayConfig.data = { model: null, idx: idx, action:"add" }; + $scope.overlayConfig.data = { model: null, idx: idx, action: "add" }; $scope.overlayConfig.show = true; } @@ -33,7 +32,7 @@ $scope.overlayConfig.show = true; } - $scope.deleteContent = function(evt, idx) { + $scope.deleteContent = function (evt, idx) { $scope.model.value.splice(idx, 1); } @@ -41,14 +40,14 @@ axis: 'y', cursor: "move", handle: ".stack__preview-wrapper", - helper: function() { + helper: function () { return $('
'); }, cursorAt: { - top: 0 + top: 0 }, - update: function(e, ui) { - _.each($scope.model.value, function(itm, idx) { + update: function (e, ui) { + _.each($scope.model.value, function (itm, idx) { innerContentService.populateName(itm, idx, $scope.model.config.contentTypes); }); } @@ -65,79 +64,90 @@ }); } - // Initialize - innerContentService.getScaffolds($scope.model.config.contentTypes).then(function(scaffolds) { + var previewEnabled = function () { + return $scope.model.config.disablePreview !== "1"; + } - // Stash scaffolds - $scope.scaffolds = scaffolds; - // Set overlay config - $scope.overlayConfig = { - propertyAlias: $scope.model.alias, - scaffolds: scaffolds, - show: false, - data: { - idx: 0, - model: null - }, - callback: function (data) { - innerContentService.populateName(data.model, data.idx, $scope.model.config.contentTypes); + // Set overlay config + $scope.overlayConfig = { + propertyAlias: $scope.model.alias, + contentTypes: $scope.model.config.contentTypes, + show: false, + data: { + idx: 0, + model: null + }, + callback: function (data) { + innerContentService.populateName(data.model, data.idx, $scope.model.config.contentTypes); + if (previewEnabled()) { scResources.getPreviewMarkup(data.model, editorState.current.id).then(function (markup) { if (markup) { $scope.markup[data.model.key] = markup; } }); + } - if (data.action === "add") { - $scope.model.value.splice(data.idx, 0, data.model); - } else if (data.action === "edit") { - $scope.model.value[data.idx] = data.model; - } + if (!($scope.model.value instanceof Array)) { + $scope.model.value = []; + } + + if (data.action === "add") { + $scope.model.value.splice(data.idx, 0, data.model); + } else if (data.action === "edit") { + $scope.model.value[data.idx] = data.model; } } + } - // Initialize value - if ($scope.model.value.length > 0) { + // Initialize value + if ($scope.model.value.length > 0) { - // Model is ready so set inited - $scope.inited = true; + // Model is ready so set inited + $scope.inited = true; - // Sync icons incase it's changes on the doctype - var aliases = _.uniq($scope.model.value.map(function (itm) { - return itm.icContentTypeAlias; - })); + // Sync icons incase it's changes on the doctype + var aliases = _.uniq($scope.model.value.map(function (itm) { + return itm.icContentTypeAlias; + })); - innerContentService.getContentTypeIcons(aliases).then(function (data) { - _.each($scope.model.value, function (itm) { - if (data.hasOwnProperty(itm.icContentTypeAlias)) { - itm.icon = data[itm.icContentTypeAlias]; - } - }); + innerContentService.getContentTypeIcons(aliases).then(function (data) { + _.each($scope.model.value, function (itm) { + if (data.hasOwnProperty(itm.icContentTypeAlias)) { + itm.icon = data[itm.icContentTypeAlias]; + } + }); - // Try loading previews + // Try loading previews + if (previewEnabled()) { loadPreviews(); - }); + } + }); - } else if ($scope.model.config.singleItemMode === "1") { + } else if ($scope.model.config.singleItemMode === "1") { - // Initialise single item mode model - $scope.model.value = [innerContentService.createDefaultDbModel($scope.scaffolds[0])]; + // Initialise single item mode model + innerContentService.createDefaultDbModel($scope.model.config.contentTypes[0]).then(function (v) { + + $scope.model.value = [v]; // Model is ready so set inited $scope.inited = true; // Try loading previews - loadPreviews(); + if (previewEnabled()) { + loadPreviews(); + } - } else { - - // Model is ready so set inited - $scope.inited = true; + }); - } + } else { + + // Model is ready so set inited + $scope.inited = true; - }); + } } ]); \ No newline at end of file diff --git a/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/js/stackedcontent.resources.js b/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/js/stackedcontent.resources.js index cbceb46..93c4b63 100644 --- a/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/js/stackedcontent.resources.js +++ b/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/js/stackedcontent.resources.js @@ -6,7 +6,7 @@ $http({ url: "/umbraco/backoffice/StackedContent/StackedContentApi/GetPreviewMarkup", method: "POST", - params: { parentId : parentId }, + params: { parentId: parentId }, data: data }), 'Failed to retrieve preview markup' diff --git a/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/views/stackedcontent.html b/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/views/stackedcontent.html index 65f8632..517e56b 100644 --- a/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/views/stackedcontent.html +++ b/src/Our.Umbraco.StackedContent/Web/UI/App_Plugins/StackedContent/views/stackedcontent.html @@ -1,48 +1,54 @@ -
+
- - - + -
+
-
+ + + -
-
- -
-
- - -

{{itm.name}}

-
- -
-
-
-
- - - +
+ +
+ +
+
+ +
+
+
-
+
+ +
-
-
-
+ + - - +
\ No newline at end of file diff --git a/src/Our.Umbraco.StackedContent/packages.config b/src/Our.Umbraco.StackedContent/packages.config index 7a9071e..a840fe4 100644 --- a/src/Our.Umbraco.StackedContent/packages.config +++ b/src/Our.Umbraco.StackedContent/packages.config @@ -27,8 +27,7 @@ - - +