inline_forms 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/bin/inline_forms +2 -1
- data/lib/app/assets/stylesheets/inline_forms.css +34 -0
- data/lib/app/controllers/inline_forms_application_controller.rb +21 -0
- data/lib/app/controllers/inline_forms_controller.rb +222 -189
- data/lib/app/helpers/form_elements/text_area.rb +1 -1
- data/lib/app/helpers/form_elements/text_area_without_ckeditor.rb +13 -0
- data/lib/app/helpers/inline_forms_helper.rb +33 -19
- data/lib/app/validators/is_a_curacao_id_number_validator.rb +4 -6
- data/lib/app/validators/is_email_address_validator.rb +0 -4
- data/lib/app/validators/must_be_a_value_validator.rb +0 -1
- data/lib/app/validators/must_be_unique_validator.rb +0 -3
- data/lib/app/views/devise/confirmations/new.html.erb +5 -8
- data/lib/app/views/devise/passwords/edit.html.erb +12 -11
- data/lib/app/views/devise/passwords/new.html.erb +5 -8
- data/lib/app/views/devise/registrations/new.html.erb +5 -8
- data/lib/app/views/devise/sessions/new.html.erb +4 -8
- data/lib/app/views/devise/shared/_header_and_errors.html.erb +4 -0
- data/lib/app/views/devise/shared/_links.erb +21 -19
- data/lib/app/views/devise/unlocks/new.html.erb +5 -8
- data/lib/app/views/inline_forms/_close.html.erb +1 -1
- data/lib/app/views/inline_forms/_list.html.erb +8 -11
- data/lib/app/views/inline_forms/_new.html.erb +9 -3
- data/lib/app/views/inline_forms/_show.html.erb +2 -2
- data/lib/app/views/inline_forms/extract_translations.erb +4 -0
- data/lib/app/views/inline_forms/show_undo.js.erb +1 -1
- data/lib/app/views/layouts/devise.html.erb +1 -1
- data/lib/app/views/layouts/inline_forms.html.erb +1 -1
- data/lib/inline_forms.rb +2 -0
- data/lib/inline_forms/version.rb +1 -1
- data/lib/locales/inline_forms.en.yml +38 -0
- data/lib/locales/inline_forms.nl.yml +4 -0
- metadata +11 -6
- data/lib/app/views/inline_forms/_show_undo.html.erb +0 -1
data/Gemfile.lock
CHANGED
data/bin/inline_forms
CHANGED
@@ -84,6 +84,7 @@ gem 'inline_forms'
|
|
84
84
|
gem 'mini_magick'
|
85
85
|
gem 'jquery_datepicker'
|
86
86
|
gem 'yaml_db'
|
87
|
+
gem 'rails-i18n'
|
87
88
|
|
88
89
|
"
|
89
90
|
gemfile_development_group ="
|
@@ -174,7 +175,7 @@ header_src = "
|
|
174
175
|
</div>
|
175
176
|
<% if cancan_enabled? -%>
|
176
177
|
<div id='logout'>
|
177
|
-
<%= link_to 'Afmelden: \#{current_user.name}', destroy_user_session_path %>
|
178
|
+
<%= link_to 'Afmelden: \#{current_user.name}', destroy_user_session_path, :method => :delete %>
|
178
179
|
</div>
|
179
180
|
<% end -%>
|
180
181
|
<div style='clear: both;'></div>
|
@@ -188,18 +188,51 @@ ul.checklist li {
|
|
188
188
|
margin: 0.4em 0 0.3em 0;
|
189
189
|
}
|
190
190
|
|
191
|
+
/* HEADER */
|
192
|
+
|
191
193
|
#title {
|
192
194
|
float: left;
|
195
|
+
height: 1.5em;
|
193
196
|
}
|
194
197
|
|
195
198
|
#logout {
|
196
199
|
float:right;
|
200
|
+
height: 1.5em;
|
201
|
+
}
|
202
|
+
|
203
|
+
#locales {
|
204
|
+
float: left;
|
205
|
+
height: 1.5em;
|
206
|
+
margin-left: 2em;
|
207
|
+
}
|
208
|
+
|
209
|
+
#locales ul {
|
210
|
+
list-style: none;
|
211
|
+
list-style-position: inside;
|
212
|
+
margin: 0;
|
213
|
+
padding: 0;
|
214
|
+
}
|
215
|
+
|
216
|
+
#locales li {
|
217
|
+
display: inline-block;
|
218
|
+
height: 1.5em;
|
219
|
+
}
|
220
|
+
|
221
|
+
#locales li a {
|
222
|
+
color: white;
|
223
|
+
}
|
224
|
+
|
225
|
+
#locales li .active_locale {
|
226
|
+
color: yellow;
|
197
227
|
}
|
198
228
|
|
199
229
|
#logout a {
|
200
230
|
color: white;
|
201
231
|
}
|
202
232
|
|
233
|
+
/* END HEADER */
|
234
|
+
|
235
|
+
|
203
236
|
#tabs {
|
204
237
|
background-color: #F9EBAE;
|
205
238
|
-moz-border-radius: 5px;
|
@@ -359,3 +392,4 @@ ul.checklist li {
|
|
359
392
|
text-align: right;
|
360
393
|
font-family: monospace;
|
361
394
|
}
|
395
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class InlineFormsApplicationController < ActionController::Base
|
2
|
+
protect_from_forgery
|
3
|
+
layout 'devise' if :devise_controller?
|
4
|
+
|
5
|
+
# limit available locales by setting this. Override in applicaton_controller.
|
6
|
+
I18n.available_locales = [ :en, :nl, :pp ]
|
7
|
+
|
8
|
+
#set the locale based on the subdomain
|
9
|
+
def set_locale
|
10
|
+
I18n.locale = extract_locale_from_subdomain || I18n.default_locale
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
# Get locale code from request subdomain (like http://it.application.local:3000)
|
15
|
+
def extract_locale_from_subdomain
|
16
|
+
locale = request.subdomains.first
|
17
|
+
return nil if locale.nil?
|
18
|
+
I18n.available_locales.include?(locale.to_sym) ? locale.to_s : nil
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -1,223 +1,256 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def self.cancan_enabled?
|
27
|
-
begin
|
28
|
-
::Ability && true
|
29
|
-
rescue NameError
|
30
|
-
false
|
31
|
-
end
|
32
|
-
end
|
1
|
+
# == Generic controller for the inline_forms plugin.
|
2
|
+
# === Usage
|
3
|
+
# If you have an Example class, make an ExampleController
|
4
|
+
# that is a subclass of InlineFormsController
|
5
|
+
# class ExampleController < InlineFormsController
|
6
|
+
# end
|
7
|
+
# That's it! It'll work. But please read about the InlineForms::InlineFormsGenerator first!
|
8
|
+
#
|
9
|
+
# You can override the methods in your ExampleController
|
10
|
+
# def index
|
11
|
+
# @objects=@Klass.all
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
#
|
15
|
+
# @objects holds the objects (in this case Examples)
|
16
|
+
# and @Klass will be set to Example by the getKlass before filter.
|
17
|
+
#
|
18
|
+
# === How it works
|
19
|
+
# The getKlass before_filter extracts the class and puts it in @Klass
|
20
|
+
#
|
21
|
+
# @Klass is used in the InlineFormsHelper
|
22
|
+
#
|
23
|
+
class InlineFormsController < ApplicationController
|
24
|
+
before_filter :getKlass
|
33
25
|
|
34
|
-
|
35
|
-
|
26
|
+
def self.cancan_enabled?
|
27
|
+
begin
|
28
|
+
::Ability && true
|
29
|
+
rescue NameError
|
30
|
+
false
|
36
31
|
end
|
32
|
+
end
|
37
33
|
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
def cancan_enabled?
|
35
|
+
self.class.cancan_enabled?
|
36
|
+
end
|
37
|
+
|
38
|
+
def cancan_disabled?
|
39
|
+
! self.class.cancan_enabled?
|
40
|
+
end
|
41
|
+
|
42
|
+
helper_method :cancan_disabled?, :cancan_enabled?
|
41
43
|
|
42
|
-
|
44
|
+
load_and_authorize_resource if cancan_enabled?
|
43
45
|
|
44
|
-
|
46
|
+
# :index shows a list of all objects from class @Klass, using will_paginate,
|
47
|
+
# including a link to 'new', that allows you to create a new record.
|
48
|
+
def index
|
49
|
+
@update_span = params[:update]
|
50
|
+
@parent_class = params[:parent_class]
|
51
|
+
@parent_id = params[:parent_id]
|
52
|
+
@ul_needed = params[:ul_needed]
|
53
|
+
@PER_PAGE = 5 unless @parent_class.nil?
|
54
|
+
# if the parent_class is not nill, we are in associated list and we don't search there.
|
55
|
+
# also, make sure the Model that you want to do a search on has a :name attribute. TODO
|
56
|
+
if @parent_class.nil?
|
57
|
+
conditions = [ @Klass.order_by_clause.to_s + " like ?", "%#{params[:search]}%" ]
|
58
|
+
else
|
59
|
+
conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
|
60
|
+
end
|
61
|
+
# if we are using cancan, then make sure to select only accessible records
|
62
|
+
if cancan_enabled?
|
63
|
+
@objects = @Klass.accessible_by(current_ability).order(@Klass.order_by_clause).paginate(
|
64
|
+
:page => params[:page],
|
65
|
+
:per_page => @PER_PAGE || 12,
|
66
|
+
:conditions => conditions )
|
67
|
+
else
|
68
|
+
@objects = @Klass.order(@Klass.order_by_clause).paginate(
|
69
|
+
:page => params[:page],
|
70
|
+
:per_page => @PER_PAGE || 12,
|
71
|
+
:conditions => conditions )
|
72
|
+
end
|
73
|
+
respond_to do |format|
|
74
|
+
format.html { render 'inline_forms/_list', :layout => 'inline_forms' } unless @Klass.not_accessible_through_html?
|
75
|
+
format.js { render :list }
|
76
|
+
end
|
77
|
+
end
|
45
78
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
79
|
+
# :new prepares a new object, updates the list of objects and replaces it with
|
80
|
+
# an empty form. After pressing OK or Cancel, the list of objects is retrieved
|
81
|
+
# in the same way as :index
|
82
|
+
def new
|
83
|
+
@object = @Klass.new
|
84
|
+
@update_span = params[:update]
|
85
|
+
@parent_class = params[:parent_class]
|
86
|
+
unless @parent_class.nil?
|
51
87
|
@parent_id = params[:parent_id]
|
52
|
-
@
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
88
|
+
@object[@parent_class.foreign_key] = @parent_id
|
89
|
+
end
|
90
|
+
@object.inline_forms_attribute_list = @inline_forms_attribute_list if @inline_forms_attribute_list
|
91
|
+
respond_to do |format|
|
92
|
+
format.js { }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# :edit presents a form to edit one specific attribute from an object
|
97
|
+
def edit
|
98
|
+
@object = @Klass.find(params[:id])
|
99
|
+
@attribute = params[:attribute]
|
100
|
+
@form_element = params[:form_element]
|
101
|
+
@sub_id = params[:sub_id]
|
102
|
+
@update_span = params[:update]
|
103
|
+
respond_to do |format|
|
104
|
+
#format.html { } unless @Klass.not_accessible_through_html?
|
105
|
+
format.js { }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# :create creates the object made with :new.
|
110
|
+
# It then presents the list of objects.
|
111
|
+
def create
|
112
|
+
object = @Klass.new
|
113
|
+
@update_span = params[:update]
|
114
|
+
attributes = @inline_forms_attribute_list || object.inline_forms_attribute_list
|
115
|
+
attributes.each do | attribute, name, form_element |
|
116
|
+
send("#{form_element.to_s}_update", object, attribute) unless form_element == :associated
|
117
|
+
end
|
118
|
+
@parent_class = params[:parent_class]
|
119
|
+
@parent_id = params[:parent_id]
|
120
|
+
@PER_PAGE = 5 unless @parent_class.nil?
|
121
|
+
# for the logic behind the :conditions see the #index method.
|
122
|
+
@parent_class.nil? ? conditions = [ @Klass.order_by_clause.to_s + " like ?", "%#{params[:search]}%" ] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
|
123
|
+
object[@parent_class.foreign_key] = @parent_id unless @parent_class.nil?
|
124
|
+
puts "BEFORE IF #{object.id} #{object.name}"
|
125
|
+
if object.save
|
126
|
+
puts "AFTER SAVE IF #{object.id} #{object.name}"
|
127
|
+
flash.now[:success] = t('success', :message => object.class.model_name.human)
|
62
128
|
if cancan_enabled?
|
63
|
-
@objects = @Klass.accessible_by(current_ability).order(@Klass.order_by_clause).paginate
|
64
|
-
:page => params[:page],
|
65
|
-
:per_page => @PER_PAGE || 12,
|
66
|
-
:conditions => conditions )
|
129
|
+
@objects = @Klass.accessible_by(current_ability).order(@Klass.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 12, :conditions => conditions
|
67
130
|
else
|
68
|
-
@objects = @Klass.order(@Klass.order_by_clause).paginate
|
69
|
-
:page => params[:page],
|
70
|
-
:per_page => @PER_PAGE || 12,
|
71
|
-
:conditions => conditions )
|
131
|
+
@objects = @Klass.order(@Klass.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 12, :conditions => conditions
|
72
132
|
end
|
73
133
|
respond_to do |format|
|
74
|
-
format.
|
75
|
-
format.js { render :list }
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
# :new prepares a new object, updates the list of objects and replaces it with
|
80
|
-
# an empty form. After pressing OK or Cancel, the list of objects is retrieved
|
81
|
-
# in the same way as :index
|
82
|
-
def new
|
83
|
-
@object = @Klass.new
|
84
|
-
@update_span = params[:update]
|
85
|
-
@parent_class = params[:parent_class]
|
86
|
-
unless @parent_class.nil?
|
87
|
-
@parent_id = params[:parent_id]
|
88
|
-
@object[@parent_class.foreign_key] = @parent_id
|
134
|
+
format.js { render :list}
|
89
135
|
end
|
90
|
-
|
136
|
+
puts "*)*)*)#{object.id} #{object.name}"
|
137
|
+
else
|
138
|
+
flash.now[:header] = ["Kan #{object.class.to_s.underscore} niet aanmaken."]
|
139
|
+
flash.now[:error] = object.errors.to_a
|
91
140
|
respond_to do |format|
|
92
|
-
|
141
|
+
@object = object
|
142
|
+
@object.inline_forms_attribute_list = attributes
|
143
|
+
format.js { render :new}
|
93
144
|
end
|
94
145
|
end
|
146
|
+
end
|
95
147
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
148
|
+
# :update updates a specific attribute from an object.
|
149
|
+
def update
|
150
|
+
@object = @Klass.find(params[:id])
|
151
|
+
@attribute = params[:attribute]
|
152
|
+
@form_element = params[:form_element]
|
153
|
+
@sub_id = params[:sub_id]
|
154
|
+
@update_span = params[:update]
|
155
|
+
send("#{@form_element.to_s}_update", @object, @attribute)
|
156
|
+
@object.save
|
157
|
+
#puts "Requested #{request.format}"
|
158
|
+
respond_to do |format|
|
159
|
+
format.js { }
|
107
160
|
end
|
161
|
+
end
|
108
162
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
163
|
+
# :show shows one attribute (attribute) from a record (object).
|
164
|
+
# It includes the link to 'edit'
|
165
|
+
def show
|
166
|
+
@object = @Klass.find(params[:id])
|
167
|
+
@attribute = params[:attribute]
|
168
|
+
@form_element = params[:form_element]
|
169
|
+
close = params[:close] || false
|
170
|
+
if @form_element == "associated"
|
171
|
+
@sub_id = params[:sub_id]
|
172
|
+
if @sub_id.to_i > 0
|
173
|
+
@associated_record_id = @object.send(@attribute.to_s.singularize + "_ids").index(@sub_id.to_i)
|
174
|
+
@associated_record = @object.send(@attribute)[@associated_record_id]
|
117
175
|
end
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
flash.now[:success] = "Successfully created #{object.class.to_s.underscore}."
|
126
|
-
if cancan_enabled?
|
127
|
-
@objects = @Klass.accessible_by(current_ability).order(@Klass.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 12, :conditions => conditions
|
176
|
+
end
|
177
|
+
@update_span = params[:update]
|
178
|
+
if @attribute.nil?
|
179
|
+
respond_to do |format|
|
180
|
+
@attributes = @object.inline_forms_attribute_list
|
181
|
+
if close
|
182
|
+
format.js { render :close }
|
128
183
|
else
|
129
|
-
|
130
|
-
end
|
131
|
-
respond_to do |format|
|
132
|
-
format.js { render :list }
|
133
|
-
end
|
134
|
-
else
|
135
|
-
flash.now[:error] = "Kan #{object.class.to_s.underscore} niet aanmaken.".html_safe
|
136
|
-
object.errors.each do |e|
|
137
|
-
flash.now[:error] << '<br />'.html_safe + e[0].to_s + ": " + e[1]
|
138
|
-
end
|
139
|
-
respond_to do |format|
|
140
|
-
@object = object
|
141
|
-
@object.inline_forms_attribute_list = attributes
|
142
|
-
format.js { render :new}
|
184
|
+
format.js { }
|
143
185
|
end
|
144
186
|
end
|
145
|
-
|
146
|
-
|
147
|
-
# :update updates a specific attribute from an object.
|
148
|
-
def update
|
149
|
-
@object = @Klass.find(params[:id])
|
150
|
-
@attribute = params[:attribute]
|
151
|
-
@form_element = params[:form_element]
|
152
|
-
@sub_id = params[:sub_id]
|
153
|
-
@update_span = params[:update]
|
154
|
-
send("#{@form_element.to_s}_update", @object, @attribute)
|
155
|
-
@object.save
|
156
|
-
#puts "Requested #{request.format}"
|
187
|
+
else
|
157
188
|
respond_to do |format|
|
158
|
-
format.js { }
|
189
|
+
format.js { render :show_element }
|
159
190
|
end
|
160
191
|
end
|
192
|
+
end
|
161
193
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
if @form_element == "associated"
|
170
|
-
@sub_id = params[:sub_id]
|
171
|
-
if @sub_id.to_i > 0
|
172
|
-
@associated_record_id = @object.send(@attribute.to_s.singularize + "_ids").index(@sub_id.to_i)
|
173
|
-
@associated_record = @object.send(@attribute)[@associated_record_id]
|
174
|
-
end
|
175
|
-
end
|
176
|
-
@update_span = params[:update]
|
177
|
-
if @attribute.nil?
|
178
|
-
respond_to do |format|
|
179
|
-
@attributes = @object.inline_forms_attribute_list
|
180
|
-
if close
|
181
|
-
format.js { render :close }
|
182
|
-
else
|
183
|
-
format.js { }
|
184
|
-
end
|
185
|
-
end
|
186
|
-
else
|
187
|
-
respond_to do |format|
|
188
|
-
format.js { render :show_element }
|
189
|
-
end
|
190
|
-
end
|
194
|
+
# :destroy destroys the record, but also shows an undo link (with paper_trail)
|
195
|
+
def destroy
|
196
|
+
@update_span = params[:update]
|
197
|
+
@object = @Klass.find(params[:id])
|
198
|
+
@object.destroy
|
199
|
+
respond_to do |format|
|
200
|
+
format.js { render :show_undo }
|
191
201
|
end
|
202
|
+
end
|
192
203
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
204
|
+
# :revert works like undo.
|
205
|
+
# Thanks Ryan Bates: http://railscasts.com/episodes/255-undo-with-paper-trail
|
206
|
+
def revert
|
207
|
+
@update_span = params[:update]
|
208
|
+
@version = Version.find(params[:id])
|
209
|
+
@version.reify.save!
|
210
|
+
@object = @Klass.find(@version.item_id)
|
211
|
+
respond_to do |format|
|
212
|
+
format.js { render :close }
|
201
213
|
end
|
214
|
+
end
|
202
215
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
@version = Version.find(params[:id])
|
208
|
-
@version.reify.save!
|
209
|
-
@object = @Klass.find(@version.item_id)
|
210
|
-
respond_to do |format|
|
211
|
-
format.js { render :close }
|
212
|
-
end
|
216
|
+
def extract_translations
|
217
|
+
keys_array = []
|
218
|
+
I18n::Backend::ActiveRecord::Translation.order(:locale, :thekey).each do |t|
|
219
|
+
keys_array << deep_hashify([ t.locale, t.thekey.split('.'), t.value ].flatten)
|
213
220
|
end
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
# CountryController < InlineFormsController, so what class are we?
|
218
|
-
# TODO think about this a bit more.
|
219
|
-
def getKlass #:doc:
|
220
|
-
@Klass = self.controller_name.classify.constantize
|
221
|
+
keys_hash = {}
|
222
|
+
keys_array.each do |h|
|
223
|
+
keys_hash = deep_merge(keys_hash, h)
|
221
224
|
end
|
225
|
+
@display_array = unravel(keys_hash)
|
226
|
+
end
|
222
227
|
|
228
|
+
private
|
229
|
+
# Get the class from the controller name.
|
230
|
+
# CountryController < InlineFormsController, so what class are we?
|
231
|
+
# TODO think about this a bit more.
|
232
|
+
def getKlass #:doc:
|
233
|
+
@Klass = self.controller_name.classify.constantize
|
223
234
|
end
|
235
|
+
|
236
|
+
def deep_hashify(ary)
|
237
|
+
return ary.to_s if ary.length == 1
|
238
|
+
{ ary.shift => deep_hashify(ary) }
|
239
|
+
end
|
240
|
+
|
241
|
+
def deep_merge(h1, h2)
|
242
|
+
return h1.merge(h2) unless h2.first[1].is_a? Hash
|
243
|
+
h1.merge(h2){|key, first, second| deep_merge(first, second)}
|
244
|
+
end
|
245
|
+
|
246
|
+
def unravel(deep_hash, level=-1)
|
247
|
+
level += 1
|
248
|
+
return "#{' '*level}\"#{deep_hash.first[0]}\": \"#{deep_hash.first[1]}\"\n" unless deep_hash.first[1].is_a? Hash
|
249
|
+
a = "#{' '*level}\"#{deep_hash.first[0]}\":\n"
|
250
|
+
deep_hash.first[1].each do |k,v|
|
251
|
+
a << unravel( { k => v}, level)
|
252
|
+
end
|
253
|
+
a
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|