Permalink
Browse files

refactoring of ux

  • Loading branch information...
1 parent 6011006 commit 8e4300c108095990adf87962b2741cf6423cf390 Matt Van Horn committed Jan 6, 2012
@@ -131,11 +131,13 @@ form {
.topbar-inner, .topbar .fill {
background-color: $spooky_blue;
}
-
+a {
+ text-decoration: underline;
+}
.pills a {
margin: 3px 3px 3px 0;
+ text-decoration: none;
}
-
-a {
- text-decoration: underline;
+a.btn {
+ text-decoration: none;
}
@@ -130,4 +130,13 @@ ul.filter {
#page-header {
@include offset(1);
margin-top: $baseline * 2;
+}
+
+#send-link {
+ @include offset(1);
+ @include columns(22);
+ form {
+ padding-top: $baseline;
+ @include columns(22);
+ }
}
@@ -9,7 +9,8 @@ class SessionsController < ApplicationController
def create
user = User.find_from_hash(auth_hash)
sign_in user
- redirect_back_or_default
+ fallback = user.projects.any? ? projects_path : new_project_path
+ redirect_back_or_default(fallback)
end
def failure
@@ -39,7 +39,7 @@ def raw_data
end
def first_day
- (raw_data.keys.first || @today).utc
+ raw_data.keys.first || @today
end
def total_days
@@ -125,13 +125,16 @@
}, setPopOvers );
}
- setActivePill($('#no-filter'));
+ setActivePill($('#user-filter'));
+ $('li.project').hide();
+ $('li.project.mine').show();
+
setActivePill($('#age-sorter'));
// attempt to call Quicksand on pill clicks
$('#age-sorter' ).click( function(){updateList($(this))} );
$('#mood-sorter').click( function(){updateList($(this))} );
$('#size-sorter').click( function(){updateList($(this))} );
$('#user-filter').click( function(){updateList($(this))} );
$('#no-filter' ).click( function(){updateList($(this))} );
-
+ $('#user-filter').click();
});
@@ -11,35 +11,41 @@
#niko-niko
#calendar
- history = project.mood_history
+
- if history.number_of_days < 7
+
- (7 - history.number_of_days).times do
%ul.column
%li.date No Data
- history.days.each do |day|
- %ul.column{:class => ('current' if day.to_date == Time.now.to_date)}
- %li.date #{day.to_date}
+ %ul.column{:class => ('current' if day.in_time_zone.to_date == Time.now.to_date)}
+ %li.date
+ #{day.to_date}
- project.mood_history.on(day).each do |mood_update|
- %li{:'data-date' => day.to_s, :class => mood_update.try(:mood)}
+ %li[mood_update]{:'data-date' => day.to_s, :class => mood_update.try(:mood)}
= mood_update.try(:mood)
#prev prev
#next next
- if user_signed_in? && current_user.member_of?(project)
.row.project-actions
= link_to t('nav.invite_member'), new_project_invitation_path(project), :class => %w(btn default)
- = link_to t('nav.update_mood'), new_project_mood_update_path(project), :class => %w(btn default)
+ = link_to t('nav.update_mood'), new_project_mood_update_path(project), :class => %w(btn primary)
.row
- = form_tag project_links_path, :id => 'send-link-form' do |f|
- %fieldset
+ #send-link
+ = form_tag project_links_path, :id => 'send-link-form' do |f|
- .clearfix.string.required
- = label_tag(:email, t(".email"), :class => 'required')
- .input
- = text_field_tag(:email, '', :required => 'required', :class => 'required')
- = hidden_field_tag :project_id, project.id
- .actions
- = submit_tag t('.send_link'), :class => 'btn primary create'
+ %fieldset
+ %legend Send Link
+ .clearfix.string.required
+ = label_tag(:email, t(".email"), :class => 'required')
+ .input
+ = text_field_tag(:email, '', :required => 'required', :class => 'required')
+ %span.help-inline Use this form to send a link to someone, anonymously.
+ = hidden_field_tag :project_id, project.id
+ .actions
+ = submit_tag t('.send_link'), :class => 'btn create'
:javascript
$(document).ready(function() {
@@ -1,4 +1,5 @@
-%h1#page-header.row= t('.page_header')
+.row
+ %h1= t('.page_header')
-if flash[:alert]
.alert-message.error= flash[:alert]
@@ -36,7 +36,7 @@ class Application < Rails::Application
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
- # config.time_zone = 'Central Time (US & Canada)'
+ config.time_zone = 'Pacific Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
@@ -15,6 +15,6 @@ Feature: See my projects
Given I am on the home page
When I click on "Projects"
Then I should be on the projects page
- And I should see exactly 4 projects
- When I click on "Only Mine"
- Then I should see exactly 1 project
+ And I should see exactly 1 project
+ When I click on "All"
+ Then I should see exactly 4 projects
@@ -18,7 +18,7 @@ Feature: User Sign In
Scenario: Signing in
When I sign in
- Then I should be on the homepage
+ Then I should be on the new project page
And I should see a link to the sign-out page
Scenario: Signing in redirects back to page
@@ -2,25 +2,30 @@
describe SessionsController do
describe "#create" do
+ let(:user){ mock_model(User, :projects => []) }
before(:each) do
- @mock_user = mock_model(User)
- @mock_user = mock_model(User, :user => @mock_user)
- User.stub(:find_from_hash).and_return(@mock_user)
+ User.stub(:find_from_hash).and_return(user)
end
it "identifies the authenticated user" do
- User.should_receive(:find_from_hash).and_return(@mock_user)
+ User.should_receive(:find_from_hash).and_return(user)
get :create, :provider => 'identity'
end
it "signs in the authenticated user as the current user" do
- controller.should_receive(:sign_in).with(@mock_user)
+ controller.should_receive(:sign_in).with(user)
get :create, :provider => 'identity'
end
- it "redirects to the home page" do
+ it "redirects to the new projects page if the user has no projects" do
get :create, :provider => 'identity'
- response.should redirect_to(root_url)
+ response.should redirect_to(new_project_url)
+ end
+
+ it "redirects to the projects page if the user has any projects" do
+ user.stub(:projects => [mock_model(Project)])
+ get :create, :provider => 'identity'
+ response.should redirect_to(projects_url)
end
end

0 comments on commit 8e4300c

Please sign in to comment.