Commit b5344e5ed5c380586e9b9b9702799b1c16f7c36e
1 parent
2bb9ce75
New :
- Add jQuery tabs.
Showing
2 changed files
with
87 additions
and
8 deletions
Show diff stats
web/CXM_jquery.anubis
| @@ -11,14 +11,15 @@ read calexium_lib/web/CXM_making_a_web_site.anubis | @@ -11,14 +11,15 @@ read calexium_lib/web/CXM_making_a_web_site.anubis | ||
| 11 | read tools/printable_tree.anubis | 11 | read tools/printable_tree.anubis |
| 12 | read tools/basis.anubis | 12 | read tools/basis.anubis |
| 13 | 13 | ||
| 14 | -public define List(HTML_Head_Tag) | 14 | +/* jQuery default js files */ |
| 15 | +define List(HTML_Head_Tag) | ||
| 15 | jquery_defaults | 16 | jquery_defaults |
| 16 | = | 17 | = |
| 17 | [ | 18 | [ |
| 18 | - js(js_file("js/jquery/jquery-1.8.0.min.js")), | ||
| 19 | - js(js_file("js/jquery/jquery-ui-1.8.23.custom.min.js")), | 19 | + js(js_file("/js/jquery/jquery-1.8.0.min.js")), |
| 20 | + js(js_file("/js/jquery/jquery-ui-1.8.23.custom.min.js")), | ||
| 20 | ]. | 21 | ]. |
| 21 | - | 22 | + |
| 22 | /* Initialize jQuery in compatiblity mode with jQueryUI */ | 23 | /* Initialize jQuery in compatiblity mode with jQueryUI */ |
| 23 | public define List(HTML_Head_Tag) | 24 | public define List(HTML_Head_Tag) |
| 24 | jquery_init | 25 | jquery_init |
| @@ -28,9 +29,7 @@ public define List(HTML_Head_Tag) | @@ -28,9 +29,7 @@ public define List(HTML_Head_Tag) | ||
| 28 | ) | 29 | ) |
| 29 | = | 30 | = |
| 30 | if file_exists(web_dir+"/css/jquery/"+theme_name+"/jquery-ui-1.8.23.custom.css") then | 31 | if file_exists(web_dir+"/css/jquery/"+theme_name+"/jquery-ui-1.8.23.custom.css") then |
| 31 | - [ css(css_file("css/jquery/"+theme_name+"/jquery-ui-1.8.23.custom.css")) . jquery_defaults ] | 32 | + [ css(css_file("/css/jquery/"+theme_name+"/jquery-ui-1.8.23.custom.css")) . jquery_defaults ] |
| 32 | else | 33 | else |
| 33 | - [ css(css_file(web_dir+"/css/jquery/redmond/jquery-ui-1.8.23.custom.css")) . jquery_defaults ] | 34 | + [ css(css_file("/css/jquery/redmond/jquery-ui-1.8.23.custom.css")) . jquery_defaults ] |
| 34 | . | 35 | . |
| 35 | - | ||
| 36 | - |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: Jeremy | ||
| 4 | + * Date: 04/09/2012 | ||
| 5 | + * Time: 16:19 | ||
| 6 | + * | ||
| 7 | + * To change this template use Tools | Options | Coding | Edit Standard Headers. | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +read calexium_lib/web/CXM_making_a_web_site.anubis | ||
| 11 | +read tools/basis.anubis | ||
| 12 | + | ||
| 13 | +public type JQuery_tab: | ||
| 14 | + jQuery_tab(String title, HTML_Off_Form content) | ||
| 15 | +. | ||
| 16 | + | ||
| 17 | + | ||
| 18 | +define HTML_Partial_Content | ||
| 19 | + _jquery_tabs | ||
| 20 | + ( | ||
| 21 | + String tabs_container_id, | ||
| 22 | + List(JQuery_tab) tabs, | ||
| 23 | + String tabs_titles, | ||
| 24 | + List(HTML_Off_Form) tabs_contents, | ||
| 25 | + Int count | ||
| 26 | + ) | ||
| 27 | + = | ||
| 28 | + if tabs is | ||
| 29 | + { | ||
| 30 | + [ ] then | ||
| 31 | + partial_content( | ||
| 32 | + [], | ||
| 33 | + sequence([ | ||
| 34 | + literal("<ul>"+tabs_titles+"</ul>"), | ||
| 35 | + sequence(reverse(tabs_contents)) | ||
| 36 | + ]) | ||
| 37 | + ), | ||
| 38 | + [ h . t ] then | ||
| 39 | + if h is jQuery_tab(title, content) then | ||
| 40 | + _jquery_tabs( | ||
| 41 | + tabs_container_id, | ||
| 42 | + t, | ||
| 43 | + tabs_titles + "<li><a href=\"#"+tabs_container_id+"-tab-"+count+"\">"+title+"</a></li>", | ||
| 44 | + [ | ||
| 45 | + sequence([ | ||
| 46 | + literal("<div id=\""+tabs_container_id+"-tab-"+count+"\">"), | ||
| 47 | + content, | ||
| 48 | + literal("</div>") | ||
| 49 | + ]) | ||
| 50 | + . | ||
| 51 | + tabs_contents | ||
| 52 | + ], | ||
| 53 | + count+1 | ||
| 54 | + ) | ||
| 55 | + } | ||
| 56 | + . | ||
| 57 | + | ||
| 58 | + | ||
| 59 | +public define HTML_Partial_Content | ||
| 60 | + jquery_tabs | ||
| 61 | + ( | ||
| 62 | + String tabs_container_id, | ||
| 63 | + List(JQuery_tab) tabs | ||
| 64 | + ) | ||
| 65 | + = | ||
| 66 | + if _jquery_tabs(tabs_container_id, tabs, "", [], 0) is partial_content(tags, html) then | ||
| 67 | + partial_content( | ||
| 68 | + [ | ||
| 69 | + js_inline(script("", "$(document).ready(function(){$('#"+tabs_container_id+"').tabs();});")) | ||
| 70 | + . | ||
| 71 | + tags | ||
| 72 | + ], | ||
| 73 | + sequence([ | ||
| 74 | + literal("<div id=\""+tabs_container_id+"\">"), | ||
| 75 | + html, | ||
| 76 | + literal("</div>") | ||
| 77 | + ]) | ||
| 78 | + ) | ||
| 79 | + . | ||
| 80 | + |