snaptable 2.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +230 -0
  3. data/Rakefile +1 -9
  4. data/app/assets/stylesheets/snaptable/table.css.scss +56 -52
  5. data/app/views/snaptable/base.html.erb +23 -21
  6. data/lib/snaptable/version.rb +1 -1
  7. metadata +4 -75
  8. data/test/dummy/Rakefile +0 -6
  9. data/test/dummy/app/assets/javascripts/application.js +0 -13
  10. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  11. data/test/dummy/app/controllers/application_controller.rb +0 -5
  12. data/test/dummy/app/helpers/application_helper.rb +0 -2
  13. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  14. data/test/dummy/bin/bundle +0 -3
  15. data/test/dummy/bin/rails +0 -4
  16. data/test/dummy/bin/rake +0 -4
  17. data/test/dummy/bin/setup +0 -29
  18. data/test/dummy/config/application.rb +0 -26
  19. data/test/dummy/config/boot.rb +0 -5
  20. data/test/dummy/config/database.yml +0 -25
  21. data/test/dummy/config/environment.rb +0 -5
  22. data/test/dummy/config/environments/development.rb +0 -41
  23. data/test/dummy/config/environments/production.rb +0 -79
  24. data/test/dummy/config/environments/test.rb +0 -42
  25. data/test/dummy/config/initializers/assets.rb +0 -11
  26. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  27. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  28. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  29. data/test/dummy/config/initializers/inflections.rb +0 -16
  30. data/test/dummy/config/initializers/mime_types.rb +0 -4
  31. data/test/dummy/config/initializers/session_store.rb +0 -3
  32. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  33. data/test/dummy/config/locales/en.yml +0 -23
  34. data/test/dummy/config/routes.rb +0 -56
  35. data/test/dummy/config/secrets.yml +0 -22
  36. data/test/dummy/config.ru +0 -4
  37. data/test/dummy/public/404.html +0 -67
  38. data/test/dummy/public/422.html +0 -67
  39. data/test/dummy/public/500.html +0 -66
  40. data/test/dummy/public/favicon.ico +0 -0
  41. data/test/integration/navigation_test.rb +0 -8
  42. data/test/snaptable_test.rb +0 -7
  43. data/test/test_helper.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd1d36813feff2abd769b78bcc5aebe4340ba890
4
- data.tar.gz: 2d918c32f5a8366a04b6a6c33e8041299384c3fa
3
+ metadata.gz: a47cdc0973b24df9558a52bca76c5db61ebc66c4
4
+ data.tar.gz: 41ef5c4837577bcfdbefc45427a62a92db8fe0b6
5
5
  SHA512:
