Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added search box view component #4145

Merged
merged 7 commits into from
Jun 3, 2020
Merged

Conversation

AkinSabriCam
Copy link
Contributor

No description provided.

@@ -40,4 +40,8 @@
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Widgets\Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj" />
</ItemGroup>

<ItemGroup>
<_ContentIncludedByDefault Remove="Pages\Shared\Components\AbpPageToolbar\AbpPageSearchBox\Default.cshtml" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is _ContentIncludedByDefault?

}
}

public class SearchBoxViewModel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to its own file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove parameters then this class can be removed.

{
public string PlaceHolder { get; set; }

public async Task<IViewComponentResult> InvokeAsync(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to parameters, just use standard names.

@@ -0,0 +1,11 @@

<form method="post" class="searchForm">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use kebab-case for CSS class names.
Rename to page-search-form (search-form is too general)


<form method="post" class="searchForm">
<div class="input-group">
<input class="form-control filterText" placeholder="Search"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Rename filterText to page-search-filter-text
  • Make placeholder localized

{
public async Task<IViewComponentResult> InvokeAsync()
{
return await Task.FromResult(View("~/Pages/Shared/Components/AbpPageSearchBox/Default.cshtml"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to make async if you simply return the view:

public IViewComponentResult Invoke()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to make invoke method as return type IViewComponentResult but I got error like this
taskReturn

thats why I create this method as async method

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public IViewComponentResult Invoke() should work (exactly like that, not public IViewComponentResult InvokeAsync())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it, you can check it


<form method="post" class="page-search-form">
<div class="input-group">
<input class="form-control page-search-filter-text" placeholder="@Model.PlaceHolder">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've wrtitten that it should be LOCALIZED, not "it should be parametric".

@@ -0,0 +1,7 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageSearchBox
{
public class AbpSearchBoxViewModel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this class! We don't want that parameter. It should be a standard text, but localized in the current language.

@@ -1,30 +1,30 @@
{
"culture": "de",
"texts": {
"InternalServerErrorMessage": "W�hrend Ihrer Anfrage ist ein interner Fehler aufgetreten!",
"ValidationErrorMessage": "Ihre Anfrage ist nicht g�ltig!",
"InternalServerErrorMessage": "W�hrend Ihrer Anfrage ist ein interner Fehler aufgetreten!",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a problem here. I see bad chars.

{
public class AbpPageSearchBoxViewComponent : AbpViewComponent
{
public IViewComponentResult Invoke(string placeHolder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still has placeHolder!

@hikalkan hikalkan merged commit b989986 into dev Jun 3, 2020
@hikalkan hikalkan deleted the akin/added-searchbox-view-component branch September 17, 2020 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants