-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
74 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class MicropostsController < ApplicationController | ||
before_filter :signed_in_user | ||
|
||
def create | ||
@micropost = current_user.microposts.build(params[:micropost]) | ||
if @micropost.save | ||
flash[:success] = "Micropost created!" | ||
redirect_to root_path | ||
else | ||
render 'static_pages/home' | ||
end | ||
end | ||
|
||
def destroy | ||
end | ||
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<%= form_for(@micropost) do |f| %> | ||
<%= render 'shared/error_messages', object: f.object %> | ||
<div class="field"> | ||
<%= f.text_area :content %> | ||
</div> | ||
<div class="actions"> | ||
<%= f.submit "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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="user_info"> | ||
<a href="<%= user_path(current_user) %>"> | ||
<%= gravatar_for(current_user, size: 30) %> | ||
<span class="user_name"> | ||
<%= current_user.name %> | ||
</span> | ||
<span class="microposts"> | ||
<%= pluralize(current_user.microposts.count, "micropost") %> | ||
</span> | ||
</a> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
<% provide(:title, 'Home') %> | ||
<h1>Sample App</h1> | ||
<<% provide(:title, 'Home') %> | ||
<% if signed_in? %> | ||
<table class="front"> | ||
<tr> | ||
<td class="main"> | ||
<h1 class="micropost">What's up?</h1> | ||
<%= render 'shared/micropost_form' %> | ||
</td> | ||
<td class="sidebar round"> | ||
<%= render 'shared/user_info' %> | ||
</td> | ||
</tr> | ||
</table> | ||
<% else %> | ||
<h1>Sample App</h1> | ||
|
||
<p> | ||
This is the home page for the | ||
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> | ||
sample application. | ||
</p> | ||
<p> | ||
This is the home page for the | ||
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> | ||
sample application. | ||
</p> | ||
|
||
<%= link_to "Sign up now!", signup_path, class: "signup_button round" %> | ||
<%= link_to "Sign up now!", signup_path, class: "signup_button round" %> | ||
<% 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
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
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