Skip to content

Commit 1a3b940

Browse files
authored
Добавить колонтитул и номер страницы для печати вводной (#3310)
1 parent 3053882 commit 1a3b940

File tree

5 files changed

+54
-41
lines changed

5 files changed

+54
-41
lines changed

src/JoinRpg.Portal/Views/Print/Character.cshtml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@model JoinRpg.Web.Models.Print.PrintCharacterViewModel
1+
@model JoinRpg.Web.Models.Print.PrintCharacterViewModel
22

33
@{
44
Layout = null;
@@ -11,10 +11,12 @@
1111
<title>@Model.ProjectName: @Model.CharacterName</title>
1212
<link href="~/css/print.css" rel="stylesheet" />
1313
<link href="https://fonts.googleapis.com/css?family=Roboto:400,400i,700,700i&amp;subset=cyrillic" rel="stylesheet" />
14+
<style>
15+
@Html.Raw("@page { @top-center { content: 'Вводная " + Model.CharacterName + " (" + Model.ProjectName + ") , стр. ' counter(page) } } ")
16+
</style>
1417
</head>
1518
<body>
1619
<div>
17-
@await Html.PartialAsync("CharacterListHeader", Model)
1820
@await Html.PartialAsync("PrintCharacter", Model)
1921
</div>
2022
</body>

src/JoinRpg.Portal/Views/Print/CharacterList.cshtml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@model JoinRpg.Web.Models.Print.PrintCharacterViewModel[]
1+
@model JoinRpg.Web.Models.Print.PrintCharacterViewModel[]
22

33
@{
4-
Layout = null;
4+
Layout = null;
55
}
66

77
<!DOCTYPE html>
@@ -11,11 +11,13 @@
1111
<title>@Model.First().ProjectName</title>
1212
<link href="~/css/print.css" rel="stylesheet" />
1313
<link href="https://fonts.googleapis.com/css?family=Roboto:400,400i,700,700i&amp;subset=cyrillic" rel="stylesheet" />
14+
<style>
15+
@Html.Raw("@page { @top-center { content: 'Загрузы игры " + Model.First().ProjectName + "'} } ")
16+
</style>
1417
</head>
1518
<body>
1619
@foreach (var item in Model)
1720
{
18-
@await Html.PartialAsync("CharacterListHeader", item)
1921
@await Html.PartialAsync("PrintCharacter", item)
2022
}
2123

src/JoinRpg.Portal/Views/Print/CharacterListHeader.cshtml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@
5252
}
5353

5454
</table>
55-
<div class="print-character-footer">
56-
создано при помощи joinrpg.ru
57-
</div>
58-
5955
</div>
6056

6157
@if (Model.RegistrationOnHold)
Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
11
@model JoinRpg.Web.Models.Print.PrintCharacterViewModel
2-
<div class="print-character-main">
3-
<h1>@Model.CharacterName</h1>
4-
<p class="print-character-gamename">@Model.ProjectName</p>
52

6-
@if (Model.Fields.AnythingAccessible)
7-
{
8-
<div class="print-character-fields">
9-
<h2>Поля персонажа</h2>
10-
<dl>
11-
@foreach (var field in Model.Fields.Fields.Where(f => f.HasValue && f.CanView))
12-
{
13-
<dt>@field.FieldName</dt>
14-
<dd>@field.DisplayString</dd>
15-
}
16-
</dl>
17-
</div>
18-
}
3+
<div class="print-character-all">
4+
@await Html.PartialAsync("CharacterListHeader", Model)
195

20-
@if (Model.Plots.Elements.Any())
21-
{
22-
<div class="print-character-plots">
23-
<h2>Загрузы (@Model.Plots.Elements.Count()) </h2>
6+
<div class="print-character-main">
7+
<h1>@Model.CharacterName</h1>
8+
<p class="print-character-gamename">@Model.ProjectName</p>
249

10+
@if (Model.Fields.AnythingAccessible)
11+
{
12+
<div class="print-character-fields">
13+
<h2>Поля персонажа</h2>
14+
<dl>
15+
@foreach (var field in Model.Fields.Fields.Where(f => f.HasValue && f.CanView))
16+
{
17+
<dt>@field.FieldName</dt>
18+
<dd>@field.DisplayString</dd>
19+
}
20+
</dl>
21+
</div>
22+
}
2523

26-
@foreach (var plot in Model.Plots.Elements)
27-
{
28-
<div class="print-character-plot-element">
29-
@Html.Raw(plot.Content.Value)
30-
</div>
31-
}
32-
</div>
33-
<div class="print-character-footer">
34-
создано при помощи joinrpg.ru
35-
</div>
36-
}
24+
@if (Model.Plots.Elements.Any())
25+
{
26+
<div class="print-character-plots">
27+
<h2>Загрузы (@Model.Plots.Elements.Count()) </h2>
28+
29+
30+
@foreach (var plot in Model.Plots.Elements)
31+
{
32+
<div class="print-character-plot-element">
33+
@Html.Raw(plot.Content.Value)
34+
</div>
35+
}
36+
</div>
37+
<div class="print-character-footer">
38+
создано при помощи joinrpg.ru
39+
</div>
40+
}
41+
</div>
3742
</div>

src/JoinRpg.Portal/wwwroot/css/print.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1, h2, h3, h4, h5, h6, p, div, dt, dd {
1+
h1, h2, h3, h4, h5, h6, p, div, dt, dd {
22
font-family: 'Roboto', sans-serif;
33
}
44

@@ -80,6 +80,14 @@ div.print-character-list-box table {
8080
margin: 1cm;
8181
}
8282

83+
@page {
84+
@bottom-right {
85+
font-size: 50%;
86+
font-style: italic;
87+
content: 'Распечатано из joinrpg.ru'
88+
}
89+
}
90+
8391
.print-character-footer {
8492
font-size: 50%;
8593
width: 100%;

0 commit comments

Comments
 (0)