Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conflicts:
	public/stylesheets/application.css
  • Loading branch information
btelles committed Dec 12, 2010
2 parents 59afe95 + c963642 commit 8b7a9a9
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 403 deletions.
2 changes: 1 addition & 1 deletion app/controllers/motions_controller.rb
Expand Up @@ -9,7 +9,7 @@ def index

# List Motions that are closed (passed, failed, approved)
def closed
@motions = Motion.closed_state.where('id >= ?', params[:id] || 1).order('created_at DESC')
@motions = Motion.closed_state.where('id >= ?', params[:id] || 1).order('created_at DESC').limit(6)
end

# Start a new Motion
Expand Down
11 changes: 5 additions & 6 deletions app/helpers/motions_helper.rb
Expand Up @@ -24,18 +24,17 @@ def render_motion_list(motions, &block)
motions.each do |motion|
haml_concat(render(:partial => 'motions/list_item', :locals => { :motion => motion }))
end

if link = link_to_more_motions(motions)
haml_tag(:li, link)
end
end
end
haml_concat(link_to_more_motions(motions))
end

def link_to_more_motions(motions)
if motions.count > motions.size
content_tag(
:div,
link_to('More', show_more_motions_path, :class => 'more_motions quick-tool', :'data-last-id' => motions.last.id),
:class => 'more_motions'
)
link_to('More', show_more_motions_path, :class => 'more_motions quick-tooling', :'data-last-id' => motions.last.id)
end
end
end
91 changes: 70 additions & 21 deletions app/stylesheets/application.scss
Expand Up @@ -221,28 +221,34 @@ div.more_motions {


.current-motions {
section {
margin: 10px 0 20px;
padding: 8px;
@include border-radius(5px);
background-color: #f8f8f8;
}

h2 {
margin-top: 18px;
padding: 4px 10px 1px;
font-size: 1.7em;
color: #333;
background-color: #f0f0f0;
margin: 10px;
font-size: 2.2em;
font-weight: normal;
color: #555;
}

div.empty {
padding: 10px;
border: 1px solid #f0f0f0;
ul, div.empty {
@include border-radius(3px);
border: 2px solid #e9e9e9;
background-color: #fff;
font-size: 1.7em;
}

ul {
border: 1px solid #f0f0f0;
border-bottom: 0;
margin: 0 0 5px;
div.empty {
padding: 20px;
}


li {
padding: 1em;
padding: 20px;
border-bottom: 1px solid #f0f0f0;

&.odd {
Expand All @@ -262,7 +268,7 @@ div.more_motions {
}

a {
font-size: 1.75em;
font-size: 1.2em;
text-decoration: none;

&.plus {
Expand All @@ -277,17 +283,21 @@ div.more_motions {
}
}

span.meta {
font-size: 1.25em !important;
a.more_motions {
display: block;
width: 100%;
text-align: center;
}

p.author {
font-size: 1.1em;
color: #80a080;

strong { font-weight: bold }
}

p {
p.description {
color: #b8b8b8;
font-style: italic;
font-weight: normal;
font-size: 1.25em;
margin: .25em 0 0;
}
}
}
Expand All @@ -306,6 +316,7 @@ div.more_motions {

nav.main ul {
float: right;
height: 40px;

li {
margin-top: 5px;
Expand Down Expand Up @@ -337,3 +348,41 @@ nav.main ul {

/* @end */

/* @group Flash alerts & Validation Errors */

#flash_notice {
margin: 10px 20px;
clear: both;
background: #FFFECF;
border: 2px solid #DCDA00;
font-size: 14px;
text-align: center;
padding: 5px 20px;
color: #5F5F5F;
}

#flash_alert {
margin: 10px 20px;
clear: both;
background: #FFEEEE;
border: 2px solid red;
font-size: 14px;
text-align: center;
padding: 5px 20px;
color: red;
}

#error_explanation {
background: #FBB;
border: 2px solid red;
color: #585858;
padding: 20px;
font-size: 12px;
margin: 20px;
}

#error_explanation ul { margin: 0; }
#error_explanation h2 { font-size: 14px;}
#error_explanation h3 { font-size: 12px;}

/* @end */
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.haml
Expand Up @@ -50,6 +50,8 @@
%li=link_to 'Sign out', sign_out_path
-else
%li=link_to 'Sign in', sign_in_path
- flash.each do |name, msg|
=content_tag :div, msg, :id => "flash_#{name}"
%div.inner-content
=yield
#jq-footer.jq-clearfix
Expand Down
10 changes: 5 additions & 5 deletions app/views/motions/_list_item.html.haml
@@ -1,6 +1,6 @@
%li{ html_attrs_for_motion(motion) }
=link_to %Q{"#{motion.title}"}, motion_events_url(motion)
%span.meta
by #{motion_creator_display_name(motion)}
%p
=truncate(motion.description)
=link_to motion.title, motion_events_url(motion)
%p.author
by
%strong #{motion_creator_display_name(motion)}
%p.description= truncate(motion.description, :length => 200)
4 changes: 3 additions & 1 deletion app/views/motions/show_more.js.erb
@@ -1,4 +1,6 @@
<% @motions.each do |motion| %>
<%= render(:partial => 'motions/list_item', :locals => { :motion => motion }) %>
<% end %>
<%= link_to_more_motions(@motions) %>
<% if link = link_to_more_motions(@motions) %>
<li><%= link %></li>
<% end %>
14 changes: 14 additions & 0 deletions features/member_session_validation.feature
@@ -0,0 +1,14 @@
Feature: Member sign in validations
As an active member
I want see error messages if the signin fails
So that I know what I've done wrong

Background:
Given there is an active member with email "TestMan42@example.com" and password "secret"
And I am on the sign in page

Scenario: I type incorrect credentials
When I fill in "Email" with "TestMan41@example.com"
And I fill in "Password" with "fail"
And I press "Sign in"
Then I should see "Invalid email or password."
9 changes: 1 addition & 8 deletions public/javascripts/application.js
Expand Up @@ -6,15 +6,8 @@ $(document).ready(function(){
var self = $(this);
var data = {id: self.attr('data-last-id')};
var ul = self.closest("section").find("ul");
self.remove();
self.parent().remove();
$.get("/motions/show_more", data, function(html) {
var divIndex = html.indexOf('<div');
if (divIndex > 0) {
// pull out the More link if it exists and append it outside the UL
var moreHTML = html.substring(divIndex);
html = html.replace(/<div.*<\/div>/, '');
$(ul).after(moreHTML);
};
$(ul).append(html);
});
e.preventDefault();
Expand Down

0 comments on commit 8b7a9a9

Please sign in to comment.