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

Announcement view #298

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Modules/StatCan.OrchardCore.Hackathon/HackathonMigrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public async Task<int> CreateAsync()
CreateUserProfiles();
CreateWidgets();
CreateChallenge();
CreateAnnouncement();

await _recipeMigrator.ExecuteAsync("queries.recipe.json", this);
await _recipeMigrator.ExecuteAsync("roles.recipe.json", this);
Expand Down Expand Up @@ -89,6 +90,7 @@ private void CreateWidgets()
{
_contentDefinitionManager.CreateBasicWidget("HackathonCalendar");
_contentDefinitionManager.CreateBasicWidget("ChallengeListWidget");
_contentDefinitionManager.CreateBasicWidget("AnnouncementListWidget");
}

private void CreateChallenge()
Expand All @@ -104,5 +106,31 @@ private void CreateChallenge()
.WithMarkdownBody("2")
);
}

private void CreateAnnouncement()
{
_contentDefinitionManager.AlterTypeDefinition("Announcement", type => type
.DisplayedAs("Announcement")
.Creatable()
.Listable()
.Draftable()
.Securable()
.WithPart("Announcement", part => part
.WithPosition("0")
)
.WithPart("MarkdownBodyPart", part => part
.WithPosition("1")
.WithEditor("Wysiwyg")
)
);

_contentDefinitionManager.AlterPartDefinition("Announcement", part => part
.WithField("Title", field => field
.OfType("TextField")
.WithDisplayName("Title")
.WithPosition("0")
)
);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% assign dateTime = "DateTime" | shape_new: utc: Model.ContentItem.CreatedUtc, format: format | shape_stringify %}
<v-container >
<v-row justify="center">
<v-col cols="12" xl="8">
<v-card >
<v-card-title class="text-h4">{{Model.ContentItem.Content.Announcement.Title.Text}}</v-card-title>
<v-card-subtitle class="pt-0 font-italic">by {{ Model.ContentItem.Author }} {{dateTime}}</v-card-subtitle>
<v-divider class="mx-3"></v-divider>
<v-card-text>
{{ Model.Content.MarkdownBodyPart | shape_render }}
</v-card-text>
</v-card>
</v-col>
</v-cpntainer>


Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% assign announcements = Queries.GetItemsForHackathon | query: type: "Announcement" | sort: "ModifiedUtc" | reverse %}

<div class="text-h3 font-weight-black pb-3 ">Team Announcements</div>
<v-container>
<v-col cols="10">
<v-expansion-panels multiple >
{% for announcement in announcements %}
{% assign dateTime = "DateTime" | shape_new: utc: announcement.ModifiedUtc, format: format | shape_stringify %}
{% assign aShape = announcement.ContentItem | shape_build_display %}
{% if announcement.Published == true %}
<v-expansion-panel>
<v-expansion-panel-header class="justify-start">
<div>
<div class="pb-2" >
<span class="d-flex align-center text-caption ">
<v-icon small class="px-1 grey--text darken-4--text">mdi-clock</v-icon>
{{dateTime}}
<v-icon small class="px-1 grey--text darken-4--text">mdi-account</v-icon>
{{ Model.ContentItem.Author }}
</span>
</div>
<div class="text-h5">
{{ announcement.ContentItem.Content.Announcement.Title.Text | shortcode }}
</div>
</div>
</v-expansion-panel-header>
<v-expansion-panel-content><v-list-text>{{ aShape.Content.MarkdownBodyPart | shape_render }}</v-list-text></v-expansion-panel-content>
</v-expansion-panel>
{% endif %}
{% endfor %}
</v-expansion-panels>
</v-col>
</v-container>