Skip to content

Commit

Permalink
Add rubber ducks to problem alerts
Browse files Browse the repository at this point in the history
Closes #4467
  • Loading branch information
differentmatt committed Oct 2, 2017
1 parent c8b24c9 commit 7b2d850
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
Binary file added app/assets/images/pages/play/duck_anya.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/pages/play/duck_tharin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion app/styles/play/level/tome/problem_alert.sass
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@

&.alert-info
border-image-source: url(/images/level/code_editor_info_background.png)


.duck-img
margin-right: 10px

html.no-borderimage
.problem-alert
border-width: 0
Expand Down
21 changes: 14 additions & 7 deletions app/templates/play/level/tome/problem_alert.jade
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
button.close(type="button") ×
h3.problem-alert-title(data-i18n="play_level.problem_alert_title") Fix Your Code
if view.hint
span.problem-title!= view.hint
br
span.problem-subtitle!= view.message
else
span.problem-title!= view.message
table
tr
if view.duckImg
td
img.duck-img(src=view.duckImg width=100)
td
h3.problem-alert-title(data-i18n="play_level.problem_alert_title") Fix Your Code
if view.hint
span.problem-title!= view.hint
br
span.problem-subtitle!= view.message
else
span.problem-title!= view.message

5 changes: 5 additions & 0 deletions app/views/play/level/tome/ProblemAlertView.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module.exports = class ProblemAlertView extends CocoView
id: 'problem-alert-view'
className: 'problem-alert'
template: template
duckImages: [
'/images/pages/play/duck_anya.png'
'/images/pages/play/duck_tharin.png'
]

subscriptions:
'tome:show-problem-alert': 'onShowProblemAlert'
Expand All @@ -29,6 +33,7 @@ module.exports = class ProblemAlertView extends CocoView
@onWindowResize()
else
@$el.hide()
@duckImg = _.sample(@duckImages)
$(window).on 'resize', @onWindowResize

destroy: ->
Expand Down

0 comments on commit 7b2d850

Please sign in to comment.