Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DCTewi committed Jun 23, 2021
2 parents 7553200 + fcbf57b commit 3c96bc5
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 43 deletions.
4 changes: 2 additions & 2 deletions VirtualGroupEx.Server/Localization/I18n.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"zh-CN": {
"nav.bulletin": "公告栏",
"nav.search": "搜索框",
"nav.search": "搜索",
"nav.routine": "打卡处",
"nav.mission": "工作表",
"nav.discussion": "讨论版",
Expand Down Expand Up @@ -194,7 +194,7 @@
},
"ja-JP": {
"nav.bulletin": "掲示板",
"nav.search": "検索ボックス",
"nav.search": "検索",
"nav.routine": "ルーティン",
"nav.mission": "仕事テーブル",
"nav.discussion": "検討エリア",
Expand Down
13 changes: 13 additions & 0 deletions VirtualGroupEx.Server/Pages/Dashboard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
@inject CurrentUserService CurrentUser
@inject NavigationManager NavigationManager

@inject JSInvokeService Js
@code
{
protected async override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await Js.HideModalsAsync();
}
await base.OnAfterRenderAsync(firstRender);
}
}

@code
{
protected override void OnInitialized()
Expand Down
12 changes: 12 additions & 0 deletions VirtualGroupEx.Server/Pages/Discussions.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

@inject DiscussionService DiscussService
@inject NavigationManager NavigationManager
@inject JSInvokeService Js
@code
{
protected async override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await Js.HideModalsAsync();
}
await base.OnAfterRenderAsync(firstRender);
}
}

@code
{
Expand Down
13 changes: 13 additions & 0 deletions VirtualGroupEx.Server/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
@page "/"

@inject JSInvokeService Js
@code
{
protected async override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await Js.HideModalsAsync();
}
await base.OnAfterRenderAsync(firstRender);
}
}

<BulletinList></BulletinList>
13 changes: 13 additions & 0 deletions VirtualGroupEx.Server/Pages/Missions.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
@inject MissionService MissionService
@inject NavigationManager NavigationManager

@inject JSInvokeService Js
@code
{
protected async override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await Js.HideModalsAsync();
}
await base.OnAfterRenderAsync(firstRender);
}
}

@code
{
[Parameter] public int? Id { get; set; }
Expand Down
13 changes: 13 additions & 0 deletions VirtualGroupEx.Server/Pages/Routines.razor
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
@page "/routine"

@inject JSInvokeService Js
@code
{
protected async override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await Js.HideModalsAsync();
}
await base.OnAfterRenderAsync(firstRender);
}
}

<RoutineList></RoutineList>
49 changes: 31 additions & 18 deletions VirtualGroupEx.Server/Pages/Search.razor
Original file line number Diff line number Diff line change
@@ -1,53 +1,66 @@
@page "/search"
@page "/search/{keyword}"

@inject SearchService SearchService
@inject NavigationManager NavigationManager
@inject DiscussionService DiscussService
@inject UserInfoService UserInfo
@inject JSInvokeService Js
@inject JSInvokeService Js

@code
{
private string keyword;
[Parameter] public string Keyword { get; set; }

private List<SearchResult> searchResults = null;

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!string.IsNullOrEmpty(Keyword))
{
await SearchAsync();
}
await base.OnAfterRenderAsync(firstRender);
}

private async Task SearchAsync()
{
if (!string.IsNullOrEmpty(keyword))
if (!string.IsNullOrEmpty(Keyword))
{
keyword = keyword?.Trim();
searchResults = SearchService.Search(keyword);
Keyword = Keyword?.Trim();
searchResults = SearchService.Search(Keyword);
StateHasChanged();
}
await Js.ResetButtonAsync();
}

private async Task ReloadPage()
{
keyword = string.Empty;
Keyword = string.Empty;
searchResults = null;
await Js.ResetButtonAsync();
}
}

<h2>@localizer["nav.search"]</h2>
<h2>@localizer["nav.search"]@(string.IsNullOrEmpty(Keyword) ? "" : $": {Keyword}")</h2>

<hr />

<form class="col-lg-8" method="dialog">
@if (string.IsNullOrEmpty(Keyword))
{
<hr />
<form class="col-lg-8" method="dialog">

<p class="form-group">
<label>@localizer["search.string"]</label>
<input class="form-control" @bind="keyword" />
</p>
<p class="form-group">
<label>@localizer["search.string"]</label>
<input class="form-control" @bind="Keyword" />
</p>

<button type="button" class="btn btn-outline-primary" @onclick="SearchAsync"
id="searchBtn" onmouseup="setButtonBuzy('searchBtn')">
@localizer["operation.search"]
</button>
<button type="button" class="btn btn-outline-primary" @onclick="@(() => NavigationManager.NavigateTo($"/search/{Keyword}"))"
id="searchBtn" onmouseup="setButtonBuzy('searchBtn')">
@localizer["operation.search"]
</button>

</form>
</form>
}

@if (searchResults != null)
{
Expand Down
29 changes: 29 additions & 0 deletions VirtualGroupEx.Server/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
@inherits LayoutComponentBase
@inject NavigationManager NavigationManager
@inject CurrentUserService CurrentUser

@code
{
private string keyword;
}

<div class="page">
<div class="sidebar">
<NavMenu />
</div>

<div class="main">
<div class="top-row auth px-4">
<form class="form-inline" method="dialog">
<p class="input-group mb-0">
<input class="form-control" placeholder="@localizer["search.string"]" @bind="keyword" />
<div class="input-group-append">
<button type="button" class="btn btn-outline-primary" @onclick="@(() => NavigationManager.NavigateTo($"/search/{keyword}", forceLoad: true))"
id="searchBtn" onmouseup="setButtonBuzy('searchBtn')">
@localizer["operation.search"]
</button>
</div>
</p>
</form>

<a href="/me">
<span class="oi oi-person mr-1"></span>
@CurrentUser.User.NickName.Substring(0, Math.Min(CurrentUser.User.NickName.Length, 9))
@if (CurrentUser.User.NickName.Length > 9)
{
<span>...</span>
}
</a>
</div>
<div class="content px-4">
@Body
</div>
Expand Down
23 changes: 0 additions & 23 deletions VirtualGroupEx.Server/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
<span class="oi oi-home" aria-hidden="true"></span> @localizer["nav.bulletin"]
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="/search">
<span class="oi oi-magnifying-glass" aria-hidden="true"></span> @localizer["nav.search"]
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="/routine">
<span class="oi oi-tags" aria-hidden="true"></span> @localizer["nav.routine"]
Expand Down Expand Up @@ -90,25 +85,7 @@
</NavLink>
</li>
}
@*@if (CurrentUser.User.IsAdministrator)
{
<li class="nav-item px-3">
<NavLink class="nav-link" href="/apikey">
<span class="oi oi-terminal" aria-hidden="true"></span> @localizer["nav.api"]
</NavLink>
</li>
}*@
}
<li class="nav-item px-3">
<NavLink class="nav-link" href="/me">
<span class="oi oi-person" aria-hidden="true"></span>
@CurrentUser.User.NickName.Substring(0, Math.Min(CurrentUser.User.NickName.Length, 9))
@if (CurrentUser.User.NickName.Length > 9)
{
<span>...</span>
}
</NavLink>
</li>
}
else
{
Expand Down

0 comments on commit 3c96bc5

Please sign in to comment.