Compare commits

..

128 Commits

Author SHA1 Message Date
Mads Rasmussen 244ee646b9 Revert "update content when changing variation"
This reverts commit b487436d93.
2016-04-07 12:45:33 +02:00
Mads Rasmussen b487436d93 update content when changing variation 2016-04-07 12:38:05 +02:00
Mads Rasmussen 321b1a3964 disable autocomplete on editor name input 2016-04-07 11:17:05 +02:00
Mads Rasmussen f6b1971243 disable name input for a marketing variation 2016-04-07 11:05:21 +02:00
Simon Busborg ab1e412b4b Active in quickswitcher 2016-04-07 10:51:39 +02:00
Mads Rasmussen 2c866e8326 add spanish 2016-04-07 10:24:52 +02:00
Mads Rasmussen 433563c10b select first variation 2016-04-06 20:03:49 +02:00
Mads Rasmussen 95b91cb55f a bit fine tuning of selected variation and language 2016-04-06 19:29:29 +02:00
Mads Rasmussen d070b869a3 fix error in css 2016-04-06 16:09:26 +02:00
Mads Rasmussen 82bcb8bb8a Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-04-06 16:07:49 +02:00
Mads Rasmussen 8cbd0281aa set limit on apps 2016-04-06 16:07:12 +02:00
Simon Busborg 148067f119 apps 2016-04-06 16:01:16 +02:00
Mads Rasmussen 9d79577833 add activity app 2016-04-06 15:05:16 +02:00
Simon Busborg c24918aeb7 standard width on apps 2016-04-06 14:15:10 +02:00
Simon Busborg f7a814714c even spacing between apps 2016-04-06 11:36:34 +02:00
Simon Busborg 3200a7fd1a Splitview close 2016-04-06 11:23:38 +02:00
Mads Rasmussen 7983aedf53 make tabs to apps 2016-04-06 11:22:18 +02:00
Mads Rasmussen c31efa3f54 only show variations for active language + add sortable on variations 2016-04-05 15:16:55 +02:00
Simon Busborg c98a98dd71 Tabs 2016-04-05 15:07:35 +02:00
Mads Rasmussen ee3965521d bring back old tabs markup to enable active state 2016-04-05 14:34:57 +02:00
Mads Rasmussen 3d90c0d3d7 add segments to create variation + fix edit variation 2016-04-05 12:31:00 +02:00
Mads Rasmussen bc60aa1688 remove analytics from content plugins 2016-04-05 11:46:08 +02:00
Mads Rasmussen 5c90043298 hide the split view divider when there is no split view open 2016-04-05 11:44:16 +02:00
Mads Rasmussen 0f784151cb close split view on route change 2016-04-05 09:47:58 +02:00
Mads Rasmussen 681512da8c Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-04-04 19:04:53 +02:00
Mads Rasmussen b17770d6c7 fake split views 2016-04-04 19:04:36 +02:00
Simon Busborg 745b536f63 Fixed divider 2016-04-04 12:55:08 +02:00
Mads Rasmussen 738289cd78 comment out sync switcher and property overlay 2016-04-01 11:19:13 +02:00
Simon Busborg 77d30e8484 fixed colors 2016-03-30 15:02:53 +02:00
Simon Busborg 347fb3a90d demoed version of splitview (not pretty) 2016-03-30 12:24:01 +02:00
Mads Rasmussen 39bdc1bc78 handle 1sites with 1 language 2016-03-30 09:04:26 +02:00
Simon Busborg a3dcdb159b Removed tags, added tags checkboxes, styling in general for variations 2016-03-29 15:38:50 +02:00
Simon Busborg 9656659ecd overview 2016-03-29 13:46:11 +02:00
Mads Rasmussen d679a4e697 make it possible to fake variation content 2016-03-29 12:18:47 +02:00
Mads Rasmussen c81a034c69 only show variations toggle if there are any variations 2016-03-23 14:23:02 +01:00
Mads Rasmussen a519d38b54 Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-23 14:13:10 +01:00
Mads Rasmussen cf4c09f41f When click on item in variation quick switcher - change context in header 2016-03-23 14:12:57 +01:00
Simon Busborg bd3096c3ec changed quick toggler 2016-03-23 13:49:07 +01:00
Simon Busborg 1bbf104b9f variations overview 2016-03-23 13:41:26 +01:00
Mads Rasmussen 4f1e44d42e get variations from helper service so they are in sync 2016-03-23 13:39:26 +01:00
Simon Busborg fa68a9472b quickswitcher update 2016-03-23 11:54:54 +01:00
Mads Rasmussen efb2b744fc Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-23 11:52:26 +01:00
Mads Rasmussen 9018c4ef79 add functionality to create, edit and delete variations - missing styling + segments 2016-03-23 11:52:04 +01:00
Simon Busborg dfce0aa0cb changed width of container 2016-03-23 08:59:52 +01:00
Mads Rasmussen 131c9a6fe1 move description inline 2016-03-22 16:24:18 +01:00
Mads Rasmussen 555589ef3b change colour on tags + bring back create variation link 2016-03-22 15:10:46 +01:00
Mads Rasmussen b099d35981 Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/less/components/umb-variations.less
#	src/Umbraco.Web.UI.Client/src/views/components/umb-variations.html
2016-03-22 14:24:03 +01:00
Mads Rasmussen e3bc3091f7 add dynamic data to variations overview + clean up UI + add segments to variations overview 2016-03-22 14:17:20 +01:00
Simon Busborg 320ed93b14 active quick switcher 2016-03-22 13:50:39 +01:00
Simon Busborg c71ce7ef2a changed lang options 2016-03-22 10:59:12 +01:00
Mads Rasmussen c0ea46c9f1 split languages and variations in dropdown. Show selected in header 2016-03-22 10:55:33 +01:00
Mads Rasmussen 533443fd25 remove sidebar on variations 2016-03-22 10:47:00 +01:00
Simon Busborg e76658373f Added lang groups for variations 2016-03-22 10:13:05 +01:00
Mads Rasmussen a77330a592 add a bit a variations toggle styling 2016-03-21 10:39:48 +01:00
Mads Rasmussen 2f5e9ee8c4 change sync off label + smaller font size 2016-03-21 10:01:36 +01:00
Mads Rasmussen f252590a1c Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-18 14:40:23 +01:00
Mads Rasmussen fa4bdac78a style editor overlay label 2016-03-18 14:39:18 +01:00
Simon Busborg e268945077 fixed animate bug 2016-03-18 14:38:04 +01:00
Simon Busborg b428fb2211 fixed search / scrollable area 2016-03-18 14:26:24 +01:00
Mads Rasmussen bfc098e5e0 make change variation work work editor view 2016-03-18 14:09:07 +01:00
Simon Busborg d9b58e80fe added search to variations 2016-03-18 12:40:16 +01:00
Simon Busborg a7a860bbcd fixed dropdown 2016-03-18 12:03:05 +01:00
Mads Rasmussen fa277a4a5d fix styling on dropdown 2016-03-18 11:58:57 +01:00
Mads Rasmussen 7e1df76db3 move dropdown logic 2016-03-18 11:26:46 +01:00
Simon Busborg 9c33e292ae moved component to label 2016-03-18 11:13:49 +01:00
Mads Rasmussen 75edd645c6 add basic functionality to edit content and change which variation to sync content from 2016-03-17 21:31:09 +01:00
Mads Rasmussen 6adfdbf7dd clear variations when a new master i set 2016-03-17 20:30:29 +01:00
Mads Rasmussen 5453d86a46 make sidebar title a little smaller 2016-03-17 20:09:58 +01:00
Mads Rasmussen 6d4146b9c6 add wrappers and title to sidebar 2016-03-17 20:07:57 +01:00
Simon Busborg a93d98933f fixed z-index on buttons 2016-03-17 15:20:34 +01:00
Mads Rasmussen cf28c0ca5e change text and icon on sync toggle 2016-03-17 15:12:56 +01:00
Mads Rasmussen 435434b859 position toggle top 0 and right 0 2016-03-17 15:10:07 +01:00
Mads Rasmussen e93b057a5f make sync button a bit smaller 2016-03-17 15:02:38 +01:00
Simon Busborg e8d167faf0 added get content 2016-03-17 14:42:26 +01:00
Mads Rasmussen ab1322f789 started on dropdown 2016-03-17 12:39:40 +01:00
Simon Busborg 36abb83ff2 moved psuedo element to the property editor markup 2016-03-17 11:54:01 +01:00
Simon Busborg 0d62e62fda changed inactive state 2016-03-17 11:41:38 +01:00
Simon Busborg d25a01d9c9 added overlay to variation picker 2016-03-17 11:22:52 +01:00
Simon Busborg 1da55e4dde Fixed subview editor header 2016-03-17 10:46:08 +01:00
Simon Busborg c346ec1282 search width 2016-03-14 11:06:03 +01:00
Simon Busborg 556d4b4c11 search 2016-03-11 14:07:05 +01:00
Mads Rasmussen 7d0d58f7c2 fix notifications width 2016-03-11 13:53:50 +01:00
Mads Rasmussen a0618f401f Merge remote-tracking branch 'origin/temp-maurice' into temp-maurice 2016-03-11 13:19:48 +01:00
Mads Rasmussen 34645460fb Set position relative to contain absolute elements 2016-03-11 13:19:15 +01:00
Simon Busborg 43b534c3b1 tabs activity 2016-03-11 10:57:44 +01:00
Mads Rasmussen bc29b2e235 copy search functionality to top bar 2016-03-11 10:52:45 +01:00
Simon Busborg d6c226d41a Added navigation to sidebars 2016-03-10 15:29:41 +01:00
Simon Busborg 14d8b634b5 Acitvity feed 2016-03-10 12:45:08 +01:00
Mads Rasmussen c4e41c1df6 add a content wrapper to add padding 2016-03-10 12:20:46 +01:00
Mads Rasmussen 788efeb098 remove horizontal scrollbar in media folders 2016-03-10 11:57:00 +01:00
Mads Rasmussen 71916af49c hide generic properties tab content 2016-03-10 11:56:31 +01:00
Mads Rasmussen 55e62c01e4 hide tab instead of removing it.. now we can save again 2016-03-10 11:43:53 +01:00
Mads Rasmussen fa8dc5ace4 remove console.logs 2016-03-10 11:22:08 +01:00
Simon Busborg 671d99f455 changed menu state 2016-03-10 11:09:51 +01:00
Mads Rasmussen d681a84800 Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-10 10:59:07 +01:00
Mads Rasmussen 440e2a7d56 bring back dashboards 2016-03-10 10:58:45 +01:00
Simon Busborg 2f8ec7bd29 Added more and added sidebar navigation status 2016-03-10 10:58:07 +01:00
Simon Busborg 5105cf890d displaying apps center 2016-03-10 10:04:32 +01:00
Mads Rasmussen 88a0f21328 align sub view header content left and right 2016-03-10 09:58:52 +01:00
Mads Rasmussen cd1ea78825 contain absolute positioned elements inside content 2016-03-10 09:33:57 +01:00
Simon Busborg ca4ff98c5f navigation fluf 2016-03-10 09:18:26 +01:00
Mads Rasmussen 339e1dc94e WIP bring in variation ideas + a couple of placeholder subviews 2016-03-10 09:16:37 +01:00
Mads Rasmussen a84c6e9dff remove generic properties tab 2016-03-10 09:15:29 +01:00
Simon Busborg ba927d1962 fixed tree navigation 2016-03-09 20:40:34 +01:00
Simon Busborg ee30f10357 Dropdown 2016-03-09 20:21:14 +01:00
Simon Busborg 478fe51651 Added tree toggler 2016-03-09 15:21:43 +01:00
Mads Rasmussen 5694beafef add subviews to content 2016-03-08 14:49:04 +01:00
Mads Rasmussen 2a1e9e30ae add generic properties icon 2016-03-07 10:01:33 +01:00
Mads Rasmussen ef5bf29b07 remove background color on footer - wireframe style 2016-03-07 09:58:42 +01:00
Mads Rasmussen 7b521e6857 um tree nav - set overflow to auto 2016-03-07 09:51:35 +01:00
Mads Rasmussen 4135e30834 add tabs to media 2016-03-05 14:03:16 +01:00
Mads Rasmussen 2b1bf0b966 add scroll to tree 2016-03-04 18:42:06 +01:00
Mads Rasmussen 6bc2ce19f5 hide search in tree 2016-03-04 18:13:21 +01:00
Mads Rasmussen 67efc1906a add editor toolbar directive - move tabs outside header for content section 2016-03-04 18:12:53 +01:00
Mads Rasmussen 8b62d09e64 remove background from editor header - wireframe look 2016-03-04 18:09:34 +01:00
Mads Rasmussen 5c6bbfb423 remove background + add border to navigation bar - wireframe look 2016-03-04 18:09:04 +01:00
Mads Rasmussen 97ff32245d fix navigation height 2016-03-04 14:43:56 +01:00
Simon Busborg b7549ad644 Fixed second header 🌮 2016-03-04 11:31:56 +01:00
Mads Rasmussen 802fe45614 Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-04 11:05:06 +01:00
Mads Rasmussen 253a4520b0 tighten up tree a bit 2016-03-04 11:04:41 +01:00
Simon Busborg b6877dc4ce fixed header size 2016-03-04 11:03:50 +01:00
Simon Busborg 27a031ea12 Updated recess – fixed content scroll 2016-03-04 10:59:19 +01:00
Mads Rasmussen 0e2212bd40 less padding and smaller font size on top navigation 2016-03-04 10:34:18 +01:00
Simon Busborg 8ee414793f flex - content 2016-03-04 10:26:33 +01:00
Simon Busborg 1dddc06ae7 added tree 🌳 2016-03-03 16:12:07 +01:00
Simon Busborg 3d253b79e4 Added very slick navigation 🔥 2016-03-03 14:26:37 +01:00
Mads Rasmussen e7542bc455 add functionality to top bar navigation - needs styling 2016-03-03 12:56:38 +01:00
Simon Busborg 43ab5a8e2e Nuked interface 2016-03-03 10:38:01 +01:00
249 changed files with 4862 additions and 5765 deletions
+1
View File
@@ -72,6 +72,7 @@
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.xml" target="lib\UmbracoExamine.xml" />
<file src="tools\install.core.ps1" target="tools\install.ps1" />
<file src="tools\uninstall.core.ps1" target="tools\uninstall.ps1" />
<!-- Added to be able to produce a symbols package -->
<file src="..\_BuildOutput\bin\SQLCE4Umbraco.pdb" target="lib" />
+2 -1
View File
@@ -17,7 +17,7 @@
<dependencies>
<dependency id="UmbracoCms.Core" version="[$version$]" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 9.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.2, 4.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.0, 4.0.0)" />
</dependencies>
</metadata>
<files>
@@ -33,6 +33,7 @@
<file src="..\_BuildOutput\WebApp\umbraco\**" target="UmbracoFiles\umbraco" />
<file src="..\_BuildOutput\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
<file src="tools\install.ps1" target="tools\install.ps1" />
<file src="tools\uninstall.ps1" target="tools\uninstall.ps1" />
<file src="tools\Readme.txt" target="tools\Readme.txt" />
<file src="tools\ReadmeUpgrade.txt" target="tools\ReadmeUpgrade.txt" />
<file src="tools\Web.config.install.xdt" target="Content\Web.config.install.xdt" />
@@ -21,8 +21,6 @@
<appSettings xdt:Transform="InsertIfMissing" />
<appSettings>
<add key="owin:appStartup" value="UmbracoDefaultOwinStartup" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
<add key="Umbraco.ModelsBuilder.Enable" value="false" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
<add key="Umbraco.ModelsBuilder.ModelsMode" value="Nothing" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
</appSettings>
<umbracoConfiguration xdt:Transform="InsertIfMissing">
+48
View File
@@ -0,0 +1,48 @@
param($installPath, $toolsPath, $package, $project)
Write-Host "installPath:" "${installPath}"
Write-Host "toolsPath:" "${toolsPath}"
Write-Host " "
if ($project) {
# Create paths and list them
$projectPath = (Get-Item $project.Properties.Item("FullPath").Value).FullName
Write-Host "projectPath:" "${projectPath}"
$backupPath = Join-Path $projectPath "App_Data\NuGetBackup"
Write-Host "backupPath:" "${backupPath}"
$umbracoBinFolder = Join-Path $projectPath "bin"
Write-Host "umbracoBinFolder:" "${umbracoBinFolder}"
# Remove backups
Write-Host "removing backups:" "${backupPath}"
if(Test-Path $backupPath) { Remove-Item -Recurse -Force $backupPath -Confirm:$false }
# Delete files Umbraco ships with
Write-Host "removing dlls:" "${umbracoBinFolder}"
if(Test-Path $umbracoBinFolder\businesslogic.dll) { Remove-Item $umbracoBinFolder\businesslogic.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\cms.dll) { Remove-Item $umbracoBinFolder\cms.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\controls.dll) { Remove-Item $umbracoBinFolder\controls.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\interfaces.dll) { Remove-Item $umbracoBinFolder\interfaces.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\log4net.dll) { Remove-Item $umbracoBinFolder\log4net.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\Microsoft.ApplicationBlocks.Data.dll) { Remove-Item $umbracoBinFolder\Microsoft.ApplicationBlocks.Data.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\SQLCE4Umbraco.dll) { Remove-Item $umbracoBinFolder\SQLCE4Umbraco.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\System.Data.SqlServerCe.dll) { Remove-Item $umbracoBinFolder\System.Data.SqlServerCe.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\System.Data.SqlServerCe.Entity.dll) { Remove-Item $umbracoBinFolder\System.Data.SqlServerCe.Entity.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\TidyNet.dll) { Remove-Item $umbracoBinFolder\TidyNet.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.dll) { Remove-Item $umbracoBinFolder\umbraco.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\Umbraco.Core.dll) { Remove-Item $umbracoBinFolder\Umbraco.Core.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.DataLayer.dll) { Remove-Item $umbracoBinFolder\umbraco.DataLayer.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.editorControls.dll) { Remove-Item $umbracoBinFolder\umbraco.editorControls.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.MacroEngines.dll) { Remove-Item $umbracoBinFolder\umbraco.MacroEngines.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.providers.dll) { Remove-Item $umbracoBinFolder\umbraco.providers.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\Umbraco.Web.UI.dll) { Remove-Item $umbracoBinFolder\Umbraco.Web.UI.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\UmbracoExamine.dll) { Remove-Item $umbracoBinFolder\UmbracoExamine.dll -Force -Confirm:$false }
$amd64Folder = Join-Path $umbracoBinFolder "amd64"
if(Test-Path $amd64Folder) { Remove-Item $amd64Folder -Force -Recurse -Confirm:$false }
$x86Folder = Join-Path $umbracoBinFolder "x86"
if(Test-Path $x86Folder) { Remove-Item $x86Folder -Force -Recurse -Confirm:$false }
}
+39
View File
@@ -0,0 +1,39 @@
param($installPath, $toolsPath, $package, $project)
Write-Host "installPath:" "${installPath}"
Write-Host "toolsPath:" "${toolsPath}"
Write-Host " "
if ($project) {
# Create paths and list them
$projectPath = (Get-Item $project.Properties.Item("FullPath").Value).FullName
Write-Host "projectPath:" "${projectPath}"
$backupPath = Join-Path $projectPath "App_Data\NuGetBackup"
Write-Host "backupPath:" "${backupPath}"
$appBrowsers = Join-Path $projectPath "App_Browsers"
Write-Host "appBrowsers:" "${appBrowsers}"
$appData = Join-Path $projectPath "App_Data"
Write-Host "appData:" "${appData}"
# Remove backups
Write-Host "removing backups:" "${backupPath}"
if(Test-Path $backupPath) { Remove-Item -Recurse -Force $backupPath -Confirm:$false }
# Remove app_data files
Write-Host "removing app_data files:" "${appData}"
if(Test-Path $appData\packages) { Remove-Item $appData\packages -Recurse -Force -Confirm:$false }
Write-Host "removing app_browsers:" "${appBrowsers}"
if(Test-Path $appBrowsers\Form.browser) { Remove-Item $appBrowsers\Form.browser -Force -Confirm:$false }
if(Test-Path $appBrowsers\w3cvalidator.browser) { Remove-Item $appBrowsers\w3cvalidator.browser -Force -Confirm:$false }
# Remove umbraco and umbraco_files
$umbracoFolder = Join-Path $projectPath "Umbraco"
Write-Host "removing umbraco folder:" "${umbracoFolder}"
if(Test-Path $umbracoFolder) { Remove-Item $umbracoFolder -Recurse -Force -Confirm:$false }
$umbracoClientFolder = Join-Path $projectPath "Umbraco_Client"
Write-Host "removing umbraco client folder:" "${umbracoClientFolder}"
if(Test-Path $umbracoClientFolder) { Remove-Item $umbracoClientFolder -Recurse -Force -Confirm:$false }
}
+1 -1
View File
@@ -1,2 +1,2 @@
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
7.4.2
7.4.1
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.4.2")]
[assembly: AssemblyInformationalVersion("7.4.2")]
[assembly: AssemblyFileVersion("7.4.1")]
[assembly: AssemblyInformationalVersion("7.4.1")]
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.4.2");
private static readonly Version Version = new Version("7.4.1");
/// <summary>
/// Gets the current version of Umbraco.
@@ -5,10 +5,8 @@ using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Linq.Expressions;
using System.Text;
using System.Web.Services.Description;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Dynamics
{
@@ -22,20 +20,6 @@ namespace Umbraco.Core.Dynamics
/// </summary>
private static readonly ConcurrentDictionary<Tuple<Type, string, int>, MethodInfo[]> MethodCache = new ConcurrentDictionary<Tuple<Type, string, int>, MethodInfo[]>();
private static IEnumerable<Type> GetTypes(Assembly a)
{
try
{
return TypeFinder.GetTypesWithFormattedException(a);
}
catch (ReflectionTypeLoadException ex)
{
// is this going to flood the log?
LogHelper.Error(typeof (ExtensionMethodFinder), "Failed to get types.", ex);
return Enumerable.Empty<Type>();
}
}
/// <summary>
/// Returns the enumerable of all extension method info's in the app domain = USE SPARINGLY!!!
/// </summary>
@@ -52,7 +36,7 @@ namespace Umbraco.Core.Dynamics
// assemblies that contain extension methods
.Where(a => a.IsDefined(typeof (ExtensionAttribute), false))
// types that contain extension methods
.SelectMany(a => GetTypes(a)
.SelectMany(a => a.GetTypes()
.Where(t => t.IsDefined(typeof (ExtensionAttribute), false) && t.IsSealed && t.IsGenericType == false && t.IsNested == false))
// actual extension methods
.SelectMany(t => t.GetMethods(BindingFlags.Static | BindingFlags.Public)
@@ -61,9 +45,9 @@ namespace Umbraco.Core.Dynamics
.Concat(typeof (Enumerable).GetMethods(BindingFlags.Static | BindingFlags.Public))
//If we don't do this then we'll be scanning all assemblies each time!
.ToArray(),
//only cache for 5 minutes
timeout: TimeSpan.FromMinutes(5),
timeout: TimeSpan.FromMinutes(5),
//each time this is accessed it will be for 5 minutes longer
isSliding:true);
@@ -73,7 +57,7 @@ namespace Umbraco.Core.Dynamics
/// Returns all extension methods found matching the definition
/// </summary>
/// <param name="runtimeCache">
/// The runtime cache is used to temporarily cache all extension methods found in the app domain so that
/// The runtime cache is used to temporarily cache all extension methods found in the app domain so that
/// while we search for individual extension methods, the process will be reasonably 'quick'. We then statically
/// cache the MethodInfo's that we are looking for and then the runtime cache will expire and give back all that memory.
/// </param>
@@ -94,7 +78,7 @@ namespace Umbraco.Core.Dynamics
{
var candidates = GetAllExtensionMethodsInAppDomain(runtimeCache);
// filter by name
// filter by name
var filtr1 = candidates.Where(m => m.Name == name);
// filter by args count
@@ -118,7 +102,7 @@ namespace Umbraco.Core.Dynamics
return filtr3.ToArray();
});
}
private static MethodInfo DetermineMethodFromParams(IEnumerable<MethodInfo> methods, Type genericType, IEnumerable<object> args)
@@ -139,12 +123,12 @@ namespace Umbraco.Core.Dynamics
types = method.GetParameters().Select(pi => pi.ParameterType).Skip(1)
});
//This type comparer will check
//This type comparer will check
var typeComparer = new DelegateEqualityComparer<Type>(
//Checks if the argument type passed in can be assigned from the parameter type in the method. For
//Checks if the argument type passed in can be assigned from the parameter type in the method. For
// example, if the argument type is HtmlHelper<MyModel> but the method parameter type is HtmlHelper then
// it will match because the argument is assignable to that parameter type and will be able to execute
TypeHelper.IsTypeAssignableFrom,
TypeHelper.IsTypeAssignableFrom,
//This will not ever execute but if it does we need to get the hash code of the string because the hash
// code of a type is random
type => type.FullName.GetHashCode());
@@ -175,7 +159,7 @@ namespace Umbraco.Core.Dynamics
.ToArray();
var methods = GetAllExtensionMethods(runtimeCache, thisType, name, args.Length).ToArray();
return DetermineMethodFromParams(methods, genericType, args);
}
}
+20 -59
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using Semver;
using Umbraco.Core.Configuration;
using Umbraco.Core.Persistence.Migrations;
namespace Umbraco.Core.Events
@@ -14,50 +13,24 @@ namespace Umbraco.Core.Events
/// </summary>
/// <param name="eventObject"></param>
/// <param name="targetVersion"></param>
/// <param name="productName"></param>
/// <param name="canCancel"></param>
/// <param name="configuredVersion"></param>
public MigrationEventArgs(IList<IMigration> eventObject, SemVersion configuredVersion, SemVersion targetVersion, string productName, bool canCancel)
: this(eventObject, null, configuredVersion, targetVersion, productName, canCancel)
{ }
/// <summary>
/// Constructor accepting multiple migrations that are used in the migration runner
/// </summary>
/// <param name="eventObject"></param>
/// <param name="targetVersion"></param>
/// <param name="canCancel"></param>
/// <param name="configuredVersion"></param>
[Obsolete("Use constructor accepting a product name instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, SemVersion configuredVersion, SemVersion targetVersion, bool canCancel)
: this(eventObject, null, configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName, canCancel)
{ }
[Obsolete("Use constructor accepting SemVersion instances and a product name instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, Version configuredVersion, Version targetVersion, bool canCancel)
: this(eventObject, null, new SemVersion(configuredVersion), new SemVersion(targetVersion), GlobalSettings.UmbracoMigrationName, canCancel)
{ }
/// <summary>
/// Constructor accepting multiple migrations that are used in the migration runner
/// </summary>
/// <param name="eventObject"></param>
/// <param name="migrationContext"></param>
/// <param name="targetVersion"></param>
/// <param name="productName"></param>
/// <param name="canCancel"></param>
/// <param name="configuredVersion"></param>
internal MigrationEventArgs(IList<IMigration> eventObject, MigrationContext migrationContext, SemVersion configuredVersion, SemVersion targetVersion, string productName, bool canCancel)
: base(eventObject, canCancel)
{
MigrationContext = migrationContext;
ConfiguredSemVersion = configuredVersion;
TargetSemVersion = targetVersion;
ProductName = productName;
}
[Obsolete("Use constructor accepting UmbracoVersion instances instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, Version configuredVersion, Version targetVersion, bool canCancel)
: base(eventObject, canCancel)
{
ConfiguredSemVersion = new SemVersion(configuredVersion);
TargetSemVersion = new SemVersion(targetVersion);
}
/// <summary>
/// Constructor accepting multiple migrations that are used in the migration runner
/// </summary>
@@ -66,15 +39,12 @@ namespace Umbraco.Core.Events
/// <param name="targetVersion"></param>
/// <param name="canCancel"></param>
/// <param name="configuredVersion"></param>
[Obsolete("Use constructor accepting a product name instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
internal MigrationEventArgs(IList<IMigration> eventObject, MigrationContext migrationContext, SemVersion configuredVersion, SemVersion targetVersion, bool canCancel)
: base(eventObject, canCancel)
{
MigrationContext = migrationContext;
ConfiguredSemVersion = configuredVersion;
TargetSemVersion = targetVersion;
ProductName = GlobalSettings.UmbracoMigrationName;
}
/// <summary>
@@ -83,28 +53,21 @@ namespace Umbraco.Core.Events
/// <param name="eventObject"></param>
/// <param name="configuredVersion"></param>
/// <param name="targetVersion"></param>
/// <param name="productName"></param>
public MigrationEventArgs(IList<IMigration> eventObject, SemVersion configuredVersion, SemVersion targetVersion, string productName)
: this(eventObject, null, configuredVersion, targetVersion, productName, false)
{ }
/// <summary>
/// Constructor accepting multiple migrations that are used in the migration runner
/// </summary>
/// <param name="eventObject"></param>
/// <param name="configuredVersion"></param>
/// <param name="targetVersion"></param>
[Obsolete("Use constructor accepting a product name instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, SemVersion configuredVersion, SemVersion targetVersion)
: this(eventObject, null, configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName, false)
{ }
: base(eventObject)
{
ConfiguredSemVersion = configuredVersion;
TargetSemVersion = targetVersion;
}
[Obsolete("Use constructor accepting SemVersion instances and a product name instead.")]
[Obsolete("Use constructor accepting UmbracoVersion instances instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, Version configuredVersion, Version targetVersion)
: this(eventObject, null, new SemVersion(configuredVersion), new SemVersion(targetVersion), GlobalSettings.UmbracoMigrationName, false)
{ }
: base(eventObject)
{
ConfiguredSemVersion = new SemVersion(configuredVersion);
TargetSemVersion = new SemVersion(targetVersion);
}
/// <summary>
/// Returns all migrations that were used in the migration runner
@@ -132,8 +95,6 @@ namespace Umbraco.Core.Events
public SemVersion TargetSemVersion { get; private set; }
public string ProductName { get; private set; }
internal MigrationContext MigrationContext { get; private set; }
}
}
+6 -3
View File
@@ -487,8 +487,11 @@ namespace Umbraco.Core.Models
var oldPropertyGroup = PropertyGroups.FirstOrDefault(x =>
x.PropertyTypes.Any(y => y.Alias == propertyTypeAlias));
// set new group
propertyType.PropertyGroupId = newPropertyGroup == null ? null : new Lazy<int>(() => newPropertyGroup.Id, false);
// reset PropertyGroupId, which will be re-evaluated when the content type
// is saved - what is important is group.PropertyTypes - see code in
// ContentTypeBaseRepository.PersistUpdatedBaseContentType
propertyType.PropertyGroupId = new Lazy<int>(() => default(int));
propertyType.ResetDirtyProperties(); // PropertyGroupId must not be dirty
// remove from old group, if any - add to new group, if any
if (oldPropertyGroup != null)
@@ -537,7 +540,7 @@ namespace Umbraco.Core.Models
// re-assign the group's properties to no group
foreach (var property in group.PropertyTypes)
{
property.PropertyGroupId = null;
property.PropertyGroupId = new Lazy<int>(() => 0);
_propertyTypes.Add(property);
}
+1 -7
View File
@@ -7,12 +7,6 @@ namespace Umbraco.Core.Models
/// </summary
public interface IMediaType : IContentTypeComposition
{
/// <summary>
/// Creates a deep clone of the current entity with its identity/alias and it's property identities reset
/// </summary>
/// <param name="newAlias"></param>
/// <returns></returns>
IMediaType DeepCloneWithResetIdentities(string newAlias);
}
}
-25
View File
@@ -38,30 +38,5 @@ namespace Umbraco.Core.Models
: base(parent, alias)
{
}
/// <summary>
/// Creates a deep clone of the current entity with its identity/alias and it's property identities reset
/// </summary>
/// <returns></returns>
public IMediaType DeepCloneWithResetIdentities(string alias)
{
var clone = (MediaType)DeepClone();
clone.Alias = alias;
clone.Key = Guid.Empty;
foreach (var propertyGroup in clone.PropertyGroups)
{
propertyGroup.ResetIdentity();
propertyGroup.ResetDirtyProperties(false);
}
foreach (var propertyType in clone.PropertyTypes)
{
propertyType.ResetIdentity();
propertyType.ResetDirtyProperties(false);
}
clone.ResetIdentity();
clone.ResetDirtyProperties(false);
return clone;
}
}
}
+1 -2
View File
@@ -221,9 +221,8 @@ namespace Umbraco.Core.Models
}
/// <summary>
/// Gets or sets the identifier of the PropertyGroup this PropertyType belongs to.
/// Gets or Sets the PropertyGroup's Id for which this PropertyType belongs
/// </summary>
/// <remarks>For generic properties, the value is <c>null</c>.</remarks>
[DataMember]
internal Lazy<int> PropertyGroupId
{
@@ -114,25 +114,10 @@ namespace Umbraco.Core.Models.PublishedContent
internal static void ClearContentType(int id)
{
Logging.LogHelper.Debug<PublishedContentType>("Clear content type w/id {0}.", () => id);
// we don't support "get all" at the moment - so, cheating
var all = ApplicationContext.Current.ApplicationCache.StaticCache.GetCacheItemsByKeySearch<PublishedContentType>("PublishedContentType_").ToArray();
// the one we want to clear
var clr = all.FirstOrDefault(x => x.Id == id);
if (clr == null) return;
// those that have that one in their composition aliases
// note: CompositionAliases contains all recursive aliases
var oth = all.Where(x => x.CompositionAliases.InvariantContains(clr.Alias)).Select(x => x.Id);
// merge ids
var ids = oth.Concat(new[] { clr.Id }).ToArray();
// clear them all at once
// we don't support "clear many at once" at the moment - so, cheating
// requires a predicate because the key does not contain the ID
// faster than key strings comparisons anyway
ApplicationContext.Current.ApplicationCache.StaticCache.ClearCacheObjectTypes<PublishedContentType>(
(key, value) => ids.Contains(value.Id));
(key, value) => value.Id == id);
}
internal static void ClearDataType(int id)
@@ -164,7 +164,7 @@ namespace Umbraco.Core.Persistence.Factories
Name = typeDto.Name,
SortOrder = typeDto.SortOrder,
ValidationRegExp = typeDto.ValidationRegExp,
PropertyGroupId = null,
PropertyGroupId = new Lazy<int>(() => default(int)),
CreateDate = dto.CreateDate,
UpdateDate = dto.CreateDate
};
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
@@ -28,21 +27,18 @@ namespace Umbraco.Core.Persistence.Migrations
private readonly IMigration[] _migrations;
[Obsolete("Use the ctor that specifies all dependencies instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationRunner(Version currentVersion, Version targetVersion, string productName)
: this(LoggerResolver.Current.Logger, currentVersion, targetVersion, productName)
{
}
[Obsolete("Use the ctor that specifies all dependencies instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationRunner(ILogger logger, Version currentVersion, Version targetVersion, string productName)
: this(logger, currentVersion, targetVersion, productName, null)
{
}
[Obsolete("Use the ctor that specifies all dependencies instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationRunner(ILogger logger, Version currentVersion, Version targetVersion, string productName, params IMigration[] migrations)
: this(ApplicationContext.Current.Services.MigrationEntryService, logger, new SemVersion(currentVersion), new SemVersion(targetVersion), productName, migrations)
{
@@ -96,7 +92,7 @@ namespace Umbraco.Core.Persistence.Migrations
: OrderedDowngradeMigrations(foundMigrations).ToList();
if (Migrating.IsRaisedEventCancelled(new MigrationEventArgs(migrations, _currentVersion, _targetVersion, _productName, true), this))
if (Migrating.IsRaisedEventCancelled(new MigrationEventArgs(migrations, _currentVersion, _targetVersion, true), this))
{
_logger.Warn<MigrationRunner>("Migration was cancelled by an event");
return false;
@@ -125,7 +121,7 @@ namespace Umbraco.Core.Persistence.Migrations
throw;
}
Migrated.RaiseEvent(new MigrationEventArgs(migrations, migrationContext, _currentVersion, _targetVersion, _productName, false), this);
Migrated.RaiseEvent(new MigrationEventArgs(migrations, migrationContext, _currentVersion, _targetVersion, false), this);
return true;
}
@@ -128,34 +128,6 @@ namespace Umbraco.Core.Persistence.Querying
right = Visit(b.Right);
}
}
else if (operand == "=")
{
// deal with (x == true|false) - most common
var constRight = b.Right as ConstantExpression;
if (constRight != null && constRight.Type == typeof (bool))
return ((bool) constRight.Value) ? VisitNotNot(b.Left) : VisitNot(b.Left);
right = Visit(b.Right);
// deal with (true|false == x) - why not
var constLeft = b.Left as ConstantExpression;
if (constLeft != null && constLeft.Type == typeof (bool))
return ((bool) constLeft.Value) ? VisitNotNot(b.Right) : VisitNot(b.Right);
left = Visit(b.Left);
}
else if (operand == "<>")
{
// deal with (x != true|false) - most common
var constRight = b.Right as ConstantExpression;
if (constRight != null && constRight.Type == typeof(bool))
return ((bool) constRight.Value) ? VisitNot(b.Left) : VisitNotNot(b.Left);
right = Visit(b.Right);
// deal with (true|false != x) - why not
var constLeft = b.Left as ConstantExpression;
if (constLeft != null && constLeft.Type == typeof(bool))
return ((bool) constLeft.Value) ? VisitNot(b.Right) : VisitNotNot(b.Right);
left = Visit(b.Left);
}
else
{
left = Visit(b.Left);
@@ -180,7 +152,7 @@ namespace Umbraco.Core.Persistence.Querying
case "COALESCE":
return string.Format("{0}({1},{2})", operand, left, right);
default:
return "(" + left + " " + operand + " " + right + ")";
return left + " " + operand + " " + right;
}
}
@@ -259,47 +231,25 @@ namespace Umbraco.Core.Persistence.Querying
switch (u.NodeType)
{
case ExpressionType.Not:
return VisitNot(u.Operand);
var o = Visit(u.Operand);
//use a Not equal operator instead of <> since we don't know that <> works in all sql servers
switch (u.Operand.NodeType)
{
case ExpressionType.MemberAccess:
//In this case it wil be a false property , i.e. x => !Trashed
SqlParameters.Add(true);
return string.Format("NOT ({0} = @0)", o);
default:
//In this case it could be anything else, such as: x => !x.Path.StartsWith("-20")
return string.Format("NOT ({0})", o);
}
default:
return Visit(u.Operand);
}
}
private string VisitNot(Expression exp)
{
var o = Visit(exp);
// use a "NOT (...)" syntax instead of "<>" since we don't know whether "<>" works in all sql servers
// also, x.StartsWith(...) translates to "x LIKE '...%'" which we cannot "<>" and have to "NOT (...")
switch (exp.NodeType)
{
case ExpressionType.MemberAccess:
// false property , i.e. x => !Trashed
SqlParameters.Add(true);
return string.Format("NOT ({0} = @{1})", o, SqlParameters.Count - 1);
default:
// could be anything else, such as: x => !x.Path.StartsWith("-20")
return "NOT (" + o + ")";
}
}
private string VisitNotNot(Expression exp)
{
var o = Visit(exp);
switch (exp.NodeType)
{
case ExpressionType.MemberAccess:
// true property, i.e. x => Trashed
SqlParameters.Add(true);
return string.Format("({0} = @{1})", o, SqlParameters.Count - 1);
default:
// could be anything else, such as: x => x.Path.StartsWith("-20")
return o;
}
}
protected virtual string VisitNewArray(NewArrayExpression na)
{
@@ -914,7 +914,7 @@ AND umbracoNode.id <> @id",
//check for default templates
bool? isDefaultTemplate = Convert.ToBoolean(ct.dtIsDefault);
int? templateId = ct.dtTemplateId;
if (currDefaultTemplate == -1 && isDefaultTemplate.HasValue && isDefaultTemplate.Value && templateId.HasValue)
if (currDefaultTemplate == -1 && isDefaultTemplate.HasValue && templateId.HasValue)
{
currDefaultTemplate = templateId.Value;
}
@@ -1212,19 +1212,5 @@ AND umbracoNode.id <> @id",
{
return PerformExists(id);
}
public string GetUniqueAlias(string alias)
{
// alias is unique accross ALL content types!
var aliasColumn = SqlSyntax.GetQuotedColumnName("alias");
var aliases = Database.Fetch<string>(@"SELECT cmsContentType." + aliasColumn + @" FROM cmsContentType
INNER JOIN umbracoNode ON cmsContentType.nodeId = umbracoNode.id
WHERE cmsContentType." + aliasColumn + @" LIKE @pattern",
new { pattern = alias + "%", objectType = NodeObjectTypeId });
var i = 1;
string test;
while (aliases.Contains(test = alias + i)) i++;
return test;
}
}
}
@@ -32,13 +32,5 @@ namespace Umbraco.Core.Persistence.Repositories
/// </param>
/// <returns></returns>
IEnumerable<string> GetAllContentTypeAliases(params Guid[] objectTypes);
/// <summary>
/// Derives a unique alias from an existing alias.
/// </summary>
/// <param name="alias">The original alias.</param>
/// <returns>The original alias with a number appended to it, so that it is unique.</returns>
/// /// <remarks>Unique accross all content, media and member types.</remarks>
string GetUniqueAlias(string alias);
}
}
@@ -15,13 +15,5 @@ namespace Umbraco.Core.Persistence.Repositories
IEnumerable<IMediaType> GetByQuery(IQuery<PropertyType> query);
IEnumerable<MoveEventInfo<IMediaType>> Move(IMediaType toMove, EntityContainer container);
/// <summary>
/// Derives a unique alias from an existing alias.
/// </summary>
/// <param name="alias">The original alias.</param>
/// <returns>The original alias with a number appended to it, so that it is unique.</returns>
/// <remarks>Unique accross all content, media and member types.</remarks>
string GetUniqueAlias(string alias);
}
}
@@ -103,18 +103,10 @@ namespace Umbraco.Core.Security
var backOfficeIdentity = http.User.Identity as UmbracoBackOfficeIdentity;
if (backOfficeIdentity != null) return backOfficeIdentity;
//Check if there's more than one identity assigned and see if it's a UmbracoBackOfficeIdentity and use that
var claimsPrincipal = http.User as ClaimsPrincipal;
if (claimsPrincipal != null)
{
backOfficeIdentity = claimsPrincipal.Identities.OfType<UmbracoBackOfficeIdentity>().FirstOrDefault();
if (backOfficeIdentity != null) return backOfficeIdentity;
}
//Otherwise convert to a UmbracoBackOfficeIdentity if it's auth'd and has the back office session
var claimsIdentity = http.User.Identity as ClaimsIdentity;
if (claimsIdentity != null && claimsIdentity.IsAuthenticated)
{
{
try
{
return UmbracoBackOfficeIdentity.FromClaimsIdentity(claimsIdentity);
@@ -794,7 +794,7 @@ namespace Umbraco.Core.Services
//TODO: This needs to change, if we are deleting a content type, we should just delete the data,
// this method will recursively go lookup every content item, check if any of it's descendants are
// of a different type, move them to the recycle bin, then permanently delete the content items.
// of a different type, move them to the recycle bin, then permanently delete the content items.
// The main problem with this is that for every content item being deleted, events are raised...
// which we need for many things like keeping caches in sync, but we can surely do this MUCH better.
@@ -1067,92 +1067,6 @@ namespace Umbraco.Core.Services
new OperationStatus<MoveOperationStatusType>(MoveOperationStatusType.Success, evtMsgs));
}
public Attempt<OperationStatus<IMediaType, MoveOperationStatusType>> CopyMediaType(IMediaType toCopy, int containerId)
{
var evtMsgs = EventMessagesFactory.Get();
IMediaType copy;
var uow = UowProvider.GetUnitOfWork();
using (var containerRepository = RepositoryFactory.CreateEntityContainerRepository(uow, Constants.ObjectTypes.MediaTypeContainerGuid))
using (var repository = RepositoryFactory.CreateMediaTypeRepository(uow))
{
try
{
if (containerId > 0)
{
var container = containerRepository.Get(containerId);
if (container == null)
throw new DataOperationException<MoveOperationStatusType>(MoveOperationStatusType.FailedParentNotFound);
}
var alias = repository.GetUniqueAlias(toCopy.Alias);
copy = toCopy.DeepCloneWithResetIdentities(alias);
copy.Name = copy.Name + " (copy)"; // might not be unique
// if it has a parent, and the parent is a content type, unplug composition
// all other compositions remain in place in the copied content type
if (copy.ParentId > 0)
{
var parent = repository.Get(copy.ParentId);
if (parent != null)
copy.RemoveContentType(parent.Alias);
}
copy.ParentId = containerId;
repository.AddOrUpdate(copy);
}
catch (DataOperationException<MoveOperationStatusType> ex)
{
return Attempt.Fail(new OperationStatus<IMediaType, MoveOperationStatusType>(null, ex.Operation, evtMsgs));
}
uow.Commit();
}
return Attempt.Succeed(new OperationStatus<IMediaType, MoveOperationStatusType>(copy, MoveOperationStatusType.Success, evtMsgs));
}
public Attempt<OperationStatus<IContentType, MoveOperationStatusType>> CopyContentType(IContentType toCopy, int containerId)
{
var evtMsgs = EventMessagesFactory.Get();
IContentType copy;
var uow = UowProvider.GetUnitOfWork();
using (var containerRepository = RepositoryFactory.CreateEntityContainerRepository(uow, Constants.ObjectTypes.DocumentTypeContainerGuid))
using (var repository = RepositoryFactory.CreateContentTypeRepository(uow))
{
try
{
if (containerId > 0)
{
var container = containerRepository.Get(containerId);
if (container == null)
throw new DataOperationException<MoveOperationStatusType>(MoveOperationStatusType.FailedParentNotFound);
}
var alias = repository.GetUniqueAlias(toCopy.Alias);
copy = toCopy.DeepCloneWithResetIdentities(alias);
copy.Name = copy.Name + " (copy)"; // might not be unique
// if it has a parent, and the parent is a content type, unplug composition
// all other compositions remain in place in the copied content type
if (copy.ParentId > 0)
{
var parent = repository.Get(copy.ParentId);
if (parent != null)
copy.RemoveContentType(parent.Alias);
}
copy.ParentId = containerId;
repository.AddOrUpdate(copy);
}
catch (DataOperationException<MoveOperationStatusType> ex)
{
return Attempt.Fail(new OperationStatus<IContentType, MoveOperationStatusType>(null, ex.Operation, evtMsgs));
}
uow.Commit();
}
return Attempt.Succeed(new OperationStatus<IContentType, MoveOperationStatusType>(copy, MoveOperationStatusType.Success, evtMsgs));
}
/// <summary>
/// Saves a single <see cref="IMediaType"/> object
/// </summary>
@@ -267,15 +267,11 @@ namespace Umbraco.Core.Services
structure.Add(new XElement("MediaType", allowedType.Alias));
}
var genericProperties = new XElement("GenericProperties"); // actually, all of them
var genericProperties = new XElement("GenericProperties");
foreach (var propertyType in mediaType.PropertyTypes)
{
var definition = dataTypeService.GetDataTypeDefinitionById(propertyType.DataTypeDefinitionId);
var propertyGroup = propertyType.PropertyGroupId == null // true generic property
? null
: mediaType.PropertyGroups.FirstOrDefault(x => x.Id == propertyType.PropertyGroupId.Value);
var propertyGroup = mediaType.PropertyGroups.FirstOrDefault(x => x.Id == propertyType.PropertyGroupId.Value);
var genericProperty = new XElement("GenericProperty",
new XElement("Name", propertyType.Name),
new XElement("Alias", propertyType.Alias),
@@ -385,14 +381,14 @@ namespace Umbraco.Core.Services
structure.Add(new XElement("DocumentType", allowedType.Alias));
}
var genericProperties = new XElement("GenericProperties"); // actually, all of them
var genericProperties = new XElement("GenericProperties");
foreach (var propertyType in contentType.PropertyTypes)
{
var definition = dataTypeService.GetDataTypeDefinitionById(propertyType.DataTypeDefinitionId);
var propertyGroup = propertyType.PropertyGroupId == null // true generic property
? null
: contentType.PropertyGroups.FirstOrDefault(x => x.Id == propertyType.PropertyGroupId.Value);
var propertyGroup = propertyType.PropertyGroupId == null
? null
: contentType.PropertyGroups.FirstOrDefault(x => x.Id == propertyType.PropertyGroupId.Value);
var genericProperty = new XElement("GenericProperty",
new XElement("Name", propertyType.Name),
@@ -291,7 +291,5 @@ namespace Umbraco.Core.Services
Attempt<OperationStatus<MoveOperationStatusType>> MoveMediaType(IMediaType toMove, int containerId);
Attempt<OperationStatus<MoveOperationStatusType>> MoveContentType(IContentType toMove, int containerId);
Attempt<OperationStatus<IMediaType, MoveOperationStatusType>> CopyMediaType(IMediaType toCopy, int containerId);
Attempt<OperationStatus<IContentType, MoveOperationStatusType>> CopyContentType(IContentType toCopy, int containerId);
}
}
+28 -59
View File
@@ -22,7 +22,7 @@ namespace Umbraco.Core
/// <summary>
/// A utility class to find all classes of a certain type by reflection in the current bin folder
/// of the web application.
/// of the web application.
/// </summary>
public static class TypeFinder
{
@@ -34,7 +34,7 @@ namespace Umbraco.Core
/// This is a modified version of: http://www.dominicpettifer.co.uk/Blog/44/how-to-get-a-reference-to-all-assemblies-in-the--bin-folder
/// </summary>
/// <remarks>
/// We do this because we cannot use AppDomain.Current.GetAssemblies() as this will return only assemblies that have been
/// We do this because we cannot use AppDomain.Current.GetAssemblies() as this will return only assemblies that have been
/// loaded in the CLR, not all assemblies.
/// See these threads:
/// http://issues.umbraco.org/issue/U5-198
@@ -136,7 +136,7 @@ namespace Umbraco.Core
});
/// <summary>
/// Return a list of found local Assemblies excluding the known assemblies we don't want to scan
/// Return a list of found local Assemblies excluding the known assemblies we don't want to scan
/// and exluding the ones passed in and excluding the exclusion list filter, the results of this are
/// cached for perforance reasons.
/// </summary>
@@ -190,7 +190,6 @@ namespace Umbraco.Core
/// </summary>
/// <remarks>
/// NOTE the comma vs period... comma delimits the name in an Assembly FullName property so if it ends with comma then its an exact name match
/// NOTE this means that "foo." will NOT exclude "foo.dll" but only "foo.*.dll"
/// </remarks>
internal static readonly string[] KnownAssemblyExclusionFilter = new[]
{
@@ -215,7 +214,7 @@ namespace Umbraco.Core
"RouteDebugger,",
"SqlCE4Umbraco,",
"umbraco.datalayer,",
"umbraco.interfaces,",
"umbraco.interfaces,",
//"umbraco.providers,",
//"Umbraco.Web.UI,",
"umbraco.webservices",
@@ -231,9 +230,9 @@ namespace Umbraco.Core
"AutoMapper,",
"AutoMapper.",
"AzureDirectory,",
"itextsharp,",
"itextsharp,",
"UrlRewritingNet.",
"HtmlAgilityPack,",
"HtmlAgilityPack,",
"MiniProfiler,",
"Moq,",
"nunit.framework,",
@@ -372,7 +371,7 @@ namespace Umbraco.Core
var assemblyList = assemblies.ToArray();
//find all assembly references that are referencing the attribute type's assembly since we
//find all assembly references that are referencing the attribute type's assembly since we
//should only be scanning those assemblies because any other assembly will definitely not
//contain a class that has this attribute.
var referencedAssemblies = TypeHelper.GetReferencedAssemblies(attributeType, assemblyList);
@@ -419,7 +418,7 @@ namespace Umbraco.Core
foreach (var subTypesInAssembly in allAttributeTypes.GroupBy(x => x.Assembly))
{
//So that we are not scanning too much, we need to group the sub types:
//So that we are not scanning too much, we need to group the sub types:
// * if there is more than 1 sub type in the same assembly then we should only search on the 'lowest base' type.
// * We should also not search for sub types if the type is sealed since you cannot inherit from a sealed class
// * We should not search for sub types if the type is static since you cannot inherit from them.
@@ -490,7 +489,7 @@ namespace Umbraco.Core
/// <summary>
/// Finds types that are assignable from the assignTypeFrom parameter and will scan for these types in the assembly
/// list passed in, however we will only scan assemblies that have a reference to the assignTypeFrom Type or any type
/// list passed in, however we will only scan assemblies that have a reference to the assignTypeFrom Type or any type
/// deriving from the base type.
/// </summary>
/// <param name="assignTypeFrom"></param>
@@ -514,7 +513,7 @@ namespace Umbraco.Core
var assemblyList = assemblies.ToArray();
//find all assembly references that are referencing the current type's assembly since we
//find all assembly references that are referencing the current type's assembly since we
//should only be scanning those assemblies because any other assembly will definitely not
//contain sub type's of the one we're currently looking for
var referencedAssemblies = TypeHelper.GetReferencedAssemblies(assignTypeFrom, assemblyList);
@@ -561,7 +560,7 @@ namespace Umbraco.Core
foreach (var subTypesInAssembly in allSubTypes.GroupBy(x => x.Assembly))
{
//So that we are not scanning too much, we need to group the sub types:
//So that we are not scanning too much, we need to group the sub types:
// * if there is more than 1 sub type in the same assembly then we should only search on the 'lowest base' type.
// * We should also not search for sub types if the type is sealed since you cannot inherit from a sealed class
// * We should not search for sub types if the type is static since you cannot inherit from them.
@@ -603,69 +602,39 @@ namespace Umbraco.Core
return foundAssignableTypes;
}
internal static IEnumerable<Type> GetTypesWithFormattedException(Assembly a)
private static IEnumerable<Type> GetTypesWithFormattedException(Assembly a)
{
//if the assembly is dynamic, do not try to scan it
if (a.IsDynamic)
return Enumerable.Empty<Type>();
var getAll = a.GetCustomAttribute<AllowPartiallyTrustedCallersAttribute>() == null;
try
{
//we need to detect if an assembly is partially trusted, if so we cannot go interrogating all of it's types
//only its exported types, otherwise we'll get exceptions.
return getAll ? a.GetTypes() : a.GetExportedTypes();
if (a.GetCustomAttribute<AllowPartiallyTrustedCallersAttribute>() == null)
{
return a.GetTypes();
}
else
{
return a.GetExportedTypes();
}
}
catch (TypeLoadException ex) // GetExportedTypes *can* throw TypeLoadException!
catch (ReflectionTypeLoadException ex)
{
var sb = new StringBuilder();
AppendCouldNotLoad(sb, a, getAll);
AppendLoaderException(sb, ex);
// rethrow as ReflectionTypeLoadException (for consistency) with new message
throw new ReflectionTypeLoadException(new Type[0], new Exception[] { ex }, sb.ToString());
sb.AppendLine("Could not load types from assembly " + a.FullName + ", errors:");
foreach (var loaderException in ex.LoaderExceptions.WhereNotNull())
{
sb.AppendLine("Exception: " + loaderException);
}
throw new ReflectionTypeLoadException(ex.Types, ex.LoaderExceptions, sb.ToString());
}
catch (ReflectionTypeLoadException rex) // GetTypes throws ReflectionTypeLoadException
{
var sb = new StringBuilder();
AppendCouldNotLoad(sb, a, getAll);
foreach (var loaderException in rex.LoaderExceptions.WhereNotNull())
AppendLoaderException(sb, loaderException);
// rethrow with new message
throw new ReflectionTypeLoadException(rex.Types, rex.LoaderExceptions, sb.ToString());
}
}
private static void AppendCouldNotLoad(StringBuilder sb, Assembly a, bool getAll)
{
sb.Append("Could not load ");
sb.Append(getAll ? "all" : "exported");
sb.Append(" types from \"");
sb.Append(a.FullName);
sb.AppendLine("\" due to LoaderExceptions, skipping:");
}
private static void AppendLoaderException(StringBuilder sb, Exception loaderException)
{
sb.Append(". ");
sb.Append(loaderException.GetType().FullName);
var tloadex = loaderException as TypeLoadException;
if (tloadex != null)
{
sb.Append(" on ");
sb.Append(tloadex.TypeName);
}
sb.Append(": ");
sb.Append(loaderException.Message);
sb.AppendLine();
}
#endregion
public static Type GetTypeByName(string typeName)
{
@@ -1,100 +0,0 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
using Semver;
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Migrations;
using Umbraco.Core.Profiling;
using Umbraco.Core.Services;
using Umbraco.Web.Strategies.Migrations;
namespace Umbraco.Tests.Persistence.Migrations
{
[TestFixture]
public class MigrationStartupHandlerTests
{
[Test]
public void Executes_For_Any_Product_Name_When_Not_Specified()
{
var changed1 = new Args { CountExecuted = 0 };
var testHandler1 = new TestMigrationHandler(changed1);
testHandler1.OnApplicationStarting(Mock.Of<UmbracoApplicationBase>(), new ApplicationContext(CacheHelper.CreateDisabledCacheHelper(), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())));
var conn = new Mock<IDbConnection>();
conn.Setup(x => x.BeginTransaction(It.IsAny<IsolationLevel>())).Returns(Mock.Of<IDbTransaction>());
var db = new Mock<Database>(conn.Object);
var runner1 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(1), new SemVersion(2), "Test1",
new IMigration[] { Mock.Of<IMigration>() });
var result1 = runner1.Execute(db.Object, DatabaseProviders.SqlServerCE, false);
Assert.AreEqual(1, changed1.CountExecuted);
}
[Test]
public void Executes_Only_For_Specified_Product_Name()
{
var changed1 = new Args { CountExecuted = 0};
var testHandler1 = new TestMigrationHandler("Test1", changed1);
testHandler1.OnApplicationStarting(Mock.Of<UmbracoApplicationBase>(), new ApplicationContext(CacheHelper.CreateDisabledCacheHelper(), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())));
var changed2 = new Args { CountExecuted = 0 };
var testHandler2 = new TestMigrationHandler("Test2", changed2);
testHandler2.OnApplicationStarting(Mock.Of<UmbracoApplicationBase>(), new ApplicationContext(CacheHelper.CreateDisabledCacheHelper(), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())));
var conn = new Mock<IDbConnection>();
conn.Setup(x => x.BeginTransaction(It.IsAny<IsolationLevel>())).Returns(Mock.Of<IDbTransaction>());
var db = new Mock<Database>(conn.Object);
var runner1 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(1), new SemVersion(2), "Test1",
new IMigration[] { Mock.Of<IMigration>()});
var result1 = runner1.Execute(db.Object, DatabaseProviders.SqlServerCE, false);
Assert.AreEqual(1, changed1.CountExecuted);
Assert.AreEqual(0, changed2.CountExecuted);
var runner2 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(1), new SemVersion(2), "Test2",
new IMigration[] { Mock.Of<IMigration>() });
var result2 = runner2.Execute(db.Object, DatabaseProviders.SqlServerCE, false);
Assert.AreEqual(1, changed1.CountExecuted);
Assert.AreEqual(1, changed2.CountExecuted);
}
public class Args
{
public int CountExecuted { get; set; }
}
public class TestMigrationHandler : MigrationStartupHander
{
private readonly string _prodName;
private readonly Args _changed;
public TestMigrationHandler(Args changed)
{
_changed = changed;
}
public TestMigrationHandler(string prodName, Args changed)
{
_prodName = prodName;
_changed = changed;
}
protected override void AfterMigration(MigrationRunner sender, MigrationEventArgs e)
{
_changed.CountExecuted++;
}
public override string[] TargetProductNames
{
get { return _prodName.IsNullOrWhiteSpace() ? new string[] {} : new[] {_prodName}; }
}
}
}
}
@@ -21,7 +21,7 @@ namespace Umbraco.Tests.Persistence.Querying
.InnerJoin("[cmsContentVersion]").On("[cmsDocument].[versionId] = [cmsContentVersion].[VersionId]")
.InnerJoin("[cmsContent]").On("[cmsContentVersion].[ContentId] = [cmsContent].[nodeId]")
.InnerJoin("[umbracoNode]").On("[cmsContent].[nodeId] = [umbracoNode].[id]")
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("c66ba18e-eaf3-4cff-8a22-41b16d66a972"));
.Where("[umbracoNode].[nodeObjectType] = @0", new Guid("c66ba18e-eaf3-4cff-8a22-41b16d66a972"));
var sql = new Sql();
sql.Select("*")
@@ -56,8 +56,8 @@ namespace Umbraco.Tests.Persistence.Querying
.InnerJoin("[cmsContentVersion]").On("[cmsDocument].[versionId] = [cmsContentVersion].[VersionId]")
.InnerJoin("[cmsContent]").On("[cmsContentVersion].[ContentId] = [cmsContent].[nodeId]")
.InnerJoin("[umbracoNode]").On("[cmsContent].[nodeId] = [umbracoNode].[id]")
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("c66ba18e-eaf3-4cff-8a22-41b16d66a972"))
.Where("([umbracoNode].[id] = @0)", 1050);
.Where("[umbracoNode].[nodeObjectType] = @0", new Guid("c66ba18e-eaf3-4cff-8a22-41b16d66a972"))
.Where("[umbracoNode].[id] = @0", 1050);
var sql = new Sql();
sql.Select("*")
@@ -94,9 +94,9 @@ namespace Umbraco.Tests.Persistence.Querying
.InnerJoin("[cmsContentVersion]").On("[cmsDocument].[versionId] = [cmsContentVersion].[VersionId]")
.InnerJoin("[cmsContent]").On("[cmsContentVersion].[ContentId] = [cmsContent].[nodeId]")
.InnerJoin("[umbracoNode]").On("[cmsContent].[nodeId] = [umbracoNode].[id]")
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("c66ba18e-eaf3-4cff-8a22-41b16d66a972"))
.Where("([umbracoNode].[id] = @0)", 1050)
.Where("([cmsContentVersion].[VersionId] = @0)", new Guid("2b543516-a944-4ee6-88c6-8813da7aaa07"))
.Where("[umbracoNode].[nodeObjectType] = @0", new Guid("c66ba18e-eaf3-4cff-8a22-41b16d66a972"))
.Where("[umbracoNode].[id] = @0", 1050)
.Where("[cmsContentVersion].[VersionId] = @0", new Guid("2b543516-a944-4ee6-88c6-8813da7aaa07"))
.OrderBy("[cmsContentVersion].[VersionDate] DESC");
var sql = new Sql();
@@ -133,8 +133,8 @@ namespace Umbraco.Tests.Persistence.Querying
expected.Select("*");
expected.From("[cmsPropertyData]");
expected.InnerJoin("[cmsPropertyType]").On("[cmsPropertyData].[propertytypeid] = [cmsPropertyType].[id]");
expected.Where("([cmsPropertyData].[contentNodeId] = @0)", 1050);
expected.Where("([cmsPropertyData].[versionId] = @0)", new Guid("2b543516-a944-4ee6-88c6-8813da7aaa07"));
expected.Where("[cmsPropertyData].[contentNodeId] = @0", 1050);
expected.Where("[cmsPropertyData].[versionId] = @0", new Guid("2b543516-a944-4ee6-88c6-8813da7aaa07"));
var sql = new Sql();
sql.Select("*")
@@ -22,8 +22,8 @@ namespace Umbraco.Tests.Persistence.Querying
.On("[cmsContentType].[nodeId] = [cmsDocumentType].[contentTypeNodeId]")
.InnerJoin("[umbracoNode]")
.On("[cmsContentType].[nodeId] = [umbracoNode].[id]")
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("a2cb7800-f571-4787-9638-bc48539a0efb"))
.Where("([cmsDocumentType].[IsDefault] = @0)", true);
.Where("[umbracoNode].[nodeObjectType] = @0", new Guid("a2cb7800-f571-4787-9638-bc48539a0efb"))
.Where("[cmsDocumentType].[IsDefault] = @0", true);
var sql = new Sql();
sql.Select("*")
@@ -58,9 +58,9 @@ namespace Umbraco.Tests.Persistence.Querying
.On("[cmsContentType].[nodeId] = [cmsDocumentType].[contentTypeNodeId]")
.InnerJoin("[umbracoNode]")
.On("[cmsContentType].[nodeId] = [umbracoNode].[id]")
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("a2cb7800-f571-4787-9638-bc48539a0efb"))
.Where("[umbracoNode].[nodeObjectType] = @0", new Guid("a2cb7800-f571-4787-9638-bc48539a0efb"))
.Where("[cmsDocumentType].[IsDefault] = @0", true)
.Where("([umbracoNode].[id] = @0)", 1050);
.Where("[umbracoNode].[id] = @0", 1050);
var sql = new Sql();
sql.Select("*")
@@ -112,7 +112,7 @@ namespace Umbraco.Tests.Persistence.Querying
var expected = new Sql();
expected.Select("*")
.From("[cmsContentTypeAllowedContentType]")
.Where("([cmsContentTypeAllowedContentType].[Id] = @0)", 1050);
.Where("[cmsContentTypeAllowedContentType].[Id] = @0", 1050);
var sql = new Sql();
sql.Select("*")
@@ -138,7 +138,7 @@ namespace Umbraco.Tests.Persistence.Querying
.From("[cmsPropertyTypeGroup]")
.RightJoin("[cmsPropertyType]").On("[cmsPropertyTypeGroup].[id] = [cmsPropertyType].[propertyTypeGroupId]")
.InnerJoin("[cmsDataType]").On("[cmsPropertyType].[dataTypeId] = [cmsDataType].[nodeId]")
.Where("([cmsPropertyType].[contentTypeId] = @0)", 1050);
.Where("[cmsPropertyType].[contentTypeId] = @0", 1050);
var sql = new Sql();
sql.Select("*")
@@ -19,7 +19,7 @@ namespace Umbraco.Tests.Persistence.Querying
expected.Select("*")
.From("[cmsDataType]")
.InnerJoin("[umbracoNode]").On("[cmsDataType].[nodeId] = [umbracoNode].[id]")
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("30a2a501-1978-4ddb-a57b-f7efed43ba3c"));
.Where("[umbracoNode].[nodeObjectType] = @0", new Guid("30a2a501-1978-4ddb-a57b-f7efed43ba3c"));
var sql = new Sql();
sql.Select("*")
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Querying
Console.WriteLine("Model to Sql ExpressionHelper: \n" + result);
Assert.AreEqual("([umbracoNode].[parentID] = @0)", result);
Assert.AreEqual("[umbracoNode].[parentID] = @0", result);
Assert.AreEqual(-1, modelToSqlExpressionHelper.GetSqlParameters()[0]);
}
@@ -66,7 +66,7 @@ namespace Umbraco.Tests.Persistence.Querying
Console.WriteLine("Model to Sql ExpressionHelper: \n" + result);
Assert.AreEqual("([umbracoUser].[userLogin] = @0)", result);
Assert.AreEqual("[umbracoUser].[userLogin] = @0", result);
Assert.AreEqual("hello@world.com", modelToSqlExpressionHelper.GetSqlParameters()[0]);
}
@@ -20,7 +20,7 @@ namespace Umbraco.Tests.Persistence.Querying
.From("[cmsContentVersion]")
.InnerJoin("[cmsContent]").On("[cmsContentVersion].[ContentId] = [cmsContent].[nodeId]")
.InnerJoin("[umbracoNode]").On("[cmsContent].[nodeId] = [umbracoNode].[id]")
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("b796f64c-1f99-4ffb-b886-4bf4bc011a9c"));
.Where("[umbracoNode].[nodeObjectType] = @0", new Guid("b796f64c-1f99-4ffb-b886-4bf4bc011a9c"));
var sql = new Sql();
sql.Select("*")
@@ -19,7 +19,7 @@ namespace Umbraco.Tests.Persistence.Querying
expected.Select("*")
.From("[cmsContentType]")
.InnerJoin("[umbracoNode]").On("[cmsContentType].[nodeId] = [umbracoNode].[id]")
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e"));
.Where("[umbracoNode].[nodeObjectType] = @0", new Guid("4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e"));
var sql = new Sql();
sql.Select("*")
@@ -33,7 +33,7 @@ namespace Umbraco.Tests.Persistence.Querying
var content = new NodeDto() {NodeId = 123, Path = "-1,123"};
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.Path.StartsWith(content.Path) && x.NodeId != content.NodeId);
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ((upper([umbracoNode].[path]) LIKE upper(@0) AND ([umbracoNode].[id] <> @1)))", sql.SQL.Replace("\n", " "));
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE (upper([umbracoNode].[path]) LIKE upper(@0) AND [umbracoNode].[id] <> @1)", sql.SQL.Replace("\n", " "));
Assert.AreEqual(2, sql.Arguments.Length);
Assert.AreEqual(content.Path + "%", sql.Arguments[0]);
Assert.AreEqual(content.NodeId, sql.Arguments[1]);
@@ -45,19 +45,7 @@ namespace Umbraco.Tests.Persistence.Querying
var level = 1;
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.Level == level && !x.Path.StartsWith("-20"));
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ((([umbracoNode].[level] = @0) AND NOT (upper([umbracoNode].[path]) LIKE upper(@1))))", sql.SQL.Replace("\n", " "));
Assert.AreEqual(2, sql.Arguments.Length);
Assert.AreEqual(level, sql.Arguments[0]);
Assert.AreEqual("-20%", sql.Arguments[1]);
}
[Test]
public void Where_Clause_With_EqualsFalse_Starts_With()
{
var level = 1;
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.Level == level && x.Path.StartsWith("-20") == false);
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ((([umbracoNode].[level] = @0) AND NOT (upper([umbracoNode].[path]) LIKE upper(@1))))", sql.SQL.Replace("\n", " "));
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ([umbracoNode].[level] = @0 AND NOT (upper([umbracoNode].[path]) LIKE upper(@1)))", sql.SQL.Replace("\n", " "));
Assert.AreEqual(2, sql.Arguments.Length);
Assert.AreEqual(level, sql.Arguments[0]);
Assert.AreEqual("-20%", sql.Arguments[1]);
@@ -83,16 +71,6 @@ namespace Umbraco.Tests.Persistence.Querying
Assert.AreEqual(true, sql.Arguments[0]);
}
[Test]
public void Where_Clause_With_EqualsFalse_Boolean()
{
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.Trashed == false);
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE (NOT ([umbracoNode].[trashed] = @0))", sql.SQL.Replace("\n", " "));
Assert.AreEqual(1, sql.Arguments.Length);
Assert.AreEqual(true, sql.Arguments[0]);
}
[Test]
public void Where_Clause_With_Boolean()
{
@@ -108,7 +86,7 @@ namespace Umbraco.Tests.Persistence.Querying
{
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.Text.ToUpper() == "hello".ToUpper());
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ((upper([umbracoNode].[text]) = upper(@0)))", sql.SQL.Replace("\n", " "));
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE (upper([umbracoNode].[text]) = upper(@0))", sql.SQL.Replace("\n", " "));
Assert.AreEqual(1, sql.Arguments.Length);
Assert.AreEqual("hello", sql.Arguments[0]);
}
@@ -118,7 +96,7 @@ namespace Umbraco.Tests.Persistence.Querying
{
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.Text == 1.ToString());
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE (([umbracoNode].[text] = @0))", sql.SQL.Replace("\n", " "));
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ([umbracoNode].[text] = @0)", sql.SQL.Replace("\n", " "));
Assert.AreEqual(1, sql.Arguments.Length);
Assert.AreEqual("1", sql.Arguments[0]);
}
@@ -138,7 +116,7 @@ namespace Umbraco.Tests.Persistence.Querying
{
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.NodeId == 2);
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE (([umbracoNode].[id] = @0))", sql.SQL.Replace("\n", " "));
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ([umbracoNode].[id] = @0)", sql.SQL.Replace("\n", " "));
Assert.AreEqual(1, sql.Arguments.Length);
Assert.AreEqual(2, sql.Arguments[0]);
}
@@ -148,7 +126,7 @@ namespace Umbraco.Tests.Persistence.Querying
{
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.NodeId != 2 && x.NodeId != 3);
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ((([umbracoNode].[id] <> @0) AND ([umbracoNode].[id] <> @1)))", sql.SQL.Replace("\n", " "));
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ([umbracoNode].[id] <> @0 AND [umbracoNode].[id] <> @1)", sql.SQL.Replace("\n", " "));
Assert.AreEqual(2, sql.Arguments.Length);
Assert.AreEqual(2, sql.Arguments[0]);
Assert.AreEqual(3, sql.Arguments[1]);
@@ -159,7 +137,7 @@ namespace Umbraco.Tests.Persistence.Querying
{
var sql = new Sql("SELECT *").From<NodeDto>().Where<NodeDto>(x => x.Text == "hello" || x.NodeId == 3);
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ((([umbracoNode].[text] = @0) OR ([umbracoNode].[id] = @1)))", sql.SQL.Replace("\n", " "));
Assert.AreEqual("SELECT * FROM [umbracoNode] WHERE ([umbracoNode].[text] = @0 OR [umbracoNode].[id] = @1)", sql.SQL.Replace("\n", " "));
Assert.AreEqual(2, sql.Arguments.Length);
Assert.AreEqual("hello", sql.Arguments[0]);
Assert.AreEqual(3, sql.Arguments[1]);
@@ -230,7 +208,7 @@ namespace Umbraco.Tests.Persistence.Querying
public void Can_Use_Where_Predicate()
{
var expected = new Sql();
expected.Select("*").From("[cmsContent]").Where("([cmsContent].[nodeId] = @0)", 1045);
expected.Select("*").From("[cmsContent]").Where("[cmsContent].[nodeId] = @0", 1045);
var sql = new Sql();
sql.Select("*").From<ContentDto>().Where<ContentDto>(x => x.NodeId == 1045);
@@ -246,8 +224,8 @@ namespace Umbraco.Tests.Persistence.Querying
var expected = new Sql();
expected.Select("*")
.From("[cmsContent]")
.Where("([cmsContent].[nodeId] = @0)", 1045)
.Where("([cmsContent].[contentType] = @0)", 1050);
.Where("[cmsContent].[nodeId] = @0", 1045)
.Where("[cmsContent].[contentType] = @0", 1050);
var sql = new Sql();
sql.Select("*")
@@ -56,7 +56,7 @@ namespace Umbraco.Tests.Persistence.Querying
var result = translator.Translate();
var strResult = result.SQL;
string expectedResult = "SELECT *\nFROM umbracoNode\nWHERE (([umbracoNode].[parentID] = @0))";
string expectedResult = "SELECT *\nFROM umbracoNode\nWHERE ([umbracoNode].[parentID] = @0)";
// Assert
Assert.That(strResult, Is.Not.Empty);
@@ -83,7 +83,7 @@ namespace Umbraco.Tests.Persistence.Querying
var result = translator.Translate();
var strResult = result.SQL;
string expectedResult = "SELECT *\nFROM umbracoNode\nWHERE (([cmsContentType].[alias] = @0))";
string expectedResult = "SELECT *\nFROM umbracoNode\nWHERE ([cmsContentType].[alias] = @0)";
// Assert
Assert.That(strResult, Is.Not.Empty);
@@ -90,7 +90,7 @@ namespace Umbraco.Tests.Persistence.Repositories
templateRepo.AddOrUpdate(template);
}
unitOfWork.Commit();
var contentType = MockedContentTypes.CreateSimpleContentType();
contentType.AllowedTemplates = new[] {templates[0], templates[1]};
contentType.SetDefaultTemplate(templates[0]);
@@ -127,7 +127,7 @@ namespace Umbraco.Tests.Persistence.Repositories
repository.AddOrUpdate(contentType);
unitOfWork.Commit();
//create a
//create a
var contentType2 = (IContentType)new ContentType(contentType, "hello")
{
Name = "Blahasdfsadf"
@@ -293,9 +293,7 @@ namespace Umbraco.Tests.Persistence.Repositories
using (var repository = CreateRepository(unitOfWork))
{
// Act
var contentType = (IContentType)MockedContentTypes.CreateSimpleContentType2("test", "Test", propertyGroupName: "testGroup");
Assert.AreEqual(4, contentType.PropertyTypes.Count());
var contentType = (IContentType)MockedContentTypes.CreateSimpleContentType("test", "Test", propertyGroupName: "testGroup");
// there is NO mapping from display to contentType, but only from save
// to contentType, so if we want to test, let's to it properly!
@@ -303,18 +301,12 @@ namespace Umbraco.Tests.Persistence.Repositories
var save = MapToContentTypeSave(display);
var mapped = Mapper.Map<IContentType>(save);
Assert.AreEqual(4, mapped.PropertyTypes.Count());
repository.AddOrUpdate(mapped);
unitOfWork.Commit();
Assert.AreEqual(4, mapped.PropertyTypes.Count());
//re-get
contentType = repository.Get(mapped.Id);
Assert.AreEqual(4, contentType.PropertyTypes.Count());
// Assert
Assert.That(contentType.HasIdentity, Is.True);
Assert.That(contentType.PropertyGroups.All(x => x.HasIdentity), Is.True);
@@ -324,11 +316,7 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.That(contentType.PropertyGroups.ElementAt(0).Name == "testGroup", Is.True);
var groupId = contentType.PropertyGroups.ElementAt(0).Id;
var propertyTypes = contentType.PropertyTypes.ToArray();
Assert.AreEqual("gen", propertyTypes[0].Alias); // just to be sure
Assert.IsNull(propertyTypes[0].PropertyGroupId);
Assert.IsTrue(propertyTypes.Skip(1).All((x => x.PropertyGroupId.Value == groupId)));
Assert.That(contentType.PropertyTypes.All(x => x.PropertyGroupId.Value == groupId), Is.True);
}
}
@@ -365,7 +353,7 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.That(contentType.PropertyTypes.Any(x => x.Alias == "subtitle"), Is.True);
}
}
// this is for tests only because it makes no sense at all to have such a
@@ -503,16 +491,16 @@ namespace Umbraco.Tests.Persistence.Repositories
var provider = new PetaPocoUnitOfWorkProvider(Logger);
var unitOfWork = provider.GetUnitOfWork();
using (var repository = CreateRepository(unitOfWork))
{
{
var ctMain = MockedContentTypes.CreateSimpleContentType();
var ctChild1 = MockedContentTypes.CreateSimpleContentType("child1", "Child 1", ctMain, true);
var ctChild2 = MockedContentTypes.CreateSimpleContentType("child2", "Child 2", ctChild1, true);
repository.AddOrUpdate(ctMain);
repository.AddOrUpdate(ctChild1);
repository.AddOrUpdate(ctChild2);
repository.AddOrUpdate(ctChild2);
unitOfWork.Commit();
// Act
var resolvedParent = repository.Get(ctMain.Id);
@@ -540,7 +528,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var child3 = MockedContentTypes.CreateSimpleContentType("zyx", "zyx", contentType, randomizeAliases: true);
repository.AddOrUpdate(child3);
var child2 = MockedContentTypes.CreateSimpleContentType("a123", "a123", contentType, randomizeAliases: true);
repository.AddOrUpdate(child2);
repository.AddOrUpdate(child2);
unitOfWork.Commit();
// Act
@@ -552,7 +540,7 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.AreEqual("aabc", contentTypes.ElementAt(1).Name);
Assert.AreEqual("zyx", contentTypes.ElementAt(2).Name);
}
}
[Test]
@@ -683,7 +671,7 @@ namespace Umbraco.Tests.Persistence.Repositories
{
var contentType = repository.Get(NodeDto.NodeIdSeed + 1);
// Act
// Act
contentType.PropertyGroups["Meta"].PropertyTypes.Remove("description");
repository.AddOrUpdate(contentType);
unitOfWork.Commit();
@@ -853,7 +841,7 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(5));
Assert.That(contentType.PropertyTypes.Any(x => x.Alias == "metaAuthor"), Is.True);
}
}
[Test]
@@ -36,7 +36,7 @@ namespace Umbraco.Tests.Persistence.SyntaxProvider
FROM [cmsContentXml]
INNER JOIN [umbracoNode]
ON [cmsContentXml].[nodeId] = [umbracoNode].[id]
WHERE (([umbracoNode].[nodeObjectType] = @0))) x)".Replace(Environment.NewLine, " ").Replace("\n", " ").Replace("\r", " "),
WHERE ([umbracoNode].[nodeObjectType] = @0)) x)".Replace(Environment.NewLine, " ").Replace("\n", " ").Replace("\r", " "),
sqlOutput.SQL.Replace(Environment.NewLine, " ").Replace("\n", " ").Replace("\r", " "));
Assert.AreEqual(1, sqlOutput.Arguments.Length);
+2 -2
View File
@@ -79,8 +79,8 @@ namespace Umbraco.Tests.Plugins
var originalTypesFound = TypeFinderOriginal.FindClassesOfType<IApplicationStartupHandler>(_assemblies);
Assert.AreEqual(originalTypesFound.Count(), typesFound.Count());
Assert.AreEqual(9, typesFound.Count());
Assert.AreEqual(9, originalTypesFound.Count());
Assert.AreEqual(8, typesFound.Count());
Assert.AreEqual(8, originalTypesFound.Count());
}
[Test]
@@ -164,24 +164,6 @@ namespace Umbraco.Tests.TestHelpers.Entities
return contentType;
}
public static ContentType CreateSimpleContentType2(string alias, string name, IContentType parent = null, bool randomizeAliases = false, string propertyGroupName = "Content")
{
var contentType = CreateSimpleContentType(alias, name, parent, randomizeAliases, propertyGroupName);
var propertyType = new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext)
{
Alias = RandomAlias("gen", randomizeAliases),
Name = "Gen",
Description = "",
Mandatory = false,
SortOrder = 1,
DataTypeDefinitionId = -88
};
contentType.AddPropertyType(propertyType);
return contentType;
}
public static ContentType CreateSimpleContentType(string alias, string name, IContentType parent = null, bool randomizeAliases = false, string propertyGroupName = "Content")
{
var contentType = parent == null ? new ContentType(-1) : new ContentType(parent, alias);
-2
View File
@@ -175,7 +175,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Persistence\Migrations\MigrationStartupHandlerTests.cs" />
<Compile Include="Web\AngularIntegration\AngularAntiForgeryTests.cs" />
<Compile Include="Web\AngularIntegration\ContentModelSerializationTests.cs" />
<Compile Include="Web\AngularIntegration\JsInitializationTests.cs" />
@@ -245,7 +244,6 @@
<Compile Include="Models\UmbracoEntityTests.cs" />
<Compile Include="Models\UserTests.cs" />
<Compile Include="Models\UserTypeTests.cs" />
<Compile Include="Web\Mvc\RenderModelBinderTests.cs" />
<Compile Include="Web\Mvc\SurfaceControllerTests.cs" />
<Compile Include="Web\Mvc\UmbracoViewPageTests.cs" />
<Compile Include="BootManagers\CoreBootManagerTests.cs" />
@@ -1,157 +0,0 @@
using System.Collections.Generic;
using System.Globalization;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Moq;
using NUnit.Framework;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
namespace Umbraco.Tests.Web.Mvc
{
[TestFixture]
public class RenderModelBinderTests
{
[Test]
public void Returns_Binder_For_IPublishedContent_And_IRenderModel()
{
var binder = new RenderModelBinder();
var found = binder.GetBinder(typeof (IPublishedContent));
Assert.IsNotNull(found);
found = binder.GetBinder(typeof(IRenderModel));
Assert.IsNotNull(found);
found = binder.GetBinder(typeof(RenderModel));
Assert.IsNotNull(found);
found = binder.GetBinder(typeof(DynamicPublishedContent));
Assert.IsNotNull(found);
found = binder.GetBinder(typeof(MyContent));
Assert.IsNotNull(found);
found = binder.GetBinder(typeof(MyOtherContent));
Assert.IsNull(found);
}
[Test]
public void BindModel_Null_Source_Returns_Null()
{
Assert.IsNull(RenderModelBinder.BindModel(null, typeof(MyContent), CultureInfo.CurrentCulture));
}
[Test]
public void BindModel_Returns_If_Same_Type()
{
var content = new MyContent(Mock.Of<IPublishedContent>());
var bound = RenderModelBinder.BindModel(content, typeof (IPublishedContent), CultureInfo.CurrentCulture);
Assert.AreSame(content, bound);
}
[Test]
public void BindModel_RenderModel_To_IPublishedContent()
{
var content = new MyContent(Mock.Of<IPublishedContent>());
var renderModel = new RenderModel(content, CultureInfo.CurrentCulture);
var bound = RenderModelBinder.BindModel(renderModel, typeof(IPublishedContent), CultureInfo.CurrentCulture);
Assert.AreSame(content, bound);
}
[Test]
public void BindModel_IPublishedContent_To_RenderModel()
{
var content = new MyContent(Mock.Of<IPublishedContent>());
var bound = (IRenderModel)RenderModelBinder.BindModel(content, typeof(RenderModel), CultureInfo.CurrentCulture);
Assert.AreSame(content, bound.Content);
}
[Test]
public void BindModel_IPublishedContent_To_Generic_RenderModel()
{
var content = new MyContent(Mock.Of<IPublishedContent>());
var bound = (IRenderModel)RenderModelBinder.BindModel(content, typeof(RenderModel<MyContent>), CultureInfo.CurrentCulture);
Assert.AreSame(content, bound.Content);
}
[Test]
public void No_DataToken_Returns_Null()
{
var binder = new RenderModelBinder();
var routeData = new RouteData();
var result = binder.BindModel(new ControllerContext(Mock.Of<HttpContextBase>(), routeData, Mock.Of<ControllerBase>()),
new ModelBindingContext());
Assert.IsNull(result);
}
[Test]
public void Invalid_DataToken_Model_Type_Returns_Null()
{
var binder = new RenderModelBinder();
var routeData = new RouteData();
routeData.DataTokens[Core.Constants.Web.UmbracoDataToken] = "hello";
//the value provider is the default implementation
var valueProvider = new Mock<IValueProvider>();
//also IUnvalidatedValueProvider
var invalidatedValueProvider = valueProvider.As<IUnvalidatedValueProvider>();
invalidatedValueProvider.Setup(x => x.GetValue(It.IsAny<string>(), It.IsAny<bool>())).Returns(() =>
new ValueProviderResult(null, "", CultureInfo.CurrentCulture));
var controllerCtx = new ControllerContext(
Mock.Of<HttpContextBase>(http => http.Items == new Dictionary<object, object>()),
routeData,
Mock.Of<ControllerBase>());
var result = binder.BindModel(controllerCtx,
new ModelBindingContext
{
ValueProvider = valueProvider.Object,
ModelMetadata = new ModelMetadata(new EmptyModelMetadataProvider(), null, () => null, typeof(IPublishedContent), "content")
});
Assert.IsNull(result);
}
[Test]
public void IPublishedContent_DataToken_Model_Type_Uses_DefaultImplementation()
{
var content = new MyContent(Mock.Of<IPublishedContent>());
var binder = new RenderModelBinder();
var routeData = new RouteData();
routeData.DataTokens[Core.Constants.Web.UmbracoDataToken] = content;
//the value provider is the default implementation
var valueProvider = new Mock<IValueProvider>();
//also IUnvalidatedValueProvider
var invalidatedValueProvider = valueProvider.As<IUnvalidatedValueProvider>();
invalidatedValueProvider.Setup(x => x.GetValue(It.IsAny<string>(), It.IsAny<bool>())).Returns(() =>
new ValueProviderResult(content, "content", CultureInfo.CurrentCulture));
var controllerCtx = new ControllerContext(
Mock.Of<HttpContextBase>(http => http.Items == new Dictionary<object, object>()),
routeData,
Mock.Of<ControllerBase>());
var result = binder.BindModel(controllerCtx,
new ModelBindingContext
{
ValueProvider = valueProvider.Object,
ModelMetadata = new ModelMetadata(new EmptyModelMetadataProvider(), null, () => null, typeof(IPublishedContent), "content")
});
Assert.AreEqual(content, result);
}
public class MyOtherContent
{
}
public class MyContent : PublishedContentWrapped
{
public MyContent(IPublishedContent content) : base(content)
{
}
}
}
}
+7 -7
View File
@@ -1,5 +1,5 @@
{
"env": {
"env": {
"browser": true
},
@@ -8,7 +8,7 @@
],
"rules": {
"eqeqeq": 2,
"eqeqeq": 2,
"curly": 2,
"no-unused-vars": 1,
@@ -18,8 +18,8 @@
"dot-notation": 1,
"no-use-before-define": 0,
"angular/ng_controller_as": 1,
"angular/ng_controller_as_vm": 1,
"angular/ng_controller_as": 1,
"angular/ng_controller_as_vm": 1,
"strict": 0,
@@ -32,8 +32,8 @@
"comma-spacing": 0,
"no-trailing-spaces": 0,
"eol-last": 0,
"no-underscore-dangle": 0,
"camelcase": 0
"no-underscore-dangle": 0,
"camelcase": 0
},
"globals": {
@@ -50,4 +50,4 @@
"Bloodhound", false
}
}
}
@@ -210,7 +210,7 @@ function submit()
if (findDepth(curLineHTML, cc) !== 0) {
// Cursor is inside a <tag>, don't set cursor:
curLineHTML = curLineHTML.replace(cc, '');
doc.getLineHandle(pos.line).text = curLineHTML;
doc.setLine(pos.line, curLineHTML);
}
// Submit HTML to TinyMCE:
+1 -1
View File
@@ -37,7 +37,7 @@
"grunt-ngdocs": "~0.1.2",
"grunt-open": "~0.2.0",
"grunt-postcss": "~0.6.0",
"grunt-recess": "~0.3",
"grunt-recess": "~1.0.1",
"karma": "~0.9",
"karma-chrome-launcher": "0.0.2",
"karma-coffee-preprocessor": "0.0.1",
+7 -27
View File
@@ -22,35 +22,15 @@ var packages = angular.module("umbraco.packages", []);
//module is initilized.
angular.module("umbraco.views", ["umbraco.viewcache"]);
angular.module("umbraco.viewcache", [])
.run(function($rootScope, $templateCache) {
/** For debug mode, always clear template cache to cut down on
.run(function($rootScope, $templateCache){
/** For debug mode, always clear template cache to cut down on
dev frustration and chrome cache on templates */
if (Umbraco.Sys.ServerVariables.isDebuggingEnabled) {
$templateCache.removeAll();
if(Umbraco.Sys.ServerVariables.isDebuggingEnabled){
//$rootScope.$on('$viewContentLoaded', function() {
$templateCache.removeAll();
//});
}
})
.config([
//This ensures that all of our angular views are cache busted, if the path starts with views/ and ends with .html, then
// we will append the cache busting value to it. This way all upgraded sites will not have to worry about browser cache.
"$provide", function($provide) {
return $provide.decorator("$http", [
"$delegate", function($delegate) {
var get = $delegate.get;
$delegate.get = function (url, config) {
if (Umbraco.Sys.ServerVariables.application && url.startsWith("views/") && url.endsWith(".html")) {
var rnd = Umbraco.Sys.ServerVariables.application.version + "." + Umbraco.Sys.ServerVariables.application.cdf;
var _op = (url.indexOf("?") > 0) ? "&" : "?";
url += _op + "umb__rnd=" + rnd;
}
return get(url, config);
};
return $delegate;
}
]);
}
]);
})
//Call a document callback if defined, this is sort of a dodgy hack to
// be able to configure angular values in the Default.cshtml
@@ -1,22 +1,20 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:autoScale
* @element div
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
* @function
* @description
* Resize div's automatically to fit to the bottom of the screen, as an optional parameter an y-axis offset can be set
* So if you only want to scale the div to 70 pixels from the bottom you pass "70"
* @example
* <example module="umbraco.directives">
* <file name="index.html">
* <div auto-scale="70" class="input-block-level"></div>
* </file>
* </example>
**/
* @ngdoc directive
* @name umbraco.directives.directive:autoScale
* @element div
* @function
*
* @description
* Resize div's automatically to fit to the bottom of the screen, as an optional parameter an y-axis offset can be set
* So if you only want to scale the div to 70 pixels from the bottom you pass "70"
*
* @example
<example module="umbraco.directives">
<file name="index.html">
<div auto-scale="70" class="input-block-level"></div>
</file>
</example>
*/
angular.module("umbraco.directives")
.directive('autoScale', function ($window) {
return function (scope, el, attrs) {
@@ -37,4 +35,4 @@ angular.module("umbraco.directives")
});
};
});
});
@@ -1,12 +1,9 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:detectFold
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
* @name umbraco.directives.directive:umbPanel
* @description This is used for the editor buttons to ensure they are displayed correctly if the horizontal overflow of the editor
* exceeds the height of the window
* exceeds the height of the window
**/
angular.module("umbraco.directives.html")
.directive('detectFold', function ($timeout, $log, windowResizeListener) {
return {
@@ -1,14 +1,11 @@
/**
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbItemSorter
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
* @function
* @element ANY
* @restrict E
* @description A re-usable directive for sorting items
**/
function umbItemSorter(angularHelper) {
return {
scope: {
@@ -1,14 +1,11 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbContentName
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
* @restrict E
* @function
* @description
* Used by editors that require naming an entity. Shows a textbox/headline with a required validator within it's own form.
**/
angular.module("umbraco.directives")
.directive('umbContentName', function ($timeout, localizationService) {
return {
@@ -1,14 +1,11 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbHeader
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
* @restrict E
* @function
* @description
* The header on an editor that contains tabs using bootstrap tabs - THIS IS OBSOLETE, use umbTabHeader instead
**/
angular.module("umbraco.directives")
.directive('umbHeader', function ($parse, $timeout) {
return {
@@ -1,13 +1,10 @@
/**
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbLogin
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
* @name umbraco.directives.directive:login
* @function
* @element ANY
* @restrict E
**/
function loginDirective() {
return {
restrict: "E", // restrict to an element
@@ -1,13 +1,3 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbOptionsMenu
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
* @function
* @element ANY
* @restrict E
**/
angular.module("umbraco.directives")
.directive('umbOptionsMenu', function ($injector, treeService, navigationService, umbModelMapper, appState) {
return {
@@ -1,11 +1,8 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbPhotoFolder
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
* @restrict E
**/
angular.module("umbraco.directives.html")
.directive('umbPhotoFolder', function($compile, $log, $timeout, $filter, umbPhotoFolderHelper) {
@@ -1,24 +1,20 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbSort
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
*
* @element div
* @function
*
* @description
* Resize div's automatically to fit to the bottom of the screen, as an optional parameter an y-axis offset can be set
* So if you only want to scale the div to 70 pixels from the bottom you pass "70"
*
* @example
* <example module="umbraco.directives">
* <file name="index.html">
* <div umb-sort="70" class="input-block-level"></div>
* </file>
* </example>
**/
* @ngdoc directive
* @name umbraco.directives.directive:umbSort
* @element div
* @function
*
* @description
* Resize div's automatically to fit to the bottom of the screen, as an optional parameter an y-axis offset can be set
* So if you only want to scale the div to 70 pixels from the bottom you pass "70"
*
* @example
<example module="umbraco.directives">
<file name="index.html">
<div umb-sort="70" class="input-block-level"></div>
</file>
</example>
*/
angular.module("umbraco.directives")
.value('umbSortContextInternal',{})
.directive('umbSort', function($log,umbSortContextInternal) {
@@ -169,4 +165,4 @@ angular.module("umbraco.directives")
}
};
});
});
@@ -1,12 +1,8 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbTabView
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
*
* @restrict E
**/
angular.module("umbraco.directives")
.directive('umbTabView', function($timeout, $log){
return {
@@ -1,12 +1,8 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbUploadDropzone
* @deprecated
* We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use.
*
* @restrict E
**/
angular.module("umbraco.directives.html")
.directive('umbUploadDropzone', function(){
return {
@@ -17,7 +17,7 @@
if(convert){
element.html("<i class='icon-section " + convert + "'></i>");
}else{
element.html("<img class='icon-section' src='images/tray/" + icon + "'>");
element.html("<img src='images/tray/" + icon + "'>");
}
//it's a file, normally legacy so look in the icon tray images
}
@@ -3,11 +3,93 @@
* @name umbraco.directives.directive:umbNavigation
* @restrict E
**/
function umbNavigationDirective() {
function umbNavigationDirective(appState, $location) {
return {
restrict: "E", // restrict to an element
replace: true, // replace the html element with the template
templateUrl: 'views/components/application/umb-navigation.html'
templateUrl: 'views/components/application/umb-navigation.html',
link: function (scope, element, attr, ctrl) {
scope.showTreeNavigation = appState.getGlobalState("showNavigation");
scope.searchClick = function() {
scope.searchOverlay = {
view: "search",
show: true,
submit: function(model) {
$location.path(model.selectedItem.editorPath);
scope.searchOverlay.show = false;
scope.searchOverlay = null;
},
close: function(oldModel) {
scope.searchOverlay.show = false;
scope.searchOverlay = null;
}
};
};
scope.avatarClick = function(){
if(scope.helpDialog) {
closeHelpDialog();
}
if(!scope.userDialog) {
scope.userDialog = {
view: "user",
show: true,
close: function(oldModel) {
closeUserDialog();
}
};
} else {
closeUserDialog();
}
};
function closeUserDialog() {
scope.userDialog.show = false;
scope.userDialog = null;
}
scope.helpClick = function(){
if(scope.userDialog) {
closeUserDialog();
}
if(!scope.helpDialog) {
scope.helpDialog = {
view: "help",
show: true,
close: function(oldModel) {
closeHelpDialog();
}
};
} else {
closeHelpDialog();
}
};
function closeHelpDialog() {
scope.helpDialog.show = false;
scope.helpDialog = null;
}
scope.showTree = function () {
scope.showTreeNavigation = appState.getGlobalState("showNavigation");
if(scope.showTreeNavigation === true) {
appState.setGlobalState("showNavigation", false);
} else {
appState.setGlobalState("showNavigation", true);
}
};
}
};
}
@@ -11,7 +11,7 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se
link: function (scope, element, attr, ctrl) {
//setup scope vars
scope.maxSections = 7;
scope.maxSections = 5;
scope.overflowingSections = 0;
scope.sections = [];
scope.currentSection = appState.getSectionState("currentSection");
@@ -34,16 +34,25 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se
sectionResource.getSections()
.then(function (result) {
scope.sections = result;
calculateHeight();
// hide overflowing sections
scope.totalSections = scope.sections.length;
if(scope.totalSections > scope.maxSections){
scope.needTray = true;
scope.overflowingSections = scope.maxSections - scope.totalSections;
}
// calculateHeight();
});
}
function calculateHeight(){
$timeout(function(){
//total height minus room for avatar and help icon
var height = $(window).height()-200;
var height = $(window).width();
scope.totalSections = scope.sections.length;
scope.maxSections = Math.floor(height / 70);
scope.maxSections = Math.floor(width / 70);
scope.needTray = false;
if(scope.totalSections > scope.maxSections){
@@ -84,57 +93,7 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se
});
//on page resize
window.onresize = calculateHeight;
scope.avatarClick = function(){
if(scope.helpDialog) {
closeHelpDialog();
}
if(!scope.userDialog) {
scope.userDialog = {
view: "user",
show: true,
close: function(oldModel) {
closeUserDialog();
}
};
} else {
closeUserDialog();
}
};
function closeUserDialog() {
scope.userDialog.show = false;
scope.userDialog = null;
}
scope.helpClick = function(){
if(scope.userDialog) {
closeUserDialog();
}
if(!scope.helpDialog) {
scope.helpDialog = {
view: "help",
show: true,
close: function(oldModel) {
closeHelpDialog();
}
};
} else {
closeHelpDialog();
}
};
function closeHelpDialog() {
scope.helpDialog.show = false;
scope.helpDialog = null;
}
// window.onresize = calculateHeight;
scope.sectionClick = function (event, section) {
@@ -0,0 +1,30 @@
(function() {
'use strict';
function TreeNavigation(appState) {
function link(scope, el, attr, ctrl) {
scope.showTreeNavigation = false;
scope.currentSection = appState.getSectionState("currentSection");
scope.$watch(function(){
return appState.getGlobalState("showNavigation");
}, function (newValue) {
scope.showTreeNavigation = newValue;
});
}
var directive = {
restrict: 'E',
replace: true,
templateUrl: 'views/components/application/umb-tree-navigation.html',
link: link
};
return directive;
}
angular.module('umbraco.directives').directive('umbTreeNavigation', TreeNavigation);
})();
@@ -1,71 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbButton
@restrict E
@scope
@description
Use this directive to render an umbraco button. The directive can be used to generate all types of buttons, set type, style, translation, shortcut and much more.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-button
action="vm.clickButton()"
type="button"
button-style="success"
state="vm.buttonState"
shortcut="ctrl+c"
label="My button"
disabled="vm.buttonState === 'busy'">
</umb-button>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller(myService) {
var vm = this;
vm.buttonState = "init";
vm.clickButton = clickButton;
function clickButton() {
vm.buttonState = "busy";
myService.clickButton().then(function() {
vm.buttonState = "success";
}, function() {
vm.buttonState = "error";
});
}
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {callback} action The button action which should be performed when the button is clicked.
@param {string=} href Url/Path to navigato to.
@param {string=} type Set the button type ("button" or "submit").
@param {string=} buttonStyle Set the style of the button. The directive uses the default bootstrap styles ("primary", "info", "success", "warning", "danger", "inverse", "link").
@param {string=} state Set a progress state on the button ("init", "busy", "success", "error").
@param {string=} shortcut Set a keyboard shortcut for the button ("ctrl+c").
@param {string=} label Set the button label.
@param {string=} labelKey Set a localization key to make a multi lingual button ("general_buttonText").
@param {string=} icon Set a button icon. Can only be used when buttonStyle is "link".
@param {boolean=} disabled Set to <code>true</code> to disable the button.
**/
(function() {
'use strict';
@@ -1,94 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbButtonGroup
@restrict E
@scope
@description
Use this directive to render a button with a dropdown of alternative actions.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-button-group
ng-if="vm.buttonGroup"
default-button="vm.buttonGroup.defaultButton"
sub-buttons="vm.buttonGroup.subButtons"
direction="down"
float="right">
</umb-button-group>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.buttonGroup = {
defaultButton: {
labelKey: "general_defaultButton",
hotKey: "ctrl+d",
hotKeyWhenHidden: true,
handler: function() {
// do magic here
}
},
subButtons: [
{
labelKey: "general_subButton",
hotKey: "ctrl+b",
hotKeyWhenHidden: true,
handler: function() {
// do magic here
}
}
]
};
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
<h3>Button model description</h3>
<ul>
<li>
<strong>labekKey</strong>
<small>(string)</small> -
Set a localization key to make a multi lingual button ("general_buttonText").
</li>
<li>
<strong>hotKey</strong>
<small>(array)</small> -
Set a keyboard shortcut for the button ("ctrl+c").
</li>
<li>
<strong>hotKeyWhenHidden</strong>
<small>(boolean)</small> -
As a default the hotkeys only works on elements visible in the UI. Set to <code>true</code> to set a hotkey on the hidden sub buttons.
</li>
<li>
<strong>handler</strong>
<small>(callback)</small> -
Set a callback to handle button click events.
</li>
</ul>
@param {object} defaultButton The model of the default button.
@param {array} subButtons Array of sub buttons.
@param {string=} state Set a progress state on the button ("init", "busy", "success", "error").
@param {string=} direction Set the direction of the dropdown ("up", "down").
@param {string=} float Set the float of the dropdown. ("left", "right").
**/
(function() {
'use strict';
@@ -1,43 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorSubHeader
@restrict E
@description
Use this directive to construct a sub header in the main editor window.
The sub header is sticky and will follow along down the page when scrolling.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-container>
<umb-editor-sub-header>
// sub header content here
</umb-editor-sub-header>
</umb-editor-container>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderContentLeft umbEditorSubHeaderContentLeft}</li>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderContentRight umbEditorSubHeaderContentRight}</li>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderSection umbEditorSubHeaderSection}</li>
</ul>
**/
(function() {
'use strict';
@@ -1,50 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorSubHeaderContentLeft
@restrict E
@description
Use this directive to left align content in a sub header in the main editor window.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-container>
<umb-editor-sub-header>
<umb-editor-sub-header-content-left>
// left content here
</umb-editor-sub-header-content-left>
<umb-editor-sub-header-content-right>
// right content here
</umb-editor-sub-header-content-right>
</umb-editor-sub-header>
</umb-editor-container>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorSubHeader umbEditorSubHeader}</li>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderContentRight umbEditorSubHeaderContentRight}</li>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderSection umbEditorSubHeaderSection}</li>
</ul>
**/
(function() {
'use strict';
@@ -1,50 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorSubHeaderContentRight
@restrict E
@description
Use this directive to rigt align content in a sub header in the main editor window.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-container>
<umb-editor-sub-header>
<umb-editor-sub-header-content-left>
// left content here
</umb-editor-sub-header-content-left>
<umb-editor-sub-header-content-right>
// right content here
</umb-editor-sub-header-content-right>
</umb-editor-sub-header>
</umb-editor-container>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorSubHeader umbEditorSubHeader}</li>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderContentLeft umbEditorSubHeaderContentLeft}</li>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderSection umbEditorSubHeaderSection}</li>
</ul>
**/
(function() {
'use strict';
@@ -1,58 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorSubHeaderSection
@restrict E
@description
Use this directive to create sections, divided by borders, in a sub header in the main editor window.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-container>
<umb-editor-sub-header>
<umb-editor-sub-header-content-right>
<umb-editor-sub-header-section>
// section content here
</umb-editor-sub-header-section>
<umb-editor-sub-header-section>
// section content here
</umb-editor-sub-header-section>
<umb-editor-sub-header-section>
// section content here
</umb-editor-sub-header-section>
</umb-editor-sub-header-content-right>
</umb-editor-sub-header>
</umb-editor-container>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorSubHeader umbEditorSubHeader}</li>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderContentLeft umbEditorSubHeaderContentLeft}</li>
<li>{@link umbraco.directives.directive:umbEditorSubHeaderContentRight umbEditorSubHeaderContentRight}</li>
</ul>
**/
(function() {
'use strict';
@@ -0,0 +1,18 @@
(function() {
'use strict';
function EditorSubView() {
var directive = {
transclude: true,
restrict: 'E',
replace: true,
templateUrl: 'views/components/editor/subview/umb-editor-sub-view.html'
};
return directive;
}
angular.module('umbraco.directives').directive('umbEditorSubView', EditorSubView);
})();
@@ -0,0 +1,18 @@
(function() {
'use strict';
function EditorSubViewContainer() {
var directive = {
transclude: true,
restrict: 'E',
replace: true,
templateUrl: 'views/components/editor/subview/umb-editor-sub-view-container.html'
};
return directive;
}
angular.module('umbraco.directives').directive('umbEditorSubViewContainer', EditorSubViewContainer);
})();
@@ -0,0 +1,18 @@
(function() {
'use strict';
function EditorSubViewContent() {
var directive = {
transclude: true,
restrict: 'E',
replace: true,
templateUrl: 'views/components/editor/subview/umb-editor-sub-view-content.html'
};
return directive;
}
angular.module('umbraco.directives').directive('umbEditorSubViewContent', EditorSubViewContent);
})();
@@ -0,0 +1,18 @@
(function() {
'use strict';
function EditorSubViewHeader() {
var directive = {
transclude: true,
restrict: 'E',
replace: true,
templateUrl: 'views/components/editor/subview/umb-editor-sub-view-header.html'
};
return directive;
}
angular.module('umbraco.directives').directive('umbEditorSubViewHeader', EditorSubViewHeader);
})();
@@ -0,0 +1,18 @@
(function() {
'use strict';
function EditorSubViewSidebar() {
var directive = {
transclude: true,
restrict: 'E',
replace: true,
templateUrl: 'views/components/editor/subview/umb-editor-sub-view-sidebar.html'
};
return directive;
}
angular.module('umbraco.directives').directive('umbEditorSubViewSidebar', EditorSubViewSidebar);
})();
@@ -1,47 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbBreadcrumbs
@restrict E
@scope
@description
Use this directive to generate a list of breadcrumbs.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-breadcrumbs
ng-if="vm.ancestors && vm.ancestors.length > 0"
ancestors="vm.ancestors"
entity-type="content">
</umb-breadcrumbs>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller(myService) {
var vm = this;
vm.ancestors = [];
myService.getAncestors().then(function(ancestors){
vm.ancestors = ancestors;
});
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {array} ancestors Array of ancestors
@param {string} entityType The content entity type (member, media, content).
**/
(function() {
'use strict';
@@ -1,42 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorContainer
@restrict E
@description
Use this directive to construct a main content area inside the main editor window.
<h3>Markup example</h3>
<pre>
<div ng-controller="Umbraco.Controller as vm">
<umb-editor-view>
<umb-editor-header
// header configuration>
</umb-editor-header>
<umb-editor-container>
// main content here
</umb-editor-container>
<umb-editor-footer>
// footer content here
</umb-editor-footer>
</umb-editor-view>
</div>
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li>
<li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li>
<li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li>
</ul>
**/
(function() {
'use strict';
@@ -1,48 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorFooter
@restrict E
@description
Use this directive to construct a footer inside the main editor window.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-header
// header configuration>
</umb-editor-header>
<umb-editor-container>
// main content here
</umb-editor-container>
<umb-editor-footer>
// footer content here
</umb-editor-footer>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li>
<li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li>
<li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li>
<li>{@link umbraco.directives.directive:umbEditorFooterContentLeft umbEditorFooterContentLeft}</li>
<li>{@link umbraco.directives.directive:umbEditorFooterContentRight umbEditorFooterContentRight}</li>
</ul>
**/
(function() {
'use strict';
@@ -1,48 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorFooterContentLeft
@restrict E
@description
Use this directive to align content left inside the main editor footer.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-footer>
<umb-editor-footer-content-left>
// align content left
</umb-editor-footer-content-left>
<umb-editor-footer-content-right>
// align content right
</umb-editor-footer-content-right>
</umb-editor-footer>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li>
<li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li>
<li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li>
<li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li>
<li>{@link umbraco.directives.directive:umbEditorFooterContentRight umbEditorFooterContentRight}</li>
</ul>
**/
(function() {
'use strict';
@@ -1,48 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorFooterContentRight
@restrict E
@description
Use this directive to align content right inside the main editor footer.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-footer>
<umb-editor-footer-content-left>
// align content left
</umb-editor-footer-content-left>
<umb-editor-footer-content-right>
// align content right
</umb-editor-footer-content-right>
</umb-editor-footer>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li>
<li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li>
<li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li>
<li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li>
<li>{@link umbraco.directives.directive:umbEditorFooterContentLeft umbEditorFooterContentLeft}</li>
</ul>
**/
(function() {
'use strict';
@@ -1,213 +1,25 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorHeader
@restrict E
@scope
@description
Use this directive to construct a header inside the main editor window.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-header
name="vm.content.name"
hide-alias="true"
hide-description="true"
hide-icon="true">
</umb-editor-header>
<umb-editor-container>
// main content here
</umb-editor-container>
<umb-editor-footer>
// footer content here
</umb-editor-footer>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Markup example - with tabs</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" val-form-manager novalidate>
<umb-editor-view umb-tabs>
<umb-editor-header
name="vm.content.name"
tabs="vm.content.tabs"
hide-alias="true"
hide-description="true"
hide-icon="true">
</umb-editor-header>
<umb-editor-container>
<umb-tabs-content class="form-horizontal" view="true">
<umb-tab id="tab{{tab.id}}" ng-repeat="tab in vm.content.tabs" rel="{{tab.id}}">
<div ng-show="tab.alias==='tab1'">
// tab 1 content
</div>
<div ng-show="tab.alias==='tab2'">
// tab 2 content
</div>
</umb-tab>
</umb-tabs-content>
</umb-editor-container>
<umb-editor-footer>
// footer content here
</umb-editor-footer>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Controller example - with tabs</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.content = {
name: "",
tabs: [
{
id: 1,
label: "Tab 1",
alias: "tab1",
active: true
},
{
id: 2,
label: "Tab 2",
alias: "tab2",
active: false
}
]
};
}
angular.module("umbraco").controller("MySection.Controller", Controller);
})();
</pre>
<h3>Markup example - with sub views</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" val-form-manager novalidate>
<umb-editor-view>
<umb-editor-header
name="vm.content.name"
navigation="vm.content.navigation"
hide-alias="true"
hide-description="true"
hide-icon="true">
</umb-editor-header>
<umb-editor-container>
<umb-editor-sub-views
sub-views="vm.content.navigation"
model="vm.content">
</umb-editor-sub-views>
</umb-editor-container>
<umb-editor-footer>
// footer content here
</umb-editor-footer>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Controller example - with sub views</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.content = {
name: "",
navigation: [
{
"name": "Section 1",
"icon": "icon-document-dashed-line",
"view": "/App_Plugins/path/to/html.html",
"active": true
},
{
"name": "Section 2",
"icon": "icon-list",
"view": "/App_Plugins/path/to/html.html",
}
]
};
}
angular.module("umbraco").controller("MySection.Controller", Controller);
})();
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li>
<li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li>
<li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li>
</ul>
@param {string} name The content name.
@param {array=} tabs Array of tabs. See example above.
@param {array=} navigation Array of sub views. See example above.
@param {boolean=} nameLocked Set to <code>true</code> to lock the name.
@param {object=} menu Add a context menu to the editor.
@param {string=} icon Show and edit the content icon. Opens an overlay to change the icon.
@param {boolean=} hideIcon Set to <code>true</code> to hide icon.
@param {string=} alias show and edit the content alias.
@param {boolean=} hideAlias Set to <code>true</code> to hide alias.
@param {string=} description Add a description to the content.
@param {boolean=} hideDescription Set to <code>true</code> to hide description.
**/
(function() {
'use strict';
function EditorHeaderDirective(iconHelper) {
function EditorHeaderDirective(iconHelper, variationsHelper) {
function link(scope, el, attr, ctrl) {
scope.showVariationsQuickSwitchToggle = false;
scope.showVariationsQuickSwitch = false;
function activate() {
showVariationsQuickSwitch(scope.variations);
}
function showVariationsQuickSwitch(variations) {
if(variations && variations.length > 1 || variations && variations.length === 1 && variations[0].variations && variations[0].variations.length > 0) {
scope.showVariationsQuickSwitchToggle = true;
} else {
scope.showVariationsQuickSwitchToggle = false;
}
}
scope.openIconPicker = function() {
scope.dialogModel = {
view: "iconpicker",
@@ -227,6 +39,62 @@ Use this directive to construct a header inside the main editor window.
}
};
};
scope.toggleVariationsQuickSwitch = function() {
scope.showVariationsQuickSwitch = !scope.showVariationsQuickSwitch;
};
scope.hideVariationsQuickSwitch = function() {
scope.showVariationsQuickSwitch = false;
};
scope.toggleSubItems = function(item, $event) {
item.showSubItems = !item.showSubItems;
$event.preventDefault();
$event.stopPropagation();
};
scope.selectItem = function(item) {
if(scope.onSelectItem) {
for(var i = 0; i < scope.variations.length; i++) {
var language = scope.variations[i];
language.active = false;
if(language.variations && language.variations.length > 0) {
for(var variationIndex = 0; variationIndex < language.variations.length; variationIndex++) {
var variation = language.variations[variationIndex];
variation.active = false;
}
}
}
// set selected item to active
item.active = true;
scope.onSelectItem(item);
scope.showVariationsQuickSwitch = false;
}
};
scope.openInSplitView = function(item, $event) {
if(scope.onOpenInSplitView) {
scope.onOpenInSplitView(item);
scope.showVariationsQuickSwitch = false;
$event.preventDefault();
$event.stopPropagation();
}
};
scope.$watch('variations', function(newValue, oldValue){
showVariationsQuickSwitch(newValue);
}, true);
activate();
}
var directive = {
@@ -240,6 +108,11 @@ Use this directive to construct a header inside the main editor window.
actions: "=",
name: "=",
nameLocked: "=",
variation: "=",
language: "=",
variations: "=",
onSelectItem: "=",
onOpenInSplitView: "=",
menu: "=",
icon: "=",
hideIcon: "@",
@@ -6,10 +6,21 @@
function link(scope, el, attr, ctrl) {
scope.showNavigation = true;
scope.showDropdown = false;
scope.maxNavigationItems = 5;
scope.overflowingNavigationsItems = 0;
scope.needDropdown = false;
scope.clickNavigationItem = function(selectedItem) {
setItemToActive(selectedItem);
runItemAction(selectedItem);
if(scope.showDropdown) {
scope.closeDropdown();
}
};
function runItemAction(selectedItem) {
@@ -40,8 +51,29 @@
scope.showNavigation = false;
}
hideOverflowingNavigationItems();
}
function hideOverflowingNavigationItems() {
scope.totalNavigationItems = scope.navigation.length;
if(scope.totalNavigationItems > scope.maxNavigationItems){
scope.needDropdown = true;
scope.overflowingNavigationsItems = scope.maxNavigationItems - scope.totalNavigationItems;
}
}
scope.toggleDropdown = function() {
scope.showDropdown = !scope.showDropdown;
};
scope.closeDropdown = function() {
scope.showDropdown = false;
};
activate();
}
@@ -3,32 +3,6 @@
function EditorSubViewsDirective() {
function link(scope, el, attr, ctrl) {
scope.activeView = {};
// set toolbar from selected navigation item
function setActiveView(items) {
for (var index = 0; index < items.length; index++) {
var item = items[index];
if (item.active && item.view) {
scope.activeView = item;
}
}
}
// watch for navigation changes
scope.$watch('subViews', function(newValue, oldValue) {
if (newValue) {
setActiveView(newValue);
}
}, true);
}
var directive = {
restrict: 'E',
replace: true,
@@ -36,8 +10,7 @@
scope: {
subViews: "=",
model: "="
},
link: link
}
};
return directive;
@@ -0,0 +1,19 @@
(function() {
'use strict';
function EditorToolbar() {
var directive = {
restrict: 'E',
replace: true,
transclude: true,
templateUrl: 'views/components/editor/umb-editor-toolbar.html'
};
return directive;
}
angular.module('umbraco.directives').directive('umbEditorToolbar', EditorToolbar);
})();
@@ -1,66 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEditorView
@restrict E
@scope
@description
Use this directive to construct the main editor window.
<h3>Markup example</h3>
<pre>
<div ng-controller="MySection.Controller as vm">
<form name="mySectionForm" novalidate>
<umb-editor-view>
<umb-editor-header
name="vm.content.name"
hide-alias="true"
hide-description="true"
hide-icon="true">
</umb-editor-header>
<umb-editor-container>
// main content here
</umb-editor-container>
<umb-editor-footer>
// footer content here
</umb-editor-footer>
</umb-editor-view>
</form>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
}
angular.module("umbraco").controller("MySection.Controller", Controller);
})();
</pre>
<h3>Use in combination with</h3>
<ul>
<li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li>
<li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li>
<li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li>
</ul>
**/
(function() {
'use strict';
@@ -1,8 +1,7 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:hotkey
**/
* @ngdoc directive
* @name umbraco.directives.directive:headline
**/
angular.module("umbraco.directives")
.directive('hotkey', function($window, keyboardService, $log) {
@@ -1,23 +1,13 @@
/**
@ngdoc directive
@name umbraco.directives.directive:preventDefault
@description
Use this directive to prevent default action of an element. Effectively implementing <a href="https://api.jquery.com/event.preventdefault/">jQuery's preventdefault</a>
<h3>Markup example</h3>
<pre>
<a href="https://umbraco.com" prevent-default>Don't go to Umbraco.com</a>
</pre>
* @ngdoc directive
* @name umbraco.directives.directive:preventDefault
**/
angular.module("umbraco.directives")
.directive('preventDefault', function() {
return function(scope, element, attrs) {
var enabled = true;
//check if there's a value for the attribute, if there is and it's false then we conditionally don't
//check if there's a value for the attribute, if there is and it's false then we conditionally don't
//prevent default.
if (attrs.preventDefault) {
attrs.$observe("preventDefault", function (newVal) {
@@ -36,4 +26,4 @@ angular.module("umbraco.directives")
}
});
};
});
});
@@ -1,6 +1,6 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbControlGroup
* @name umbraco.directives.directive:umbProperty
* @restrict E
**/
angular.module("umbraco.directives.html")
@@ -1,6 +1,6 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbPane
* @name umbraco.directives.directive:umbProperty
* @restrict E
**/
angular.module("umbraco.directives.html")
@@ -1,9 +1,10 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbImageGravity
* @name umbraco.directives.directive:umbCropsy
* @restrict E
* @function
* @description
* Used by editors that require naming an entity. Shows a textbox/headline with a required validator within it's own form.
**/
angular.module("umbraco.directives")
.directive('umbImageGravity', function ($timeout, localizationService, $log) {
@@ -1,9 +1,10 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbImageThumbnail
* @name umbraco.directives.directive:umbCropsy
* @restrict E
* @function
* @description
* Used by editors that require naming an entity. Shows a textbox/headline with a required validator within it's own form.
**/
angular.module("umbraco.directives")
.directive('umbImageThumbnail',
@@ -1,409 +1,8 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbOverlay
@restrict E
@scope
@description
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<button type="button" ng-click="vm.openOverlay()"></button>
<umb-overlay
ng-if="vm.overlay.show"
model="vm.overlay"
view="vm.overlay.view"
position="right">
</umb-overlay>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.openOverlay = openOverlay;
function openOverlay() {
vm.overlay = {
view: "mediapicker",
show: true,
submit: function(model) {
vm.overlay.show = false;
vm.overlay = null;
},
close: function(oldModel) {
vm.overlay.show = false;
vm.overlay = null;
}
}
};
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
<h1>General Options</h1>
Lorem ipsum dolor sit amet..
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tr>
<td>model.title</td>
<td>String</td>
<td>Set the title of the overlay.</td>
</tr>
<tr>
<td>model.subTitle</td>
<td>String</td>
<td>Set the subtitle of the overlay.</td>
</tr>
<tr>
<td>model.submitButtonLabel</td>
<td>String</td>
<td>Set an alternate submit button text</td>
</tr>
<tr>
<td>model.submitButtonLabelKey</td>
<td>String</td>
<td>Set an alternate submit button label key for localized texts</td>
</tr>
<tr>
<td>model.hideSubmitButton</td>
<td>Boolean</td>
<td>Hides the submit button</td>
</tr>
<tr>
<td>model.closeButtonLabel</td>
<td>String</td>
<td>Set an alternate close button text</td>
</tr>
<tr>
<td>model.closeButtonLabelKey</td>
<td>String</td>
<td>Set an alternate close button label key for localized texts</td>
</tr>
<tr>
<td>model.show</td>
<td>Boolean</td>
<td>Show/hide the overlay</td>
</tr>
<tr>
<td>model.submit</td>
<td>Function</td>
<td>Callback function when the overlay submits. Returns the overlay model object</td>
</tr>
<tr>
<td>model.close</td>
<td>Function</td>
<td>Callback function when the overlay closes. Returns a copy of the overlay model object before being modified</td>
</tr>
</table>
<h1>Content Picker</h1>
Opens a content picker.</br>
<strong>view: </strong>contentpicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tr>
<td>model.multiPicker</td>
<td>Boolean</td>
<td>Pick one or multiple items</td>
</tr>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tr>
<td>model.selection</td>
<td>Array</td>
<td>Array of content objects</td>
</tr>
</table>
<h1>Icon Picker</h1>
Opens an icon picker.</br>
<strong>view: </strong>iconpicker
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tr>
<td>model.icon</td>
<td>String</td>
<td>The icon class</td>
</tr>
</table>
<h1>Item Picker</h1>
Opens an item picker.</br>
<strong>view: </strong>itempicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.availableItems</td>
<td>Array</td>
<td>Array of available items</td>
</tr>
<tr>
<td>model.selectedItems</td>
<td>Array</td>
<td>Array of selected items. When passed in the selected items will be filtered from the available items.</td>
</tr>
<tr>
<td>model.filter</td>
<td>Boolean</td>
<td>Set to false to hide the filter</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tr>
<td>model.selectedItem</td>
<td>Object</td>
<td>The selected item</td>
</tr>
</table>
<h1>Macro Picker</h1>
Opens a media picker.</br>
<strong>view: </strong>macropicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.dialogData</td>
<td>Object</td>
<td>Object which contains array of allowedMacros. Set to <code>null</code> to allow all.</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.macroParams</td>
<td>Array</td>
<td>Array of macro params</td>
</tr>
<tr>
<td>model.selectedMacro</td>
<td>Object</td>
<td>The selected macro</td>
</tr>
</tbody>
</table>
<h1>Media Picker</h1>
Opens a media picker.</br>
<strong>view: </strong>mediapicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.multiPicker</td>
<td>Boolean</td>
<td>Pick one or multiple items</td>
</tr>
<tr>
<td>model.onlyImages</td>
<td>Boolean</td>
<td>Only display files that have an image file-extension</td>
</tr>
<tr>
<td>model.disableFolderSelect</td>
<td>Boolean</td>
<td>Disable folder selection</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.selectedImages</td>
<td>Array</td>
<td>Array of selected images</td>
</tr>
</tbody>
</table>
<h1>Member Group Picker</h1>
Opens a member group picker.</br>
<strong>view: </strong>membergrouppicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.multiPicker</td>
<td>Boolean</td>
<td>Pick one or multiple items</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.selectedMemberGroup</td>
<td>String</td>
<td>The selected member group</td>
</tr>
<tr>
<td>model.selectedMemberGroups (multiPicker)</td>
<td>Array</td>
<td>The selected member groups</td>
</tr>
</tbody>
</table>
<h1>Member Picker</h1>
Opens a member picker. </br>
<strong>view: </strong>memberpicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.multiPicker</td>
<td>Boolean</td>
<td>Pick one or multiple items</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.selection</td>
<td>Array</td>
<td>Array of selected members/td>
</tr>
</tbody>
</table>
<h1>YSOD</h1>
Opens an overlay to show a custom YSOD. </br>
<strong>view: </strong>ysod
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.error</td>
<td>Object</td>
<td>Error object</td>
</tr>
</tbody>
</table>
@param {object} model Overlay options.
@param {string} view Path to view or one of the default view names.
@param {string} position The overlay position ("left", "right", "center": "target").
**/
* @ngdoc directive
* @name umbraco.directives.directive:umbProperty
* @restrict E
**/
(function() {
'use strict';
@@ -11,22 +11,88 @@ angular.module("umbraco.directives")
},
transclude: true,
restrict: 'E',
replace: true,
replace: true,
templateUrl: 'views/components/property/umb-property.html',
link: function(scope) {
scope.propertyAlias = Umbraco.Sys.ServerVariables.isDebuggingEnabled === true ? scope.property.alias : null;
scope.showDropdown = false;
scope.selectedVariation = {};
scope.variations = [
{
name: "Danish",
master: true,
selected: true
},
{
name: "German"
},
{
name: "Spanish"
},
{
name: "Finnish"
},
{
name: "Albanian"
},
{
name: "Russian"
},
{
name: "Norwegian"
},
{
name: "Swedish"
}
];
function activate() {
for(var i = 0; i < scope.variations.length; i++ ) {
var variation = scope.variations[i];
if(variation.selected) {
scope.property.variation = variation;
}
}
}
scope.toggleDropdown = function() {
scope.showDropdown = !scope.showDropdown;
};
scope.closeDropdown = function() {
scope.showDropdown = false;
};
scope.editContent = function() {
scope.property.variation = null;
scope.showDropdown = false;
};
scope.syncContent = function(selectedVariation) {
for(var i = 0; i < scope.variations.length; i++ ) {
var variation = scope.variations[i];
variation.selected = false;
}
selectedVariation.selected = true;
scope.property.variation = selectedVariation;
scope.showDropdown = false;
};
activate();
},
//Define a controller for this directive to expose APIs to other directives
controller: function ($scope, $timeout) {
var self = this;
//set the API properties/methods
self.property = $scope.property;
self.setPropertyError = function(errorMsg) {
$scope.property.propertyErrorMessage = errorMsg;
};
}
};
});
});
@@ -1,7 +1,7 @@
/**
* @ngdoc directive
* @function
* @name umbraco.directives.directive:umbPropertyEditor
* @name umbraco.directives.directive:umbPropertyEditor
* @requires formController
* @restrict E
**/
@@ -14,10 +14,10 @@ var _umbPropertyEditor = function (umbPropEditorHelper) {
isPreValue: "@",
preview: "@"
},
require: "^form",
restrict: 'E',
replace: true,
replace: true,
templateUrl: 'views/components/property/umb-property-editor.html',
link: function (scope, element, attrs, ctrl) {
@@ -33,6 +33,7 @@ var _umbPropertyEditor = function (umbPropEditorHelper) {
scope.$watch("model.view", function(val){
scope.propertyEditorView = umbPropEditorHelper.getViewPath(scope.model.view, scope.isPreValue);
});
}
};
};
@@ -13,7 +13,7 @@
el.find("a:first").tab('show');
//enable the tab drop
el.tabdrop();
//el.tabdrop();
});
@@ -29,7 +29,7 @@
scope.$on('$destroy', function () {
//ensure to destroy tabdrop (unbinds window resize listeners)
el.tabdrop("destroy");
//el.tabdrop("destroy");
unbindModelWatch();
@@ -1,52 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbGenerateAlias
@restrict E
@scope
@description
Use this directive to generate a camelCased umbraco alias.
When the aliasFrom value is changed the directive will get a formatted alias from the server and update the alias model. If "enableLock" is set to <code>true</code>
the directive will use {@link umbraco.directives.directive:umbLockedField umbLockedField} to lock and unlock the alias.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<input type="text" ng-model="vm.name" />
<umb-generate-alias
enable-lock="true"
alias-from="vm.name"
alias="vm.alias">
</umb-generate-alias>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.name = "";
vm.alias = "";
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {string} alias (<code>binding</code>): The model where the alias is bound.
@param {string} aliasFrom (<code>binding</code>): The model to generate the alias from.
@param {boolean=} enableLock (<code>binding</code>): Set to <code>true</code> to add a lock next to the alias from where it can be unlocked and changed.
**/
angular.module("umbraco.directives")
.directive('umbGenerateAlias', function ($timeout, entityResource) {
return {
@@ -1,117 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbChildSelector
@restrict E
@scope
@description
Use this directive to render a ui component for selecting child items to a parent node.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-child-selector
selected-children="vm.selectedChildren"
available-children="vm.availableChildren"
parent-name="vm.name"
parent-icon="vm.icon"
parent-id="vm.id"
on-add="vm.addChild"
on-remove="vm.removeChild">
</umb-child-selector>
<!-- use overlay to select children from -->
<umb-overlay
ng-if="vm.overlay.show"
model="vm.overlay"
position="target"
view="vm.overlay.view">
</umb-overlay>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.id = 1;
vm.name = "My Parent element";
vm.icon = "icon-document";
vm.selectedChildren = [];
vm.availableChildren = [
{
id: 1,
alias: "item1",
name: "Item 1",
icon: "icon-document"
},
{
id: 2,
alias: "item2",
name: "Item 2",
icon: "icon-document"
}
];
vm.addChild = addChild;
vm.removeChild = removeChild;
function addChild($event) {
vm.overlay = {
view: "itempicker",
title: "Choose child",
availableItems: vm.availableChildren,
selectedItems: vm.selectedChildren,
event: $event,
show: true,
submit: function(model) {
// add selected child
vm.selectedChildren.push(model.selectedItem);
// close overlay
vm.overlay.show = false;
vm.overlay = null;
}
};
}
function removeChild($index) {
vm.selectedChildren.splice($index, 1);
}
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {array} selectedChildren (<code>binding</code>): Array of selected children.
@param {array} availableChildren (<code>binding</code>: Array of items available for selection.
@param {string} parentName (<code>binding</code>): The parent name.
@param {string} parentIcon (<code>binding</code>): The parent icon.
@param {number} parentId (<code>binding</code>): The parent id.
@param {callback} onRemove (<code>binding</code>): Callback when the remove button is clicked on an item.
<h3>The callback returns:</h3>
<ul>
<li><code>child</code>: The selected item.</li>
<li><code>$index</code>: The selected item index.</li>
</ul>
@param {callback} onAdd (<code>binding</code>): Callback when the add button is clicked.
<h3>The callback returns:</h3>
<ul>
<li><code>$event</code>: The select event.</li>
</ul>
**/
(function() {
'use strict';
@@ -1,69 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbConfirmAction
@restrict E
@scope
@description
<p>Use this directive to toggle a confirmation prompt for an action.
The prompt consists of a checkmark and a cross to confirm or cancel the action.
The prompt can be opened in four direction up, down, left or right.</p>
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<div class="my-action" style="position:relative;">
<i class="icon-trash" ng-click="vm.showPrompt()"></i>
<umb-confirm-action
ng-if="vm.promptIsVisible"
direction="left"
on-confirm="vm.confirmAction()"
on-cancel="vm.hidePrompt()">
</umb-confirm-action>
</div>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.promptIsVisible = false;
vm.confirmAction = confirmAction;
vm.showPrompt = showPrompt;
vm.hidePrompt = hidePrompt;
function confirmAction() {
// confirm logic here
}
function showPrompt() {
vm.promptIsVisible = true;
}
function hidePrompt() {
vm.promptIsVisible = false;
}
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {string} direction The direction the prompt opens ("up", "down", "left", "right").
@param {callback} onConfirm Callback when the checkmark is clicked.
@param {callback} onCancel Callback when the cross is clicked.
**/
(function() {
'use strict';
@@ -1,108 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbContentGrid
@restrict E
@scope
@description
Use this directive to generate a list of content items presented as a flexbox grid.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-content-grid
content="vm.contentItems"
content-properties="vm.includeProperties"
on-click="vm.selectItem"
on-click-name="vm.clickItem">
</umb-content-grid>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.contentItems = [
{
"name": "Cape",
"published": true,
"icon": "icon-document",
"updateDate": "15-02-2016",
"owner": "Mr. Batman",
"selected": false
},
{
"name": "Utility Belt",
"published": true,
"icon": "icon-document",
"updateDate": "15-02-2016",
"owner": "Mr. Batman",
"selected": false
},
{
"name": "Cave",
"published": true,
"icon": "icon-document",
"updateDate": "15-02-2016",
"owner": "Mr. Batman",
"selected": false
}
];
vm.includeProperties = [
{
"alias": "updateDate",
"header": "Last edited"
},
{
"alias": "owner",
"header": "Created by"
}
];
vm.clickItem = clickItem;
vm.selectItem = selectItem;
function clickItem(item, $event, $index){
// do magic here
}
function selectItem(item, $event, $index) {
// set item.selected = true; to select the item
// do magic here
}
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {array} content (<code>binding</code>): Array of content items.
@param {array=} contentProperties (<code>binding</code>): Array of content item properties to include in the item. If left empty the item will only show the item icon and name.
@param {callback=} onClick (<code>binding</code>): Callback method to handle click events on the content item.
<h3>The callback returns:</h3>
<ul>
<li><code>item</code>: The clicked item</li>
<li><code>$event</code>: The select event</li>
<li><code>$index</code>: The item index</li>
</ul>
@param {callback=} onClickName (<code>binding</code>): Callback method to handle click events on the checkmark icon.
<h3>The callback returns:</h3>
<ul>
<li><code>item</code>: The selected item</li>
<li><code>$event</code>: The select event</li>
<li><code>$index</code>: The item index</li>
</ul>
**/
(function() {
'use strict';
@@ -1,29 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbEmptyState
@restrict E
@scope
@description
Use this directive to show an empty state message.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-empty-state
ng-if="!vm.items"
position="center">
// Empty state content
</umb-empty-state>
</div>
</pre>
@param {string=} size Set the size of the text ("small", "large").
@param {string=} position Set the position of the text ("center").
**/
(function() {
'use strict';
@@ -1,83 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbFolderGrid
@restrict E
@scope
@description
Use this directive to generate a list of folders presented as a flexbox grid.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-folder-grid
ng-if="vm.folders.length > 0"
folders="vm.folders"
on-click="vm.clickFolder"
on-select="vm.selectFolder">
</umb-folder-grid>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller(myService) {
var vm = this;
vm.folders = [
{
"name": "Folder 1",
"icon": "icon-folder",
"selected": false
},
{
"name": "Folder 2",
"icon": "icon-folder",
"selected": false
}
];
vm.clickFolder = clickFolder;
vm.selectFolder = selectFolder;
myService.getFolders().then(function(folders){
vm.folders = folders;
});
function clickFolder(folder){
// Execute when clicking folder name/link
}
function selectFolder(folder, event, index) {
// Execute when clicking folder
// set folder.selected = true; to show checkmark icon
}
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {array} folders (<code>binding</code>): Array of folders
@param {callback=} onClick (<code>binding</code>): Callback method to handle click events on the folder.
<h3>The callback returns:</h3>
<ul>
<li><code>folder</code>: The selected folder</li>
</ul>
@param {callback=} onSelect (<code>binding</code>): Callback method to handle click events on the checkmark icon.
<h3>The callback returns:</h3>
<ul>
<li><code>folder</code>: The selected folder</li>
<li><code>$event</code>: The select event</li>
<li><code>$index</code>: The folder index</li>
</ul>
**/
(function() {
'use strict';
@@ -1,112 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbkeyboardShortcutsOverview
@restrict E
@scope
@description
<p>Use this directive to show an overview of keyboard shortcuts in an editor.
The directive will render an overview trigger wich shows how the overview is opened.
When this combination is hit an overview is opened with shortcuts based on the model sent to the directive.</p>
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-keyboard-shortcuts-overview
model="vm.keyboardShortcutsOverview">
</umb-keyboard-shortcuts-overview>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.keyboardShortcutsOverview = [
{
"name": "Sections",
"shortcuts": [
{
"description": "Navigate sections",
"keys": [
{"key": "1"},
{"key": "4"}
],
"keyRange": true
}
]
},
{
"name": "Design",
"shortcuts": [
{
"description": "Add tab",
"keys": [
{"key": "alt"},
{"key": "shift"},
{"key": "t"}
]
}
]
}
];
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
<h3>Model description</h3>
<ul>
<li>
<strong>name</strong>
<small>(string)</small> -
Sets the shortcut section name.
</li>
<li>
<strong>shortcuts</strong>
<small>(array)</small> -
Array of available shortcuts in the section.
</li>
<ul>
<li>
<strong>description</strong>
<small>(string)</small> -
Short description of the shortcut.
</li>
<li>
<strong>keys</strong>
<small>(array)</small> -
Array of keys in the shortcut.
</li>
<ul>
<li>
<strong>key</strong>
<small>(string)</small> -
The invidual key in the shortcut.
</li>
</ul>
<li>
<strong>keyRange</strong>
<small>(boolean)</small> -
Set to <code>true</code> to show a key range. It combines the shortcut keys with "-" instead of "+".
</li>
</ul>
</ul>
@param {object} model keyboard shortcut model. See description and example above.
**/
(function() {
'use strict';
@@ -1,50 +1,3 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbLoadIndicator
@restrict E
@description
Use this directive to generate a loading indicator.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-load-indicator
ng-if="vm.loading">
</umb-load-indicator>
<div class="content" ng-if="!vm.loading">
<p>{{content}}</p>
</div>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller(myService) {
var vm = this;
vm.content = "";
vm.loading = true;
myService.getContent().then(function(content){
vm.content = content;
vm.loading = false;
});
}
½
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
**/
(function() {
'use strict';
@@ -1,48 +1,11 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbLockedField
@restrict E
@scope
@description
Use this directive to render a value with a lock next to it. When the lock is clicked the value gets unlocked and can be edited.
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-locked-field
ng-model="vm.value"
placeholder-text="'Click to unlock...'">
</umb-locked-field>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.value = "My locked text";
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {string} ngModel (<code>binding</code>): The locked text.
@param {boolean=} locked (<code>binding</code>): <Code>true</code> by default. Set to <code>false</code> to unlock the text.
@param {string=} placeholderText (<code>binding</code>): If ngModel is empty this text will be shown.
@param {string=} regexValidation (<code>binding</code>): Set a regex expression for validation of the field.
@param {string=} serverValidationField (<code>attribute</code>): Set a server validation field.
* @ngdoc directive
* @name umbraco.directives.directive:umbContentName
* @restrict E
* @function
* @description
* Used by editors that require naming an entity. Shows a textbox/headline with a required validator within it's own form.
**/
(function() {
'use strict';

Some files were not shown because too many files have changed in this diff Show More