Permalink
Browse files

initial mwh checkin

  • Loading branch information...
1 parent a94e97c commit 4dd7987a43cb742d358b693b68e082264d41cd62 @chrismatthieu committed Oct 15, 2011
Showing with 484 additions and 217 deletions.
  1. +1 −1 Rakefile
  2. BIN app/.DS_Store
  3. BIN app/assets/.DS_Store
  4. BIN app/assets/images/.DS_Store
  5. BIN app/assets/javascripts/.DS_Store
  6. +3 −0 app/assets/javascripts/issues.js.coffee
  7. BIN app/assets/stylesheets/.DS_Store
  8. +13 −0 app/assets/stylesheets/application.css
  9. +3 −0 app/assets/stylesheets/issues.css.scss
  10. BIN app/controllers/.DS_Store
  11. +1 −1 app/controllers/comments_controller.rb
  12. +2 −2 app/controllers/follows_controller.rb
  13. +119 −0 app/controllers/issues_controller.rb
  14. +2 −2 app/controllers/sessions_controller.rb
  15. +0 −24 app/controllers/static_controller.rb
  16. +10 −6 app/controllers/users_controller.rb
  17. BIN app/helpers/.DS_Store
  18. +2 −0 app/helpers/issues_helper.rb
  19. +2 −2 app/mailers/notifier.rb
  20. BIN app/models/.DS_Store
  21. +1 −1 app/models/comment.rb
  22. +5 −0 app/models/issue.rb
  23. +1 −0 app/models/user.rb
  24. BIN app/views/.DS_Store
  25. +40 −0 app/views/issues/_form.html.erb
  26. +25 −0 app/views/issues/_issue.html.erb
  27. +10 −0 app/views/issues/edit.html.erb
  28. +13 −0 app/views/issues/index.html.erb
  29. +9 −0 app/views/issues/new.html.erb
  30. +13 −0 app/views/issues/search.html.erb
  31. +45 −0 app/views/issues/show.html.erb
  32. +6 −69 app/views/layouts/application.html.erb
  33. +2 −9 app/views/static/about.html.erb
  34. +7 −8 app/views/static/index.html.erb
  35. +1 −1 app/views/users/_form.html.erb
  36. +1 −1 app/views/users/_profile.html.erb
  37. +19 −20 app/views/users/allfeed.html.erb
  38. +1 −1 app/views/users/edit.html.erb
  39. +1 −1 app/views/users/new.html.erb
  40. +7 −14 app/views/users/show.html.erb
  41. +1 −1 config.ru
  42. +1 −1 config/application.rb
  43. +3 −3 config/database.yml
  44. +1 −1 config/environment.rb
  45. +1 −1 config/environments/development.rb
  46. +1 −1 config/environments/production.rb
  47. +1 −1 config/environments/test.rb
  48. +1 −1 config/initializers/secret_token.rb
  49. +2 −2 config/initializers/session_store.rb
  50. +6 −13 config/routes.rb
  51. +0 −2 db/migrate/20110918213306_create_users.rb
  52. +1 −1 db/migrate/20110924171558_create_comments.rb
  53. +0 −2 db/migrate/20110926191642_add_oauth_to_users.rb
  54. +13 −0 db/migrate/20111014224054_create_issues.rb
  55. +12 −24 db/schema.rb
  56. +15 −0 test/fixtures/issues.yml
  57. +49 −0 test/functional/issues_controller_test.rb
  58. +4 −0 test/unit/helpers/issues_helper_test.rb
  59. +7 −0 test/unit/issue_test.rb
  60. BIN vendor/.DS_Store
