Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#10979] Highlight today date and add today button #10980

Merged
merged 11 commits into from
Mar 5, 2021

Conversation

daongochieu2810
Copy link
Contributor

@daongochieu2810 daongochieu2810 commented Feb 24, 2021

Fixes #10979

Outline of Solution

  • Highlight today date with ng-template
  • Add today button

Screenshot from 2021-02-24 20-07-02

@damithc
Copy link
Contributor

damithc commented Feb 24, 2021

In the examples I have seen elsewhere, the 'today' button is actually inside the picker dialog itself. Is that possible? e.g.,
image

@daongochieu2810
Copy link
Contributor Author

In the examples I have seen elsewhere, the 'today' button is actually inside the picker dialog itself. Is that possible? e.g.,
image

Yes thats possible. I will make the change

@daongochieu2810 daongochieu2810 added the s.ToReview The PR is waiting for review(s) label Feb 25, 2021
Copy link
Contributor

@ccyccyccy ccyccyccy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bug here. The following and previous month's dates are hidden even though they are supposed to muted only.

Before After
image image

We should also consider the styling of today's date in the edge case where it appears as a "following month" on the currently viewed month.

Also, I find that the today date highlight and the currently selected date highlight are too similarly styled. Maybe we can use something similar to the image below? Another advantage is that we can combine their styles if today's date is the selected date.
image

<div class="col-md-7 col-xs-center">
<div class="input-group">
<input id="submission-start-date" type="text" class="form-control" ngbDatepicker [ngModel]="model.submissionStartDate" (ngModelChange)="triggerModelChange('submissionStartDate', $event)" #startTimeDp="ngbDatepicker" [disabled]="!model.isEditable"/>
<ng-template #ft1>
Copy link
Contributor

@ccyccyccy ccyccyccy Feb 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change name similarly for ft1, ft2, ft3 and ft4.
If possible, can try passing in the parameter for the model change without repeating the footer template 4 times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its possible with a custom template. But not possible with [footerTemplate] directive and without using it the Today button will not appear inside the datepicker

@ccyccyccy
Copy link
Contributor

Did you try using .ngb-dp-today to style it? You could avoid the usage of the custom day template that way.

@daongochieu2810
Copy link
Contributor Author

Did you try using .ngb-dp-today to style it? You could avoid the usage of the custom day template that way.

That does not seem to work on the input component. Perhaps it only works with a datepicker template

@ccyccyccy
Copy link
Contributor

ccyccyccy commented Mar 1, 2021

You probably have to put it in the styles.scss file.

@daongochieu2810
Copy link
Contributor Author

Screenshot from 2021-03-02 12-25-18
Somehow setting the color for the number does not work

@ccyccyccy
Copy link
Contributor

The reason is because the color setting is getting overwritten by the child class btn-light.

image
Being more specific in the CSS selector would solve this problem.

.ngb-dp-today > .btn-light {
  font-weight: bold;
  color: blue
}

Copy link
Contributor

@ccyccyccy ccyccyccy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ccyccyccy ccyccyccy added s.FinalReview The PR is ready for final review and removed s.ToReview The PR is waiting for review(s) labels Mar 4, 2021
@madanalogy madanalogy added s.Ongoing The PR is being worked on by the author(s) and removed s.FinalReview The PR is ready for final review labels Mar 4, 2021
Copy link
Contributor

@madanalogy madanalogy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@madanalogy madanalogy added c.Feature User-facing feature; can be new feature or enhancement to existing feature s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.Ongoing The PR is being worked on by the author(s) labels Mar 5, 2021
@madanalogy madanalogy added this to the V7.12.0 milestone Mar 5, 2021
@madanalogy madanalogy merged commit c35f79c into TEAMMATES:master Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c.Feature User-facing feature; can be new feature or enhancement to existing feature s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a 'today' button in date picker
4 participants