refactoring
This commit is contained in:
parent
9a93cdd962
commit
497e769c6d
@ -99,7 +99,7 @@ namespace GanjooRazor.Pages
|
||||
}
|
||||
SummedUpViewModel summary = JsonConvert.DeserializeObject<SummedUpViewModel>(await response.Content.ReadAsStringAsync());
|
||||
|
||||
return Partial("_GroupedByDateViewPartial", new _GroupedByDateViewPartialModel()
|
||||
return Partial("~/Pages/Partials/Contribs/_GroupedByDateViewPartial.cshtml", new _GroupedByDateViewPartialModel()
|
||||
{
|
||||
DataType = dataType,
|
||||
Days = days.ToArray(),
|
||||
@ -120,7 +120,7 @@ namespace GanjooRazor.Pages
|
||||
var users = JArray.Parse(await responseUsers.Content.ReadAsStringAsync()).ToObject<List<GroupedByUserViewModel>>();
|
||||
var usersPagination = JsonConvert.DeserializeObject<PaginationMetadata>(responseUsers.Headers.GetValues("paging-headers").Single());
|
||||
|
||||
return Partial("_GroupedByDateViewTablePartial", new _GroupedByDateViewTablePartialModel()
|
||||
return Partial("~/Pages/Partials/Contribs/_GroupedByDateViewTablePartial.cshtml", new _GroupedByDateViewTablePartialModel()
|
||||
{
|
||||
DataType = dataType,
|
||||
Users = users.ToArray(),
|
||||
@ -137,7 +137,7 @@ namespace GanjooRazor.Pages
|
||||
}
|
||||
var days = JArray.Parse(await responseDays.Content.ReadAsStringAsync()).ToObject<List<GroupedByDateViewModel>>();
|
||||
|
||||
return Partial("_GroupedByDateViewTablePartial", new _GroupedByDateViewTablePartialModel()
|
||||
return Partial("~/Pages/Partials/Contribs/_GroupedByDateViewTablePartial.cshtml", new _GroupedByDateViewTablePartialModel()
|
||||
{
|
||||
DataType = dataType,
|
||||
Days = days.ToArray(),
|
||||
|
||||
@ -417,7 +417,7 @@ else if (Model.ReadOnlyMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
<partial name="_InlinePageUtilsPartial" model="Model" />
|
||||
<partial name="~/Pages/Partials/GanjoorPage/_InlinePageUtilsPartial.cshtml" model="Model" />
|
||||
@if (Model.GanjoorPage.Id == 39401)
|
||||
{
|
||||
<div class="poempretab" id="pretab"></div>
|
||||
@ -440,7 +440,7 @@ else if (Model.ReadOnlyMode)
|
||||
@if (Model.CategoryWordsCounts != null)
|
||||
{
|
||||
<text>
|
||||
<partial name="_CategoryWordsCountPartial" model="Model.CategoryWordsCounts">
|
||||
<partial name="~/Pages/Partials/GanjoorPage/_CategoryWordsCountPartial.cshtml" model="Model.CategoryWordsCounts">
|
||||
</text>
|
||||
}
|
||||
</div>
|
||||
@ -476,7 +476,7 @@ else if (Model.ReadOnlyMode)
|
||||
@if (Model.CategoryWordsCounts != null)
|
||||
{
|
||||
<text>
|
||||
<partial name="_CategoryWordsCountPartial" model="Model.CategoryWordsCounts">
|
||||
<partial name="~/Pages/Partials/GanjoorPage/_CategoryWordsCountPartial.cshtml" model="Model.CategoryWordsCounts">
|
||||
</text>
|
||||
}
|
||||
</div>
|
||||
@ -1098,7 +1098,7 @@ else if (Model.ReadOnlyMode)
|
||||
</div>
|
||||
|
||||
<div class="poemtabcontent">
|
||||
<partial name="_AudioPlayerPartial" model=@Model.GetRecitationsModel(Model.GanjoorPage.Poem.Recitations, false, RMuseum.Models.GanjoorAudio.RecitationType.Normal, Model.CanEdit) />
|
||||
<partial name="~/Pages/Partials/GanjoorPage/_AudioPlayerPartial.cshtml" model=@Model.GetRecitationsModel(Model.GanjoorPage.Poem.Recitations, false, RMuseum.Models.GanjoorAudio.RecitationType.Normal, Model.CanEdit) />
|
||||
|
||||
<a onclick="switchPlayerScrollLock()" role="button" class="pagebutton comments-link">
|
||||
فعال یا غیرفعالسازی قفل متن روی خوانش
|
||||
@ -1140,7 +1140,7 @@ else if (Model.ReadOnlyMode)
|
||||
</div>
|
||||
|
||||
<div class="poemtabcontent">
|
||||
<partial name="_AudioPlayerPartial" model=@Model.GetRecitationsModel(Model.GanjoorPage.Poem.Recitations, false, RMuseum.Models.GanjoorAudio.RecitationType.Commentary, Model.CanEdit) />
|
||||
<partial name="~/Pages/Partials/GanjoorPage/_AudioPlayerPartial.cshtml" model=@Model.GetRecitationsModel(Model.GanjoorPage.Poem.Recitations, false, RMuseum.Models.GanjoorAudio.RecitationType.Commentary, Model.CanEdit) />
|
||||
<a onclick="switchPlayerScrollLock()" role="button" class="pagebutton comments-link">
|
||||
فعال یا غیرفعالسازی قفل متن روی خوانش
|
||||
<svg class="noindent-info-button" height="24px" viewBox="0 0 24 24" width="24px" fill="#5f6368"><path d="M0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none" /><path d="M8.9 6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2h-4.66l2 2H18v5.56l2 2V10c0-1.1-.9-2-2-2h-1V6c0-2.76-2.24-5-5-5-2.32 0-4.26 1.59-4.82 3.74L8.9 6.46V6zM4.41 4.81L3 6.22l2.04 2.04C4.42 8.6 4 9.25 4 10v10c0 1.1.9 2 2 2h12.78l1 1 1.41-1.41L4.41 4.81zM6 20V10h.78l10 10H6z" /></svg>
|
||||
@ -1176,7 +1176,7 @@ else if (Model.ReadOnlyMode)
|
||||
<div class="poemtabcontent">
|
||||
@for (int i = 0; i < Math.Min(5, Model.GanjoorPage.Poem.Top6QuotedPoems.Length); i++)
|
||||
{
|
||||
<partial name="_QuotedPoemPartial" model=@Model.GetQuotedPoemModel(Model.GanjoorPage.Poem.Top6QuotedPoems[i], Model.GanjoorPage, Model.CanEdit) />
|
||||
<partial name="~/Pages/Partials/GanjoorPage/_QuotedPoemPartial.cshtml" model=@Model.GetQuotedPoemModel(Model.GanjoorPage.Poem.Top6QuotedPoems[i], Model.GanjoorPage, Model.CanEdit) />
|
||||
}
|
||||
|
||||
@if (Model.GanjoorPage.Poem.Top6QuotedPoems.Length == 6)
|
||||
@ -1436,7 +1436,7 @@ else if (Model.ReadOnlyMode)
|
||||
<div id="comments-block">
|
||||
@foreach (var comment in Model.GanjoorPage.Poem.Comments)
|
||||
{
|
||||
<partial name="_CommentPartial" model=@Model.GetCommentModel(comment, Model.GanjoorPage.Id) />
|
||||
<partial name="~/Pages/Partials/GanjoorPage/_CommentPartial.cshtml" model=@Model.GetCommentModel(comment, Model.GanjoorPage.Id) />
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ namespace GanjooRazor.Pages
|
||||
/// </summary>
|
||||
public Task<IActionResult> OnPostComment(string comment, int poemId, int inReplytoId, int coupletIndex)
|
||||
{
|
||||
var unauthorized = Partial("_CommentPartial", new _CommentPartialModel()
|
||||
var unauthorized = Partial("~/Pages/Partials/GanjoorPage/_CommentPartial.cshtml", new _CommentPartialModel()
|
||||
{
|
||||
Comment = null,
|
||||
Error = NotLoggedInMessage,
|
||||
@ -164,7 +164,7 @@ namespace GanjooRazor.Pages
|
||||
var resComment = JsonConvert.DeserializeObject<GanjoorCommentSummaryViewModel>(await response.Content.ReadAsStringAsync());
|
||||
resComment.MyComment = true;
|
||||
|
||||
return Partial("_CommentPartial", new _CommentPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_CommentPartial.cshtml", new _CommentPartialModel()
|
||||
{
|
||||
Comment = resComment,
|
||||
Error = "",
|
||||
@ -174,7 +174,7 @@ namespace GanjooRazor.Pages
|
||||
});
|
||||
}
|
||||
|
||||
return Partial("_CommentPartial", new _CommentPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_CommentPartial.cshtml", new _CommentPartialModel()
|
||||
{
|
||||
Comment = null,
|
||||
Error = await ReadErrorMessageAsync(response),
|
||||
@ -891,7 +891,7 @@ namespace GanjooRazor.Pages
|
||||
}
|
||||
}
|
||||
|
||||
return Partial("_BNumPartial", new _BNumPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_BNumPartial.cshtml", new _BNumPartialModel()
|
||||
{
|
||||
PoemId = poemId,
|
||||
CoupletIndex = coupletIndex,
|
||||
@ -1072,7 +1072,7 @@ namespace GanjooRazor.Pages
|
||||
quoteds.Remove(mainList);
|
||||
}
|
||||
|
||||
return Partial("_MultipleQuotedPoemsPartial", new _MultipleQuotedPoemsPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml", new _MultipleQuotedPoemsPartialModel()
|
||||
{
|
||||
GanjoorQuotedPoems = quoteds.ToArray(),
|
||||
PoetImageUrl = poetImageUrl,
|
||||
@ -1090,7 +1090,7 @@ namespace GanjooRazor.Pages
|
||||
|
||||
var quoteds = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorQuotedPoemViewModel>>();
|
||||
|
||||
return Partial("_MultipleQuotedPoemsPartial", new _MultipleQuotedPoemsPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml", new _MultipleQuotedPoemsPartialModel()
|
||||
{
|
||||
GanjoorQuotedPoems = quoteds.ToArray(),
|
||||
PoetImageUrl = poetImageUrl,
|
||||
@ -1139,7 +1139,7 @@ namespace GanjooRazor.Pages
|
||||
}
|
||||
var categoryTop1Recitations = JsonConvert.DeserializeObject<PublicRecitationViewModel[]>(await catTop1RecitationsQuery.Content.ReadAsStringAsync());
|
||||
|
||||
return Partial("_AudioPlayerPartial", new _AudioPlayerPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_AudioPlayerPartial.cshtml", new _AudioPlayerPartialModel()
|
||||
{
|
||||
LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]),
|
||||
Recitations = categoryTop1Recitations,
|
||||
@ -1193,7 +1193,7 @@ namespace GanjooRazor.Pages
|
||||
return BadRequest("خطا در دسترسی به شمارش واژگان");
|
||||
}
|
||||
|
||||
return Partial("_CategoryWordsCountPartial", res);
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_CategoryWordsCountPartial.cshtml", res);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetSearchCategoryWordCountsAsync(int catId, int poetId, string term, int totalWordCount)
|
||||
@ -1209,7 +1209,7 @@ namespace GanjooRazor.Pages
|
||||
}
|
||||
var wordCounts = JsonConvert.DeserializeObject<CategoryWordCount[]>(await wordCountsResponse.Content.ReadAsStringAsync());
|
||||
|
||||
return Partial("_CategoryWordsCountTablePartial", new _CategoryWordsCountTablePartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_CategoryWordsCountTablePartial.cshtml", new _CategoryWordsCountTablePartialModel()
|
||||
{
|
||||
CatId = catId,
|
||||
PoetId = poetId,
|
||||
@ -1260,7 +1260,7 @@ namespace GanjooRazor.Pages
|
||||
RowNmbrInCat = 0,
|
||||
});
|
||||
|
||||
return Partial("_CategoryWordsCountTablePartial", new _CategoryWordsCountTablePartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_CategoryWordsCountTablePartial.cshtml", new _CategoryWordsCountTablePartialModel()
|
||||
{
|
||||
CatId = -1,
|
||||
PoetId = -1,
|
||||
@ -1277,14 +1277,14 @@ namespace GanjooRazor.Pages
|
||||
|
||||
if (!topVisitsResponse.IsSuccessStatusCode)
|
||||
{
|
||||
return Partial("_TopVisitsPartial", new _TopVisitsPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_TopVisitsPartial.cshtml", new _TopVisitsPartialModel()
|
||||
{
|
||||
Visits = null
|
||||
});
|
||||
}
|
||||
var topVisits = JsonConvert.DeserializeObject<PageVisitsViewModel[]>(await topVisitsResponse.Content.ReadAsStringAsync());
|
||||
|
||||
return Partial("_TopVisitsPartial", new _TopVisitsPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_TopVisitsPartial.cshtml", new _TopVisitsPartialModel()
|
||||
{
|
||||
Visits = topVisits
|
||||
});
|
||||
@ -1298,14 +1298,14 @@ namespace GanjooRazor.Pages
|
||||
|
||||
if (!s7ndaysVisitsResponse.IsSuccessStatusCode)
|
||||
{
|
||||
return Partial("_7DaysVisitsPartial", new _7DaysVisitsPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_7DaysVisitsPartial.cshtml", new _7DaysVisitsPartialModel()
|
||||
{
|
||||
SevenDaysVisits = null
|
||||
});
|
||||
}
|
||||
var s7ndaysVisits = JsonConvert.DeserializeObject<DateRangeVisitsViewModel[]>(await s7ndaysVisitsResponse.Content.ReadAsStringAsync());
|
||||
|
||||
return Partial("_7DaysVisitsPartial", new _7DaysVisitsPartialModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_7DaysVisitsPartial.cshtml", new _7DaysVisitsPartialModel()
|
||||
{
|
||||
SevenDaysVisits = s7ndaysVisits
|
||||
});
|
||||
@ -1321,7 +1321,7 @@ namespace GanjooRazor.Pages
|
||||
return BadRequest(await ReadErrorMessageAsync(response));
|
||||
var relatedSections = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorCachedRelatedSection>>();
|
||||
|
||||
return Partial("_SimiPartialView", new _SimiPartialViewModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_SimiPartialView.cshtml", new _SimiPartialViewModel()
|
||||
{
|
||||
RelatedSections = relatedSections.ToArray(),
|
||||
Rhythm = prosodyMetre,
|
||||
@ -1351,7 +1351,7 @@ namespace GanjooRazor.Pages
|
||||
poem.HtmlText = GanjoorPoemTools.GetPoemHtmlExcerpt(poem.HtmlText);
|
||||
}
|
||||
|
||||
return Partial("_SimiPartialFromPoetView", new _SimiPartialFromPoetViewModel()
|
||||
return Partial("~/Pages/Partials/GanjoorPage/_SimiPartialFromPoetView.cshtml", new _SimiPartialFromPoetViewModel()
|
||||
{
|
||||
Poems = poems,
|
||||
});
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
<div id="comments-block-@Model.CoupletIndex" class="clear-both">
|
||||
@foreach (var comment in Model.Comments)
|
||||
{
|
||||
<partial name="_CommentPartial" model=Model.GetCommentModel(comment) />
|
||||
<partial name="_CommentPartial.cshtml" model=Model.GetCommentModel(comment) />
|
||||
}
|
||||
</div>
|
||||
@if (Model.LoggedIn)
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<input type="text" id="wordcountterm" placeholder="جستجوی واژه" value="" onkeyup="onSearchWordCounts(@Model.CatId, @Model.PoetId, @Model.TotalWordCount)">
|
||||
</div>
|
||||
<div id="wordcounts-table">
|
||||
<partial name="_CategoryWordsCountTablePartial" model="Model.TableModel">
|
||||
<partial name="_CategoryWordsCountTablePartial.cshtml" model="Model.TableModel">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@ -54,7 +54,7 @@ else
|
||||
<div class='spacer'> </div>
|
||||
@foreach (var reply in Model.Comment.Replies)
|
||||
{
|
||||
<partial name="_CommentPartial" model=Model.GetCommentModel(reply) />
|
||||
<partial name="_CommentPartial.cshtml" model=Model.GetCommentModel(reply) />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@ -6,5 +6,5 @@
|
||||
|
||||
@foreach (var q in Model.GanjoorQuotedPoems)
|
||||
{
|
||||
<partial name="_QuotedPoemPartial" model=@Model.GetQuotedPoemModel(q, Model.PoetImageUrl, Model.PoetNickName) />
|
||||
<partial name="_QuotedPoemPartial.cshtml" model=@Model.GetQuotedPoemModel(q, Model.PoetImageUrl, Model.PoetNickName) />
|
||||
}
|
||||
@ -3,14 +3,14 @@
|
||||
@if (!Model.Blur || Model.WordStats.Length == 0)
|
||||
{
|
||||
<text>
|
||||
<partial name="_CategoryWordsCountByCatTablePartial" model="Model.Model">
|
||||
<partial name="_CategoryWordsCountByCatTablePartial.cshtml" model="Model.Model">
|
||||
</text>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="expandable-container-wrapper">
|
||||
<div class="expandable-content" id="expandableContent">
|
||||
<partial name="_CategoryWordsCountByCatTablePartial" model="Model.Model">
|
||||
<partial name="_CategoryWordsCountByCatTablePartial.cshtml" model="Model.Model">
|
||||
</div>
|
||||
<div class="expandable-blur-overlay" id="expandableBlur"></div>
|
||||
</div>
|
||||
|
||||
@ -414,7 +414,7 @@ namespace GanjooRazor.Pages
|
||||
var wordCounts = JsonConvert.DeserializeObject<PoetOrCatWordStat[]>(await wordCountsResponse.Content.ReadAsStringAsync());
|
||||
string countStr = wordCountsResponse.Headers.GetValues("items-count").FirstOrDefault();
|
||||
|
||||
return Partial("_CategoryWordsCountByCatPartial", new _CategoryWordsCountByCatPartialModel()
|
||||
return Partial("~/Pages/Partials/Search/_CategoryWordsCountByCatPartial.cshtml", new _CategoryWordsCountByCatPartialModel()
|
||||
{
|
||||
Term = term,
|
||||
WordStats = wordCounts,
|
||||
|
||||
@ -33,6 +33,32 @@ namespace GanjooRazor
|
||||
services.AddRazorPages(options =>
|
||||
{
|
||||
options.Conventions.AddPageRoute("/GanjoorPage", "{*url}");
|
||||
|
||||
// Pages/ reorganization: these pages moved into subfolders (Auth/, SongRecommendation/,
|
||||
// ImageRecommendation/, Recitations/, CommentReports/, Misc/) for readability, but each
|
||||
// one used a bare `@page` (no explicit route), so without these overrides their public
|
||||
// URL would change from the flat form (e.g. "/Login") to the new nested form
|
||||
// (e.g. "/Auth/Login"). None of these pages are referenced via asp-page/RedirectToPage
|
||||
// anywhere in the app (checked), only via plain hrefs and JS-embedded URLs, so
|
||||
// preserving the URL here is sufficient - no other code needed to change.
|
||||
options.Conventions.AddPageRoute("/Auth/Login", "/Login");
|
||||
options.Conventions.AddPageRoute("/Auth/SignUp", "/SignUp");
|
||||
options.Conventions.AddPageRoute("/Auth/ResetPassword", "/ResetPassword");
|
||||
|
||||
options.Conventions.AddPageRoute("/SongRecommendation/Bp", "/Bp");
|
||||
options.Conventions.AddPageRoute("/SongRecommendation/Golha", "/Golha");
|
||||
options.Conventions.AddPageRoute("/SongRecommendation/Spotify", "/Spotify");
|
||||
|
||||
options.Conventions.AddPageRoute("/ImageRecommendation/Pin", "/Pin");
|
||||
|
||||
options.Conventions.AddPageRoute("/Recitations/AudioClip", "/AudioClip");
|
||||
options.Conventions.AddPageRoute("/Recitations/RecitationsOrder", "/RecitationsOrder");
|
||||
options.Conventions.AddPageRoute("/Recitations/ReportRecitation", "/ReportRecitation");
|
||||
|
||||
options.Conventions.AddPageRoute("/CommentReports/ReportComment", "/ReportComment");
|
||||
|
||||
options.Conventions.AddPageRoute("/Misc/Photos", "/Photos");
|
||||
options.Conventions.AddPageRoute("/Misc/t6e", "/t6e");
|
||||
});
|
||||
|
||||
services.AddCors(options =>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user