-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobile.erl
54 lines (49 loc) · 1.57 KB
/
mobile.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%% -*- mode: nitrogen -*-
%% vim: ts=4 sw=4 et
-module(mobile).
-include_lib("nitrogen_core/include/wf.hrl").
-include("records.hrl").
-compile(export_all).
-author("Jesse Gumm ([email protected])").
main() -> #template{file="./site/templates/plugins/nitrogen_jqm/mobile.html"}.
title() -> "Nitrogen Web Framework - Mobile Sample".
body() ->
[
"If you can see this, then your Nitrogen installation is working.",
#p{},
"Go ahead and enable the sample menu below to test postbacks and links",
#p{},
#mobile_toggle{
on_text="Menu Visible",
off_text="Menu Hidden",
selected="off",
postback=toggle_menu,
id=menu_on,
width=200
},
#p{},
#mobile_list{
id=menu,
theme=a,
inset=true,
style="display:none",
body=[
#mobile_list_divider{class=c, text="Sample Mobile Menu"},
mobile_list_link("Non-mobile Sample Page","/"),
mobile_list_link("Nitrogen Home","http://nitrogenproject.com"),
mobile_list_link("jQuery Mobile Home","http://jquerymobile.com"),
mobile_list_link("Erlang Home","http://erlang.org")
]
}
].
mobile_list_link(Text,URL) ->
#mobile_listitem{
theme=c,
body=#link{text=Text, url=URL, mobile_target=false}
}.
event(toggle_menu) ->
ShowMenu = wf:q(menu_on),
case ShowMenu of
"on" -> wf:wire(menu,#appear{});
"off" -> wf:wire(menu,#fade{})
end.