Skip to content

Commit b3ec90e

Browse files
committed
Finish demo app
1 parent 22e8385 commit b3ec90e

34 files changed

+622
-14
lines changed

Gemfile.lock

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,36 @@ GEM
2828
activesupport (3.2.13)
2929
i18n (= 0.6.1)
3030
multi_json (~> 1.0)
31-
arel (3.0.2)
31+
arel (3.0.3)
3232
builder (3.0.4)
3333
coffee-rails (3.2.2)
3434
coffee-script (>= 2.2.0)
3535
railties (~> 3.2.0)
3636
coffee-script (2.2.0)
3737
coffee-script-source
3838
execjs
39-
coffee-script-source (1.6.2)
39+
coffee-script-source (1.7.0)
4040
erubis (2.7.0)
41-
execjs (1.4.0)
42-
multi_json (~> 1.0)
41+
execjs (2.0.2)
4342
hike (1.2.3)
4443
i18n (0.6.1)
4544
journey (1.0.4)
4645
jquery-rails (2.0.2)
4746
railties (>= 3.2.0, < 5.0)
4847
thor (~> 0.14)
49-
json (1.8.0)
48+
json (1.8.1)
5049
mail (2.5.4)
5150
mime-types (~> 1.16)
5251
treetop (~> 1.4.8)
53-
mime-types (1.23)
54-
multi_json (1.7.7)
52+
mime-types (1.25.1)
53+
multi_json (1.10.1)
54+
pg (0.12.2)
5555
pg (0.12.2-x86-mingw32)
56-
polyglot (0.3.3)
56+
polyglot (0.3.4)
5757
rack (1.4.5)
5858
rack-cache (1.2)
5959
rack (>= 0.4)
60-
rack-ssl (1.3.3)
60+
rack-ssl (1.3.4)
6161
rack
6262
rack-test (0.6.2)
6363
rack (>= 1.0)
@@ -76,10 +76,10 @@ GEM
7676
rake (>= 0.8.7)
7777
rdoc (~> 3.4)
7878
thor (>= 0.14.6, < 2.0)
79-
rake (10.1.0)
79+
rake (10.3.2)
8080
rdoc (3.12.2)
8181
json (~> 1.4)
82-
sass (3.2.9)
82+
sass (3.3.7)
8383
sass-rails (3.2.5)
8484
railties (~> 3.2.0)
8585
sass (>= 3.1.10)
@@ -89,18 +89,20 @@ GEM
8989
multi_json (~> 1.0)
9090
rack (~> 1.0)
9191
tilt (~> 1.1, != 1.3.0)
92+
sqlite3 (1.3.5)
9293
sqlite3 (1.3.5-x86-mingw32)
93-
thor (0.18.1)
94+
thor (0.19.1)
9495
tilt (1.4.1)
95-
treetop (1.4.14)
96+
treetop (1.4.15)
9697
polyglot
9798
polyglot (>= 0.3.1)
98-
tzinfo (0.3.37)
99+
tzinfo (0.3.39)
99100
uglifier (1.2.3)
100101
execjs (>= 0.3.0)
101102
multi_json (>= 1.0.2)
102103

103104
PLATFORMS
105+
ruby
104106
x86-mingw32
105107

