Skip to content

Commit

Permalink
Merge pull request #1 from bmic-development/kg-scroll_to_top
Browse files Browse the repository at this point in the history
KG - Back to Top Button on Protocol Index
  • Loading branch information
jleonardw9 committed Jan 23, 2017
2 parents 7342511 + f9a7fd9 commit 463b1f3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/assets/javascripts/protocols.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,11 @@ $ ->
$('#protocol-list').bootstrapTable('hideColumn', 'subsidy_committed')
$('#protocol-list').bootstrapTable('hideColumn', 'subsidy_expended')

$(window).scroll ->
if $(this).scrollTop() > 50
$('.back-to-top').removeClass('hidden')
else
$('.back-to-top').addClass('hidden')

(exports ? this).number_to_percent = (value) ->
value + '%'
5 changes: 5 additions & 0 deletions app/assets/stylesheets/protocols.sass
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ body.protocols
.srid
width: 200px

.back-to-top
position: fixed
right: 20px
bottom: 20px

&.protocols-show

span.r-label, span.t-label
Expand Down
3 changes: 3 additions & 0 deletions app/views/protocols/_back_to_top.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
%a.back-to-top.btn.btn-primary.btn-lg.hidden{href: '#', role: 'button', data: { toggle: 'tooltip', placement: 'left' }}
= t(:protocol)[:back_to_top]
%span.glyphicon.glyphicon-chevron-up
2 changes: 2 additions & 0 deletions app/views/protocols/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
.row
.col-md-12
= render 'protocols'

= render 'back_to_top'
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ en:
project_schedule: "Project Schedule"
udak_project_number: "UDAK Project #"
updates: "Updates"
back_to_top: 'Back to Top'

reports:
asc: "ASC"
Expand Down

0 comments on commit 463b1f3

Please sign in to comment.