Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 80afcbe802ac1c2ddab21555af101daa48d106fc @ryanb ryanb committed Jul 7, 2012
Showing with 2,547 additions and 0 deletions.
  1. +14 −0 README.md
  2. +15 −0 blog-after/.gitignore
  3. +40 −0 blog-after/Gemfile
  4. +121 −0 blog-after/Gemfile.lock
  5. +11 −0 blog-after/README.md
  6. +7 −0 blog-after/Rakefile
  7. +15 −0 blog-after/app/assets/javascripts/application.js
  8. +3 −0 blog-after/app/assets/javascripts/articles.js.coffee
  9. +13 −0 blog-after/app/assets/stylesheets/application.css
  10. +11 −0 blog-after/app/assets/stylesheets/articles.css.scss
  11. +84 −0 blog-after/app/assets/stylesheets/layout.css.scss
  12. +3 −0 blog-after/app/controllers/application_controller.rb
  13. +43 −0 blog-after/app/controllers/articles_controller.rb
  14. +2 −0 blog-after/app/helpers/application_helper.rb
  15. +2 −0 blog-after/app/helpers/articles_helper.rb
  16. 0 blog-after/app/mailers/.gitkeep
  17. 0 blog-after/app/models/.gitkeep
  18. +3 −0 blog-after/app/models/article.rb
  19. +13 −0 blog-after/app/models/user.rb
  20. +25 −0 blog-after/app/views/articles/_form.html.erb
  21. +6 −0 blog-after/app/views/articles/edit.html.erb
  22. +10 −0 blog-after/app/views/articles/index.html.erb
  23. +5 −0 blog-after/app/views/articles/new.html.erb
  24. +8 −0 blog-after/app/views/articles/show.html.erb
  25. +12 −0 blog-after/app/views/devise/confirmations/new.html.erb
  26. +5 −0 blog-after/app/views/devise/mailer/confirmation_instructions.html.erb
  27. +8 −0 blog-after/app/views/devise/mailer/reset_password_instructions.html.erb
  28. +7 −0 blog-after/app/views/devise/mailer/unlock_instructions.html.erb
  29. +16 −0 blog-after/app/views/devise/passwords/edit.html.erb
  30. +12 −0 blog-after/app/views/devise/passwords/new.html.erb
  31. +28 −0 blog-after/app/views/devise/registrations/edit.html.erb
  32. +21 −0 blog-after/app/views/devise/registrations/new.html.erb
  33. +17 −0 blog-after/app/views/devise/sessions/new.html.erb
  34. +25 −0 blog-after/app/views/devise/shared/_links.erb
  35. +12 −0 blog-after/app/views/devise/unlocks/new.html.erb
  36. +29 −0 blog-after/app/views/layouts/application.html.erb
  37. +4 −0 blog-after/config.ru
  38. +62 −0 blog-after/config/application.rb
  39. +6 −0 blog-after/config/boot.rb
  40. +25 −0 blog-after/config/database.yml
  41. +5 −0 blog-after/config/environment.rb
  42. +39 −0 blog-after/config/environments/development.rb
  43. +67 −0 blog-after/config/environments/production.rb
  44. +37 −0 blog-after/config/environments/test.rb
  45. +7 −0 blog-after/config/initializers/backtrace_silencers.rb
  46. +232 −0 blog-after/config/initializers/devise.rb
  47. +15 −0 blog-after/config/initializers/inflections.rb
  48. +5 −0 blog-after/config/initializers/mime_types.rb
  49. +7 −0 blog-after/config/initializers/secret_token.rb
  50. +8 −0 blog-after/config/initializers/session_store.rb
  51. +14 −0 blog-after/config/initializers/wrap_parameters.rb
  52. +58 −0 blog-after/config/locales/devise.en.yml
  53. +5 −0 blog-after/config/locales/en.yml
  54. +6 −0 blog-after/config/routes.rb
  55. +10 −0 blog-after/db/migrate/20120706211416_create_articles.rb
  56. +46 −0 blog-after/db/migrate/20120706223746_devise_create_users.rb
  57. +5 −0 blog-after/db/migrate/20120707002932_add_username_to_users.rb
  58. +42 −0 blog-after/db/schema.rb
  59. +19 −0 blog-after/db/seeds.rb
  60. +2 −0 blog-after/doc/README_FOR_APP
  61. 0 blog-after/lib/assets/.gitkeep
  62. 0 blog-after/lib/tasks/.gitkeep
  63. 0 blog-after/log/.gitkeep
  64. +26 −0 blog-after/public/404.html
  65. +26 −0 blog-after/public/422.html
  66. +25 −0 blog-after/public/500.html
  67. 0 blog-after/public/favicon.ico
  68. +5 −0 blog-after/public/robots.txt
  69. +6 −0 blog-after/script/rails
  70. 0 blog-after/test/fixtures/.gitkeep
  71. +9 −0 blog-after/test/fixtures/articles.yml
  72. +11 −0 blog-after/test/fixtures/users.yml
  73. 0 blog-after/test/functional/.gitkeep
  74. +49 −0 blog-after/test/functional/articles_controller_test.rb
  75. 0 blog-after/test/integration/.gitkeep
  76. +12 −0 blog-after/test/performance/browsing_test.rb
  77. +13 −0 blog-after/test/test_helper.rb
  78. 0 blog-after/test/unit/.gitkeep
  79. +7 −0 blog-after/test/unit/article_test.rb
  80. +4 −0 blog-after/test/unit/helpers/articles_helper_test.rb
  81. +7 −0 blog-after/test/unit/user_test.rb
  82. 0 blog-after/vendor/assets/javascripts/.gitkeep
  83. 0 blog-after/vendor/assets/stylesheets/.gitkeep
  84. 0 blog-after/vendor/plugins/.gitkeep
  85. +15 −0 blog-before/.gitignore
  86. +38 −0 blog-before/Gemfile
  87. +111 −0 blog-before/Gemfile.lock
  88. +11 −0 blog-before/README.md
  89. +7 −0 blog-before/Rakefile
  90. +15 −0 blog-before/app/assets/javascripts/application.js
  91. +3 −0 blog-before/app/assets/javascripts/articles.js.coffee
  92. +13 −0 blog-before/app/assets/stylesheets/application.css
  93. +11 −0 blog-before/app/assets/stylesheets/articles.css.scss
  94. +84 −0 blog-before/app/assets/stylesheets/layout.css.scss
  95. +3 −0 blog-before/app/controllers/application_controller.rb
  96. +41 −0 blog-before/app/controllers/articles_controller.rb
  97. +2 −0 blog-before/app/helpers/application_helper.rb
  98. +2 −0 blog-before/app/helpers/articles_helper.rb
  99. 0 blog-before/app/mailers/.gitkeep
  100. 0 blog-before/app/models/.gitkeep
  101. +3 −0 blog-before/app/models/article.rb
  102. +25 −0 blog-before/app/views/articles/_form.html.erb
  103. +6 −0 blog-before/app/views/articles/edit.html.erb
  104. +10 −0 blog-before/app/views/articles/index.html.erb
  105. +5 −0 blog-before/app/views/articles/new.html.erb
  106. +8 −0 blog-before/app/views/articles/show.html.erb
  107. +18 −0 blog-before/app/views/layouts/application.html.erb
  108. +4 −0 blog-before/config.ru
  109. +62 −0 blog-before/config/application.rb
  110. +6 −0 blog-before/config/boot.rb
  111. +25 −0 blog-before/config/database.yml
  112. +5 −0 blog-before/config/environment.rb
  113. +37 −0 blog-before/config/environments/development.rb
  114. +67 −0 blog-before/config/environments/production.rb
  115. +37 −0 blog-before/config/environments/test.rb
  116. +7 −0 blog-before/config/initializers/backtrace_silencers.rb
  117. +15 −0 blog-before/config/initializers/inflections.rb
  118. +5 −0 blog-before/config/initializers/mime_types.rb
  119. +7 −0 blog-before/config/initializers/secret_token.rb
  120. +8 −0 blog-before/config/initializers/session_store.rb
  121. +14 −0 blog-before/config/initializers/wrap_parameters.rb
  122. +5 −0 blog-before/config/locales/en.yml
  123. +4 −0 blog-before/config/routes.rb
  124. +10 −0 blog-before/db/migrate/20120706211416_create_articles.rb
  125. +23 −0 blog-before/db/schema.rb
  126. +19 −0 blog-before/db/seeds.rb
  127. +2 −0 blog-before/doc/README_FOR_APP
  128. 0 blog-before/lib/assets/.gitkeep
  129. 0 blog-before/lib/tasks/.gitkeep
  130. 0 blog-before/log/.gitkeep
  131. +26 −0 blog-before/public/404.html
  132. +26 −0 blog-before/public/422.html
  133. +25 −0 blog-before/public/500.html
  134. 0 blog-before/public/favicon.ico
  135. +5 −0 blog-before/public/robots.txt
  136. +6 −0 blog-before/script/rails
  137. 0 blog-before/test/fixtures/.gitkeep
  138. +9 −0 blog-before/test/fixtures/articles.yml
  139. 0 blog-before/test/functional/.gitkeep
  140. +49 −0 blog-before/test/functional/articles_controller_test.rb
  141. 0 blog-before/test/integration/.gitkeep
  142. +12 −0 blog-before/test/performance/browsing_test.rb
  143. +13 −0 blog-before/test/test_helper.rb
  144. 0 blog-before/test/unit/.gitkeep
  145. +7 −0 blog-before/test/unit/article_test.rb
  146. +4 −0 blog-before/test/unit/helpers/articles_helper_test.rb
  147. 0 blog-before/vendor/assets/javascripts/.gitkeep
  148. 0 blog-before/vendor/assets/stylesheets/.gitkeep
  149. 0 blog-before/vendor/plugins/.gitkeep
