forked from americas--guest/twetter
-
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.
Changing language to Twetter and Twet
- Loading branch information
Showing
34 changed files
with
169 additions
and
160 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
twitter-clone | ||
Twetter | ||
============= | ||
|
||
This is the sample Twitter Clone code base for Thinkful's Ruby on Rails course. | ||
This is the sample version of Twetter, a basic clone of the most popular micro-blogging site, produced for Thinkful's Ruby on Rails course. | ||
|
||
Before Beginning | ||
------------- | ||
|
@@ -24,15 +24,15 @@ Getting Started | |
|
||
```sh | ||
# Clone the repository | ||
git clone [email protected]:Thinkful/twitter-clone.git | ||
git clone [email protected]:Thinkful/twetter.git | ||
|
||
cd ./twitter-clone | ||
cd ./twetter | ||
|
||
# Install the required gems | ||
bundle install | ||
|
||
# Generate a new config/initializers/secret_token.rb file. | ||
echo "TwitterClone::Application.config.secret_key_base = '`bundle exec rake secret`'" > config/initializers/secret_token.rb | ||
echo "Twetter::Application.config.secret_key_base = '`bundle exec rake secret`'" > config/initializers/secret_token.rb | ||
|
||
# Set up the database | ||
bundle exec rake db:create db:migrate db:test:prepare | ||
|
@@ -50,7 +50,7 @@ Seeds | |
|
||
```sh | ||
bundle exec rake seed:users # Create 20 users | ||
bundle exec rake seed:tweets # Create 5 tweets for each user | ||
bundle exec rake seed:twets # Create 5 twets for each user | ||
``` | ||
|
||
If you'd like to log in as one of your recently seeded users, use the rails console to | ||
|
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
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
2 changes: 1 addition & 1 deletion
2
app/assets/stylesheets/tweets.css.scss → app/assets/stylesheets/twets.css.scss
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,3 +1,3 @@ | ||
// Place all the styles related to the Tweets controller here. | ||
// Place all the styles related to the Twets controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file was deleted.
Oops, something went wrong.
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,57 @@ | ||
class TwetsController < ApplicationController | ||
# All actions in this controller require the presence of an authenticated user. | ||
before_filter :authenticate_user! | ||
|
||
# GET /twets | ||
# | ||
# This action uses the #get_twets method to set the @twets instance variable. | ||
# | ||
# @twets # => All twets defaultly shown to the authenticated user. | ||
# | ||
def index | ||
get_twets | ||
end | ||
|
||
# POST /twets | ||
# | ||
# Used to create a new twet for the authenticated user based on the data passed | ||
# in params[:twet]. If the twet is created successfully, a success message is | ||
# set and we are directed to the index action. Otherwise, an error message is set, | ||
# the twets visible to the authenticated user are loaded into @twets and the index | ||
# view template is displayed. | ||
# | ||
# @twet # => The newly created (or attempted) twet. | ||
# @twets # => (only set if the twet was not created) All twets defaultly shown | ||
# to the authenticated user. | ||
# | ||
# | ||
def create | ||
@twet = current_user.twets.create(twet_params) | ||
if @twet.valid? | ||
flash[:success] = "Your twet was shared" | ||
redirect_to :action => :index and return | ||
else | ||
get_twets | ||
flash[:error] = "Your twet could not be saved" | ||
render :action => :index and return | ||
end | ||
end | ||
|
||
private | ||
|
||
# Sets the @twets instance variable to all twets viewable by the current user | ||
def get_twets | ||
@twets = current_user.all_twets | ||
end | ||
|
||
# http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters | ||
# | ||
# This method uses Strong Parameters to ensure that the data passed by the user | ||
# is appropriate. If params[:twet] does not exist or contains any key / value | ||
# pairs other then :content, an error will be raised and the page will return | ||
# a 400 'Bad Request' HTML response code. | ||
# | ||
def twet_params | ||
params.require(:twet).permit(:content) | ||
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 was deleted.
Oops, something went wrong.
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,2 @@ | ||
module TwetsHelper | ||
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
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 was deleted.
Oops, something went wrong.
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,26 @@ | ||
<div class="clearfix top-space small"></div> | ||
<div class="row"> | ||
|
||
<%= render :partial => 'shared/left_nav' %> | ||
|
||
<div class="panel panel-default col-md-8 text-left"> | ||
<div class="pull-left"> | ||
<h4>Twets</h4> | ||
</div> | ||
<div class="clearfix"></div> | ||
<hr /> | ||
<ol class="list-unstyled"> | ||
<% @twets.each do |twet| -%> | ||
<li> | ||
<%= content_tag :strong, twet.user.name, :class => 'pull-left text-middle' %> | ||
<%= content_tag :small, "@"+twet.user.username, :class => 'text-muted pad-10 text-middle' %> | ||
<%= content_tag :small, twet.created_at.strftime("%b %-d"), :class => 'text-muted text-middle pull-right' %> | ||
<div class="clearfix"></div> | ||
<%= content_tag :p, twet.content %> | ||
</li> | ||
<li><hr></li> | ||
<% end -%> | ||
</ol> | ||
</div> | ||
</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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Be sure to restart your server when you modify this file. | ||
|
||
TwitterClone::Application.config.session_store :cookie_store, key: '_twitter-clone_session' | ||
Twetter::Application.config.session_store :cookie_store, key: '_twetter_session' |
Oops, something went wrong.