Skip to content

Commit

Permalink
Add seconds to time picker (#3464)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablopunk authored May 11, 2020
1 parent f091599 commit e540521
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions scripts/core/superdesk-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ declare module 'superdesk-api' {
export interface IPublishedArticle extends IArticle {

/** id in published collection, different for each correction */
item_id: string;
item_id: string;

/** item copy in archive collection, always the latest version of the item */
archive_item: IArticle;
Expand Down Expand Up @@ -1184,7 +1184,7 @@ declare module 'superdesk-api' {
search_cvs: any;
view: {
dateformat: string; // a combination of YYYY, MM, and DD with a custom separator e.g. 'MM/DD/YYYY'
timeformat: any;
timeformat: string;
};
user: {
sign_off_mapping: any;
Expand Down
10 changes: 7 additions & 3 deletions scripts/core/ui/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,12 @@ function TimepickerPopupDirective($timeout) {
time: '=',
},
link: function(scope, element) {
var MODEL_TIME_FORMAT = appConfig.model.timeformat;
const MODEL_TIME_FORMAT = appConfig.model.timeformat;
const VIEW_TIME_FORMAT = appConfig.view.timeformat;

var POPUP = '.timepicker-popup';
const POPUP = '.timepicker-popup';

var focusEl = function() {
const focusEl = function() {
$timeout(() => {
element.find(POPUP).focus();
}, 0, false);
Expand All @@ -714,6 +715,9 @@ function TimepickerPopupDirective($timeout) {

scope.hours = _.range(24);
scope.minutes = _.range(0, 60, 5);
if (VIEW_TIME_FORMAT.includes('ss')) {
scope.seconds = _.range(0, 60, 10);
}

scope.$watch('time', (newVal, oldVal) => {
var local;
Expand Down
8 changes: 7 additions & 1 deletion scripts/core/ui/views/sd-timepicker-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
<li ng-repeat="m in minutes" ng-click="$parent.minute = m" ng-class="{active: minute === m}">{{m | leadingZero}}</li>
</ul>
</div>
<div class="select-area" ng-show="seconds">
<div class="header" translate>Seconds</div>
<ul>
<li ng-repeat="s in seconds" ng-click="$parent.second = s" ng-class="{active: second === s}">{{s | leadingZero}}</li>
</ul>
</div>
<button class="btn btn--primary btn--small pull-right" ng-click="submit()" translate>Confirm</button>
<button class="btn btn--small pull-right" ng-click="cancel()" translate>Cancel</button>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions styles/sass/sf-additional.scss
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@
@include box-shadow(0 0 5px 0 rgba(0,0,0,0.45));
@include border-radius(3px);
width: 200px;
height: 310px;
min-height: 310px;
@include border-box();
.timepicker-additional {
margin-bottom: 5px;
Expand Down Expand Up @@ -1259,7 +1259,7 @@
align-items: center;
padding: 4px;
min-height: 38px;

* + * {
margin-left: 6px;
}
Expand Down

0 comments on commit e540521

Please sign in to comment.