inline_forms 6.0.6 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.txt +1 -1
- data/app/assets/javascripts/inline_forms/inline_forms.js +1 -0
- data/app/controllers/inline_forms_application_controller.rb +2 -2
- data/app/controllers/inline_forms_controller.rb +35 -38
- data/app/helpers/inline_forms_helper.rb +48 -38
- data/app/views/inline_forms/_close.html.erb +2 -1
- data/app/views/inline_forms/_header.html.erb +1 -1
- data/app/views/inline_forms/_list.html.erb +2 -1
- data/app/views/inline_forms/_new.html.erb +1 -1
- data/app/views/inline_forms/_show.html.erb +1 -1
- data/app/views/inline_forms/_versions_list.html.erb +5 -2
- data/app/views/inline_forms/record_destroyed.js.erb +1 -0
- data/bin/inline_forms_installer_core.rb +45 -136
- data/inline_forms.gemspec +1 -6
- data/lib/generators/templates/capistrano/Capfile +0 -5
- data/lib/generators/templates/migration.erb +1 -1
- data/lib/inline_forms/version.rb +1 -1
- metadata +21 -83
- data/lib/generators/templates/abstract_mysql2_adapter.rb +0 -3
- data/lib/generators/templates/application.yml.blank +0 -59
- data/lib/generators/templates/paper_trail.rb +0 -7
- data/lib/otherstuff/bump +0 -13
- data/lib/otherstuff/diffie +0 -2
- data/lib/otherstuff/fixtures/rails.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b280e63417aebf00d9254f8f565d46136cff645b9853d7e3e92091531583722f
|
4
|
+
data.tar.gz: bfb39dbe69a962a7bbbe721625db46e397a1f99cbe168ad569b9942f20182499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 352aad514005fa9092ea1519c1494df2761bfdfeb2b0ea286dc36c7889939d7458236970ca763cccc43a742157b1fff75ce17b4227293122b59015150c44fea1
|
7
|
+
data.tar.gz: 99a34153380f2d246993f09f36813937c4a7c2348d631ee1f17e3680356c25b00d4bff0f719041d73e3b0ba9e27f163ffa6e46376d6467a362a39f23e03657f3
|
data/LICENSE.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
class InlineFormsApplicationController < ActionController::Base
|
3
3
|
protect_from_forgery
|
4
4
|
layout 'devise' if :devise_controller?
|
5
|
-
|
5
|
+
|
6
6
|
# limit available locales by setting this. Override in applicaton_controller.
|
7
7
|
I18n.available_locales = [ :en, :nl, :pp ]
|
8
8
|
|
@@ -10,7 +10,7 @@ class InlineFormsApplicationController < ActionController::Base
|
|
10
10
|
def set_locale
|
11
11
|
I18n.locale = extract_locale_from_subdomain || I18n.default_locale
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
# Get locale code from request subdomain (like http://it.application.local:3000)
|
15
15
|
def extract_locale_from_subdomain
|
16
16
|
locale = request.subdomains.first
|
@@ -95,7 +95,7 @@ class InlineFormsController < ApplicationController
|
|
95
95
|
@update_span = params[:update]
|
96
96
|
attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list
|
97
97
|
attributes.each do | attribute, name, form_element |
|
98
|
-
send("#{form_element.to_s}_update", @object, attribute) unless form_element == :tree || form_element == :associated || (cancan_enabled? && cannot?(:read, @
|
98
|
+
send("#{form_element.to_s}_update", @object, attribute) unless form_element == :tree || form_element == :associated || (cancan_enabled? && cannot?(:read, @object, attribute))
|
99
99
|
end
|
100
100
|
@parent_class = params[:parent_class]
|
101
101
|
@parent_id = params[:parent_id]
|
@@ -180,29 +180,41 @@ class InlineFormsController < ApplicationController
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
-
# :
|
183
|
+
# :soft_delete
|
184
|
+
def soft_delete
|
185
|
+
@update_span = params[:update]
|
186
|
+
@object = referenced_object
|
187
|
+
# destroy the object
|
188
|
+
@object.soft_delete(current_user)
|
189
|
+
respond_to do |format|
|
190
|
+
format.html { } unless @Klass.not_accessible_through_html?
|
191
|
+
format.js { render :close }
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
# :soft_restore
|
196
|
+
def soft_restore
|
197
|
+
@update_span = params[:update]
|
198
|
+
@object = referenced_object
|
199
|
+
# restore the object
|
200
|
+
@object.soft_restore
|
201
|
+
respond_to do |format|
|
202
|
+
format.html { } unless @Klass.not_accessible_through_html?
|
203
|
+
format.js { render :close }
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# :destroy destroys the record. There is no undo!
|
184
208
|
def destroy
|
185
209
|
@update_span = params[:update]
|
186
210
|
@object = referenced_object
|
187
211
|
if current_user.role? :superadmin
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
format.html { } unless @Klass.not_accessible_through_html?
|
192
|
-
format.js { render :close }
|
193
|
-
end
|
194
|
-
elsif
|
195
|
-
@object.destroy
|
196
|
-
respond_to do |format|
|
197
|
-
format.html { } unless @Klass.not_accessible_through_html?
|
198
|
-
format.js { render :show_undo }
|
199
|
-
end
|
200
|
-
end
|
201
|
-
elsif (@object.soft_deletable? rescue false)
|
202
|
-
@object.soft_delete(current_user)
|
212
|
+
# destroy the object
|
213
|
+
@undo_object = @object.versions.last
|
214
|
+
@object.destroy
|
203
215
|
respond_to do |format|
|
204
216
|
format.html { } unless @Klass.not_accessible_through_html?
|
205
|
-
format.js { render :
|
217
|
+
format.js { render :record_destroyed }
|
206
218
|
end
|
207
219
|
end
|
208
220
|
end
|
@@ -211,27 +223,12 @@ class InlineFormsController < ApplicationController
|
|
211
223
|
# Thanks Ryan Bates: http://railscasts.com/episodes/255-undo-with-paper-trail
|
212
224
|
def revert
|
213
225
|
@update_span = params[:update]
|
226
|
+
@object = referenced_object
|
214
227
|
if current_user.role? :superadmin
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
format.html { } unless @Klass.not_accessible_through_html?
|
220
|
-
format.js { render :close }
|
221
|
-
end
|
222
|
-
elsif
|
223
|
-
@version = PaperTrail::Version.find(params[:id])
|
224
|
-
@version.reify.save!
|
225
|
-
@object = @Klass.find(@version.item_id)
|
226
|
-
authorize!(:revert, @object) if cancan_enabled?
|
227
|
-
respond_to do |format|
|
228
|
-
format.html { } unless @Klass.not_accessible_through_html?
|
229
|
-
format.js { render :close }
|
230
|
-
end
|
231
|
-
end
|
232
|
-
elsif (@object.soft_deletable? rescue false)
|
233
|
-
@object = referenced_object
|
234
|
-
@object.soft_restore
|
228
|
+
@version = PaperTrail::Version.find(params[:id])
|
229
|
+
@version.reify.save!
|
230
|
+
@object = @Klass.find(@version.item_id)
|
231
|
+
authorize!(:revert, @object) if cancan_enabled?
|
235
232
|
respond_to do |format|
|
236
233
|
format.html { } unless @Klass.not_accessible_through_html?
|
237
234
|
format.js { render :close }
|
@@ -30,37 +30,44 @@ module InlineFormsHelper
|
|
30
30
|
:title => t('inline_forms.view.close')
|
31
31
|
end
|
32
32
|
|
33
|
-
#
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
object,
|
40
|
-
:update => update_span ),
|
41
|
-
:method => :delete,
|
42
|
-
:remote => true,
|
43
|
-
:title => t('inline_forms.view.trash')
|
44
|
-
end
|
45
|
-
elsif (object.class.safe_deletable? rescue false)
|
46
|
-
if object.deleted? && (cancan_disabled? || ( can? :revert, object ))
|
47
|
-
link_to "undelete".html_safe,
|
48
|
-
send( 'revert_' + object.class.to_s.underscore + '_path',
|
33
|
+
# delete link. Mind the difference between delete and destroy.
|
34
|
+
def link_to_soft_delete( object, update_span )
|
35
|
+
soft=''
|
36
|
+
if (object.soft_deletable? rescue false)
|
37
|
+
if object.deleted? && (cancan_disabled? || ( can? :soft_restore, object ))
|
38
|
+
soft = link_to "<i class='fi-refresh'></i>".html_safe,
|
39
|
+
send( 'soft_restore_' + object.class.to_s.underscore + '_path',
|
49
40
|
object,
|
50
41
|
:update => update_span ),
|
51
42
|
:method => :post,
|
52
43
|
:remote => true,
|
53
|
-
:title => t('inline_forms.view.
|
54
|
-
elsif !object.deleted? && (cancan_disabled? || ( can? :
|
55
|
-
link_to "<i class='fi-trash'></i>".html_safe,
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
44
|
+
:title => t('inline_forms.view.undelete')
|
45
|
+
elsif !object.deleted? && (cancan_disabled? || ( can? :soft_delete, object ))
|
46
|
+
soft = link_to "<i class='fi-trash'></i>".html_safe,
|
47
|
+
send( 'soft_delete_' + object.class.to_s.underscore + '_path',
|
48
|
+
object,
|
49
|
+
:update => update_span ),
|
50
|
+
:method => :post,
|
51
|
+
:remote => true,
|
52
|
+
:title => t('inline_forms.view.trash')
|
62
53
|
end
|
63
54
|
end
|
55
|
+
soft.html_safe
|
56
|
+
end
|
57
|
+
|
58
|
+
# destroy link. Mind the difference between delete and destroy.
|
59
|
+
def link_to_destroy( object, update_span )
|
60
|
+
hard=''
|
61
|
+
if cancan_disabled? || ( can? :destroy, object )
|
62
|
+
hard = link_to " <font color='FF0000'><i class='fi-x'></i></font>".html_safe,
|
63
|
+
send( object.class.to_s.underscore + '_path',
|
64
|
+
object,
|
65
|
+
:update => update_span ),
|
66
|
+
:method => :delete,
|
67
|
+
:remote => true,
|
68
|
+
:title => t('inline_forms.view.trash')
|
69
|
+
end
|
70
|
+
hard.html_safe
|
64
71
|
end
|
65
72
|
|
66
73
|
# new link
|
@@ -76,7 +83,7 @@ module InlineFormsHelper
|
|
76
83
|
:title => t('inline_forms.view.add_new', :model => model.model_name.human )
|
77
84
|
)
|
78
85
|
if cancan_enabled?
|
79
|
-
if can? :create, model
|
86
|
+
if can? :create, model
|
80
87
|
if parent_class.nil?
|
81
88
|
raw out
|
82
89
|
else
|
@@ -90,17 +97,19 @@ module InlineFormsHelper
|
|
90
97
|
|
91
98
|
# link to versions list
|
92
99
|
def link_to_versions_list(path_to_versions_list, object, update_span, html_class = 'button new_button')
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
if can? :list_versions, object
|
101
|
+
if defined?(PaperTrail) && object.respond_to?(:versions)
|
102
|
+
out = (link_to "<i class='fi-list'></i>".html_safe,
|
103
|
+
send(path_to_versions_list,
|
104
|
+
object,
|
105
|
+
:update => update_span,
|
106
|
+
),
|
107
|
+
:remote => true,
|
108
|
+
:class => html_class,
|
109
|
+
:title => t('inline_forms.view.list_versions')
|
110
|
+
)
|
111
|
+
raw out
|
112
|
+
end
|
104
113
|
end
|
105
114
|
end
|
106
115
|
|
@@ -123,7 +132,8 @@ module InlineFormsHelper
|
|
123
132
|
spaces = attribute_value.length > 40 ? 0 : 40 - attribute_value.length
|
124
133
|
value = h(attribute_value) + (" " * spaces).html_safe
|
125
134
|
css_class_id = "#{object.class.to_s.underscore}_#{object.id}_#{attribute}"
|
126
|
-
if cancan_disabled? || ( can? :update, object, attribute )
|
135
|
+
if (cancan_disabled? rescue true) || ( can? :update, object, attribute )
|
136
|
+
# some problem with concerns makes this function not available when called direct. FIXME
|
127
137
|
link_to value,
|
128
138
|
send( 'edit_' + object.class.to_s.underscore + '_path',
|
129
139
|
object,
|
@@ -1,5 +1,6 @@
|
|
1
|
-
<% if cancan_disabled? || ( can? :
|
1
|
+
<% if cancan_disabled? || ( can? :soft_delete, @object ) %>
|
2
2
|
<div class="small-1 column">
|
3
|
+
<%= link_to_soft_delete(@object, @update_span) -%>
|
3
4
|
<%= link_to_destroy(@object, @update_span) -%>
|
4
5
|
</div>
|
5
6
|
<div class="small-11 column">
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<% MODEL_TABS.each do |m| %>
|
23
23
|
<% model = m.singularize.camelcase.constantize rescue nil %>
|
24
24
|
<% unless model.nil? || model.not_accessible_through_html? %>
|
25
|
-
<% if can? :update,
|
25
|
+
<% if can? :update, model %>
|
26
26
|
<li>
|
27
27
|
<%= link_to model.model_name.human, '/' + m %>
|
28
28
|
</li>
|
@@ -53,8 +53,9 @@
|
|
53
53
|
<% path_to_object = attribute.to_s.singularize.underscore + "_path" %>
|
54
54
|
<% end %>
|
55
55
|
<div class="row <%= cycle('odd', 'even') %><%= " top-level" if parent_class.nil? %>" id="<%= css_class_id -%>">
|
56
|
-
<% if cancan_disabled? || ( can? :
|
56
|
+
<% if cancan_disabled? || ( can? :soft_delete, object ) %>
|
57
57
|
<div class="small-1 column">
|
58
|
+
<%= link_to_soft_delete(object, css_class_id) -%>
|
58
59
|
<%= link_to_destroy(object, css_class_id) -%>
|
59
60
|
</div>
|
60
61
|
<div class="small-11 column">
|
@@ -23,7 +23,7 @@
|
|
23
23
|
:multipart => true, :remote => true, :class => "edit_form" do -%>
|
24
24
|
<% attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list -%>
|
25
25
|
<% attributes.each do | attribute, name, form_element | -%>
|
26
|
-
<% unless form_element.to_sym == :associated || form_element.to_sym == :tree || (cancan_enabled? && cannot?(:read, @
|
26
|
+
<% unless form_element.to_sym == :associated || form_element.to_sym == :tree || (cancan_enabled? && cannot?(:read, @object, attribute)) -%>
|
27
27
|
<% css_class_id = "attribute_#{attribute}_#{@object.id}" -%>
|
28
28
|
<% if form_element && form_element.to_sym == :header %>
|
29
29
|
<div class="row form_element_header" >
|
@@ -115,7 +115,7 @@
|
|
115
115
|
<% end %>
|
116
116
|
<% end %>
|
117
117
|
<% end %>
|
118
|
-
<% if can? :list_versions, @object
|
118
|
+
<% if can? :list_versions, @object %>
|
119
119
|
<% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_versions" -%>
|
120
120
|
<div id="<%= css_class_id -%>">
|
121
121
|
<%= render 'versions' %>
|
@@ -44,11 +44,14 @@
|
|
44
44
|
<div class="small-1 column">
|
45
45
|
<%= version.event -%>
|
46
46
|
</div>
|
47
|
+
<div class="small-2 column">
|
48
|
+
<%= version.created_at -%>
|
49
|
+
</div>
|
47
50
|
<div class="small-2 column">
|
48
51
|
<%= version_modified_by version.whodunnit -%>
|
49
52
|
</div>
|
50
|
-
<div class="small-
|
51
|
-
<% if version.changeset.empty? %>
|
53
|
+
<div class="small-6 column">
|
54
|
+
<% if version.changeset.nil? || version.changeset.empty? %>
|
52
55
|
<em>empty</em>
|
53
56
|
<% else %>
|
54
57
|
<% version.changeset.each do |attribute, value| %>
|
@@ -0,0 +1 @@
|
|
1
|
+
$('#<%= @update_span %>').fadeOut("slow")
|
@@ -1,57 +1,60 @@
|
|
1
1
|
GENERATOR_PATH = File.dirname(File.expand_path(__FILE__)) + '/../'
|
2
2
|
|
3
|
-
create_file 'Gemfile', "# created by inline_forms #{ENV['inline_forms_version']} on {Date.today}\n"
|
3
|
+
create_file 'Gemfile', "# created by inline_forms #{ENV['inline_forms_version']} on #{Date.today}\n"
|
4
4
|
|
5
5
|
add_source 'https://rubygems.org'
|
6
6
|
|
7
|
-
|
8
|
-
gem 'carrierwave'
|
9
|
-
gem 'ckeditor', git: 'https://github.com/galetahub/ckeditor'
|
7
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
10
8
|
#gem 'bootsnap', require: false
|
11
|
-
gem 'coffee-rails'
|
12
9
|
#gem 'compass-rails'
|
10
|
+
# gem 'modernizr-rails'
|
11
|
+
|
12
|
+
gem 'cancancan'
|
13
|
+
gem 'carrierwave'
|
14
|
+
gem 'ckeditor', github: 'galetahub/ckeditor'
|
15
|
+
gem 'coffee-rails'
|
16
|
+
gem 'devise-i18n', :git => 'https://github.com/acesuares/devise-i18n.git'
|
13
17
|
gem 'devise'
|
14
18
|
gem 'foundation-icons-sass-rails'
|
15
19
|
gem 'foundation-rails', '~> 5.5'
|
16
|
-
gem 'i18n-active_record', git
|
17
|
-
gem 'inline_forms', '
|
20
|
+
gem 'i18n-active_record', :git => 'https://github.com/acesuares/i18n-active_record.git'
|
21
|
+
gem 'inline_forms', '~> 6.2'
|
18
22
|
gem 'jquery-rails'
|
19
23
|
gem 'jquery-timepicker-rails'
|
20
24
|
gem 'jquery-ui-sass-rails'
|
21
25
|
gem 'mini_magick'
|
22
26
|
gem 'mysql2'
|
23
27
|
gem 'paper_trail'
|
24
|
-
gem 'rails-i18n'
|
25
|
-
gem 'rails'
|
28
|
+
gem 'rails-i18n', :git => 'https://github.com/svenfuchs/rails-i18n.git' # since https://github.com/svenfuchs/rails-i18n/pull/794 we don't have to maintain 'https://github.com/acesuares/rails-i18n.git' anymore!
|
29
|
+
gem 'rails-jquery-autocomplete'
|
30
|
+
gem 'rails', '6.1.3.1'
|
26
31
|
gem 'rake'
|
27
32
|
gem 'remotipart', '~> 1.0'
|
28
33
|
gem 'rvm'
|
29
34
|
gem 'sass-rails'
|
30
|
-
gem 'tabs_on_rails'
|
31
|
-
gem 'therubyracer'
|
32
|
-
gem 'uglifier'
|
33
|
-
gem 'figaro'
|
35
|
+
gem 'tabs_on_rails', :git => 'https://github.com/acesuares/tabs_on_rails.git', :branch => 'update_remote_before_action'
|
34
36
|
gem 'unicorn'
|
35
37
|
gem 'validation_hints'
|
36
38
|
gem 'will_paginate' #, git: 'https://github.com/acesuares/will_paginate.git'
|
37
|
-
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
38
|
-
gem 'turbolinks', '~> 5'
|
39
39
|
|
40
40
|
gem_group :development do
|
41
|
-
gem 'bundler'
|
41
|
+
gem 'capistrano-bundler', require: false
|
42
|
+
gem 'capistrano-rails', require: false
|
43
|
+
gem 'capistrano', require: false
|
44
|
+
gem 'capistrano3-unicorn'
|
42
45
|
gem 'listen'
|
43
|
-
gem '
|
44
|
-
gem '
|
45
|
-
gem 'seed_dump',
|
46
|
-
gem 'shoulda'
|
46
|
+
gem 'rvm-capistrano', :require => false
|
47
|
+
gem 'rvm1-capistrano3', require: false
|
48
|
+
gem 'seed_dump', '~> 0.5.3'
|
47
49
|
gem 'sqlite3'
|
48
50
|
gem 'switch_user'
|
51
|
+
gem 'thin'
|
49
52
|
gem 'yaml_db'
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
gem '
|
54
|
-
gem
|
53
|
+
end
|
54
|
+
|
55
|
+
gem_group :production do
|
56
|
+
gem 'mini_racer'
|
57
|
+
gem 'uglifier'
|
55
58
|
end
|
56
59
|
|
57
60
|
say "- Running bundle..."
|
@@ -86,9 +89,6 @@ append_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc
|
|
86
89
|
password: <%= ENV["DATABASE_PASSWORD"] %>
|
87
90
|
END_DATABASEYML
|
88
91
|
|
89
|
-
say "- Add rails 5.2 defaults to application.rb..."
|
90
|
-
gsub_file "config/application.rb", /6\.0/, '5.2'
|
91
|
-
|
92
92
|
say "- Devise install..."
|
93
93
|
run "bundle exec rails g devise:install"
|
94
94
|
|
@@ -291,12 +291,9 @@ copy_file File.join(GENERATOR_PATH, 'lib/generators/templates/application_record
|
|
291
291
|
say "- Install ckeditor..."
|
292
292
|
generate "ckeditor:install --orm=active_record --backend=carrierwave"
|
293
293
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
# see https://github.com/galetahub/ckeditor/issues/579
|
298
|
-
#say "- Set languages for ckeditor to ['en', 'nl'] in config/initializers/ckeditor.rb..."
|
299
|
-
#insert_into_file "config/initializers/ckeditor.rb", " config.assets_languages = ['en', 'nl']\n", :after => "config.assets_languages = ['en', 'uk']\n"
|
294
|
+
# precompile config.js
|
295
|
+
say "- Precompile ckeditor config.js"
|
296
|
+
append_file "config/initializers/assets.rb", " Rails.application.config.assets.precompile += %w[ckeditor/config.js]\n"
|
300
297
|
|
301
298
|
say "- Paper_trail install..."
|
302
299
|
generate "paper_trail:install --with-changes"
|
@@ -366,17 +363,23 @@ create_file "app/controllers/application_controller.rb", <<-END_APPCONTROLLER.st
|
|
366
363
|
class ApplicationController < InlineFormsApplicationController
|
367
364
|
protect_from_forgery
|
368
365
|
|
369
|
-
#
|
370
|
-
before_action :
|
366
|
+
# add whodunnit
|
367
|
+
before_action :set_paper_trail_whodunnit
|
371
368
|
|
372
|
-
# Comment next
|
369
|
+
# Comment next lines if you don't want Devise authentication
|
370
|
+
before_action :authenticate_user!
|
373
371
|
check_authorization unless: :devise_controller?
|
374
372
|
|
375
373
|
rescue_from CanCan::AccessDenied do |exception|
|
376
|
-
|
374
|
+
respond_to do |format|
|
375
|
+
format.json { head :forbidden, content_type: 'text/html' }
|
376
|
+
format.html { redirect_to main_app.root_url, notice: exception.message }
|
377
|
+
format.js { head :forbidden, content_type: 'text/html' }
|
378
|
+
end
|
377
379
|
end
|
380
|
+
# Comment previous lines if you don't want Devise authentication
|
378
381
|
|
379
|
-
ActionView::CompiledTemplates::MODEL_TABS = %w()
|
382
|
+
#ActionView::CompiledTemplates::MODEL_TABS = %w()
|
380
383
|
|
381
384
|
# Uncomment next line if you want I18n (based on subdomain)
|
382
385
|
# before_action :set_locale
|
@@ -422,75 +425,8 @@ create_file "app/models/ability.rb", <<-END_ABILITY.strip_heredoc
|
|
422
425
|
end
|
423
426
|
END_ABILITY
|
424
427
|
|
425
|
-
say "- Generating test files", :green
|
426
|
-
|
427
|
-
create_file "spec/spec_helper.rb", <<-END_TEST_HELPER.strip_heredoc
|
428
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
429
|
-
ENV["RAILS_ENV"] ||= 'development' # this need to be changed to test ???
|
430
|
-
require File.expand_path("../../config/environment", __FILE__)
|
431
|
-
require 'capybara/rspec'
|
432
|
-
require 'rspec/rails'
|
433
|
-
require 'rspec/autorun'
|
434
|
-
require 'carrierwave/test/matchers'
|
435
|
-
|
436
|
-
|
437
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
438
|
-
# in spec/support/ and its subdirectories.
|
439
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
440
|
-
|
441
|
-
RSpec.configure do |config|
|
442
|
-
config.include FactoryGirl::Syntax::Methods
|
443
|
-
# ## Mock Framework
|
444
|
-
#
|
445
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
446
|
-
#
|
447
|
-
# config.mock_with :mocha
|
448
|
-
# config.mock_with :flexmock
|
449
|
-
# config.mock_with :rr
|
450
|
-
|
451
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
452
|
-
config.fixture_path = Rails.root + "/spec/fixtures"
|
453
|
-
|
454
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
455
|
-
# examples within a transaction, remove the following line or assign false
|
456
|
-
# instead of true.
|
457
|
-
config.use_transactional_fixtures = true
|
458
|
-
|
459
|
-
# If true, the base class of anonymous controllers will be inferred
|
460
|
-
# automatically. This will be the default behavior in future versions of
|
461
|
-
# rspec-rails.
|
462
|
-
config.infer_base_class_for_anonymous_controllers = false
|
463
|
-
|
464
|
-
# Run specs in random order to surface order dependencies. If you find an
|
465
|
-
# order dependency and want to debug it, you can fix the order by providing
|
466
|
-
# the seed, which is printed after each run.
|
467
|
-
# --seed 1234
|
468
|
-
config.order = "random"
|
469
|
-
end
|
470
|
-
END_TEST_HELPER
|
471
|
-
|
472
|
-
say 'copy test image into rspec folder'
|
473
|
-
copy_file File.join(GENERATOR_PATH,'lib/otherstuff/fixtures/rails.png'), "spec/fixtures/images/rails.png"
|
474
|
-
say '- Creating factory_girl file'
|
475
|
-
create_file "spec/factories/inline_forms.rb", <<-END_FACTORY_GIRL.strip_heredoc
|
476
|
-
FactoryGirl.define do
|
477
|
-
factory :apartment do
|
478
|
-
name "Luxe House in Bandabou 147A" #string
|
479
|
-
title "A dream house in a dream place" # string
|
480
|
-
description "A beatiful House at the edge of the <strong>sea</strong>" #text
|
481
|
-
end
|
482
|
-
factory :large_text do
|
483
|
-
name "Luxe House in Bandabou 147A" #string
|
484
|
-
title "A dream house in a dream place" # string
|
485
|
-
description "A beatiful House at the edge of the <strong>sea</strong>" #text
|
486
|
-
end
|
487
|
-
end
|
488
|
-
END_FACTORY_GIRL
|
489
|
-
remove_file 'spec/factories/users.rb'
|
490
|
-
remove_file 'spec/models/user_spec.rb'
|
491
|
-
|
492
428
|
# precompile devise.css
|
493
|
-
say "- Precompile devise.css
|
429
|
+
say "- Precompile devise.css"
|
494
430
|
append_file "config/initializers/assets.rb", " Rails.application.config.assets.precompile += %w( inline_forms_devise.css )\n"
|
495
431
|
|
496
432
|
# devise mailer stuff
|
@@ -539,36 +475,9 @@ copy_file File.join(GENERATOR_PATH,'lib/generators/templates/capistrano/Capfile'
|
|
539
475
|
say "- Unicorn Config..."
|
540
476
|
copy_file File.join(GENERATOR_PATH,'lib/generators/templates/unicorn/production.rb'), "config/unicorn/production.rb"
|
541
477
|
|
542
|
-
|
543
478
|
# Git
|
544
|
-
say "-
|
545
|
-
run 'git init'
|
546
|
-
|
547
|
-
insert_into_file ".gitignore", <<-GITIGNORE.strip_heredoc, :after => "/tmp\n"
|
548
|
-
# remotipart uploads
|
549
|
-
public/uploads
|
550
|
-
# Figaro secrets
|
551
|
-
config/application.yml
|
552
|
-
GITIGNORE
|
553
|
-
|
554
|
-
say "- Installing Figaro..."
|
555
|
-
run 'bundle exec figaro install'
|
556
|
-
remove_file "config/application.yml"
|
557
|
-
copy_file File.join(GENERATOR_PATH,'lib/generators/templates/application.yml.blank'), "config/application.yml"
|
558
|
-
copy_file File.join(GENERATOR_PATH,'lib/generators/templates/application.yml.blank'), "config/application.yml.blank"
|
559
|
-
|
560
|
-
say "- Installing config/secrets.yml..."
|
561
|
-
remove_file "config/secrets.yml"
|
562
|
-
create_file "config/secrets.yml", <<-END_SECRETS_YML.strip_heredoc
|
563
|
-
development:
|
564
|
-
secret_key_base: #{SecureRandom.hex(64)}
|
565
|
-
|
566
|
-
test:
|
567
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
568
|
-
|
569
|
-
production:
|
570
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
571
|
-
END_SECRETS_YML
|
479
|
+
say "- adding and committing to git..."
|
480
|
+
# run 'git init' # this is already done by rails!
|
572
481
|
|
573
482
|
run 'git add .'
|
574
483
|
run 'git commit -a -m " * Initial"'
|
data/inline_forms.gemspec
CHANGED
@@ -23,12 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency('rvm')
|
24
24
|
s.add_dependency('thor')
|
25
25
|
s.add_dependency('validation_hints')
|
26
|
-
s.add_dependency('rails', '
|
26
|
+
s.add_dependency('rails', '6.1.3.1')
|
27
27
|
s.add_dependency('rails-i18n')
|
28
28
|
|
29
|
-
s.add_development_dependency(%q<rspec-rails>)
|
30
|
-
s.add_development_dependency(%q<shoulda>)
|
31
|
-
s.add_development_dependency(%q<bundler>)
|
32
|
-
s.add_development_dependency(%q<jeweler>)
|
33
|
-
|
34
29
|
end
|
data/lib/inline_forms/version.rb
CHANGED
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: 6.
|
4
|
+
version: 6.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ace Suares
|
@@ -10,132 +10,76 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-04-11 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
|
-
version:
|
63
|
+
version: 6.1.3.1
|
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
|
-
version:
|
70
|
+
version: 6.1.3.1
|
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
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '0'
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: rspec-rails
|
87
|
-
requirement: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - '>='
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0'
|
92
|
-
type: :development
|
93
|
-
prerelease: false
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
requirements:
|
96
|
-
- - '>='
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: '0'
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: shoulda
|
101
|
-
requirement: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - '>='
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '0'
|
106
|
-
type: :development
|
107
|
-
prerelease: false
|
108
|
-
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
requirements:
|
110
|
-
- - '>='
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0'
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: bundler
|
115
|
-
requirement: !ruby/object:Gem::Requirement
|
116
|
-
requirements:
|
117
|
-
- - '>='
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0'
|
120
|
-
type: :development
|
121
|
-
prerelease: false
|
122
|
-
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- - '>='
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: '0'
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: jeweler
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
requirements:
|
131
|
-
- - '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
requirements:
|
138
|
-
- - '>='
|
82
|
+
- - ">="
|
139
83
|
- !ruby/object:Gem::Version
|
140
84
|
version: '0'
|
141
85
|
description: Inline Forms aims to ease the setup of forms that provide inline editing.
|
@@ -149,9 +93,9 @@ executables:
|
|
149
93
|
extensions: []
|
150
94
|
extra_rdoc_files: []
|
151
95
|
files:
|
152
|
-
- .document
|
153
|
-
- .gitignore
|
154
|
-
- .vscode/settings.json
|
96
|
+
- ".document"
|
97
|
+
- ".gitignore"
|
98
|
+
- ".vscode/settings.json"
|
155
99
|
- Gemfile
|
156
100
|
- LICENSE.txt
|
157
101
|
- README.rdoc
|
@@ -246,6 +190,7 @@ files:
|
|
246
190
|
- app/views/inline_forms/extract_translations.erb
|
247
191
|
- app/views/inline_forms/list.js.erb
|
248
192
|
- app/views/inline_forms/new.js.erb
|
193
|
+
- app/views/inline_forms/record_destroyed.js.erb
|
249
194
|
- app/views/inline_forms/show.js.erb
|
250
195
|
- app/views/inline_forms/show_element.js.erb
|
251
196
|
- app/views/inline_forms/show_undo.js.erb
|
@@ -264,8 +209,6 @@ files:
|
|
264
209
|
- lib/generators/assets/stylesheets/inline_forms_devise.css
|
265
210
|
- lib/generators/inline_forms_generator.rb
|
266
211
|
- lib/generators/templates/_inline_forms_tabs.html.erb
|
267
|
-
- lib/generators/templates/abstract_mysql2_adapter.rb
|
268
|
-
- lib/generators/templates/application.yml.blank
|
269
212
|
- lib/generators/templates/application_record.rb
|
270
213
|
- lib/generators/templates/capistrano/Capfile
|
271
214
|
- lib/generators/templates/capistrano/deploy.rb
|
@@ -273,7 +216,6 @@ files:
|
|
273
216
|
- lib/generators/templates/controller.erb
|
274
217
|
- lib/generators/templates/migration.erb
|
275
218
|
- lib/generators/templates/model.erb
|
276
|
-
- lib/generators/templates/paper_trail.rb
|
277
219
|
- lib/generators/templates/test.erb
|
278
220
|
- lib/generators/templates/unicorn/production.rb
|
279
221
|
- lib/inline_forms.rb
|
@@ -282,9 +224,6 @@ files:
|
|
282
224
|
- lib/locales/inline_forms.nl.yml
|
283
225
|
- lib/otherstuff/20120310065554_inline_forms_create_view_for_translations.rb
|
284
226
|
- lib/otherstuff/add_roles.sql
|
285
|
-
- lib/otherstuff/bump
|
286
|
-
- lib/otherstuff/diffie
|
287
|
-
- lib/otherstuff/fixtures/rails.png
|
288
227
|
- lib/otherstuff/mkiftrans
|
289
228
|
- lib/otherstuff/mkrole
|
290
229
|
- lib/otherstuff/roles_users.sql
|
@@ -299,17 +238,16 @@ require_paths:
|
|
299
238
|
- lib
|
300
239
|
required_ruby_version: !ruby/object:Gem::Requirement
|
301
240
|
requirements:
|
302
|
-
- -
|
241
|
+
- - ">="
|
303
242
|
- !ruby/object:Gem::Version
|
304
243
|
version: '0'
|
305
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
306
245
|
requirements:
|
307
|
-
- -
|
246
|
+
- - ">="
|
308
247
|
- !ruby/object:Gem::Version
|
309
248
|
version: '0'
|
310
249
|
requirements: []
|
311
|
-
|
312
|
-
rubygems_version: 2.6.14
|
250
|
+
rubygems_version: 3.2.5
|
313
251
|
signing_key:
|
314
252
|
specification_version: 4
|
315
253
|
summary: Inline editing of forms.
|
@@ -1,59 +0,0 @@
|
|
1
|
-
DEVISE_SECRET_KEY:
|
2
|
-
SECRET_TOKEN:
|
3
|
-
|
4
|
-
DEPLOY_USER:
|
5
|
-
DEPLOY_HOST:
|
6
|
-
DEPLOY_APPLICATION:
|
7
|
-
DEPLOY_REPO_URL:
|
8
|
-
DEPLOY_DIRECTORY:
|
9
|
-
|
10
|
-
development:
|
11
|
-
ACTION_MAILER_SMTP_SETTINGS_ADDRESS:
|
12
|
-
ACTION_MAILER_SMTP_SETTINGS_PASSWORD:
|
13
|
-
ACTION_MAILER_SMTP_SETTINGS_USERNAME:
|
14
|
-
|
15
|
-
DATABASE_NAME:
|
16
|
-
DATABASE_USER:
|
17
|
-
DATABASE_PASSWORD:
|
18
|
-
|
19
|
-
FACEBOOK_APP_ID:
|
20
|
-
FACEBOOK_APP_SECRET:
|
21
|
-
|
22
|
-
GITHUB_CLIENT_ID:
|
23
|
-
GITHUB_CLIENT_SECRET:
|
24
|
-
|
25
|
-
SECRET_KEY_BASE:
|
26
|
-
|
27
|
-
production:
|
28
|
-
ACTION_MAILER_SMTP_SETTINGS_ADDRESS:
|
29
|
-
ACTION_MAILER_SMTP_SETTINGS_PASSWORD:
|
30
|
-
ACTION_MAILER_SMTP_SETTINGS_USERNAME:
|
31
|
-
|
32
|
-
DATABASE_NAME:
|
33
|
-
DATABASE_USER:
|
34
|
-
DATABASE_PASSWORD:
|
35
|
-
|
36
|
-
FACEBOOK_APP_ID:
|
37
|
-
FACEBOOK_APP_SECRET:
|
38
|
-
|
39
|
-
GITHUB_CLIENT_ID:
|
40
|
-
GITHUB_CLIENT_SECRET:
|
41
|
-
|
42
|
-
SECRET_KEY_BASE:
|
43
|
-
|
44
|
-
test:
|
45
|
-
ACTION_MAILER_SMTP_SETTINGS_ADDRESS:
|
46
|
-
ACTION_MAILER_SMTP_SETTINGS_PASSWORD:
|
47
|
-
ACTION_MAILER_SMTP_SETTINGS_USERNAME:
|
48
|
-
|
49
|
-
DATABASE_NAME:
|
50
|
-
DATABASE_USER:
|
51
|
-
DATABASE_PASSWORD:
|
52
|
-
|
53
|
-
FACEBOOK_APP_ID:
|
54
|
-
FACEBOOK_APP_SECRET:
|
55
|
-
|
56
|
-
GITHUB_CLIENT_ID:
|
57
|
-
GITHUB_CLIENT_SECRET:
|
58
|
-
|
59
|
-
SECRET_KEY_BASE:
|
data/lib/otherstuff/bump
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
rule /^version:bump:.*/ do |t|
|
2
|
-
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
|
3
|
-
index = ['major', 'minor','patch'].index(t.name.split(':').last)
|
4
|
-
file = 'lib/GEM_NAME/version.rb'
|
5
|
-
|
6
|
-
version_file = File.read(file)
|
7
|
-
old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
|
8
|
-
version_parts[index] = version_parts[index].to_i + 1
|
9
|
-
new_version = version_parts * '.'
|
10
|
-
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
|
11
|
-
|
12
|
-
sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
|
13
|
-
end
|
data/lib/otherstuff/diffie
DELETED
Binary file
|