init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
125
KretaWeb/Helpers/ButtonExtensions.cs
Normal file
125
KretaWeb/Helpers/ButtonExtensions.cs
Normal file
|
@ -0,0 +1,125 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kendo.Mvc.UI.Fluent;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Helpers.Modal;
|
||||
|
||||
namespace Kreta.Web.Helpers
|
||||
{
|
||||
public static class ButtonExtensions
|
||||
{
|
||||
private const string ObsoleteButtonExtensions = "Ne használd, a text-es KretaButton metódust használd helyette!";
|
||||
|
||||
[Obsolete(ObsoleteButtonExtensions)]
|
||||
public static ButtonBuilder KretaButton(
|
||||
this HtmlHelper helper,
|
||||
string name,
|
||||
int content,
|
||||
bool enabled = true,
|
||||
string spriteCssClass = null,
|
||||
string icon = null,
|
||||
string imageUrl = null,
|
||||
IDictionary<string, object> htmlAttributes = null,
|
||||
string clickEventName = null)
|
||||
{
|
||||
var type = "button";
|
||||
var text = StringResourcesUtil.GetString(content);
|
||||
var button = helper.KretaButton(name, text, type, enabled, spriteCssClass, icon, imageUrl, htmlAttributes, clickEventName);
|
||||
return button;
|
||||
}
|
||||
|
||||
[Obsolete(ObsoleteButtonExtensions)]
|
||||
public static ButtonBuilder KretaButton(
|
||||
this HtmlHelper helper,
|
||||
string name,
|
||||
int content,
|
||||
string type = "button",
|
||||
bool enabled = true,
|
||||
string spriteCssClass = null,
|
||||
string icon = null,
|
||||
string imageUrl = null,
|
||||
IDictionary<string, object> htmlAttributes = null,
|
||||
string clickEventName = null)
|
||||
{
|
||||
var text = StringResourcesUtil.GetString(content);
|
||||
var button = helper.KretaButton(name, text, type, enabled, spriteCssClass, icon, imageUrl, htmlAttributes, clickEventName);
|
||||
return button;
|
||||
}
|
||||
|
||||
public static ButtonBuilder KretaButton(this HtmlHelper helper, ModalButtonModel modalButtonModel, string type = "button")
|
||||
{
|
||||
var button = helper.KretaButton(
|
||||
modalButtonModel.Name,
|
||||
modalButtonModel.Text,
|
||||
type,
|
||||
modalButtonModel.Enabled,
|
||||
modalButtonModel.SpriteCssClass,
|
||||
modalButtonModel.Icon,
|
||||
modalButtonModel.ImageUrl,
|
||||
null,
|
||||
modalButtonModel.EventName);
|
||||
return button;
|
||||
}
|
||||
|
||||
public static ButtonBuilder KretaButton(
|
||||
this HtmlHelper helper,
|
||||
string name,
|
||||
string text,
|
||||
string type = "button",
|
||||
bool enabled = true,
|
||||
string spriteCssClass = null,
|
||||
string icon = null,
|
||||
string imageUrl = null,
|
||||
IDictionary<string, object> htmlAttributes = null,
|
||||
string clickEventName = null)
|
||||
{
|
||||
var button = helper.Kendo().Button()
|
||||
.Name(name)
|
||||
.Content(text)
|
||||
.Enable(enabled)
|
||||
.SpriteCssClass(spriteCssClass)
|
||||
.Icon(icon)
|
||||
.ImageUrl(imageUrl);
|
||||
|
||||
if (htmlAttributes == null)
|
||||
{
|
||||
htmlAttributes = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
htmlAttributes.Add("type", type);
|
||||
button.HtmlAttributes(htmlAttributes);
|
||||
|
||||
if (clickEventName != null)
|
||||
{
|
||||
button.Events(x => x.Click(clickEventName));
|
||||
}
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
public static ButtonBuilder KretaSaveButton(
|
||||
this HtmlHelper helper,
|
||||
string name,
|
||||
string clickEventName = null)
|
||||
{
|
||||
var button = helper.Kendo().Button()
|
||||
.Name(name)
|
||||
.Content(CommonResource.Mentes);
|
||||
|
||||
var htmlAttributes = new Dictionary<string, object> { { "style", "background-color:#54a5d1" } };
|
||||
htmlAttributes.Add("type", "button");
|
||||
button.HtmlAttributes(htmlAttributes);
|
||||
|
||||
if (clickEventName != null)
|
||||
{
|
||||
button.Events(x => x.Click(clickEventName));
|
||||
}
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue