quick_dry 0.0.1.1 → 0.1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/quick_dry/quick_dry_controller.rb +65 -19
- data/config/routes.rb +8 -8
- data/lib/quick_dry/version.rb +1 -1
- metadata +3 -149
- data/test/dummy/app/assets/javascripts/comments.js +0 -2
- data/test/dummy/app/assets/javascripts/posts.js +0 -2
- data/test/dummy/app/assets/stylesheets/comments.css +0 -4
- data/test/dummy/app/assets/stylesheets/posts.css +0 -4
- data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
- data/test/dummy/app/controllers/comments_controller.rb +0 -58
- data/test/dummy/app/controllers/posts_controller.rb +0 -58
- data/test/dummy/app/helpers/comments_helper.rb +0 -2
- data/test/dummy/app/helpers/posts_helper.rb +0 -2
- data/test/dummy/app/models/comment.rb +0 -2
- data/test/dummy/app/models/post.rb +0 -2
- data/test/dummy/app/views/comments/_form.html.erb +0 -25
- data/test/dummy/app/views/comments/edit.html.erb +0 -6
- data/test/dummy/app/views/comments/index.html.erb +0 -27
- data/test/dummy/app/views/comments/new.html.erb +0 -5
- data/test/dummy/app/views/comments/show.html.erb +0 -14
- data/test/dummy/app/views/posts/_form.html.erb +0 -25
- data/test/dummy/app/views/posts/edit.html.erb +0 -6
- data/test/dummy/app/views/posts/index.html.erb +0 -27
- data/test/dummy/app/views/posts/new.html.erb +0 -5
- data/test/dummy/app/views/posts/show.html.erb +0 -14
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20141014142634_create_comments.rb +0 -10
- data/test/dummy/db/migrate/20141014142659_create_posts.rb +0 -10
- data/test/dummy/db/schema.rb +0 -30
- data/test/dummy/log/development.log +0 -15567
- data/test/dummy/test/controllers/comments_controller_test.rb +0 -49
- data/test/dummy/test/controllers/posts_controller_test.rb +0 -49
- data/test/dummy/test/fixtures/comments.yml +0 -9
- data/test/dummy/test/fixtures/posts.yml +0 -9
- data/test/dummy/test/helpers/comments_helper_test.rb +0 -4
- data/test/dummy/test/helpers/posts_helper_test.rb +0 -4
- data/test/dummy/test/models/comment_test.rb +0 -7
- data/test/dummy/test/models/post_test.rb +0 -7
- data/test/dummy/tmp/cache/assets/development/sprockets/0dd5163be147a1ee2f93f5abb9a0fd32 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1e8f75a6b5b33970fb8e397347caa0a1 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/206236caf137ae7dd3cae0aac897f4b2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/24204f742af588c8166d3160b500d20f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/37c31816befce62c4f5d52026a23287d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/412ab75ab0fc70ac2d7f96418d4c1d43 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5eccfa2606a027a0b509bdb46f03d701 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/73510521b58326509331d135128ad92e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8244190c3c743ce907b74854faabcb0b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8288ddc9a4e9f4196c50036ee1eda4b8 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/886a4f506bfbabff5d6b407aedbb80d0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/952d783e1981cc269524cb5a2890409d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9c7264225a395d67bc2a2d9181a19571 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/aa844f54ad5b802f23b19beb26e81435 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ae2c9e8cd2d7afe29ae08c4e049fb57a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b3ee3550542b56da2fa6ed034609648c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b86ae80f0c5c9fda3e212df5e11179c7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b9de2fc513b54720f71ab4d2a2df3004 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c40e7666f601d5bab36418512d6b76ee +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c5cb5b72ad5b8996bce2c68b02dff3a5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cba44a33ec96893200b56f4695586826 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d066c004d1fd26ae76a61303a7a18145 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e1ca254e5fdbd2901067c0a9d95e6dd5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e584db490f8a31d32e707b821c61fa75 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e912bd2d77f53416b8fa30878918d082 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f13f0412b3245894f220e57919843e97 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f3dabd6fc74da6af45a775c1ddb019f7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aedda840a4c0ca6b0b6f29b9a1036bc9cd7a91fd
|
4
|
+
data.tar.gz: 1a0a95676c84e29d862bd1bedcb63c5619f1ee31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a7247d9402663b8a3fb8f14e14f6f769aea33193089856521d0a1d1617ef66384cfdb83e867ca11ea6d2903bc2cf5041e3c27a6a398655d26643c75a2071a37
|
7
|
+
data.tar.gz: 1aab9e24a2d373db71bcd804eaa2adae36014d8fad40da2cbabd92776db70a522b39caa312741da042f22d9bed9f4f79a9003231dbac2e884513fb4fbe47e2cf
|
@@ -1,68 +1,114 @@
|
|
1
1
|
require_dependency "quick_dry/application_controller"
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module QuickDry
|
4
5
|
class QuickDryController < ApplicationController
|
5
6
|
protect_from_forgery #unless Rails.env = "development"
|
6
7
|
before_action :instantiate_paths
|
7
8
|
|
8
|
-
# GET /
|
9
|
-
# GET /
|
9
|
+
# GET /table_name
|
10
|
+
# GET /table_name.json
|
10
11
|
def index
|
11
12
|
# results = get_paged_search_results(params,user:current_user)
|
12
13
|
# params = results[:params]
|
13
14
|
@instances = get_model.all
|
14
|
-
render 'quick_dry/index'
|
15
|
+
# render 'quick_dry/index'
|
16
|
+
respond_to do |format|
|
17
|
+
format.json { render json:@instances}
|
18
|
+
format.html { render 'quick_dry/index'}
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
22
|
+
# GET /table_name/new
|
17
23
|
def new
|
18
24
|
@instance = get_model.new
|
19
25
|
render 'quick_dry/new'
|
20
26
|
end
|
21
27
|
|
28
|
+
# GET /table_name/1
|
29
|
+
# GET /table_name/1.json
|
22
30
|
def show
|
23
31
|
@instance = get_model.find(params[:id])
|
24
|
-
|
32
|
+
|
33
|
+
respond_to do |format|
|
34
|
+
format.json { render json:@instance}
|
35
|
+
format.html { render 'quick_dry/show'}
|
36
|
+
end
|
25
37
|
end
|
26
38
|
|
39
|
+
# POST /table_name
|
40
|
+
# POST /table_name.json
|
27
41
|
def create
|
28
42
|
@instance = get_model.new(instance_params)
|
29
43
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
44
|
+
respond_to do |format|
|
45
|
+
if @instance.save
|
46
|
+
flash[:notice] = "#{get_model.name} was successfully created."
|
47
|
+
format.html { render 'quick_dry/show' }
|
48
|
+
format.json { render json:@instance, status: :created, location: get_url }
|
49
|
+
else
|
50
|
+
format.html { render 'quick_dry/new' }
|
51
|
+
format.json { render json:@instance.errors, status: :unprocessable_entity }
|
52
|
+
end
|
35
53
|
end
|
36
54
|
end
|
37
55
|
|
56
|
+
# GET /table_name/1/edit
|
38
57
|
def edit
|
39
58
|
@instance = get_model.find(params[:id])
|
40
59
|
render 'quick_dry/edit'
|
41
60
|
end
|
42
61
|
|
62
|
+
# PATCH/PUT /table_name/1
|
63
|
+
# PATCH/PUT /table_name/1.json
|
43
64
|
def update
|
44
65
|
@instance = get_model.find(params[:id])
|
45
66
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
67
|
+
respond_to do |format|
|
68
|
+
if @instance.update(instance_params)
|
69
|
+
flash[:notice] = "#{get_model.name} was successfully updated."
|
70
|
+
format.html { render 'quick_dry/show' }
|
71
|
+
format.json { render json:@instance, status: :ok, location: get_url}
|
72
|
+
else
|
73
|
+
format.html { render 'quick_dry/edit' }
|
74
|
+
format.json { render json: @instance.errors, status: :unprocessable_entity}
|
75
|
+
end
|
52
76
|
end
|
53
77
|
end
|
54
78
|
|
79
|
+
# DELETE /table_name/1
|
80
|
+
# DELETE /table_name/1.json
|
55
81
|
def destroy
|
56
|
-
|
57
|
-
|
58
|
-
|
82
|
+
get_model.destroy(params[:id])
|
83
|
+
respond_to do |format|
|
84
|
+
format.html { redirect_to "/#{get_model.model_name.route_key}", notice: "#{get_model.name} was successfully destroyed." }
|
85
|
+
format.json { head :no_content }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_url target:@instance
|
90
|
+
target_url = "/unknown_route"
|
91
|
+
return target_url = "#{get_model.model_name.route_key}" if target.is_a? ActiveRecord::Relation
|
92
|
+
return target_url = "#{get_model.model_name.route_key}/#{target.id}" if target.is_a? ActiveRecord::Base
|
93
|
+
return target_url
|
59
94
|
end
|
60
95
|
|
61
96
|
# Never trust parameters from the scary internet, only allow the white list through.
|
62
97
|
def instance_params
|
63
98
|
model = get_model
|
64
99
|
# get all params except for id, and the standard dates
|
65
|
-
|
100
|
+
respond_to do |format|
|
101
|
+
format.html { }
|
102
|
+
format.json do
|
103
|
+
body = JSON.parse(request.body.read)
|
104
|
+
if body.is_a? Hash and body.has_key? model.model_name.singular_route_key
|
105
|
+
params.merge!(body)
|
106
|
+
elsif body.is_a? Hash
|
107
|
+
params[model.model_name.singular_route_key] = body
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
return params.require(model.model_name.singular_route_key.to_sym).permit(model.attribute_names.collect{|x| x.to_sym} - [:id,:created_at,:updated_at])
|
66
112
|
end
|
67
113
|
|
68
114
|
def append_route(proc:nil,&block)
|
data/config/routes.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
QuickDry::Engine.routes.draw do
|
2
2
|
|
3
3
|
# put these at the end of the routes.rb so as not to interfere with default rails routes
|
4
|
-
get '/:table_name(.:format)', to: 'quick_dry#index', table_name:/[
|
5
|
-
post '/:table_name(.:format)', to: 'quick_dry#create', table_name:/[
|
6
|
-
get '/:table_name/:id(.:format)', to: 'quick_dry#show', table_name:/[
|
7
|
-
put '/:table_name/:id(.:format)', to: 'quick_dry#update', table_name:/[
|
8
|
-
patch '/:table_name/:id(.:format)', to: 'quick_dry#update', table_name:/[
|
9
|
-
delete '/:table_name/:id(.:format)', to: 'quick_dry#destroy',table_name:/[
|
10
|
-
get '/:table_name/:id/edit(.:format)', to: 'quick_dry#edit', table_name:/[
|
11
|
-
get '/:table_name/new(.:format)', to: 'quick_dry#new', table_name:/[
|
4
|
+
get '/:table_name(.:format)', to: 'quick_dry#index', table_name:/[^\/\.]*/, as: :instances
|
5
|
+
post '/:table_name(.:format)', to: 'quick_dry#create', table_name:/[^\/\.]*/
|
6
|
+
get '/:table_name/:id(.:format)', to: 'quick_dry#show', table_name:/[^\/\.]*/, id:/[\d]*/,as: :instance
|
7
|
+
put '/:table_name/:id(.:format)', to: 'quick_dry#update', table_name:/[^\/\.]*/, id:/[\d]*/
|
8
|
+
patch '/:table_name/:id(.:format)', to: 'quick_dry#update', table_name:/[^\/\.]*/, id:/[\d]*/
|
9
|
+
delete '/:table_name/:id(.:format)', to: 'quick_dry#destroy',table_name:/[^\/\.]*/, id:/[\d]*/
|
10
|
+
get '/:table_name/:id/edit(.:format)', to: 'quick_dry#edit', table_name:/[^\/\.]*/, id:/[\d]*/,as: :edit_instance
|
11
|
+
get '/:table_name/new(.:format)', to: 'quick_dry#new', table_name:/[^\/\.]*/, as: :new_instance
|
12
12
|
|
13
13
|
|
14
14
|
end
|
data/lib/quick_dry/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quick_dry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hanna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -101,31 +101,10 @@ files:
|
|
101
101
|
- test/dummy/README.rdoc
|
102
102
|
- test/dummy/Rakefile
|
103
103
|
- test/dummy/app/assets/javascripts/application.js
|
104
|
-
- test/dummy/app/assets/javascripts/comments.js
|
105
|
-
- test/dummy/app/assets/javascripts/posts.js
|
106
104
|
- test/dummy/app/assets/stylesheets/application.css
|
107
|
-
- test/dummy/app/assets/stylesheets/comments.css
|
108
|
-
- test/dummy/app/assets/stylesheets/posts.css
|
109
|
-
- test/dummy/app/assets/stylesheets/scaffold.css
|
110
105
|
- test/dummy/app/controllers/application_controller.rb
|
111
|
-
- test/dummy/app/controllers/comments_controller.rb
|
112
|
-
- test/dummy/app/controllers/posts_controller.rb
|
113
106
|
- test/dummy/app/helpers/application_helper.rb
|
114
|
-
- test/dummy/app/helpers/comments_helper.rb
|
115
|
-
- test/dummy/app/helpers/posts_helper.rb
|
116
|
-
- test/dummy/app/models/comment.rb
|
117
|
-
- test/dummy/app/models/post.rb
|
118
|
-
- test/dummy/app/views/comments/_form.html.erb
|
119
|
-
- test/dummy/app/views/comments/edit.html.erb
|
120
|
-
- test/dummy/app/views/comments/index.html.erb
|
121
|
-
- test/dummy/app/views/comments/new.html.erb
|
122
|
-
- test/dummy/app/views/comments/show.html.erb
|
123
107
|
- test/dummy/app/views/layouts/application.html.erb
|
124
|
-
- test/dummy/app/views/posts/_form.html.erb
|
125
|
-
- test/dummy/app/views/posts/edit.html.erb
|
126
|
-
- test/dummy/app/views/posts/index.html.erb
|
127
|
-
- test/dummy/app/views/posts/new.html.erb
|
128
|
-
- test/dummy/app/views/posts/show.html.erb
|
129
108
|
- test/dummy/bin/bundle
|
130
109
|
- test/dummy/bin/rails
|
131
110
|
- test/dummy/bin/rake
|
@@ -148,62 +127,10 @@ files:
|
|
148
127
|
- test/dummy/config/locales/en.yml
|
149
128
|
- test/dummy/config/routes.rb
|
150
129
|
- test/dummy/config/secrets.yml
|
151
|
-
- test/dummy/db/development.sqlite3
|
152
|
-
- test/dummy/db/migrate/20141014142634_create_comments.rb
|
153
|
-
- test/dummy/db/migrate/20141014142659_create_posts.rb
|
154
|
-
- test/dummy/db/schema.rb
|
155
|
-
- test/dummy/log/development.log
|
156
130
|
- test/dummy/public/404.html
|
157
131
|
- test/dummy/public/422.html
|
158
132
|
- test/dummy/public/500.html
|
159
133
|
- test/dummy/public/favicon.ico
|
160
|
-
- test/dummy/test/controllers/comments_controller_test.rb
|
161
|
-
- test/dummy/test/controllers/posts_controller_test.rb
|
162
|
-
- test/dummy/test/fixtures/comments.yml
|
163
|
-
- test/dummy/test/fixtures/posts.yml
|
164
|
-
- test/dummy/test/helpers/comments_helper_test.rb
|
165
|
-
- test/dummy/test/helpers/posts_helper_test.rb
|
166
|
-
- test/dummy/test/models/comment_test.rb
|
167
|
-
- test/dummy/test/models/post_test.rb
|
168
|
-
- test/dummy/tmp/cache/assets/development/sprockets/0dd5163be147a1ee2f93f5abb9a0fd32
|
169
|
-
- test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
|
170
|
-
- test/dummy/tmp/cache/assets/development/sprockets/1e8f75a6b5b33970fb8e397347caa0a1
|
171
|
-
- test/dummy/tmp/cache/assets/development/sprockets/206236caf137ae7dd3cae0aac897f4b2
|
172
|
-
- test/dummy/tmp/cache/assets/development/sprockets/24204f742af588c8166d3160b500d20f
|
173
|
-
- test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
174
|
-
- test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
|
175
|
-
- test/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212
|
176
|
-
- test/dummy/tmp/cache/assets/development/sprockets/37c31816befce62c4f5d52026a23287d
|
177
|
-
- test/dummy/tmp/cache/assets/development/sprockets/412ab75ab0fc70ac2d7f96418d4c1d43
|
178
|
-
- test/dummy/tmp/cache/assets/development/sprockets/416150dc3ac35079c94273cc46e90aa6
|
179
|
-
- test/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5
|
180
|
-
- test/dummy/tmp/cache/assets/development/sprockets/5384ad85f52d3272dbc64d46ef3876a4
|
181
|
-
- test/dummy/tmp/cache/assets/development/sprockets/5eccfa2606a027a0b509bdb46f03d701
|
182
|
-
- test/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2
|
183
|
-
- test/dummy/tmp/cache/assets/development/sprockets/73510521b58326509331d135128ad92e
|
184
|
-
- test/dummy/tmp/cache/assets/development/sprockets/8244190c3c743ce907b74854faabcb0b
|
185
|
-
- test/dummy/tmp/cache/assets/development/sprockets/8288ddc9a4e9f4196c50036ee1eda4b8
|
186
|
-
- test/dummy/tmp/cache/assets/development/sprockets/886a4f506bfbabff5d6b407aedbb80d0
|
187
|
-
- test/dummy/tmp/cache/assets/development/sprockets/952d783e1981cc269524cb5a2890409d
|
188
|
-
- test/dummy/tmp/cache/assets/development/sprockets/9c7264225a395d67bc2a2d9181a19571
|
189
|
-
- test/dummy/tmp/cache/assets/development/sprockets/aa844f54ad5b802f23b19beb26e81435
|
190
|
-
- test/dummy/tmp/cache/assets/development/sprockets/ae2c9e8cd2d7afe29ae08c4e049fb57a
|
191
|
-
- test/dummy/tmp/cache/assets/development/sprockets/b3ee3550542b56da2fa6ed034609648c
|
192
|
-
- test/dummy/tmp/cache/assets/development/sprockets/b86ae80f0c5c9fda3e212df5e11179c7
|
193
|
-
- test/dummy/tmp/cache/assets/development/sprockets/b9de2fc513b54720f71ab4d2a2df3004
|
194
|
-
- test/dummy/tmp/cache/assets/development/sprockets/c40e7666f601d5bab36418512d6b76ee
|
195
|
-
- test/dummy/tmp/cache/assets/development/sprockets/c5cb5b72ad5b8996bce2c68b02dff3a5
|
196
|
-
- test/dummy/tmp/cache/assets/development/sprockets/c85016e7bbd4f3adbb7635d01f85d39b
|
197
|
-
- test/dummy/tmp/cache/assets/development/sprockets/cba44a33ec96893200b56f4695586826
|
198
|
-
- test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
199
|
-
- test/dummy/tmp/cache/assets/development/sprockets/d066c004d1fd26ae76a61303a7a18145
|
200
|
-
- test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
201
|
-
- test/dummy/tmp/cache/assets/development/sprockets/e1ca254e5fdbd2901067c0a9d95e6dd5
|
202
|
-
- test/dummy/tmp/cache/assets/development/sprockets/e584db490f8a31d32e707b821c61fa75
|
203
|
-
- test/dummy/tmp/cache/assets/development/sprockets/e912bd2d77f53416b8fa30878918d082
|
204
|
-
- test/dummy/tmp/cache/assets/development/sprockets/f13f0412b3245894f220e57919843e97
|
205
|
-
- test/dummy/tmp/cache/assets/development/sprockets/f3dabd6fc74da6af45a775c1ddb019f7
|
206
|
-
- test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
207
134
|
- test/helpers/quick_dry/quick_dry_helper_test.rb
|
208
135
|
- test/integration/navigation_test.rb
|
209
136
|
- test/quick_dry_test.rb
|
@@ -228,38 +155,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
155
|
version: '0'
|
229
156
|
requirements: []
|
230
157
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.
|
158
|
+
rubygems_version: 2.4.5
|
232
159
|
signing_key:
|
233
160
|
specification_version: 4
|
234
161
|
summary: 'Implements a DRY front end for Ruby on Rails: routes, controllers, and views'
|
235
162
|
test_files:
|
236
163
|
- test/controllers/quick_dry/quick_dry_controller_test.rb
|
237
164
|
- test/dummy/app/assets/javascripts/application.js
|
238
|
-
- test/dummy/app/assets/javascripts/comments.js
|
239
|
-
- test/dummy/app/assets/javascripts/posts.js
|
240
165
|
- test/dummy/app/assets/stylesheets/application.css
|
241
|
-
- test/dummy/app/assets/stylesheets/comments.css
|
242
|
-
- test/dummy/app/assets/stylesheets/posts.css
|
243
|
-
- test/dummy/app/assets/stylesheets/scaffold.css
|
244
166
|
- test/dummy/app/controllers/application_controller.rb
|
245
|
-
- test/dummy/app/controllers/comments_controller.rb
|
246
|
-
- test/dummy/app/controllers/posts_controller.rb
|
247
167
|
- test/dummy/app/helpers/application_helper.rb
|
248
|
-
- test/dummy/app/helpers/comments_helper.rb
|
249
|
-
- test/dummy/app/helpers/posts_helper.rb
|
250
|
-
- test/dummy/app/models/comment.rb
|
251
|
-
- test/dummy/app/models/post.rb
|
252
|
-
- test/dummy/app/views/comments/edit.html.erb
|
253
|
-
- test/dummy/app/views/comments/index.html.erb
|
254
|
-
- test/dummy/app/views/comments/new.html.erb
|
255
|
-
- test/dummy/app/views/comments/show.html.erb
|
256
|
-
- test/dummy/app/views/comments/_form.html.erb
|
257
168
|
- test/dummy/app/views/layouts/application.html.erb
|
258
|
-
- test/dummy/app/views/posts/edit.html.erb
|
259
|
-
- test/dummy/app/views/posts/index.html.erb
|
260
|
-
- test/dummy/app/views/posts/new.html.erb
|
261
|
-
- test/dummy/app/views/posts/show.html.erb
|
262
|
-
- test/dummy/app/views/posts/_form.html.erb
|
263
169
|
- test/dummy/bin/bundle
|
264
170
|
- test/dummy/bin/rails
|
265
171
|
- test/dummy/bin/rake
|
@@ -282,64 +188,12 @@ test_files:
|
|
282
188
|
- test/dummy/config/routes.rb
|
283
189
|
- test/dummy/config/secrets.yml
|
284
190
|
- test/dummy/config.ru
|
285
|
-
- test/dummy/db/development.sqlite3
|
286
|
-
- test/dummy/db/migrate/20141014142634_create_comments.rb
|
287
|
-
- test/dummy/db/migrate/20141014142659_create_posts.rb
|
288
|
-
- test/dummy/db/schema.rb
|
289
|
-
- test/dummy/log/development.log
|
290
191
|
- test/dummy/public/404.html
|
291
192
|
- test/dummy/public/422.html
|
292
193
|
- test/dummy/public/500.html
|
293
194
|
- test/dummy/public/favicon.ico
|
294
195
|
- test/dummy/Rakefile
|
295
196
|
- test/dummy/README.rdoc
|
296
|
-
- test/dummy/test/controllers/comments_controller_test.rb
|
297
|
-
- test/dummy/test/controllers/posts_controller_test.rb
|
298
|
-
- test/dummy/test/fixtures/comments.yml
|
299
|
-
- test/dummy/test/fixtures/posts.yml
|
300
|
-
- test/dummy/test/helpers/comments_helper_test.rb
|
301
|
-
- test/dummy/test/helpers/posts_helper_test.rb
|
302
|
-
- test/dummy/test/models/comment_test.rb
|
303
|
-
- test/dummy/test/models/post_test.rb
|
304
|
-
- test/dummy/tmp/cache/assets/development/sprockets/0dd5163be147a1ee2f93f5abb9a0fd32
|
305
|
-
- test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
|
306
|
-
- test/dummy/tmp/cache/assets/development/sprockets/1e8f75a6b5b33970fb8e397347caa0a1
|
307
|
-
- test/dummy/tmp/cache/assets/development/sprockets/206236caf137ae7dd3cae0aac897f4b2
|
308
|
-
- test/dummy/tmp/cache/assets/development/sprockets/24204f742af588c8166d3160b500d20f
|
309
|
-
- test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
310
|
-
- test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
|
311
|
-
- test/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212
|
312
|
-
- test/dummy/tmp/cache/assets/development/sprockets/37c31816befce62c4f5d52026a23287d
|
313
|
-
- test/dummy/tmp/cache/assets/development/sprockets/412ab75ab0fc70ac2d7f96418d4c1d43
|
314
|
-
- test/dummy/tmp/cache/assets/development/sprockets/416150dc3ac35079c94273cc46e90aa6
|
315
|
-
- test/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5
|
316
|
-
- test/dummy/tmp/cache/assets/development/sprockets/5384ad85f52d3272dbc64d46ef3876a4
|
317
|
-
- test/dummy/tmp/cache/assets/development/sprockets/5eccfa2606a027a0b509bdb46f03d701
|
318
|
-
- test/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2
|
319
|
-
- test/dummy/tmp/cache/assets/development/sprockets/73510521b58326509331d135128ad92e
|
320
|
-
- test/dummy/tmp/cache/assets/development/sprockets/8244190c3c743ce907b74854faabcb0b
|
321
|
-
- test/dummy/tmp/cache/assets/development/sprockets/8288ddc9a4e9f4196c50036ee1eda4b8
|
322
|
-
- test/dummy/tmp/cache/assets/development/sprockets/886a4f506bfbabff5d6b407aedbb80d0
|
323
|
-
- test/dummy/tmp/cache/assets/development/sprockets/952d783e1981cc269524cb5a2890409d
|
324
|
-
- test/dummy/tmp/cache/assets/development/sprockets/9c7264225a395d67bc2a2d9181a19571
|
325
|
-
- test/dummy/tmp/cache/assets/development/sprockets/aa844f54ad5b802f23b19beb26e81435
|
326
|
-
- test/dummy/tmp/cache/assets/development/sprockets/ae2c9e8cd2d7afe29ae08c4e049fb57a
|
327
|
-
- test/dummy/tmp/cache/assets/development/sprockets/b3ee3550542b56da2fa6ed034609648c
|
328
|
-
- test/dummy/tmp/cache/assets/development/sprockets/b86ae80f0c5c9fda3e212df5e11179c7
|
329
|
-
- test/dummy/tmp/cache/assets/development/sprockets/b9de2fc513b54720f71ab4d2a2df3004
|
330
|
-
- test/dummy/tmp/cache/assets/development/sprockets/c40e7666f601d5bab36418512d6b76ee
|
331
|
-
- test/dummy/tmp/cache/assets/development/sprockets/c5cb5b72ad5b8996bce2c68b02dff3a5
|
332
|
-
- test/dummy/tmp/cache/assets/development/sprockets/c85016e7bbd4f3adbb7635d01f85d39b
|
333
|
-
- test/dummy/tmp/cache/assets/development/sprockets/cba44a33ec96893200b56f4695586826
|
334
|
-
- test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
335
|
-
- test/dummy/tmp/cache/assets/development/sprockets/d066c004d1fd26ae76a61303a7a18145
|
336
|
-
- test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
337
|
-
- test/dummy/tmp/cache/assets/development/sprockets/e1ca254e5fdbd2901067c0a9d95e6dd5
|
338
|
-
- test/dummy/tmp/cache/assets/development/sprockets/e584db490f8a31d32e707b821c61fa75
|
339
|
-
- test/dummy/tmp/cache/assets/development/sprockets/e912bd2d77f53416b8fa30878918d082
|
340
|
-
- test/dummy/tmp/cache/assets/development/sprockets/f13f0412b3245894f220e57919843e97
|
341
|
-
- test/dummy/tmp/cache/assets/development/sprockets/f3dabd6fc74da6af45a775c1ddb019f7
|
342
|
-
- test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
343
197
|
- test/helpers/quick_dry/quick_dry_helper_test.rb
|
344
198
|
- test/integration/navigation_test.rb
|
345
199
|
- test/quick_dry_test.rb
|
@@ -1,56 +0,0 @@
|
|
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
|
-
}
|
@@ -1,58 +0,0 @@
|
|
1
|
-
class CommentsController < ApplicationController
|
2
|
-
before_action :set_comment, only: [:show, :edit, :update, :destroy]
|
3
|
-
|
4
|
-
# GET /comments
|
5
|
-
def index
|
6
|
-
@comments = Comment.all
|
7
|
-
end
|
8
|
-
|
9
|
-
# GET /comments/1
|
10
|
-
def show
|
11
|
-
end
|
12
|
-
|
13
|
-
# GET /comments/new
|
14
|
-
def new
|
15
|
-
@comment = Comment.new
|
16
|
-
end
|
17
|
-
|
18
|
-
# GET /comments/1/edit
|
19
|
-
def edit
|
20
|
-
end
|
21
|
-
|
22
|
-
# POST /comments
|
23
|
-
def create
|
24
|
-
@comment = Comment.new(comment_params)
|
25
|
-
|
26
|
-
if @comment.save
|
27
|
-
redirect_to @comment, notice: 'Comment was successfully created.'
|
28
|
-
else
|
29
|
-
render :new
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# PATCH/PUT /comments/1
|
34
|
-
def update
|
35
|
-
if @comment.update(comment_params)
|
36
|
-
redirect_to @comment, notice: 'Comment was successfully updated.'
|
37
|
-
else
|
38
|
-
render :edit
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# DELETE /comments/1
|
43
|
-
def destroy
|
44
|
-
@comment.destroy
|
45
|
-
redirect_to comments_url, notice: 'Comment was successfully destroyed.'
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
# Use callbacks to share common setup or constraints between actions.
|
50
|
-
def set_comment
|
51
|
-
@comment = Comment.find(params[:id])
|
52
|
-
end
|
53
|
-
|
54
|
-
# Only allow a trusted parameter "white list" through.
|
55
|
-
def comment_params
|
56
|
-
params.require(:comment).permit(:User, :body)
|
57
|
-
end
|
58
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
class PostsController < ApplicationController
|
2
|
-
before_action :set_post, only: [:show, :edit, :update, :destroy]
|
3
|
-
|
4
|
-
# GET /posts
|
5
|
-
def index
|
6
|
-
@posts = Post.all
|
7
|
-
end
|
8
|
-
|
9
|
-
# GET /posts/1
|
10
|
-
def show
|
11
|
-
end
|
12
|
-
|
13
|
-
# GET /posts/new
|
14
|
-
def new
|
15
|
-
@post = Post.new
|
16
|
-
end
|
17
|
-
|
18
|
-
# GET /posts/1/edit
|
19
|
-
def edit
|
20
|
-
end
|
21
|
-
|
22
|
-
# POST /posts
|
23
|
-
def create
|
24
|
-
@post = Post.new(post_params)
|
25
|
-
|
26
|
-
if @post.save
|
27
|
-
redirect_to @post, notice: 'Post was successfully created.'
|
28
|
-
else
|
29
|
-
render :new
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# PATCH/PUT /posts/1
|
34
|
-
def update
|
35
|
-
if @post.update(post_params)
|
36
|
-
redirect_to @post, notice: 'Post was successfully updated.'
|
37
|
-
else
|
38
|
-
render :edit
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# DELETE /posts/1
|
43
|
-
def destroy
|
44
|
-
@post.destroy
|
45
|
-
redirect_to posts_url, notice: 'Post was successfully destroyed.'
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
# Use callbacks to share common setup or constraints between actions.
|
50
|
-
def set_post
|
51
|
-
@post = Post.find(params[:id])
|
52
|
-
end
|
53
|
-
|
54
|
-
# Only allow a trusted parameter "white list" through.
|
55
|
-
def post_params
|
56
|
-
params.require(:post).permit(:name, :content)
|
57
|
-
end
|
58
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<%= form_for(@comment) do |f| %>
|
2
|
-
<% if @comment.errors.any? %>
|
3
|
-
<div id="error_explanation">
|
4
|
-
<h2><%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
|
5
|
-
|
6
|
-
<ul>
|
7
|
-
<% @comment.errors.full_messages.each do |message| %>
|
8
|
-
<li><%= message %></li>
|
9
|
-
<% end %>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<div class="field">
|
15
|
-
<%= f.label :User %><br>
|
16
|
-
<%= f.text_field :User %>
|
17
|
-
</div>
|
18
|
-
<div class="field">
|
19
|
-
<%= f.label :body %><br>
|
20
|
-
<%= f.text_field :body %>
|
21
|
-
</div>
|
22
|
-
<div class="actions">
|
23
|
-
<%= f.submit %>
|
24
|
-
</div>
|
25
|
-
<% end %>
|