active_scaffold 3.6.20 → 3.7.1

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.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +47 -0
  3. data/README.md +29 -16
  4. data/app/assets/javascripts/jquery/active_scaffold.js +106 -68
  5. data/app/assets/javascripts/jquery/active_scaffold_chosen.js +6 -5
  6. data/app/assets/javascripts/jquery/tiny_mce_bridge.js +18 -4
  7. data/app/assets/stylesheets/active_scaffold_layout.css +13 -2
  8. data/app/views/active_scaffold_overrides/_base_form.html.erb +5 -1
  9. data/app/views/active_scaffold_overrides/_field_search.html.erb +1 -0
  10. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +2 -1
  11. data/app/views/active_scaffold_overrides/_render_field.js.erb +24 -13
  12. data/config/locales/de.yml +6 -3
  13. data/config/locales/en.yml +3 -0
  14. data/config/locales/es.yml +3 -0
  15. data/config/locales/fr.yml +9 -6
  16. data/config/locales/hu.yml +20 -17
  17. data/config/locales/ja.yml +83 -80
  18. data/config/locales/ru.yml +17 -14
  19. data/lib/active_scaffold/actions/common_search.rb +2 -2
  20. data/lib/active_scaffold/actions/core.rb +30 -10
  21. data/lib/active_scaffold/actions/field_search.rb +9 -6
  22. data/lib/active_scaffold/actions/nested.rb +7 -7
  23. data/lib/active_scaffold/actions/update.rb +3 -3
  24. data/lib/active_scaffold/attribute_params.rb +22 -70
  25. data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +0 -3
  26. data/lib/active_scaffold/bridges/active_storage/form_ui.rb +6 -6
  27. data/lib/active_scaffold/bridges/active_storage/list_ui.rb +7 -7
  28. data/lib/active_scaffold/bridges/active_storage.rb +3 -0
  29. data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +2 -2
  30. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +2 -2
  31. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +12 -14
  32. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +2 -2
  33. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +1 -1
  34. data/lib/active_scaffold/bridges/chosen/helpers.rb +10 -10
  35. data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +7 -7
  36. data/lib/active_scaffold/bridges/date_picker/ext.rb +20 -9
  37. data/lib/active_scaffold/bridges/date_picker/helper.rb +9 -9
  38. data/lib/active_scaffold/bridges/date_picker.rb +2 -0
  39. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +3 -3
  40. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +5 -5
  41. data/lib/active_scaffold/bridges/file_column/form_ui.rb +1 -1
  42. data/lib/active_scaffold/bridges/file_column/list_ui.rb +3 -3
  43. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +1 -1
  44. data/lib/active_scaffold/bridges/paper_trail/actions.rb +4 -1
  45. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +3 -3
  46. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
  47. data/lib/active_scaffold/bridges/record_select/helpers.rb +17 -17
  48. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +6 -6
  49. data/lib/active_scaffold/bridges/tiny_mce.rb +1 -1
  50. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +6 -11
  51. data/lib/active_scaffold/bridges.rb +0 -3
  52. data/lib/active_scaffold/config/core.rb +1 -1
  53. data/lib/active_scaffold/config/field_search.rb +9 -1
  54. data/lib/active_scaffold/config/form.rb +9 -1
  55. data/lib/active_scaffold/constraints.rb +22 -7
  56. data/lib/active_scaffold/core.rb +6 -10
  57. data/lib/active_scaffold/data_structures/action_columns.rb +0 -25
  58. data/lib/active_scaffold/data_structures/action_links.rb +1 -1
  59. data/lib/active_scaffold/data_structures/association/abstract.rb +8 -0
  60. data/lib/active_scaffold/data_structures/association/active_mongoid.rb +8 -0
  61. data/lib/active_scaffold/data_structures/association/active_record.rb +1 -13
  62. data/lib/active_scaffold/data_structures/association/mongoid.rb +21 -8
  63. data/lib/active_scaffold/data_structures/column.rb +139 -28
  64. data/lib/active_scaffold/data_structures/columns.rb +12 -12
  65. data/lib/active_scaffold/data_structures/nested_info.rb +12 -0
  66. data/lib/active_scaffold/data_structures/sorting.rb +1 -1
  67. data/lib/active_scaffold/engine.rb +15 -1
  68. data/lib/active_scaffold/extensions/action_view_rendering.rb +13 -5
  69. data/lib/active_scaffold/extensions/cow_proxy.rb +1 -1
  70. data/lib/active_scaffold/extensions/routing_mapper.rb +1 -0
  71. data/lib/active_scaffold/extensions/unsaved_record.rb +9 -3
  72. data/lib/active_scaffold/finder.rb +147 -28
  73. data/lib/active_scaffold/helpers/action_link_helpers.rb +1 -1
  74. data/lib/active_scaffold/helpers/controller_helpers.rb +9 -4
  75. data/lib/active_scaffold/helpers/form_column_helpers.rb +153 -107
  76. data/lib/active_scaffold/helpers/human_condition_helpers.rb +48 -14
  77. data/lib/active_scaffold/helpers/list_column_helpers.rb +37 -20
  78. data/lib/active_scaffold/helpers/search_column_helpers.rb +137 -55
  79. data/lib/active_scaffold/helpers/show_column_helpers.rb +6 -6
  80. data/lib/active_scaffold/helpers/view_helpers.rb +1 -1
  81. data/lib/active_scaffold/orm_checks.rb +21 -1
  82. data/lib/active_scaffold/registry.rb +10 -15
  83. data/lib/active_scaffold/tableless.rb +10 -79
  84. data/lib/active_scaffold/version.rb +2 -2
  85. data/lib/active_scaffold.rb +3 -9
  86. data/lib/generators/active_scaffold/install_generator.rb +2 -2
  87. data/test/bridges/bridge_test.rb +1 -1
  88. data/test/bridges/date_picker_test.rb +3 -2
  89. data/test/bridges/paperclip_test.rb +18 -14
  90. data/test/bridges/tiny_mce_test.rb +5 -3
  91. data/test/config/base_test.rb +1 -1
  92. data/test/config/core_test.rb +1 -1
  93. data/test/config/create_test.rb +1 -1
  94. data/test/config/delete_test.rb +1 -1
  95. data/test/config/field_search_test.rb +1 -1
  96. data/test/config/list_test.rb +1 -1
  97. data/test/config/nested_test.rb +1 -1
  98. data/test/config/search_test.rb +1 -1
  99. data/test/config/show_test.rb +1 -1
  100. data/test/config/subform_test.rb +1 -1
  101. data/test/config/update_test.rb +1 -1
  102. data/test/data_structures/action_columns_test.rb +1 -1
  103. data/test/data_structures/action_link_test.rb +1 -1
  104. data/test/data_structures/action_links_test.rb +1 -1
  105. data/test/data_structures/actions_test.rb +1 -1
  106. data/test/data_structures/association_column_test.rb +1 -1
  107. data/test/data_structures/column_test.rb +1 -1
  108. data/test/data_structures/columns_test.rb +1 -1
  109. data/test/data_structures/set_test.rb +1 -1
  110. data/test/data_structures/sorting_test.rb +1 -1
  111. data/test/data_structures/standard_column_test.rb +1 -1
  112. data/test/data_structures/validation_reflection_test.rb +1 -1
  113. data/test/data_structures/virtual_column_test.rb +1 -1
  114. data/test/extensions/active_record_test.rb +1 -1
  115. data/test/helpers/form_column_helpers_test.rb +7 -5
  116. data/test/helpers/pagination_helpers_test.rb +1 -1
  117. data/test/helpers/search_column_helpers_test.rb +2 -1
  118. data/test/misc/active_record_permissions_test.rb +1 -1
  119. data/test/misc/attribute_params_test.rb +1 -1
  120. data/test/misc/calculation_test.rb +1 -1
  121. data/test/misc/configurable_test.rb +1 -1
  122. data/test/misc/constraints_test.rb +2 -1
  123. data/test/misc/convert_numbers_format_test.rb +1 -1
  124. data/test/misc/finder_test.rb +39 -1
  125. data/test/misc/lang_test.rb +1 -1
  126. data/test/misc/parse_datetime_test.rb +1 -1
  127. data/test/misc/tableless_test.rb +1 -1
  128. data/test/test_helper.rb +4 -4
  129. metadata +5 -17
  130. data/config/brakeman.ignore +0 -26
  131. data/config/brakeman.yml +0 -3
  132. data/config/i18n-tasks.yml +0 -121
  133. data/lib/active_scaffold/bridges/shared/date_bridge.rb +0 -221
  134. data/lib/active_scaffold/delayed_setup.rb +0 -41
  135. data/lib/active_scaffold/extensions/left_outer_joins.rb +0 -43
@@ -47,6 +47,9 @@ es:
47
47
  deleted_model: "%{model} borrado"
48
48
  deleted_records: Ver Eliminados
49
49
  delimiter: Delimitador
50
+ doesnt_begin_with: No empieza con
51
+ doesnt_contain: No contiene
52
+ doesnt_end_with: No termina con
50
53
  download: Descargar
51
54
  edit: Editar
52
55
  ends_with: Termina con
@@ -47,6 +47,9 @@ fr:
47
47
  deleted_model: Suppression de %{model}
48
48
  deleted_records: Lister les enregistrements supprimés
49
49
  delimiter: Délimiteur
50
+ doesnt_begin_with:
51
+ doesnt_contain:
52
+ doesnt_end_with:
50
53
  download: Télécharger
51
54
  edit: Éditer
52
55
  ends_with: Se terminant par
@@ -63,7 +66,7 @@ fr:
63
66
  found: Trouvé
64
67
  future: Futur
65
68
  group_by: Grouper par
66
- grouped_by:
69
+ grouped_by:
67
70
  hide: "(Cacher)"
68
71
  hours: Heures
69
72
  human_conditions:
@@ -138,11 +141,11 @@ fr:
138
141
  yesterday: Hier
139
142
  date:
140
143
  formats:
141
- month:
142
- quarter:
143
- week:
144
- year_month:
145
- year_quarter:
144
+ month: "%B"
145
+ quarter:
146
+ week:
147
+ year_month: "%b %Y"
148
+ year_quarter:
146
149
  time:
147
150
  formats:
148
151
  picker: "%a, %d %b %Y %H:%M:%S"
@@ -18,7 +18,7 @@ hu:
18
18
  between: Között
19
19
  cancel: Mégse
20
20
  cant_destroy_record: 'nem törölhető: %{record}'
21
- changes:
21
+ changes:
22
22
  click_to_edit: Kattints a szerkesztéshez
23
23
  click_to_reset: Kattints az alapállapothoz
24
24
  close: Bezárás
@@ -27,7 +27,7 @@ hu:
27
27
  contains: Contains
28
28
  create: Létrehozás
29
29
  create_another: Create Another %{model}
30
- create_apply:
30
+ create_apply:
31
31
  create_model: "%{model} létrehozása"
32
32
  create_new: Új létrehozása
33
33
  created_model: "%{model} létrehozva"
@@ -38,15 +38,18 @@ hu:
38
38
  showMonthAfterYear: false
39
39
  weekHeader: Wk
40
40
  datetime_picker_options:
41
- closeText:
42
- currentText:
41
+ closeText:
42
+ currentText:
43
43
  timeText:
44
- timezoneText: Timezone
44
+ timezoneText:
45
45
  days: Days
46
46
  delete: Törlés
47
47
  deleted_model: "%{model} törölve"
48
- deleted_records:
48
+ deleted_records:
49
49
  delimiter: Elválasztó
50
+ doesnt_begin_with:
51
+ doesnt_contain:
52
+ doesnt_end_with:
50
53
  download: Letöltés
51
54
  edit: Szerkesztés
52
55
  ends_with: Ends with
@@ -62,8 +65,8 @@ hu:
62
65
  filtered: "(Szűrt)"
63
66
  found: Találat
64
67
  future: Future
65
- group_by:
66
- grouped_by:
68
+ group_by:
69
+ grouped_by:
67
70
  hide: "(Elrejtés)"
68
71
  hours: Hours
69
72
  human_conditions:
@@ -85,9 +88,9 @@ hu:
85
88
  next_week: Next Week
86
89
  next_year: Next Year
87
90
  no_authorization_for_action: No Authorization for action %{action}
88
- no_color:
91
+ no_color:
89
92
  no_entries: Nincs elem
90
- no_group:
93
+ no_group:
91
94
  no_options: nincsenek opciók
92
95
  not_null: Not Null
93
96
  'null': 'Null'
@@ -109,7 +112,7 @@ hu:
109
112
  refresh: Frissítés
110
113
  remove: Törlés
111
114
  remove_file: Fájl törlése, vagy cseréje
112
- remove_files: Fájlok törlése, vagy hozzáadása
115
+ remove_files:
113
116
  replace_existing: Replace existing
114
117
  replace_with_new: Csere újjal
115
118
  reset: Alapállapot
@@ -129,7 +132,7 @@ hu:
129
132
  tomorrow: Tomorrow
130
133
  'true': 'True'
131
134
  update: Modosítás
132
- update_apply:
135
+ update_apply:
133
136
  update_model: "%{model} modosítása"
134
137
  updated_model: "%{model} módosítva"
135
138
  version_inconsistency: Verzió ütközés - ezt a rekordot módosították mióta elkezdted szerkeszteni.
@@ -138,11 +141,11 @@ hu:
138
141
  yesterday: Yesterday
139
142
  date:
140
143
  formats:
141
- month:
142
- quarter:
143
- week:
144
- year_month:
145
- year_quarter:
144
+ month:
145
+ quarter:
146
+ week:
147
+ year_month:
148
+ year_quarter:
146
149
  time:
147
150
  formats:
148
151
  picker: "%a, %d %b %Y %H:%M:%S"
@@ -11,23 +11,23 @@ ja:
11
11
  add: 追加
12
12
  add_existing: 既存のものを追加
13
13
  add_existing_model: 既存の%{model}を追加
14
- apply: Apply
15
- are_you_sure_to_delete: Are you sure you want to delete %{label}?
16
- average: Average
17
- begins_with: Begins with
18
- between: Between
14
+ apply: 適用
15
+ are_you_sure_to_delete: "%{label}を消去してもよろしいですか?"
16
+ average: 平均
17
+ begins_with: 開始時間
18
+ between: 範囲指定
19
19
  cancel: キャンセル
20
- cant_destroy_record: "%{record}を削除で来ません"
21
- changes:
20
+ cant_destroy_record: "%{record}を削除できません"
21
+ changes: 差分
22
22
  click_to_edit: クリックして編集
23
- click_to_reset: Click to reset
23
+ click_to_reset: クリックしてリセット
24
24
  close: 閉じる
25
- config_list: Configure
26
- config_list_model: Configure Columns for %{model}
27
- contains: Contains
25
+ config_list:
26
+ config_list_model:
27
+ contains: 部分一致検索
28
28
  create: 作成
29
- create_another: Create Another %{model}
30
- create_apply:
29
+ create_another:
30
+ create_apply:
31
31
  create_model: "%{model}を作成"
32
32
  create_new: 新規作成
33
33
  created_model: "%{model}を作成しました"
@@ -36,36 +36,39 @@ ja:
36
36
  firstDay: 0
37
37
  isRTL: false
38
38
  showMonthAfterYear: false
39
- weekHeader: Wk
39
+ weekHeader:
40
40
  datetime_picker_options:
41
- closeText:
42
- currentText:
43
- timeText:
44
- timezoneText: Timezone
45
- days: Days
41
+ closeText: 閉じる
42
+ currentText: 現在時刻
43
+ timeText: 時間
44
+ timezoneText: 時間帯
45
+ days: 日分
46
46
  delete: 削除
47
47
  deleted_model: "%{model}を削除しました"
48
- deleted_records:
49
- delimiter: Delimiter
48
+ deleted_records:
49
+ delimiter: 区切り文字
50
+ doesnt_begin_with:
51
+ doesnt_contain:
52
+ doesnt_end_with:
50
53
  download: ダウンロード
51
54
  edit: 編集
52
- ends_with: Ends with
53
- error_500: "(コード500: 内部エラー)"
55
+ ends_with: 終了時間
56
+ error_500: "(コード500:内部エラー)"
54
57
  errors:
55
58
  template:
56
- body: 'There were problems with the following fields:'
59
+ body: 次のフィールドに問題がありました:
57
60
  header:
58
- one: 1 error prohibited this %{model} from being saved.
59
- other: "%{count} errors prohibited this %{model} from being saved"
60
- export: Export
61
- 'false': 'False'
61
+ one: 1件のエラーにより、この%{model}が保存できませんでした
62
+ other: "%{count}件のエラーにより、この%{model}が保存できませんでした"
63
+ export: エクスポート
64
+ 'false':
62
65
  filtered: "(フィルタ中)"
63
66
  found: 個ありました
64
- future: Future
65
- group_by:
66
- grouped_by:
67
- hide: "(隠す)"
68
- hours: Hours
67
+ future: 未来
68
+ group_by:
69
+ grouped_by:
70
+ hide: "(隠す)"
71
+ hours: 時間分
69
72
  human_conditions:
70
73
  association: "%{column} = %{value}"
71
74
  boolean: "%{column} = %{value}"
@@ -73,76 +76,76 @@ ja:
73
76
  internal_error: リクエストが失敗しました
74
77
  live_search: その場で検索
75
78
  loading: 読み込み中…
76
- mark_all_records: Mark all
77
- maximum: Maximum
78
- minimum: Minimum
79
- minutes: Minutes
80
- months: Months
79
+ mark_all_records: すべて選択
80
+ maximum: 最大値
81
+ minimum: 最小値
82
+ minutes: 分間
83
+ months: か月分
81
84
  nested_for_model: "%{parent_model}の%{nested_model}"
82
- nested_of_model: "%{nested_model} of %{parent_model}"
85
+ nested_of_model:
83
86
  next: 次
84
- next_month: Next Month
85
- next_week: Next Week
86
- next_year: Next Year
87
- no_authorization_for_action: No Authorization for action %{action}
88
- no_color:
87
+ next_month: 来月
88
+ next_week: 来週
89
+ next_year: 来年
90
+ no_authorization_for_action:
91
+ no_color:
89
92
  no_entries: 見つかりませんでした
90
- no_group:
93
+ no_group:
91
94
  no_options: オプション無し
92
- not_null: Not Null
93
- 'null': 'Null'
94
- omit_header: Omit Header
95
- optional_attributes: Further Options
95
+ not_null:
96
+ 'null':
97
+ omit_header:
98
+ optional_attributes:
96
99
  options: オプション
97
- past: Past
98
- pdf: PDF
99
- prev_month: Last Month
100
- prev_week: Last Week
101
- prev_year: Last Year
100
+ past: 過去
101
+ pdf:
102
+ prev_month: 先月
103
+ prev_week: 先週
104
+ prev_year: 去年
102
105
  previous: 前
103
106
  print: 印刷
104
- range: Range
105
- record_not_saved: Failed to save record cause of an unknown error
107
+ range: 範囲検索
108
+ record_not_saved: 不明なエラーによって保存できませんでした
106
109
  records_marked:
107
- one: 1 marked %{model}
108
- other: "%{count} marked %{model}"
109
- refresh: Refresh
110
+ one: "%{model}を1件選択"
111
+ other: "%{model}を%{count}件選択"
112
+ refresh: 更新
110
113
  remove: 削除
111
114
  remove_file: ファイルを削除または置換
112
115
  remove_files: ファイルを削除または追加する
113
- replace_existing: Replace existing
116
+ replace_existing:
114
117
  replace_with_new: 新しいもので置換
115
118
  reset: リセット
116
- revisions_for_model: Revisions for %{model}
119
+ revisions_for_model:
117
120
  saving: 保存中…
118
121
  search: 検索
119
122
  search_terms: 検索単語
120
- seconds: Seconds
123
+ seconds: 秒分
121
124
  show: 表示
122
- show_block: "(表示)"
125
+ show_block: "(表示)"
123
126
  show_model: "%{model}を表示"
124
- sum: Sum
125
- this_month: This Month
126
- this_week: This Week
127
- this_year: This Year
128
- today: Today
129
- tomorrow: Tomorrow
130
- 'true': 'True'
127
+ sum: 合計値
128
+ this_month: 今月
129
+ this_week: 今週
130
+ this_year: 今年
131
+ today: 今日
132
+ tomorrow: 明日
133
+ 'true':
131
134
  update: 更新
132
- update_apply:
135
+ update_apply:
133
136
  update_model: "%{model}を更新"
134
137
  updated_model: "%{model}を更新しました"
135
138
  version_inconsistency: バージョンが一致しません - あなたが編集している間にこのレコードが変更されました。
136
- weeks: Weeks
137
- years: Years
138
- yesterday: Yesterday
139
+ weeks: 週間分
140
+ years: 年分
141
+ yesterday: 昨日
139
142
  date:
140
143
  formats:
141
- month:
142
- quarter:
143
- week:
144
- year_month:
145
- year_quarter:
144
+ month: "%m月"
145
+ quarter: 第%{quarter}四半期
146
+ week:
147
+ year_month: "%Y年%m月"
148
+ year_quarter: "%{year}年第%{quarter}四半期"
146
149
  time:
147
150
  formats:
148
- picker: "%a, %d %b %Y %H:%M:%S"
151
+ picker: "%Y年%m月%d日(%a %H:%M:%S"
@@ -18,7 +18,7 @@ ru:
18
18
  between: В интервале
19
19
  cancel: Отмена
20
20
  cant_destroy_record: Запись %{record} не может быть удалена
21
- changes:
21
+ changes:
22
22
  click_to_edit: Нажмите для редактирования
23
23
  click_to_reset: Нажмите для сброса
24
24
  close: Закрыть
@@ -27,7 +27,7 @@ ru:
27
27
  contains: Содержит
28
28
  create: Создать
29
29
  create_another: "%{model}: Создать другую запись"
30
- create_apply:
30
+ create_apply:
31
31
  create_model: "%{model}: создать запись"
32
32
  create_new: Создать новую запись
33
33
  created_model: "%{model}: запись создана"
@@ -41,12 +41,15 @@ ru:
41
41
  closeText: Закрыть
42
42
  currentText: Текущее время
43
43
  timeText:
44
- timezoneText: Timezone
44
+ timezoneText:
45
45
  days: дней
46
46
  delete: Удалить
47
47
  deleted_model: "%{model}: запись удалена"
48
- deleted_records:
48
+ deleted_records:
49
49
  delimiter: Разделитель
50
+ doesnt_begin_with:
51
+ doesnt_contain:
52
+ doesnt_end_with:
50
53
  download: Загрузить
51
54
  edit: Изменить
52
55
  ends_with: Оканчивается на
@@ -68,8 +71,8 @@ ru:
68
71
  one: запись
69
72
  other: записи
70
73
  future: Будущие
71
- group_by:
72
- grouped_by:
74
+ group_by:
75
+ grouped_by:
73
76
  hide: "(Скрыть)"
74
77
  hours: часов
75
78
  human_conditions:
@@ -91,9 +94,9 @@ ru:
91
94
  next_week: На следующей неделе
92
95
  next_year: В следующем году
93
96
  no_authorization_for_action: Нет прав на выполнение действия "%{action}"
94
- no_color:
97
+ no_color:
95
98
  no_entries: Нет записей
96
- no_group:
99
+ no_group:
97
100
  no_options: Нет вариантов
98
101
  not_null: Не пусто
99
102
  'null': Пусто
@@ -137,7 +140,7 @@ ru:
137
140
  tomorrow: Завтра
138
141
  'true': Да
139
142
  update: Обновить запись
140
- update_apply:
143
+ update_apply:
141
144
  update_model: "%{model}: обновить запись"
142
145
  updated_model: "%{model}: запись обновлена"
143
146
  version_inconsistency: Эта запись была обновлена с того момента, как вы начали ее редактировать
@@ -146,11 +149,11 @@ ru:
146
149
  yesterday: Вчера
147
150
  date:
148
151
  formats:
149
- month:
150
- quarter:
151
- week:
152
- year_month:
153
- year_quarter:
152
+ month:
153
+ quarter:
154
+ week:
155
+ year_month:
156
+ year_quarter:
154
157
  time:
155
158
  formats:
156
159
  picker: "%a, %d %b %Y %H:%M:%S"
@@ -31,11 +31,11 @@ module ActiveScaffold::Actions
31
31
  params_hash params[:search]
32
32
  end
33
33
 
34
- def set_outer_joins_for_search(columns)
34
+ def set_outer_joins_for_search(columns) # rubocop:disable Naming/AccessorMethodName
35
35
  references = []
36
36
  outer_joins = []
37
37
  columns.each do |column|
38
- next unless column.search_joins.present?
38
+ next if column.search_joins.blank?
39
39
  if column.includes.present? && list_columns.include?(column)
40
40
  references << (column.search_joins & column.includes)
41
41
  outer_joins << (column.search_joins - column.includes)
@@ -6,6 +6,7 @@ module ActiveScaffold::Actions
6
6
  before_action :check_input_device
7
7
  before_action :register_constraints_with_action_columns, :unless => :nested?
8
8
  after_action :clear_flashes
9
+ after_action :dl_cookie
9
10
  around_action :clear_storage
10
11
  rescue_from ActiveScaffold::RecordNotAllowed, ActiveScaffold::ActionNotAllowed, :with => :deny_access
11
12
  end
@@ -22,7 +23,7 @@ module ActiveScaffold::Actions
22
23
  end
23
24
 
24
25
  def render_field
25
- if request.get?
26
+ if request.get? || request.head?
26
27
  render_field_for_inplace_editing
27
28
  respond_to do |format|
28
29
  format.js { render :action => 'render_field_inplace', :layout => false }
@@ -61,14 +62,18 @@ module ActiveScaffold::Actions
61
62
  @source_id = params.delete(:source_id)
62
63
  @columns = @column.update_columns || []
63
64
  @scope = params.delete(:scope)
64
- action = :subform if @scope
65
- action ||= params[:id] ? :update : :create
66
- @main_columns = active_scaffold_config.send(action).columns
65
+ if @scope
66
+ @form_action = :subform
67
+ elsif active_scaffold_config.actions.include? params[:form_action]&.to_sym
68
+ @form_action = params.delete(:form_action).to_sym
69
+ end
70
+ @form_action ||= params[:id] ? :update : :create
71
+ @main_columns = active_scaffold_config.send(@form_action).columns
67
72
  @columns << @column.name if @column.options[:refresh_link] && @columns.exclude?(@column.name)
68
73
 
69
74
  @record =
70
75
  if @column.send_form_on_update_column
71
- updated_record_with_form(@main_columns, params[:record], @scope)
76
+ updated_record_with_form(@main_columns, params[:record] || params[:search], @scope)
72
77
  else
73
78
  updated_record_with_column(@column, params.delete(:value), @scope)
74
79
  end
@@ -100,7 +105,14 @@ module ActiveScaffold::Actions
100
105
  record = params[:id] ? copy_attributes(find_if_allowed(params[:id], :read)) : new_model
101
106
  apply_constraints_to_record(record) unless scope || params[:id]
102
107
  create_association_with_parent record, true if nested?
103
- update_column_from_params(record, column, value, true)
108
+ if @form_action == :field_search && value.is_a?(Array) && column.association&.singular?
109
+ # don't assign value if it's an array and column is singular association,
110
+ # e.g. value came from multi-select on search form
111
+ # use instance variable so it's available in the view and helpers
112
+ @value = value
113
+ else
114
+ update_column_from_params(record, column, value, true)
115
+ end
104
116
  record.id = params[:id]
105
117
  record
106
118
  end
@@ -165,6 +177,10 @@ module ActiveScaffold::Actions
165
177
  flash.clear if request.xhr?
166
178
  end
167
179
 
180
+ def dl_cookie
181
+ cookies[params[:_dl_cookie]] = {value: Time.now.to_i, expires: 1.day.since} if params[:_dl_cookie]
182
+ end
183
+
168
184
  def each_marked_record(&block)
169
185
  active_scaffold_config.model.as_marked.each(&block)
170
186
  end
@@ -248,7 +264,7 @@ module ActiveScaffold::Actions
248
264
  @conditions_from_params ||= begin
249
265
  conditions = [{}]
250
266
  params.except(:controller, :action, :page, :sort, :sort_direction, :format, :id).each do |key, value|
251
- distinct = true if key =~ /!$/
267
+ distinct = true if key.match?(/!$/)
252
268
  column = active_scaffold_config._columns_hash[key.to_s[0..(distinct ? -2 : -1)]]
253
269
  next unless column
254
270
  key = column.name.to_sym
@@ -321,7 +337,8 @@ module ActiveScaffold::Actions
321
337
 
322
338
  def check_input_device
323
339
  return unless session[:input_device_type].nil?
324
- if request.env['HTTP_USER_AGENT'] =~ /(iPhone|iPod|iPad)/i
340
+ return if request.env['HTTP_USER_AGENT'].nil?
341
+ if request.env['HTTP_USER_AGENT'].match?(/(iPhone|iPod|iPad)/i)
325
342
  session[:input_device_type] = 'TOUCH'
326
343
  session[:hover_supported] = false
327
344
  else
@@ -362,14 +379,14 @@ module ActiveScaffold::Actions
362
379
  # flash[:info] = 'Player fired'
363
380
  # end
364
381
  def process_action_link_action(render_action = :action_update, crud_type_or_security_options = nil)
365
- if request.get?
382
+ if request.get? || request.head?
366
383
  # someone has disabled javascript, we have to show confirmation form first
367
384
  @record = find_if_allowed(params[:id], :read) if params[:id]
368
385
  respond_to_action(:action_confirmation)
369
386
  else
370
387
  @action_link = active_scaffold_config.action_links[action_name]
371
388
  if params[:id]
372
- crud_type_or_security_options ||= {:crud_type => request.post? || request.put? ? :update : :delete, :action => action_name}
389
+ crud_type_or_security_options ||= {:crud_type => request.delete? ? :delete : :update, :action => action_name}
373
390
  get_row(crud_type_or_security_options)
374
391
  if @record.nil?
375
392
  self.successful = false
@@ -378,6 +395,9 @@ module ActiveScaffold::Actions
378
395
  yield @record
379
396
  end
380
397
  else
398
+ if @action_link && respond_to?(@action_link.security_method, true) && !send(@action_link.security_method)
399
+ raise ActiveScaffold::ActionNotAllowed
400
+ end
381
401
  yield
382
402
  end
383
403
  respond_to_action(render_action)
@@ -154,7 +154,6 @@ module ActiveScaffold::Actions
154
154
  filtered_columns = []
155
155
  text_search = active_scaffold_config.field_search.text_search
156
156
  columns = active_scaffold_config.field_search.columns
157
- count_includes = active_scaffold_config.list.user.count_includes
158
157
  search_params.each do |key, value|
159
158
  next unless columns.include? key
160
159
  column = active_scaffold_config.columns[key]
@@ -164,11 +163,7 @@ module ActiveScaffold::Actions
164
163
  active_scaffold_conditions << search_condition
165
164
  filtered_columns << column
166
165
  end
