Merge branch 'master' of bitbucket.org:jamkazam/jam-web

This commit is contained in:
Seth Call 2012-11-18 11:33:35 -06:00
commit 6ba0f9cc2b
11 changed files with 99 additions and 53 deletions

View File

@ -0,0 +1,23 @@
/**
* Javascript for controlling the landing page.
* This is the page you'll see when you visit the
* client home page without being logged in.
*/
(function(context,$) {
context.JK = context.JK || {};
context.JK.LandingPage = function() {
var logger = context.JK.logger;
logger.debug("Landing Page TODO");
this.initialize = function() {
$('div[layout="landing"]').show();
JK.hideCurtain(400);
};
return this;
};
}(window,jQuery));

View File

@ -10,6 +10,16 @@
(function(context,$) {
context.JK = context.JK || {};
// Static function to hide the 'curtain' which hides the underlying
// stuff until we can get it laid out. Called from both the main
// client as well as the landing page.
context.JK.hideCurtain = function(duration) {
setTimeout(function() {
$('.curtain').fadeOut(2*duration);
}, duration);
};
context.JK.Layout = function() {
// privates
@ -49,19 +59,13 @@
$('[layout="sidebar"]').show();
$('[layout="panel"]').show();
layout();
hideCurtain();
JK.hideCurtain(opts.animationDuration);
}
function setInitialExpandedSidebarPanel() {
expandedPanel = $('[layout="panel"]').first().attr("layout-id");
}
function hideCurtain() {
setTimeout(function() {
$('.curtain').fadeOut(2*opts.animationDuration);
}, opts.animationDuration);
}
function layout() {
width = $(window).width();
height = $(window).height();

View File

@ -15,7 +15,6 @@
return template;
};
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.

View File

@ -82,6 +82,7 @@ label {
}
.notify {
display:none;
background-color: $color8;
color:#000;
overflow:auto;
@ -92,6 +93,7 @@ label {
}
.dialog {
display:none;
background-color:$color8;
border: #666;
color:#000;
@ -158,6 +160,10 @@ label {
background: scale-lightness($color7, 10%);
}
.screen {
display:none;
}
.screen.secondary {
}
.buttonrow, .screen.secondary .footer {

View File

@ -2,9 +2,6 @@ class ClientsController < ApplicationController
include UsersHelper
# have to be signed in currently to see this screen
before_filter :signed_in_user
def index
# use gon to pass variables into javascript
gon.websocket_gateway_uri = Rails.application.config.websocket_gateway_uri

View File

@ -59,12 +59,12 @@ class SessionsController < ApplicationController
def complete_sign_in(user)
sign_in user
redirect_back_or music_sessions_url
redirect_back_or client_url
end
def destroy
sign_out
redirect_to root_url
redirect_to client_url
end
def failure

View File

@ -1,6 +1,16 @@
<div class="curtain"></div>
<div layout="header" class="header">
<h1>JamKazam</h1>
<div class="curtain" style="width:100%; height:100%; z-index:9999; background-color:#ffffff;"></div>
<!-- Shown to users who are not logged in -->
<div layout="landing" class="landing" style="display:none;">
<h1>Welcome to JamKazam!</h1>
<p>This is a landing page for users who haven't registered or signed-in. Marketing text to convince you how great it would be to use the service goes here.</p>
<p>No account? <a href="signup">Register!</a></p>
<p>or <a href="/signin">Sign In</a></p>
</div>
<!-- Normal signed-in user content -->
<div layout="header" class="header" style="display:none;">
<h1>Jamkazam</h1>
<div class="search">
<input type="text" class="searchtextinput" placeholder="Search for Bands, Musicians and Fans"/>
</div>
@ -28,9 +38,9 @@
</script>
<div class="userinfo">
<%= gravatar_for current_user, size: 52, hclass: "avatar medium" %>
<!-- gravatar_for current_user, size: 52, hclass: "avatar medium" -->
<div class="username">
<h2><%= "#{current_user.first_name} #{current_user.last_name}" %></h2>
<h2>TODO Name</h2>
<%= image_tag "down_arrow.png", :class=> "profile-toggle" %>
<ul>
<li><a layout-link="account">Profile</a></li>
@ -66,7 +76,7 @@
</div>
</div>
<div layout="sidebar" class="sidebar">
<div layout="sidebar" class="sidebar" style="display:none;">
<div layout-sidebar-expander="visible" class="expander visible">
<p>&gt;&gt; Hide</p>
</div>
@ -562,29 +572,41 @@
<script type="text/javascript">
$(function() {
JK = JK || {};
var jk = JK.JamKazam();
jk.initialize();
<% if current_user %>
JK.currentUserId = '<%= current_user.id %>';
<% else %>
JK.currentUserId = null;
<% end %>
JK.currentUserId = '<%= current_user.id %>';
if (JK.currentUserId) {
var header = new JK.Header(jk);
header.initialize();
var jk = JK.JamKazam();
jk.initialize();
var homeScreen = new JK.HomeScreen(jk);
homeScreen.initialize();
var header = new JK.Header(jk);
header.initialize();
var createSessionScreen = new JK.CreateSessionScreen(jk);
createSessionScreen.initialize();
var homeScreen = new JK.HomeScreen(jk);
homeScreen.initialize();
var findSessionScreen = new JK.FindSessionScreen(jk);
findSessionScreen.initialize();
var createSessionScreen = new JK.CreateSessionScreen(jk);
createSessionScreen.initialize();
var sessionScreen = new JK.SessionScreen(jk);
sessionScreen.initialize();
var findSessionScreen = new JK.FindSessionScreen(jk);
findSessionScreen.initialize();
var jam_server = JK.JamServer;
jam_server.connect();
var sessionScreen = new JK.SessionScreen(jk);
sessionScreen.initialize();
var jam_server = JK.JamServer;
jam_server.connect();
} else {
var landing = new JK.LandingPage(jk);
landing.initialize();
}
})
</script>

View File

@ -5,7 +5,7 @@
<%= link_to "Jamkazam", root_path, id: "logo" %>
<nav>
<ul class="nav pull-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Home", '/oldhome' %></li>
<li><%= link_to "Help", help_path %></li>
<% if signed_in? %>
<li><%= link_to "Music Sessions", music_sessions_url %></li>

View File

@ -11,7 +11,11 @@ SampleApp::Application.routes.draw do
resources :sessions, only: [:new, :create, :destroy]
root to: 'static_pages#home'
#root to: 'static_pages#home'
root to: 'clients#index'
# This page is still here, and is under test. Keep a route to it.
match '/oldhome', to: 'static_pages#home'
match '/signup', to: 'users#new'
match '/email_sent', to: 'users#email_sent'

View File

@ -34,19 +34,9 @@ describe "Authentication" do
click_button "Sign in"
end
# it now goes to /music_sessions
it { should have_selector('title', text: "Music Sessions") }
it { should have_link('Users', href: users_path) }
it { should have_link('Profile', href: user_path(user)) }
it { should have_link('Settings', href: edit_user_path(user)) }
it { should have_link('Sign out', href: signout_path) }
it { should_not have_link('Sign in', href: signin_path) }
describe "followed by signout" do
before { click_link "Sign out" }
it { should have_link('Sign in') }
end
# Successful sign-in goes to the client
it { should have_selector('title', text: "Jamkazam") }
it { should have_selector('h1', text: "Jamkazam") }
end
end
@ -78,9 +68,10 @@ describe "Authentication" do
click_button "Sign in"
end
it "should render the default (profile) page" do
it "should render the signed-in client page" do
# it now goes to /music_sessions
page.should have_selector('title', text: "Music Sessions")
page.should have_selector('title', text: "Jamkazam")
page.should have_selector('h1', text: "Jamkazam")
end
end
end

View File

@ -5,7 +5,7 @@ describe "Static pages" do
subject { page }
describe "Home page" do
before { visit root_path }
before { visit '/oldhome' }
it { should have_selector('h1', text: 'Jam') }
it { should have_selector('title', text: full_title('')) }
@ -42,7 +42,7 @@ describe "Static pages" do
end
it "should have the right links on the layout" do
visit root_path
visit '/oldhome'
click_link "About"
page.should have_selector 'title', text: full_title('About Us')
click_link "Help"