card 1.96.1 → 1.96.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/locales/de.yml +18 -23
  4. data/config/locales/en.yml +16 -21
  5. data/config/locales/es.yml +16 -21
  6. data/lib/card.rb +1 -3
  7. data/lib/card/codename.rb +2 -1
  8. data/lib/card/error.rb +73 -57
  9. data/lib/card/format.rb +2 -2
  10. data/lib/card/format/error.rb +17 -18
  11. data/lib/card/format/nesting/mode.rb +1 -1
  12. data/lib/card/format/permission.rb +8 -10
  13. data/lib/card/format/render.rb +1 -2
  14. data/lib/card/model/save_helper.rb +20 -12
  15. data/lib/card/query.rb +1 -1
  16. data/lib/card/query/card_query.rb +2 -2
  17. data/lib/card/query/card_query/found_by.rb +43 -0
  18. data/lib/card/query/card_query/match_attributes.rb +72 -0
  19. data/lib/card/query/card_query/relational_attributes.rb +19 -0
  20. data/lib/card/view.rb +0 -1
  21. data/lib/card/view/cache_action.rb +1 -10
  22. data/mod/account/set/right/token.rb +1 -3
  23. data/mod/account/set/self/account_links.rb +9 -12
  24. data/mod/basic_formats/set/all/json.rb +19 -54
  25. data/mod/basic_formats/spec/set/all/json_spec.rb +13 -3
  26. data/mod/basic_formats/spec/shared_context/json_shared_context.rb +3 -8
  27. data/mod/basic_types/set/type/json.rb +13 -1
  28. data/mod/bootstrap/set/abstract/bootswatch_theme/html_views.rb +0 -1
  29. data/mod/bootstrap/set/all/bootstrap/helper.rb +7 -0
  30. data/mod/bootstrap/set/self/script_bootstrap.rb +1 -2
  31. data/mod/core/set/all/content.rb +4 -6
  32. data/mod/core/set/all/export.rb +39 -15
  33. data/mod/core/set/all/fetch.rb +9 -0
  34. data/mod/core/set/all/permissions.rb +0 -4
  35. data/mod/core/set/all/phases.rb +1 -1
  36. data/mod/core/set/all/subcards.rb +1 -0
  37. data/mod/core/set/all/trash.rb +6 -2
  38. data/mod/core/set/all/type.rb +1 -1
  39. data/mod/core/set/all/utils.rb +13 -1
  40. data/mod/core/spec/set/all/fetch_spec.rb +17 -4
  41. data/mod/history/set/all/history.rb +34 -57
  42. data/mod/history/set/all/{act_view.rb → history/act_listing.rb} +0 -13
  43. data/mod/history/set/all/history/actions.rb +119 -0
  44. data/mod/history/set/all/history/acts.rb +12 -0
  45. data/mod/history/set/all/history/events.rb +94 -0
  46. data/mod/history/set/all/history/last.rb +97 -0
  47. data/mod/history/set/all/history/revision.rb +54 -0
  48. data/mod/history/set/all/history/selected.rb +64 -0
  49. data/mod/history/set/all/history/views.rb +34 -0
  50. data/mod/history/spec/set/all/history/views_spec.rb +29 -0
  51. data/mod/item/spec/set/all/bar_spec.rb +2 -2
  52. data/mod/machines/file/all_script_machine_output/file.js +66 -30621
  53. data/mod/machines/file/all_style_machine_output/file.css +2 -2
  54. data/mod/machines/file/script_html5shiv_printshiv_machine_output/file.js +1 -1
  55. data/mod/machines/lib/javascript/decko.js.coffee +1 -1
  56. data/mod/pointer/lib/javascript/script_pointer_config.js.coffee +1 -1
  57. data/mod/pointer/set/abstract/01_paging.rb +1 -0
  58. data/mod/pointer/set/abstract/02_pointer/html_views.rb +2 -2
  59. data/mod/pointer/set/abstract/02_pointer/html_views/checkbox_input.haml +2 -2
  60. data/mod/pointer/set/abstract/02_pointer/html_views/filter/filter_items.haml +1 -1
  61. data/mod/pointer/set/abstract/02_pointer/html_views/radio_input.haml +4 -4
  62. data/mod/pointer/set/abstract/02_pointer/options_api.rb +25 -1
  63. data/mod/pointer/set/abstract/02_pointer/other_views.rb +4 -0
  64. data/mod/pointer/spec/set/abstract/pointer/options_api_spec.rb +35 -0
  65. data/mod/search/set/abstract/search.rb +4 -114
  66. data/mod/search/set/abstract/search/views.rb +156 -0
  67. data/mod/search/set/abstract/wql_search.rb +10 -0
  68. data/mod/search/set/self/search.rb +3 -10
  69. data/mod/search/set/type/search_type.rb +5 -1
  70. data/mod/search/template/abstract/03_filter/filter_form.haml +1 -1
  71. data/mod/standard/set/all/error.rb +24 -192
  72. data/mod/standard/set/all/rich_html/content.rb +1 -1
  73. data/mod/standard/set/all/rich_html/error.rb +177 -0
  74. data/mod/standard/{template/all → set/all/rich_html}/error/not_found.haml +0 -0
  75. data/mod/standard/{template/all → set/all/rich_html}/error/server_error.haml +0 -0
  76. data/mod/standard/set/all/rich_html/form.rb +9 -9
  77. data/mod/standard/set/all/rich_html/menu.rb +14 -5
  78. data/mod/standard/spec/content/chunk/include_spec.rb +1 -2
  79. data/mod/standard/spec/set/type/search_type_spec.rb +1 -1
  80. data/mod/utility/set/abstract/bs_badge/bs_badge.haml +1 -1
  81. data/mod/utility/set/abstract/media.rb +3 -1
  82. metadata +20 -16
  83. data/lib/card/query/card_query/attribute_helper.rb +0 -74
  84. data/lib/card/query/card_query/special_attributes.rb +0 -49
  85. data/mod/history/set/all/action_view.rb +0 -52
  86. data/mod/history/set/all/actions.rb +0 -185
  87. data/mod/history/set/all/acts.rb +0 -16
  88. data/mod/history/set/all/content_history.rb +0 -180
  89. data/mod/history/spec/set/all/act_view_spec.rb +0 -16
  90. data/mod/history/spec/set/all/action_view_spec.rb +0 -10
  91. data/mod/history/spec/set/all/history_spec.rb +0 -11
