BuildFeed/BuildFeed/Areas/admin/Views/meta/create.cshtml

96 lines
3.0 KiB
Plaintext
Raw Normal View History

2015-10-14 03:24:39 +08:00
@model BuildFeed.Models.MetaItemModel
2015-01-30 05:44:54 +08:00
@{
2015-10-14 03:24:39 +08:00
ViewBag.Title = string.Format("Add metadata for {0} | BuildFeed", Model.Id.Value);
2015-01-30 05:44:54 +08:00
}
2015-10-14 03:24:39 +08:00
<h2>@string.Format("Add metadata for {0}", Model.Id.Value)</h2>
2015-01-30 05:44:54 +08:00
@using (Html.BeginForm())
{
2015-10-14 03:24:39 +08:00
@Html.AntiForgeryToken()
2015-01-30 05:44:54 +08:00
2015-10-14 03:24:39 +08:00
@Html.HiddenFor(model => model.Id.Type)
@Html.HiddenFor(model => model.Id.Value)
2015-01-30 05:44:54 +08:00
2015-10-14 03:24:39 +08:00
<div class="form-horizontal">
<div class="form-group">
@Html.LabelFor(model => model.MetaDescription, htmlAttributes: new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-8">
@Html.TextAreaFor(model => model.MetaDescription, new { @class = "form-control", rows = "2" })
</div>
2015-01-30 05:44:54 +08:00
</div>
<div class="help-block">
<span id="meta-count">0</span> characters
@Html.ValidationMessageFor(model => model.MetaDescription)
</div>
2015-10-14 03:24:39 +08:00
</div>
</div>
2015-01-30 05:44:54 +08:00
2015-10-14 03:24:39 +08:00
<div class="form-group">
@Html.LabelFor(model => model.PageContent, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-8">
@Html.TextAreaFor(model => model.PageContent, new { @class = "form-control" })
</div>
2015-01-30 05:44:54 +08:00
</div>
<div class="help-block">
@Html.ValidationMessageFor(model => model.PageContent)
</div>
2015-10-14 03:24:39 +08:00
</div>
</div>
2015-01-30 05:44:54 +08:00
2015-10-14 03:24:39 +08:00
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" value="Add metadata" class="btn btn-primary" />
</div>
</div>
</div>
2015-01-30 05:44:54 +08:00
}
@section Scripts
{
2015-10-14 03:24:39 +08:00
<script src="~/Scripts/trumbowyg/trumbowyg.min.js" type="text/javascript"></script>
<link href="~/Scripts/trumbowyg/ui/trumbowyg.min.css" rel="stylesheet" type="text/css" />
2015-01-30 05:44:54 +08:00
2015-10-14 03:24:39 +08:00
@Scripts.Render("~/bundles/jqueryval")
2015-01-30 05:44:54 +08:00
2015-10-14 03:24:39 +08:00
<script type="text/javascript">
function updateMetaCount() {
var count = document.getElementById("@Html.IdFor(model => model.MetaDescription)").value.length;
$("#meta-count").text(count.toFixed(0));
if (count == 0) {
$("#meta-count").attr("class", "");
}
else if (count < 160) {
$("#meta-count").attr("class", "text-success");
}
else {
$("#meta-count").attr("class", "text-danger");
}
}
2015-10-14 03:24:39 +08:00
$(function () {
var btnsGrps = $.trumbowyg.btnsGrps;
2015-01-30 05:44:54 +08:00
2015-10-14 03:24:39 +08:00
$("#@Html.IdFor(model => model.PageContent)").trumbowyg({
semantic: true,
autogrow: true,
btns: ['viewHTML',
'|', 'strong', 'em',
'|', 'link',
'|', btnsGrps.justify,
'|', btnsGrps.lists]
});
$("#@Html.IdFor(model => model.MetaDescription)").keyup(function () {
updateMetaCount();
});
updateMetaCount();
});
2015-10-14 03:24:39 +08:00
</script>
2015-01-30 05:44:54 +08:00
}