Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleaned up garbage. changed current_user helper to logged_in for ease…

… of use. took out Welcome on application layout.
  • Loading branch information...
commit eeff69fe791689961c6a9df4cca42345e5b18030 1 parent 43c19db
Kevin Musiorski authored
3  app/assets/stylesheets/landings.css.scss
View
@@ -1,3 +0,0 @@
-// Place all the styles related to the Landings controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
4 app/controllers/application_controller.rb
View
@@ -1,11 +1,11 @@
class ApplicationController < ActionController::Base
protect_from_forgery
- helper_method :current_user
+ helper_method :logged_in
private
- def current_user
+ def logged_in
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
10 app/controllers/landings_controller.rb
View
@@ -1,10 +0,0 @@
-class LandingsController < ApplicationController
- def annie1
- if current_user
- redirect_to :words
- else
- render :layout => 'landings/annie1_layout'
- end
- end
-
-end
3  app/controllers/lists_controller.rb
View
@@ -0,0 +1,3 @@
+class ListsController < ApplicationController
+
+end
11 app/controllers/pages_controller.rb
View
@@ -0,0 +1,11 @@
+class PagesController < ApplicationController
+
+def landing
+ if logged_in
+ redirect_to :words
+ else
+ render :layout => 'landings/annie1'
+ end
+end
+
+end
13 app/controllers/words_controller.rb
View
@@ -2,7 +2,7 @@ class WordsController < ApplicationController
def index
- if current_user
+ if logged_in
@all_wordzies = @current_user.words.find(:all, :order => "created_at ASC")
end
@@ -34,8 +34,7 @@ def show
def create
- if current_user
- @current_user ||= User.find(session[:user_id]) if session[:user_id]
+ if logged_in
@word = Word.new(params[:word])
@word.save
@use = Use.new :word_id => @word.id, :user_id => @current_user.id
@@ -43,17 +42,15 @@ def create
redirect_to root_url
else
# flash[:notice] = "Please sign in"
- redirect_to "http://localhost:3000/auth/twitter"
+ redirect_to :twitter_auth
end
end
def destroy
- if current_user
+ if logged_in
- #@use = Use.new :word_id => @word.id, :user_id => @current_user.id
- #@use.save
- @word=Use.find_by_word_id_and_user_id(params[:id],@current_user.id)
+ @word = Use.find_by_word_id_and_user_id(params[:id],@current_user.id)
if @word.destroy
flash[:notice]="Deleted word"
redirect_to root_url
2  app/helpers/landings_helper.rb
View
@@ -1,2 +0,0 @@
-module LandingsHelper
-end
4 app/views/layouts/application.html.haml
View
@@ -9,9 +9,9 @@
.container
%h1= link_to 'Wordzies', :words
#signin
- - if current_user
+ - if logged_in
%span
- = "Welcome, #{current_user.name}"
+ = "#{logged_in.name}"
= link_to "Log Out", signout_path
- else
= link_to "Log In", "/auth/twitter"
19 app/views/layouts/landings/annie1.html.haml
View
@@ -0,0 +1,19 @@
+%html
+ %head
+ %title Landing
+ = stylesheet_link_tag "application"
+ = javascript_include_tag "application"
+ = csrf_meta_tags
+ %body
+ #landingcontainer
+ .dictionary
+ %h1= link_to (image_tag 'logo.png'), root_url
+ #signin
+ = link_to "Sign in", :twitter_auth
+ #landingsearchbox
+ .landingsearchfield
+ = form_tag({ :controller => 'words', :action => 'search' }, :method => "get") do
+ = text_field_tag :q, nil, :placeholder => "enter a word you want to learn"
+ = submit_tag("Define", :id => "addwordzy-btn", :class => "btn-warning btn")
+
+ = yield
55 app/views/layouts/landings/annie1_layout.html.haml
View
@@ -1,55 +0,0 @@
-%html
- %head
- %title Landing
- = stylesheet_link_tag "application"
- = javascript_include_tag "application"
- = csrf_meta_tags
- %body
- #landingcontainer
- .dictionary
- %h1= link_to (image_tag 'logo.png'), root_url
- #signin
- - if current_user
- %span
- = "Welcome, #{current_user.name}"
- = link_to "Sign Out", signout_path, :class => "btn-danger btn"
- - else
- = link_to "Sign in", :twitter_auth
- #landingsearchbox
- .landingsearchfield
- = form_tag({ :controller => 'words', :action => 'search' }, :method => "get") do
- = text_field_tag :q, nil, :placeholder => "enter a word you want to learn"
- = submit_tag("Define", :id => "addwordzy-btn", :class => "btn-warning btn")
-
- = yield
-
-/ application.html.haml for reference
-/ %html
-/ %head
-/ %title WORDZIES
-/ = stylesheet_link_tag "application"
-/ = javascript_include_tag "application"
-/ = csrf_meta_tags
-/ %body
-/ %header#header
-/ .container
-/ %h1= link_to 'Wordzies', :words
-/ #signin
-/ - if current_user
-/ %span
-/ = "Welcome, #{current_user.name}"
-/ = link_to "Log Out", signout_path
-/ - else
-/ = link_to "Log In", "/auth/twitter"
-/ #searchbox
-/ = form_tag({ :controller => 'words', :action => 'search' }, :method => "get") do
-/ = text_field_tag :q, nil, :placeholder => "find a wordzy"
-/ = submit_tag("Search", :id => "addwordzy-btn", :class => "btn-warning btn")
-/ .container
-/ - if flash[:notice]
-/ .alert.alert-success= flash[:notice]
-/ = yield
-/
-/ #footer
-/ .container
-/ %p Wordzies &copy 2012
0  app/views/landings/annie1.html.haml → app/views/pages/landing.html.haml
View
File renamed without changes
2  app/views/words/_submit_word.html.erb
View
@@ -2,7 +2,7 @@
<%= form_for(@word) do |f| %>
<%= f.hidden_field(:wn_title, value: @the_word) %>
<%= f.hidden_field(:wn_id, value: @wn_word_id) %>
- <% if current_user %>
+ <% if logged_in %>
<%= f.submit("Add Word to My Wordzie Bank", :class => "btn-success btn-large", :id => "search-btn") %>
<% else %>
<% end %>
16 app/views/words/index.html.haml
View
@@ -5,25 +5,15 @@
/ words. We help you integrate your "wordzies" into your everyday vocabulary.
/ Sign in with your Twitter account to start using wordzies now!
-.span6
+.span4
#mywordzies
%h1 List: All
%ul
- - if current_user
+ - if logged_in
- @all_wordzies.each do |wordzy|
%li
= link_to wordzy.wn_title, show_word_url(wordzy.wn_title)
= link_to("Delete", word_path(:id=> wordzy.id) ,:method =>:delete, :class => "btn btn-danger")
- else
= link_to "Sign in to Add Words", "/auth/twitter", :class => "btn btn-success"
-
-/ .span6
-/ #randomwordzies
-/ %h1
-/ Random Wordzies
-/ %ul
-/ - @random_words.each do |word|
-/ %li
-/ = link_to word['word'], show_word_url(word['word'])
-/ %p.center= link_to 'I already know these wordzies!', root_url, :class => "btn"
-/ %p.center= link_to 'I don\'t like these wordzies, suggest new ones!', root_url, :class => "btn btn-danger"
+
2  app/views/words/show.html.haml
View
@@ -6,7 +6,7 @@
= form_for(@word) do |f|
= f.hidden_field(:wn_title, value: @the_word)
= f.hidden_field(:wn_id, value: @wn_word_id)
- - if current_user
+ - if logged_in
= f.submit("Add Word to My Wordzie Bank", :class => "btn-success btn-large", :id => "search-btn")
- else
4 config/routes.rb
View
@@ -1,8 +1,8 @@
WordziesCA::Application.routes.draw do
- root :to => 'landings#annie1'
+ root :to => 'pages#landing'
- get "landings/annie1"
+ get 'pages/landing'
# get "words/index"
# resources :words, :only => [:index]
9 test/functional/landings_controller_test.rb
View
@@ -1,9 +0,0 @@
-require 'test_helper'
-
-class LandingsControllerTest < ActionController::TestCase
- test "should get annie1" do
- get :annie1
- assert_response :success
- end
-
-end
4 test/unit/helpers/landings_helper_test.rb
View
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class LandingsHelperTest < ActionView::TestCase
-end
Please sign in to comment.
Something went wrong with that request. Please try again.