Commits

Anonymous committed 2bd8f3c

Adding theme support.

  • Participants
  • Parent commits 869046a

Comments (0)

Files changed (4)

File src/redhot2_web_projects.erl

 	 , event/1
 	]).
 
+-import(redhot2_common, [logo_text/0]).
+
 
 main() ->
     #template { file="./templates/grid.html" }.
         ++ redhot2_common:logo_text() ++".".
 
 projects() ->
+    Theme = theme_chooser(),
+
     TwId = wf:temp_id(),
     Twitter = twitter(TwId),
     wf:wire(TwId, #event {type=click, postback=twitter, delegate=?MODULE}),
     SpId = wf:temp_id(),
     Sopcast = sopcast(SpId),
     wf:wire(SpId, #event {type=click, postback=sopcast, delegate=?MODULE}),
-    #panel{body=[Twitter,Sopcast]}.
+    #panel{body=[Theme,Twitter,Sopcast]}.
 
 
-event(theme) ->
-    wf:redirect("/theme");
+event({theme, Theme}) ->
+    wf:session(theme, Theme),
+    wf:redirect("/projects");
 event(twitter) ->
     wf:redirect("/twitter");
 event(sopcast) ->
     ?PRINT(Event),
     wf:redirect("/?error_msg").
 
+theme_chooser() ->
+    #panel{body=[#image{image="/images/chili-small.png",class="icon_theme"},
+                 #panel{class="proj_themes", 
+                        body=themes()}]}.
+    
+themes() ->
+    [#panel{body=[#link{class="theme", text="DigitalChili", 
+                        postback={theme,"digitalchili"}, delegate=?MODULE },
+                  " is the (new) default look of "++logo_text()]}
+     , #panel{body=[#link{class="theme", text="WhiteChili", 
+                          postback={theme,"whitechili"}, delegate=?MODULE },
+                    " very similar to the default but more whiteish... "]}
+    ].
+     
 
 twitter(Id) ->
     #panel{body=[#link{body=#image{image="/images/twitter_logo.png",class="icon_twitter"},

File src/redhot2_web_theme.erl

 theme_filename() ->
     case wf:session(theme) of
         "digitalchili" -> "digitalchili.css";
+        "whitechili"   -> "whitechili.css";
         _              -> "digitalchili.css"
     end.
 

File templates/grid.html

     <link rel="alternate" title="RedHotErlang Atom feed" href="http://www.redhoterlang.com/atom" type="application/atom+xml" />
   </head>
   <body>
-    [[[page:layout()]]]
+      [[[page:layout()]]]
 
     <script>
       [[[script]]]

File www/css/digitalchili.css

 html {
-	font-size:75%;
+    font-size:75%;
 }
 
 body {
-	background-color:#eff0e7;
-	margin:0;
-	padding:0;
-	font-family: Verdana,Arial,Helvetica,sans-serif;
-	font-size:1em;
-	line-height:1.6em;
-	color:#595959;
+    background-color:#eff0e7;
+    margin:0;
+    padding:0;
+    font-family: Verdana,Arial,Helvetica,sans-serif;
+    font-size:1em;
+    line-height:1.6em;
+    color:#595959;
 }
 
 h1.header {
 
 .tw_search {padding:0.5em;}
 
+.icon_theme {margin:1em 0 0 -3em; width:10%;}
 .icon_twitter {margin:1em -1em 0 1em; width:10%;}
 .icon_sopcast {margin:1em -1em 0 1em; width:6%;}
 .proj_txt {margin-left:3em; width:65%;}
+.proj_themes {margin:0 0 1em 3em; width:65%;}
 
 .sopcast_sport{padding-bottom: 1em; font-weight:bold; text-decoration:underline;}
 .sopcast_hdr {margin-left:2em; padding: 0.5em 0 0.5em 0; text-decoration:underline;}