6
- metadata.gz: 26c5addcad41645f4c13599f28827a7a437dc27e7e95b5b6b9a7a395fb8de73721aac1326e09978f02b2186f89dec2b99ef169dd565b5861f8919dd09dea991c
7
- data.tar.gz: 75d2ecaff90b2c9095c2b2e2c49ea1724cc621b70b90931dc3c1db4a881ef64a9a37a4f2530d58330c273e335c2aabec630ca5612f2842fc2754062009895582
6
+ metadata.gz: fd322359ab58269b6a42b6be0a63c05371e27a1a48467590d249fbf37ea764f20f87e21c1c55594040c6991b9d04eabff1d3038dbbaf62777d794d2663c3996a
7
+ data.tar.gz: 4398927f2d24d004dc72d897e716561eaf56787a452d8dbffb426e6b5be51b9bc543a8ab72a6d2265cd9c15b8da92113da893137bb3a82dc5f6c68480ff1b39c
data/README.md ADDED
@@ -0,0 +1,230 @@
1
+ # Snaptable
2
+
3
+ A gem that generate HTML tables from your models in order to display them in your admin views. It supports pagination, sorting and searching. It is also possible to customize the tables.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'snaptable'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install snaptable
20
+
21
+ Include the assets:
22
+
23
+ ```css
24
+ # application.css
25
+ /*
26
+ *= require_self
27
+ *= require_tree .
28
+ *= require snaptable
29
+ */
30
+
31
+ ```
32
+
33
+ ```js
34
+ # application.js
35
+ //= require_tree .
36
+ //= require snaptable
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ### Basic table
42
+
43
+ In your controller, instantiate a new `Table` with minimum two arguments: the controller itself and the model to use.
44
+
45
+ ```ruby
46
+ def index
47
+ @table = Table.new(self, Article)
48
+ end
49
+ ```
50
+
51
+ Then, in order to enable sorting, call the method `respond` on the table.
52
+
53
+ ```ruby
54
+ def index
55
+ @table = Table.new(self, Article)
56
+ @table.respond
57
+ end
58
+ ```
59
+
60
+ Finally, in your view, generate the table where you wish.
61
+
62
+ ```html
63
+ <div>
64
+ <%= @table.present %>
65
+ </div>
66
+ ```
67
+
68
+ The elements in the table are clickable. Click on an element and use the links above the table to edit or destroy it. If you double-click, you are directly redirect to the edit page. Furthermore, the columns are sortable. Click on a label to sort the data by a column.
69
+
70
+ ### Options
71
+
72
+ You can customize the table when you instantiate it. Pass you own collection in the third argument.
73
+
74
+ ```ruby
75
+ @articles = Article.last(3)
76
+ Table.new(self, Article, @articles)
77
+ ```
78
+
79
+ Pass the options in the fourth argument. Here is a list:
80
+
81
+ * buttons [true]: enable the buttons above the table to add, edit or destroy an element.
82
+ * search [false]: enable searching. Add a search field above the table.
83
+
84
+ ```ruby
85
+ Table.new(self, Article, nil, { search: true, buttons: false })
86
+ ```
87
+
88
+ You can also configure the table in the view. The `present` method takes a single named argument to let you add a custom buttons bar. Pass the name of a partial to the parameter `buttons` and the content will be added above the table.
89
+
90
+ ```erb
91
+ <div>
92
+ <%= @table.present(buttons: "my_custom_partial") %>
93
+ </div>
94
+ ```
95
+ To help you build your custom buttons header, you are provided two helper methods for each of the possible actions (add, show, edit, delete):
96
+
97
+ * `#{action}_button` returns the HTML code to display the button for the desired action, e.g `add_button`.
98
+ * `#{action}_button?` returns if the user is allowed to see the desired button, e.g. `delete_button?`.
99
+
100
+ ```erb
101
+ <div id="custom-buttons">
102
+ <p>This is my custom table header !</p>
103
+ <%= add_button if add_button? %>
104
+ <div>
105
+ ```
106
+
107
+ Notice that you can customize the buttons header application-wide. With the following options, you decide which buttons are displayed by default.
108
+
109
+ ```ruby
110
+ Snaptable.add_button = true
111
+ Snaptable.edit_button = true
112
+ Snaptable.delete_button = true
113
+ Snaptable.show_button = false
114
+ ```
115
+
116
+ ### Custom class
117
+
118
+ If you need more control on the displayed fields or on the search, you can easily create your own table.
119
+ Create a directory `app/tables`. Then create a file `my_model_table.rb`. Inside declare a class `MyModelTable` that inherits from `BaseTable`.
120
+ You must necessarily write a method called `model` that returns the model to use for your table.
121
+
122
+ ```ruby
123
+ # article_table.rb
124
+ class ArticleTable < BaseTable
125
+
126
+ def model
127
+ Article
128
+ end
129
+
130
+ end
131
+ ```
132
+
133
+ From that point, you have a working table, but it acts exactly the same than the basic table. You have few possibilities to change the behavior.
134
+ If you want to change the table's columns, write a method `attributes` that returns an array of the model's attributes you want to display. It supports associations by allowing you to put a hash.
135
+
136
+ ```ruby
137
+ def attributes
138
+ [:title, :content, { user: :name }]
139
+ end
140
+ ```
141
+
142
+ You can also change how the URL to edit and delete an element is generated. By default, it uses the element's id, but you can specify an other attribute. Write a method `url` that returns an attribute.
143
+
144
+ ```ruby
145
+ def url
146
+ :slug
147
+ end
148
+ ```
149
+
150
+ By default, the search is done on the string fields of the model. If you want to search on the associations, create a module `Search` inside the class. Then declare a method `self.fields` that returns a hash and `self.associations` that returns an array. Be careful, the search is only possible on string fields.
151
+
152
+ ```ruby
153
+ class ArticleTable < BaseTable
154
+
155
+ def model
156
+ Article
157
+ end
158
+
159
+ def attributes
160
+ [:title, :content, { user: :name }]
161
+ end
162
+
163
+ def url
164
+ :slug
165
+ end
166
+
167
+ module Search
168
+
169
+ def self.associations
170
+ [:user, :category]
171
+ end
172
+
173
+ def self.fields
174
+ { articles: [:title, :content], user: [:name, :email], category: [:name] }
175
+ end
176
+
177
+ end
178
+ ```
179
+
180
+ ### Multiple tables
181
+
182
+ Snaptable supports multiple tables on the same page. However, if you want sorting for your tables to work, then type the following in the controller:
183
+
184
+ ```ruby
185
+ def index
186
+ @user_table = UserTable.new(self)
187
+ @group_table = GroupTable.new(self)
188
+ Snaptable.respond_with(self, @user_table, @group_table)
189
+ end
190
+ ```
191
+
192
+ ### Enums
193
+
194
+ The gem supports enum's type in your model. If it detects a column that is an enum, it will automatically looks for the localized path `#{model.model_name.singular}.#{enum.pluralize}.#{enum_value}`. For example: `member.statuses.active`.
195
+
196
+ ### i18n
197
+
198
+ To display date & time columns, the gem uses a format named `snaptable`. You can easily override it in your localization file:
199
+
200
+ ```yml
201
+ # en.yml
202
+
203
+ time:
204
+ format:
205
+ snaptable: "%m.d.%y %H:%M"
206
+
207
+ ```
208
+
209
+ See the [localization files](config/locales) to see all the keys you can override.
210
+
211
+ ### Gotchas
212
+
213
+ If you're using Postgresql, array types and want to enable searching, then you must create a custom table and specify the fields to search (see above). You must exclude the array columns from the search or it will raise an error.
214
+
215
+ ### Permission
216
+
217
+ if you want to use the `adeia` gem which provides a permission system:
218
+
219
+ ```ruby
220
+ # initializers/snaptable.rb
221
+ Snaptable.use_permission = true
222
+ ```
223
+
224
+ ## Contributing
225
+
226
+ 1. Fork it ( https://github.com/khcr/snaptable/fork )
227
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
228
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
229
+ 4. Push to the branch (`git push origin my-new-feature`)
230
+ 5. Create a new Pull Request
data/Rakefile CHANGED
@@ -4,12 +4,4 @@ rescue LoadError
4
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
8
- load 'rails/tasks/engine.rake'
9
-
10
-
11
- load 'rails/tasks/statistics.rake'
12
-
13
-
14
-
15
- Bundler::GemHelper.install_tasks
7
+ Bundler::GemHelper.install_tasks
@@ -7,67 +7,71 @@
7
7
  }
