By | Chris Done |
At | 2011-06-12 |
Title | Toggle text of the expand/collapse button. |
Description |
Edit file src/HJScript/Objects/JQuery/Extra.hs 33188 → 33188
17 17 -- | Set the width of a DOM element.
18 18 setWidth :: IsJQuery o => Exp Int -> o -> HJScript ()
19 19 setWidth w o = do
20 20 runExp $ methodCall "width" w o
21 21 + 22 -- | Set the text of a DOM element.
+ 23 setText :: IsJQuery o => Exp String -> o -> HJScript ()
+ 24 setText w o = do
+ 25 runExp $ methodCall "text" w o
+ 26 22 27 -- | Append an element to another.
23 28 append :: IsJQuery o => Exp a -> o -> HJScript ()
24 29 append w o = do
25 30 runExp $ methodCall "append" w o
26 31 … … … … Edit file src/Amelie/View/Script.hs 33188 → 33188
66 66 each (do btn <- varWith (j "<a href=\"\">Expand</a>")
67 67 this <- varWith this'
68 68 prepend (string " - ") this
69 69 prepend (val btn) this
70 70 details <- varWith (siblings ".amelie-paste-specs" this)
- 71 display "none" details
- 72 toggle (display "block" details)
- 73 (display "none" details)
+ 71 display btn "none" details
+ 72 toggle (display btn "block" details)
+ 73 (display btn "none" details)
74 74 btn
75 75 return true)
76 76 (j ".amelie-paste-nav")
77 77 - 78 where display prop o = do
+ 78 where display btn prop o = do
79 79 css "display" prop o
+ 80 setText (string caption) btn
80 81 return false
+ 82 where caption = if prop == "block" then "Collapse" else "Expand"
… … … …