Skip to content

Commit

Permalink
[#22 and #36]
Browse files Browse the repository at this point in the history
users can change name and email

fix some bug related to tournaments
  • Loading branch information
IceSentry committed Feb 24, 2016
1 parent 52e970a commit fa6e397
Show file tree
Hide file tree
Showing 24 changed files with 372 additions and 184 deletions.
4 changes: 4 additions & 0 deletions LanAdept/LanAdept.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
<Compile Include="Views\Place\ModelController\MaPlaceModel.cs" />
<Compile Include="Views\Place\ModelController\PlaceController.cs" />
<Compile Include="Views\Team\ModelController\IndexTeamModel.cs" />
<Compile Include="Views\Team\ModelController\ModalModel.cs" />
<Compile Include="Views\Team\ModelController\TeamController.cs" />
<Compile Include="Views\Team\ModelController\DetailsModel.cs" />
<Compile Include="Views\Team\ModelController\TeamDemandeModel.cs" />
Expand Down Expand Up @@ -357,6 +358,9 @@
<Content Include="Views\Emails\Confirmation.Text.cshtml" />
<Content Include="Views\Emails\Confirmation.Html.cshtml" />
<Content Include="Views\User\Index.cshtml" />
<Content Include="Views\User\Edit.cshtml" />
<Content Include="Views\User\Details.cshtml" />
<Content Include="Views\Team\Partial\ConfirmationModal.cshtml" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
Expand Down
44 changes: 28 additions & 16 deletions LanAdept/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
@using LanAdeptCore.HtmlExtension;

@{
bool isTeamLeader = LanAdeptCore.Service.UserService.IsTeamLeader();
int nbDemandes = 0;
int nbTeams = 0;
if (isTeamLeader)
{
nbDemandes = LanAdeptCore.Service.UserService.GetNbTeamDemand();
nbTeams = LanAdeptCore.Service.UserService.GetNbTeams();
}
}

<!DOCTYPE html>
<html moznomarginboxes="" mozdisallowselectionprint="">
<head>
Expand Down Expand Up @@ -61,26 +72,34 @@
@if (LanAdeptCore.Service.UserService.IsUserLoggedIn())
{
<li class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
<span class="glyphicon glyphicon-user"></span>
@if (LanAdeptCore.Service.UserService.IsTeamLeader() && LanAdeptCore.Service.UserService.GetNbTeamDemand() > 0)
<a class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-menu-hamburger"></span>
@if (isTeamLeader && nbDemandes > 0)
{
<span class="label label-danger">@LanAdeptCore.Service.UserService.GetNbTeamDemand()</span>
<span class="label label-danger">@nbDemandes</span>
}
</button>
</a>
<ul class="dropdown-menu">
@Html.ListItemAction("Mon profil", "Index", "User")
@if (LanAdeptCore.Service.UserService.IsTeamLeader())

@if (LanAdeptCore.Service.ReservationService.HasUserPlace())
{
int nbDemandes = @LanAdeptCore.Service.UserService.GetNbTeamDemand();
@Html.ListItemAction("Ma place", "MaPlace", "Place")
}

@Html.ListItemAction("Déconnexion", "Logout", "Auth")

@if (isTeamLeader)
{
<li role="separator" class="divider"></li>
<li class="dropdown-header">Tournois</li>
<li>
<a href="@Url.Action("Index", "Team")" class="hidden-sm">
@if (LanAdeptCore.Service.UserService.GetNbTeams() > 1)
@if (nbTeams > 1)
{
<span>Mes équipes</span>
}
else if (LanAdeptCore.Service.UserService.GetNbTeams() == 1)
else if (nbTeams == 1)
{
<span>Mon équipe</span>
}
Expand All @@ -90,14 +109,7 @@
}
</a>
</li>
@*@Html.ListItemAction("Mes équipes", "Index", "Team", null, new { @class = "hidden-sm" })*@
}

@if (LanAdeptCore.Service.ReservationService.HasUserPlace())
{
@Html.ListItemAction("Ma place", "MaPlace", "Place")
}
@Html.ListItemAction("Déconnexion", "Logout", "Auth")
</ul>
</li>
}
Expand Down
119 changes: 51 additions & 68 deletions LanAdept/Views/Team/Details.cshtml
Original file line number Diff line number Diff line change
@@ -1,72 +1,49 @@
@using LanAdeptData.Model.Tournaments
@model LanAdept.Views.Teams.ModelController.DetailsModel
@using LanAdept.Views.Teams.ModelController
@using LanAdeptCore.Service
@model DetailsModel

@{
bool isConnected = LanAdeptCore.Service.UserService.IsUserLoggedIn();
bool IsTeamLeader = LanAdeptCore.Service.UserService.IsTeamLeader();
bool isConnected = UserService.IsUserLoggedIn();
bool IsTeamLeader = UserService.IsTeamLeader();
ViewBag.Title = "Équipe " + Model.Name;
}

<div class="modal fade" id="kickModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Retirer un joueur</h4>
</div>
<div class="modal-body">
<p>Voulez-vous vraiment retirer le joueur "<span id="modal-gamertag"></span>"?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
<a href="#" class="btn btn-danger" id="modal-link">Exclure</a>
</div>
</div>
</div>
</div>

<div class="modal fade" id="promoteModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Promouvoir un joueur</h4>
</div>
<div class="modal-body">
<p>Voulez-vous vraiment promouvoir le joueur "<span id="modal-gamertag"></span>"?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
<a href="#" class="btn btn-success" id="modal-link">Promouvoir</a>
</div>
</div>
</div>
</div>