@@ -0,0 +1,14 @@
+# RailsCasts Episode #209: Devise (revised)
+
+http://railscasts.com/episodes/209-devise-revised
+
+Requires Ruby 1.9.2 or higher.
+
+
+### Commands used in this episode
+
+```
+rails g devise:install
+rails g devise:views
+rails g migration add_username_to_users username
+```
@@ -0,0 +1,15 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile ~/.gitignore_global
+
+# Ignore bundler config
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+
+# Ignore all logfiles and tempfiles.
+/log/*.log
+/tmp
@@ -0,0 +1,40 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.6'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer', :platforms => :ruby
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the app server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'debugger'
+
+gem 'devise'
@@ -0,0 +1,121 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.6)
+ actionpack (= 3.2.6)
+ mail (~> 2.4.4)
+ actionpack (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.3)
+ activemodel (3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ activerecord (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ activesupport (3.2.6)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ bcrypt-ruby (3.0.1)
+ builder (3.0.0)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.3.3)
+ devise (2.1.2)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.1)
+ railties (~> 3.1)
+ warden (~> 1.2.1)
+ erubis (2.7.0)
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.4)
+ jquery-rails (2.0.2)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.7.3)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.19)
+ multi_json (1.3.6)
+ orm_adapter (0.3.0)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.6)
+ actionmailer (= 3.2.6)
+ actionpack (= 3.2.6)
+ activerecord (= 3.2.6)
+ activeresource (= 3.2.6)
+ activesupport (= 3.2.6)
+ bundler (~> 1.0)
+ railties (= 3.2.6)
+ railties (3.2.6)
+ actionpack (= 3.2.6)
+ activesupport (= 3.2.6)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.1.20)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ thor (0.15.4)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+ uglifier (1.2.6)
+ execjs (>= 0.3.0)
+ multi_json (~> 1.3)
+ warden (1.2.1)
+ rack (>= 1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.2.1)
+ devise
+ jquery-rails
+ rails (= 3.2.6)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
@@ -0,0 +1,11 @@
+# RailsCasts Example Application
+
+Run these commands to try it out.
+
+```
+bundle
+rake db:setup
+rails s
+```
+
+Requires Ruby 1.9.2 or later to run.
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Blog::Application.load_tasks
@@ -0,0 +1,15 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
@@ -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/
@@ -0,0 +1,13 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require_tree .
+ */
@@ -0,0 +1,11 @@
+// Place all the styles related to the articles controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+#articles {
+ h2 {
+ font-size: 18px;
+ margin-top: 20px;
+ margin-bottom: 5px;
+ }
+ p { margin: 5px 0; }
+}
@@ -0,0 +1,84 @@
+html, body {
+ background-color: #4B7399;
+ font-family: Verdana, Helvetica, Arial;
+ font-size: 14px;
+}
+
+a img {
+ border: none;
+}
+
+a {
+ color: #0000FF;
+}
+
+.clear {
+ clear: both;
+ height: 0;
+ overflow: hidden;
+}
+
+#container {
+ width: 80%;
+ margin: 0 auto;
+ background-color: #FFF;
+ padding: 20px 40px;
+ border: solid 1px black;
+ margin-top: 20px;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+ width: 320px;
+}
+
+#flash_notice {
+ background-color: #CFC;
+ border: solid 1px #6C6;
+}
+
+#flash_error, #flash_alert {
+ background-color: #FCC;
+ border: solid 1px #C66;
+}
+
+.field_with_errors {
+ display: inline;
+}
+
+#error_explanation {
+ width: 400px;
+ border: 2px solid #CF0000;
+ padding: 0px;
+ padding-bottom: 12px;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ font-size: 12px;
+}
+
+#error_explanation h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 10px;
+ font-size: 12px;
+ margin: 0;
+ background-color: #c00;
+ color: #fff;
+}
+
+#error_explanation p {
+ margin: 8px 10px;
+}
+
+#error_explanation ul {
+ margin-bottom: 0;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
+
+#user_nav {
+ float: right;
+}
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
@@ -0,0 +1,43 @@
+class ArticlesController < ApplicationController
+ before_filter :authenticate_user!, except: [:index, :show]
+
+ def index
+ @articles = Article.all
+ end
+
+ def show
+ @article = Article.find(params[:id])
+ end
+
+ def new
+ @article = Article.new
+ end
+
+ def edit
+ @article = Article.find(params[:id])
+ end
+
+ def create
+ @article = Article.new(params[:article])
+ if @article.save
+ redirect_to @article, notice: "Article was successfully created."
+ else
+ render "new"
+ end
+ end
+
+ def update
+ @article = Article.find(params[:id])
+ if @article.update_attributes(params[:article])
+ redirect_to @article, notice: "Article was successfully updated."
+ else
+ render "edit"
+ end
+ end
+
+ def destroy
+ @article = Article.find(params[:id])
+ @article.destroy
+ redirect_to articles_url
+ end
+end
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
@@ -0,0 +1,2 @@
+module ArticlesHelper
+end
No changes.
No changes.
Oops, something went wrong.

0 comments on commit 80afcbe

Please sign in to comment.