/
CollapsibleSet.cs
62 lines (49 loc) · 2.06 KB
/
CollapsibleSet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using System.Web.WebPages;
using Juice.Mobile;
namespace Juice.Mvc.Mobile {
public partial class MobileHelpers {
/// <summary>
/// {summary}
/// </summary>
/// <param name="elementId">Sets the id attribute of the rendered element.</param>
/// <param name="contentTheme">Sets the color scheme (swatch) for the collapsible content block. It accepts a single letter from a-z that maps to one of the swatches included in your theme.</param>,
/// <param name="mini">Sets the size of the element to a more compact, mini version.</param>,
/// <param name="inset">By setting this option to false the collapsibles will get a full width appearance without corners.</param>,
/// <param name="theme">Defines the theme swatch letter (a-z)</param>
/// <returns>CollapsibleSetWidget</returns>
public CollapsibleSetWidget BeginCollapsibleSet(String elementId = "", String contentTheme = null, Boolean mini = false, Boolean inset = true, String theme = null) {
var widget = new CollapsibleSetWidget(_helper);
widget.SetCoreOptions(elementId, null);
widget.Options(contentTheme, mini, inset, theme);
return widget;
}
public HelperResult EndCollapsibleSet() {
return new HelperResult(writer => {
(new CollapsibleSetWidget(_helper)).RenderEnd(writer);
});
}
}
public class CollapsibleSetWidget : JuiceMobileWidget<CollapsibleSetWidget>, IDisposable {
public CollapsibleSetWidget(HtmlHelper helper) : base(helper, "collapsible-set") {
_optionsMap = new Dictionary<String, String> {
{ "contentTheme", "content-theme" },
{ "mini", "mini" },
{ "inset", "inset" },
{ "theme", "theme" }
};
}
public CollapsibleSetWidget Options(String contentTheme = null, Boolean mini = false, Boolean inset = true, String theme = null) {
base.SetOptions(
JuiceHelpers.GetMemberInfo(() => contentTheme),
JuiceHelpers.GetMemberInfo(() => mini),
JuiceHelpers.GetMemberInfo(() => inset),
JuiceHelpers.GetMemberInfo(() => theme)
);
return this;
}
}
}