inline_forms 5.0.22 → 5.0.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/{lib/generators/assets/images → app/assets/images/inline_forms}/glass_plate.gif +0 -0
  3. data/{lib/generators/assets/javascripts → app/assets/javascripts/inline_forms}/ckeditor/config.js +0 -0
  4. data/{lib/generators/assets/javascripts → app/assets/javascripts/inline_forms}/inline_forms.js +9 -0
  5. data/{lib/generators/assets/stylesheets → app/assets/stylesheets/inline_forms}/devise.scss +0 -0
  6. data/{lib/generators/assets/stylesheets → app/assets/stylesheets/inline_forms}/foundation_and_overrides.scss +0 -0
  7. data/app/assets/stylesheets/inline_forms/inline_forms.scss +335 -0
  8. data/bin/inline_forms_installer_core.rb +8 -10
  9. data/config/initializers/paper_trail.rb +7 -0
  10. data/db/migrate/20180116154757_add_object_changes_to_versions.rb +5 -0
  11. data/lib/app/controllers/concerns/versions_concern.rb +25 -0
  12. data/lib/app/controllers/inline_forms_controller.rb +1 -0
  13. data/lib/app/helpers/form_elements/ckeditor.rb +1 -1
  14. data/lib/app/helpers/form_elements/text_area.rb +1 -1
  15. data/lib/app/helpers/inline_forms_helper.rb +28 -0
  16. data/lib/app/views/devise/sessions/_flash.html.erb +7 -0
  17. data/lib/app/views/devise/sessions/_top-bar-and-flash.html.erb +2 -19
  18. data/lib/app/views/devise/sessions/_top-bar.html.erb +12 -0
  19. data/lib/app/views/inline_forms/_show.html.erb +6 -0
  20. data/lib/app/views/inline_forms/_versions.html.erb +14 -0
  21. data/lib/app/views/inline_forms/_versions_list.html.erb +75 -0
  22. data/lib/app/views/inline_forms/versions.js.erb +4 -0
  23. data/lib/app/views/inline_forms/versions_list.js.erb +1 -0
  24. data/lib/app/views/layouts/devise.html.erb +1 -1
  25. data/lib/app/views/layouts/inline_forms.html.erb +2 -1
  26. data/lib/generators/assets/stylesheets/inline_forms.scss +13 -0
  27. data/lib/generators/inline_forms_generator.rb +2 -0
  28. data/lib/generators/templates/paper_trail.rb +7 -0
  29. data/lib/inline_forms.rb +17 -0
  30. data/lib/inline_forms/version.rb +1 -1
  31. data/lib/locales/inline_forms.en.yml +4 -1
  32. metadata +42 -33
  33. data/lib/generators/assets/javascripts/application.js +0 -22
  34. data/lib/generators/assets/stylesheets/application.scss +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acf77cdc0c3da8f53227b0883967be1366219cda
4
- data.tar.gz: 620e3b7126d08e38043bd00d1c91b629adb235f9
3
+ metadata.gz: dd6691df3203712f33899e1d8d1f6e4111d54356
4
+ data.tar.gz: 0507ce2baa082df9a2b0e9f98d050c7c72c9474b
5
5
  SHA512:
6
- metadata.gz: a1effd59c017e1e0ea79a749c3287f88a959890b721b9c285cf122b15147da18f415e147820df5c1596de748156f157f882437bfebea8f071c2f5bab4d081036
7
- data.tar.gz: 6628e7f0d5fd2c3de9ddb1855257652c6bf38e9c47407feeca1bf94456fd16410acb18121597a19a7eadd8ed3f08e68fb94b86d278cbf190ed57d1d99fed06e1
6
+ metadata.gz: 1f5e1b62be60a53bb817bd10a508086bf53a65fa40e22e2eb280b870d364ea017612e042eedae94ddfe3b0e621d98f9e4f7fbe19c36b5888734fb0437ba87e04
7
+ data.tar.gz: ec579cfb48811a98e65bb7328c7764d1f1f8f85341ea18789b11c85e2a385f79ffb7d480134ae2da1d69fd280b6796b0874883a0f9f035bbc5eb9298512c6278
@@ -1,3 +1,12 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require jquery.ui.all
4
+ //= require ckeditor/init
5
+ //= require jquery.timepicker.js
6
+ //= require foundation
7
+ //= require jquery.remotipart
8
+
9
+ $(function(){ $(document).foundation(); });
1
10
  // initialize datepickers
