Skip to content

Commit fd57245

Browse files
committed
split formula demos on many pages
1 parent add85bf commit fd57245

File tree

7 files changed

+5313
-4481
lines changed

7 files changed

+5313
-4481
lines changed

.data/app.xml

Lines changed: 5204 additions & 4147 deletions
Large diffs are not rendered by default.

formulas/_110 Values.cshtml

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -37,87 +37,9 @@
3737
Size = 100
3838
})
3939

40-
@Html.Partial("_PartFormulas.cshtml", new {
41-
Title = "Single Field visibility",
42-
Instructions = "This formula determines the visibility of the Description field. It only becomes visible when the Title field isn't empty.",
43-
ContentType = "FormulasBasic",
44-
FieldName = "Description"
45-
})
46-
47-
@Html.Partial("_PartFormulas.cshtml", new {
48-
Title = "Group visibility",
49-
Instructions = "This formula determines the visibility of the Advanced settings group. The group becomes visible, when the Advanced toggle is active.",
50-
ContentType = "FormulasVisibleGroup",
51-
FieldName = "AdvancedSettings"
52-
})
53-
54-
@Html.Partial("_PartFormulas.cshtml", new {
55-
Title = "Required fields",
56-
Instructions = "This formula determines wether the Name field is required. It becomes required if the age isn't specified.",
57-
ContentType = "FormulasRequired",
58-
FieldName = "Name"
59-
})
6040

61-
@Html.Partial("_PartFormulas.cshtml", new {
62-
Title = "Disabled fields",
63-
Instructions = "This formula determines wether the ApiKeyV2 field is disabled. It becomes disabled if the UseNewFeatures field is true.",
64-
ContentType = "FormulasDisabled",
65-
FieldName = "ApiKeyV2"
66-
})
6741

68-
@Html.Partial("_PartFormulas.cshtml", new {
69-
Title = "Group Name - Text summary",
70-
Instructions = "This formula changes the Name of the PersonGroup field. The name becomes \"Person - Profile complete\" if all group fields are filled out and \"Person - Profile incomplete\" if not.",
71-
ContentType = "FormulasTextSummary",
72-
FieldName = "PersonGroup"
73-
})
7442

75-
@Html.Partial("_PartFormulas.cshtml", new {
76-
Title = "Group Name - Emoji summary",
77-
Instructions = "This formula changes the Name of the ProductGroup field. The name becomes \"Product ✅\" if all group fields are filled out and \"Product ✏️\" if not.",
78-
ContentType = "FormulasEmojiSummary",
79-
FieldName = "ProductGroup",
80-
Size = 150
81-
})
82-
83-
@Html.Partial("_PartFormulas.cshtml", new {
84-
Title = "Helptext",
85-
Instructions = "This formula adds a help text based on the ProductCode Field text. If the ProductCode field contains \"n0t0k\" the helptext \"This product code is deprecated. Please request a new product code. \" is added, or if it contains spaces the helptext \"Please remove all spaces from your product code.\" is added.",
86-
ContentType = "FormulasHelpText",
87-
FieldName = "ProductCode",
88-
More = "prefill:ProductCode=n0t0k code",
89-
Size = 175
90-
})
91-
92-
93-
@* Run Code Once only *@
94-
@Html.Partial("_PartFormulas.cshtml", new {
95-
Title = "Run Code Only when Form Opens",
96-
Instructions = "This formula determines the initial open/closed state - in this case randomly. "
97-
+ "Normally it would do this based on how complete data in that section is or based on other criterias. "
98-
+ "This is often used to improve initial state of a form based on how much data is already filled in. ",
99-
ContentType = "FormulasRunAtStart",
100-
FieldName = "GroupRandomlyOpen",
101-
Size = 200
102-
})
103-
104-
@* Change Dropdown Values *@
105-
@Html.Partial("_PartFormulas.cshtml", new {
106-
Title = "Change dropdown options: Country to Offices",
107-
Instructions = "This formula changes the values in the second dropdown based on the country picked first. ",
108-
ContentType = "FormulasDropdown",
109-
FieldName = "Office",
110-
Size = 160
111-
})
112-
113-
@* Change Dropdown Values #2 *@
114-
@Html.Partial("_PartFormulas.cshtml", new {
115-
Title = "Change dropdown options: Limited or More Options",
116-
Instructions = "This formula changes the values in the second dropdown if the user wants more options. ",
117-
ContentType = "FormulasDropdownDirections",
118-
FieldName = "Options",
119-
Size = 160
120-
})
12143

12244
@* Date Examples #1 *@
12345
@Html.Partial("_PartFormulas.cshtml", new {

formulas/_114 DropDowns.cshtml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@inherits Custom.Hybrid.Razor14
2+
@using ToSic.Razor.Blade;
3+
<hide>
4+
@Html.Partial("_header.cshtml")
5+
@{
6+
var hlp = CreateInstance("../shared/Helpers.cs");
7+
var viewMd = AsDynamic((CmsContext.View.Metadata.OfType(hlp.TutViewMetadataType) as IEnumerable<dynamic>).FirstOrDefault());
8+
var fancybox = CreateInstance("../shared/Fancybox.cs");
9+
Edit.Enabled = true;
10+
Kit.Page.Activate("2sxc.JsCore", "2sxc.JsCms", "2sxc.Toolbars");
11+
}
12+
</hide>
13+
14+
<div class="row">
15+
<div class="col-md-7">
16+
<h2>Formulas affecting DropDowns Options</h2>
17+
<p>These examples show how Formulas can modify the list of available options. </p>
18+
</div>
19+
@Html.Partial("../shared/_DefaultInfoSection.cshtml")
20+
</div>
21+
22+
@* Change Dropdown Values *@
23+
@Html.Partial("_PartFormulas.cshtml", new {
24+
Title = "Change dropdown options: Country to Offices",
25+
Instructions = "This formula changes the values in the second dropdown based on the country picked first. ",
26+
ContentType = "FormulasDropdown",
27+
FieldName = "Office",
28+
Size = 160
29+
})
30+
31+
@* Change Dropdown Values #2 *@
32+
@Html.Partial("_PartFormulas.cshtml", new {
33+
Title = "Change dropdown options: Limited or More Options",
34+
Instructions = "This formula changes the values in the second dropdown if the user wants more options. ",
35+
ContentType = "FormulasDropdownDirections",
36+
FieldName = "Options",
37+
Size = 160
38+
})

formulas/_115 Settings.cshtml

Lines changed: 2 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<div class="row">
1515
<div class="col-md-7">
16-
<h2>Formulas affecting Field Settigns</h2>
16+
<h2>Formulas affecting Field Settings</h2>
1717
<p>We'll show you examples where formulas can be applied to change visibility, required, and more.</p>
1818
<p>In this tutorial you'll learn how to:</p>
1919
<ul>
@@ -27,34 +27,14 @@
2727
Make fields disabled
2828
</li>
2929
<li>
30-
Make group summaries in titles
31-
</li>
32-
<li>
33-
Add help text
30+
and much more...
3431
</li>
3532
</ul>
3633
<br>
3734
</div>
3835
@Html.Partial("../shared/_DefaultInfoSection.cshtml")
3936
</div>
4037

41-
@* Fill If Empty *@
42-
@Html.Partial("_PartFormulas.cshtml", new {
43-
Title = "Set the Value if it's empty",
44-
Instructions = "This formula sets the value of a field if it's empty. As long as it's not empty, the user can type anything he/she wants. ",
45-
ContentType = "FormulasIfEmpty",
46-
FieldName = "Title",
47-
Size = 100
48-
})
49-
50-
@* Combine Values of Fields *@
51-
@Html.Partial("_PartFormulas.cshtml", new {
52-
Title = "Generate a Field Combining Others",
53-
Instructions = "This formula combines the values of 3 fields into a URL Slug. ",
54-
ContentType = "FormulasCombineValues",
55-
FieldName = "UrlKey",
56-
Size = 100
57-
})
5838

5939
@Html.Partial("_PartFormulas.cshtml", new {
6040
Title = "Single Field visibility",
@@ -63,12 +43,6 @@
6343
FieldName = "Description"
6444
})
6545

66-
@Html.Partial("_PartFormulas.cshtml", new {
67-
Title = "Group visibility",
68-
Instructions = "This formula determines the visibility of the Advanced settings group. The group becomes visible, when the Advanced toggle is active.",
69-
ContentType = "FormulasVisibleGroup",
70-
FieldName = "AdvancedSettings"
71-
})
7246

7347
@Html.Partial("_PartFormulas.cshtml", new {
7448
Title = "Required fields",
@@ -84,75 +58,5 @@
8458
FieldName = "ApiKeyV2"
8559
})
8660

87-
@Html.Partial("_PartFormulas.cshtml", new {
88-
Title = "Group Name - Text summary",
89-
Instructions = "This formula changes the Name of the PersonGroup field. The name becomes \"Person - Profile complete\" if all group fields are filled out and \"Person - Profile incomplete\" if not.",
90-
ContentType = "FormulasTextSummary",
91-
FieldName = "PersonGroup"
92-
})
93-
94-
@Html.Partial("_PartFormulas.cshtml", new {
95-
Title = "Group Name - Emoji summary",
96-
Instructions = "This formula changes the Name of the ProductGroup field. The name becomes \"Product ✅\" if all group fields are filled out and \"Product ✏️\" if not.",
97-
ContentType = "FormulasEmojiSummary",
98-
FieldName = "ProductGroup",
99-
Size = 150
100-
})
101-
102-
@Html.Partial("_PartFormulas.cshtml", new {
103-
Title = "Helptext",
104-
Instructions = "This formula adds a help text based on the ProductCode Field text. If the ProductCode field contains \"n0t0k\" the helptext \"This product code is deprecated. Please request a new product code. \" is added, or if it contains spaces the helptext \"Please remove all spaces from your product code.\" is added.",
105-
ContentType = "FormulasHelpText",
106-
FieldName = "ProductCode",
107-
More = "prefill:ProductCode=n0t0k code",
108-
Size = 175
109-
})
110-
111-
112-
@* Run Code Once only *@
113-
@Html.Partial("_PartFormulas.cshtml", new {
114-
Title = "Run Code Only when Form Opens",
115-
Instructions = "This formula determines the initial open/closed state - in this case randomly. "
116-
+ "Normally it would do this based on how complete data in that section is or based on other criterias. "
117-
+ "This is often used to improve initial state of a form based on how much data is already filled in. ",
118-
ContentType = "FormulasRunAtStart",
119-
FieldName = "GroupRandomlyOpen",
120-
Size = 200
121-
})
12261

123-
@* Change Dropdown Values *@
124-
@Html.Partial("_PartFormulas.cshtml", new {
125-
Title = "Change dropdown options: Country to Offices",
126-
Instructions = "This formula changes the values in the second dropdown based on the country picked first. ",
127-
ContentType = "FormulasDropdown",
128-
FieldName = "Office",
129-
Size = 160
130-
})
13162

132-
@* Change Dropdown Values #2 *@
133-
@Html.Partial("_PartFormulas.cshtml", new {
134-
Title = "Change dropdown options: Limited or More Options",
135-
Instructions = "This formula changes the values in the second dropdown if the user wants more options. ",
136-
ContentType = "FormulasDropdownDirections",
137-
FieldName = "Options",
138-
Size = 160
139-
})
140-
141-
@* Date Examples #1 *@
142-
@Html.Partial("_PartFormulas.cshtml", new {
143-
Title = "Date - Prefill but leave editable",
144-
Instructions = "This formula sets the initial value to the current date (if the field is empty). You can try it by deleting the value, once you leave the field it's updated again. ",
145-
ContentType = "FormulasDates",
146-
FieldName = "RightNow",
147-
Size = 125
148-
})
149-
150-
@* Date Examples #2 *@
151-
@Html.Partial("_PartFormulas.cshtml", new {
152-
Title = "Date - Calculate value",
153-
Instructions = "This formula sets the third field to the current date/time + an offset the user can choose in a dropdown. "
154-
+ "Note that since we do some calculations, we must make sure the result is time-zone cleaned. ",
155-
ContentType = "FormulasDates",
156-
FieldName = "PublishWhen",
157-
Size = 125
158-
})

0 commit comments

Comments
 (0)