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

113 lines
3.2 KiB
Plaintext
Raw Normal View History

@model BuildFeed.Model.MetaItemModel
2015-01-30 05:44:54 +08:00
@{
2016-08-19 20:45:52 +08:00
ViewBag.Title = $"Add metadata for {Model.Id.Value} | BuildFeed";
2015-01-30 05:44:54 +08:00
}
<h1>@($"Add metadata for {Model.Id.Value}") </h1>
2015-10-14 03:24:39 +08:00
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">
2016-08-19 20:45:52 +08:00
@Html.LabelFor(model => model.MetaDescription, new
{
@class = "control-label"
})
<div class="wide-group">
2016-08-19 20:45:52 +08:00
@Html.TextAreaFor(model => model.MetaDescription, new
{
@class = "form-control",
rows = "2"
})
<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">
2016-08-19 20:45:52 +08:00
@Html.LabelFor(model => model.PageContent, new
{
@class = "control-label"
})
<div class="wide-group">
2016-08-19 20:45:52 +08:00
@Html.TextAreaFor(model => model.PageContent, new
{
@class = "form-control"
})
<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>
2015-10-14 03:24:39 +08:00
<input type="submit" value="Add metadata" class="btn btn-primary" />
</div>
</div>
</div>
2015-01-30 05:44:54 +08:00
}
@section Scripts
{
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
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
<script type="text/javascript" src="~/Scripts/jquery.validate.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
2015-01-30 05:44:54 +08:00
2015-10-14 03:24:39 +08:00
<script type="text/javascript">
2016-08-19 20:45:52 +08:00
function updateMetaCount()
{
var count = document.getElementById("@Html.IdFor(model => model.MetaDescription)").value.length;
$("#meta-count").text(count.toFixed(0));
2016-08-19 20:45:52 +08:00
if (count === 0)
{
$("#meta-count").attr("class", "");
}
2016-08-19 20:45:52 +08:00
else if (count < 160)
{
$("#meta-count").attr("class", "text-success");
}
2016-08-19 20:45:52 +08:00
else
{
$("#meta-count").attr("class", "text-danger");
}
}
2016-11-05 09:36:36 +08:00
$(function()
{
2015-10-14 03:24:39 +08:00
var btnsGrps = $.trumbowyg.btnsGrps;
2015-01-30 05:44:54 +08:00
2016-08-19 20:45:52 +08:00
$("#@Html.IdFor(model => model.PageContent)")
.trumbowyg({
semantic: true,
autogrow: true,
btns: [
'viewHTML',
'|', 'strong', 'em',
'|', 'link',
'|', btnsGrps.justify,
'|', btnsGrps.lists
]
});
2016-08-19 20:45:52 +08:00
$("#@Html.IdFor(model => model.MetaDescription)")
2016-11-05 09:36:36 +08:00
.keyup(function()
{
2016-08-19 20:45:52 +08:00
updateMetaCount();
});
updateMetaCount();
});
2015-10-14 03:24:39 +08:00
</script>
2015-01-30 05:44:54 +08:00
}