also make menu use percentages

somewhat responsive now
even it wont look good small
This commit is contained in:
Torsten Ruger 2018-04-18 17:54:58 +03:00
parent 6c597bea69
commit c379d0f09f
3 changed files with 26 additions and 33 deletions

View File

@ -1,44 +1,35 @@
body body
font-family: arial, helvetica, serif font-family: arial, helvetica, serif
#nav , #nav ul
#nav, #nav ul /* all lists */
padding: 0 padding: 0
margin: 0 margin: 0
list-style: none list-style: none
float: left float: left
width: 190px width: 100%
border-radius: 8px border-radius: 8px
background: black background: black
border: 2px solid #C3D46A border: 2px solid #C3D46A
#nav
#nav li /* all list items */ li
position: relative position: relative
float: left float: left
line-height: 1.25em line-height: 1.25em
width: 180px width: 99%
a , span
width: 99%
#nav li ul /* second-level lists */ display: block
position: absolute text-decoration: none
left: -999em background-color: black
margin-left: 185px border-radius: 7px
margin-top: -2.7em ul
position: absolute
left: -999em
#nav li ul ul /* third-and-above-level lists */ margin-left: 99%
left: -999em margin-top: -2.7em
ul
left: -999em
#nav li a , li span
padding-left: 5px
width: 180px
display: block
text-decoration: none
background-color: black
border-radius: 7px
#nav li a:hover #nav li a:hover
color: white color: white

View File

@ -28,13 +28,14 @@ end
class SelectView < ElementView class SelectView < ElementView
def initialize interpreter def initialize( interpreter )
super
@interpreter = interpreter @interpreter = interpreter
@codes = nil @codes = nil
end end
def draw def draw
@element = div("h4", "Code") << (list = div("ul.nav!")) @element = div("h4.select", "Code") << (list = div("ul.nav!"))
list << (div("li.code_list") << div("a.selected" , "none selected")) list << (div("li.code_list") << div("a.selected" , "none selected"))
selection_codes unless @codes selection_codes unless @codes
@element << div("br") @element << div("br")
@ -47,6 +48,7 @@ class SelectView < ElementView
@codes << @codes.first if @codes.length == 1 #otherwise unselectable @codes << @codes.first if @codes.length == 1 #otherwise unselectable
@codes.each do |c| @codes.each do |c|
code = div("li") << div("a" , c ) code = div("li") << div("a" , c )
code.style["z-index"] = 10
code.on("click"){ select(c) } code.on("click"){ select(c) }
list << code list << code
end end

View File

@ -45,7 +45,7 @@ class ObjectView < ListView
end end
def content_elements def content_elements
fields = [ConstantView.new("li" , "---------------------------------")] fields = [ConstantView.new("li" , "------------------------------")]
object = @object object = @object
if object and ! object.is_a?(String) if object and ! object.is_a?(String)
object.get_instance_variables.each do |variable| object.get_instance_variables.each do |variable|