Permalink
Browse files

final add

  • Loading branch information...
1 parent 50cae19 commit 808f70d0fd542e6b56e43cc8adbda90277c5017f @intrudder committed Mar 8, 2012
Showing with 888 additions and 0 deletions.
  1. +3 −0 app/assets/javascripts/home.js.coffee
  2. +3 −0 app/assets/javascripts/microposts.js.coffee
  3. +3 −0 app/assets/javascripts/posts.js.coffee
  4. +3 −0 app/assets/javascripts/users.js.coffee
  5. +3 −0 app/assets/stylesheets/home.css.scss
  6. +3 −0 app/assets/stylesheets/microposts.css.scss
  7. +3 −0 app/assets/stylesheets/posts.css.scss
  8. +56 −0 app/assets/stylesheets/scaffolds.css.scss
  9. +3 −0 app/assets/stylesheets/users.css.scss
  10. +4 −0 app/controllers/home_controller.rb
  11. +83 −0 app/controllers/microposts_controller.rb
  12. +83 −0 app/controllers/posts_controller.rb
  13. +83 −0 app/controllers/users_controller.rb
  14. +2 −0 app/helpers/home_helper.rb
  15. +2 −0 app/helpers/microposts_helper.rb
  16. +2 −0 app/helpers/posts_helper.rb
  17. +2 −0 app/helpers/users_helper.rb
  18. +4 −0 app/models/micropost.rb
  19. +2 −0 app/models/post.rb
  20. +10 −0 app/views/home/index.html.erb
  21. +25 −0 app/views/microposts/_form.html.erb
  22. +6 −0 app/views/microposts/edit.html.erb
  23. +26 −0 app/views/microposts/index.html.erb
  24. +5 −0 app/views/microposts/new.html.erb
  25. +15 −0 app/views/microposts/show.html.erb
  26. +29 −0 app/views/posts/_form.html.erb
  27. +6 −0 app/views/posts/edit.html.erb
  28. +27 −0 app/views/posts/index.html.erb
  29. +5 −0 app/views/posts/new.html.erb
  30. +20 −0 app/views/posts/show.html.erb
  31. +25 −0 app/views/users/_form.html.erb
  32. +6 −0 app/views/users/edit.html.erb
  33. +25 −0 app/views/users/index.html.erb
  34. +5 −0 app/views/users/new.html.erb
  35. +15 −0 app/views/users/show.html.erb
  36. +11 −0 db/migrate/20120308121033_create_posts.rb
  37. +10 −0 db/migrate/20120308121553_create_users.rb
  38. +10 −0 db/migrate/20120308123643_create_microposts.rb
  39. +38 −0 db/schema.rb
  40. +9 −0 test/fixtures/microposts.yml
  41. +11 −0 test/fixtures/posts.yml
  42. +9 −0 test/fixtures/users.yml
  43. +9 −0 test/functional/home_controller_test.rb
  44. +49 −0 test/functional/microposts_controller_test.rb
  45. +49 −0 test/functional/posts_controller_test.rb
  46. +49 −0 test/functional/users_controller_test.rb
  47. +4 −0 test/unit/helpers/home_helper_test.rb
  48. +4 −0 test/unit/helpers/microposts_helper_test.rb
  49. +4 −0 test/unit/helpers/posts_helper_test.rb
  50. +4 −0 test/unit/helpers/users_helper_test.rb
  51. +7 −0 test/unit/micropost_test.rb
  52. +7 −0 test/unit/post_test.rb
  53. +7 −0 test/unit/user_test.rb
