Browse Source

Blogging add post url controls

pull/318/head
Yunus Emre Kalkan 8 years ago
parent
commit
be562c4b5e
  1. 18
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml
  2. 6
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml
  3. 4
      modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj
  4. 14
      modules/blogging/src/Volo.Blogging.Web/wwwroot/pages/blog/posts/edit.js
  5. 14
      modules/blogging/src/Volo.Blogging.Web/wwwroot/pages/blog/posts/new.js

18
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml

@ -1,23 +1,25 @@
@page
@using Volo.Blogging.Pages.Blog.Posts
@model EditModel
@inherits Volo.Blogging.Pages.Blog.BloggingPage
<form method="post" id="edit-post-form">
<abp-input asp-for="@Model.Post.Title" auto-focus="true" />
@section scripts {
<abp-script-bundle name="@typeof(EditModel).FullName">
<abp-script src="/pages/blog/posts/edit.js" />
</abp-script-bundle>
}
<form method="post">
<abp-input asp-for="@Model.Post.Title" auto-focus="true" />
<abp-input asp-for="@Model.Post.Url" />
<div class="form-group">
<label>Content</label>
<label>@L["Content"]</label>
<textarea rows="4" class="form-control" name="Post.Content">@Model.Post.Content</textarea>
</div>
<abp-input asp-for="@Model.Post.BlogId" hidden="" />
<abp-input asp-for="@Model.Post.Id" hidden="" />
<abp-button type="submit" form="edit-post-form">
<span>Submit</span>
</abp-button>
<abp-button type="submit" text="@L["Submit"].Value" />
</form>

6
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml

@ -2,6 +2,12 @@
@using Volo.Blogging.Pages.Blog.Posts
@model NewModel
@inherits Volo.Blogging.Pages.Blog.BloggingPage
@section scripts {
<abp-script-bundle name="@typeof(NewModel).FullName">
<abp-script src="/pages/blog/posts/bew.js" />
</abp-script-bundle>
}
<form method="post">
<abp-input asp-for="Post.Title" auto-focus="true" />

4
modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj

@ -25,4 +25,8 @@
<EmbeddedResource Include="Pages\**\*.cshtml" Exclude="*.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="wwwroot\pages\blog\posts\edit.js" />
</ItemGroup>
</Project>

14
modules/blogging/src/Volo.Blogging.Web/wwwroot/pages/blog/posts/edit.js

@ -0,0 +1,14 @@
(function ($) {
$('#Post_Title').on("change paste keyup", function() {
var title = $('#Post_Title').val();
if (title.length > 64) {
title = title.substring(0, 64);
}
title = title.replace(' ','-');
$('#Post_Url').val(title);
});
})(jQuery);

14
modules/blogging/src/Volo.Blogging.Web/wwwroot/pages/blog/posts/new.js

@ -0,0 +1,14 @@
(function ($) {
$('#Post_Title').on("change paste keyup", function() {
var title = $('#Post_Title').val();
if (title.length > 64) {
title = title.substring(0, 64);
}
title = title.replace(' ','-');
$('#Post_Url').val(title);
});
})(jQuery);
Loading…
Cancel
Save