Refactor new blog post page.

pull/318/head v0.3.2.2
Halil ibrahim Kalkan 8 years ago
parent e258bcaef9
commit c239c09eeb

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Entities;
using Volo.Abp.UI;
namespace Volo.Blogging.Blogs
@ -30,7 +32,7 @@ namespace Volo.Blogging.Blogs
if (blog == null)
{
throw new UserFriendlyException("Blog Doesn't exist");
throw new EntityNotFoundException(typeof(Blog), shortName);
}
return ObjectMapper.Map<Blog, BlogDto>(blog);

@ -1,8 +1,12 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.UI;
using Volo.Abp.VirtualFileSystem;
using Volo.Blogging.Localization;
@ -29,6 +33,15 @@ namespace Volo.Blogging
options.FileSets.AddEmbedded<BloggingWebModule>("Volo.Blogging");
});
services.Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<BloggingResource>()
.AddBaseTypes(typeof(AbpValidationResource))
.AddBaseTypes(typeof(AbpUiModule))
.AddVirtualJson("/Localization/Resources/Blogging/Web");
});
services.Configure<RazorPagesOptions>(options =>
{
//TODO: Make configurable!

@ -0,0 +1,7 @@
{
"culture": "en",
"texts": {
"Title": "Title",
"Content": "Content"
}
}

@ -0,0 +1,7 @@
{
"culture": "tr",
"texts": {
"Title": "Başlık",
"Content": "İçerik"
}
}

@ -1,14 +1,15 @@
@page
@using Volo.Blogging.Pages.Blog.Posts
@model NewModel
@inherits Volo.Blogging.Pages.Blog.BloggingPage
<form method="post">
<abp-input asp-for="Post.Title" auto-focus="true" />
<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="Post.BlogId" label=" " /> @* TODO: Remove label when the issue is fixed *@
<abp-button type="submit" text="Submit" />
<abp-button type="submit" text="@L["Submit"].Value" />
</form>

@ -59,9 +59,11 @@ namespace Volo.Blogging.Pages.Blog.Posts
[Required]
[StringLength(PostConsts.MaxTitleLength)]
[Display(Name = "Title")]
public string Title { get; set; }
[StringLength(PostConsts.MaxContentLength)]
[Display(Name = "Content")]
public string Content { get; set; }
}
}

@ -20,23 +20,8 @@
<ItemGroup>
<EmbeddedResource Include="wwwroot\**\*.*" />
<EmbeddedResource Include="Localization\Resources\Blogging\Web\*.json" />
<EmbeddedResource Include="Pages\**\*.cshtml" Exclude="*.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="Pages\Blog\Posts\Detail.cshtml" />
<Content Remove="Pages\Blog\Posts\Index.cshtml" />
<Content Remove="Pages\Blog\_ViewImports.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="Pages\Blog\Posts\Edit.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Update="Pages\Blog\Posts\Edit.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
</ItemGroup>
</Project>

@ -3,6 +3,7 @@ using MyCompanyName.MyProjectName.Localization.MyProjectName;
using MyCompanyName.MyProjectName.Settings;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.Settings;
using Volo.Abp.VirtualFileSystem;
@ -23,6 +24,7 @@ namespace MyCompanyName.MyProjectName
{
options.Resources
.Add<MyProjectNameResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/MyProjectName");
});

Loading…
Cancel
Save