@@ -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,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,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,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,3 @@
+// Place all the styles related to the home controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
+// Place all the styles related to the Microposts controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
+// Place all the styles related to the Posts controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,56 @@
+body {
+ background-color: #fff;
+ color: #333;
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px; }
+
+p, ol, ul, td {
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px; }
+
+pre {
+ background-color: #eee;
+ padding: 10px;
+ font-size: 11px; }
+
+a {
+ color: #000;
+ &:visited {
+ color: #666; }
+ &:hover {
+ color: #fff;
+ background-color: #000; } }
+
+div {
+ &.field, &.actions {
+ margin-bottom: 10px; } }
+
+#notice {
+ color: green; }
+
+.field_with_errors {
+ padding: 2px;
+ background-color: red;
+ display: table; }
+
+#error_explanation {
+ width: 450px;
+ border: 2px solid red;
+ padding: 7px;
+ padding-bottom: 0;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 5px 5px 15px;
+ font-size: 12px;
+ margin: -7px;
+ margin-bottom: 0px;
+ background-color: #c00;
+ color: #fff; }
+ ul li {
+ font-size: 12px;
+ list-style: square; } }
@@ -0,0 +1,3 @@
+// Place all the styles related to the Users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,4 @@
+class HomeController < ApplicationController
+ def index
+ end
+end
@@ -0,0 +1,83 @@
+class MicropostsController < ApplicationController
+ # GET /microposts
+ # GET /microposts.json
+ def index
+ @microposts = Micropost.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @microposts }
+ end
+ end
+
+ # GET /microposts/1
+ # GET /microposts/1.json
+ def show
+ @micropost = Micropost.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @micropost }
+ end
+ end
+
+ # GET /microposts/new
+ # GET /microposts/new.json
+ def new
+ @micropost = Micropost.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @micropost }
+ end
+ end
+
+ # GET /microposts/1/edit
+ def edit
+ @micropost = Micropost.find(params[:id])
+ end
+
+ # POST /microposts
+ # POST /microposts.json
+ def create
+ @micropost = Micropost.new(params[:micropost])
+
+ respond_to do |format|
+ if @micropost.save
+ format.html { redirect_to @micropost, notice: 'Micropost was successfully created.' }
+ format.json { render json: @micropost, status: :created, location: @micropost }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @micropost.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /microposts/1
+ # PUT /microposts/1.json
+ def update
+ @micropost = Micropost.find(params[:id])
+
+ respond_to do |format|
+ if @micropost.update_attributes(params[:micropost])
+ format.html { redirect_to @micropost, notice: 'Micropost was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @micropost.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /microposts/1
+ # DELETE /microposts/1.json
+ def destroy
+ @micropost = Micropost.find(params[:id])
+ @micropost.destroy
+
+ respond_to do |format|
+ format.html { redirect_to microposts_url }
+ format.json { head :no_content }
+ end
+ end
+end
@@ -0,0 +1,83 @@
+class PostsController < ApplicationController
+ # GET /posts
+ # GET /posts.json
+ def index
+ @posts = Post.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @posts }
+ end
+ end
+
+ # GET /posts/1
+ # GET /posts/1.json
+ def show
+ @post = Post.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @post }
+ end
+ end
+
+ # GET /posts/new
+ # GET /posts/new.json
+ def new
+ @post = Post.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @post }
+ end
+ end
+
+ # GET /posts/1/edit
+ def edit
+ @post = Post.find(params[:id])
+ end
+
+ # POST /posts
+ # POST /posts.json
+ def create
+ @post = Post.new(params[:post])
+
+ respond_to do |format|
+ if @post.save
+ format.html { redirect_to @post, notice: 'Post was successfully created.' }
+ format.json { render json: @post, status: :created, location: @post }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @post.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /posts/1
+ # PUT /posts/1.json
+ def update
+ @post = Post.find(params[:id])
+
+ respond_to do |format|
+ if @post.update_attributes(params[:post])
+ format.html { redirect_to @post, notice: 'Post was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @post.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /posts/1
+ # DELETE /posts/1.json
+ def destroy
+ @post = Post.find(params[:id])
+ @post.destroy
+
+ respond_to do |format|
+ format.html { redirect_to posts_url }
+ format.json { head :no_content }
+ end
+ end
+end
@@ -0,0 +1,83 @@
+class UsersController < ApplicationController
+ # GET /users
+ # GET /users.json
+ def index
+ @users = User.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @users }
+ end
+ end
+
+ # GET /users/1
+ # GET /users/1.json
+ def show
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @user }
+ end
+ end
+
+ # GET /users/new
+ # GET /users/new.json
+ def new
+ @user = User.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @user }
+ end
+ end
+
+ # GET /users/1/edit
+ def edit
+ @user = User.find(params[:id])
+ end
+
+ # POST /users
+ # POST /users.json
+ def create
+ @user = User.new(params[:user])
+
+ respond_to do |format|
+ if @user.save
+ format.html { redirect_to @user, notice: 'User was successfully created.' }
+ format.json { render json: @user, status: :created, location: @user }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @user.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /users/1
+ # PUT /users/1.json
+ def update
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ if @user.update_attributes(params[:user])
+ format.html { redirect_to @user, notice: 'User was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @user.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /users/1
+ # DELETE /users/1.json
+ def destroy
+ @user = User.find(params[:id])
+ @user.destroy
+
+ respond_to do |format|
+ format.html { redirect_to users_url }
+ format.json { head :no_content }
+ end
+ end
+end
@@ -0,0 +1,2 @@
+module HomeHelper
+end
@@ -0,0 +1,2 @@
+module MicropostsHelper
+end
@@ -0,0 +1,2 @@
+module PostsHelper
+end
@@ -0,0 +1,2 @@
+module UsersHelper
+end
View
@@ -0,0 +1,4 @@
+class Micropost < ActiveRecord::Base
+ belongs_to :user
+ validates :content, :length => { :maximum => 10 }
+end
View
@@ -0,0 +1,2 @@
+class Post < ActiveRecord::Base
+end
@@ -0,0 +1,10 @@
+<h1>Заголовок</h1>
+<p>Моё первое приложение для web на ruby on rails ;)</p>
+
+<h1>Hello, Rails!</h1>
+
+<%= link_to "Пробный Блог", posts_path %>
+
+<%= link_to "Юзеры", users_path %>
+
+<%= link_to "Микропосты", microposts_path %>
Oops, something went wrong.

0 comments on commit 808f70d

Please sign in to comment.