2
11
  $(document).ready(function() {
3
12
  $.datepicker.setDefaults({
@@ -0,0 +1,335 @@
1
+ // inline_forms
2
+ @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,400italic);
3
+ @import 'foundation-icons';
4
+ @import 'themes/jquery.ui.sunny';
5
+ @import 'jquery.ui.all';
6
+ @import 'foundation_and_overrides';
7
+
8
+ .contain-to-grid {
9
+ background-color: $body-bg !important;
10
+ }
11
+
12
+ input {
13
+ margin: 2px 0 !important;
14
+ }
15
+
16
+ select {
17
+ background-color: #fff8e0 !important;
18
+ border: 0 !important;
19
+ margin: 2px 0 !important;
20
+ padding: 0;
21
+
22
+ }
23
+ select:hover, select:focus {
24
+ background-color: lighten(#fff8e0, 2%) !important;
25
+ border: 0 !important;
26
+ }
27
+
28
+ #inline_forms_application_top_bar {
29
+ background-color: #A3381E;
30
+ color: #FFFFFF;
31
+ .top-bar-section li a {
32
+ background-color: #A3381E;
33
+ }
34
+ }
35
+
36
+ #inline_forms_model_top_bar {
37
+ background-color: #E1C150;
38
+ padding-top: 45px;
39
+ height: 90px;
40
+ .top-bar-section {
41
+ .right, li, .has-form {
42
+ background-color: #E1C150;
43
+ }
44
+ .inline_forms_model_top_bar_buttons {
45
+ top: 4px !important;
46
+ padding: 7px 0 7px 0 !important;
47
+ margin: 0 !important;
48
+ }
49
+ .new_button {
50
+ background-color: #E1C150;
51
+ color: #B94C32;
52
+ font-size: 1.3rem;
53
+ padding: 0 2rem 0 1rem;
54
+ }
55
+ .new_button:hover, .new_button:focus {
56
+ color: white;
57
+ -webkit-transition-property: color;
58
+ transition-property: color;
59
+ }
60
+ input[type=text]:hover, input[type=text]:focus {
61
+ background-color: lighten(#fff8e0, 5%);
62
+ -webkit-transition-property: background-color;
63
+ transition-property: background-color;
64
+ }
65
+ }
66
+ }
67
+
68
+ #inline_forms_model_top_bar_container {
69
+ z-index: 9;
70
+ }
71
+
72
+ #outer_container {
73
+ width: 100%;
74
+ position: absolute;
75
+ top: 90px;
76
+ }
77
+
78
+ .top-level a {
79
+ font-weight: bold;
80
+ font-size: 110%;
81
+ }
82
+ .list_container {
83
+ .row {
84
+ font-size: 1.2rem;
85
+ font-weight: normal;
86
+ line-height: 2.2rem;
87
+ margin: 0 auto !important;
88
+ }
89
+ .odd {
90
+ background-color: #FBE38E;
91
+ }
92
+ .even {
93
+ background-color: #FBEEC1;
94
+ }
95
+ }
96
+
97
+ .inline_forms_list, .new_record {
98
+ .row.odd, .row.even {
99
+ font-size: 1rem !important;
100
+ font-weight: normal !important;
101
+ }
102
+ .row.form_element_header {
103
+ border-top: 1px solid #B94C32;
104
+ background-color: rgb(239, 202, 75);
105
+ font-weight: normal !important;
106
+ font-size: 1.3rem !important;
107
+ }
108
+ }
109
+
110
+ .new_record {
111
+ .button {
112
+ margin: 0;
113
+ padding: 0.5rem;
114
+ }
115
+ }
116
+
117
+ .object_presentation {
118
+ background-color: #B94C32;
119
+ color: white;
120
+ .close_button {
121
+ background-color: #B94C32;
122
+ font-size: 1.3rem;
123
+ padding: 0 1rem 0 1rem;
124
+ margin: 0;
125
+ }
126
+ .close_button:hover, .close_button:focus {
127
+ background-color: #B94C32;
128
+ color: #FBEEC1;
129
+ -webkit-transition-property: color;
130
+ transition-property: color;
131
+ }
132
+ }
133
+
134
+ .list_container {
135
+ .row.odd, .row.even {
136
+ font-size: 1rem !important;
137
+ font-weight: normal !important;
138
+ }
139
+ .row.form_element_header {
140
+ border-top: 1px solid #B94C32;
141
+ background-color: rgb(239, 202, 75);
142
+ font-weight: normal !important;
143
+ font-size: 1.3rem !important;
144
+ }
145
+ }
146
+
147
+
148
+
149
+ .associated_auto_header {
150
+ border-top: 1px solid #B94C32;
151
+ .new_button {
152
+ background-color: rgb(239, 202, 75);
153
+ font-size: 1.5rem;
154
+ color: #B94C32;
155
+ padding: 0 0.5rem 0 1rem;
156
+ margin: 0;
157
+ }
158
+ .new_button:hover, .new_button:focus {
159
+ background-color: rgb(239, 202, 75);
160
+ color: white;
161
+ -webkit-transition-property: color;
162
+ transition-property: color;
163
+ }
164
+ .close_button {
165
+ background-color: rgb(239, 202, 75);
166
+ font-size: 1.5rem;
167
+ color: #B94C32;
168
+ padding: 0 0.5rem 0 1rem;
169
+ margin: 0;
170
+ }
171
+ .close_button:hover, .new_button:focus {
172
+ background-color: rgb(239, 202, 75);
173
+ color: white;
174
+ -webkit-transition-property: color;
175
+ transition-property: color;
176
+ }
177
+ }
178
+
179
+ .pagination {
180
+ font-weight: normal;
181
+ font-size: 0.9em;
182
+ a:hover {
183
+ color: #B94C32;
184
+ -webkit-transition-property: color;
185
+ -webkit-transition-duration: 0.3s;
186
+ transition-property: color;
187
+ transition-duration: 0.3s;
188
+ }
189
+ em {
190
+ color: #B94C32;
191
+ font-weight: bold;
192
+ font-style: normal;
193
+ }
194
+ span.disabled {
195
+ color: #AAA;
196
+ }
197
+ }
198
+
199
+ .record_footer {
200
+ background-color: rgb(239, 202, 75);
201
+ height: 0.2em;
202
+ border-bottom: 1px solid #B94C32;
203
+ margin-bottom: 1.5em;
204
+ }
205
+
206
+ .flash {
207
+ margin-top: 1em;
208
+ padding: 0.5em;
209
+ color: #A3381E;
210
+ font-size: 130%;
211
+ font-weight: bold;
212
+ line-height: 120%;
213
+ background-color: white;
214
+ border-top: 0.5em solid #fade7a;
215
+ }
216
+
217
+ .custom-combobox {
218
+ position: relative;
219
+ display: inline-block;
220
+ }
221
+ .custom-combobox-toggle {
222
+ position: absolute;
223
+ top: 0;
224
+ bottom: 0;
225
+ margin-left: -1px;
226
+ padding: 0;
227
+ /* support: IE7 */
228
+ *height: 1.7em;
229
+ *top: 0.1em;
230
+ }
231
+ .custom-combobox-input {
232
+ margin: 0;
233
+ padding: 0.3em;
234
+ }
235
+
236
+
237
+ .column {
238
+ padding-right: 0 !important;
239
+ }
240
+
241
+ .top-bar input, .top-bar .button {
242
+ top: 4px !important;
243
+ }
244
+
245
+ .top-bar-section {
246
+ padding-left: rem-calc(12) !important;
247
+ padding-right: rem-calc(12) !important;
248
+ }
249
+
250
+ .first-bar {
251
+ margin-bottom: 0 !important;
252
+ }
253
+ .second-bar {
254
+ margin-top: 1px !important;
255
+ margin-bottom: 0 !important;
256
+ }
257
+
258
+ #switch_user_identifier {
259
+ font-size: smaller;
260
+ select {
261
+ width: 5em;
262
+ }
263
+ }
264
+
265
+
266
+ .error {
267
+ color: #ffffff;
268
+ font-weight: bold;
269
+ -moz-border-radius: 10px;
270
+ -webkit-border-radius: 10px;
271
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0, .1);
272
+ -moz-box-shadow: 0 1px 1px rgba(0,0,0, .1);
273
+ background-color: #a70f0f;
274
+ background-image: -moz-linear-gradient(100% 100% 90deg, #a70f0f, #c01313);
275
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#c01313), to(#a70f0f));
276
+ padding: 0.7em;
277
+ }
278
+ .success {
279
+ color: #ffffff;
280
+ font-weight: bold;
281
+ -moz-border-radius: 5px;
282
+ -webkit-border-radius: 5px;
283
+ -webkit-box-shadow: 0 1px 3px rgba(0,0,0, .4);
284
+ -moz-box-shadow: 0 1px 3px rgba(0,0,0, .4);
285
+ border-bottom: 1px solid #cccccc;
286
+ background-color: #4f8d0d;
287
+ background-image: -moz-linear-gradient(100% 100% 90deg, #4f8d0d, #5ba210);
288
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#5ba210), to(#4f8d0d));
289
+ padding: 0.7em;
290
+ margin-bottom: 0.5em;
291
+ }
292
+
293
+ .ckeditor_area {
294
+ position: relative;
295
+ }
296
+
297
+ .ckeditor_area .glass_plate {
298
+ position: absolute;
299
+ top: -1px;
300
+ width: 98%;
301
+ height: 232px;
302
+ border: 0;
303
+ }
304
+
305
+ .ckeditor_area .cke_top, .ckeditor_area .cke_bottom, .ckeditor_area .cke_border {
306
+ display: none;
307
+ }
308
+
309
+ /* jQuery ui Slider 8 */
310
+ .slider {
311
+ width: 300px;
312
+ float: left;
313
+ }
314
+ .slider_value {
315
+ float: left;
316
+ min-width: 60px;
317
+ text-align: right;
318
+ font-family: monospace;
319
+ }
320
+
321
+
322
+ /* LEFT */
323
+
324
+ #category_id {
325
+ margin-top: -2px !important;
326
+ }
327
+
328
+ #input_search {
329
+ border: none !important;
330
+ margin-top: -2px;
331
+ }
332
+
333
+ #inline_forms_model_top_bar .top-bar-section .inline_forms_model_top_bar_buttons {
334
+ top: 6px !important;
335
+ }
@@ -33,6 +33,8 @@ gem 'figaro'
33
33
  gem 'unicorn'