@@ -1,16 +0,0 @@
1
- def act_card?
2
- self == Card::ActManager.act_card
3
- end
4
-
5
- event :finalize_act, after: :finalize_action, when: :act_card? do
6
- Card::ActManager.act.update_attributes! card_id: id
7
- end
8
-
9
- event :remove_empty_act, :integrate_with_delay_final, when: :remove_empty_act? do
10
- # Card::ActManager.act.delete
11
- # Card::ActManager.act = nil
12
- end
13
-
14
- def remove_empty_act?
15
- act_card? && ActManager.act&.ar_actions&.reload&.empty?
16
- end
@@ -1,180 +0,0 @@
1
-
2
- # if these aren't in a nested module, the methods just overwrite the base
3
- # methods, but we need a distict module so that super will be able to refer to
4
- # the base methods.
5
- def content
6
- @selected_action_id ? selected_content : super
7
- end
8
-
9
- def selected_content
10
- @selected_content ||= content_at_time_of_selected_action || db_content
11
- end
12
-
13
- def content_at_time_of_selected_action
14
- last_change_on(:db_content, not_after: @selected_action_id, including_drafts: true)&.value
15
- end
16
-
17
- def content= value
18
- @selected_content = nil
19
- super
20
- end
21
-
22
- def save_content_draft content
23
- super
24
- acts.create do |act|
25
- act.ar_actions.build(draft: true, card_id: id, action_type: :update)
26
- .card_changes.build(field: :db_content, value: content)
27
- end
28
- end
29
-
30
- def last_change_on field, opts={}
31
- action_id = extract_action_id(opts[:before] || opts[:not_after])
32
-
33
- # If there is only one action then there are no entries in the changes table,
34
- # so we can't do a sql search but the changes are accessible via the action.
35
- if action_id == create_action.id
36
- return if opts[:before] # there is no before the first action
37
- create_action.change field
38
- elsif !action_id && create_action.sole?
39
- create_action.change field
40
- else
41
- Change.joins(:action).where(
42
- last_change_sql_conditions(opts),
43
- card_id: id,
44
- action_id: action_id,
45
- field: Card::Change.field_index(field)
46
- ).order(:id).last
47
- end
48
- end
49
-
50
- def extract_action_id action_arg
51
- action_arg.is_a?(Card::Action) ? action_arg.id : action_arg
52
- end
53
-
54
- def last_change_sql_conditions opts
55
- cond = "card_actions.card_id = :card_id AND field = :field"
56
- cond += " AND (draft is not true)" unless opts[:including_drafts]
57
- operator = "<" if opts[:before]
58
- operator = "<=" if opts[:not_after]
59
- cond += " AND card_action_id #{operator} :action_id" if operator
60
- cond
61
- end
62
-
63
- def selected_action_id
64
- @selected_action_id || (@current_action && @current_action.id) ||
65
- last_action_id
66
- end
67
-
68
- def selected_action_id= action_id
69
- @selected_content = nil
70
- @selected_action_id = action_id
71
- end
72
-
73
- def selected_action
74
- selected_action_id && Action.fetch(selected_action_id)
75
- end
76
-
77
- def with_selected_action_id action_id
78
- current_action_id = @selected_action_id
79
- select_action_id action_id
80
- result = yield
81
- select_action_id current_action_id
82
- result
83
- end
84
-
85
- def select_action_id action_id
86
- run_callbacks :select_action do
87
- self.selected_action_id = action_id
88
- end
89
- end
90
-
91
- def selected_content_action_id
92
- @selected_action_id || new_content_action_id || last_content_action_id
93
- end
94
-
95
- def new_content_action_id
96
- return unless @current_action && current_action_changes_content?
97
- @current_action.id
98
- end
99
-
100
- def current_action_changes_content?
101
- new_card? || @current_action.new_content? || db_content_is_changing?
102
- end
103
-
104
- def last_action_id
105
- last_action&.id
106
- end
107
-
108
- def last_action
109
- actions.where("id IS NOT NULL").last
110
- end
111
-
112
- def last_content_action
113
- last_change_on(:db_content)&.action
114
- end
115
-
116
- def last_content_action_id
117
- last_change_on(:db_content)&.card_action_id
118
- end
119
-
120
- def last_actor
121
- last_act.actor
122
- end
123
-
124
- def last_act
125
- @last_act ||=
126
- if (action = last_action)
127
- last_act_on_self = acts.last
128
- act_of_last_action = action.act
129
- return act_of_last_action unless last_act_on_self
130
- return last_act_on_self unless act_of_last_action
131
-
132
- return last_act_on_self if act_of_last_action == last_act_on_self
133
- if last_act_on_self.acted_at > act_of_last_action.acted_at
134
- last_act_on_self
135
- else
136
- act_of_last_action
137
- end
138
- end
139
- end
140
-
141
- def acted_at
142
- last_act.acted_at
143
- end
144
-
145
- def previous_action action_id
146
- return unless action_id
147
- action_index = actions.find_index { |a| a.id == action_id }
148
- all_actions[action_index - 1] if action_index.to_i.nonzero?
149
- end
150
-
151
- def revised_at
152
- (last_action && (act = last_action.act) && act.acted_at) || Time.zone.now
153
- end
154
-
155
- def creator
156
- Card[creator_id]
157
- end
158
-
159
- def updater
160
- Card[updater_id]
161
- end
162
-
163
- def clean_html?
164
- true
165
- end
166
-
167
- def draft_acts
168
- drafts.created_by(Card::Auth.current_id).map(&:act)
169
- end
170
-
171
- event :detect_conflict, :validate, on: :update, when: :edit_conflict? do
172
- errors.add :conflict, tr(:error_not_latest_revision)
173
- end
174
-
175
- def edit_conflict?
176
- last_action_id_before_edit &&
177
- last_action_id_before_edit.to_i != last_action_id &&
178
- (la = last_action) &&
179
- la.act.actor_id != Auth.current_id
180
- end
@@ -1,16 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- describe Card::Set::All::ActView do
4
- specify "view act" do
5
- expect_view(:act).to have_tag("div.card") do
6
- with_tag "div.card-header"
7
- with_tag "div.card-body"
8
- end
9
- end
10
-
11
- specify "view act_legend" do
12
- expect_view(:act_legend).to have_tag("div.row") do
13
- with_tag "div"
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- describe Card::Set::All::ActionView do
4
- # SPECSTUB
5
- specify "view action_summary" do
6
- expect_view(:action_summary).to have_tag("div.card-slot") do
7
- with_tag "ins"
8
- end
9
- end
10
- end
@@ -1,11 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- describe Card::Set::All::History do
4
- # SPECSTUB
5
- specify "view history" do
6
- expect_view(:history).to have_tag("div.card-slot.history-view") do
7
- with_tag "div.card-body"
8
- with_tag "div.card-header"
9
- end
10
- end
11
- end