Skip to content

Commit

Permalink
Added nonzero theme from http://oswd.org/
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Jul 21, 2008
1 parent 8917c5c commit 5c28376
Show file tree
Hide file tree
Showing 14 changed files with 435 additions and 110 deletions.
3 changes: 2 additions & 1 deletion app/controllers/sessions.rb
@@ -1,5 +1,6 @@
class Sessions < Application
# provides :xml, :yaml, :js
provides :json
does_not_provide :html

def index
@sessions = Session.all
Expand Down
8 changes: 4 additions & 4 deletions app/helpers/global_helpers.rb
@@ -1,7 +1,7 @@
module Merb

module GlobalHelpers

@@views = {
:jquery => [
"core",
Expand All @@ -20,13 +20,13 @@ module GlobalHelpers
"dashboard"
]
}

def javascripts_for(view)
@@views[view].collect do |file|
"<script type=\"text/javascript\" src=\"/javascripts/#{view}/#{file}.js\"></script>"
end.join("\n")
end

def templates_for(*namespaces)
namespaces.to_a.collect do |namespace|
Dir["#{Merb.root}/app/views/#{namespace}/*.jqt"].map { |file| File.read(file) }.join("\n")
Expand Down
17 changes: 11 additions & 6 deletions app/views/events/events.jqt
@@ -1,13 +1,18 @@
<script type="text/x-jquery-template" title="events">
<h1>Events</h1>
<h4>Events</h4>
<ul class="links events">
<% $.each(_context, function(index, event){ %>
<div class="event" event_id="<%= event.id %>"><%= event.name %></div>
<li class="event" event_id="<%= event.id %>">
<a href="#event-<%= event.name %>"> <%= event.name %> </a>
</li>
<% }); %>
</ul>
</script>

<script type="text/x-jquery-template" title="event">
<h1>Event <%= name %></h1>
<p><%= description %></p>

<%= partial("sessions", sessions) %>
<div class="post">
<h3>Event <%= name %></h3>
<p><%= description %></p>
</div>
<%= partial("sessions", sessions) %>
</script>
52 changes: 51 additions & 1 deletion app/views/layout/application.html.erb
@@ -1,13 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
<title>Fresh Merb App</title>
<title>Ruby DCa(m)p</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<%= javascripts_for(:jquery) %>
<%= javascripts_for(:app) %>
<link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8" />
</head>
<body>
<div id="header">

<div id="header_inner" class="fluid">
<span class="logout">[logout]</span>
<div id="logo">
<h1><span>OC</span></h1>
<h2>Opinionated Conferences</h2>
</div>

<div id="menu">
<ul>
<li><a href="#" class="active">Events</a></li>
<li><a href="#">People</a></li>
<li><a href="#">Resources</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>

</div>
</div>

<div id="main">

<div id="main_inner" class="fluid">

<div id="primary_content">

<div id="left_column">

</div>

</div>

<div id="secondary_content">

<div id="right_column">

</div>

</div>

<br class="clear" />

</div>

</div>

<div id="footer" class="fluid">
Copyright &copy; 2008-<%= Time.now.year %> OC <a href="http://www.rubydcamp.com/">snark</a>.
</div>
<%= templates_for(:events,:sessions,:comments) %>
</body>
</html>
6 changes: 3 additions & 3 deletions config/router.rb
Expand Up @@ -21,9 +21,9 @@

Merb.logger.info("Compiling routes...")
Merb::Router.prepare do |router|
router.resources :events #do |event|
# event.resources :sessions
# end
router.resources :events do |event|
event.resources :sessions
end
router.resources :sessions
router.match('/').to(:controller => "dashboard", :action => "index")
end
Binary file added public/images/themes/nonzero/n1.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/themes/nonzero/n2.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/themes/nonzero/n3.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/themes/nonzero/n4.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/themes/nonzero/n5.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/themes/nonzero/n6.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/themes/nonzero/spacer.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 17 additions & 6 deletions public/javascripts/app/dashboard.js
@@ -1,23 +1,34 @@
function dashboard () {
$("span.logout").click(function() { logout(); });
$("body").append($("<div/>").attr("id","events"));
$("span.logout").click(logout);
$("div#right_column").append($("<div/>").attr("id","events"));
display_events();
}

function display_events() {
$.getJSON("/events", null, function(events) {
$("#events").empty();
$("#events").append($.pageTemplates["events"](events));
$("#events div.event").click(function() { display_event($(this).attr("event_id")); });
$("div#events").empty();
$("div#events").append($.pageTemplates["events"](events));
$("div#events li.event").click(function() { display_event($(this).attr("event_id")); });
});
}

function display_event (event_id) {
$.getJSON("/events/" + event_id, null, function(event) {
$("body").append(
$("div#left_column").empty().append(
$("<div/>").attr("id","event-" + event.id).append(
$.pageTemplates["event"](event)
)
);
display_sessions_for_event(event_id);
});
}

function display_sessions_for_event(event_id) {
$.getJSON("/events/" + event_id + "/sessions", null, function(sessions) {
$("div#event-" + event_id).append(
$("<div/>").attr("id","sessions").append(
$.pageTemplates["sessions"](sessions)
)
);
});
}

0 comments on commit 5c28376

Please sign in to comment.