Skip to content
Permalink
Browse files

Merge branch 'master' into cancan

  • Loading branch information...
bitwelder committed Dec 14, 2010
2 parents e1b7df2 + c0faf2a commit 45b60515f3fd7363fc503c4f4bf84ae7a318e767
Showing with 1,151 additions and 1,081 deletions.
  1. +4 −1 .gitignore
  2. +14 −0 app/controllers/comments_controller.rb
  3. +1 −0 app/controllers/projects_controller.rb
  4. +6 −0 app/helpers/map_helper.rb
  5. +8 −0 app/models/comment.rb
  6. +1 −0 app/models/project.rb
  7. +9 −0 app/models/user.rb
  8. +1 −1 app/views/devise/mailer/reset_password_instructions.html.haml
  9. +8 −4 app/views/homes/_featured_project.html.haml
  10. +3 −0 app/views/layouts/application.html.haml
  11. +2 −1 app/views/pages/_dev_center.html.haml
  12. +2 −2 app/views/pages/_financial_center.html.haml
  13. +7 −3 app/views/pages/_why.html.haml
  14. +20 −0 app/views/projects/_comments.html.haml
  15. +9 −5 app/views/projects/_project.html.haml
  16. +2 −1 app/views/projects/index.html.haml
  17. +10 −10 app/views/projects/show.html.haml
  18. +4 −0 app/views/shared/_progbar.html.haml
  19. +3 −3 config/locales/devise.en.yml
  20. +11 −3 config/locales/en.yml
  21. +2 −0 config/routes.rb
  22. +15 −0 db/migrate/20101211182206_create_comments.rb
  23. +42 −0 features/step_definitions/auth_steps.rb
  24. +5 −0 features/step_definitions/project_steps.rb
  25. +36 −0 features/visitor_comments_on_project.feature
  26. +2 −0 features/visitor_views_project.feature
  27. +2 −2 public/flutie/stylesheets/type.css
  28. BIN public/images/contribute_btn.gif
  29. BIN public/images/contributenow.png
  30. BIN public/images/fund_btn.gif
  31. BIN public/images/fundthisproject.png
  32. +570 −0 public/stylesheets/jquery-ui.css
  33. 0 public/stylesheets/round.css
  34. +38 −0 public/stylesheets/sass/non_round.scss
  35. +229 −58 public/stylesheets/sass/screen.scss
  36. +0 −986 public/stylesheets/screen.css
  37. +42 −0 spec/controllers/comments_controller_spec.rb
  38. +3 −0 spec/controllers/projects_controller_spec.rb
  39. +8 −1 spec/factories.rb
  40. +15 −0 spec/helpers/map_helper_spec.rb
  41. +17 −0 spec/models/comment_spec.rb
@@ -12,4 +12,7 @@ rerun.txt
tags
!.keep
vendor/bundler_gems
.rvmrc
.rvmrc
public/stylesheets/round.css
public/stylesheets/non_round.css
public/stylesheets/screen.css
@@ -0,0 +1,14 @@
class CommentsController < ApplicationController
def create
@comment = Comment.new(params[:comment])
@comment.user = current_user

if @comment.save
redirect_to(:back, :notice => t("comment.create.success"))
else
err_msg = t("comment.create.error")
err_msg += @comment.errors.full_messages.to_sentence
redirect_to(:back, :notice => err_msg)
end
end
end
@@ -5,6 +5,7 @@ def index

def show
@project = Project.find(params[:id])
@comment = Comment.new
end

def my_projects
@@ -0,0 +1,6 @@
module MapHelper
def google_map_image(size, address)
image_tag "http://maps.google.com/maps/api/staticmap?size=#{size}&zoom=12&markers=#{URI.escape(address)}&sensor=false",
:alt => address
end
end
@@ -0,0 +1,8 @@
class Comment < ActiveRecord::Base
belongs_to :project
belongs_to :user