34
34
  gem 'validation_hints'
35
35
  gem 'will_paginate' #, git: 'https://github.com/acesuares/will_paginate.git'
36
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
37
+ gem 'turbolinks', '~> 5'
36
38
 
37
39
  gem_group :development do
38
40
  gem 'bundler'
@@ -92,6 +94,8 @@ route <<-ROUTE.strip_heredoc
92
94
  devise_for :users, :path_prefix => 'auth'
93
95
  resources :users do
94
96
  post 'revert', :on => :member
97
+ get 'list_versions', :on => :member
98
+ get 'close_versions_list', :on => :member
95
99
  end
96
100
  ROUTE
97
101
 
@@ -275,19 +279,13 @@ say "- Copy images..."
275
279
  copy_file File.join(GENERATOR_PATH, 'lib/generators/assets/images' , image), File.join('app/assets/images' , image)
276
280
  end
277
281
 
278
- say "- Copy stylesheets..."
279
- remove_file 'app/assets/stylesheets/application.css'
280
- remove_file 'app/assets/stylesheets/foundation_and_overrides.scss'
281
- %w(application.scss devise.scss foundation_and_overrides.scss inline_forms.scss).each do |stylesheet|
282
- copy_file File.join(GENERATOR_PATH, 'lib/generators/assets/stylesheets' , stylesheet), File.join('app/assets/stylesheets' , stylesheet)
283
- end
284
-
285
282
  say "- Copy javascripts..."