106108
DEPENDENCIES
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Place all the behaviors and hooks related to the matching controller here.
2+
# All this logic will automatically be available in application.js.
3+
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Place all the behaviors and hooks related to the matching controller here.
2+
# All this logic will automatically be available in application.js.
3+
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Place all the styles related to the Microposts controller here.
2+
// They will automatically be included in application.css.
3+
// You can use Sass (SCSS) here: http://sass-lang.com/
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
body {
2+
background-color: #fff;
3+
color: #333;
4+
font-family: verdana, arial, helvetica, sans-serif;
5+
font-size: 13px;
6+
line-height: 18px;
7+
}
8+
9+
p, ol, ul, td {
10+
font-family: verdana, arial, helvetica, sans-serif;
11+
font-size: 13px;
12+
line-height: 18px;
13+
}
14+
15+
pre {
16+
background-color: #eee;
17+
padding: 10px;
18+
font-size: 11px;
19+
}
20+
21+
a {
22+
color: #000;
23+
&:visited {
24+
color: #666;
25+
}
26+
&:hover {
27+
color: #fff;
28+
background-color: #000;
29+
}
30+
}
31+
32+
div {
33+
&.field, &.actions {
34+
margin-bottom: 10px;
35+
}
36+
}
37+
38+
#notice {
39+
color: green;
40+
}
41+
42+
.field_with_errors {
43+
padding: 2px;
44+
background-color: red;
45+
display: table;
46+
}
47+
48+
#error_explanation {
49+
width: 450px;
50+
border: 2px solid red;
51+
padding: 7px;
52+
padding-bottom: 0;
53+
margin-bottom: 20px;
54+
background-color: #f0f0f0;
55+
h2 {
56+
text-align: left;
57+
font-weight: bold;
58+
padding: 5px 5px 5px 15px;
59+
font-size: 12px;
60+
margin: -7px;
61+
margin-bottom: 0px;
62+
background-color: #c00;
63+
color: #fff;
64+
}
65+
ul li {
66+
font-size: 12px;
67+
list-style: square;
68+
}
69+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Place all the styles related to the Users controller here.
2+
// They will automatically be included in application.css.
3+
// You can use Sass (SCSS) here: http://sass-lang.com/
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
class MicropostsController < ApplicationController
2+
# GET /microposts
3+
# GET /microposts.json
4+
def index
5+
@microposts = Micropost.all
6+
7+
respond_to do |format|
8+
format.html # index.html.erb
9+
format.json { render json: @microposts }
10+
end
11+
end
12+
13+
# GET /microposts/1
14+
# GET /microposts/1.json
15+
def show
16+
@micropost = Micropost.find(params[:id])
17+
18+
respond_to do |format|
19+
format.html # show.html.erb
20+
format.json { render json: @micropost }
21+
end
22+
end
23+
24+
# GET /microposts/new
25+
# GET /microposts/new.json
26+
def new
27+
@micropost = Micropost.new
28+
29+
respond_to do |format|
30+
format.html # new.html.erb
31+
format.json { render json: @micropost }
32+
end
33+
end
34+
35+
# GET /microposts/1/edit
36+
def edit
37+
@micropost = Micropost.find(params[:id])
38+
end
39+
40+
# POST /microposts
41+
# POST /microposts.json
42+
def create
43+
@micropost = Micropost.new(params[:micropost])
44+
45+
respond_to do |format|
46+
if @micropost.save
47+
format.html { redirect_to @micropost, notice: 'Micropost was successfully created.' }
48+
format.json { render json: @micropost, status: :created, location: @micropost }
49+
else
50+
format.html { render action: "new" }
51+
format.json { render json: @micropost.errors, status: :unprocessable_entity }
52+
end
53+
end
54+
end
55+
56+
# PUT /microposts/1
57+
# PUT /microposts/1.json
58+
def update
59+
@micropost = Micropost.find(params[:id])
60+
61+
respond_to do |format|
62+
if @micropost.update_attributes(params[:micropost])
63+
format.html { redirect_to @micropost, notice: 'Micropost was successfully updated.' }
64+
format.json { head :no_content }
65+
else
66+
format.html { render action: "edit" }
67+
format.json { render json: @micropost.errors, status: :unprocessable_entity }
68+
end
69+
end
70+
end
71+
72+
# DELETE /microposts/1
73+
# DELETE /microposts/1.json
74+
def destroy
75+
@micropost = Micropost.find(params[:id])
76+
@micropost.destroy
77+
78+
respond_to do |format|
79+
format.html { redirect_to microposts_url }
80+
format.json { head :no_content }
81+
end
82+
end
83+
end
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
class UsersController < ApplicationController
2+
# GET /users
3+
# GET /users.json
4+
def index
5+
@users = User.all
6+
7+
respond_to do |format|
8+
format.html # index.html.erb
9+
format.json { render json: @users }
10+
end
11+
end
12+
13+
# GET /users/1
14+
# GET /users/1.json
15+
def show
16+
@user = User.find(params[:id])
17+
18+
respond_to do |format|
19+
format.html # show.html.erb
20+
format.json { render json: @user }
21+
end
22+
end
23+
24+
# GET /users/new
25+
# GET /users/new.json
26+
def new
27+
@user = User.new
28+
29+
respond_to do |format|
30+
format.html # new.html.erb
31+
format.json { render json: @user }
32+
end
33+
end
34+
35+
# GET /users/1/edit
36+
def edit
37+
@user = User.find(params[:id])
38+
end
39+
40+
# POST /users
41+
# POST /users.json
42+
def create
43+
@user = User.new(params[:user])
44+
45+
respond_to do |format|
46+
if @user.save
47+
format.html { redirect_to @user, notice: 'User was successfully created.' }
48+
format.json { render json: @user, status: :created, location: @user }
49+
else
50+
format.html { render action: "new" }
51+
format.json { render json: @user.errors, status: :unprocessable_entity }
52+
end
53+
end
54+
end
55+
56+
# PUT /users/1
57+
# PUT /users/1.json
58+
def update
59+
@user = User.find(params[:id])
60+
61+
respond_to do |format|
62+
if @user.update_attributes(params[:user])
63+
format.html { redirect_to @user, notice: 'User was successfully updated.' }
64+
format.json { head :no_content }
65+
else
66+
format.html { render action: "edit" }
67+
format.json { render json: @user.errors, status: :unprocessable_entity }
68+
end
69+
end
70+
end
71+
72+
# DELETE /users/1
73+
# DELETE /users/1.json
74+
def destroy
75+
@user = User.find(params[:id])
76+
@user.destroy
77+
78+
respond_to do |format|
79+
format.html { redirect_to users_url }
80+
format.json { head :no_content }
81+
end
82+
end
83+
end

app/helpers/microposts_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module MicropostsHelper
2+
end

app/helpers/users_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module UsersHelper
2+
end

0 commit comments

Comments
 (0)