mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 17:22:15 +00:00
View Group page
This commit is contained in:
parent
0ae47a126b
commit
47a8fdc9c7
4 changed files with 55 additions and 0 deletions
|
@ -109,6 +109,12 @@ public static IHtmlString TopicLinkFor(this HtmlHelper hpr, string topicId)
|
|||
return hpr.ActionLink(topic.Subject, "ViewTopic", "Forum", new { id = topic.Discriminator }, null);
|
||||
}
|
||||
|
||||
public static string GetUserGroup(string uid)
|
||||
{
|
||||
var db = new ApplicationDbContext();
|
||||
return db.Users.FirstOrDefault(x => x.Id == uid).GroupId;
|
||||
}
|
||||
|
||||
public static string ResolveUserLinksInMarkdown(string mkdn)
|
||||
{
|
||||
string[] words = mkdn.Split(' ');
|
||||
|
|
|
@ -15,5 +15,16 @@ public ActionResult Index()
|
|||
var db = new ApplicationDbContext();
|
||||
return View(db.Groups);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public ActionResult ViewGroup(string id)
|
||||
{
|
||||
var db = new ApplicationDbContext();
|
||||
var group = db.Groups.FirstOrDefault(x => x.Id == id);
|
||||
if (group == null)
|
||||
return new HttpStatusCodeResult(404);
|
||||
|
||||
return View(group);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -590,6 +590,7 @@
|
|||
<Content Include="Views\Stats\Pong.cshtml" />
|
||||
<Content Include="Views\Stats\Codepoints.cshtml" />
|
||||
<Content Include="Views\Groups\Index.cshtml" />
|
||||
<Content Include="Views\Groups\ViewGroup.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
37
Project-Unite/Views/Groups/ViewGroup.cshtml
Normal file
37
Project-Unite/Views/Groups/ViewGroup.cshtml
Normal file
|
@ -0,0 +1,37 @@
|
|||
@model Project_Unite.Models.Group
|
||||
@{
|
||||
ViewBag.Title = Model.Name + " - Groups ";
|
||||
}
|
||||
@using Microsoft.AspNet.Identity;
|
||||
|
||||
<div class="row group_banner" style="background-color: #@Model.BannerColorHex;">
|
||||
<h2><strong>[@Model.ShortName] @Model.Name</strong></h2>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="panel col-xs-8">
|
||||
@Html.Markdown(Model.Description)
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
@if (ACL.GetUserGroup(User.Identity.GetUserId()) == Model.Id)
|
||||
{
|
||||
@Html.ActionLink("Leave", "LeaveGroup", "Groups", null, new { @class = "btn btn-default" })
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (Model.Publicity == 0 || Model.Publicity == 2)
|
||||
{
|
||||
@Html.ActionLink("Join", "JoinGroup", "Groups", new { id = Model.Id }, new { @class = "btn btn-default" })
|
||||
}
|
||||
}
|
||||
<hr/>
|
||||
@if(Model.Publicity > 1)
|
||||
{
|
||||
<h4>This group is private.</h4>
|
||||
|
||||
<p>Please respect that. Do not share this group link with anyone not authorized by the group administrators.</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in a new issue