Skip to content

Commit

Permalink
Revert to shortTime refs #1474
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmiller committed Nov 12, 2018
1 parent 0617ec2 commit e34ab13
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion opal/scaffolding/record_templates/record_display.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% elif f['type'] == 'date_time' %}
[[ item.{{ f['name'] }} | displayDateTime ]]
{% elif f['type'] == 'time' %}
[[ item.{{ f['name'] }} | hhmm ]]
[[ item.{{ f['name'] }} | shortTime ]]
{% else %}
[[ item.{{ f['name'] }} ]]
{% endif %}
Expand Down
3 changes: 1 addition & 2 deletions opal/static/js/opal/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ filters.filter('shortDateTime', function(shortDateFilter, hhmmFilter, $log){
});


filters.filter('shortTime', function(shortDateFilter, hhmmFilter, $log){
filters.filter('shortTime', function(shortDateFilter, hhmmFilter){
return function(input){
$log.warn('shortTime will be removed in Opal 0.14.0')
var toChange;
if(_.isDate(input)){
toChange = moment(input);
Expand Down
9 changes: 1 addition & 8 deletions opal/static/js/test/filters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,13 @@ describe('filters', function() {
});

describe('shortTime', function(){
var shortTime, log;
var shortTime;

beforeEach(function(){
inject(function($injector){
shortTime = $injector.get('shortTimeFilter');
log = $injector.get('$log');
});

spyOn(log, 'warn');
});

it('should log a warning message', function() {
shortTime()
expect(log.warn).toHaveBeenCalledWith('shortTime will be removed in Opal 0.14.0')
});

it('should display the time as hh:mm from string', function(){
Expand Down
2 changes: 1 addition & 1 deletion opal/tests/test_scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def test_time_render(self, build_field_schema, lshift):
scaffold_path = ffs.Path(settings.PROJECT_PATH)/'scaffolding'
create_display_template_for(Colour, scaffold_path)
lshift.assert_called_once_with(
'<span ng-show="item.name">\n [[ item.name | hhmm ]]\n <br />\n</span>'
'<span ng-show="item.name">\n [[ item.name | shortTime ]]\n <br />\n</span>'
)

@patch.object(Colour, "build_field_schema")
Expand Down

0 comments on commit e34ab13

Please sign in to comment.