or
01.
@model IEnumerable<
SampleViewModel
>
02.
[...]03.
@foreach (var item in Model)
04.
{
05.
<
div
class
=
"form-horizontal"
>
06.
<
div
class
=
"form-group"
>
07.
@Html.LabelFor(modelItem => item.Html, new { @class = "control-label col-md-2" })
08.
<
div
class
=
"col-md-10"
>
09.
@Html.Kendo().EditorFor(modelItem => item.Html).Tools(tools=>tools.ViewHtml()).Encode(false)
10.
</
div
>
11.
</
div
>
12.
</
div
>
13.
} [...]
<
nav
class
=
"navbar navbar-default"
role
=
"navigation"
>
<
ul
class
=
"nav navbar-nav"
>
<
li
>@Html.ActionLink(Resources.NavigationLink_Feedback, "Index", "Feedback", routeValues: null, htmlAttributes: new { @class = "feedbackmodallink" })</
li
>
</
ul
>
</
nav
>
@(Html.Kendo().Window()
.Name("FeedbackWindow")
.Title(Resources.Title_Feedback)
.LoadContentFrom("Index", "Feedback")
.Actions(action => action.Maximize().Close())
.Modal(true)
.Iframe(true)
.Visible(false)
.AutoFocus(true)
.Events(events => events.Refresh("FeedbackWindow_Refresh"))
)
$(document).ready(
function
() {
var
tFeedbackWindow = $(
"#FeedbackWindow"
).data(
"kendoWindow"
);
$(
"a.feedbackmodallink"
).click(
function
(e) {
// Was the middle button clicked?
// (allow link to still be opened in new tab with middle click should user choose)
if
(e.which != 2)
{
// No
e.preventDefault();
// Show feedback modal
MyNameSpace.TelerikWindow.OpenWindow(tFeedbackWindow);
}
});
$(window).resize(
function
(e) {
// Is feedback modal currently visible?
if
(tFeedbackWindow.options.visible) {
// Yes, resize modal to new browser size
MyNameSpace.TelerikWindow.ResizeWindow(tFeedbackWindow);
}
});
});
function
FeedbackWindow_Refresh() {
// Resize window to content
MyNameSpace.TelerikWindow.ResizeWindow(
this
);
}
MyNameSpace.TelerikWindow = {
OpenWindow:
function
(tWindow) {
/// <summary>Opens a Telerik Window after ensuring the window is refreshed back to its original URL and resized to its contents.</summary>
/// <param name="tWindow" type="kendoWindow">The Telerik Window to open.</param>
// Does the window have an iframe?
if
(tWindow.options.iframe) {
// Yes
// Get iframe document
var
iframe = tWindow.element.children(
"iframe"
)[0];
// Get iframe's original and current urls
var
originalURL = iframe.src;
var
currentURL = iframe.contentDocument.location.href;
// Do the urls match?
if
(originalURL !== currentURL) {
// No, refresh window back to original url
tWindow.refresh();
}
else
{
// Yes, ensure window is sized to contents
this
.ResizeWindow(tWindow);
}
}
// Open window
tWindow.open();
},
ResizeWindow:
function
(tWindow, minWidth, minHeight) {
/// <summary>Resizes a Telerik Window to its contents while keeping window within screen bounds.</summary>
/// <param name="tWindow" type="kendoWindow">The Telerik Window to resize.</param>
/// <param name="minWidth" type="int">The desired min width of window (defaults to 800px to keep bootstrap small columns from wrapping)</param>
/// <param name="minHeight" type="int">The desired min height of window (defaults to 375px to keep intial IE load from being too short)</param>
// Ensure minWidth and minHeight are defined
minWidth = (
typeof
minWidth ===
"undefined"
? 800 : minWidth);
minHeight = (
typeof
minHeight ===
"undefined"
? 375 : minHeight);
var
oldWidth = tWindow.options.width;
var
oldHeight = tWindow.options.height;
var
newWidth = oldWidth;
var
newHeight = oldHeight;
// Does the window have an iframe?
if
(tWindow.options.iframe) {
// Yes
// Get iframe content size (adding 40px height buffer)
var
$iframeBody = tWindow.element.children(
"iframe"
).contents().find(
"body"
);
var
iframeWidth = $iframeBody.width();
var
iframeHeight = $iframeBody.height() + 40;
// Initialize set new width and height to iframe dimensions
newWidth = (iframeWidth > minWidth ? iframeWidth : minWidth);
newHeight = (iframeHeight < minHeight ? minHeight : iframeHeight);
}
// Ensure window fits within screen bounds (using 50px buffer)
var
browserWindowWidth = window.innerWidth - 50;
var
browserWindowHeight = window.innerHeight - 50;
newWidth = (newWidth >= browserWindowWidth ? browserWindowWidth : newWidth);
newHeight = (newHeight >= browserWindowHeight ? browserWindowHeight : newHeight);
// Resize window, if needed
if
(newWidth !== oldWidth || newHeight !== oldHeight) {
tWindow.setOptions({ width: newWidth, height: newHeight });
}
// Ensure window is still centered
tWindow.center();
}
};
01.
public
IEnumerable<LogSchedulerModel> ScdLoad() {
02.
var logs = _entityProvider.QueryLogs(x => x.Where(l => l.CheckInExpected > DateTime.Now));
03.
var scdLogs = logs.Select(log =>
new
LogSchedulerModel
04.
{
05.
ID = log.ID,
06.
CheckInExpected = log.CheckInExpected,
07.
StartDate = log.StartDate,
08.
CheckInActual = log.CheckInActual,
09.
ContactNumber = log.ContactNumber,
10.
UserName = log.UserName,
11.
Location = log.UserName,
12.
Start = log.StartDate,
13.
End = log.CheckInExpected,
14.
EmergencyContactName = log.EmergencyContactName,
15.
EmergencyContactNo = log.EmergencyContactNo
16.
});
17.
18.
return
scdLogs;
19.
}
@(Html.Kendo().Scheduler<LogSchedulerModel>()
.Name(
"scheduler"
)
.Date(DateTime.Now)
.StartTime(DateTime.Now)
.Height(600)
.Views(views =>
{
views.DayView();
views.WorkWeekView(workWeekView => workWeekView.Selected(
true
));
views.WeekView();
views.MonthView();
views.AgendaView();
})
.DataSource(source => source
.SignalR()
.Events(events => events.Push(@<text>
function(e) {
var notification = $(
"#notification"
).data(
"kendoNotification"
);
notification.success(e.type);
}
</text>))
.Transport(tr => tr
.Promise(
"hubStart"
)
.Hub(
"hub"
)
.Client(c => c
.Create(
"scdcreate"
)
.Read(
"scdload"
)
.Update(
"scdupdate"
)
.Destroy(
"scddestroy"
)
)
.Server(s => s
.Create(
"scdcreate"
)
.Read(
"scdload"
)
.Update(
"scdupdate"
)
.Destroy(
"scddestroy"
)
))
.Schema(schema => schema
.Model(model =>
{
model.Id(m => m.ID);
model.Field(m => m.ID).Editable(
true
);
})
)
)
)
function
CategoryFilter(element) {
element.kendoDropDownList({
dataSource: {
transport: {
read:
"/Software/GetSoftwareCategoriesForFilter"
}
},
optionLabel:
"--Select Value--"
});
}
bundles.Add(
new
ScriptBundle(
"~/bundles/scripts"
)
.Include(
"~/Scripts/GeneralFunctions.js"
));
columns.Bound(c => c.Software.SoftwareCategory.Name).Title("Software Category").Width(150).Filterable(filterable => filterable.UI("CategoryFilter"));
01.
@(Html.Kendo().Scheduler<
HTServices.Models.TaskViewModel
>()
02.
.Name("scheduler")
03.
.Date(new DateTime(2014,4,21,7,0,0))
04.
.StartTime(new DateTime(2014,4,21,7,0,0))
05.
.Height(600)
06.
.Editable(edit =>
07.
{
08.
edit.TemplateName("ScheduleItemTemplate");
09.
edit.Create(false);
10.
edit.Destroy(false);
11.
})
12.
.Views(views =>
13.
{
14.
views.DayView();
15.
views.WeekView(weekView => weekView.Selected(true));
16.
views.MonthView();
17.
views.AgendaView();
18.
})
19.
.Timezone("Etc/UTC")
20.
.DataSource(d => d
21.
.Model(m =>
22.
{
23.
m.Id(f => f.TaskID);
24.
m.Field(f => f.Title).DefaultValue("No title");
25.
m.Field(f => f.OwnerID).DefaultValue(1);
26.
m.Field(f => f.Title).DefaultValue("No title");
27.
m.RecurrenceId(f => f.RecurrenceID);
28.
})
29.
.Read("Read", "Scheduler")
30.
.Create("Create", "Scheduler")
31.
.Destroy("Destroy", "Scheduler")
32.
.Update("Update", "Scheduler")
33.
)
34.
)
001.
@model HTServices.Models.TaskViewModel
002.
@{
003.
//required in order to render validation attributes
004.
ViewContext.FormContext = new FormContext();
005.
}
006.
007.
@functions{
008.
public Dictionary<
string
, object> generateDatePickerAttributes(
009.
string elementId,
010.
string fieldName,
011.
string dataBindAttribute,
012.
Dictionary<
string
, object> additionalAttributes = null)
013.
{
014.
015.
Dictionary<
string
, object> datePickerAttributes = additionalAttributes != null ? new Dictionary<
string
, object>(additionalAttributes) : new Dictionary<
string
, object>();
016.
017.
datePickerAttributes["id"] = elementId;
018.
datePickerAttributes["name"] = fieldName;
019.
datePickerAttributes["data-bind"] = dataBindAttribute;
020.
datePickerAttributes["required"] = "required";
021.
datePickerAttributes["style"] = "z-index: inherit;";
022.
023.
return datePickerAttributes;
024.
}
025.
026.
}
027.
<
style
type
=
"text/css"
>
028.
.panelbarHeader {
029.
font-size: 1em;
030.
font-weight: normal;
031.
}
032.
033.
.panelbarItem {
034.
text-decoration: none;
035.
font-size: .9em;
036.
font-weight: normal;
037.
padding-left: 20px;
038.
}
039.
.dutyPanel {
040.
height: 200px;
041.
}
042.
043.
.displayDate {
044.
045.
}
046.
047.
</
style
>
048.
<
div
class
=
"k-edit-label"
>
049.
@(Html.LabelFor(model => model.Client))
050.
</
div
>
051.
<
div
data-container-for
=
"client"
class
=
"k-edit-field"
>
052.
@(Html.TextBoxFor(model => model.Client, new { style = "width:100%;", @readonly = "readonly", @class = "k-textbox col-lg-12", data_bind = "text: client" }))
053.
</
div
>
054.
<
div
class
=
"k-edit-label"
>
055.
@(Html.LabelFor(model => model.Address))
056.
</
div
>
057.
<
div
data-container-for
=
"address"
class
=
"k-edit-field"
>
058.
@(Html.TextBoxFor(model => model.Address, new { style = "width:100%;", @readonly = "readonly", @class = "k-textbox", data_bind = "text: address" }))
059.
</
div
>
060.
061.
<
div
class
=
"k-edit-label"
>
062.
@(Html.LabelFor(model => model.Start))
063.
</
div
>
064.
<
div
data-container-for
=
"start"
class
=
"k-edit-field"
>
065.
066.
@(Html.Kendo().DateTimePickerFor(model => model.Start)
067.
.HtmlAttributes(generateDatePickerAttributes("startDateTime", "start", "value:start,invisible:isAllDay"))
068.
.Enable(false))
069.
070.
</
div
>
071.
072.
<
div
class
=
"k-edit-label"
>
073.
@(Html.LabelFor(model => model.End))
074.
</
div
>
075.
<
div
data-container-for
=
"end"
class
=
"k-edit-field"
>
076.
@(Html.Kendo().DateTimePickerFor(model => model.End)
077.
.HtmlAttributes(generateDatePickerAttributes(
078.
"endDateTime",
079.
"end",
080.
"value:end,invisible:isAllDay",
081.
new Dictionary<
string
, object>() {{"data-dateCompare-msg", "End date should be greater than or equal to the start date"}}))
082.
.Enable(false))
083.
</
div
>
084.
085.
<
div
class
=
"k-edit-label"
>
086.
@(Html.LabelFor(model => model.IsAllDay))
087.
</
div
>
088.
<
div
data-container-for
=
"isAllDay"
class
=
"k-edit-field"
>
089.
@(Html.DisplayFor(model => model.IsAllDay, new { @class = "k-checkbox", @readonly = "readonly", data_bind = "value: isAllDay" }))
090.
</
div
>
091.
092.
<
div
class
=
"k-edit-label"
>
093.
@(Html.LabelFor(model => model.Description))
094.
</
div
>
095.
<
div
data-container-for
=
"description"
class
=
"k-edit-field"
>
096.
@(Html.TextAreaFor(model => model.Description, new { @class = "k-textbox", @readonly = "readonly", data_bind = "value: description" }))
097.
</
div
>
098.
099.
<
div
class
=
"k-edit-label"
>
100.
@(Html.LabelFor(model => model.DutyID))
101.
</
div
>
102.
<
div
data-container-for
=
"duties"
data-task-id
=
"@Model.TaskID"
class
=
"k-edit-field dutyPanel"
>
103.
<
div
id
=
"dutyPanel"
class
=
"dutyPanel"
></
div
>
104.
</
div
>
105.
106.
@{
107.
ViewContext.FormContext = null;
108.
}
01.
$(
function
() {
02.
03.
////bind to the scheduler edit event
04.
var
scheduler = $(
"#scheduler"
).data(
"kendoScheduler"
);
05.
scheduler.bind(
"edit"
, onSchedulerEdit);
06.
07.
function
onSelect(e) {
08.
09.
e.preventDefault();
10.
}
11.
12.
function
onSchedulerEdit(e) {
13.
14.
var
d = e.event.Duties;
15.
$(
"#dutyPanel"
).kendoPanelBar({
16.
expandMode:
"multiple"
,
17.
select: onSelect,
18.
dataSource: jQuery.makeArray(d)
19.
});
20.
21.
var
panelBar = $(
"#dutyPanel"
).data(
"kendoPanelBar"
).expand($(
"#dutyPanel .k-item"
),
true
);
22.
23.
};
24.
25.
26.
});