167
- if grouped_search? || active_scaffold_config.list.user.count_includes.present?
168
- active_scaffold_outer_joins.concat filtered_columns.map(&:search_joins).flatten.uniq.compact
169
- else
170
- set_outer_joins_for_search filtered_columns
171
- end
166
+ setup_joins_for_filtered_columns(filtered_columns)
172
167
  if filtered_columns.present? || grouped_search?
173
168
  @filtered = active_scaffold_config.field_search.human_conditions ? filtered_columns : true
174
169
  end
@@ -182,6 +177,14 @@ module ActiveScaffold::Actions
182
177
 
183
178
  private
184
179
 
180
+ def setup_joins_for_filtered_columns(filtered_columns)
181
+ if grouped_search? || active_scaffold_config.list.user.count_includes.present?
182
+ active_scaffold_outer_joins.concat filtered_columns.map(&:search_joins).flatten.uniq.compact
183
+ else
184
+ set_outer_joins_for_search filtered_columns
185
+ end
186
+ end
187
+
185
188
  def field_search_formats
186
189
  (default_formats + active_scaffold_config.formats + active_scaffold_config.field_search.formats).uniq
187
190
  end
@@ -8,7 +8,7 @@ module ActiveScaffold::Actions
8
8
  base.module_eval do
9
9
  before_action :set_nested
10
10
  before_action :configure_nested
11
- include ActiveScaffold::Actions::Nested::ChildMethods if active_scaffold_config.model.reflect_on_all_associations.any? { |a| a.macro == :has_and_belongs_to_many }
11
+ include ActiveScaffold::Actions::Nested::ChildMethods if active_scaffold_config.columns.map(&:association).compact.any?(&:habtm?)
12
12
  end
13
13
  base.before_action :include_habtm_actions
14
14
  base.helper_method :nested
@@ -120,9 +120,9 @@ module ActiveScaffold::Actions
120
120
 
121
121
  def create_association_with_parent?(check_match = false)
122
122
  # has_many is done by beginning_of_chain and rails if direct association, not in through associations
123
- return false if nested.has_many? && !nested.association.through?
123
+ return false unless nested.create_with_parent?
124
124
  return false if check_match && !nested.match_model?(active_scaffold_config.model)
125
- (nested.child_association || nested.create_through_singular?) && nested_parent_record
125
+ nested_parent_record.present?
126
126
  end
127
127
 
128
128
  def create_association_with_parent(record, check_match = false)
@@ -131,7 +131,7 @@ module ActiveScaffold::Actions
131
131
  record.send("#{nested.child_association.name}=", nested_parent_record)
132
132
  elsif nested.create_through_singular?
133
133
  through = nested_parent_record.send(nested.association.through_reflection.name) ||
134
- nested_parent_record.send("build_#{nested.association.through_reflection.name}")
134
+ nested_parent_record.send("build_#{nested.association.through_reflection.name}")
135
135
  if nested.source_reflection.reverse_association.collection?
136
136
  record.send(nested.source_reflection.reverse) << through
137
137
  else
@@ -167,7 +167,7 @@ module ActiveScaffold::Actions::Nested
167
167
  end
168
168
 
169
169
  def destroy_existing
170
- return redirect_to(params.merge(:action => :delete, :only_path => true)) if request.get?
170
+ return redirect_to(params.merge(:action => :delete, :only_path => true)) if request.get? || request.head?
171
171
  do_destroy_existing
172
172
  respond_to_action(:destroy_existing)
173
173
  end
@@ -247,8 +247,8 @@ module ActiveScaffold::Actions::Nested
247
247
  parent_record = nested_parent_record(:update)
248
248
  @record = active_scaffold_config.model.find(params[:associated_id])
249
249
  if parent_record && @record
250
- parent_record.send(nested.association.name) << @record
251
- parent_record.save
250
+ self.successful = false unless parent_record.send(nested.association.name) << @record
251
+ parent_record.save if successful?
252
252
  else
253
253
  false
254
254
  end
@@ -185,11 +185,11 @@ module ActiveScaffold::Actions
185
185
 
186
186
  def value_for_update_column(param_value, column, record)
187
187
  unless param_value
188
- param_value = ActiveScaffold::Core.column_type_cast @column.default_for_empty_value, @column.column
188
+ param_value = ActiveScaffold::Core.column_type_cast column.default_for_empty_value, column.column
189
189
  param_value = false if param_value == true
190
190
  end
191
- value = column_value_from_param_value(record, @column, param_value)
192
- value = [] if value.nil? && @column.form_ui && @column.association&.collection?
191
+ value = column_value_from_param_value(record, column, param_value)
192
+ value = [] if value.nil? && column.form_ui && column.association&.collection?
193
193
  value
194
194
  end
195
195