Skip to content

Commit 944f949

Browse files
committed
Added momentjs for formatting.
1 parent c1bda2c commit 944f949

File tree

21 files changed

+23873
-12
lines changed

21 files changed

+23873
-12
lines changed

SimpleTaskSystem/SimpleTaskSystem.Application/DtoMappings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public static void Map()
1212
{
1313
//This code configures AutoMapper to auto map between Entities and DTOs.
1414

15-
Mapper.CreateMap<Task, TaskDto>();
15+
//I specified mapping for AssignedPersonId since NHibernate does not fill Task.AssignedPersonId
16+
//If you will just use EF, then you can remove ForMember definition.
17+
Mapper.CreateMap<Task, TaskDto>().ForMember(t => t.AssignedPersonId, opts => opts.MapFrom(d => d.AssignedPerson.Id));
18+
1619
Mapper.CreateMap<Person, PersonDto>();
1720
}
1821
}

SimpleTaskSystem/SimpleTaskSystem.Application/Tasks/Dtos/TaskDto.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SimpleTaskSystem.Tasks.Dtos
88
/// </summary>
99
public class TaskDto : EntityDto<long>
1010
{
11-
public int AssignedPersonId { get; set; }
11+
public int? AssignedPersonId { get; set; }
1212

1313
public string AssignedPersonName { get; set; }
1414

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
angular.module('app')
2+
.filter('momentFromNow', function() {
3+
return function(input) {
4+
return moment(input).fromNow();
5+
};
6+
});

SimpleTaskSystem/SimpleTaskSystem.WebSpaAngular/App/Main/views/layout/layout.cshtml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@using System.Web.Optimization
1+
@using System.Threading
2+
@using System.Web.Optimization
23
<!DOCTYPE html>
34
<html lang="en">
45
<head>
@@ -27,6 +28,11 @@
2728
<![endif]-->
2829

2930
@Scripts.Render("~/Bundles/App/vendor/js")
31+
32+
<script>
33+
//Localizing momentjs
34+
moment.locale('@Thread.CurrentThread.CurrentUICulture.Name');
35+
</script>
3036

3137
<!-- Dynamic scripts of ABP system (They are created on runtime and can not be bundled) -->
3238
<script src="~/api/AbpServiceProxies/GetAll?type=angular"></script>

SimpleTaskSystem/SimpleTaskSystem.WebSpaAngular/App/Main/views/task/list.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
<span class="task-state-icon glyphicon" ng-click="vm.changeTaskState(task)" ng-class="{'glyphicon-minus': task.state == 1, 'glyphicon-ok': task.state == 2}"></span>
2626
<span ng-class="{'task-description-active': task.state == 1, 'task-description-completed': task.state == 2 }">{{task.description}}</span>
2727
<br />
28-
<span ng-show="task.assignedPersonId > 0">
28+
<span ng-show="task.assignedPersonId">
2929
<span class="task-assignedto">{{task.assignedPersonName}}</span>
3030
</span>
31-
<span class="task-creationtime">{{task.creationTime}}</span>
31+
<span class="task-creationtime">{{task.creationTime | momentFromNow}}</span>
3232
</div>
3333
</ul>
3434

SimpleTaskSystem/SimpleTaskSystem.WebSpaAngular/App_Start/BundleConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public static void RegisterBundles(BundleCollection bundles)
3636

3737
"~/Scripts/bootstrap.min.js",
3838

39+
"~/Scripts/moment-with-locales.min.js",
3940
"~/Scripts/jquery.blockUI.min.js",
4041
"~/Scripts/toastr.min.js",
4142
"~/Scripts/others/spinjs/spin.js",

0 commit comments

Comments
 (0)