<div class="modal fade" id="deleteModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Supprimer l'équipe</h4>
</div>
<div class="modal-body">
<p>Voulez-vous vraiment supprimer votre équipe "@Model.Name"?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
@Html.ActionLink("Supprimer", "Delete", new { id = Model.TeamID }, new { @class = "btn btn-danger" })
</div>
</div>
</div>
</div>

@Html.Partial("ConfirmationModal",
new ModalModel()
{
Id = "promoteModal",
Title = "Promouvoir un joueur",
Body = "Voulez-vous vraiment promouvoir au rôle de team leader le joueur \" <span id=\"modal-gamertag\"></span> \"?",
BtnStyle = "success",
BtnText = "Promouvoir"
})
@Html.Partial("ConfirmationModal",
new ModalModel()
{
Id = "kickModal",
Title = "Exclure un joueur",
Body = "Voulez-vous vraiment exclure le joueur \" <span id=\"modal-gamertag\"></span> \"?",
BtnStyle = "danger",
BtnText = "Exclure"
})

@Html.Partial("ConfirmationModal",
new ModalModel()
{
Id = "deleteModal",
Title = "Supprimer l'équipe",
Body = "Voulez-vous vraiment supprimer votre équipe \" <span id=\"modal-teamName\"></span> \"?",
BtnStyle = "danger",
BtnText = "Supprimer"
})

<div class="page-header clearfix">
<h1>
@(String.IsNullOrWhiteSpace(Model.Tag) ? "" : "[" + Model.Tag + "]")
@Model.Name

<span class="text-muted">
@(String.IsNullOrWhiteSpace(Model.Tag) ? "" : "[" + Model.Tag + "]")
</span>
@Html.DisplayFor(model => model.Name)
<span class="pull-right">
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#deleteModal">
Supprimer l'équipe
Expand Down Expand Up @@ -107,10 +84,10 @@
<td class="text-right">
@if (gamerTag != Model.TeamLeaderTag && !Model.Tournament.IsOver && !Model.Tournament.IsStarted)
{
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#promoteModal" data-gamertag="@gamerTag.Gamertag" data-gamertag-id="@gamerTag.GamerTagID">
Promote
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#promoteModal" data-gamertag="@gamerTag.Gamertag" data-gamertag-id="@gamerTag.GamerTagID" title="Promouvoir au rôle de team leader">
<span class="glyphicon glyphicon-star"></span> Promouvoir
</button>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#kickModal" data-gamertag="@gamerTag.Gamertag" data-gamertag-id="@gamerTag.GamerTagID">
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#kickModal" data-gamertag="@gamerTag.Gamertag" data-gamertag-id="@gamerTag.GamerTagID" title="Exclure le joueur de l'équipe">
Exclure
</button>
}
Expand All @@ -127,7 +104,7 @@
</h3>

@if (Model.Demandes.Count() >= 1)
{
{
<div class="table-responsive table-hover">
<table class="table table-striped">
<thead>
Expand Down Expand Up @@ -155,14 +132,14 @@
}
</table>
</div>
}
else
{
}
else
{
<br />
<em class="small">
Il n'y a aucune demande pour rejoindre votre équipe pour le moment
</em>
}
}
</div>
</div>

Expand All @@ -187,5 +164,11 @@
modal.find('#modal-gamertag').text(gamertag);
modal.find('#modal-link').attr("href", "@Url.Action("PromotePlayer", "Team", new { Id = Model.TeamID })" + "/?gamerTagId=" + gamertagId)
});
$('#deleteModal').on('show.bs.modal', function (event) {
var modal = $(this);
modal.find('#modal-teamName').text("@Model.Name");
modal.find('#modal-link').attr("href", "@Url.Action("Delete", new { Id = Model.TeamID })")
});
</script>
}
3 changes: 2 additions & 1 deletion LanAdept/Views/Team/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
{
<tr @("class=clickable-row data-row-url=" + Url.Action("Details", "Team", new { id = team.Team.TeamID }))>
<td>
<span class="text-muted">[@Html.DisplayFor(model => team.Team.Tag)]</span>
@Html.DisplayFor(modelItem => team.Team.Name)
</td>
<td class="text-center">
@team.Team.GamerTags.Count / @team.Team.Tournament.MaxPlayerPerTeam
@team.Team.GamerTags.Count / @Html.DisplayFor(model => team.Team.Tournament.MaxPlayerPerTeam)
</td>
<td class="text-center">
@if (team.Demandes == null)
Expand Down
16 changes: 16 additions & 0 deletions LanAdept/Views/Team/ModelController/ModalModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LanAdept.Views.Teams.ModelController
{
public class ModalModel
{
public string Id { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public string BtnStyle { get; set; }
public string BtnText { get; set; }
}
}
18 changes: 18 additions & 0 deletions LanAdept/Views/Team/Partial/ConfirmationModal.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@model LanAdept.Views.Teams.ModelController.ModalModel
<div class="modal fade" id="@Model.Id" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">@Model.Title</h4>
</div>
<div class="modal-body">
<p>@Html.Raw(Model.Body)</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
<a href="#" class="btn [email protected]" id="modal-link">@Model.BtnText</a>
</div>
</div>
</div>
</div>
Loading

0 comments on commit fa6e397

Please sign in to comment.