View
@@ -4,4 +4,4 @@
require File.expand_path('../config/application', __FILE__)
-Gospelr3::Application.load_tasks
+Maywehelp::Application.load_tasks
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
Binary file not shown.
@@ -147,6 +147,19 @@ html, body {
font-size: 0.4em;
margin-right: 0.5em;
}
+.page h2 {
+ font-family: "ff-meta-serif-web-pro-1","ff-meta-serif-web-pro-2" Georgia,serif;
+ -webkit-transform: rotate(-0.0000000001deg);
+ letter-spacing:-1px;
+ font-weight: 500;
+ font-style:italic;
+ padding-top:25px;
+ font-size:40px;
+ margin-bottom:25px;
+ text-align:left;
+ color: #727272;
+}
+
.page h3 {
font-family: Georgia,serif;
font-weight: normal;
@@ -0,0 +1,3 @@
+// Place all the styles related to the Issues controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
View
Binary file not shown.
@@ -8,7 +8,7 @@ def create
@comment = Comment.new
@comment.user_id = @current_user.id
- @comment.verse_id = params["id"]
+ @comment.issue_id = params["id"]
@comment.comment = params["comment"]["comment"]
@comment.save
@@ -79,8 +79,8 @@ def create
# Send welcome email
if @user.email
begin
- @message = "Hi #{@user.username.capitalize}, \n\n #{@current_user.username.capitalize} is now following you on Gospelr! You can follow them back by clicking on this link: http://gospelr.com/#{@current_user.username} \n\nGod Bless, \nGospelr"
- Notifier.contact(@user.email, "chris@gospelr.com", @message).deliver
+ @message = "Hi #{@user.username.capitalize}, \n\n #{@current_user.username.capitalize} is now following you on MayWeHelp! You can follow them back by clicking on this link: http://maywehelp.com/#{@current_user.username} \n\nGeeks Rule, \nMayWeHelp"
+ Notifier.contact(@user.email, "chris@maywehelp.com", @message).deliver
rescue
end
end
@@ -0,0 +1,119 @@
+class IssuesController < ApplicationController
+
+ before_filter :current_user
+
+ # GET /issues
+ # GET /issues.json
+ def index
+ # @issues = Issue.find(:all, :order => 'updated_at DESC')
+ @issues = Issue.paginate(:order => 'updated_at DESC',
+ :per_page => 10,
+ :page => params[:page])
+
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @issues }
+ end
+ end
+
+ # GET /issues/1
+ # GET /issues/1.json
+ def show
+ @issue = Issue.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @issue }
+ end
+ end
+
+ # GET /issues/new
+ # GET /issues/new.json
+ def new
+ @issue = Issue.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @issue }
+ end
+ end
+
+ # GET /issues/1/edit
+ def edit
+ @issue = Issue.find(params[:id])
+ end
+
+ # POST /issues
+ # POST /issues.json
+ def create
+ @issue = Issue.new(params[:issue])
+ @issue.user_id = @current_user.id
+
+ respond_to do |format|
+ if @issue.save
+ format.html { redirect_to @issue, notice: 'Issue was successfully created.' }
+ format.json { render json: @issue, status: :created, location: @issue }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @issue.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /issues/1
+ # PUT /issues/1.json
+ def update
+ @issue = Issue.find(params[:id])
+
+ respond_to do |format|
+ if @issue.update_attributes(params[:issue])
+ format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }
+ format.json { head :ok }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @issue.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /issues/1
+ # DELETE /issues/1.json
+ def destroy
+ @issue = Issue.find(params[:id])
+ @issue.destroy
+
+ respond_to do |format|
+ format.html { redirect_to issues_url }
+ format.json { head :ok }
+ end
+ end
+
+ def search
+ if params[:page].nil?
+ if params[:search].nil?
+ session[:searchterm] = params[:id]
+ else
+ session[:searchterm] = params[:search][:searchtext]
+ end
+ end
+
+ if request.url.index('localhost')
+ @issuecount = Issue.count(:all, :conditions => ["title LIKE ? or description LIKE ?", '%' + session[:searchterm] + '%', '%' + session[:searchterm] + '%'])
+
+ @issues = Issue.paginate(:conditions => ["title LIKE ? or description LIKE ?", '%' + session[:searchterm] + '%', '%' + session[:searchterm] + '%'],
+ :per_page => 10,
+ :page => params[:page])
+
+ else
+ @issuecount = Issue.count(:all, :conditions => ["title ILIKE ? or description ILIKE ?", '%' + session[:searchterm] + '%', '%' + session[:searchterm] + '%'])
+
+ @issues = Issue.paginate(:conditions => ["title ILIKE ? or description ILIKE ?", '%' + session[:searchterm] + '%', '%' + session[:searchterm] + '%'],
+ :per_page => 10,
+ :page => params[:page])
+
+ end
+ end
+
+
+end
@@ -99,8 +99,8 @@ def create
if !@user.email.nil?
# Send welcome email
- @message = "Welcome to Gospelr!"
- Notifier.contact(@authhash[:email], "chris@gospelr.com", @message).deliver
+ @message = "Welcome to MayWeHelp!"
+ Notifier.contact(@authhash[:email], "chris@maywehelp.com", @message).deliver
end
session[:user_id] = @user.id
@@ -1,28 +1,4 @@
class StaticController < ApplicationController
before_filter :current_user
- before_filter :client, :only => [:tweetverse]
- def tweetverse
- #tweeting random @gospelr bible verse
- if request.url.index('localhost')
- @verse = Verse.find(:first, :order => "RAND()")
- else
- @verse = Verse.find(:first, :order => "RANDOM()")
- end
-
- @link = "#{@verse.book_name}/#{@verse.chapter.to_s}/#{@verse.number.to_s}"
-
- if @verse.text.length > 100
- message = @verse.text[0..99] + "... http://gospelr.com/#{@link}"
- else
- message = @verse.text + " http://gospelr.com/#{@link}"
- end
-
- # gospelr = User.find_by_username('gospelr')
-
- @client.update(message)
-
- render :text => '200'
-
- end
end
@@ -27,7 +27,8 @@ def show
@follow = Follow.find(:first, :conditions => ["user_id = ? and follow_id = ?", @current_user.id, @user.id])
# @activities = User.comments.paginate :page => params[:page], :per_page => 3
- @activities = Comment.paginate :page => params[:page], :conditions => ['user_id = ?', @user.id], :order => 'updated_at DESC'
+ # @activities = Comment.paginate :page => params[:page], :conditions => ['user_id = ?', @user.id], :order => 'updated_at DESC'
+ @activities = Issue.paginate :page => params[:page], :conditions => ['user_id = ?', @user.id], :order => 'updated_at DESC'
end
respond_to do |format|
@@ -38,14 +39,17 @@ def show
def allfeed
- @activities = Comment.paginate :page => params[:page], :select => "comments.user_id, comments.verse_id, comments.comment, comments.color, comments.updated_at",
- :order => 'comments.updated_at DESC'
+ # @activities = Comment.paginate :page => params[:page], :select => "comments.user_id, comments.issue_id, comments.comment, comments.updated_at",
+ # :order => 'comments.updated_at DESC'
+
+ @activities = Issue.paginate :page => params[:page], :order => 'updated_at DESC'
+
end
def feed
- @activities = Comment.paginate :page => params[:page], :select => "comments.user_id, comments.verse_id, comments.comment, comments.color, comments.updated_at",
+ @activities = Comment.paginate :page => params[:page], :select => "comments.user_id, comments.issue_id, comments.comment, comments.updated_at",
:conditions => ["follows.user_id = ? or comments.user_id = ?", @current_user.id, @current_user.id],
:joins => "left outer join follows on comments.user_id = follows.follow_id or comments.user_id = #{@current_user.id}",
:order => 'comments.updated_at DESC'
@@ -99,8 +103,8 @@ def create
if @user.save
# Send welcome email
- @message = "Welcome to Gospelr!"
- Notifier.contact(@user.email, "chris@gospelr.com", @message).deliver
+ @message = "Welcome to MayWeHelp!"
+ Notifier.contact(@user.email, "chris@maywehelp.com", @message).deliver
session[:user_id] = @user.id
View
Binary file not shown.
@@ -0,0 +1,2 @@
+module IssuesHelper
+end
View
@@ -1,11 +1,11 @@
class Notifier < ActionMailer::Base
- # default :from => "admin@gospelr.com"
+ # default :from => "admin@maywehelp.com"
def contact(toemail, fromemail, message)
mail( :to => toemail,
:from => fromemail,
- :subject => "Gospelr Update",
+ :subject => "MayWeHelp Update",
:body => message)
end
View
Binary file not shown.
View
@@ -1,4 +1,4 @@
class Comment < ActiveRecord::Base
belongs_to :user
- belongs_to :verse
+ belongs_to :issue
end
View
@@ -0,0 +1,5 @@
+class Issue < ActiveRecord::Base
+ belongs_to :user
+ has_many :comments
+
+end
View
@@ -4,4 +4,5 @@ class User < ActiveRecord::Base
validates_uniqueness_of :username, :on => :create
has_many :comments
has_many :follows
+ has_many :issues
end
View
Binary file not shown.
@@ -0,0 +1,40 @@
+<div id="contentwrap">
+ <br/>
+<center><table width="600px"><tr><td width="60%">
+
+<div id="generalform">
+
+<%= form_for(@issue) do |f| %>
+ <% if @issue.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@issue.errors.count, "error") %> prohibited this issue from being saved:</h2>
+
+ <ul>
+ <% @issue.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :title %><br />
+ <%= f.text_field :title %>
+ </div>
+ <div class="field">
+ <%= f.label :description %><br />
+ <%= f.text_area :description %>
+ </div>
+ <div class="field">
+ <%= f.label :offer %><br />
+ <%= f.text_field :offer %>
+ </div>
+ <div class="actions">
+ <p><%= f.submit %></p>
+ </div>
+<% end %>
+
+</div>
+</td></tr></table>
+</center>
+</div>
@@ -0,0 +1,25 @@
+<a href="/issues/<%=issue.id%>"><b><%= issue.title %></b></a>
+<br/><%= issue.description %><br/>
+
+<a href="http://twitter.com/share?text=<%= issue.title %>&amp;url=http://maywehelp.com/issues/<%=issue.id%>" class="twitter-share-button">Tweet</a>
+
+<!-- Place this tag where you want the +1 button to render -->
+<g:plusone href="http://maywehelp.com/issues/<%=issue.id%>"></g:plusone>
+
+<!-- Place this tag after the last plusone tag -->
+<script type="text/javascript">
+ (function() {
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+ po.src = 'https://apis.google.com/js/plusone.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+ })();
+</script>
+
+<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=151901608223813&amp;xfbml=1"></script><fb:like href="http://maywehelp.com/issues/<%=issue.id%>" send="true" width="450" show_faces="true" font=""></fb:like>
+
+<br/>
+
+
+
+
+
@@ -0,0 +1,10 @@
+<br/>
+<center><img src="/assets/maywehelp.png" width="300"></center>
+<br/>
+<h1>Editing Issue</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @issue %> |
+<%= link_to 'Back', issues_path %>
+<br/><br/><br/>
@@ -0,0 +1,13 @@
+<h1>Listing New Issues</h1>
+
+<div id="pagecontentwithlinks">
+ <%= render :partial => "issue", :collection => @issues %>
+</div>
+
+<br />
+<p><center><%= will_paginate @issues %></center></p>
+<br /><br /><br />
+
+<br />
+
+<%= link_to 'New Issue', new_issue_path %>
@@ -0,0 +1,9 @@
+<br/>
+<center><img src="/assets/maywehelp.png" width="300"></center>
+<br/>
+<h1>New Issue</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', issues_path %>
+<br/><br/><br/>
Oops, something went wrong.

0 comments on commit 4dd7987

Please sign in to comment.