286
283
  remove_file 'app/assets/javascripts/application.js'
287
284
  %w(application.js inline_forms.js).each do |javascript|
288
285
  copy_file File.join(GENERATOR_PATH, 'lib/generators/assets/javascripts' , javascript), File.join('app/assets/javascripts' , javascript)
289
286
  end
290
287
 
288
+
291
289
  say "- Add human_attribute_name in app/models/application_record.rb"
292
290
  remove_file 'app/models/application_record.rb' # the one that 'rails new' created
293
291
  copy_file File.join(GENERATOR_PATH, 'lib/generators/templates/application_record.rb'), "app/models/application_record.rb"
@@ -302,12 +300,12 @@ application "config.autoload_paths += %W(\#{config.root}/app/models/ckeditor)"
302
300
  say "- Set languages for ckeditor to ['en', 'nl'] in config/initializers/ckeditor.rb..."
303
301
  insert_into_file "config/initializers/ckeditor.rb", " config.assets_languages = ['en', 'nl']\n", :after => "config.assets_languages = ['en', 'uk']\n"
304
302
 
305
- say "- Create ckeditor config.js"
306
- copy_file File.join(GENERATOR_PATH, 'lib/generators/assets/javascripts/ckeditor/config.js'), "app/assets/javascripts/ckeditor/config.js"
307
-
308
303
  say "- Paper_trail install..."
309
304
  generate "paper_trail:install" # TODO One day, we need some management tools so we can actually SEE the versions, restore them etc.
310
305
 
306
+ say "- Import migrations from engines"
307
+ run "bundle exec rails railties:install:migrations" # This is needed to add changeset field to the paper_trail versions table
308
+
311
309
  # Create Translations
312
310
  say "- Generate models and tables and views for translations..." # TODO Translations need to be done in inline_forms, and then generate a yml file, perhaps
313
311
  generate "inline_forms", "InlineFormsLocale name:string inline_forms_translations:belongs_to _enabled:yes _presentation:\#{name}"
@@ -0,0 +1,7 @@
1
+ PaperTrail.config.track_associations = false
2
+
3
+ PaperTrail::Version.class_eval do
4
+ def author
5
+ User.find(whodunnit) if whodunnit
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class AddObjectChangesToVersions < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :versions, :object_changes, :text
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ module VersionsConcern
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ before_action :set_paper_trail_whodunnit
6
+ end
7
+
8
+ def list_versions
9
+ @update_span = params[:update]
10
+ @object = referenced_object
11
+ respond_to do |format|
12
+ format.html { } unless @Klass.not_accessible_through_html?
13
+ format.js { render :versions_list }
14
+ end
15
+ end
16
+
17
+ def close_versions_list
18
+ @update_span = params[:update]
19
+ @object = referenced_object
20
+ respond_to do |format|
21
+ format.html { } unless @Klass.not_accessible_through_html?
22
+ format.js { render :versions }
23
+ end
24
+ end
25
+ end
@@ -23,6 +23,7 @@
23
23
  #
24
24
  class InlineFormsController < ApplicationController
25
25
  include CancanConcern
