init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
30
KretaWeb/Helpers/SwitchButtonExtension.cs
Normal file
30
KretaWeb/Helpers/SwitchButtonExtension.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Kreta.BusinessLogic.Utils;
|
||||
|
||||
namespace Kreta.Web.Helpers
|
||||
{
|
||||
public static class SwitchButtonExtension
|
||||
{
|
||||
public static MvcHtmlString KretaSwitchButton(this HtmlHelper helper, string name, bool state, int offstateText = 134, int onstateText = 133)
|
||||
{
|
||||
|
||||
string kikapcsolt = (bool)state ? "" : "-off";
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendFormat("<div class='onoffswitch' onclick='SwitchButtonHelper.switchButtonChange(\"my{0}\",\"hidden{0}\")'>", name);
|
||||
sb.AppendFormat("<input type='checkbox' name='{0}' class='onoffswitch-checkbox' id='my{0}' {1} Value=\"{2}\" />", name, state ? "checked" : string.Empty, state);
|
||||
sb.AppendFormat("<label class='onoffswitch-label' for='my{0}'>", name);
|
||||
sb.AppendFormat("<span class='onoffswitch-inner onoffswitch-inner-before'><span>{0}</span></span>", StringResourcesUtils.GetString(onstateText));
|
||||
sb.AppendFormat("<span class='onoffswitch-inner'></span>");
|
||||
sb.AppendFormat("<span class='onoffswitch-inner onoffswitch-inner-after'><span>{0}</span></span>", StringResourcesUtils.GetString(offstateText));
|
||||
sb.AppendFormat("<span class='onoffswitch-switch'></span>");
|
||||
sb.Append("</label>");
|
||||
sb.Append("</div>");
|
||||
sb.AppendFormat("<input type='hidden' name='{0}' Value=\"{1}\" id='hidden{2}' style='visibility:\"collapse\"'/>", name, state, name);
|
||||
|
||||
return new MvcHtmlString(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue