Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Commit

Permalink
OperatorsMenu should stretch its height
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Medeiros committed Aug 9, 2014
1 parent 0f40ae9 commit 55668f1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
4 changes: 2 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
+ DONE Side menu with list of operators
+ DONE RxMarbles title and proposition value
+ DONE Examples for Observable Instance Methods
- TODO OperatorsMenu should stretch its height
- TODO Version number at the bottom of the page
+ DONE OperatorsMenu should stretch its height
- TODO Version number and author at the bottom of the page
- from package.json
>>> v0.2.0

Expand Down
2 changes: 1 addition & 1 deletion dist/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ ul.operators-menu {
margin: 0;
padding: 0;
list-style-type: none;
border-top: 1px solid #d4d4d4;
overflow-y: scroll;
height: 2px;
}
ul.operators-menu li > a {
color: #7c7c7c;
Expand Down
28 changes: 23 additions & 5 deletions dist/js/app.js

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion src/views/operators-menu.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ Examples = require 'rxmarbles/models/examples'

selected$ = new Rx.Subject()

getDocumentHeight = ->
body = document.body
html = document.documentElement
return Math.max(
body.scrollHeight,
body.offsetHeight,
html.clientHeight,
html.scrollHeight,
html.offsetHeight
)

renderMenuItem = (example) ->
link = h("a", {href: "##{example.key}"}, example.key)
Rx.Observable.fromEvent(link, "click").subscribe(->
Expand All @@ -15,6 +26,13 @@ renderMenuItem = (example) ->
)
return h("li", [link])

fixListHeight = (listElement) ->
Rx.Observable.timer(1).subscribe(->
height = getDocumentHeight() - listElement.getBoundingClientRect().top
listElement.style.height = "#{height}px"
return true
)

module.exports = {
getSelected$: ->
return selected$
Expand All @@ -24,7 +42,9 @@ module.exports = {
for own key,value of Examples
value.key = key
menuItems.push(value)
return h("ul.operators-menu",
listElement = h("ul.operators-menu",
(renderMenuItem(example) for example in menuItems)
)
fixListHeight(listElement)
return listElement
}
2 changes: 1 addition & 1 deletion styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ ul.operators-menu {
margin: 0;
padding: 0;
list-style-type: none;
border-top: 1px solid @color-grey-light;
overflow-y: scroll;
height: 2px;
li > a {
color: @color-grey-dark;
font-size: 1rem;
Expand Down

0 comments on commit 55668f1

Please sign in to comment.