mirror of https://github.com/abpframework/abp.git
221 changed files with 10316 additions and 6949 deletions
@ -0,0 +1,90 @@ |
|||
# Switch to another DBMS for Entity Framework Core |
|||
|
|||
**[The application startup template](Startup-Templates/Application.md)** comes with SQL Server provider pre-configured for the Entity Framework Core. Entity Framework Core supports [many other DBMSs](https://docs.microsoft.com/en-us/ef/core/providers/) and you can use any of them with your ABP based applications. |
|||
|
|||
ABP framework provides integration packages for some common DBMSs to make the configuration a bit easier (see the [entity framework core document](Entity-Framework-Core.md) for a list of available integration packages). However, you can configure your DBMS provider without these integration packages. |
|||
|
|||
While using the integration package is always recommended (it also makes standard for the depended version across different modules), you can do it manually if there is no integration package for your DBMS provider. |
|||
|
|||
This document explains how to switch to MySQL without using [the MySQL integration package](Entity-Framework-Core-MySQL.md). |
|||
|
|||
## Replace the SQL Server Dependency |
|||
|
|||
* Remove the [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet package dependency from the `.EntityFrameworkCore` project. |
|||
* Add the [Pomelo.EntityFrameworkCore.MySql](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/) NuGet package dependency to your `.EntityFrameworkCore` project. |
|||
|
|||
## Remove the Module Dependency |
|||
|
|||
Remove the `AbpEntityFrameworkCoreSqlServerModule` from the dependency list of your ***YourProjectName*EntityFrameworkCoreModule** class. |
|||
|
|||
## Change the UseSqlServer() Calls |
|||
|
|||
Find the following code part inside the *YourProjectName*EntityFrameworkCoreModule class: |
|||
|
|||
````csharp |
|||
Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
options.UseSqlServer(); |
|||
}); |
|||
```` |
|||
|
|||
Replace it with the following code part: |
|||
|
|||
````csharp |
|||
Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
options.Configure(ctx => |
|||
{ |
|||
if (ctx.ExistingConnection != null) |
|||
{ |
|||
ctx.DbContextOptions.UseMySql(ctx.ExistingConnection); |
|||
} |
|||
else |
|||
{ |
|||
ctx.DbContextOptions.UseMySql(ctx.ConnectionString); |
|||
} |
|||
}); |
|||
}); |
|||
```` |
|||
|
|||
* `UseMySql` calls in this code is defined by the Pomelo.EntityFrameworkCore.MySql package and you can use its additional options if you need. |
|||
* This code first checks if there is an existing (active) connection to the same database in the current request and reuses it if possible. This allows to share a single transaction among different DbContext types. ABP handles the rest of the things. |
|||
* It uses `ctx.ConnectionString` and passes to the `UseMySql` if there is no active connection (which will cause to create a new database connection). Using the `ctx.ConnectionString` is important here. Don't pass a static connection string (or a connection string from a configuration). Because ABP [dynamically determines the correct connection string](Connection-Strings.md) in a multi-database or [multi-tenant](Multi-Tenancy.md) environment. |
|||
|
|||
## Change the Connection Strings |
|||
|
|||
MySQL connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/mysql/ ) for details of MySQL connection string options. |
|||
|
|||
You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. |
|||
|
|||
## Change the Migrations DbContext |
|||
|
|||
MySQL DBMS has some slight differences than the SQL Server. Some module database mapping configuration (especially the field lengths) causes problems with MySQL. For example, some of the the [IdentityServer module](Modules/IdentityServer.md) tables has such problems and it provides an option to configure the fields based on your DBMS. |
|||
|
|||
The startup template contains a *YourProjectName*MigrationsDbContext which is responsible to maintain and migrate the database schema. This DbContext basically calls extension methods of the depended modules to configure their database tables. |
|||
|
|||
Open the *YourProjectName*MigrationsDbContext and change the `builder.ConfigureIdentityServer();` line as shown below: |
|||
|
|||
````csharp |
|||
builder.ConfigureIdentityServer(options => |
|||
{ |
|||
options.DatabaseProvider = EfCoreDatabaseProvider.MySql; |
|||
}); |
|||
```` |
|||
|
|||
Then `ConfigureIdentityServer()` method will set the field lengths to not exceed the MySQL limits. Refer to related module documentation if you have any problem while creating or executing the database migrations. |
|||
|
|||
## Re-Generate the Migrations |
|||
|
|||
The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. |
|||
|
|||
* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. |
|||
* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). |
|||
|
|||
This will create a database migration with all database objects (tables) configured. |
|||
|
|||
Run the `.DbMigrator` project to create the database and seed the initial data. |
|||
|
|||
## Run the Application |
|||
|
|||
It is ready. Just run the application and enjoy coding. |
|||
@ -0,0 +1,58 @@ |
|||
# FluentValidation Integration |
|||
|
|||
ABP [Validation](Validation.md) infrastructure is extensible. [Volo.Abp.FluentValidation](https://www.nuget.org/packages/Volo.Abp.FluentValidation) NuGet package extends the validation system to work with the [FluentValidation](https://fluentvalidation.net/) library. |
|||
|
|||
## Installation |
|||
|
|||
It is suggested to use the [ABP CLI](CLI.md) to install this package. |
|||
|
|||
### Using the ABP CLI |
|||
|
|||
Open a command line window in the folder of the project (.csproj file) and type the following command: |
|||
|
|||
````bash |
|||
abp add-package Volo.Abp.FluentValidation |
|||
```` |
|||
|
|||
### Manual Installation |
|||
|
|||
If you want to manually install; |
|||
|
|||
1. Add the [Volo.Abp.FluentValidation](https://www.nuget.org/packages/Volo.Abp.FluentValidation) NuGet package to your project: |
|||
|
|||
```` |
|||
Install-Package Volo.Abp.FluentValidation |
|||
```` |
|||
|
|||
2. Add the `AbpFluentValidationModule` to the dependency list of your module: |
|||
|
|||
````csharp |
|||
[DependsOn( |
|||
//...other dependencies |
|||
typeof(AbpFluentValidationModule) //Add the FluentValidation module |
|||
)] |
|||
public class YourModule : AbpModule |
|||
{ |
|||
} |
|||
```` |
|||
|
|||
## Using the FluentValidation |
|||
|
|||
Follow [the FluentValidation documentation](https://fluentvalidation.net/) to create validator classes. Example: |
|||
|
|||
````csharp |
|||
public class CreateUpdateBookDtoValidator : AbstractValidator<CreateUpdateBookDto> |
|||
{ |
|||
public CreateUpdateBookDtoValidator() |
|||
{ |
|||
RuleFor(x => x.Name).Length(3, 10); |
|||
RuleFor(x => x.Price).ExclusiveBetween(0.0f, 999.0f); |
|||
} |
|||
} |
|||
```` |
|||
|
|||
ABP will automatically find this class and associate with the `CreateUpdateBookDto` on object validation. |
|||
|
|||
## See Also |
|||
|
|||
* [Validation System](Validation.md) |
|||
@ -0,0 +1,5 @@ |
|||
# Logging |
|||
|
|||
ABP Framework doesn't implement any logging infrastructure. It uses the [ASP.NET Core's logging system](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging). |
|||
|
|||
> .NET Core's logging system is actually independent from the ASP.NET Core. It is usable in any type of application. |
|||
@ -1,4 +1,118 @@ |
|||
# Options |
|||
|
|||
TODO! |
|||
Microsoft has introduced [the options pattern](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) that is used to configure a group of settings used by the framework services. This pattern is implemented by the [Microsoft.Extensions.Options](https://www.nuget.org/packages/Microsoft.Extensions.Options) NuGet package, so it is usable by any type of applications in addition to ASP.NET Core based applications. |
|||
|
|||
ABP framework follows this option pattern and defines options classes to configure the framework and the modules (they are explained in the documents of the related feature). |
|||
|
|||
Since [the Microsoft documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) explains the pattern in detail, no reason to repeat all. However, ABP adds a few more features and they will be explained here. |
|||
|
|||
## Configure Options |
|||
|
|||
You typically configure options in the `ConfigureServices` of the `Startup` class. However, since ABP framework provides a modular infrastructure, you configure options in the `ConfigureServices` of your [module](Module-Development-Basics.md). Example: |
|||
|
|||
````csharp |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.Configure<AbpAuditingOptions>(options => |
|||
{ |
|||
options.IsEnabled = false; |
|||
}); |
|||
} |
|||
```` |
|||
|
|||
* `AbpAuditingOptions` is a simple class defines some properties like `IsEnabled` used here. |
|||
* `AbpModule` base class defines `Configure` method to make the code simpler. So, instead of `context.Services.Configure<...>`, you can directly use the `Configure<...>` shortcut method. |
|||
|
|||
If you are developing a reusable module, you may need to define an options class to allow developers to configure your module. In this case, define a plain options class as shown below: |
|||
|
|||
````csharp |
|||
public class MyOptions |
|||
{ |
|||
public int Value1 { get; set; } |
|||
public bool Value2 { get; set; } |
|||
} |
|||
```` |
|||
|
|||
Then developers can configure your options just like the `AbpAuditingOptions` example above: |
|||
|
|||
````csharp |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<MyOptions>(options => |
|||
{ |
|||
options.Value1 = 42; |
|||
options.Value2 = true; |
|||
}); |
|||
} |
|||
```` |
|||
|
|||
* In this example, used the shortcut `Configure<...>` method. |
|||
|
|||
### Get the Option Value |
|||
|
|||
Whenever you need to get the value of an option, [inject](Dependency-Injection.md) the `IOptions<TOption>` service into your class and use its `.Value` property. Example: |
|||
|
|||
````csharp |
|||
public class MyService : ITransientDependency |
|||
{ |
|||
private readonly MyOptions _options; |
|||
|
|||
public MyService(IOptions<MyOptions> options) |
|||
{ |
|||
_options = options.Value; //Notice the options.Value usage! |
|||
} |
|||
|
|||
public void DoIt() |
|||
{ |
|||
var v1 = _options.Value1; |
|||
var v2 = _options.Value2; |
|||
} |
|||
} |
|||
```` |
|||
|
|||
Read [the Microsoft documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) for all details of the options pattern. |
|||
|
|||
## Pre Configure |
|||
|
|||
One restriction of the options pattern is that you can only resolve (inject) the `IOptions<MyOptions>` and get the option values when the dependency injection configuration completes (that means the `ConfigureServices` methods of all modules complete). |
|||
|
|||
If you are developing a module, you may need to allow developers to set some options and use these options in the dependency injection registration phase. You may need to configure other services or change the dependency injection registration code based on these option values. |
|||
|
|||
For such cases, ABP introduces the `PreConfigure<TOptions>` and the `ExecutePreConfiguredActions<TOptions>` extension methods for the `IServiceCollection`. The pattern works as explained below. |
|||
|
|||
1. Define a plan option class in your module. Example: |
|||
|
|||
````csharp |
|||
public class MyPreOptions |
|||
{ |
|||
public bool MyValue { get; set; } |
|||
} |
|||
```` |
|||
|
|||
Then any [module class](Module-Development-Basics.md) depends on your module can use the `PreConfigure<TOptions>` method in its `PreConfigureServices` method. Example: |
|||
|
|||
````csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<MyPreOptions>(options => |
|||
{ |
|||
options.MyValue = true; |
|||
}); |
|||
} |
|||
```` |
|||
|
|||
> Multiple modules can pre-configure the options and override the option values based on their dependency order. |
|||
|
|||
Finally, your module can execute the `ExecutePreConfiguredActions` method in its `ConfigureServices` method to get the configured option values. Example: |
|||
|
|||
````csharp |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var options = context.Services.ExecutePreConfiguredActions<MyPreOptions>(); |
|||
if (options.MyValue) |
|||
{ |
|||
//... |
|||
} |
|||
} |
|||
```` |
|||
|
|||
|
|||
@ -1,3 +1,158 @@ |
|||
## Validation |
|||
# Validation |
|||
|
|||
TODO |
|||
Validation system is used to validate the user input or client request for a particular controller action or service method. |
|||
|
|||
ABP is compatible with the ASP.NET Core Model Validation system and everything written in [its documentation](https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation) is already valid for ABP based applications. So, this document mostly focuses on the ABP features rather than repeating the Microsoft documentation. |
|||
|
|||
In addition, ABP adds the following benefits: |
|||
|
|||
* Defines `IValidationEnabled` to add automatic validation to an arbitrary class. Since all the [application services](Application-Services.md) inherently implements it, they are also validated automatically. |
|||
* Automatically localize the validation errors for the data annotation attributes. |
|||
* Provides extensible services to validate a method call or an object state. |
|||
* Provides [FluentValidation](https://fluentvalidation.net/) integration. |
|||
|
|||
## Validating DTOs |
|||
|
|||
This section briefly introduces the validation system. For details, see the [ASP.NET Core validation documentation](https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation). |
|||
|
|||
### Data Annotation Attributes |
|||
|
|||
Using data annotations is a simple way to implement the formal validation for a [DTO](Data-Transfer-Objects.md) in a declarative way. Example: |
|||
|
|||
````csharp |
|||
public class CreateBookDto |
|||
{ |
|||
[Required] |
|||
[StringLength(100)] |
|||
public string Name { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(1000)] |
|||
public string Description { get; set; } |
|||
|
|||
[Range(0, 999.99)] |
|||
public decimal Price { get; set; } |
|||
} |
|||
```` |
|||
|
|||
When you use this class as a parameter to an [application service](Application-Services.md) or a controller, it is automatically validated and a localized validation exception is thrown ([and handled](Exception-Handling.md) by the ABP framework). |
|||
|
|||
### IValidatableObject |
|||
|
|||
`IValidatableObject` can be implemented by a DTO to perform custom validation logic. `CreateBookDto` in the following example implements this interface and checks if the `Name` is equals to the `Description` and returns a validation error in this case. |
|||
|
|||
````csharp |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
public class CreateBookDto : IValidatableObject |
|||
{ |
|||
[Required] |
|||
[StringLength(100)] |
|||
public string Name { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(1000)] |
|||
public string Description { get; set; } |
|||
|
|||
[Range(0, 999.99)] |
|||
public decimal Price { get; set; } |
|||
|
|||
public IEnumerable<ValidationResult> Validate( |
|||
ValidationContext validationContext) |
|||
{ |
|||
if (Name == Description) |
|||
{ |
|||
yield return new ValidationResult( |
|||
"Name and Description can not be the same!", |
|||
new[] { "Name", "Description" } |
|||
); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
#### Resolving a Service |
|||
|
|||
If you need to resolve a service from the [dependency injection system](Dependency-Injection.md), you can use the `ValidationContext` object. Example: |
|||
|
|||
````csharp |
|||
var myService = validationContext.GetRequiredService<IMyService>(); |
|||
```` |
|||
|
|||
> While resolving services in the `Validate` method allows any possibility, it is not a good practice to implement your domain validation logic in DTOs. Keep DTOs simple. Their purpose is to transfer data (DTO: Data Transfer Object). |
|||
|
|||
## Validation Infrastructure |
|||
|
|||
This section explains a few additional services provided by the ABP framework. |
|||
|
|||
### IValidationEnabled Interface |
|||
|
|||
`IValidationEnabled` is an empty marker interface that can be implemented by any class (registered to and resolved from the [DI](Dependency-Injection.md)) to let the ABP framework perform the validation system for the methods of the class. Example: |
|||
|
|||
````csharp |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Validation; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
public class MyService : ITransientDependency, IValidationEnabled |
|||
{ |
|||
public virtual async Task DoItAsync(MyInput input) |
|||
{ |
|||
//... |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
> ABP framework uses the [dynamic proxying / interception](Dynamic-Proxying-Interceptors.md) system to perform the validation. In order to make it working, your method should be **virtual** or your service should be injected and used over an **interface** (like `IMyService`). |
|||
|
|||
### AbpValidationException |
|||
|
|||
Once ABP determines a validation error, it throws an exception of type `AbpValidationException`. Your application code can throw `AbpValidationException`, but most of the times it is not needed. |
|||
|
|||
* `ValidationErrors` property of the `AbpValidationException` contains the validation error list. |
|||
* Log level of the `AbpValidationException` is set to `Warning`. It logs all the validation errors to the [logging system](Logging.md). |
|||
* `AbpValidationException` is automatically caught by the ABP framework and converted to a usable error into with HTTP 400 status code. See the [exception handling](Exception-Handling.md) document for more. |
|||
|
|||
## Advanced Topics |
|||
|
|||
### IObjectValidator |
|||
|
|||
In addition to the automatic validation, you may want to manually validate an object. In this case, [inject](Dependency-Injection.md) and use the `IObjectValidator` service: |
|||
|
|||
* `Validate` method validates the given object based on the validation rules and throws an `AbpValidationException` if it is not in a valid state. |
|||
* `GetErrors` doesn't throw an exception, but only returns the validation errors. |
|||
|
|||
`IObjectValidator` is implemented by the `ObjectValidator` by default. `ObjectValidator` is extensible; you can implement `IObjectValidationContributor` interface to contribute a custom logic. Example: |
|||
|
|||
````csharp |
|||
public class MyObjectValidationContributor |
|||
: IObjectValidationContributor, ITransientDependency |
|||
{ |
|||
public void AddErrors(ObjectValidationContext context) |
|||
{ |
|||
//Get the validating object |
|||
var obj = context.ValidatingObject; |
|||
|
|||
//Add the validation errors if available |
|||
context.Errors.Add(...); |
|||
} |
|||
} |
|||
```` |
|||
|
|||
* Remember to register your class to the [DI](Dependency-Injection.md) (implementing `ITransientDependency` does it just like in this example) |
|||
* ABP will automatically discover your class and use on any type of object validation (including automatic method call validation). |
|||
|
|||
### IMethodInvocationValidator |
|||
|
|||
`IMethodInvocationValidator` is used to validate a method call. It internally uses the `IObjectValidator` to validate objects passes to the method call. You normally don't need to this service since it is automatically used by the framework, but you may want to reuse or replace it on your application in rare cases. |
|||
|
|||
## FluentValidation Integration |
|||
|
|||
Volo.Abp.FluentValidation package integrates the FluentValidation library to the validation system (by implementing the `IObjectValidationContributor`). See the [FluentValidation Integration document](FluentValidation.md) for more. |
|||
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Microsoft.EntityFrameworkCore.ChangeTracking; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.ValueComparers |
|||
{ |
|||
public class AbpDictionaryValueComparer<TKey, TValue> : ValueComparer<Dictionary<TKey, TValue>> |
|||
{ |
|||
public AbpDictionaryValueComparer() |
|||
: base( |
|||
(d1, d2) => d1.SequenceEqual(d2), |
|||
d => d.Aggregate(0, (k, v) => HashCode.Combine(k, v.GetHashCode())), |
|||
d => d.ToDictionary(k => k.Key, v => v.Value)) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Newtonsoft.Json; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.ValueConverters |
|||
{ |
|||
public class AbpJsonValueConverter<TPropertyType> : ValueConverter<TPropertyType, string> |
|||
{ |
|||
public AbpJsonValueConverter() |
|||
: base( |
|||
d => JsonConvert.SerializeObject(d, Formatting.None), |
|||
s => JsonConvert.DeserializeObject<TPropertyType>(s)) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,319 +0,0 @@ |
|||
@page |
|||
@inherits Volo.Blogging.Pages.Blog.BloggingPage |
|||
@using Microsoft.AspNetCore.Authorization |
|||
@using Microsoft.AspNetCore.Http.Extensions |
|||
@using Volo.Abp.Users |
|||
@using Volo.Blogging |
|||
@using Volo.Blogging.Pages.Blog.Posts |
|||
@using Volo.Blogging.Areas.Blog.Helpers.TagHelpers |
|||
@inject IAuthorizationService Authorization |
|||
@model DetailModel |
|||
@{ |
|||
ViewBag.PageTitle = "Blog"; |
|||
var hasCommentingPermission = CurrentUser.IsAuthenticated; //TODO: Apply real policy! |
|||
} |
|||
@section scripts { |
|||
<abp-script-bundle name="@typeof(DetailModel).FullName"> |
|||
<abp-script src="/Pages/Blog/Posts/detail.js" /> |
|||
</abp-script-bundle> |
|||
} |
|||
@section styles { |
|||
<abp-style-bundle name="@typeof(DetailModel).FullName"> |
|||
<abp-style src="/Pages/Blog/Shared/Styles/blog.css" /> |
|||
</abp-style-bundle> |
|||
} |
|||
|
|||
<div class="vs-blog vs-blog-detail"> |
|||
<abp-input asp-for="FocusCommentId" class="m-0" /> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-md-8 col-lg-8 mx-auto"> |
|||
<section class="hero-section"> |
|||
<div class="hero-articles"> |
|||
<div class="hero-content"> |
|||
<h1 class="mb-3"> |
|||
<a asp-page="./Detail" asp-route-postUrl="@Model.Post.Url" asp-route-blogShortName="@Model.BlogShortName">@Model.Post.Title</a> |
|||
</h1> |
|||
|
|||
<div class="article-owner"> |
|||
<div class="article-infos"> |
|||
<div class="user-card mt-3 mb-4"> |
|||
<div class="row"> |
|||
<div class="col-auto pr-1"> |
|||
@if (Model.Post.Writer != null) |
|||
{ |
|||
<img gravatar-email="@Model.Post.Writer.Email" default-image="Identicon" class="article-avatar" /> |
|||
} |
|||
</div> |
|||
<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> |
|||
|
|||
} |
|||
|
|||
<i class="fa fa-eye"></i> @L["WiewsWithCount", @Model.Post.ReadCount] |
|||
<span class="vs-seperator">|</span> |
|||
<i class="fa fa-comment"></i> @L["CommentWithCount", @Model.CommentCount] |
|||
|
|||
|
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Posts.Update)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a asp-page="./Edit" asp-route-postId="@Model.Post.Id" asp-route-blogShortName="@Model.BlogShortName"> |
|||
<i class="fa fa-pencil"></i> @L["Edit"] |
|||
</a> |
|||
} |
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Posts.Delete) || (CurrentUser.Id.HasValue && CurrentUser.Id == Model.Post.CreatorId)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" id="DeletePostLink" data-postid="@Model.Post.Id" data-blogShortName="@Model.BlogShortName"> |
|||
<i class="fa fa-trash"></i> @L["Delete"] |
|||
</a> |
|||
} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="img-container mb-3"> |
|||
<img src="@Model.Post.CoverImage" /> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-md-8 col-lg-8 mx-auto"> |
|||
<section class="post-content"> |
|||
<p> |
|||
@Html.Raw(RenderMarkdownToHtml(Model.Post.Content)) |
|||
</p> |
|||
</section> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-md-8 col-lg-8 mx-auto"> |
|||
@if (Model.Post.Tags.Count > 0) |
|||
{ |
|||
<div class="tags"> |
|||
<h5>@L["TagsInThisArticle"]</h5> |
|||
@foreach (var tag in Model.Post.Tags) |
|||
{ |
|||
<a asp-page="/Blog/Posts/Index" asp-route-blogShortName="@Model.BlogShortName" asp-route-tagName="@tag.Name" class="tag">@tag.Name</a> |
|||
} |
|||
</div> |
|||
} |
|||
|
|||
|
|||
@if (Model.CommentsWithReplies.Count > 0) |
|||
{ |
|||
<abp-row v-align="Start"> |
|||
<abp-column size-sm="_12"> |
|||
<p class="float-left"><i class="fa fa-comment"></i> @L["CommentWithCount", @Model.CommentCount]</p> |
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<a abp-button="Primary" class="btn-rounded float-right active" href="#LeaveComment">@L["LeaveComment"]</a> |
|||
} |
|||
else |
|||
{ |
|||
<a abp-button="Primary" class="btn-rounded float-right active" href="/Account/Login?returnUrl=@Request.GetEncodedPathAndQuery()">@L["LeaveComment"]</a> |
|||
} |
|||
</abp-column> |
|||
</abp-row> |
|||
} |
|||
|
|||
<div class="comment-area"> |
|||
@foreach (var commentWithRepliesDto in Model.CommentsWithReplies) |
|||
{ |
|||
<div class="media"> |
|||
<img gravatar-email="@commentWithRepliesDto.Comment.Writer.Email" default-image="Identicon" class="d-flex mr-3 rounded-circle comment-avatar" /> |
|||
<div class="media-body"> |
|||
<h5 class="comment-owner"> |
|||
@(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName) |
|||
<span>@ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime)</span> |
|||
</h5> |
|||
<p id="@commentWithRepliesDto.Comment.Id"> |
|||
@commentWithRepliesDto.Comment.Text |
|||
</p> |
|||
<div class="comment-buttons"> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<a href="#" class="tag replyLink" data-relpyid="@commentWithRepliesDto.Comment.Id"> |
|||
<i class="fa fa-reply" aria-hidden="true"></i> @L["Reply"] |
|||
</a> |
|||
} |
|||
|
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" class="tag deleteLink" data-deleteid="@commentWithRepliesDto.Comment.Id"> |
|||
<i class="fa fa-trash" aria-hidden="true"></i> @L["Delete"] |
|||
</a> |
|||
} |
|||
|
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" class="tag updateLink" data-updateid="@commentWithRepliesDto.Comment.Id"> |
|||
<i class="fa fa-pencil" aria-hidden="true"></i> @L["Edit"] |
|||
</a> |
|||
} |
|||
</div> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<div class="comment-form mt-4 replyForm"> |
|||
<div class="clearfix p-4"> |
|||
<h3 class="mt-0"> |
|||
@L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] |
|||
|
|||
</h3> |
|||
<div> |
|||
<form method="post"> |
|||
<input name="postId" value="@Model.Post.Id" hidden /> |
|||
<input name="repliedCommentId" value="@commentWithRepliesDto.Comment.Id" hidden /> |
|||
|
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Comment"].Value" /> |
|||
<abp-button button-type="Danger" class="btn-rounded float-right replyCancelButton" text="@L["Cancel"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<div class="comment-form mt-4 editForm"> |
|||
<div class="clearfix p-4"> |
|||
<div> |
|||
<form class="editFormClass"> |
|||
<input name="commentId" value="@commentWithRepliesDto.Comment.Id" hidden /> |
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4">@commentWithRepliesDto.Comment.Text</textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> |
|||
<abp-button button-type="Danger" class="btn-rounded float-right editCancelButton" text="@L["Cancel"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
|
|||
@foreach (var reply in commentWithRepliesDto.Replies) |
|||
{ |
|||
<div class="media"> |
|||
<img gravatar-email="@reply.Writer.Email" default-image="Identicon" class="d-flex mr-3 rounded-circle comment-avatar" /> |
|||
<div class="media-body"> |
|||
<h5 class="comment-owner"> |
|||
@(reply.Writer == null ? "" : reply.Writer.UserName) |
|||
<span>@ConvertDatetimeToTimeAgo(reply.CreationTime)</span> |
|||
</h5> |
|||
<p id="@reply.Id"> |
|||
@reply.Text |
|||
</p> |
|||
<div class="comment-buttons"> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<a href="#" class="tag replyLink" data-relpyid="@commentWithRepliesDto.Comment.Id"> |
|||
<i class="fa fa-reply" aria-hidden="true"></i> @L["Reply"] |
|||
</a> |
|||
} |
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" class="tag deleteLink" data-deleteid="@reply.Id"> |
|||
<i class="fa fa-trash" aria-hidden="true"></i> @L["Delete"] |
|||
</a> |
|||
} |
|||
|
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" class="tag updateLink" data-updateid="@reply.Id"> |
|||
<i class="fa fa-pencil" aria-hidden="true"></i> @L["Edit"] |
|||
</a> |
|||
} |
|||
</div> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<div class="comment-form mt-4 replyForm"> |
|||
<div class="clearfix bg-light p-4"> |
|||
<h3 class="mt-0"> |
|||
@L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] |
|||
</h3> |
|||
<div> |
|||
<form method="post"> |
|||
<input name="postId" value="@Model.Post.Id" hidden /> |
|||
<input name="repliedCommentId" value="@commentWithRepliesDto.Comment.Id" hidden /> |
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> |
|||
<abp-button button-type="Danger" class="btn-rounded float-right replyCancelButton" text="@L["Cancel"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<div class="comment-form mt-4 editForm"> |
|||
<div class="clearfix bg-light p-4"> |
|||
<div> |
|||
<form class="editFormClass"> |
|||
<input name="commentId" value="@reply.Id" hidden /> |
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4">@reply.Text</textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> |
|||
<abp-button button-type="Danger" class="btn-rounded float-right editCancelButton" text="@L["Cancel"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
</div> |
|||
</div> |
|||
} |
|||
</div> |
|||
</div> |
|||
} |
|||
</div> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<div class="comment-form mt-4" id="LeaveComment"> |
|||
<div class="vs-blog-title mb-0"> |
|||
<h3>@L["LeaveComment"]</h3> |
|||
</div> |
|||
<div class="clearfix bg-light p-4"> |
|||
<div> |
|||
<form method="post"> |
|||
<input name="postId" value="@Model.Post.Id" hidden /> |
|||
<input name="repliedCommentId" id="repliedCommentId" hidden /> |
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
else |
|||
{ |
|||
<a abp-button="Primary" class="btn-rounded float-right active mt-3" href="/Account/Login?returnUrl=@Request.GetEncodedPathAndQuery()">@L["LeaveComment"]</a> |
|||
} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,319 @@ |
|||
@page |
|||
@inherits Volo.Blogging.Pages.Blog.BloggingPage |
|||
@using Microsoft.AspNetCore.Authorization |
|||
@using Microsoft.AspNetCore.Http.Extensions |
|||
@using Volo.Abp.Users |
|||
@using Volo.Blogging |
|||
@using Volo.Blogging.Pages.Blog.Posts |
|||
@using Volo.Blogging.Areas.Blog.Helpers.TagHelpers |
|||
@inject IAuthorizationService Authorization |
|||
@model DetailModel |
|||
@{ |
|||
ViewBag.PageTitle = Model.Post.Title; |
|||
var hasCommentingPermission = CurrentUser.IsAuthenticated; //TODO: Apply real policy! |
|||
} |
|||
@section scripts { |
|||
<abp-script-bundle name="@typeof(DetailModel).FullName"> |
|||
<abp-script src="/Pages/Blogs/Posts/detail.js" /> |
|||
</abp-script-bundle> |
|||
} |
|||
@section styles { |
|||
<abp-style-bundle name="@typeof(DetailModel).FullName"> |
|||
<abp-style src="/Pages/Blogs/Shared/Styles/blog.css" /> |
|||
</abp-style-bundle> |
|||
} |
|||
|
|||
<div class="vs-blog vs-blog-detail"> |
|||
<abp-input asp-for="FocusCommentId" class="m-0" /> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-md-8 col-lg-8 mx-auto"> |
|||
<section class="hero-section"> |
|||
<div class="hero-articles"> |
|||
<div class="hero-content"> |
|||
<h1 class="mb-3"> |
|||
<a asp-page="./Detail" asp-route-postUrl="@Model.Post.Url" asp-route-blogShortName="@Model.BlogShortName">@Model.Post.Title</a> |
|||
</h1> |
|||
|
|||
<div class="article-owner"> |
|||
<div class="article-infos"> |
|||
<div class="user-card mt-3 mb-4"> |
|||
<div class="row"> |
|||
<div class="col-auto pr-1"> |
|||
@if (Model.Post.Writer != null) |
|||
{ |
|||
<img gravatar-email="@Model.Post.Writer.Email" default-image="Identicon" class="article-avatar" /> |
|||
} |
|||
</div> |
|||
<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> |
|||
|
|||
} |
|||
|
|||
<i class="fa fa-eye"></i> @L["WiewsWithCount", @Model.Post.ReadCount] |
|||
<span class="vs-seperator">|</span> |
|||
<i class="fa fa-comment"></i> @L["CommentWithCount", @Model.CommentCount] |
|||
|
|||
|
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Posts.Update)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a asp-page="./Edit" asp-route-postId="@Model.Post.Id" asp-route-blogShortName="@Model.BlogShortName"> |
|||
<i class="fa fa-pencil"></i> @L["Edit"] |
|||
</a> |
|||
} |
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Posts.Delete) || (CurrentUser.Id.HasValue && CurrentUser.Id == Model.Post.CreatorId)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" id="DeletePostLink" data-postid="@Model.Post.Id" data-blogShortName="@Model.BlogShortName"> |
|||
<i class="fa fa-trash"></i> @L["Delete"] |
|||
</a> |
|||
} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="img-container mb-3"> |
|||
<img src="@Model.Post.CoverImage" /> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-md-8 col-lg-8 mx-auto"> |
|||
<section class="post-content"> |
|||
<p> |
|||
@Html.Raw(RenderMarkdownToHtml(Model.Post.Content)) |
|||
</p> |
|||
</section> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-md-8 col-lg-8 mx-auto"> |
|||
@if (Model.Post.Tags.Count > 0) |
|||
{ |
|||
<div class="tags"> |
|||
<h5>@L["TagsInThisArticle"]</h5> |
|||
@foreach (var tag in Model.Post.Tags) |
|||
{ |
|||
<a asp-page="/Blog/Posts/Index" asp-route-blogShortName="@Model.BlogShortName" asp-route-tagName="@tag.Name" class="tag">@tag.Name</a> |
|||
} |
|||
</div> |
|||
} |
|||
|
|||
|
|||
@if (Model.CommentsWithReplies.Count > 0) |
|||
{ |
|||
<abp-row v-align="Start"> |
|||
<abp-column size-sm="_12"> |
|||
<p class="float-left"><i class="fa fa-comment"></i> @L["CommentWithCount", @Model.CommentCount]</p> |
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<a abp-button="Primary" class="btn-rounded float-right active" href="#LeaveComment">@L["LeaveComment"]</a> |
|||
} |
|||
else |
|||
{ |
|||
<a abp-button="Primary" class="btn-rounded float-right active" href="/Account/Login?returnUrl=@Request.GetEncodedPathAndQuery()">@L["LeaveComment"]</a> |
|||
} |
|||
</abp-column> |
|||
</abp-row> |
|||
|
|||
<div class="comment-area"> |
|||
@foreach (var commentWithRepliesDto in Model.CommentsWithReplies) |
|||
{ |
|||
<div class="media"> |
|||
<img gravatar-email="@commentWithRepliesDto.Comment.Writer.Email" default-image="Identicon" class="d-flex mr-3 rounded-circle comment-avatar" /> |
|||
<div class="media-body"> |
|||
<h5 class="comment-owner"> |
|||
@(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName) |
|||
<span>@ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime)</span> |
|||
</h5> |
|||
<p id="@commentWithRepliesDto.Comment.Id"> |
|||
@commentWithRepliesDto.Comment.Text |
|||
</p> |
|||
<div class="comment-buttons"> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<a href="#" class="tag replyLink" data-relpyid="@commentWithRepliesDto.Comment.Id"> |
|||
<i class="fa fa-reply" aria-hidden="true"></i> @L["Reply"] |
|||
</a> |
|||
} |
|||
|
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" class="tag deleteLink" data-deleteid="@commentWithRepliesDto.Comment.Id"> |
|||
<i class="fa fa-trash" aria-hidden="true"></i> @L["Delete"] |
|||
</a> |
|||
} |
|||
|
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" class="tag updateLink" data-updateid="@commentWithRepliesDto.Comment.Id"> |
|||
<i class="fa fa-pencil" aria-hidden="true"></i> @L["Edit"] |
|||
</a> |
|||
} |
|||
</div> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<div class="comment-form mt-4 replyForm"> |
|||
<div class="clearfix p-4"> |
|||
<h3 class="mt-0"> |
|||
@L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] |
|||
|
|||
</h3> |
|||
<div> |
|||
<form method="post"> |
|||
<input name="postId" value="@Model.Post.Id" hidden /> |
|||
<input name="repliedCommentId" value="@commentWithRepliesDto.Comment.Id" hidden /> |
|||
|
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Comment"].Value" /> |
|||
<abp-button button-type="Danger" class="btn-rounded float-right replyCancelButton" text="@L["Cancel"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<div class="comment-form mt-4 editForm"> |
|||
<div class="clearfix p-4"> |
|||
<div> |
|||
<form class="editFormClass"> |
|||
<input name="commentId" value="@commentWithRepliesDto.Comment.Id" hidden /> |
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4">@commentWithRepliesDto.Comment.Text</textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> |
|||
<abp-button button-type="Danger" class="btn-rounded float-right editCancelButton" text="@L["Cancel"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
|
|||
@foreach (var reply in commentWithRepliesDto.Replies) |
|||
{ |
|||
<div class="media"> |
|||
<img gravatar-email="@reply.Writer.Email" default-image="Identicon" class="d-flex mr-3 rounded-circle comment-avatar" /> |
|||
<div class="media-body"> |
|||
<h5 class="comment-owner"> |
|||
@(reply.Writer == null ? "" : reply.Writer.UserName) |
|||
<span>@ConvertDatetimeToTimeAgo(reply.CreationTime)</span> |
|||
</h5> |
|||
<p id="@reply.Id"> |
|||
@reply.Text |
|||
</p> |
|||
<div class="comment-buttons"> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<a href="#" class="tag replyLink" data-relpyid="@commentWithRepliesDto.Comment.Id"> |
|||
<i class="fa fa-reply" aria-hidden="true"></i> @L["Reply"] |
|||
</a> |
|||
} |
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" class="tag deleteLink" data-deleteid="@reply.Id"> |
|||
<i class="fa fa-trash" aria-hidden="true"></i> @L["Delete"] |
|||
</a> |
|||
} |
|||
|
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<span class="seperator">|</span> |
|||
<a href="#" class="tag updateLink" data-updateid="@reply.Id"> |
|||
<i class="fa fa-pencil" aria-hidden="true"></i> @L["Edit"] |
|||
</a> |
|||
} |
|||
</div> |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<div class="comment-form mt-4 replyForm"> |
|||
<div class="clearfix bg-light p-4"> |
|||
<h3 class="mt-0"> |
|||
@L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] |
|||
</h3> |
|||
<div> |
|||
<form method="post"> |
|||
<input name="postId" value="@Model.Post.Id" hidden /> |
|||
<input name="repliedCommentId" value="@commentWithRepliesDto.Comment.Id" hidden /> |
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> |
|||
<abp-button button-type="Danger" class="btn-rounded float-right replyCancelButton" text="@L["Cancel"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) |
|||
{ |
|||
<div class="comment-form mt-4 editForm"> |
|||
<div class="clearfix bg-light p-4"> |
|||
<div> |
|||
<form class="editFormClass"> |
|||
<input name="commentId" value="@reply.Id" hidden /> |
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4">@reply.Text</textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> |
|||
<abp-button button-type="Danger" class="btn-rounded float-right editCancelButton" text="@L["Cancel"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
</div> |
|||
</div> |
|||
} |
|||
</div> |
|||
</div> |
|||
} |
|||
</div> |
|||
} |
|||
|
|||
@if (hasCommentingPermission) |
|||
{ |
|||
<div class="comment-form mt-4" id="LeaveComment"> |
|||
<div class="vs-blog-title mb-0"> |
|||
<h3>@L["LeaveComment"]</h3> |
|||
</div> |
|||
<div class="clearfix bg-light p-4"> |
|||
<div> |
|||
<form method="post"> |
|||
<input name="postId" value="@Model.Post.Id" hidden /> |
|||
<input name="repliedCommentId" id="repliedCommentId" hidden /> |
|||
<div class="form-group"> |
|||
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea> |
|||
</div> |
|||
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
} |
|||
else |
|||
{ |
|||
<a abp-button="Primary" class="btn-rounded float-right active mt-3" href="/Account/Login?returnUrl=@Request.GetEncodedPathAndQuery()">@L["LeaveComment"]</a> |
|||
} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue