@model PollModel @using Telerik.Web.Mvc.UI; @Html.ValidationSummary(true) @Html.HiddenFor(model => model.Id) @Html.SmartStore().TabStrip().Name("poll-edit").Items(x => { x.Add().Text(T("Admin.ContentManagement.Polls.Info").Text).Content(TabInfo()).Selected(true); x.Add().Text(T("Admin.ContentManagement.Polls.Answers").Text).Content(TabAnswers()); x.Add().Text(T("Admin.Common.Stores").Text).Content(TabStores()); //generate an event EngineContext.Current.Resolve().Publish(new TabStripCreated(x, "poll-edit", this.Html, this.Model)); }) @helper TabInfo() {
@Html.SmartLabelFor(model => model.LanguageId) @Html.DropDownListFor(model => model.LanguageId, new SelectList(ViewBag.AllLanguages, "Id", "Name"))
@Html.SmartLabelFor(model => model.Name) @Html.EditorFor(model => model.Name) @Html.ValidationMessageFor(model => model.Name)
@Html.SmartLabelFor(model => model.SystemKeyword) @Html.EditorFor(model => model.SystemKeyword) @Html.ValidationMessageFor(model => model.SystemKeyword)
@Html.SmartLabelFor(model => model.Published) @Html.EditorFor(model => model.Published) @Html.ValidationMessageFor(model => model.Published)
@Html.SmartLabelFor(model => model.ShowOnHomePage) @Html.EditorFor(model => model.ShowOnHomePage) @Html.ValidationMessageFor(model => model.ShowOnHomePage)
@Html.SmartLabelFor(model => model.AllowGuestsToVote) @Html.EditorFor(model => model.AllowGuestsToVote) @Html.ValidationMessageFor(model => model.AllowGuestsToVote)
@Html.SmartLabelFor(model => model.DisplayOrder) @Html.EditorFor(model => model.DisplayOrder) @Html.ValidationMessageFor(model => model.DisplayOrder)
@Html.SmartLabelFor(model => model.StartDate) @Html.EditorFor(model => model.StartDate) @Html.ValidationMessageFor(model => model.StartDate)
@Html.SmartLabelFor(model => model.EndDate) @Html.EditorFor(model => model.EndDate) @Html.ValidationMessageFor(model => model.EndDate)
} @helper TabAnswers() { if (Model.Id > 0) {
@(Html.Telerik().Grid() .Name("answers-grid") .DataKeys(x => { x.Add(y => y.Id).RouteKey("Id"); x.Add(y => y.PollId).RouteKey("pollId"); }) .Columns(columns => { columns.Bound(x => x.Name) .Width(250); columns.Bound(x => x.NumberOfVotes) .ReadOnly() .Width(100); columns.Bound(x => x.DisplayOrder1).Width(100); columns.Command(commands => { commands.Edit().Localize(T); commands.Delete().Localize(T); }).Width(180); }) .ToolBar(x => x.Insert()) .Editable(x => { x.Mode(GridEditMode.InLine); }) .DataBinding(dataBinding => { dataBinding.Ajax().Select("PollAnswers", "Poll", new { pollId = Model.Id }) .Update("PollAnswerUpdate", "Poll") .Delete("PollAnswerDelete", "Poll") .Insert("PollAnswerAdd", "Poll", new { pollId = Model.Id }); }) .ClientEvents(x => x.OnError("grid_onError")) .EnableCustomBinding(true))
} else { @T("Admin.ContentManagement.Polls.Answers.SaveBeforeEdit") } } @helper TabStores() {
@Html.SmartLabelFor(model => model.LimitedToStores) @Html.EditorFor(model => model.LimitedToStores) @Html.ValidationMessageFor(model => model.LimitedToStores)
@Html.SmartLabelFor(model => model.AvailableStores) @if (Model.AvailableStores != null && Model.AvailableStores.Count > 0) { foreach (var store in Model.AvailableStores) { } } else {
@T("Admin.Configuration.Stores.NoStoresDefined")
}
}