Skip to content

Commit 854b9e9

Browse files
committed
icon tutorial updates
1 parent 42f455d commit 854b9e9

File tree

5 files changed

+127
-21
lines changed

5 files changed

+127
-21
lines changed

.data/app.xml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2-
<SexyContent FileVersion="07.00.00" MinimumRequiredVersion="07.00.00" ModuleVersion="10.01.00" ExportDate="2019-09-13T12:54:42.3556953+02:00">
2+
<SexyContent FileVersion="07.00.00" MinimumRequiredVersion="07.00.00" ModuleVersion="10.08.00" ExportDate="2019-10-15T00:10:08.9354134+02:00">
33
<Header>
44
<App Guid="efe3b9cf-1382-40b3-bee2-34becb5351bc" />
55
<Language Default="en-US" />
@@ -346,7 +346,7 @@
346346
<Value Key="SupportsAjaxReload" Value="False" Type="Boolean">
347347
<Dimension DimensionID="141" ReadOnly="false" />
348348
</Value>
349-
<Value Key="Version" Value="10.02.00" Type="String">
349+
<Value Key="Version" Value="10.09.00" Type="String">
350350
<Dimension DimensionID="141" ReadOnly="false" />
351351
</Value>
352352
</Entity>
@@ -1697,6 +1697,47 @@
16971697
<Dimension DimensionID="141" ReadOnly="false" />
16981698
</Value>
16991699
</Entity>
1700+
<Entity AssignmentObjectType="Default" AttributeSetStaticName="2SexyContent-Template" AttributeSetName="2SexyContent-Template" EntityGUID="fcded946-f2e3-4d47-ac98-ad3a0d1e069b">
1701+
<Value Key="ContentTypeStaticName" Value="" Type="String">
1702+
<Dimension DimensionID="141" ReadOnly="false" />
1703+
</Value>
1704+
<Value Key="IsHidden" Value="True" Type="Boolean">
1705+
<Dimension DimensionID="141" ReadOnly="false" />
1706+
</Value>
1707+
<Value Key="ListContentTypeStaticName" Value="" Type="String">
1708+
<Dimension DimensionID="141" ReadOnly="false" />
1709+
</Value>
1710+
<Value Key="ListPresentationTypeStaticName" Value="" Type="String">
1711+
<Dimension DimensionID="141" ReadOnly="false" />
1712+
</Value>
1713+
<Value Key="Location" Value="Portal File System" Type="String">
1714+
<Dimension DimensionID="141" ReadOnly="false" />
1715+
</Value>
1716+
<Value Key="Name" Value="RB340 - Icons" Type="String">
1717+
<Dimension DimensionID="141" ReadOnly="false" />
1718+
</Value>
1719+
<Value Key="Path" Value="blade/_340-icons-default.cshtml" Type="String">
1720+
<Dimension DimensionID="141" ReadOnly="false" />
1721+
</Value>
1722+
<Value Key="PresentationTypeStaticName" Value="" Type="String">
1723+
<Dimension DimensionID="141" ReadOnly="false" />
1724+
</Value>
1725+
<Value Key="PublishData" Value="False" Type="Boolean">
1726+
<Dimension DimensionID="141" ReadOnly="false" />
1727+
</Value>
1728+
<Value Key="StreamsToPublish" Value="" Type="String">
1729+
<Dimension DimensionID="141" ReadOnly="false" />
1730+
</Value>
1731+
<Value Key="Type" Value="C# Razor" Type="String">
1732+
<Dimension DimensionID="141" ReadOnly="false" />
1733+
</Value>
1734+
<Value Key="UseForList" Value="False" Type="Boolean">
1735+
<Dimension DimensionID="141" ReadOnly="false" />
1736+
</Value>
1737+
<Value Key="ViewNameInUrl" Value="blade340/.*" Type="String">
1738+
<Dimension DimensionID="141" ReadOnly="false" />
1739+
</Value>
1740+
</Entity>
17001741
</Entities>
17011742
<PortalFiles>
17021743
<File Id="1530" RelativePath="adam\Tutorial-Razor\7md5eRsHbU6B0iHeIzYLCQ\Cover\image.png" />

_home.cshtml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
@hlp.TutorialLinkHome("Working with HTML", "html", "Learn the difference of showing variables with <code>@variable</code> and <code>@Html.Raw(variable)</code>, and re-using snippets with <code>@helper</code>")
2020

21-
@hlp.TutorialLinkHome("Using Emojis / Emoticons 👍", "html210", "Show Emojis in your output or use them for showing true/false", "(new!)")
21+
@hlp.TutorialLinkHome("Using Emojis / Emoticons 👍", "html210", "Show Emojis in your output or use them for showing true/false", "")
2222

23-
@hlp.TutorialLinkHome("Reuse templates and code", "reuse", "You can place common templates, hlp and functions into shared files - both <code>.cshtml</code> and <code>.cs</code>.", "(enhanced!)")
23+
@hlp.TutorialLinkHome("Reuse templates and code", "reuse", "You can place common templates, hlp and functions into shared files - both <code>.cshtml</code> and <code>.cs</code>.", "")
2424
</ol>
2525

2626
<hr>
@@ -41,7 +41,7 @@
4141
<h2><em>RazorBlade</em> Examples</h2>
4242
<p>These examples help you quickly do hard stuff, once you've mastered the basics above</p>
4343
<ol>
44-
@hlp.TutorialLinkHome("RazorBlade - Making real tasks easier", "blade", "Properly create preview-texts, strip HTML, pick the right variables, set page titles and way more. Includes...", "(new!)")
44+
@hlp.TutorialLinkHome("RazorBlade - Making real tasks easier", "blade", "Properly create preview-texts, strip HTML, pick the right variables, set page titles and way more. Includes...", "")
4545
<ul>
4646
<li>Text manipulation, clean-up, cropping and ellipsis</li>
4747
<li>Picking the ideal string-values</li>
@@ -52,8 +52,8 @@
5252
<li>Create social media Open-Graph headers</li>
5353
</ul>
5454
@hlp.TutorialLink("RazorBlade - using the fluent tag API", "blade800",
55-
"The basics of creating html directly from code - new in 2.0",
56-
"new!")
55+
"The basics of creating html directly from code - new in 2.0 and enhanced in 2.1",
56+
"enhanced!")
5757
</ol>
5858

5959

blade/_000-blade.cshtml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<p>
2020
<em>RazorBlade</em> can be installed as a <a href="https://github.com/DNN-Connect/razor-blade/releases" target="_blank">stand-alone DNN module</a> or if you are creating your own module, you can include it in your distribution. If you're viewing this tutorial with 2sxc 9.40+, then it already includes <em>RazorBlade</em> 1.01, but some examples need an even newer version. If you see errors, you probably need to install a newer version of <em>RazorBlade</em>
2121
</p>
22-
@rzr.RazorVersionBox(2.0)
22+
@rzr.RazorVersionBox(2.01)
2323
</trim>
2424

2525
<hr>
@@ -28,19 +28,19 @@
2828
<ol>
2929
@hlp.TutorialLink("RazorBlade - Text.Crop() and Text.Ellipsis()", "blade110",
3030
"Correctly crop text without splitting words or html-characters like &amp;",
31-
"new!", rzr.VersionInfo(version, 1.0))
31+
"", rzr.VersionInfo(version, 1.0))
3232

3333
@hlp.TutorialLink("RazorBlade - Text.Has() tells you if something really has content", "blade120",
3434
"Check if strings really have something correctly, incl. spaces or even &nbsp; whitespaces. ",
35-
"new!", rzr.VersionInfo(version, 1.0))
35+
"", rzr.VersionInfo(version, 1.0))
3636

3737
@hlp.TutorialLink("RazorBlade - Text.First() lets you pick a value from many variables", "blade130",
3838
"Often you have to check many variables to find the first one to use.",
39-
"new!", rzr.VersionInfo(version, 1.0))
39+
"", rzr.VersionInfo(version, 1.0))
4040

4141
@hlp.TutorialLink("RazorBlade - Text.Zip() lets you shrink all spaces, tabs, enters together", "blade140",
4242
"Very often you need to clean up some text before working with it.",
43-
"new!", rzr.VersionInfo(version, 1.0))
43+
"", rzr.VersionInfo(version, 1.0))
4444
</ol>
4545

4646
<hr>
@@ -49,11 +49,11 @@
4949
<ol>
5050
@hlp.TutorialLink("Tags.Strip() cleans out all HTML tags", "blade210",
5151
"Remove all html from a string - important for teaser texts and protecting against cross-site-scripting attacks.",
52-
"new!", rzr.VersionInfo(version, 1.0))
52+
"", rzr.VersionInfo(version, 1.0))
5353

5454
@hlp.TutorialLink("Convert <br> tags to new-lines or spaces and back", "blade220",
5555
"A common challenge is showing text as HTML or the other way around",
56-
"new!", rzr.VersionInfo(version, 1.0))
56+
"", rzr.VersionInfo(version, 1.0))
5757
</ol>
5858

5959

@@ -63,19 +63,24 @@
6363
<ol>
6464
@hlp.TutorialLink("Page Title, Keyword, Description", "blade310",
6565
"Get/Set Page Title, Keywords, Description and set meta-tags and more.",
66-
"new!", rzr.VersionInfo(version, 1.01))
66+
"", rzr.VersionInfo(version, 1.01))
6767

6868
@hlp.TutorialLink("JSON-LD Headers for SEO", "blade320",
6969
"Add JSON-LD (Linked Data) headers for Google",
70-
"new!", rzr.VersionInfo(version, 1.01))
70+
"", rzr.VersionInfo(version, 1.01))
7171

7272
@hlp.TutorialLink("Open-Graph headers for Social Media", "blade330",
73-
"Add various combinations of icons to the page header",
74-
"new!", rzr.VersionInfo(version, 1.01))
73+
"Add Open-Graph data headers for Facebook, Twitter and other sharing-systems",
74+
"", rzr.VersionInfo(version, 1.01))
7575

76-
<!-- @hlp.TutorialLink("Page Icons for Favicon, Apple/Android", "blade340",
76+
@* todo - must enhance, this isn't showing much ATM *@
77+
@hlp.TutorialLink("Open-Graph headers for Social Media", "blade330",
7778
"Add Open-Graph data headers for Facebook, Twitter and other sharing-systems",
78-
"new!", rzr.VersionInfo(version, 1.03)) -->
79+
"", rzr.VersionInfo(version, 1.01))
80+
81+
@hlp.TutorialLink("Page Icons for Favicon, Apple/Android", "blade340/page/mode/set",
82+
"Add various combinations of icons to the page header",
83+
"new!", rzr.VersionInfo(version, 2.01))
7984

8085
</ol>
8186

blade/_340-icons-default.cshtml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
@using Connect.Razor.Blade;
2+
3+
@using Connect.Razor.Blade.Html5;
4+
<hide>
5+
@RenderPage("_header.cshtml")
6+
@{ var hlp = CreateInstance("../shared/_helpers.cshtml"); }
7+
</hide>
8+
<trim>
9+
<h2><em>RazorBlade</em> AddIcon to Html Headers <em>v2.1</em></h2>
10+
<div>
11+
This page sets various icon headers according to best practices.
12+
13+
Look at the html-header in the output-source to see the effect. <br>
14+
The following links will set different icons depending on what you need.
15+
</div>
16+
<ul>
17+
@SubpageLink("Just add single icon", "one")
18+
@SubpageLink("Add default set incl. favicon and apple-touch", "set")
19+
@SubpageLink("Add default set without favicon", "nofav")
20+
@SubpageLink("Add default set with custom favicon (recommended)", "pngfav")
21+
</ul>
22+
</trim>
23+
24+
@{
25+
// use url parameter to decide which icon(s) to show, and default to "one"
26+
var mode = Request.QueryString["mode"] ?? "one";
27+
28+
// the icon we want to use for this page is this png file
29+
var iconUrl = App.Path + "/blade/assets/razor-blade-icon.png";
30+
31+
// now add the headers depending on the demo you picked
32+
// in your code you would only use one of these
33+
if(mode == "one") {
34+
HtmlPage.AddIcon(iconUrl);
35+
}
36+
else if (mode == "set") {
37+
HtmlPage.AddIconSet(iconUrl);
38+
}
39+
else if (mode == "nofav") {
40+
HtmlPage.AddIconSet(iconUrl, favicon: false);
41+
}
42+
else if (mode == "pngfav") {
43+
HtmlPage.AddIconSet(iconUrl, favicon: iconUrl);
44+
}
45+
}
46+
47+
<hide>
48+
@RenderPage("../shared/_source-code.cshtml", new { Path = VirtualPath })
49+
50+
@helper SubpageLink(string label, string value) {
51+
@SubpageLink(label, "blade340=page", "mode", value)
52+
}
53+
54+
@helper SubpageLink(string label, string root, string key, string value) {
55+
<li class='@(Request.QueryString[key] == value ? "selected" : "")'>
56+
<a href='@Link.To(parameters: "?" + root + "&" + key + "=" + value)'>
57+
@label
58+
</a>
59+
</li>
60+
}
61+
</hide>

blade/_razorblade-version.cshtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727

2828
@helper RazorVersionBox(double expected) {
29-
// var rzrVersionInfo = GetRazorBladeVersion();
3029
double version = VersionDouble();
3130
var exists = version != 0;
3231
bool versionOk = version >= expected;

0 commit comments

Comments
 (0)