validates_presence_of :body
validates_presence_of :project_id
validates_presence_of :user_id
end
@@ -2,6 +2,7 @@ class Project < ActiveRecord::Base
belongs_to :organization
has_many :project_photos, :foreign_key => :owner_id
has_many :donations
has_many :comments, :dependent => :destroy, :order => 'id DESC'

accepts_nested_attributes_for :project_photos

@@ -7,6 +7,7 @@ class User < ActiveRecord::Base

has_many :donations
has_many :projects, :through => :donations
has_many :comments, :dependent => :destroy

validates_presence_of :email
validates_presence_of :first_name
@@ -42,4 +43,12 @@ def update_with_password(params={})
params.delete(:password_confirmation) if params[:password_confirmation].blank?
update_attributes(params)
end

def full_name
"#{self.first_name} #{self.last_name}"
end

def location
"New York, NY"
end
end
@@ -1,5 +1,5 @@
%p
= t('device.common.hello')
= t('Hello')
= @resource.email
\!
%p= t('.reset_password_instruction')
@@ -2,14 +2,18 @@
.featured_thumbnail
= link_to image_tag(featured_project.photo_url(:full)), project_path(featured_project) unless featured_project.photo.nil?
.featured_project_info
%h1= link_to featured_project.name, project_path(featured_project)
%h2= link_to featured_project.name, project_path(featured_project)
%h4= featured_project.organization_name
%h5= featured_project.requestor
%p= truncate(featured_project.description, :length => 150)
%p.raised=t '.raised', :percentage => featured_project.percent_raised, :goal => number_to_currency(featured_project.goal)
%p= truncate(featured_project.description, :length => 50)
%br
%div{:id => ['pb', featured_project.id]}
#progressbar
=render :partial => 'shared/progbar', :object => featured_project
.featured_raised=t '.raised', :percentage => number_to_percentage(featured_project.percent_raised, :precision => 0), :goal => number_to_currency(featured_project.goal, :precision => 0)
= amazon_simple_pay_form_tag do
= text_field_tag 'amount'
= hidden_field_tag 'referenceId', featured_project.id
= hidden_field_tag 'description', featured_project.name
= image_submit_tag('/images/contribute_btn.gif', :id => 'contribute_now_btn', :alt=> t('.fund_this_project'))
= image_submit_tag('/images/contributenow.png', :id => 'contribute_now_btn', :alt=> t('.fund_this_project'))
.clear
@@ -3,8 +3,11 @@
%head
%meta{ :charset => "utf-8" }/
%title ReliefHub
= stylesheet_link_tag 'jquery-ui'
= stylesheet_link_tag :flutie, 'screen', :media => 'all'
= csrf_meta_tag
-# This include is to fix a strange issues where the progress bar wasn't rendering properly
= javascript_include_tag 'jquery'
%body.body_class
#wrapper
= render :partial => 'shared/header'
@@ -1,2 +1,3 @@
%h2 Development Center
%p In our best efforts to remain totally transparent, we hope to provide our users with a visible and streamlined experience when choosing our platform. Beyond our users, we aim to provide the source to our web-based funding framework so that others in the development community may view and apply it in areas that we alone cannot reach. By remaining open source, we hope to inspire and perpetuate world-wide relief for all those outside of our grasp. Our ultimate goal is to provide a solution and there is no better means of creating positive change than creating it together. We invite all prospects to discuss our framework either with us personally or with any other audience so that we may continue to improve and develop our foundation for the better.
%p When a developer, or set of developers, contributes code to the collective commons, society benefits. The ReliefHub open source community has developed a helpful kind of software and is happy to share it with the development community. In our best efforts to remain totally transparent, we hope to provide our users with a visible and streamlined experience when choosing our platform.
Beyond our users, we aim to provide the source to our web-based funding framework so that others in the development community may view and apply it in areas that we alone cannot reach. By remaining open source, we hope to inspire and perpetuate world-wide relief for all those outside of our grasp. Our ultimate goal is to provide a solution and there is no better means of creating positive change than creating it together. We invite all prospects to discuss our framework either with us personally or with any other audience so that we may continue to improve and develop our foundation for the better.
@@ -1,3 +1,3 @@
%h2 Financial Center
%p As a user, it is crucial that you know and understand how the funds you give are handled and dispersed. In our continued aim to maintain total transparency, we will provide a fluid means of tracking and understanding the processes surrounding our donation framework. Here you will be able to track an organized arrangement of the projects you have contributed to along with logs and bullet points on how your funds were used in the aid of others.
Users reap the ability to review and maintain records of all their financial data regarding ReliefHub via the user dashboard. Alongside this, periodic progress reports and updates detailing the congregated effort to spread relief will disperse monthly.
%p As a user, it is crucial that you know and understand how the funds you give are handled and dispersed. In our continued aim to maintain total transparency, we will provide a fluid means of tracking and understanding the processes surrounding our donation framework. Here in the ReliefHub Financial Center you will be able to track an organized arrangement of the projects you have contributed to along with specific information on how your funds were used in the aid of others.
Our goal is to make your contributions absolutely visible by publishing our detailed budgets and financial data on our website for everyone to review. Users reap the ability to review and maintain records of all their financial data regarding ReliefHub via the user dashboard. Alongside this, periodic progress reports and updates detailing the collective effort to spread relief will be dispersed monthly.
@@ -1,14 +1,18 @@
%h1 Why ReliefHub
%p ReliefHub is unique because it is built on the following guiding principles:
%br
%span.bold
1. Community Influenced Decision Making
%p Working with our community we will run ReliefHub similar to Wikipedia so individuals can give feedback and influence the decision making process.
%br
%span.bold
2. Self-Sustaining
%p Our goal is to become self-sustaining by our 5th birthday. We will work with our community to develop the best plan for achieving this goal.
%p Our goal is to become self-sustaining by our 5th birthday. We will continuously work with our community to develop the best approach possible in order to allow our framework to remain largely effective while requiring minimal resources.
%br
%span.bold
3. Total Transparency
%p Ever wonder what happens to your dollars after you make a donation? Our goal is make it absolutely visible by publishing our detailed budgets and financials on our website for everyone to review.
%p Ever wonder what happens to your dollars after you make a donation? Our goal is to make it completely visible by publishing our detailed budgets and financial reports on our website for everyone to review. We aim to leave no trail of ambiguity between your generosity and those which YOU want to reach out to but rather play a mere vessel for such acts of selflessness.
%br
%span.bold
4. Open Source
%p We leverage open source technologies to build ReliefHub.org and will share all of our innovations including processes, product roadmap, and software so others in the non-profit community can benefit.
%p We leverage open source technologies to build and maintain ReliefHub.org and will share all of our innovations including processes, product roadmap, and software so others in the non-profit community can benefit and build from our platform.
@@ -0,0 +1,20 @@
#comment_section
#comment_form
#comment_section_head Comments
- if !user_signed_in?
Sign in to leave a comment
- if user_signed_in?
= semantic_form_for [@comment] do |f|
= f.inputs do
= f.input :body
= f.input :project_id, :as => :hidden, :value => @project.id
.right
= f.commit_button
.comments
- @project.comments.each do |comment|
.comment
.comment_body
= "\"#{comment.body}\""
%span.comment_author #{comment.user.full_name}
%span.comment_author_location #{comment.user.location}
.clear
@@ -1,15 +1,19 @@
%li.project
.summary
= link_to image_tag(project.photo_url(:small)), project_path(project) unless project.photo.nil?
= link_to 'Fund this Project', project_path(project), :class => 'button'
%h3= link_to project.name, project_path(project)
%h4= project.organization_name
%h5= project.requestor
%p= truncate project.description, :length => 150
%p= link_to 'Learn more...', project_path(project)
%p= truncate project.description, :length => 75
.learn_more= link_to 'Learn more...', project_path(project)
%br
.raised== #{number_to_percentage(project.percent_raised, :precision => 0)} of #{number_to_currency(project.goal)} raised
%div{:id => ['pb', project.id]}
#progressbar
=render :partial => 'shared/progbar', :object => project
%br
= amazon_simple_pay_form_tag do
= text_field_tag 'amount'
= text_field_tag 'amount'
= hidden_field_tag 'referenceId', project.id
= hidden_field_tag 'description', project.name
= image_submit_tag('/images/contribute_btn.gif')
= image_submit_tag('/images/fundthisproject.png')
@@ -1,6 +1,7 @@
.right=link_to('Give to Any Project', :class => 'button')
%h2 Projects
.projects
%ul=render @projects
.clear
.pagination
%ul=will_paginate @projects
.clear
@@ -1,7 +1,8 @@
#col_left
- if @project.photo
#project_photo= image_tag(@project.photo_url(:small))
=# #project_map
#project_map
= google_map_image("146x146", @project.organization_address)
#project_information
%h1= @project.name
%h3= @project.organization_name
@@ -11,8 +12,9 @@
%p Funds Purpose: #{@project.funds_purpose}
%p Funding Needed: #{number_to_currency(@project.goal, :precision => 0)}
%p Funding Received: #{number_to_currency(@project.amount_raised, :precision => 0)}
#project_percent_raised
I am the percent raised
%div{:id => ['pb', @project.id]}
#progressbar
=render :partial => 'shared/progbar', :object => @project
.clear
#percent_raised_number
#{number_to_percentage(@project.percent_raised, :precision => 0)} Raised
@@ -33,14 +35,8 @@
%a.addthis_button_facebook_like{ "fb:like:layout" => "button_count" }
%a.addthis_button_tweet
%script{ :type => "text/javascript", :src => "http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4cfc4db62e7d6471" }
=#.testimonials Lorem Ipsum is simply dummy text of the printing and typesetting industry.
=#%span.testimonial_name John Smith
=#%span.test_location New York, NY, USA
=#.testimonials Lorem Ipsum is simply dummy text of the printing and typesetting industry.
=#%span.testimonial_name John Smith
=#%span.test_location New York, NY, USA
.clear

