Skip to content

Commit

Permalink
Merge pull request #4400 from dodona-edu/valentine-overlay
Browse files Browse the repository at this point in the history
Valentine status overlay
  • Loading branch information
jorg-vr authored Feb 9, 2023
2 parents ffbf132 + d8ec398 commit 7c39fdc
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 10 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/stylesheets/base.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

// 6. Seasonal css sheets
@import "seasonal/christmas.css.scss";
@import "seasonal/valentine.css.scss";

/* stylelint-disable-next-line selector-class-pattern */
.field_with_errors input {
Expand Down
26 changes: 26 additions & 0 deletions app/assets/stylesheets/seasonal/valentine.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.series-icon.valentine {
.overlay {
overflow: visible;
}

.overlay div {
content: "";
position: absolute;
width: 50px;
height: 50px;
margin-left: -5px;
background-size: contain;
background-repeat: no-repeat;
top: -5px;
}

&.completed:not(.deadline-missed) {
.icon-base {
visibility: hidden;
}

.overlay div {
content: url("seasonal/series_status_overlays/heart-rainbow.svg");
}
}
}
5 changes: 5 additions & 0 deletions app/helpers/seasonal_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ def christmas(current_time)
current_time.month == 12 && current_time.day > 6
end

def valentine(current_time)
current_time.month == 2 && current_time.day == 14
end

# returns seasonal class
def series_status_overlay
current_time = Time.now.in_time_zone(config.time_zone)

return 'christmas' if christmas(current_time)
return 'valentine' if valentine(current_time)

nil
end
Expand Down
23 changes: 13 additions & 10 deletions app/views/series/_series_status.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@
<stop stop-color="var(--purple)" offset="99%" />
</linearGradient>
</defs>
<circle cx="50%" cy="50%" r= "50%" fill="var(--icon-color)" class="outer-circle"></circle>
<circle cx="50%" cy="50%" r= "42%" fill="var(--icon-background-color)"></circle>
<foreignObject x="8" y="8" height="24" width="24" style="color: var(--icon-color)">
<i class="mdi <%= progress_icon %>"></i>
</foreignObject>
<% if deadline_icon %>
<circle cx="33" cy="34.5" r= "11" fill="var(--deadline-icon-background-color)"></circle>
<foreignObject x="24" y="26" height="18" width="18" style="color: var(--deadline-icon-color)">
<i class="mdi mdi-18 <%= deadline_icon %>"></i>
<g class="icon-base" >
<circle cx="50%" cy="50%" r= "50%" fill="var(--icon-color)" class="outer-circle"></circle>
<circle cx="50%" cy="50%" r= "42%" fill="var(--icon-background-color)"></circle>
<foreignObject x="8" y="8" height="24" width="24" style="color: var(--icon-color)">
<i class="mdi <%= progress_icon %>"></i>
</foreignObject>
<% end %>
<% if deadline_icon %>
<circle cx="33" cy="34.5" r= "11" fill="var(--deadline-icon-background-color)"></circle>
<foreignObject x="24" y="26" height="18" width="18" style="color: var(--deadline-icon-color)">
<i class="mdi mdi-18 <%= deadline_icon %>"></i>
</foreignObject>
<% end %>
</g>
<% if overlay_class %>
<foreignObject width="100%" height="100%" class="overlay">
Expand Down

0 comments on commit 7c39fdc

Please sign in to comment.