Merge pull request #2371 from umbraco/temp-U4-10707

fixes: U4-10707 Config to order tour groups
This commit is contained in:
Shannon Deminick
2018-01-11 22:04:24 +11:00
committed by GitHub
13 changed files with 479 additions and 237 deletions

View File

@@ -1,11 +1,10 @@
using System;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models
{
/// <summary>
/// A model representing a tour.
/// </summary>
[DataContract(Name = "tour", Namespace = "")]
public class BackOfficeTour
{
@@ -15,6 +14,8 @@ namespace Umbraco.Web.Models
public string Alias { get; set; }
[DataMember(Name = "group")]
public string Group { get; set; }
[DataMember(Name = "groupOrder")]
public int GroupOrder { get; set; }
[DataMember(Name = "allowDisable")]
public bool AllowDisable { get; set; }
[DataMember(Name = "steps")]

View File

@@ -3,6 +3,9 @@ using System.Runtime.Serialization;
namespace Umbraco.Web.Models
{
/// <summary>
/// A model representing the file used to load a tour.
/// </summary>
[DataContract(Name = "tourFile", Namespace = "")]
public class BackOfficeTourFile
{

View File

@@ -0,0 +1,61 @@
using System.Text.RegularExpressions;
namespace Umbraco.Web.Models
{
public class BackOfficeTourFilter
{
public Regex PluginName { get; private set; }
public Regex TourFileName { get; private set; }
public Regex TourAlias { get; private set; }
/// <summary>
/// Create a filter to filter out a whole plugin's tours
/// </summary>
/// <param name="pluginName"></param>
/// <returns></returns>
public static BackOfficeTourFilter FilterPlugin(Regex pluginName)
{
return new BackOfficeTourFilter(pluginName, null, null);
}
/// <summary>
/// Create a filter to filter out a whole tour file
/// </summary>
/// <param name="tourFileName"></param>
/// <returns></returns>
public static BackOfficeTourFilter FilterFile(Regex tourFileName)
{
return new BackOfficeTourFilter(null, tourFileName, null);
}
/// <summary>
/// Create a filter to filter out a tour alias, this will filter out the same alias found in all files
/// </summary>
/// <param name="tourAlias"></param>
/// <returns></returns>
public static BackOfficeTourFilter FilterAlias(Regex tourAlias)
{
return new BackOfficeTourFilter(null, null, tourAlias);
}
/// <summary>
/// Constructor to create a tour filter
/// </summary>
/// <param name="pluginName">Value to filter out tours by a plugin, can be null</param>
/// <param name="tourFileName">Value to filter out a tour file, can be null</param>
/// <param name="tourAlias">Value to filter out a tour alias, can be null</param>
/// <remarks>
/// Depending on what is null will depend on how the filter is applied.
/// If pluginName is not NULL and it's matched then we check if tourFileName is not NULL and it's matched then we check tour alias is not NULL and then match it,
/// if any steps is NULL then the filters upstream are applied.
/// Example, pluginName = "hello", tourFileName="stuff", tourAlias=NULL = we will filter out the tour file "stuff" from the plugin "hello" but not from other plugins if the same file name exists.
/// Example, tourAlias="test.*" = we will filter out all tour aliases that start with the word "test" regardless of the plugin or file name
/// </remarks>
public BackOfficeTourFilter(Regex pluginName, Regex tourFileName, Regex tourAlias)
{
PluginName = pluginName;
TourFileName = tourFileName;
TourAlias = tourAlias;
}
}
}

View File

@@ -2,6 +2,9 @@
namespace Umbraco.Web.Models
{
/// <summary>
/// A model representing a step in a tour.
/// </summary>
[DataContract(Name = "step", Namespace = "")]
public class BackOfficeTourStep
{