chili 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -3
- data/Gemfile +1 -0
- data/README.md +37 -45
- data/chili.gemspec +7 -0
- data/lib/chili/template.rb +19 -5
- data/lib/chili/version.rb +1 -1
- data/spec/dummy/chili_likes/app/assets/images/chili_likes/.gitkeep +0 -0
- data/spec/dummy/chili_likes/app/assets/javascripts/chili_likes/application.js +15 -0
- data/spec/dummy/chili_likes/app/assets/stylesheets/chili_likes/application.css.scss +7 -0
- data/spec/dummy/chili_likes/app/controllers/chili_likes/likes_controller.rb +14 -0
- data/spec/dummy/chili_likes/app/models/chili_likes/like.rb +7 -0
- data/spec/dummy/chili_likes/app/models/chili_likes/post.rb +9 -0
- data/spec/dummy/chili_likes/app/models/chili_likes/user.rb +5 -0
- data/spec/dummy/chili_likes/app/overrides/layouts/application/chili_likes.html.erb.deface +2 -0
- data/spec/dummy/chili_likes/app/overrides/posts/_post/chili_likes.html.erb.deface +6 -0
- data/spec/dummy/chili_likes/app/overrides/posts/index/chili_likes.html.erb.deface +2 -0
- data/spec/dummy/chili_likes/app/views/chili_likes/likes/index.html.erb +9 -0
- data/spec/dummy/chili_likes/config/routes.rb +4 -0
- data/spec/dummy/chili_likes/db/migrate/20120513031021_create_chili_likes_likes.rb +10 -0
- data/spec/dummy/chili_likes/lib/chili_likes.rb +7 -0
- data/spec/dummy/chili_likes/lib/chili_likes/engine.rb +10 -0
- data/spec/dummy/main_app/README.rdoc +261 -0
- data/spec/dummy/main_app/Rakefile +7 -0
- data/spec/dummy/main_app/app/assets/javascripts/application.js +2 -0
- data/spec/dummy/main_app/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/main_app/app/assets/stylesheets/posts.css +4 -0
- data/spec/dummy/main_app/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/main_app/app/assets/stylesheets/users.css +4 -0
- data/spec/dummy/main_app/app/controllers/application_controller.rb +11 -0
- data/spec/dummy/main_app/app/controllers/posts_controller.rb +83 -0
- data/spec/dummy/main_app/app/controllers/users_controller.rb +83 -0
- data/spec/dummy/main_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/main_app/app/helpers/posts_helper.rb +2 -0
- data/spec/dummy/main_app/app/helpers/users_helper.rb +2 -0
- data/spec/dummy/main_app/app/mailers/.gitkeep +0 -0
- data/spec/dummy/main_app/app/models/.gitkeep +0 -0
- data/spec/dummy/main_app/app/models/post.rb +3 -0
- data/spec/dummy/main_app/app/models/user.rb +3 -0
- data/spec/dummy/main_app/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/main_app/app/views/posts/_form.html.erb +21 -0
- data/spec/dummy/main_app/app/views/posts/_post.html.erb +3 -0
- data/spec/dummy/main_app/app/views/posts/edit.html.erb +6 -0
- data/spec/dummy/main_app/app/views/posts/index.html.erb +16 -0
- data/spec/dummy/main_app/app/views/posts/new.html.erb +5 -0
- data/spec/dummy/main_app/app/views/posts/show.html.erb +10 -0
- data/spec/dummy/main_app/app/views/users/_form.html.erb +21 -0
- data/spec/dummy/main_app/app/views/users/edit.html.erb +6 -0
- data/spec/dummy/main_app/app/views/users/index.html.erb +23 -0
- data/spec/dummy/main_app/app/views/users/new.html.erb +5 -0
- data/spec/dummy/main_app/app/views/users/show.html.erb +10 -0
- data/spec/dummy/main_app/config.ru +4 -0
- data/spec/dummy/main_app/config/application.rb +57 -0
- data/spec/dummy/main_app/config/boot.rb +11 -0
- data/spec/dummy/main_app/config/database.yml +25 -0
- data/spec/dummy/main_app/config/environment.rb +5 -0
- data/spec/dummy/main_app/config/environments/development.rb +37 -0
- data/spec/dummy/main_app/config/environments/production.rb +67 -0
- data/spec/dummy/main_app/config/environments/test.rb +37 -0
- data/spec/dummy/main_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/main_app/config/initializers/inflections.rb +15 -0
- data/spec/dummy/main_app/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/main_app/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/main_app/config/initializers/session_store.rb +8 -0
- data/spec/dummy/main_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/main_app/config/locales/en.yml +5 -0
- data/spec/dummy/main_app/config/routes.rb +6 -0
- data/spec/dummy/main_app/db/migrate/20120513023816_create_posts.rb +9 -0
- data/spec/dummy/main_app/db/migrate/20120513023840_create_users.rb +9 -0
- data/spec/dummy/main_app/db/migrate/20120513032032_create_chili_likes_likes.chili_likes.rb +11 -0
- data/spec/dummy/main_app/db/schema.rb +36 -0
- data/spec/dummy/main_app/lib/assets/.gitkeep +0 -0
- data/spec/dummy/main_app/log/.gitkeep +0 -0
- data/spec/dummy/main_app/public/404.html +26 -0
- data/spec/dummy/main_app/public/422.html +26 -0
- data/spec/dummy/main_app/public/500.html +25 -0
- data/spec/dummy/main_app/public/favicon.ico +0 -0
- data/spec/dummy/main_app/script/rails +6 -0
- data/spec/lib/chili/activatable_spec.rb +21 -0
- data/spec/requests/chili_likes_spec.rb +28 -0
- data/spec/spec_helper.rb +27 -0
- metadata +255 -5
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
# GET /posts
|
3
|
+
# GET /posts.json
|
4
|
+
def index
|
5
|
+
@posts = Post.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @posts }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /posts/1
|
14
|
+
# GET /posts/1.json
|
15
|
+
def show
|
16
|
+
@post = Post.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @post }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /posts/new
|
25
|
+
# GET /posts/new.json
|
26
|
+
def new
|
27
|
+
@post = Post.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render json: @post }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /posts/1/edit
|
36
|
+
def edit
|
37
|
+
@post = Post.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /posts
|
41
|
+
# POST /posts.json
|
42
|
+
def create
|
43
|
+
@post = Post.new(params[:post])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @post.save
|
47
|
+
format.html { redirect_to @post, notice: 'Post was successfully created.' }
|
48
|
+
format.json { render json: @post, status: :created, location: @post }
|
49
|
+
else
|
50
|
+
format.html { render action: "new" }
|
51
|
+
format.json { render json: @post.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /posts/1
|
57
|
+
# PUT /posts/1.json
|
58
|
+
def update
|
59
|
+
@post = Post.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @post.update_attributes(params[:post])
|
63
|
+
format.html { redirect_to @post, notice: 'Post was successfully updated.' }
|
64
|
+
format.json { head :no_content }
|
65
|
+
else
|
66
|
+
format.html { render action: "edit" }
|
67
|
+
format.json { render json: @post.errors, status: :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /posts/1
|
73
|
+
# DELETE /posts/1.json
|
74
|
+
def destroy
|
75
|
+
@post = Post.find(params[:id])
|
76
|
+
@post.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to posts_url }
|
80
|
+
format.json { head :no_content }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -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
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_for(@post) do |f| %>
|
2
|
+
<% if @post.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :title %><br />
|
16
|
+
<%= f.text_field :title %>
|
17
|
+
</div>
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_for(@user) do |f| %>
|
2
|
+
<% if @user.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @user.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name %><br />
|
16
|
+
<%= f.text_field :name %>
|
17
|
+
</div>
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h1>Listing users</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
<th></th>
|
7
|
+
<th></th>
|
8
|
+
<th></th>
|
9
|
+
</tr>
|
10
|
+
|
11
|
+
<% @users.each do |user| %>
|
12
|
+
<tr>
|
13
|
+
<td><%= user.name %></td>
|
14
|
+
<td><%= link_to 'Show', user %></td>
|
15
|
+
<td><%= link_to 'Edit', edit_user_path(user) %></td>
|
16
|
+
<td><%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %></td>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
</table>
|
20
|
+
|
21
|
+
<br />
|
22
|
+
|
23
|
+
<%= link_to 'New User', new_user_path %>
|