Merge pull request #4247 from abpframework/maliming/razor-inherits

Remove inherits directive in all pages.
pull/4279/head
Halil İbrahim Kalkan 5 years ago committed by GitHub
commit 5c05797741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,7 +35,6 @@ A good way to customize a page is to copy its source code. [Click here](https://
@using Volo.Abp.Account.Settings
@using Volo.Abp.Settings
@model Acme.BookStore.Web.Pages.Account.CustomLoginModel
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject Volo.Abp.Settings.ISettingProvider SettingProvider
@if (Model.EnableLocalLogin)
{
@ -110,4 +109,4 @@ You can find the source code of the completed example [here](https://github.com/
## See Also
* [ASP.NET Core (MVC / Razor Pages) User Interface Customization Guide](../UI/AspNetCore/Customization-User-Interface.md).
* [ASP.NET Core (MVC / Razor Pages) User Interface Customization Guide](../UI/AspNetCore/Customization-User-Interface.md).

@ -14,7 +14,7 @@ else if UI == "NG"
DB="mongodb"
DB_Text="MongoDB"
UI_Text="angular"
else
else
DB ="?"
UI_Text="?"
end
@ -26,7 +26,7 @@ In this tutorial series, you will build an ABP application named `Acme.BookStore
The ASP.NET Core {{UI_Value}} tutorial series consists of 3 parts:
- **Part-1: Creating the project and book list page (this tutorial)**
- **Part-1: Creating the project and book list page (this tutorial)**
- [Part-2: Creating, updating and deleting books](part-2.md)
- [Part-3: Integration tests](part-3.md)
@ -106,7 +106,7 @@ This is how the layered solution structure looks like:
![bookstore-visual-studio-solution](./images/bookstore-solution-structure-{{UI_Text}}.png)
Check out the [solution structure](../startup-templates/application#solution-structure) section to understand the structure in details.
Check out the [solution structure](../startup-templates/application#solution-structure) section to understand the structure in details.
### Create the book entity
@ -444,7 +444,7 @@ using Volo.Abp.Application.Services;
namespace Acme.BookStore
{
public interface IBookAppService :
public interface IBookAppService :
ICrudAppService< //Defines CRUD methods
BookDto, //Used to show books
Guid, //Primary key of the book entity
@ -473,12 +473,12 @@ using Volo.Abp.Domain.Repositories;
namespace Acme.BookStore
{
public class BookAppService :
public class BookAppService :
CrudAppService<Book, BookDto, Guid, PagedAndSortedResultRequestDto,
CreateUpdateBookDto, CreateUpdateBookDto>,
IBookAppService
{
public BookAppService(IRepository<Book, Guid> repository)
public BookAppService(IRepository<Book, Guid> repository)
: base(repository)
{
@ -564,17 +564,15 @@ Open the `Index.cshtml` and change the whole content as shown below:
````html
@page
@using Acme.BookStore.Web.Pages.Books
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model IndexModel
<h2>Books</h2>
````
* This code changes the default inheritance of the Razor View Page Model so it **inherits** from the `BookStorePage` class (instead of `PageModel`). The `BookStorePage` class which comes with the startup template, provides some shared properties/methods used by all pages.
* Set the `IndexModel`'s namespace to `Acme.BookStore.Pages.Books` in `Index.cshtml.cs`.
**Index.cshtml.cs:**
@ -602,7 +600,7 @@ Open the `BookStoreMenuContributor` class in the `Menus` folder and add the foll
namespace Acme.BookStore.Web.Menus
{
public class BookStoreMenuContributor : IMenuContributor
{
{
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
//<-- added the below code
@ -681,7 +679,6 @@ Change the `Pages/Books/Index.cshtml` as following:
````html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model Acme.BookStore.Web.Pages.Books.IndexModel
@section scripts
{
@ -749,7 +746,7 @@ It's end of this part. The final UI of this work is shown as below:
{{end}}
{{if UI == "NG"}}
{{if UI == "NG"}}
### Angular development
#### Create the books page

@ -15,7 +15,7 @@ else if UI == "NG"
DB="mongodb"
DB_Text="MongoDB"
UI_Text="angular"
else
else
DB ="?"
UI_Text="?"
end
@ -86,7 +86,6 @@ Open the `CreateModal.cshtml` file and paste the code below:
````html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model Acme.BookStore.Web.Pages.Books.CreateModalModel
@{
@ -203,7 +202,7 @@ namespace Acme.BookStore.Web.Pages.Books
* In the `GetAsync` method, we get `BookDto `from `BookAppService` and this is being mapped to the DTO object `CreateUpdateBookDto`.
* The `OnPostAsync` uses `BookAppService.UpdateAsync()` to update the entity.
#### Mapping from BookDto to CreateUpdateBookDto
#### Mapping from BookDto to CreateUpdateBookDto
To be able to map the `BookDto` to `CreateUpdateBookDto`, configure a new mapping. To do this, open the `BookStoreWebAutoMapperProfile.cs` in the `Acme.BookStore.Web` project and change it as shown below:
@ -230,7 +229,6 @@ Replace `EditModal.cshtml` content with the following content:
````html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Acme.BookStore.Web.Pages.Books
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model EditModalModel
@ -256,7 +254,7 @@ This page is very similar to the `CreateModal.cshtml`, except:
#### Add "Actions" dropdown to the table
We will add a dropdown button to the table named *Actions*.
We will add a dropdown button to the table named *Actions*.
Open the `Pages/Books/Index.cshtml` page and change the `<abp-table>` section as shown below:
@ -525,7 +523,7 @@ export class BookState {
* We imported `CreateUpdateBook` action and defined the `save` method that will listen to a `CreateUpdateBook` action to create a book.
When the `SaveBook` action dispatched, the save method is being executed. It calls `createByInput` method of the `BookService`.
When the `SaveBook` action dispatched, the save method is being executed. It calls `createByInput` method of the `BookService`.
#### Add a modal to BookListComponent
@ -601,7 +599,7 @@ Open `book-list.component.html` file in `books\book-list` folder and replace the
</abp-modal>
```
* We added the `abp-modal` which renders a modal to allow user to create a new book.
* We added the `abp-modal` which renders a modal to allow user to create a new book.
* `abp-modal` is a pre-built component to show modals. While you could use another approach to show a modal, `abp-modal` provides additional benefits.
* We added `New book` button to the `AbpContentToolbar`.
@ -864,7 +862,7 @@ export class BookListComponent implements OnInit {
}
```
* We imported ` NgbDateNativeAdapter, NgbDateAdapter`
* We imported ` NgbDateNativeAdapter, NgbDateAdapter`
* We added a new provider `NgbDateAdapter` that converts Datepicker value to `Date` type. See the [datepicker adapters](https://ng-bootstrap.github.io/#/components/datepicker/overview) for more details.
@ -971,7 +969,7 @@ Open `book-list.component.html` in `app\book\book-list` folder and add the follo
<button type="button" class="btn btn-secondary" #abpClose>
{%{{{ 'AbpAccount::Close' | abpLocalization }}}%}
</button>
<!--added save button-->
<button class="btn btn-primary" (click)="save()" [disabled]="form.invalid">
<i class="fa fa-check mr-1"></i>
@ -986,7 +984,7 @@ Find the `<form [formGroup]="form">` tag and replace below content:
<form [formGroup]="form" (ngSubmit)="save()"> <!-- added the ngSubmit -->
```
* We added the `(ngSubmit)="save()"` to `<form>` element to save a new book by pressing the enter.
* We added `abp-button` to the bottom area of the modal to save a new book.
@ -1131,7 +1129,7 @@ export class BookListComponent implements OnInit {
* We imported `BookService`.
* We declared a variable named `selectedBook` as `BookDto`.
* We injected `BookService` to the constructor. `BookService` is being used to retrieve the book data which is being edited.
* We added `editBook` method. This method fetches the book with the given `Id` and sets it to `selectedBook` object.
* We added `editBook` method. This method fetches the book with the given `Id` and sets it to `selectedBook` object.
* We replaced the `buildForm` method so that it creates the form with the `selectedBook` data.
* We replaced the `createBook` method so it sets `selectedBook` to an empty object.
* We added `selectedBook.id` to the constructor of the new `CreateUpdateBook`.
@ -1291,7 +1289,7 @@ import { ConfirmationService } from '@abp/ng.theme.shared';
//...
constructor(
private store: Store,
private store: Store,
private fb: FormBuilder,
private bookService: BookService,
private confirmation: ConfirmationService // <== added this line ==>

@ -222,7 +222,7 @@ using Volo.Abp.Application.Services;
namespace Acme.BookStore
{
public interface IBookAppService :
public interface IBookAppService :
ICrudAppService< //Defines CRUD methods
BookDto, //Used to show books
Guid, //Primary key of the book entity
@ -251,12 +251,12 @@ using Volo.Abp.Domain.Repositories;
namespace Acme.BookStore
{
public class BookAppService :
public class BookAppService :
CrudAppService<Book, BookDto, Guid, PagedAndSortedResultRequestDto,
CreateUpdateBookDto, CreateUpdateBookDto>,
IBookAppService
{
public BookAppService(IRepository<Book, Guid> repository)
public BookAppService(IRepository<Book, Guid> repository)
: base(repository)
{
@ -338,13 +338,11 @@ Abra `Index.cshtml`e altere o conteúdo, como mostrado abaixo:
```html
@page
@using Acme.BookStore.Web.Pages.Books
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model IndexModel
<h2>Books</h2>
```
- Esse código altera a herança padrão do Razor View Page Model para que ele **herda** da `BookStorePage`classe (em vez de `PageModel`). A `BookStorePage`classe que acompanha o modelo de inicialização e fornece algumas propriedades / métodos compartilhados usados por todas as páginas.
- Verifique se o `IndexModel`( *Index.cshtml.cs)* possui o `Acme.BookStore.Pages.Books`espaço para nome ou atualize-o no `Index.cshtml`.
#### Adicionar página de livros ao menu principal
@ -395,7 +393,6 @@ Altere o `Pages/Books/Index.cshtml`seguinte:
```html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model Acme.BookStore.Web.Pages.Books.IndexModel
@section scripts
{
@ -459,4 +456,4 @@ A interface do usuário final é mostrada abaixo:
### Próxima parte
Veja a [próxima parte](https://docs.abp.io/en/abp/latest/Tutorials/AspNetCore-Mvc/Part-II) deste tutorial.
Veja a [próxima parte](https://docs.abp.io/en/abp/latest/Tutorials/AspNetCore-Mvc/Part-II) deste tutorial.

@ -67,7 +67,6 @@ Abra o `CreateModal.cshtml`arquivo e cole o código abaixo:
```html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model Acme.BookStore.Web.Pages.Books.CreateModalModel
@{
@ -86,13 +85,13 @@ Abra o `CreateModal.cshtml`arquivo e cole o código abaixo:
- Este modal usa o
- Este modal usa o
```
abp-dynamic-form
```
auxiliar de marca para criar automaticamente o formulário a partir da
auxiliar de marca para criar automaticamente o formulário a partir da
```
CreateBookViewModel
@ -234,7 +233,6 @@ Substitua o `EditModal.cshtml`conteúdo pelo seguinte:
```html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Acme.BookStore.Web.Pages.Books
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model EditModalModel
@ -464,4 +462,4 @@ Execute o aplicativo e tente excluir um livro.
### Próxima parte
Veja a [próxima parte](https://docs.abp.io/en/abp/latest/Tutorials/AspNetCore-Mvc/Part-III) deste tutorial.
Veja a [próxima parte](https://docs.abp.io/en/abp/latest/Tutorials/AspNetCore-Mvc/Part-III) deste tutorial.

@ -35,7 +35,6 @@ public class CustomLoginModel : LoginModel
@using Volo.Abp.Account.Settings
@using Volo.Abp.Settings
@model Acme.BookStore.Web.Pages.Account.CustomLoginModel
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject Volo.Abp.Settings.ISettingProvider SettingProvider
@if (Model.EnableLocalLogin)
{
@ -110,4 +109,4 @@ public class CustomLoginModel : LoginModel
## 另请参阅
* [ASP.NET Core (MVC / Razor Pages) 用户界面自定义指南](../UI/AspNetCore/Customization-User-Interface.md).
* [ASP.NET Core (MVC / Razor Pages) 用户界面自定义指南](../UI/AspNetCore/Customization-User-Interface.md).

@ -14,7 +14,7 @@ else if UI == "NG"
DB="mongodb"
DB_Text="MongoDB"
UI_Text="angular"
else
else
DB ="?"
UI_Text="?"
end
@ -444,7 +444,7 @@ using Volo.Abp.Application.Services;
namespace Acme.BookStore
{
public interface IBookAppService :
public interface IBookAppService :
ICrudAppService< //定义了CRUD方法
BookDto, //用来展示书籍
Guid, //Book实体的主键
@ -473,12 +473,12 @@ using Volo.Abp.Domain.Repositories;
namespace Acme.BookStore
{
public class BookAppService :
public class BookAppService :
CrudAppService<Book, BookDto, Guid, PagedAndSortedResultRequestDto,
CreateUpdateBookDto, CreateUpdateBookDto>,
IBookAppService
{
public BookAppService(IRepository<Book, Guid> repository)
public BookAppService(IRepository<Book, Guid> repository)
: base(repository)
{
@ -564,13 +564,11 @@ successfully created the book with id: 439b0ea8-923e-8e1e-5d97-39f2c7ac4246
````html
@page
@using Acme.BookStore.Web.Pages.Book
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model IndexModel
<h2>Book</h2>
````
* 此代码更改了Razor View Page Model的默认继承,因此它从`BookStorePage`类(而不是`PageModel`)继承.启动模板附带的`BookStorePage`类,提供所有页面使用的一些共享属性/方法.
* 确保`IndexModel`(Index.cshtml.cs)具有`Acme.BookStore.Web.Pages.Book`命名空间,或者在`Index.cshtml`中更新它.
**Index.cshtml.cs:**
@ -599,7 +597,7 @@ namespace Acme.BookStore.Web.Pages.Book
namespace Acme.BookStore.Web.Menus
{
public class BookStoreMenuContributor : IMenuContributor
{
{
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
//<-- added the below code
@ -667,7 +665,6 @@ namespace Acme.BookStore.Web.Menus
````html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model Acme.BookStore.Web.Pages.Book.IndexModel
@section scripts
{
@ -1060,4 +1057,4 @@ export class BookListComponent implements OnInit {
### 下一章
参阅[第二章](part-2.md)了解创建,更新和删除图书.
参阅[第二章](part-2.md)了解创建,更新和删除图书.

@ -15,7 +15,7 @@ else if UI == "NG"
DB="mongodb"
DB_Text="MongoDB"
UI_Text="angular"
else
else
DB ="?"
UI_Text="?"
end
@ -86,7 +86,6 @@ namespace Acme.BookStore.Web.Pages.Books
````html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model Acme.BookStore.Web.Pages.Books.CreateModalModel
@{
@ -230,7 +229,6 @@ namespace Acme.BookStore.Web
````html
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Acme.BookStore.Web.Pages.Books
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model EditModalModel
@ -866,7 +864,7 @@ export class BookListComponent implements OnInit {
}
```
* 我们导入了 ` NgbDateNativeAdapter, NgbDateAdapter`
* 我们导入了 ` NgbDateNativeAdapter, NgbDateAdapter`
* 我们添加了一个新的 `NgbDateAdapter` 提供程序,它将Datepicker值转换为Date类型. 有关更多详细信息,请参见[datepicker adapters](https://ng-bootstrap.github.io/#/components/datepicker/overview).
@ -972,7 +970,7 @@ export class BookListComponent implements OnInit {
<button type="button" class="btn btn-secondary" #abpClose>
{%{{{ 'AbpAccount::Close' | abpLocalization }}}%}
</button>
<!--added save button-->
<button class="btn btn-primary" (click)="save()" [disabled]="form.invalid">
<i class="fa fa-check mr-1"></i>
@ -1290,7 +1288,7 @@ import { ConfirmationService } from '@abp/ng.theme.shared';
//...
constructor(
private store: Store,
private store: Store,
private fb: FormBuilder,
private bookService: BookService,
private confirmation: ConfirmationService // <== added this line ==>

@ -1,13 +0,0 @@
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Volo.Abp.Account.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Volo.Abp.Account.Web.Pages.Account
{
public abstract class AccountPage : AbpPage
{
[RazorInject]
public IHtmlLocalizer<AccountResource> L { get; set; }
}
}

@ -1,8 +1,10 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@using Volo.Abp.Account.Settings
@using Volo.Abp.Settings
@model Volo.Abp.Account.Web.Pages.Account.LoginModel
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject IHtmlLocalizer<AccountResource> L
@inject Volo.Abp.Settings.ISettingProvider SettingProvider
@if (Model.EnableLocalLogin)
{

@ -1,3 +1,2 @@
@page "/Account/Logout"
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@model Volo.Abp.Account.Web.Pages.Account.LogoutModel
@model Volo.Abp.Account.Web.Pages.Account.LogoutModel

@ -1,11 +1,13 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@using Volo.Abp.Account.Web.Pages.Account
@using Volo.Abp.Identity.Settings
@using Volo.Abp.Settings
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
@inject ISettingProvider SettingManager
@inject IThemeManager ThemeManager
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject IHtmlLocalizer<AccountResource> L
@model ManageModel
@{
Layout = ThemeManager.CurrentTheme.GetApplicationLayout();
@ -54,4 +56,4 @@
</abp-tab>
</abp-tabs>
</abp-card-body>
</abp-card>
</abp-card>

@ -1,6 +1,8 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@model Volo.Abp.Account.Web.Pages.Account.RegisterModel
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject IHtmlLocalizer<AccountResource> L
<div class="card mt-3 shadow-sm rounded">
<div class="card-body p-5">

@ -1,6 +1,8 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@using Volo.Abp.Account.Web.Pages.Account
@inherits AccountPage
@model SendSecurityCodeModel
@inject IHtmlLocalizer<AccountResource> L
<h2>Send security code!</h2>
<p>TODO: This page is under construction.</p>
<p>TODO: This page is under construction.</p>

@ -1,8 +1,10 @@
@page
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Blogging.Pages.Blog
@inherits BloggingPage
@model Volo.Blogging.Pages.Admin.Blogs.CreateModel
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Blogging.Localization
@inject IHtmlLocalizer<BloggingResource> L
@{
Layout = null;
}

@ -1,8 +1,10 @@
@page
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Blogging.Pages.Blog
@inherits BloggingPage
@model Volo.Blogging.Pages.Admin.Blogs.EditModel
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Blogging.Localization
@inject IHtmlLocalizer<BloggingResource> L
@{
Layout = null;
}
@ -17,4 +19,4 @@
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)">
</abp-modal-footer>
</abp-modal>
</abp-dynamic-form>
</abp-dynamic-form>

@ -2,8 +2,10 @@
@using Microsoft.AspNetCore.Authorization
@using Volo.Blogging
@using Volo.Blogging.Pages.Blog
@inherits BloggingPage
@model Volo.Blogging.Pages.Admin.Blogs.IndexModel
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Blogging.Localization
@inject IHtmlLocalizer<BloggingResource> L
@inject IAuthorizationService Authorization
@{
ViewBag.PageTitle = "Blogs";

@ -1,19 +1,17 @@
using System;
using System;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
using Volo.Blogging.Localization;
using Markdig;
using Volo.Abp.DependencyInjection;
using Volo.Blogging.Localization;
namespace Volo.Blogging.Pages.Blog
{
public abstract class BloggingPage : AbpPage
public class BloggingPageHelper : ITransientDependency
{
[RazorInject]
public IHtmlLocalizer<BloggingResource> L { get; set; }
public const string DefaultTitle = "Blog";
@ -30,7 +28,7 @@ namespace Volo.Blogging.Pages.Blog
return title;
}
public string GetShortContent(string content)
public string GetShortContent(string content)
{
var html = RenderMarkdownToHtmlAsString(content);
var plainText = Regex.Replace(html, "<[^>]*>", "");
@ -49,7 +47,7 @@ namespace Volo.Blogging.Pages.Blog
{
shortContent.Append($" {line}");
}
if(shortContent.Length >= MaxShortContentLength)
{
return shortContent.ToString().Substring(0, MaxShortContentLength) + "...";

@ -1,6 +1,8 @@
@page
@using Volo.Blogging.Pages.Blog
@inherits BloggingPage
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Blogging.Localization
@inject IHtmlLocalizer<BloggingResource> L
@model IndexModel
@{
ViewBag.PageTitle = "Blogs";

@ -1,5 +1,4 @@
@page
@inherits Volo.Blogging.Pages.Blog.BloggingPage
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Http.Extensions
@using Microsoft.Extensions.Options
@ -11,6 +10,12 @@
@using Volo.Blogging.SocialMedia
@inject IAuthorizationService Authorization
@inject IOptionsSnapshot<BloggingTwitterOptions> twitterOptions
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Blogging.Localization
@using Volo.Blogging.Pages.Blog
@inject IHtmlLocalizer<BloggingResource> L
@inject BloggingPageHelper BloggingPageHelper
@inject ICurrentUser CurrentUser
@model DetailModel
@{
ViewBag.Title = Model.Post.Title;
@ -67,7 +72,7 @@
<div class="col pl-1">
@if (Model.Post.Writer != null)
{
<h5 class="mt-2 mb-1">@(Model.Post.Writer.UserName) <span>@ConvertDatetimeToTimeAgo(Model.Post.CreationTime)</span></h5>
<h5 class="mt-2 mb-1">@(Model.Post.Writer.UserName) <span>@BloggingPageHelper.ConvertDatetimeToTimeAgo(Model.Post.CreationTime)</span></h5>
}
@ -108,7 +113,7 @@
<div class="col-12 col-md-8 col-lg-7 mx-auto">
<section class="post-content">
<p>
@Html.Raw(RenderMarkdownToHtml(Model.Post.Content))
@Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content))
</p>
</section>
</div>
@ -164,7 +169,7 @@
<div class="media-body">
<h5 class="comment-owner">
@(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName)
<span>@ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime)</span>
<span>@BloggingPageHelper.ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime)</span>
</h5>
<p id="@commentWithRepliesDto.Comment.Id">
@commentWithRepliesDto.Comment.Text
@ -243,7 +248,7 @@
<div class="media-body">
<h5 class="comment-owner">
@(reply.Writer == null ? "" : reply.Writer.UserName)
<span>@ConvertDatetimeToTimeAgo(reply.CreationTime)</span>
<span>@BloggingPageHelper.ConvertDatetimeToTimeAgo(reply.CreationTime)</span>
</h5>
<p id="@reply.Id">
@reply.Text

@ -2,8 +2,10 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor
@using Volo.Blogging.Pages.Blog.Posts
@using Volo.Blogging.Posts
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Blogging.Localization
@inject IHtmlLocalizer<BloggingResource> L
@model EditModel
@inherits Volo.Blogging.Pages.Blog.BloggingPage
@{
ViewBag.PageTitle = "Blog";
}
@ -18,19 +20,19 @@
<abp-script type="@typeof(TuiEditorScriptContributor)" />
<abp-script src="/Pages/Blogs/Posts/edit.js" />
</abp-script-bundle>
}
}
<div id="edit-post-container">
<div class="container py-5">
<div class="row">
<div class="col-12 col-md-8 col-lg-7 mx-auto">
<div class="card">
<div class="card-body">
<div class="card-body">
<form method="post" id="edit-post-form">
<abp-input asp-for="Post.Title" auto-focus="true" />
<abp-alert
dismissible="true"
style="display: none"
<abp-alert
dismissible="true"
style="display: none"
id="title-length-warning"
data-max-length="@PostConsts.MaxTitleLengthToBeSeoFriendly">
@L["TitleLengthWarning"]
@ -38,7 +40,7 @@
<abp-input asp-for="Post.Url" />
<abp-input asp-for="Post.CoverImage" />
<abp-row>
<abp-column size-sm="_9">
<div class="form-group">
@ -87,5 +89,5 @@
</div>
</div>
</div>
</div>
</div>
</div>

@ -1,11 +1,15 @@
@page
@inherits Volo.Blogging.Pages.Blog.BloggingPage
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.OwlCarousel
@using Volo.Blogging
@using Volo.Blogging.Pages.Blog.Posts
@inject IAuthorizationService Authorization
@model Volo.Blogging.Pages.Blog.Posts.IndexModel
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Blogging.Localization
@using Volo.Blogging.Pages.Blog
@using IndexModel = Volo.Blogging.Pages.Blog.Posts.IndexModel
@inject IHtmlLocalizer<BloggingResource> L
@inject BloggingPageHelper BloggingPageHelper
@{
ViewBag.Title = "Blog";
}
@ -42,7 +46,7 @@
<a asp-page="./Detail" asp-route-postUrl="@post.Url" asp-route-blogShortName="@Model.BlogShortName">@post.Title</a>
</h2>
<p class="article-sum">
@Html.Raw(GetShortContent(post.Content))
@Html.Raw(BloggingPageHelper.GetShortContent(post.Content))
</p>
<a asp-page="./Detail" asp-route-postUrl="@post.Url" asp-route-blogShortName="@Model.BlogShortName" class="read-more-btn">Continue Reading &#8594;</a>
@ -57,7 +61,7 @@
<img gravatar-email="@post.Writer.Email" default-image="Identicon" class="article-avatar" />
</div>
<div class="col pl-1">
<h5 class="mt-2 mb-1">@post.Writer.UserName <span>@ConvertDatetimeToTimeAgo(post.CreationTime)</span></h5>
<h5 class="mt-2 mb-1">@post.Writer.UserName <span>@BloggingPageHelper.ConvertDatetimeToTimeAgo(post.CreationTime)</span></h5>
<i class="fa fa-eye"></i> @L["WiewsWithCount", post.ReadCount]
@*<span class="vs-seperator">|</span>
<i class="fa fa-comment"></i> @L["CommentWithCount", post.CommentCount]*@
@ -113,7 +117,7 @@
<div class="user-card">
@if (post.Writer != null)
{
<h5 class="mt-2 mb-1">@post.Writer.UserName <span>@ConvertDatetimeToTimeAgo(post.CreationTime)</span></h5>
<h5 class="mt-2 mb-1">@post.Writer.UserName <span>@BloggingPageHelper.ConvertDatetimeToTimeAgo(post.CreationTime)</span></h5>
}
<i class="fa fa-eye"></i> @L["WiewsWithCount", post.ReadCount]
@*<span class="vs-seperator">|</span>
@ -161,7 +165,7 @@
<a asp-page="./Detail" asp-route-postUrl="@post.Url" asp-route-blogShortName="@Model.BlogShortName">@post.Title</a>
</h3>
<p>
@Html.Raw(GetShortContent(post.Content))
@Html.Raw(BloggingPageHelper.GetShortContent(post.Content))
</p>
<a asp-page="./Detail" asp-route-postUrl="@post.Url" asp-route-blogShortName="@Model.BlogShortName" class="read-more-btn">Continue Reading &#8594;</a>
@ -175,7 +179,7 @@
<img gravatar-email="@post.Writer.Email" default-image="Identicon" class="article-avatar" />
</div>
<div class="col pl-1">
<h5 class="mt-2 mb-1">@post.Writer.UserName <span>@ConvertDatetimeToTimeAgo(post.CreationTime)</span></h5>
<h5 class="mt-2 mb-1">@post.Writer.UserName <span>@BloggingPageHelper.ConvertDatetimeToTimeAgo(post.CreationTime)</span></h5>
<i class="fa fa-eye"></i> @L["WiewsWithCount", post.ReadCount]
@*<span class="vs-seperator">|</span>
<i class="fa fa-comment"></i> @L["CommentWithCount", post.CommentCount]*@

@ -2,8 +2,10 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor
@using Volo.Blogging.Pages.Blog.Posts
@using Volo.Blogging.Posts
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Blogging.Localization
@inject IHtmlLocalizer<BloggingResource> L
@model NewModel
@inherits Volo.Blogging.Pages.Blog.BloggingPage
@{
ViewBag.PageTitle = "Blog";
}

@ -1,13 +0,0 @@
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
using Volo.Docs.Localization;
namespace Volo.Docs.Admin.Pages.Docs.Admin
{
public abstract class DocsAdminPage : AbpPage
{
[RazorInject]
public IHtmlLocalizer<DocsResource> L { get; set; }
}
}

@ -1,8 +1,10 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Docs.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Docs.Admin.Pages.Docs.Admin.Projects
@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.CreateModel
@inject IHtmlLocalizer<DocsResource> L
@{
Layout = null;
}
@ -19,4 +21,4 @@
</abp-modal-footer>
</abp-modal>
</abp-dynamic-form>
}
}

@ -1,8 +1,10 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Docs.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Docs.Admin.Pages.Docs.Admin.Projects
@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.EditModel
@inject IHtmlLocalizer<DocsResource> L
@{
Layout = null;
}
@ -19,4 +21,4 @@
</abp-modal-footer>
</abp-modal>
</abp-dynamic-form>
}
}

@ -3,8 +3,10 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Docs.Admin
@using Volo.Docs.Admin.Navigation
@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Docs.Localization
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.IndexModel
@inject IHtmlLocalizer<DocsResource> L
@inject IAuthorizationService Authorization
@{
ViewBag.PageTitle = "Projects";

@ -1,8 +1,10 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Docs.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Docs.Admin.Pages.Docs.Admin.Projects
@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.PullModel
@inject IHtmlLocalizer<DocsResource> L
@{
Layout = null;
}

@ -1,25 +0,0 @@
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using ProductManagement.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace ProductManagement.Pages.ProductManagement
{
public abstract class ProductManagementPage : AbpPage
{
[RazorInject]
public IHtmlLocalizer<ProductManagementResource> L { get; set; }
public const string DefaultTitle = "ProductManagement";
public string GetTitle(string title = null)
{
if (string.IsNullOrWhiteSpace(title))
{
return DefaultTitle;
}
return title;
}
}
}

@ -1,7 +1,9 @@
@page
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@inherits ProductManagement.Pages.ProductManagement.ProductManagementPage
@using Microsoft.AspNetCore.Mvc.Localization
@using ProductManagement.Localization
@model ProductManagement.Pages.ProductManagement.Products.CreateModel
@inject IHtmlLocalizer<ProductManagementResource> L
@{
Layout = null;
}

@ -1,7 +1,9 @@
@page
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@inherits ProductManagement.Pages.ProductManagement.ProductManagementPage
@using Microsoft.AspNetCore.Mvc.Localization
@using ProductManagement.Localization
@model ProductManagement.Pages.ProductManagement.Products.EditModel
@inject IHtmlLocalizer<ProductManagementResource> L
@{
Layout = null;
}
@ -15,4 +17,4 @@
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)">
</abp-modal-footer>
</abp-modal>
</abp-dynamic-form>
</abp-dynamic-form>

@ -1,9 +1,11 @@
@page
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using ProductManagement
@inherits ProductManagement.Pages.ProductManagement.ProductManagementPage
@using ProductManagement.Localization
@model ProductManagement.Pages.ProductManagement.Products.IndexModel
@inject IAuthorizationService Authorization
@inject IHtmlLocalizer<ProductManagementResource> L
@{
ViewBag.PageTitle = "Products";
}

@ -1,6 +1,10 @@
@page
@inherits MyCompanyName.MyProjectName.Web.Pages.MyProjectNamePage
@model MyCompanyName.MyProjectName.Web.Pages.IndexModel
@using Microsoft.AspNetCore.Mvc.Localization
@using MyCompanyName.MyProjectName.Localization
@using Volo.Abp.Users
@inject IHtmlLocalizer<MyProjectNameResource> L
@inject ICurrentUser CurrentUser
@section styles {
<abp-style-bundle>
<abp-style src="/Pages/Index.css" />
@ -24,4 +28,4 @@
<hr />
<p class="text-right"><a href="https://abp.io?ref=tmpl" target="_blank">abp.io</a></p>
</abp-card-body>
</abp-card>
</abp-card>

@ -1,13 +0,0 @@
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using MyCompanyName.MyProjectName.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace MyCompanyName.MyProjectName.Web.Pages
{
public abstract class MyProjectNamePage : AbpPage
{
[RazorInject]
public IHtmlLocalizer<MyProjectNameResource> L { get; set; }
}
}

@ -1,7 +1,11 @@
@page
@using MyCompanyName.MyProjectName.Pages
@inherits MyProjectNamePage
@model IndexModel
@using Microsoft.AspNetCore.Mvc.Localization
@using MyCompanyName.MyProjectName.Localization
@using Volo.Abp.Users
@inject IHtmlLocalizer<MyProjectNameResource> L
@inject ICurrentUser CurrentUser
<abp-card>
<abp-card-header>Welcome</abp-card-header>
<abp-card-body>
@ -19,4 +23,4 @@
<hr />
<p class="text-right"><a href="https://abp.io?ref=tmpl" target="_blank">abp.io</a></p>
</abp-card-body>
</abp-card>
</abp-card>

@ -1,13 +0,0 @@
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using MyCompanyName.MyProjectName.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace MyCompanyName.MyProjectName.Pages
{
public abstract class MyProjectNamePage : AbpPage
{
[RazorInject]
public IHtmlLocalizer<MyProjectNameResource> L { get; set; }
}
}

@ -1,7 +1,6 @@
@page
@inherits MyCompanyName.MyProjectName.Web.Pages.MyProjectNamePage
@model MyCompanyName.MyProjectName.Web.Pages.MyProjectName.IndexModel
@{
}
<h1>MyProjectName</h1>
<p>A sample page for the MyProjectName module.</p>
<p>A sample page for the MyProjectName module.</p>

@ -1,16 +0,0 @@
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using MyCompanyName.MyProjectName.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace MyCompanyName.MyProjectName.Web.Pages
{
/* Inherit your UI Pages from this class. To do that, add this line to your Pages (.cshtml files under the Page folder):
* @inherits MyCompanyName.MyProjectName.Web.Pages.MyProjectNamePage
*/
public abstract class MyProjectNamePage : AbpPage
{
[RazorInject]
public IHtmlLocalizer<MyProjectNameResource> L { get; set; }
}
}
Loading…
Cancel
Save