-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Highlight weekends in the calendar..(Highlight Saturdays and Sundays in the calendar) #13505
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
Draft
Wanderer65
wants to merge
6
commits into
DefectDojo:bugfix
Choose a base branch
from
Wanderer65:calendar-weekend-highlight
base: bugfix
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+108
−44
Draft
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eb3bea7
Highlight weekends in the calendar
1bb09ce
Fix: use local FullCalendar libs and restore comment per review feedback
2b7c892
Fix calendar.html: restore form, retain weekend highlight, use local …
7398036
Restore form, retain weekend highlight, use local FullCalendar JS/CSS…
433366f
Fix calendar.html: restore form, retain weekend highlight, use local …
d46b6a5
Merge branch 'bugfix' into calendar-weekend-highlight
Wanderer65 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,32 @@ | ||
| {% extends 'base.html' %} | ||
| {% load static %} | ||
| {% load i18n %} | ||
|
|
||
| {% block content %} | ||
| {% block head_extra %} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this changed/removed? |
||
| {{ block.super }} | ||
| <form method="GET" id="calfilter" action="/calendar"> | ||
| <div class="container-fluid chosen-container side-by-side"> | ||
| <div class="row"> | ||
| <div style="display: inline-block;"> | ||
| <select data-placeholder="Calendar type" id="caltype" class="chosen-select"> | ||
| <option value="engagements">Engagements</option> | ||
| <option value="tests">Tests</option> | ||
| </select> | ||
| </div> | ||
| <div style="display: inline-block;"> | ||
| <select data-placeholder="All users" multiple id="lead" name="lead" class="chosen-select"> | ||
| <option value="0">All users</option> | ||
| <option value="-1">Unassigned</option> | ||
| {% for u in users %} | ||
| <option value="{{ u.id }}">{{ u.username }}</option> | ||
| {% endfor %} | ||
| </select> | ||
| </div> | ||
| <div style="display: inline-block;"> | ||
| <input class="btn btn-primary" type="submit" value="Apply" /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </form> | ||
| <br/><br/> | ||
| <div id="calendar"></div> | ||
| <br/><br/> | ||
|
Comment on lines
7
to
33
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this changed/removed? |
||
| <!-- Using locally stored FullCalendar CSS (no external CDN) --> | ||
| <link href="{% static 'vendor/fullcalendar/fullcalendar.min.css' %}" rel="stylesheet" /> | ||
| {% endblock %} | ||
|
|
||
| {% block postscript %} | ||
| {{ block.super }} | ||
| <!-- Using locally stored JS libraries to avoid missing SRI on external CDNs --> | ||
| <script src="{% static 'vendor/fullcalendar/jquery.min.js' %}"></script> | ||
| <script src="{% static 'vendor/fullcalendar/moment.min.js' %}"></script> | ||
| <script src="{% static 'vendor/fullcalendar/fullcalendar.min.js' %}"></script> | ||
|
|
||
| <script> | ||
| $(function () { | ||
| $('#caltype').change(function() { | ||
| $('#calfilter').attr('action', '/calendar/' + $(this).val()); | ||
| }); | ||
|
|
||
| if (caltype) { | ||
| $('#caltype').val('{{ caltype }}'); | ||
| $('#caltype').trigger('change'); | ||
| } | ||
|
|
||
| $('#lead').val([{% for lead in leads %} '{{ lead }}', {% endfor %}]); | ||
|
|
||
| $('#calendar').fullCalendar({ | ||
| header: { | ||
| left: 'prev,next today', | ||
|
|
@@ -56,35 +39,40 @@ | |
| {% if caltype == 'tests' %} | ||
| {% for t in tests %} | ||
| { | ||
| title: '{{t.engagement.product.name}}: {{ t.engagement.name|default:"Unknown" }} - {{ t.test_type }} ({{ t.lead|default:"Unassigned" }})', | ||
| start: '{{t.target_start|date:"c"}}', | ||
| end: '{{t.target_end|date:"c"}}', | ||
| title: '{{ t.engagement.product.name }}: {{ t.engagement.name|default:"Unknown" }} - {{ t.test_type }} ({{ t.lead|default:"Unassigned" }})', | ||
| start: '{{ t.target_start|date:"c" }}', | ||
| end: '{{ t.target_end|date:"c" }}', | ||
| url: '{% url 'view_test' t.id %}', | ||
| color: {% if t.engagement.active %}'#337ab7'{% else %}'#b9b9b9'{% endif %}, | ||
| color: {% if t.engagement.active %}'#337ab7'{% else %}'#b9b9b9'{% endif %}, | ||
| overlap: true | ||
| }, | ||
| {% endfor %} | ||
| {% endfor %} | ||
| {% else %} | ||
| {% for e in engagements %} | ||
| { | ||
| title: '{{e.product.name}}: {{ e.name|default:"Unknown" }} ({{ e.lead|default:"Unassigned" }})', | ||
| start: '{{e.target_start|date:"c"}}', | ||
| end: '{{e.target_end|date:"c"}}', | ||
| title: '{{ e.product.name }}: {{ e.name|default:"Unknown" }} ({{ e.lead|default:"Unassigned" }})', | ||
| start: '{{ e.target_start|date:"c" }}', | ||
| end: '{{ e.target_end|date:"c" }}', | ||
| url: '{% url 'view_engagement' e.id %}', | ||
| color: {% if e.active %}'#337ab7'{% else %}'#b9b9b9'{% endif %}, | ||
| color: {% if e.active %}'#337ab7'{% else %}'#b9b9b9'{% endif %}, | ||
| overlap: true | ||
| }, | ||
| {% endfor %} | ||
| {% endfor %} | ||
| {% endif %} | ||
| ], | ||
| viewRender: function(view, element) { | ||
| // Updating aria-label attributes calendar switches after the view is rendered | ||
| $('.fc-prev-button').attr('aria-label', '{% trans "Previous month" %}'); | ||
| $('.fc-next-button').attr('aria-label', '{% trans "Next month" %}'); | ||
| $('.fc-month-button').attr('aria-label', '{% trans "Month preview" %}'); | ||
| $('.fc-basicWeek-button').attr('aria-label', '{% trans "Week preview" %}'); | ||
| $('.fc-basicDay-button').attr('aria-label', '{% trans "Day preview" %}'); | ||
| } | ||
| $('.fc-prev-button').attr('aria-label', '{% trans "Previous month" %}'); | ||
| $('.fc-next-button').attr('aria-label', '{% trans "Next month" %}'); | ||
| $('.fc-month-button').attr('aria-label', '{% trans "Month preview" %}'); | ||
| $('.fc-basicWeek-button').attr('aria-label', '{% trans "Week preview" %}'); | ||
| $('.fc-basicDay-button').attr('aria-label', '{% trans "Day preview" %}'); | ||
| }, | ||
| dayRender: function(date, cell) { | ||
| // Highlight Saturdays and Sundays | ||
| if (date.day() === 0 || date.day() === 6) { | ||
| cell.css("background-color", "#f0e68c"); | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| </script> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this changed/removed?