26
+ include VersionsConcern
26
27
 
27
28
  before_action :getKlass
28
29
 
@@ -17,7 +17,7 @@ def ckeditor_show(object, attribute)
17
17
  :toolbarCanCollapse => "false"
18
18
  }
19
19
  ) +
20
- image_tag( 'glass_plate.gif',
20
+ image_tag( 'inline_forms/glass_plate.gif',
21
21
  :class => "glass_plate",
22
22
  :title => '' ) +
23
23
  "<script>delete CKEDITOR.instances['textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}']</script>".html_safe +
@@ -21,7 +21,7 @@ def text_area_show(object, attribute)
21
21
  :toolbarCanCollapse => "false"
22
22
  }
23
23
  ) +
24
- image_tag( 'glass_plate.gif',
24
+ image_tag( 'inline_forms/glass_plate.gif',
25
25
  :class => "glass_plate",
26
26
  :title => '' ) +
27
27
  "<script>delete CKEDITOR.instances['textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}']</script>".html_safe +
@@ -88,6 +88,34 @@ module InlineFormsHelper
88
88
  end
89
89
  end
90
90
 
91
+ # link to versions list
92
+ def link_to_versions_list(path_to_versions_list, object, update_span, html_class = 'button new_button')
93
+ out = (link_to "<i class='fi-list'></i>".html_safe,
94
+ send(path_to_versions_list,
95
+ object,
96
+ :update => update_span,
97
+ ),
98
+ :remote => true,
99
+ :class => html_class,
100
+ :title => t('inline_forms.view.list_versions')
101
+ )
102
+ if current_user.role? :superadmin
103
+ raw out
104
+ end
105
+ end
106
+
107
+ # close versions list link
108
+ def close_versions_list_link(object, update_span, html_class = 'button close_button' )
109
+ link_to "<i class='fi-x'></i>".html_safe,
110
+ send('close_versions_list_' + @object.class.to_s.underscore + "_path",
111
+ object,
112
+ :update => update_span
113
+ ),
114
+ :remote => true,
115
+ :class => html_class,
116
+ :title => t('inline_forms.view.close_versions_list')
117
+ end
118
+
91
119
  # link_to_inline_edit
92
120
  def link_to_inline_edit(object, attribute, attribute_value='')
93
121
  attribute_value = attribute_value.to_s
@@ -0,0 +1,7 @@
1
+ <% if !flash.empty? %>
2
+ <div id='inline_forms_devise_flash_div' class='row'>
3
+ <% flash.each do |name, msg| %>
4
+ <%= content_tag :div, msg, :id => "flash_#{name}", :class => 'devise flash' %>
5
+ <% end %>
6
+ </div>
7
+ <% end %>
@@ -1,19 +1,2 @@
1
- <div class='contain-to-grid'>
2
- <nav id='inline_forms_devise_top_nav_bar' class='top-bar' data-topbar>
3
- <ul class='title-area'>
4
- <li class='name'>
5
- <h1><a href='/'><%= t('inline_forms.devise.title_for_devise') %> <%= InlineForms::VERSION %></a></h1>
6
- </li>
7
- <li class='toggle-topbar menu-icon'>
8
- <a href='#'><span></span></a>
9
- </li>
10
- </ul>
11
- </nav>
12
- </div>
13
-
14
- <div id='inline_forms_devise_flash_div' class='row'>
15
- <% flash = @flash %>
16
- <% flash.each do |name, msg| %>
17
- <%= content_tag :div, msg, :id => "flash_#{name}", :class => 'devise flash' %>
18
- <% end unless flash.blank? %>
19
- </div>
1
+ <%= render 'top-bar' %>
2
+ <%= render 'flash' %>
@@ -0,0 +1,12 @@
1
+ <div class='contain-to-grid'>
2
+ <nav id='inline_forms_devise_top_nav_bar' class='top-bar' data-topbar>
3
+ <ul class='title-area'>
4
+ <li class='name'>
5
+ <h1><a href='/'><%= t('inline_forms.devise.title_for_devise') %> <%= InlineForms::VERSION %></a></h1>
6
+ </li>
7
+ <li class='toggle-topbar menu-icon'>
8
+ <a href='#'><span></span></a>
9
+ </li>
10
+ </ul>
11
+ </nav>
12
+ </div>
@@ -115,6 +115,12 @@
115
115
  <% end %>
116
116
  <% end %>
117
117
  <% end %>
118
+ <% if current_user.role? :superadmin %>
119
+ <% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_versions" -%>
120
+ <div id="<%= css_class_id -%>">
121
+ <%= render 'versions' %>
122
+ </div>
123
+ <% end %>
118
124
  <div class="record_footer"></div>
119
125
  </div>
120
126
  </div>
@@ -0,0 +1,14 @@
1
+ <% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_versions" -%>
2
+ <div class="row form_element_header associated_auto_header callout">
3
+ <div class='medium-11 large-11 column' >
4
+ <%= "Versions (#{@object.versions.length})" %>
5
+ </div>
6
+ <div class='medium-1 large-1 column'>
7
+ <%= link_to_versions_list(
8
+ 'list_versions_' + @object.class.to_s.underscore + "_path",
9
+ @object,
10
+ css_class_id
11
+ )
12
+ %>
13
+ </div>
14
+ </div>
@@ -0,0 +1,75 @@
1
+ <% path_to_object = @object.class.to_s.underscore + '_path' %>
2
+ <% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_versions" -%>
3
+ <div class="row form_element_header associated_auto_header callout">
4
+ <div class='medium-11 large-11 column' >
5
+ <%= "Versions (#{@object.versions.length})" %>
6
+ </div>
7
+ <div class='medium-1 large-1 column'>
8
+ <%= close_versions_list_link(
9
+ @object,
10
+ css_class_id
11
+ )
12
+ %>
13
+ </div>
14
+ </div>
15
+ <div class="row <%= cycle('odd', 'even') %>">
16
+ <div class='small-12 column'>
17
+ <div class="small-1 column">
18
+ &nbsp;
19
+ </div>
20
+ <div class="small-1 column">
21
+ <strong>Event</strong>
22
+ </div>
23
+ <div class="small-2 column">
24
+ <strong>Done by</strong>
25
+ </div>
26
+ <div class="small-8 column">
27
+ <strong>Changeset</strong>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ <div class="row <%= cycle('odd', 'even') %>">
32
+ <% @object.versions.reverse.each do | version | %>
33
+ <div class='small-12 column'>
34
+ <div class="small-1 column">
35
+ <%= link_to t('inline_forms.view.restore'),
36
+ send('revert_' + @object.class.to_s.underscore + "_path",
37
+ version,
38
+ :update => "#{@object.class.name.underscore}_#{@object.id}"
39
+ ),
40
+ :remote => true,
41
+ :method => :post
42
+ %>
43
+ </div>
44
+ <div class="small-1 column">
45
+ <%= version.event -%>
46
+ </div>
47
+ <div class="small-2 column">
48
+ <%= version.whodunnit.nil? ? 'nil' : version.author.name -%>
49
+ </div>
50
+ <div class="small-8 column">
51
+ <% if version.changeset.empty? %>
52
+ <em>empty</em>
53
+ <% else %>
54
+ <% version.changeset.each do |attribute, value| %>
55
+ <% next if attribute == 'updated_at' %>
56
+ <table>
57
+ <tr>
58
+ <th colspan="2" class="text-center"><%= attribute %></th>
59
+ <th></th>
60
+ </tr>
61
+ <tr>
62
+ <td>old value</td>
63
+ <td>new value</td>
64
+ </tr>
65
+ <tr>
66
+ <td><%= value[0] %></td>
67
+ <td><%= value[1] %></td>
68
+ </tr>
69
+ </table>
70
+ <% end %>
71
+ <% end %>
72
+ </div>
73
+ </div>
74
+ <% end %>
75
+ </div>
@@ -0,0 +1,4 @@
1
+ $('#<%= @update_span %>').fadeOut("slow", function() {
2
+ $(this).html('<%= escape_javascript(render(:partial => 'inline_forms/versions' ))%>');
3
+ $(this).fadeIn("slow");
4
+ });
@@ -0,0 +1 @@
1
+ $('#<%= @update_span %>').html('<%= escape_javascript(render(:partial => 'inline_forms/versions_list' ))%>')
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  <%= t('inline_forms.general.application_title') %> v<%= InlineForms::VERSION %>
8
8
  </title>
9
- <%= stylesheet_link_tag "devise" %>
9
+ <%= stylesheet_link_tag "inline_forms/devise" %>
10
10
  <%= csrf_meta_tags %>
11
11
  </head>
12
12
 
@@ -5,6 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title><%= t('application_name') + " v" + InlineForms::VERSION -%></title>
7
7
  <%= stylesheet_link_tag "application" %>
8
+ <%= stylesheet_link_tag "inline_forms/inline_forms" %>
8
9
  <%= csrf_meta_tags %>
9
10
  </head>
10
11
 
@@ -14,6 +15,6 @@
14
15
  <div id="outer_container">
15
16
  <%= yield %>
16
17
  </div>
17
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
18
+ <%= javascript_include_tag 'inline_forms/inline_forms', 'data-turbolinks-track' => true %>
18
19
  </body>
19
20
  </html>
@@ -161,6 +161,19 @@ select:hover, select:focus {
161
161
  -webkit-transition-property: color;
162
162
  transition-property: color;
163
163
  }
164
+ .close_button {
165
+ background-color: rgb(239, 202, 75);
166
+ font-size: 1.5rem;
167
+ color: #B94C32;
168
+ padding: 0 0.5rem 0 1rem;
169
+ margin: 0;
170
+ }
171
+ .close_button:hover, .new_button:focus {
172
+ background-color: rgb(239, 202, 75);
173
+ color: white;
174
+ -webkit-transition-property: color;
175
+ transition-property: color;
176
+ }
164
177
  }
165
178
 
166
179
  .pagination {
@@ -172,6 +172,8 @@ module InlineForms
172
172
  route <<-ROUTE.strip_heredoc
173
173
  resources :#{resource_name} do
174
174
  post 'revert', :on => :member
175
+ get 'list_versions', :on => :member
176
+ get 'close_versions_list', :on => :member
175
177
  end
176
178
  ROUTE
177
179
  end
@@ -0,0 +1,7 @@
1
+ PaperTrail.config.track_associations = false
2
+
3
+ PaperTrail::Version.class_eval do
4
+ def author
5
+ User.find(whodunnit) if whodunnit
6
+ end
7
+ end
data/lib/inline_forms.rb CHANGED
@@ -144,6 +144,23 @@ module InlineForms
144
144
  paths["app/views"] << "lib/app/views"
145
145
  paths["app/assets"] << "lib/app/assets"
146
146
 
147
+ initializer :append_migrations do |app|
148
+ unless app.root.to_s.match(root.to_s)
149
+ config.paths["db/migrate"].expanded.each do |path|
150
+ app.config.paths["db/migrate"] << path
151
+ end
152
+ end
153
+ end
154
+
155
+ initializer "inline_forms.assets.precompile" do |app|
156
+ app.config.assets.precompile += %w( inline_forms/inline_forms.scss
157
+ inline_forms/devise.css
158
+ inline_forms/inline_forms.js
159
+ inline_forms/ckeditor/config.js
160
+ inline_forms/glass_plate.gif
161
+ )
162
+ end
163
+
147
164
  I18n.load_path << Dir[File.join(File.expand_path(File.dirname(__FILE__) + '/locales'), '*.yml')]
148
165
  I18n.load_path.flatten!
149
166
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "5.0.22"
3
+ VERSION = "5.0.23"
4
4
  end
@@ -27,7 +27,10 @@ en:
27
27
  close: close
28
28
  add_new: make a new %{model}
29
29
  undo: undo
30
+ restore: restore
30
31
  trash: trash
32
+ list_versions: List versions
33
+ close_versions_list: Close versions list
31
34
  succes: success.
32
35
  activerecord:
33
36
  models:
@@ -35,4 +38,4 @@ en:
35
38
  attributes:
36
39
  client:
37
40
  first_name: first name
38
- last_name: last name
41
+ last_name: last name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.22
4
+ version: 5.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -10,132 +10,132 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-23 00:00:00.000000000 Z
13
+ date: 2018-02-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rvm
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">="
19
+ - - '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ">="
26
+ - - '>='
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: thor
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ">="
33
+ - - '>='
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ">="
40
+ - - '>='
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: validation_hints
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
47
+ - - '>='
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ">="
54
+ - - '>='
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rails
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ">="
61
+ - - '>='
62
62
  - !ruby/object:Gem::Version
63
63
  version: '5.0'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ">="
68
+ - - '>='
69
69
  - !ruby/object:Gem::Version
70
70
  version: '5.0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rails-i18n
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ">="
75
+ - - '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ">="
82
+ - - '>='
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rspec-rails
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ">="
89
+ - - '>='
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ">="
96
+ - - '>='
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: shoulda
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - ">="
103
+ - - '>='
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ">="
110
+ - - '>='
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: bundler
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ">="
117
+ - - '>='
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - ">="
124
+ - - '>='
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: jeweler
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - ">="
131
+ - - '>='
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - ">="
138
+ - - '>='
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  description: Inline Forms aims to ease the setup of forms that provide inline editing.
@@ -149,18 +149,27 @@ executables:
149
149
  extensions: []
150
150
  extra_rdoc_files: []
151
151
  files:
152
- - ".document"
153
- - ".gitignore"
154
- - ".vscode/settings.json"
152
+ - .document
153
+ - .gitignore
154
+ - .vscode/settings.json
155
155
  - Gemfile
156
156
  - LICENSE.txt
157
157
  - README.rdoc
158
158
  - Rakefile
159
+ - app/assets/images/inline_forms/glass_plate.gif
160
+ - app/assets/javascripts/inline_forms/ckeditor/config.js
161
+ - app/assets/javascripts/inline_forms/inline_forms.js
162
+ - app/assets/stylesheets/inline_forms/devise.scss
163
+ - app/assets/stylesheets/inline_forms/foundation_and_overrides.scss
164
+ - app/assets/stylesheets/inline_forms/inline_forms.scss
159
165
  - bin/inline_forms
160
166
  - bin/inline_forms_app_template.rb
161
167
  - bin/inline_forms_installer_core.rb
168
+ - config/initializers/paper_trail.rb
169
+ - db/migrate/20180116154757_add_object_changes_to_versions.rb
162
170
  - inline_forms.gemspec
163
171
  - lib/app/controllers/concerns/cancan_concern.rb
172
+ - lib/app/controllers/concerns/versions_concern.rb
164
173
  - lib/app/controllers/geo_code_curacao_controller.rb
165
174
  - lib/app/controllers/inline_forms_application_controller.rb
166
175
  - lib/app/controllers/inline_forms_controller.rb
@@ -215,8 +224,10 @@ files:
215
224
  - lib/app/views/devise/passwords/_top-bar-and-flash.html.erb
216
225
  - lib/app/views/devise/passwords/edit.html.erb
217
226
  - lib/app/views/devise/passwords/new.html.erb
227
+ - lib/app/views/devise/sessions/_flash.html.erb
218
228
  - lib/app/views/devise/sessions/_form.html.erb
219
229
  - lib/app/views/devise/sessions/_top-bar-and-flash.html.erb
230
+ - lib/app/views/devise/sessions/_top-bar.html.erb
220
231
  - lib/app/views/devise/sessions/new.html.erb
221
232
  - lib/app/views/devise/shared/_header_and_errors.html.erb
222
233
  - lib/app/views/devise/shared/_links.erb
@@ -231,6 +242,8 @@ files:
231
242
  - lib/app/views/inline_forms/_new_nested.html.erb
232
243
  - lib/app/views/inline_forms/_show.html.erb
233
244
  - lib/app/views/inline_forms/_tree.html.erb
245
+ - lib/app/views/inline_forms/_versions.html.erb
246
+ - lib/app/views/inline_forms/_versions_list.html.erb
234
247
  - lib/app/views/inline_forms/close.js.erb
235
248
  - lib/app/views/inline_forms/edit.js.erb
236
249
  - lib/app/views/inline_forms/extract_translations.erb
@@ -240,17 +253,12 @@ files:
240
253
  - lib/app/views/inline_forms/show_element.js.erb
241
254
  - lib/app/views/inline_forms/show_undo.js.erb
242
255
  - lib/app/views/inline_forms/update.js.erb
256
+ - lib/app/views/inline_forms/versions.js.erb
257
+ - lib/app/views/inline_forms/versions_list.js.erb
243
258
  - lib/app/views/layouts/application.html.erb
244
259
  - lib/app/views/layouts/devise.html.erb
245
260
  - lib/app/views/layouts/inline_forms.html.erb
246
261
  - lib/generators/USAGE
247
- - lib/generators/assets/images/glass_plate.gif
248
- - lib/generators/assets/javascripts/application.js
249
- - lib/generators/assets/javascripts/ckeditor/config.js
250
- - lib/generators/assets/javascripts/inline_forms.js
251
- - lib/generators/assets/stylesheets/application.scss
252
- - lib/generators/assets/stylesheets/devise.scss
253
- - lib/generators/assets/stylesheets/foundation_and_overrides.scss
254
262
  - lib/generators/assets/stylesheets/inline_forms.scss
255
263
  - lib/generators/inline_forms_generator.rb
256
264
  - lib/generators/templates/_inline_forms_tabs.html.erb
@@ -263,6 +271,7 @@ files:
263
271
  - lib/generators/templates/controller.erb
264
272
  - lib/generators/templates/migration.erb
265
273
  - lib/generators/templates/model.erb
274
+ - lib/generators/templates/paper_trail.rb
266
275
  - lib/generators/templates/test.erb
267
276
  - lib/generators/templates/unicorn/production.rb
268
277
  - lib/inline_forms.rb
@@ -288,17 +297,17 @@ require_paths:
288
297
  - lib
289
298
  required_ruby_version: !ruby/object:Gem::Requirement
290
299
  requirements:
291
- - - ">="
300
+ - - '>='
292
301
  - !ruby/object:Gem::Version
293
302
  version: '0'
294
303
  required_rubygems_version: !ruby/object:Gem::Requirement
295
304
  requirements:
296
- - - ">="
305
+ - - '>='
297
306
  - !ruby/object:Gem::Version
298
307
  version: '0'
299
308
  requirements: []
300
309
  rubyforge_project: inline_forms
301
- rubygems_version: 2.5.1
310
+ rubygems_version: 2.4.8
302
311
  signing_key:
303
312
  specification_version: 4
304
313
  summary: Inline editing of forms.
@@ -1,22 +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 vendor/assets/javascripts of plugins, if any, 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
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require jquery.ui.all
16
- //= require ckeditor/init
17
- //= require jquery.timepicker.js
18
- //= require foundation
19
- //= require jquery.remotipart
20
- //= require inline_forms
21
-
22
- $(function(){ $(document).foundation(); });
@@ -1,16 +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 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 jquery.ui.core
12
- *= require jquery.ui.theme
13
- *= require foundation_and_overrides
14
- *= require jquery.timepicker.css
15
- *= require inline_forms
16
- */