8
8
  width: 100%;
9
9
  font-family: "helvetica neue", "helvetica", "sans-serif";
10
- overflow: auto;
11
10
  a {
12
11
  text-decoration: none;
13
12
  }
14
- // show scrollbar
15
- &::-webkit-scrollbar {
16
- -webkit-appearance: none;
17
- width: 7px;
18
- }
19
- &::-webkit-scrollbar-thumb {
20
- border-radius: 4px;
21
- background-color: rgba(0,0,0,.5);
22
- -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
23
- }
24
13
 
25
- table {
26
- border-collapse: collapse;
27
- width: 100%;
28
- max-width: 100%;
29
- line-height: 25px;
30
- margin: 20px 0 20px 0;
31
- thead {
32
- tr {
33
- th {
34
- vertical-align: bottom;
35
- border-bottom: 1px solid #DADADA;
36
- padding: 10px 8px 5px 8px;
37
- font-size: 13px;
38
- text-align: left;
39
- background: #3d3d3e;
40
- color: #c0c0c0;
41
- font-weight: 400;
42
- &:not(:first-child) {
43
- }
44
- &:not(:last-child) {
45
- }
46
- a {
47
- color:#c0c0c0;
48
- font-weight: bold;
14
+ .table_container {
15
+ overflow: auto;
16
+
17
+ // show scrollbar
18
+ &::-webkit-scrollbar {
19
+ -webkit-appearance: none;
20
+ width: 7px;
21
+ }
22
+ &::-webkit-scrollbar-thumb {
23
+ border-radius: 4px;
24
+ background-color: rgba(0,0,0,.5);
25
+ -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
26
+ }
27
+
28
+ table {
29
+ border-collapse: collapse;
30
+ width: 100%;
31
+ max-width: 100%;
32
+ line-height: 25px;
33
+ margin: 20px 0 20px 0;
34
+ thead {
35
+ tr {
36
+ th {
37
+ vertical-align: bottom;
38
+ border-bottom: 1px solid #DADADA;
39
+ padding: 10px 8px 5px 8px;
40
+ font-size: 13px;
41
+ text-align: left;
42
+ background: #3d3d3e;
43
+ color: #c0c0c0;
44
+ font-weight: 400;
45
+ &:not(:first-child) {
46
+ }
47
+ &:not(:last-child) {
48
+ }
49
+ a {
50
+ color:#c0c0c0;
51
+ font-weight: bold;
52
+ }
49
53
  }
50
54
  }
51
55
  }
52
- }
53
- tbody {
54
- td {
55
- font-size: 12px;
56
- color: #333;
57
- padding: 7px 8px;
58
- &:not(:first-child) {
59
- border-left: 1px solid #DADADA;
56
+ tbody {
57
+ td {
58
+ font-size: 12px;
59
+ color: #333;
60
+ padding: 7px 8px;
61
+ &:not(:first-child) {
62
+ border-left: 1px solid #DADADA;
63
+ }
60
64
  }
61
65
  }
62
- }
63
- tr.odd {
64
- background: #fff;
65
- }
66
- tr.even {
67
- background: #f8f8f8;
68
- }
69
- tr.selected {
70
- background: #F0BEBE;
66
+ tr.odd {
67
+ background: #fff;
68
+ }
69
+ tr.even {
70
+ background: #f8f8f8;
71
+ }
72
+ tr.selected {
73
+ background: #F0BEBE;
74
+ }
71
75
  }
72
76
  }
73
77
 
@@ -5,28 +5,30 @@
5
5
  <%= render presenter.instance_variable_get(:@buttons) unless presenter.options[:buttons] == false %>
6
6
  </div>
7
7
 
8
- <table>
9
- <thead>
10
- <tr>
11
- <% presenter.column_names.each do |column| %>
12
- <th><%= presenter.sortable(column) %></th>
8
+ <div class="table_container">
9
+ <table>
10
+ <thead>
11
+ <tr>
12
+ <% presenter.column_names.each do |column| %>
13
+ <th><%= presenter.sortable(column) %></th>
14
+ <% end %>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% if presenter.records.any? %>
19
+ <% presenter.records.each do |record| %>
20
+ <tr class="<%= cycle('odd', 'even') %>" data-url="<%= record.send(presenter.url) %>">
21
+ <% presenter.values(record).each do |value| %>
22
+ <td><%= truncate((strip_tags value), length: 40) %></td>
23
+ <% end %>
24
+ </tr>
25
+ <% end %>
26
+ <% else %>
27
+ <tr><td class="none" colspan="<%= presenter.column_names.count %>"><%= t("table.nothing") %></td></tr>
13
28
  <% end %>
14
- </tr>
15
- </thead>
16
- <tbody>
17
- <% if presenter.records.any? %>
18
- <% presenter.records.each do |record| %>
19
- <tr class="<%= cycle('odd', 'even') %>" data-url="<%= record.send(presenter.url) %>">
20
- <% presenter.values(record).each do |value| %>
21
- <td><%= truncate((strip_tags value), length: 40) %></td>
22
- <% end %>
23
- </tr>
24
- <% end %>
25
- <% else %>
26
- <tr><td class="none" colspan="<%= presenter.column_names.count %>"><%= t("table.nothing") %></td></tr>
27
- <% end %>
28
- </tbody>
29
- </table>
29
+ </tbody>
30
+ </table>
31
+ </div>
30
32
  <%= will_paginate presenter.records, param_name: presenter.paginate_key, params: { table: presenter.table_name } %>
31
33
 
32
34
  </div>
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "2.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-26 00:00:00.000000000 Z
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -89,6 +89,7 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - MIT-LICENSE
92
+ - README.md
92
93
  - Rakefile
93
94
  - app/assets/javascripts/snaptable.js
94
95
  - app/assets/javascripts/snaptable/table.js
@@ -109,42 +110,6 @@ files:
109
110
  - lib/snaptable/helpers/buttons_helper.rb
110
111
  - lib/snaptable/helpers/table_helper.rb
111
112
  - lib/snaptable/version.rb
112
- - test/dummy/Rakefile
113
- - test/dummy/app/assets/javascripts/application.js
114
- - test/dummy/app/assets/stylesheets/application.css
115
- - test/dummy/app/controllers/application_controller.rb
116
- - test/dummy/app/helpers/application_helper.rb
117
- - test/dummy/app/views/layouts/application.html.erb
118
- - test/dummy/bin/bundle
119
- - test/dummy/bin/rails
120
- - test/dummy/bin/rake
121
- - test/dummy/bin/setup
122
- - test/dummy/config.ru
123
- - test/dummy/config/application.rb
124
- - test/dummy/config/boot.rb
125
- - test/dummy/config/database.yml
126
- - test/dummy/config/environment.rb
127
- - test/dummy/config/environments/development.rb
128
- - test/dummy/config/environments/production.rb
129
- - test/dummy/config/environments/test.rb
130
- - test/dummy/config/initializers/assets.rb
131
- - test/dummy/config/initializers/backtrace_silencers.rb
132
- - test/dummy/config/initializers/cookies_serializer.rb
133
- - test/dummy/config/initializers/filter_parameter_logging.rb
134
- - test/dummy/config/initializers/inflections.rb
135
- - test/dummy/config/initializers/mime_types.rb
136
- - test/dummy/config/initializers/session_store.rb
137
- - test/dummy/config/initializers/wrap_parameters.rb
138
- - test/dummy/config/locales/en.yml
139
- - test/dummy/config/routes.rb
140
- - test/dummy/config/secrets.yml
141
- - test/dummy/public/404.html
142
- - test/dummy/public/422.html
143
- - test/dummy/public/500.html
144
- - test/dummy/public/favicon.ico
145
- - test/integration/navigation_test.rb
146
- - test/snaptable_test.rb
147
- - test/test_helper.rb
148
113
  homepage: http://github.com/khcr/snaptable
149
114
  licenses:
150
115
  - MIT
@@ -170,40 +135,4 @@ signing_key:
170
135
  specification_version: 4
171
136
  summary: A gem that generate HTML tables from your models in order to display them
172
137
  in your admin views.
173
- test_files:
174
- - test/dummy/app/assets/javascripts/application.js
175
- - test/dummy/app/assets/stylesheets/application.css
176
- - test/dummy/app/controllers/application_controller.rb
177
- - test/dummy/app/helpers/application_helper.rb
178
- - test/dummy/app/views/layouts/application.html.erb
179
- - test/dummy/bin/bundle
180
- - test/dummy/bin/rails
181
- - test/dummy/bin/rake
182
- - test/dummy/bin/setup
183
- - test/dummy/config/application.rb
184
- - test/dummy/config/boot.rb
185
- - test/dummy/config/database.yml
186
- - test/dummy/config/environment.rb
187
- - test/dummy/config/environments/development.rb
188
- - test/dummy/config/environments/production.rb
189
- - test/dummy/config/environments/test.rb
190
- - test/dummy/config/initializers/assets.rb
191
- - test/dummy/config/initializers/backtrace_silencers.rb
192
- - test/dummy/config/initializers/cookies_serializer.rb
193
- - test/dummy/config/initializers/filter_parameter_logging.rb
194
- - test/dummy/config/initializers/inflections.rb
195
- - test/dummy/config/initializers/mime_types.rb
196
- - test/dummy/config/initializers/session_store.rb
197
- - test/dummy/config/initializers/wrap_parameters.rb
198
- - test/dummy/config/locales/en.yml
199
- - test/dummy/config/routes.rb
200
- - test/dummy/config/secrets.yml
201
- - test/dummy/config.ru
202
- - test/dummy/public/404.html
203
- - test/dummy/public/422.html
204
- - test/dummy/public/500.html
205
- - test/dummy/public/favicon.ico
206
- - test/dummy/Rakefile
207
- - test/integration/navigation_test.rb
208
- - test/snaptable_test.rb
209
- - test/test_helper.rb
138
+ test_files: []
data/test/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Rails.application.load_tasks
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,15 +0,0 @@
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
data/test/dummy/bin/rake DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
data/test/dummy/bin/setup DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
-
4
- # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
-
7
- Dir.chdir APP_ROOT do
8
- # This script is a starting point to setup your application.
9
- # Add necessary setup steps to this file:
10
-
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
14
-
15
- # puts "\n== Copying sample files =="
16
- # unless File.exist?("config/database.yml")
17
- # system "cp config/database.yml.sample config/database.yml"
18
- # end
19
-
20
- puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
22
-
23
- puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
26
-
27
- puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
29
- end