edgarj 0.01.29 → 0.01.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/edgarj/base.js +5 -3
- data/app/helpers/edgarj/assoc_helper.rb +41 -24
- data/app/helpers/edgarj/form_drawer.rb +12 -3
- data/config/settings.yml +5 -0
- data/lib/edgarj/version.rb +1 -1
- metadata +74 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 651228d83ae7f3f3b5415d2ce044522c8fa5f826
|
4
|
+
data.tar.gz: a3ecdbfbc74287563e55d3fca86f63fd8a473fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f208dcc1c0c482fa715764159a33a91c8b0be399b0eed4b1a4bdbda35eb8c079381e1e5293f29884d8e9da8689169de2cef01de34723a814988fe053eb5aa45a
|
7
|
+
data.tar.gz: e2648e3312e36da84403c6ad4b3a530c620e6766a9d10e52aac534ae3907089ea66dff5ff223beec70dc41a70606c5e7e5aed00000a478ca02e29874474164d3
|
@@ -22,12 +22,14 @@ Edgarj.Popup = {
|
|
22
22
|
|
23
23
|
= INPUTS
|
24
24
|
id_target:: id target DOM
|
25
|
+
text:: default text on clear
|
25
26
|
*/
|
26
|
-
clear: function(id_target){
|
27
|
-
|
27
|
+
clear: function(id_target, text){
|
28
|
+
if(typeof(text)==='undefined') text = '';
|
29
|
+
|
28
30
|
var pf = new this.Field(id_target);
|
29
31
|
pf.id_target.val('');
|
30
|
-
pf.label_target.text(
|
32
|
+
pf.label_target.text(text);
|
31
33
|
pf.label_hidden_field.val('');
|
32
34
|
pf.clear_link.hide();
|
33
35
|
}
|
@@ -151,10 +151,10 @@ module Edgarj
|
|
151
151
|
# * edgarj search form(Edgarj::SearchForm) for search-condition entry
|
152
152
|
#
|
153
153
|
# === INPUTS
|
154
|
-
# f
|
155
|
-
# popup_path
|
156
|
-
# col_name
|
157
|
-
# model
|
154
|
+
# @param f [FormBuilder] FormBuilder object
|
155
|
+
# @param popup_path [String] popup path(url)
|
156
|
+
# @param col_name [String] 'belongs_to' column name
|
157
|
+
# @param model [AR] data model class
|
158
158
|
def draw_belongs_to_label(f, popup_path, col_name, model = f.object.class)
|
159
159
|
col = model.columns.detect{|c| c.name == col_name.to_s}
|
160
160
|
return "no column found" if !col
|
@@ -164,7 +164,7 @@ module Edgarj
|
|
164
164
|
|
165
165
|
link_to(
|
166
166
|
draw_belongs_to_label_sub(model, col.name, parent_model).html_safe +
|
167
|
-
|
167
|
+
Settings.edgarj.belongs_to.link_tag.html_safe,
|
168
168
|
popup_path,
|
169
169
|
remote: true)
|
170
170
|
end
|
@@ -176,11 +176,10 @@ module Edgarj
|
|
176
176
|
# col_name:: 'belongs_to' column name
|
177
177
|
# popup_field:: Edgarj::PopupHelper::PopupField object
|
178
178
|
# parent_name:: initial parent name
|
179
|
-
def draw_belongs_to_clear_link(f, col_name, popup_field, parent_name)
|
179
|
+
def draw_belongs_to_clear_link(f, col_name, popup_field, parent_name, default_label)
|
180
180
|
(' ' +
|
181
181
|
link_to("[#{I18n.t('edgarj.default.clear')}]", '#',
|
182
|
-
onClick:
|
183
|
-
popup_field.id_target),
|
182
|
+
onClick: "Edgarj.Popup.clear('#{j(popup_field.id_target)}','#{j(default_label)}'); return false;",
|
184
183
|
id: popup_field.clear_link,
|
185
184
|
style: 'display:' + (parent_name.blank? ? 'none' : '')) +
|
186
185
|
f.hidden_field(col_name)).html_safe
|
@@ -190,11 +189,11 @@ module Edgarj
|
|
190
189
|
#
|
191
190
|
# This is usually used with draw_belongs_to_label().
|
192
191
|
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
# col_name
|
196
|
-
# model
|
197
|
-
def draw_belongs_to_field(f, col_name, model = f.object.class)
|
192
|
+
# @param f [FormBuilder] FormBuilder object
|
193
|
+
# @param popup_path [String] popup path(url)
|
194
|
+
# @param col_name [String] 'belongs_to' column name
|
195
|
+
# @param model [AR] data model class
|
196
|
+
def draw_belongs_to_field(f, popup_path, col_name, model = f.object.class)
|
198
197
|
col = model.columns.detect{|c| c.name == col_name.to_s}
|
199
198
|
return "no column found" if !col
|
200
199
|
|
@@ -204,20 +203,38 @@ module Edgarj
|
|
204
203
|
parent_obj = f.object.belongs_to_AR(col)
|
205
204
|
popup_field = Edgarj::PopupHelper::PopupField.new_builder(
|
206
205
|
f.object_name, col_name)
|
207
|
-
|
208
|
-
|
209
|
-
|
206
|
+
default_label = '[' + draw_belongs_to_label_sub(model, col.name, parent_model) + ']'
|
207
|
+
label = content_tag(:span,
|
208
|
+
parent_obj ? parent_obj.name : default_label.html_safe,
|
209
|
+
id: popup_field.label_target)
|
210
|
+
link_tag = Settings.edgarj.belongs_to.link_tag.html_safe
|
210
211
|
if parent_obj
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
212
|
+
if Settings.edgarj.belongs_to.popup_on == 'field'
|
213
|
+
link_to(
|
214
|
+
label + link_tag,
|
215
|
+
popup_path,
|
216
|
+
remote: true)
|
217
|
+
else
|
218
|
+
link_to(label,
|
219
|
+
# TODO: Hardcoded 'master' prefix should be fixed
|
220
|
+
controller: url_prefix + parent_obj.class.name.underscore.pluralize,
|
221
|
+
action: 'show',
|
222
|
+
id: parent_obj,
|
223
|
+
topic_path: 'add')
|
224
|
+
end
|
217
225
|
else
|
218
|
-
|
226
|
+
if Settings.edgarj.belongs_to.popup_on == 'field'
|
227
|
+
link_to(
|
228
|
+
label + link_tag,
|
229
|
+
popup_path,
|
230
|
+
remote: true)
|
231
|
+
else
|
232
|
+
label
|
233
|
+
end
|
219
234
|
end +
|
220
|
-
draw_belongs_to_clear_link(f, col.name, popup_field,
|
235
|
+
draw_belongs_to_clear_link(f, col.name, popup_field,
|
236
|
+
parent_obj && parent_obj.name,
|
237
|
+
default_label)
|
221
238
|
end
|
222
239
|
|
223
240
|
# Is flag in column_value on?
|
@@ -44,6 +44,10 @@ module Edgarj
|
|
44
44
|
# 1. 'belongs_to' column uses:
|
45
45
|
# ** I18n.t('activerecord.attributes.MODEL.EXT_ID')
|
46
46
|
# ** parent.human_name
|
47
|
+
|
48
|
+
# TODO: draw_field() 層があってもよい
|
49
|
+
# form.draw() と form._draw_field(), form._draw_belongs_to_field ... は
|
50
|
+
# あるけど、抽象化層の form.draw_field がない
|
47
51
|
def draw()
|
48
52
|
adrs_field = {}
|
49
53
|
@vc.content_tag(:table) do
|
@@ -157,8 +161,11 @@ module Edgarj
|
|
157
161
|
|
158
162
|
# draw 'belongs_to' field for AR
|
159
163
|
def _draw_belongs_to_field(parent_model, col)
|
160
|
-
|
161
|
-
|
164
|
+
label = Settings.edgarj.belongs_to.popup_on == 'field' ?
|
165
|
+
nil :
|
166
|
+
@vc.draw_belongs_to_label(@f, @drawer.popup_path(col), col.name)
|
167
|
+
_draw_head(col, label){
|
168
|
+
@vc.draw_belongs_to_field(@f, @drawer.popup_path(col), col.name)
|
162
169
|
}
|
163
170
|
end
|
164
171
|
|
@@ -280,7 +287,9 @@ module Edgarj
|
|
280
287
|
'edgarj_search_form[search_form_parent][%s]' % col.name,
|
281
288
|
parent_name.blank? ? '' : parent_name,
|
282
289
|
id: popup_field.label_hidden_field) +
|
283
|
-
@vc.draw_belongs_to_clear_link(@f, col.name, popup_field,
|
290
|
+
@vc.draw_belongs_to_clear_link(@f, col.name, popup_field,
|
291
|
+
parent_name,
|
292
|
+
'[' + @vc.draw_belongs_to_label_sub(model, col.name, parent_model) + ']')
|
284
293
|
}
|
285
294
|
end
|
286
295
|
|
data/config/settings.yml
CHANGED
data/lib/edgarj/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edgarj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.01.
|
4
|
+
version: 0.01.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fuminori Ido
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -400,94 +400,94 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
400
400
|
version: '0'
|
401
401
|
requirements: []
|
402
402
|
rubyforge_project:
|
403
|
-
rubygems_version: 2.
|
403
|
+
rubygems_version: 2.4.1
|
404
404
|
signing_key:
|
405
405
|
specification_version: 4
|
406
406
|
summary: Scaffold with Ajax, search, sort, 'belongs_to' popup, and more.
|
407
407
|
test_files:
|
408
|
-
- test/
|
409
|
-
- test/
|
410
|
-
- test/
|
411
|
-
- test/
|
412
|
-
- test/
|
413
|
-
- test/
|
414
|
-
- test/
|
415
|
-
- test/
|
416
|
-
- test/
|
417
|
-
- test/test_helper.rb
|
418
|
-
- test/dummy/test/helpers/authors_helper_test.rb
|
419
|
-
- test/dummy/test/unit/book_test.rb
|
420
|
-
- test/dummy/test/unit/author_test.rb
|
421
|
-
- test/dummy/test/unit/rails_config_test.rb
|
422
|
-
- test/dummy/test/functional/authors_controller_test.rb
|
423
|
-
- test/dummy/test/functional/books_controller_test.rb
|
424
|
-
- test/dummy/test/functional/authors_popup_controller_test.rb
|
425
|
-
- test/dummy/README.rdoc
|
408
|
+
- test/fixtures/users.yml
|
409
|
+
- test/fixtures/edgarj/model_permissions.yml
|
410
|
+
- test/fixtures/edgarj/sssns.yml
|
411
|
+
- test/fixtures/edgarj/user_group_users.yml
|
412
|
+
- test/fixtures/edgarj/page_infos.yml
|
413
|
+
- test/fixtures/edgarj/user_groups.yml
|
414
|
+
- test/fixtures/authors.yml
|
415
|
+
- test/fixtures/books.yml
|
416
|
+
- test/dummy/Rakefile
|
426
417
|
- test/dummy/config.ru
|
418
|
+
- test/dummy/bin/rails
|
427
419
|
- test/dummy/bin/bundle
|
428
420
|
- test/dummy/bin/rake
|
429
|
-
- test/dummy/
|
430
|
-
- test/dummy/
|
431
|
-
- test/dummy/
|
432
|
-
- test/dummy/
|
433
|
-
- test/dummy/
|
434
|
-
- test/dummy/
|
435
|
-
- test/dummy/
|
436
|
-
- test/dummy/
|
437
|
-
- test/dummy/
|
438
|
-
- test/dummy/
|
439
|
-
- test/dummy/
|
440
|
-
- test/dummy/
|
441
|
-
- test/dummy/
|
442
|
-
- test/dummy/
|
443
|
-
- test/dummy/
|
444
|
-
- test/dummy/
|
445
|
-
- test/dummy/
|
421
|
+
- test/dummy/app/decorators/models/edgarj/user_group_decorator.rb
|
422
|
+
- test/dummy/app/assets/stylesheets/application.css
|
423
|
+
- test/dummy/app/assets/stylesheets/authors.css
|
424
|
+
- test/dummy/app/assets/stylesheets/scaffold.css
|
425
|
+
- test/dummy/app/assets/javascripts/application.js
|
426
|
+
- test/dummy/app/assets/javascripts/authors.js
|
427
|
+
- test/dummy/app/views/layouts/login.html.erb
|
428
|
+
- test/dummy/app/views/layouts/application.html.erb
|
429
|
+
- test/dummy/app/models/author.rb
|
430
|
+
- test/dummy/app/models/book.rb
|
431
|
+
- test/dummy/app/models/user.rb
|
432
|
+
- test/dummy/app/controllers/dummy_auth_mixin.rb
|
433
|
+
- test/dummy/app/controllers/application_controller.rb
|
434
|
+
- test/dummy/app/controllers/authors_popup_controller.rb
|
435
|
+
- test/dummy/app/controllers/books_controller.rb
|
436
|
+
- test/dummy/app/controllers/authors_controller.rb
|
437
|
+
- test/dummy/app/helpers/authors_helper.rb
|
438
|
+
- test/dummy/app/helpers/authors_popup_helper.rb
|
439
|
+
- test/dummy/app/helpers/application_helper.rb
|
440
|
+
- test/dummy/app/helpers/books_helper.rb
|
446
441
|
- test/dummy/config/locales/en.yml
|
447
442
|
- test/dummy/config/locales/ja.yml
|
448
|
-
- test/dummy/config/
|
449
|
-
- test/dummy/config/
|
443
|
+
- test/dummy/config/application.rb
|
444
|
+
- test/dummy/config/edgarj/menu_config.rb
|
445
|
+
- test/dummy/config/environments/production.rb
|
446
|
+
- test/dummy/config/environments/development.rb
|
447
|
+
- test/dummy/config/environments/test.rb
|
448
|
+
- test/dummy/config/environment.rb
|
450
449
|
- test/dummy/config/initializers/wrap_parameters.rb
|
451
|
-
- test/dummy/config/initializers/session_store.rb
|
452
|
-
- test/dummy/config/initializers/secret_token.rb
|
453
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
454
450
|
- test/dummy/config/initializers/mime_types.rb
|
455
451
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
456
|
-
- test/dummy/
|
452
|
+
- test/dummy/config/initializers/secret_token.rb
|
453
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
454
|
+
- test/dummy/config/initializers/inflections.rb
|
455
|
+
- test/dummy/config/initializers/strong_parameter.rb
|
456
|
+
- test/dummy/config/initializers/session_store.rb
|
457
|
+
- test/dummy/config/routes.rb
|
458
|
+
- test/dummy/config/settings.yml
|
459
|
+
- test/dummy/config/database.yml
|
460
|
+
- test/dummy/config/boot.rb
|
457
461
|
- test/dummy/public/favicon.ico
|
458
|
-
- test/dummy/public/404.html
|
459
462
|
- test/dummy/public/422.html
|
460
463
|
- test/dummy/public/500.html
|
461
|
-
- test/dummy/
|
462
|
-
- test/dummy/
|
463
|
-
- test/dummy/
|
464
|
-
- test/dummy/
|
465
|
-
- test/dummy/
|
466
|
-
- test/dummy/
|
467
|
-
- test/dummy/
|
468
|
-
- test/dummy/
|
469
|
-
- test/dummy/
|
470
|
-
- test/dummy/
|
471
|
-
- test/dummy/
|
472
|
-
- test/dummy/
|
473
|
-
- test/dummy/
|
474
|
-
- test/dummy/
|
475
|
-
- test/dummy/
|
476
|
-
- test/
|
477
|
-
- test/
|
478
|
-
- test/
|
479
|
-
- test/
|
480
|
-
- test/
|
464
|
+
- test/dummy/public/404.html
|
465
|
+
- test/dummy/README.rdoc
|
466
|
+
- test/dummy/db/schema.rb
|
467
|
+
- test/dummy/db/migrate/20131218011851_create_books.rb
|
468
|
+
- test/dummy/db/migrate/20131107120635_create_authors.rb
|
469
|
+
- test/dummy/db/migrate/20140201000000_add_user_group_id_to_authors.rb
|
470
|
+
- test/dummy/db/migrate/20140807065420_create_users.rb
|
471
|
+
- test/dummy/test/unit/author_test.rb
|
472
|
+
- test/dummy/test/unit/rails_config_test.rb
|
473
|
+
- test/dummy/test/unit/book_test.rb
|
474
|
+
- test/dummy/test/functional/books_controller_test.rb
|
475
|
+
- test/dummy/test/functional/authors_popup_controller_test.rb
|
476
|
+
- test/dummy/test/functional/authors_controller_test.rb
|
477
|
+
- test/dummy/test/helpers/authors_helper_test.rb
|
478
|
+
- test/dummy/script/rails
|
479
|
+
- test/unit/edgarj/sssn_test.rb
|
480
|
+
- test/unit/edgarj/model_permission_test.rb
|
481
|
+
- test/unit/edgarj/user_group_test.rb
|
482
|
+
- test/unit/edgarj/user_group_user_test.rb
|
483
|
+
- test/unit/edgarj/page_info_test.rb
|
484
|
+
- test/unit/helpers/edgarj/user_group_users_helper_test.rb
|
485
|
+
- test/unit/helpers/edgarj/model_permissions_helper_test.rb
|
486
|
+
- test/support/edgarj/controller_supporter.rb
|
481
487
|
- test/edgar_test.rb
|
482
|
-
- test/
|
483
|
-
- test/
|
484
|
-
- test/fixtures/edgarj/page_infos.yml
|
485
|
-
- test/fixtures/edgarj/user_group_users.yml
|
486
|
-
- test/fixtures/edgarj/user_groups.yml
|
487
|
-
- test/fixtures/edgarj/model_permissions.yml
|
488
|
-
- test/fixtures/edgarj/sssns.yml
|
489
|
-
- test/fixtures/books.yml
|
488
|
+
- test/test_helper.rb
|
489
|
+
- test/integration/navigation_test.rb
|
490
490
|
- test/functional/edgarj/user_group_users_controller_test.rb
|
491
|
-
- test/functional/edgarj/edgarj_controller_test.rb
|
492
491
|
- test/functional/edgarj/model_permissions_controller_test.rb
|
492
|
+
- test/functional/edgarj/edgarj_controller_test.rb
|
493
493
|
has_rdoc:
|