%br
#donor_info
#form_left
#donor_head Donor Information
@@ -75,3 +71,7 @@
= image_submit_tag('/images/contribute_btn.gif')
.clear
.clear
%br
=render :partial => 'comments', :object => @project


@@ -0,0 +1,4 @@
:javascript
$(document).ready(function() {
$("#pb_#{progbar.id} #progressbar").progressbar({ value: #{progbar.percent_raised} })
});
@@ -29,7 +29,7 @@ en:
confirmation_instructions:
subject: 'Confirmation instructions'
reset_password_instructions:
subject: 'Reset password instructions'
subject: 'Reset your password for ReliefHub.org'

common:
forgot_your_password?: "Forgot your password?"
@@ -49,9 +49,9 @@ en:
you_can_confirm_your_account_through_the_link_below: "You can confirm your account through the link below"
confirm_my_account: "Confirm my account"
reset_password_instructions:
reset_password_instruction: "Someone has requested a link to change your password, and you can do this through the link below."
reset_password_instruction: "Can’t remember password? Don’t worry, be happy! We are asking you to take this step to verify your identity and ensure your account is protected. Please click on this link below to reset your password. If you did not initiate this new password request at ReliefHub.org, please ignore this email."
change_my_password: "Change my password"
wrong_request_instruction: "If you didn't request this, please ignore this email."
wrong_request_instruction: "If you did not initiate this new password request at ReliefHub.org, please ignore this email."
unchange_password_message: "Your password won't change until you access the link above and create a new one."
unlock_instructions:
locked_account_message: "Your account has been locked due to an excessive amount of unsuccessful sign in attempts."
@@ -2,21 +2,25 @@
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.

en:
comment:
create:
error: "Error saving your comment - "
success: "Comment was successfully created."
homes:
featured_project:
raised: "%{percentage}% of %{goal} raised"
raised: "%{percentage} of %{goal} raised"
fund_this_project: 'Fund this Project'
show:
learn_more: "Learn More"
who_we_are: "ReliefHub is dedicated to working with orphanages around the world to help perpetuate their effectiveness and provide a foundation for gathering the resources they require to continue to care for millions of orphans and abandoned children."
who_we_are: "ReliefHub is dedicated to working with orphanages around the world to help perpetuate their effectiveness and provide a foundation for gathering the resources they require to continue to care for millions of orphans and abandoned children. Our team is committed to providing excellent service for each and every project that is chosen and completed through the help of our donor’s generosity. Through our combined efforts, we can reach out to countless others."
recent_press: "Recent Press"
mailer:
contact:
heading: "The following was submitted via the ReliefHub website."
pages:
about_us:
our_mission: "Our Mission"
our_mission_text: "ReliefHub is dedicated to working with orphanages in third world countries to help them secure the resources they require to continue to care for millions of orphans and abandoned children."
our_mission_text: "ReliefHub is dedicated to working with orphanages in third world countries to help them secure the resources they require to continue to care for millions of orphans and abandoned children. Our team is committed to providing excellent service for each and every project that is chosen and completed through the help of our donor’s generosity. Through our combined efforts, we can reach out to countless others."
about_us: "About Us"
about_us_text1: "ReliefHub is a 501 (c) 3 nonprofit organization founded to work with orphanages around the world to help them secure the resources required to provide excellent care for orphans and abandoned children. Initially ReliefHub will focus on Haiti, where an estimated 200,000 children are living in orphanages."
about_us_text2: "ReliefHub is managed by an international team of volunteers from Haiti, USA, and Sweden who have come together to support this great cause. The team works tirelessly to organize innovative fundraisers and to manage the selection and distribution of funds to orphanages."
@@ -51,9 +55,13 @@ en:

formtastic:
labels:
comment:
body: "Please leave a message explaining why this cause is important to you:"
email:
from: "Email"
body: "Body"
actions:
comment:
create: "Submit"
email:
submit: "Contact us"
@@ -4,6 +4,8 @@
scope "(:locale)", :locale => /en|fr/ do
resource :home, :only => [:show]

resources :comments, :only => [:create]

resources :projects, :only => [:index, :show] do
collection do
get :my_projects
@@ -0,0 +1,15 @@
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.text :body
t.integer :user_id
t.integer :project_id

t.timestamps
end
end

def self.down
drop_table :comments
end
end
@@ -0,0 +1,42 @@
Given /^I signed up with "(.*)\/(.*)"$/ do |email, password|
user = Factory :user,
:email => email,
:password => password,
:password_confirmation => password
end

Given /^I am signed up and confirmed as "(.*)\/(.*)"$/ do |email, password|
user = Factory :email_confirmed_user,
:email => email,
:password => password,
:password_confirmation => password
end

Given /^I have signed in with "(.*)\/(.*)"$/ do |email, password|
Given %{I am signed up and confirmed as "#{email}/#{password}"}
And %{I sign in as "#{email}/#{password}"}
end

When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
When %{I go to the sign in page}
And %{I fill in "Email" with "#{email}"}
And %{I fill in "Password" with "#{password}"}
And %{I press "Sign in"}
end

When "I sign out" do
steps %{
When I go to the homepage
And I follow "Sign out"
}
end

Then /^I should be signed in$/ do
Given %{I am on the homepage}
Then %{I should see "Sign out"}
end

Then /^I should be signed out$/ do
Given %{I am on the homepage}
Then %{I should see "Sign in"}
end

0 comments on commit 45b6051

Please sign in to comment.
You can’t perform that action at this time.