-
-
Save anonymous/a5f658a2b4f1854ef2f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="comment_container"> | |
<p><%= comment.content %> | |
SCORE <%= comment.votes_for%> | |
</p> | |
<%= link_to('Vote up', vote_up_comment_path(comment), :method => :post) %> | |
<%= link_to('Vote down', vote_down_comment_path(comment), :method => :post) %> | |
</br> | |
<p>created at: | |
<%= comment.created_at %> | |
</p> | |
<%= link_to 'Destroy Comment', [comment.post, comment], | |
:confirm => 'Are you sure?', | |
:method => :delete %> | |
</br> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<li id="<%= my_item.id %>"> | |
<%= link_to gravatar_for(my_item.user), my_item.user %> | |
<span class="user"> | |
<%= link_to my_item.user.name, my_item.user %> | |
</span> | |
<span class="content"><%= my_item.content %></span> | |
<span class="timestamp"> | |
Posted <%= time_ago_in_words(my_item.created_at) %> ago. | |
</span> | |
<%= link_to('Vote Down', vote_down_post_path(my_item), :method => :post) %> | |
<%= link_to('Vote Up', vote_up_post_path(my_item), :method => :post) %> | |
<p>SCORE <%= my_item.votes_for%><p> | |
<% if current_user?(my_item.user) %> | |
<%= link_to "delete", my_item, method: :delete, data: { confirm: "You sure?" }, title: my_item.content %> | |
<% end %> | |
<br> | |
<h3>Comments</h3> | |
<br> | |
<!-- THESE ARE THE PARTIALS I WANT TO SWAP --> | |
<%= render partial: 'comments/comment', collection: my_item.comments, as: :comment %> | |
<%= render :partial => "comments/form", :locals => { :cur_post => my_item } %> | |
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<br> | |
<br> | |
<h3>NEW COMMENT</h3> | |
<%= form_for([cur_post, cur_post.comments.build]) do |f| %> | |
<div class="field"> | |
<%= f.text_area :content %> | |
</div> | |
<div class="actions"> | |
<%= f.submit %> | |
</div> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if @user_items.any? %> | |
<ol class="posts"> | |
<%= render partial: 'shared/feed_item', collection: @user_items, as: :my_item %> | |
</ol> | |
<%= will_paginate @user_items %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyBlog::Application.routes.draw do | |
# You can have the root of your site routed with "root" | |
# just remember to delete public/index.html. | |
#put home page at root | |
root :to => 'static_pages#home' | |
#remove static_pages from url | |
match '/help', to: 'static_pages#help' | |
match '/about', to: 'static_pages#about' | |
match '/contact', to: 'static_pages#contact' | |
#spoof users/new to singup | |
match '/signup', to: 'users#new' | |
#spoof sessions -- these can below because they arent sesssions/signin* * pretty sure | |
match '/signin', to: 'sessions#new' | |
match '/signout', to: 'sessions#destroy', via: :delete | |
# just the ones i want | |
resources :sessions, only: [:new, :create, :destroy] | |
resources :relationships, only: [:create, :destroy] | |
# all of users plus following command | |
resources :users do | |
member do | |
get :following, :followers | |
end | |
end | |
# all posts, plue vote up and down and nested comments | |
resources :posts do | |
member do | |
post :vote_up, :vote_down | |
get :vote_up, :vote_down | |
end | |
resources :comments | |
end | |
# VIEW COMMENTS ON THEIR OWN AND THRU POSTS | |
resources :comments do | |
member do | |
post :vote_up, :vote_down | |
get :vote_up, :vote_down | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment