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

This commit is contained in:
Brian Smith 2012-11-18 16:52:26 -05:00
commit 98c6ad0bb0
16 changed files with 167 additions and 57 deletions

17
Gemfile
View File

@ -1,7 +1,20 @@
#ruby=1.9.3
source 'https://rubygems.org'
source 'https://jamjam:blueberryjam@www.jamkazam.com/gems/'
# Look for $WORKSPACE, otherwise use "workspace" as dev path.
workspace = ENV["WORKSPACE"] || "~/workspace"
devenv = ENV["BUILD_NUMBER"].nil? # Jenkins sets a build number environment variable
if devenv
gem 'jam_db', :path=> "#{workspace}/jam-db/target/ruby_package"
gem 'jampb', :path => "#{workspace}/jam-pb/target/ruby/jampb"
gem 'jam_ruby', :path => "#{workspace}/jam-ruby"
else
gem 'jam_db'
gem 'jampb'
gem 'jam_ruby'
end
gem 'rails', '3.2.8'
gem 'jquery-rails', '2.0.2'
@ -13,10 +26,6 @@ gem 'bootstrap-will_paginate', '0.0.6'
gem 'uuidtools', '2.1.2'
gem 'ruby-protocol-buffers', '1.2.2'
#gem 'pg_migrate','0.1.6' #:path => "#{workspace}/pg_migrate_ruby"
gem 'jam_db', :path => "#{workspace}/jam-db/target/ruby_package"
gem 'jam_ruby', :path => "#{workspace}/jam-ruby"
gem 'jampb', :path => "#{workspace}/jam-pb/target/ruby/jampb"
gem 'pg', '0.14.0'
gem 'compass-rails'
gem 'rabl' # for JSON API development

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>

39
build Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
echo "updating dependencies"
bundle update
if [ "$?" = "0" ]; then
echo "success: updated dependencies"
else
echo "could not update dependencies"
exit 1
fi
echo "running rspec tests"
bundle exec rspec
if [ "$?" = "0" ]; then
echo "success: ran rspec tests"
else
echo "running rspec tests failed."
exit 1
fi
echo "running jasmine tests"
#http://shortforgilbert.com/blog/2011/03/25/headless-jasmine-ci
# TODO starting Xvfb here because we don't do this on start of build server
# If you run it once, it will background/nohup itself, so this is 'lazy'
Xvfb :99 -screen 0 1440x900x16 > /dev/null 2>&1 &
# run jasmine using the virtual screen, and in the test environment to use the jam_web_test db
DISPLAY=":99" rake jasmine:ci RAILS_ENV=test
if [ "$?" = "0" ]; then
echo "success: jasmine tests completed"
else
echo "running jasmine tests failed"
exit 1
fi
echo "build complete"

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'

15
jenkins Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
echo "starting build..."
./build
if [ "$?" = "0" ]; then
echo "build succeeded"
echo "TODO: build debian package"
else
echo "build failed"
exit 1
fi

BIN
public/fb-signup-button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

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"

View File

@ -6,6 +6,7 @@ require 'spork'
require 'active_record'
require 'action_mailer'
require 'jam_db'
require 'jam_ruby'
require 'spec_db'
include JamRuby