Skip to content

Commit fb3056a

Browse files
committed
Setup demo app for Rails 4
This application is required in order to test Strong Parameters
1 parent 4bf35d4 commit fb3056a

15 files changed

Lines changed: 129 additions & 19 deletions

File tree

spec/dummy4/.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "vendor/assets/components"
3+
}

spec/dummy4/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515
/log/*
1616
!/log/.keep
1717
/tmp
18+
*/cloudinary.yml
19+
vendor/assets/
20+
db/

spec/dummy4/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ group :development, :test do
4343
gem 'spring'
4444
end
4545

46+
gem 'cloudinary'
47+
gem 'attachinary'
48+
gem 'bootstrap-sass', '~> 3.3.5'

spec/dummy4/Gemfile.lock

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,24 @@ GEM
3737
thread_safe (~> 0.3, >= 0.3.4)
3838
tzinfo (~> 1.1)
3939
arel (6.0.2)
40+
attachinary (1.3.0)
41+
cloudinary (~> 1.0.69)
42+
rails (>= 3.2)
43+
autoprefixer-rails (5.2.1.1)
44+
execjs
45+
json
46+
aws_cf_signer (0.1.3)
4047
binding_of_caller (0.7.2)
4148
debug_inspector (>= 0.0.1)
49+
bootstrap-sass (3.3.5.1)
50+
autoprefixer-rails (>= 5.0.0.1)
51+
sass (>= 3.3.0)
4252
builder (3.2.2)
4353
byebug (5.0.0)
4454
columnize (= 0.9.0)
55+
cloudinary (1.0.85)
56+
aws_cf_signer
57+
rest-client
4558
coffee-rails (4.1.0)
4659
coffee-script (>= 2.2.0)
4760
railties (>= 4.0.0, < 5.0)
@@ -51,10 +64,14 @@ GEM
5164
coffee-script-source (1.9.1.1)
5265
columnize (0.9.0)
5366
debug_inspector (0.0.2)
67+
domain_name (0.5.24)
68+
unf (>= 0.0.5, < 1.0.0)
5469
erubis (2.7.0)
5570
execjs (2.5.2)
5671
globalid (0.3.5)
5772
activesupport (>= 4.1.0)
73+
http-cookie (1.0.2)
74+
domain_name (~> 0.5)
5875
i18n (0.7.0)
5976
jbuilder (2.3.1)
6077
activesupport (>= 3.0.0, < 5)
@@ -72,6 +89,7 @@ GEM
7289
mini_portile (0.6.2)
7390
minitest (5.7.0)
7491
multi_json (1.11.2)
92+
netrc (0.10.3)
7593
nokogiri (1.6.6.2)
7694
mini_portile (~> 0.6.0)
7795
rack (1.6.4)
@@ -104,6 +122,10 @@ GEM
104122
rake (10.4.2)
105123
rdoc (4.2.0)
106124
json (~> 1.4)
125+
rest-client (1.8.0)
126+
http-cookie (>= 1.0.2, < 2.0)
127+
mime-types (>= 1.16, < 3.0)
128+
netrc (~> 0.7)
107129
sass (3.4.16)
108130
sass-rails (5.0.3)
109131
railties (>= 4.0.0, < 5.0)
@@ -132,6 +154,9 @@ GEM
132154
uglifier (2.7.1)
133155
execjs (>= 0.3.0)
134156
json (>= 1.8.0)
157+
unf (0.1.4)
158+
unf_ext
159+
unf_ext (0.0.7.1)
135160
web-console (2.2.1)
136161
activemodel (>= 4.0)
137162
binding_of_caller (>= 0.7.2)
@@ -142,7 +167,10 @@ PLATFORMS
142167
ruby
143168

144169
DEPENDENCIES
170+
attachinary
171+
bootstrap-sass (~> 3.3.5)
145172
byebug
173+
cloudinary
146174
coffee-rails (~> 4.1.0)
147175
jbuilder (~> 2.0)
148176
jquery-rails

spec/dummy4/app/assets/javascripts/application.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,19 @@
1313
//= require jquery
1414
//= require jquery_ujs
1515
//= require turbolinks
16+
//= require bootstrap-sprockets
17+
//= require blueimp-file-upload/js/vendor/jquery.ui.widget
18+
//= require blueimp-file-upload/js/jquery.iframe-transport
19+
//= require blueimp-file-upload/js/jquery.fileupload
20+
//= require cloudinary/jquery.cloudinary
21+
//= require attachinary
22+
1623
//= require_tree .
24+
25+
26+
//jQuery(function() {
27+
$(document).on('ready page:chagne page:load', function(e){
28+
$('.attachinary-input').attachinary();
29+
});
30+
31+
//});

spec/dummy4/app/assets/stylesheets/application.css renamed to spec/dummy4/app/assets/stylesheets/application.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
1111
* file per style scope.
1212
*
13-
*= require_tree .
14-
*= require_self
1513
*/
14+
15+
// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
16+
@import "bootstrap-sprockets";
17+
@import "bootstrap";
18+
@import "posts";

spec/dummy4/app/controllers/posts_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ def set_post
6969

7070
# Never trust parameters from the scary internet, only allow the white list through.
7171
def post_params
72-
params.require(:post).permit(:title, :body, :published)
72+
params.require(:post).permit(:title, :body, :published, :photo)
7373
end
7474
end

spec/dummy4/app/models/post.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
class Post < ActiveRecord::Base
2+
3+
has_attachment :photo
4+
25
end

spec/dummy4/app/views/layouts/application.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
<title>Dummy4</title>
55
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
66
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7+
<%= cloudinary_js_config %>
78
<%= csrf_meta_tags %>
89
</head>
9-
<body>
10+
<body class="container">
1011

1112
<%= yield %>
1213

spec/dummy4/app/views/posts/_form.html.erb

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,30 @@
1010
</ul>
1111
</div>
1212
<% end %>
13-
14-
<div class="field">
13+
<div class="form-group">
14+
<div class="field form-group">
1515
<%= f.label :title %><br>
16-
<%= f.text_field :title %>
16+
<%= f.text_field :title, class: "form-control" %>
1717
</div>
18-
<div class="field">
18+
<div class="field form-group">
1919
<%= f.label :body %><br>
20-
<%= f.text_area :body %>
20+
<%= f.text_area :body, class: "form-control" %>
21+
</div>
22+
<div class="field form-group">
23+
<div class="input-group">
24+
<span class="input-group-addon">
25+
<%= f.check_box :published, class: "checkbox" %>
26+
27+
</span>
28+
<%= f.label :published, class: "form-control" %>
29+
</div>
2130
</div>
22-
<div class="field">
23-
<%= f.label :published %><br>
24-
<%= f.check_box :published %>
31+
<div class="field form-group">
32+
<%= f.label :photo%>
33+
<%= f.attachinary_file_field :photo %>
2534
</div>
2635
<div class="actions">
2736
<%= f.submit %>
2837
</div>
38+
</div>
2939
<% end %>

0 commit comments

Comments
 (0)