-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEventPreview.razor
More file actions
87 lines (77 loc) · 3.08 KB
/
Copy pathEventPreview.razor
File metadata and controls
87 lines (77 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<article class="post-preview event-preview">
<header>
<div class="title">
<h3>
<a href="@($"/events/{Event.Id}")">
@Event.Title
</a>
</h3>
@if (Event.Id != 0 && !HideAdminControls)
{
<AuthorizeView Policy="Write" Resource="@Event">
<div class="icon-buttons">
<a title="Esemény szerkesztése" href="/events/@Event.Id/edit">
<md-icon>
edit
</md-icon>
</a>
<a title="Új alesemény"
href="/events/0/edit?categories=@(string.Join(',', Event.Categories.Select(c => c.Id)))&parent=@Event.Id">
<md-icon>
calendar_add_on
</md-icon>
</a>
<a title="Új poszt"
href="/posts/0/edit?categories=@(string.Join(',', Event.Categories.Select(c => c.Id)))&event=@Event.Id">
<md-icon>
chat_add_on
</md-icon>
</a>
</div>
</AuthorizeView>
}
</div>
<ul class="label-list">
<li>
<CategoryList Categories="@Event.Categories"/>
<div class="label">
<md-icon>event</md-icon>
<DateDisplay DateUtc="@Event.Start" EndUtc="@Event.End" NowUtc="@_utcNow" />
</div>
</li>
@if (Event.Parent != null && !ParentKnown)
{
<li>
<div class="label">
<md-icon>event</md-icon>
<a href="/events/@Event.Parent.Id" class="clip-text" style="max-width: 320px">
@if (Event.Parent.Start.HasValue
&& (Event.Parent.End ?? Event.Parent.Start.Value.AddHours(4)) > _utcNow)
{
<text>
<DateDisplay DateUtc="@Event.Parent.Start" NowUtc="@_utcNow" />:
</text>
}
@Event.Parent.Title
</a>
</div>
</li>
}
</ul>
</header>
<div class="body">
@((MarkupString)_content.HtmlExcerpt)
</div>
</article>
@code {
[Parameter, EditorRequired] public required Event Event { get; set; }
private TextContent _content = null!;
private readonly DateTime _utcNow = DateTime.UtcNow;
[Parameter] public bool HideAdminControls { get; set; }
[Parameter] public bool ParentKnown { get; set; }
[Parameter] public int? KnownPageId { get; set; }
protected override void OnParametersSet()
{
_content = new(Event.DescriptionMarkdown ?? "", null);
}
}