Browse Source

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

Remove inherits directive in all pages.
pull/4279/head
Halil İbrahim Kalkan 6 years ago
committed by GitHub
parent
commit
5c05797741
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      docs/en/How-To/Customize-Login-Page-MVC.md
  2. 21
      docs/en/Tutorials/Part-1.md
  3. 22
      docs/en/Tutorials/Part-2.md
  4. 11
      docs/pt-BR/Tutorials/AspNetCore-Mvc/Part-I.md
  5. 8
      docs/pt-BR/Tutorials/AspNetCore-Mvc/Part-II.md
  6. 3
      docs/zh-Hans/How-To/Customize-Login-Page-MVC.md
  7. 15
      docs/zh-Hans/Tutorials/Part-1.md
  8. 10
      docs/zh-Hans/Tutorials/Part-2.md
  9. 13
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPage.cs
  10. 4
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml
  11. 3
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Logout.cshtml
  12. 6
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml
  13. 4
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml
  14. 6
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml
  15. 4
      modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Create.cshtml
  16. 6
      modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Edit.cshtml
  17. 4
      modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Index.cshtml
  18. 14
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs
  19. 4
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Index.cshtml
  20. 15
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml
  21. 20
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml
  22. 18
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml
  23. 4
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml
  24. 13
      modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPage.cs
  25. 6
      modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml
  26. 6
      modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml
  27. 4
      modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml
  28. 4
      modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml
  29. 25
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/ProductManagementPage.cs
  30. 4
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/Products/Create.cshtml
  31. 6
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/Products/Edit.cshtml
  32. 4
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/Products/Index.cshtml
  33. 8
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Pages/Index.cshtml
  34. 13
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Pages/MyProjectNamePage.cs
  35. 8
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Pages/Index.cshtml
  36. 13
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Pages/MyProjectNamePage.cs
  37. 3
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml
  38. 16
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectNamePage.cs

3
docs/en/How-To/Customize-Login-Page-MVC.md

