#214: added DateTime formatter
This commit is contained in:
parent
e698039a7c
commit
a37a23266f
1
Gemfile
1
Gemfile
|
@ -61,6 +61,7 @@ gem "gemoji", "~> 1.2.1", require: 'emoji/railtie'
|
|||
# AngularJS related stuff
|
||||
gem 'angularjs-rails'
|
||||
gem 'ng-rails-csrf'
|
||||
gem 'momentjs-rails'
|
||||
|
||||
group :assets do
|
||||
gem 'sass-rails', '~> 3.2.5'
|
||||
|
|
|
@ -196,6 +196,8 @@ GEM
|
|||
mime-types (1.23)
|
||||
mini_portile (0.5.1)
|
||||
mock_redis (0.6.2)
|
||||
momentjs-rails (2.0.0.2)
|
||||
railties (>= 3.1)
|
||||
multi_json (1.7.7)
|
||||
multipart-post (1.2.0)
|
||||
mustache (0.99.4)
|
||||
|
@ -436,6 +438,7 @@ DEPENDENCIES
|
|||
meta-tags (~> 1.2.5)
|
||||
meta_request
|
||||
mock_redis (= 0.6.2)
|
||||
momentjs-rails
|
||||
newrelic_rpm (~> 3.5.5.38)
|
||||
ng-rails-csrf
|
||||
omniauth
|
||||
|
|
|
@ -1 +1,14 @@
|
|||
var RosaABF = angular.module('RosaABF', ['ngResource', 'ng-rails-csrf']);
|
||||
|
||||
var DateTimeFormatter = function() {
|
||||
|
||||
var UtcFormatter = function(api_time) {
|
||||
return moment.utc(api_time * 1000).format('YYYY-MM-DD HH:mm:ss UTC');
|
||||
}
|
||||
|
||||
return {
|
||||
utc : UtcFormatter
|
||||
}
|
||||
}
|
||||
|
||||
RosaABF.factory("DateTimeFormatter", DateTimeFormatter);
|
|
@ -1,4 +1,4 @@
|
|||
RosaABF.controller('PullRequestController', function($scope, $http, ApiPullRequest, ApiProject) {
|
||||
RosaABF.controller('PullRequestController', function($scope, $http, ApiPullRequest, ApiProject, DateTimeFormatter) {
|
||||
|
||||
$scope.project_id = null;
|
||||
$scope.project_resource = null;
|
||||
|
@ -25,8 +25,8 @@ RosaABF.controller('PullRequestController', function($scope, $http, ApiPullReque
|
|||
{project_id: $scope.project_id, serial_id: $scope.serial_id},
|
||||
function(results) {
|
||||
$scope.pull = results.pull_request;
|
||||
if ($scope.pull.merged_at) { $scope.merged_at = new Date($scope.pull.merged_at * 1000).toUTCString(); }
|
||||
if ($scope.pull.closed_at) { $scope.closed_at = new Date($scope.pull.closed_at * 1000).toUTCString(); }
|
||||
if ($scope.pull.merged_at) { $scope.merged_at = DateTimeFormatter.utc($scope.pull.merged_at); }
|
||||
if ($scope.pull.closed_at) { $scope.closed_at = DateTimeFormatter.utc($scope.pull.closed_at); }
|
||||
if ($scope.check_branch && ($scope.pull.status == 'closed' || $scope.pull.status == 'merged')) { $scope.getBranch(); }
|
||||
}
|
||||
);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
//= require unstable/angular-resource
|
||||
//= require ng-rails-csrf
|
||||
//= require_tree ./angularjs
|
||||
//= require moment
|
||||
|
||||
//= require_self
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ json.refs_list @refs do |json_grit, grit|
|
|||
json_grit.object do |json_object|
|
||||
json_object.type (grit.class.name =~ /Tag/ ? 'tag' : 'commit')
|
||||
json_object.sha grit.commit.id
|
||||
json_object.authored_date grit.commit.authored_date.strftime('%d.%m.%Y')
|
||||
json_object.authored_date grit.commit.authored_date.to_i
|
||||
end
|
||||
end
|
||||
json.url refs_list_api_v1_project_path(@project.id, :format => :json)
|
|
@ -25,4 +25,4 @@
|
|||
= t('layout.projects.source_code', :type => type)
|
||||
%p.name
|
||||
%b {{tag.ref}}
|
||||
.date {{tag.object.authored_date}}
|
||||
.date {{tag.object.authored_date * 1000 | date:'yyyy.MM.dd'}}
|
||||
|
|
Loading…
Reference in New Issue