Need to clone the object before removing $-prefixed variables. Otherwise we are modifying the same data as the views are using

This commit is contained in:
Bjarke Berg
2019-02-11 15:30:11 +01:00
parent 154b59c84b
commit 944c8d59d7
12 changed files with 57 additions and 115 deletions

View File

@@ -45,7 +45,7 @@
/// <summary>
/// Application alias for the forms section.
/// </summary>
public const string Forms = "forms";
public const string FormsInstaller = "formsInstaller";
}
/// <summary>
@@ -77,7 +77,7 @@
/// alias for the macro tree.
/// </summary>
public const string Macros = "macros";
/// <summary>
/// alias for the datatype tree.
/// </summary>
@@ -92,7 +92,7 @@
/// alias for the dictionary tree.
/// </summary>
public const string Dictionary = "dictionary";
public const string Stylesheets = "stylesheets";
/// <summary>
@@ -121,7 +121,7 @@
public const string Templates = "templates";
public const string RelationTypes = "relationTypes";
public const string Languages = "languages";
/// <summary>
@@ -138,6 +138,7 @@
/// alias for the users tree.
/// </summary>
public const string Users = "users";
public const string Forms = "formsInstaller";
public const string Scripts = "scripts";

View File

@@ -189,13 +189,13 @@ namespace Umbraco.Core.Migrations.Install
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Members });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Settings });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Users });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Forms });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.FormsInstaller });
_database.Insert(new UserGroup2AppDto { UserGroupId = 2, AppAlias = Constants.Applications.Content });
_database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Content });
_database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Media });
_database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Forms });
_database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.FormsInstaller });
_database.Insert(new UserGroup2AppDto { UserGroupId = 4, AppAlias = Constants.Applications.Translation });
}

View File

@@ -228,6 +228,7 @@ namespace Umbraco.Tests.Testing
.Append<PackagesBackOfficeSection>()
.Append<UsersBackOfficeSection>()
.Append<MembersBackOfficeSection>()
.Append<FormsBackOfficeSection>()
.Append<TranslationBackOfficeSection>();
Composition.RegisterUnique<ISectionService, SectionService>();

View File

