Skip to content

Commit

Permalink
Merge pull request #119 from ezraroi/117-add-column-in-admin-view-wit…
Browse files Browse the repository at this point in the history
…h-user-role

added
  • Loading branch information
ezraroi authored Sep 15, 2024
2 parents 81467b5 + 7ddae98 commit a989f43
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Mundialito/Client/src/Users/ManageApp.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
<table class="table table-striped">
<thead>
<th>Name</th>
<th>Role</th>
<th>Email</th>
<th>Actions</th>
</thead>
<tbody>
<tr ng-repeat="user in users">
<td><a href="{{user.getUrl()}}">{{::user.Name}}</a><span style="margin-left: 5px;" class="label label-as-badge" ng-class="{'label-success': user.Roles === 'Admin', 'label-default': user.Roles === 'Active', 'label-danger':user.Roles === 'Disabled'}">{{::user.Roles}}</span> </td>
<td><a href="{{user.getUrl()}}">{{::user.Name}}</a></td>
<td><span style="margin-left: 5px;" class="label label-as-badge" ng-class="{'label-success': user.Roles === 'Admin', 'label-default': user.Roles === 'Active', 'label-danger':user.Roles === 'Disabled'}">{{::user.Roles}}</span></td>
<td>{{user.Email}}</td>
<td>
<button title="delete" type="button" class="btn btn-danger btn-sm" ng-click="deleteUser(user)" tooltip="Delete User"><i class="fa fa-times-circle"></i> <span class="hidden-xs">Delete</span></button>
Expand Down
2 changes: 1 addition & 1 deletion Mundialito/Client/src/Users/UserProfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h4>
<i class="fa fa-user" ng-if="profileUser.ProfilePicture == null"></i><img referrerpolicy="no-referrer"
ng-if="profileUser.ProfilePicture != null" src="{{profileUser.ProfilePicture}}" class="img-circle">
{{profileUser.Name}} Profile
{{profileUser.Name}} <span style="margin-left: 5px;" class="label label-as-badge" ng-class="{'label-success': profileUser.Roles === 'Admin', 'label-default': profileUser.Roles === 'Active', 'label-danger':profileUser.Roles === 'Disabled'}">{{::profileUser.Roles}}</span>
</h4>
</div>
<div class="col-md-2" ng-if="profileUser.Username !== security.user.Username">
Expand Down
6 changes: 2 additions & 4 deletions Mundialito/Models/UserModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public UserModel(MundialitoUser user)
Email = user.Email;

Check warning on line 14 in Mundialito/Models/UserModel.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.
Points = 0;
ProfilePicture = user.ProfilePicture == null ? "../../../icons/user.webp" :user.ProfilePicture;
Roles = user.Role.ToString();
}

[JsonPropertyName("Id")]
Expand All @@ -27,10 +28,7 @@ public UserModel(MundialitoUser user)

[JsonPropertyName("Email")]
public string Email { get; set; }

[JsonPropertyName("IsAdmin")]
public bool IsAdmin { get; set; }


[JsonPropertyName("Username")]
public string Username { get; set; }

Expand Down
4 changes: 3 additions & 1 deletion Mundialito/wwwroot/App/Users/ManageApp.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
<table class="table table-striped">
<thead>
<th>Name</th>
<th>Role</th>
<th>Email</th>
<th>Actions</th>
</thead>
<tbody>
<tr ng-repeat="user in users">
<td><a href="{{user.getUrl()}}">{{::user.Name}}</a><span style="margin-left: 5px;" class="label label-as-badge" ng-class="{'label-success': user.Roles === 'Admin', 'label-default': user.Roles === 'Active', 'label-danger':user.Roles === 'Disabled'}">{{::user.Roles}}</span> </td>
<td><a href="{{user.getUrl()}}">{{::user.Name}}</a></td>
<td><span style="margin-left: 5px;" class="label label-as-badge" ng-class="{'label-success': user.Roles === 'Admin', 'label-default': user.Roles === 'Active', 'label-danger':user.Roles === 'Disabled'}">{{::user.Roles}}</span></td>
<td>{{user.Email}}</td>
<td>
<button title="delete" type="button" class="btn btn-danger btn-sm" ng-click="deleteUser(user)" tooltip="Delete User"><i class="fa fa-times-circle"></i> <span class="hidden-xs">Delete</span></button>
Expand Down
2 changes: 1 addition & 1 deletion Mundialito/wwwroot/App/Users/UserProfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h4>
<i class="fa fa-user" ng-if="profileUser.ProfilePicture == null"></i><img referrerpolicy="no-referrer"
ng-if="profileUser.ProfilePicture != null" src="{{profileUser.ProfilePicture}}" class="img-circle">
{{profileUser.Name}} Profile
{{profileUser.Name}} Profile<span style="margin-left: 5px;" class="label label-as-badge" ng-class="{'label-success': profileUser.Roles === 'Admin', 'label-default': profileUser.Roles === 'Active', 'label-danger':profileUser.Roles === 'Disabled'}">{{::profileUser.Roles}}</span>
</h4>
</div>
<div class="col-md-2" ng-if="profileUser.Username !== security.user.Username">
Expand Down

0 comments on commit a989f43

Please sign in to comment.