@ -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.Account.Settings
@using Volo.Abp.Settings @using Volo.Abp.Settings
@model Acme.BookStore.Web.Pages.Account.CustomLoginModel @model Acme.BookStore.Web.Pages.Account.CustomLoginModel
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject Volo.Abp.Settings.ISettingProvider SettingProvider @inject Volo.Abp.Settings.ISettingProvider SettingProvider
@if (Model.EnableLocalLogin) @if (Model.EnableLocalLogin)
{ {
@ -110,4 +109,4 @@ You can find the source code of the completed example [here](https://github.com/
## See Also ## 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).

21
docs/en/Tutorials/Part-1.md

@ -14,7 +14,7 @@ else if UI == "NG"
DB="mongodb" DB="mongodb"
DB_Text="MongoDB" DB_Text="MongoDB"
UI_Text="angular" UI_Text="angular"
else else
DB ="?" DB ="?"
UI_Text="?" UI_Text="?"
end 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: 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-2: Creating, updating and deleting books](part-2.md)
- [Part-3: Integration tests](part-3.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) ![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 ### Create the book entity
@ -444,7 +444,7 @@ using Volo.Abp.Application.Services;
namespace Acme.BookStore namespace Acme.BookStore
{ {
public interface IBookAppService : public interface IBookAppService :
ICrudAppService< //Defines CRUD methods ICrudAppService< //Defines CRUD methods
BookDto, //Used to show books BookDto, //Used to show books
Guid, //Primary key of the book entity Guid, //Primary key of the book entity
@ -473,12 +473,12 @@ using Volo.Abp.Domain.Repositories;
namespace Acme.BookStore namespace Acme.BookStore
{ {
public class BookAppService : public class BookAppService :
CrudAppService<Book, BookDto, Guid, PagedAndSortedResultRequestDto, CrudAppService<Book, BookDto, Guid, PagedAndSortedResultRequestDto,
CreateUpdateBookDto, CreateUpdateBookDto>, CreateUpdateBookDto, CreateUpdateBookDto>,
IBookAppService IBookAppService
{ {
public BookAppService(IRepository<Book, Guid> repository) public BookAppService(IRepository<Book, Guid> repository)
: base(repository) : base(repository)
{ {
@ -564,17 +564,15 @@ Open the `Index.cshtml` and change the whole content as shown below:
````html ````html
@page @page
@using Acme.BookStore.Web.Pages.Books @using Acme.BookStore.Web.Pages.Books
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model IndexModel @model IndexModel
<h2>Books</h2> <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`. * Set the `IndexModel`'s namespace to `Acme.BookStore.Pages.Books` in `Index.cshtml.cs`.
**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 namespace Acme.BookStore.Web.Menus
{ {
public class BookStoreMenuContributor : IMenuContributor public class BookStoreMenuContributor : IMenuContributor
{ {
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context) private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{ {
//<-- added the below code //<-- added the below code
@ -681,7 +679,6 @@ Change the `Pages/Books/Index.cshtml` as following:
````html ````html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model Acme.BookStore.Web.Pages.Books.IndexModel @model Acme.BookStore.Web.Pages.Books.IndexModel
@section scripts @section scripts
{ {
@ -749,7 +746,7 @@ It's end of this part. The final UI of this work is shown as below:
{{end}} {{end}}
{{if UI == "NG"}} {{if UI == "NG"}}
### Angular development ### Angular development
#### Create the books page #### Create the books page

22
docs/en/Tutorials/Part-2.md

@ -15,7 +15,7 @@ else if UI == "NG"
DB="mongodb" DB="mongodb"
DB_Text="MongoDB" DB_Text="MongoDB"
UI_Text="angular" UI_Text="angular"
else else
DB ="?" DB ="?"
UI_Text="?" UI_Text="?"
end end
@ -86,7 +86,6 @@ Open the `CreateModal.cshtml` file and paste the code below:
````html ````html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model Acme.BookStore.Web.Pages.Books.CreateModalModel @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`. * 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. * 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: 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 ````html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Acme.BookStore.Web.Pages.Books @using Acme.BookStore.Web.Pages.Books
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model EditModalModel @model EditModalModel
@ -256,7 +254,7 @@ This page is very similar to the `CreateModal.cshtml`, except:
#### Add "Actions" dropdown to the table #### 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: 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. * 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 #### 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> </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. * `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`. * 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. * 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> <button type="button" class="btn btn-secondary" #abpClose>
{%{{{ 'AbpAccount::Close' | abpLocalization }}}%} {%{{{ 'AbpAccount::Close' | abpLocalization }}}%}
</button> </button>
<!--added save button--> <!--added save button-->
<button class="btn btn-primary" (click)="save()" [disabled]="form.invalid"> <button class="btn btn-primary" (click)="save()" [disabled]="form.invalid">
<i class="fa fa-check mr-1"></i> <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 --> <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 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. * 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 imported `BookService`.
* We declared a variable named `selectedBook` as `BookDto`. * 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 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 `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 replaced the `createBook` method so it sets `selectedBook` to an empty object.
* We added `selectedBook.id` to the constructor of the new `CreateUpdateBook`. * We added `selectedBook.id` to the constructor of the new `CreateUpdateBook`.
@ -1291,7 +1289,7 @@ import { ConfirmationService } from '@abp/ng.theme.shared';
//... //...
constructor( constructor(
private store: Store, private store: Store,
private fb: FormBuilder, private fb: FormBuilder,
private bookService: BookService, private bookService: BookService,
private confirmation: ConfirmationService // <== added this line ==> private confirmation: ConfirmationService // <== added this line ==>

11
docs/pt-BR/Tutorials/AspNetCore-Mvc/Part-I.md

@ -222,7 +222,7 @@ using Volo.Abp.Application.Services;
namespace Acme.BookStore namespace Acme.BookStore
{ {
public interface IBookAppService : public interface IBookAppService :
ICrudAppService< //Defines CRUD methods ICrudAppService< //Defines CRUD methods
BookDto, //Used to show books BookDto, //Used to show books
Guid, //Primary key of the book entity Guid, //Primary key of the book entity
@ -251,12 +251,12 @@ using Volo.Abp.Domain.Repositories;
namespace Acme.BookStore namespace Acme.BookStore
{ {
public class BookAppService : public class BookAppService :
CrudAppService<Book, BookDto, Guid, PagedAndSortedResultRequestDto, CrudAppService<Book, BookDto, Guid, PagedAndSortedResultRequestDto,
CreateUpdateBookDto, CreateUpdateBookDto>, CreateUpdateBookDto, CreateUpdateBookDto>,
IBookAppService IBookAppService
{ {
public BookAppService(IRepository<Book, Guid> repository) public BookAppService(IRepository<Book, Guid> repository)
: base(repository) : base(repository)
{ {
@ -338,13 +338,11 @@ Abra `Index.cshtml`e altere o conteúdo, como mostrado abaixo:
```html ```html
@page @page
@using Acme.BookStore.Web.Pages.Books @using Acme.BookStore.Web.Pages.Books
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model IndexModel @model IndexModel
<h2>Books</h2> <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`. - 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 #### Adicionar página de livros ao menu principal
@ -395,7 +393,6 @@ Altere o `Pages/Books/Index.cshtml`seguinte:
```html ```html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model Acme.BookStore.Web.Pages.Books.IndexModel @model Acme.BookStore.Web.Pages.Books.IndexModel
@section scripts @section scripts
{ {
@ -459,4 +456,4 @@ A interface do usuário final é mostrada abaixo:
### Próxima parte ### 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.

8
docs/pt-BR/Tutorials/AspNetCore-Mvc/Part-II.md

@ -67,7 +67,6 @@ Abra o `CreateModal.cshtml`arquivo e cole o código abaixo:
```html ```html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model Acme.BookStore.Web.Pages.Books.CreateModalModel @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 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 CreateBookViewModel
@ -234,7 +233,6 @@ Substitua o `EditModal.cshtml`conteúdo pelo seguinte:
```html ```html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Acme.BookStore.Web.Pages.Books @using Acme.BookStore.Web.Pages.Books
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model EditModalModel @model EditModalModel
@ -464,4 +462,4 @@ Execute o aplicativo e tente excluir um livro.
### Próxima parte ### 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.

3
docs/zh-Hans/How-To/Customize-Login-Page-MVC.md

@ -35,7 +35,6 @@ public class CustomLoginModel : LoginModel
@using Volo.Abp.Account.Settings @using Volo.Abp.Account.Settings
@using Volo.Abp.Settings @using Volo.Abp.Settings
@model Acme.BookStore.Web.Pages.Account.CustomLoginModel @model Acme.BookStore.Web.Pages.Account.CustomLoginModel
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject Volo.Abp.Settings.ISettingProvider SettingProvider @inject Volo.Abp.Settings.ISettingProvider SettingProvider
@if (Model.EnableLocalLogin) @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).

15
docs/zh-Hans/Tutorials/Part-1.md

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

10
docs/zh-Hans/Tutorials/Part-2.md

@ -15,7 +15,7 @@ else if UI == "NG"
DB="mongodb" DB="mongodb"
DB_Text="MongoDB" DB_Text="MongoDB"
UI_Text="angular" UI_Text="angular"
else else
DB ="?" DB ="?"
UI_Text="?" UI_Text="?"
end end
@ -86,7 +86,6 @@ namespace Acme.BookStore.Web.Pages.Books
````html ````html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model Acme.BookStore.Web.Pages.Books.CreateModalModel @model Acme.BookStore.Web.Pages.Books.CreateModalModel
@{ @{
@ -230,7 +229,6 @@ namespace Acme.BookStore.Web
````html ````html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@using Acme.BookStore.Web.Pages.Books @using Acme.BookStore.Web.Pages.Books
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model EditModalModel @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). * 我们添加了一个新的 `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> <button type="button" class="btn btn-secondary" #abpClose>
{%{{{ 'AbpAccount::Close' | abpLocalization }}}%} {%{{{ 'AbpAccount::Close' | abpLocalization }}}%}
</button> </button>
<!--added save button--> <!--added save button-->
<button class="btn btn-primary" (click)="save()" [disabled]="form.invalid"> <button class="btn btn-primary" (click)="save()" [disabled]="form.invalid">
<i class="fa fa-check mr-1"></i> <i class="fa fa-check mr-1"></i>
@ -1290,7 +1288,7 @@ import { ConfirmationService } from '@abp/ng.theme.shared';
//... //...
constructor( constructor(
private store: Store, private store: Store,
private fb: FormBuilder, private fb: FormBuilder,
private bookService: BookService, private bookService: BookService,
private confirmation: ConfirmationService // <== added this line ==> private confirmation: ConfirmationService // <== added this line ==>

13
modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPage.cs

@ -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; }
}
}

4
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml

@ -1,8 +1,10 @@
@page @page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@using Volo.Abp.Account.Settings @using Volo.Abp.Account.Settings
@using Volo.Abp.Settings @using Volo.Abp.Settings
@model Volo.Abp.Account.Web.Pages.Account.LoginModel @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 @inject Volo.Abp.Settings.ISettingProvider SettingProvider
@if (Model.EnableLocalLogin) @if (Model.EnableLocalLogin)
{ {

3
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Logout.cshtml

@ -1,3 +1,2 @@
@page "/Account/Logout" @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

6
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml

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

4
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml

@ -1,6 +1,8 @@
@page @page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@model Volo.Abp.Account.Web.Pages.Account.RegisterModel @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 mt-3 shadow-sm rounded">
<div class="card-body p-5"> <div class="card-body p-5">

6
modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml

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

4
modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Create.cshtml

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

6
modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Edit.cshtml

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

4
modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Index.cshtml

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

14
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs

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

4
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Index.cshtml

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

15
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml

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

20
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml

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

18
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml

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

4
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml

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

13
modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPage.cs

@ -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; }
}
}

6
modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml

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

6
modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml

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

4
modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml

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

4
modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml

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

25
samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/ProductManagementPage.cs

@ -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;
}
}
}

4
samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/Products/Create.cshtml

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

6
samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/Products/Edit.cshtml

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

4
samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/Products/Index.cshtml

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

8
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Pages/Index.cshtml

@ -1,6 +1,10 @@
@page @page
@inherits MyCompanyName.MyProjectName.Web.Pages.MyProjectNamePage
@model MyCompanyName.MyProjectName.Web.Pages.IndexModel @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 { @section styles {
<abp-style-bundle> <abp-style-bundle>
<abp-style src="/Pages/Index.css" /> <abp-style src="/Pages/Index.css" />
@ -24,4 +28,4 @@
<hr /> <hr />
<p class="text-right"><a href="https://abp.io?ref=tmpl" target="_blank">abp.io</a></p> <p class="text-right"><a href="https://abp.io?ref=tmpl" target="_blank">abp.io</a></p>
</abp-card-body> </abp-card-body>
</abp-card> </abp-card>

13
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Pages/MyProjectNamePage.cs

@ -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; }
}
}

8
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Pages/Index.cshtml

@ -1,7 +1,11 @@
@page @page
@using MyCompanyName.MyProjectName.Pages @using MyCompanyName.MyProjectName.Pages
@inherits MyProjectNamePage
@model IndexModel @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>
<abp-card-header>Welcome</abp-card-header> <abp-card-header>Welcome</abp-card-header>
<abp-card-body> <abp-card-body>
@ -19,4 +23,4 @@
<hr /> <hr />
<p class="text-right"><a href="https://abp.io?ref=tmpl" target="_blank">abp.io</a></p> <p class="text-right"><a href="https://abp.io?ref=tmpl" target="_blank">abp.io</a></p>
</abp-card-body> </abp-card-body>
</abp-card> </abp-card>

13
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Pages/MyProjectNamePage.cs

@ -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; }
}
}

3
templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml

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

16
templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectNamePage.cs

@ -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