@@ -192,7 +192,6 @@ function FormsController($scope, $route, $cookies, packageResource, localization
function Video_player (videoId) {
// Get dom elements
this.container = document.getElementById(videoId);
this.video = this.container.getElementsByTagName('video')[0];
//Create controls
this.controls = document.createElement('div');
@@ -215,104 +214,6 @@ function FormsController($scope, $route, $cookies, packageResource, localization
this.controls.appendChild(this.loader);
this.loader.appendChild(this.progress_bar);
}
Video_player.prototype
.seeking = function() {
// get the value of the seekbar (hidden input[type="range"])
var time = this.video.duration * (this.seek_bar.value / 100);
// Update video to seekbar value
this.video.currentTime = time;
};
// Stop video when user initiates seeking
Video_player.prototype
.start_seek = function() {
this.video.pause();
};
// Start video when user stops seeking
Video_player.prototype
.stop_seek = function() {
this.video.play();
};
// Update the progressbar (span.loader) according to video.currentTime
Video_player.prototype
.update_progress_bar = function() {
// Get video progress in %
var value = (100 / this.video.duration) * this.video.currentTime;
// Update progressbar
this.progress_bar.style.width = value + '%';
};
// Bind progressbar to mouse when seeking
Video_player.prototype
.handle_mouse_move = function(event) {
// Get position of progressbar relative to browser window
var pos = this.progress_bar.getBoundingClientRect().left;
// Make sure event is reckonized cross-browser
event = event || window.event;
// Update progressbar
this.progress_bar.style.width = (event.clientX - pos) + "px";
};
// Eventlisteners for seeking
Video_player.prototype
.video_event_handler = function(videoPlayer, interval) {
// Update the progress bar
var animate_progress_bar = setInterval(function () {
videoPlayer.update_progress_bar();
}, interval);
// Fire when input value changes (user seeking)
videoPlayer.seek_bar
.addEventListener("change", function() {
videoPlayer.seeking();
});
// Fire when user clicks on seekbar
videoPlayer.seek_bar
.addEventListener("mousedown", function (clickEvent) {
// Pause video playback
videoPlayer.start_seek();
// Stop updating progressbar according to video progress
clearInterval(animate_progress_bar);
// Update progressbar to where user clicks
videoPlayer.handle_mouse_move(clickEvent);
// Bind progressbar to cursor
window.onmousemove = function(moveEvent){
videoPlayer.handle_mouse_move(moveEvent);
};
});
// Fire when user releases seekbar
videoPlayer.seek_bar
.addEventListener("mouseup", function () {
// Unbind progressbar from cursor
window.onmousemove = null;
// Start video playback
videoPlayer.stop_seek();
// Animate the progressbar
animate_progress_bar = setInterval(function () {
videoPlayer.update_progress_bar();
}, interval);
});
};
var videoPlayer = new Video_player('video_1');
videoPlayer.video_event_handler(videoPlayer, 17);
}
angular.module("umbraco").controller("Umbraco.Dashboard.FormsDashboardController", FormsController);

View File

@@ -8,14 +8,6 @@
<div class="step-one" ng-hide="state"> <!-- STEP one -->
<div id="video_1" class="video_player" style="margin-bottom: 40px">
<video autoplay loop>
<!-- <source src="videos/gif.webm" type="video/webm"> -->
<source src="https://player.vimeo.com/external/110229004.hd.mp4?s=823f701836260bd08fb783d38389f628" type="video/mp4">
Sorry, you don't have HTML5 video and we didn't catch this properly in javascript.
</video>
</div>
<p style="font-size: 16px; line-height: 1.5; color: #4c4c4c; margin-bottom: 20px;">Create forms using an intuitive drag and drop interface. From simple contact forms that sends e-mails to advanced questionaires that integrate with CRM systems. Your clients will love it!</p>
<umb-button

View File

@@ -1244,6 +1244,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="courier">Courier</key>
<key alias="developer">Developer</key>
<key alias="forms">Forms</key>
<key alias="formsInstaller">Forms</key>
<key alias="help" version="7.0">Help</key>
<key alias="installer">Umbraco Configuration Wizard</key>
<key alias="media">Media</key>

View File

@@ -1247,6 +1247,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<area alias="sections">
<key alias="content">Content</key>
<key alias="forms">Forms</key>
<key alias="formsInstaller">Forms</key>
<key alias="media">Media</key>
<key alias="member">Members</key>
<key alias="packages">Packages</key>
@@ -1388,7 +1389,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="styles">Styles</key>
<key alias="stylesHelp">The CSS that should be applied in the rich text editor, e.g. "color:red;"</key>
<key alias="tabCode">Code</key>
<key alias="tabRules">Rich Text Editor</key>
<key alias="tabRules">Rich Text Editor</key>
</area>
<area alias="template">
<key alias="deleteByIdFailed">Failed to delete template with ID %0%</key>

View File

@@ -1,4 +1,5 @@
using System;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Dashboards;
@@ -9,7 +10,7 @@ namespace Umbraco.Web.Dashboards
{
public string Alias => "formsInstall";
public string[] Sections => new [] { "forms" };
public string[] Sections => new [] { Constants.Applications.FormsInstaller };
public string View => "views/dashboard/forms/formsdashboardintro.html";

View File

@@ -220,6 +220,7 @@ namespace Umbraco.Web.Runtime
.Append<PackagesBackOfficeSection>()
.Append<UsersBackOfficeSection>()
.Append<MembersBackOfficeSection>()
.Append<FormsBackOfficeSection>()
.Append<TranslationBackOfficeSection>();
// register core CMS dashboards and 3rd party types - will be ordered by weight attribute & merged with package.manifest dashboards

View File

@@ -0,0 +1,14 @@
using Umbraco.Core;
using Umbraco.Core.Models.Trees;
namespace Umbraco.Web.Trees
{
/// <summary>
/// Defines the back office media section
/// </summary>
public class FormsBackOfficeSection : IBackOfficeSection
{
public string Alias => Constants.Applications.FormsInstaller;
public string Name => "Forms";
}
}

View File

@@ -0,0 +1,27 @@
using System.Net.Http.Formatting;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.Forms)]
[Tree(Constants.Applications.FormsInstaller, Constants.Trees.Forms, SortOrder = 0, IsSingleNodeTree = true)]
[PluginController("UmbracoTrees")]
[CoreTree]
public class FormsTreeController : TreeController
{
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
//full screen app without tree nodes
return TreeNodeCollection.Empty;
}
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
//doesn't have a menu, this is a full screen app without tree nodes
return MenuItemCollection.Empty;
}
}
}

View File

@@ -214,6 +214,8 @@
<Compile Include="PropertyEditors\ValueConverters\MultiUrlPickerValueConverter.cs" />
<Compile Include="Templates\ITemplateRenderer.cs" />
<Compile Include="Trees\BackOfficeSectionCollectionBuilder.cs" />
<Compile Include="Trees\FormsBackOfficeSection.cs" />
<Compile Include="Trees\FormsTreeController.cs" />
<Compile Include="Trees\MediaBackOfficeSection.cs" />
<Compile Include="Trees\MembersBackOfficeSection.cs" />
<Compile Include="Trees\PackagesBackOfficeSection.cs" />