card 1.15.2 → 1.15.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/20150528084659_add_session_cardtype.rb +15 -0
  4. data/db/seed/new/card_actions.yml +342 -314
  5. data/db/seed/new/card_acts.yml +1 -1
  6. data/db/seed/new/card_changes.yml +1284 -1199
  7. data/db/seed/new/card_references.yml +664 -622
  8. data/db/seed/new/cards.yml +1355 -1278
  9. data/db/seed/test/fixtures/card_actions.yml +1239 -1204
  10. data/db/seed/test/fixtures/card_acts.yml +281 -275
  11. data/db/seed/test/fixtures/card_changes.yml +4127 -4022
  12. data/db/seed/test/fixtures/card_references.yml +1338 -1296
  13. data/db/seed/test/fixtures/cards.yml +2635 -2540
  14. data/db/version_core_cards.txt +1 -1
  15. data/lib/card/core_ext.rb +11 -7
  16. data/lib/card/format.rb +1 -1
  17. data/lib/card/name.rb +1 -1
  18. data/lib/card/set.rb +47 -47
  19. data/lib/card/simplecov_helper.rb +2 -2
  20. data/lib/card/spec_helper.rb +17 -7
  21. data/lib/card/view_name.rb +44 -0
  22. data/mod/01_core/chunk/include.rb +1 -1
  23. data/mod/01_core/set/all/collection.rb +90 -7
  24. data/mod/01_core/spec/set/all/collection_spec.rb +37 -3
  25. data/mod/01_history/lib/card/act.rb +15 -11
  26. data/mod/01_history/lib/card/action.rb +38 -38
  27. data/mod/01_history/set/all/history.rb +8 -4
  28. data/mod/02_basic_types/set/type/pointer.rb +29 -28
  29. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +39 -0
  30. data/mod/03_machines/lib/stylesheets/style_cards.scss +6 -1
  31. data/mod/05_email/set/all/notify.rb +47 -49
  32. data/mod/05_email/set/self/follow_defaults.rb +7 -7
  33. data/mod/05_email/set/type_plus_right/user/follow.rb +1 -1
  34. data/mod/05_standard/set/all/error.rb +1 -1
  35. data/mod/05_standard/set/all/links.rb +1 -1
  36. data/mod/05_standard/set/all/rich_html/content.rb +23 -21
  37. data/mod/05_standard/set/all/rich_html/editing.rb +64 -8
  38. data/mod/05_standard/set/all/rich_html/form.rb +26 -26
  39. data/mod/05_standard/set/all/rich_html/header.rb +2 -2
  40. data/mod/05_standard/set/all/rich_html/menu.rb +9 -10
  41. data/mod/05_standard/set/all/rich_html/toolbar.rb +100 -71
  42. data/mod/05_standard/set/all/rich_html/wrapper.rb +6 -0
  43. data/mod/05_standard/set/right/discussion.rb +3 -0
  44. data/mod/05_standard/set/rstar/rules.rb +5 -24
  45. data/mod/05_standard/set/type/cardtype.rb +31 -2
  46. data/mod/05_standard/set/type/session.rb +29 -0
  47. data/mod/05_standard/set/type/set.rb +1 -1
  48. data/mod/05_standard/spec/set/all/rich_html/editing_spec.rb +60 -0
  49. data/mod/05_standard/spec/set/all/rich_html/form_spec.rb +6 -6
  50. data/mod/05_standard/spec/set/type/cardtype_spec.rb +15 -1
  51. data/mod/06_bootstrap/lib/javascript/bootstrap_modal_wagn.js +27 -0
  52. data/mod/06_bootstrap/set/all/rich_bootstrap.rb +4 -3
  53. data/mod/06_bootstrap/set/self/bootstrap_js.rb +3 -1
  54. metadata +8 -2
@@ -1,6 +1,6 @@
1
1
  event :update_follow_rules, :after=>:store, :on=>:save, :when=> proc { |c| c.update_all_users } do
2
2
  defaults = item_names.map do |item|
3
- if ((set_card = Card.fetch item.to_name.left) && set_card.type_code == :set)
3
+ if ((set_card = Card.fetch item.to_name.left) && set_card.type_code == :set)
4
4
  option_card = Card.fetch(item.to_name.right) || Card[item.to_name.right.to_sym]
5
5
  option = if option_card.follow_option?
6
6
  option_card.name
@@ -8,7 +8,7 @@ event :update_follow_rules, :after=>:store, :on=>:save, :when=> proc { |c| c.upd
8
8
  '*always'
9
9
  end
10
10
  [set_card, option]
11
- elsif ((set_card = Card.fetch sug) && set_card.type_code == :set)
11
+ elsif ((set_card = Card.fetch sug) && set_card.type_code == :set)
12
12
  [set_card, '*always']
13
13
  end
14
14
  end.compact
@@ -31,14 +31,14 @@ format :html do
31
31
  view :edit, :perms=>:update, :tags=>:unknown_ok do |args|
32
32
  frame_and_form :update, args do
33
33
  [
34
- _optional_render( :content_formgroups, args ),
34
+ _optional_render( :content_formgroup, args ),
35
35
  _optional_render( :confirm_update_all, args ),
36
36
  _optional_render( :button_formgroup, args )
37
37
  ]
38
38
  end
39
39
  end
40
-
41
-
40
+
41
+
42
42
  view :confirm_update_all do |args|
43
43
  wrap args do
44
44
  alert 'info' do
@@ -49,7 +49,7 @@ format :html do
49
49
  end
50
50
  end
51
51
  end
52
-
52
+
53
53
  def default_edit_args args
54
54
  args[:hidden] ||= {}
55
55
  args[:hidden].reverse_merge!(
@@ -61,6 +61,6 @@ format :html do
61
61
  #{ button_tag 'Submit', :class=>'follow' }
62
62
  #{ button_tag 'Cancel', :class=>'slotter', :type=>'button', :href=>path(:view=>:edit, :id=>card.id)}
63
63
  }
64
-
64
+
65
65
  end
66
66
  end
@@ -163,7 +163,7 @@ format :html do
163
163
  save_interrupted_action(request.env['REQUEST_URI'])
164
164
  title = "Problems with #{card.name}"
165
165
  frame args.merge(:panel_class=>"panel panel-warning", :title=>title, :hide=>'menu' ) do
166
- "You have to #{ link_to 'sign in', card_url(':signin') }" #" #{to_task}"
166
+ "Please #{ link_to 'sign in', card_url(':signin') }" #" #{to_task}"
167
167
  end
168
168
  else
169
169
  super(args)
@@ -186,7 +186,7 @@ format :html do
186
186
  "or #{ link_to 'sign up', card_url('new/:signup') }"
187
187
  end
188
188
  save_interrupted_action(request.env['REQUEST_URI'])
189
- "You have to #{ link_to 'sign in', card_url(':signin') } #{or_signup} #{to_task}"
189
+ "Please #{ link_to 'sign in', card_url(':signin') } #{or_signup} #{to_task}"
190
190
  end
191
191
 
192
192
  %{<h1>Sorry!</h1>\n<div>#{ message }</div>}
@@ -32,12 +32,12 @@ format do
32
32
 
33
33
  # link to a specific card
34
34
  def card_link name_or_card, opts={}
35
- text = (opts.delete(:text) || name_or_card).to_name.to_show @context_names
36
35
  name = case name_or_card
37
36
  when Symbol then Card.fetch( name_or_card, :skip_modules=>true ).cardname
38
37
  when Card then name_or_card.cardname
39
38
  else name_or_card
40
39
  end
40
+ text = (opts.delete(:text) || name).to_name.to_show @context_names
41
41
 
42
42
  path_opts = opts.delete( :path_opts ) || {}
43
43
  path_opts[:name ] = name
@@ -1,3 +1,6 @@
1
+ def show_comment_box_in_related?
2
+ false
3
+ end
1
4
 
2
5
  format :html do
3
6
 
@@ -40,6 +43,7 @@ format :html do
40
43
  view :titled, :tags=>:comment do |args|
41
44
  wrap args do
42
45
  [
46
+ _optional_render( :menu, args ),
43
47
  _render_header( args ),
44
48
  wrap_body( :content=>true ) { _render_core args },
45
49
  optional_render( :comment_box, args )
@@ -61,9 +65,10 @@ format :html do
61
65
 
62
66
  view :title do |args|
63
67
  title = fancy_title args[:title], args[:title_class]
64
- title = _optional_render( :title_toolbar, args, (show_view?(:toolbar,args.merge(:default_visibility=>:hide)) ? :show : :hide)) ||
68
+ title = _optional_render( :title_toolbar, args, (show_view?(:toolbar,args.merge(:default_visibility=>:hide)) || toolbar_pinned? ? :show : :hide)) ||
65
69
  _optional_render( :title_link, args.merge( :title_ready=>title ), :hide ) ||
66
70
  title
71
+ #title += " (#{card.type_name})" if Card[:show_cardtype].content == 'true'
67
72
  add_name_context
68
73
  title
69
74
  end
@@ -111,7 +116,7 @@ format :html do
111
116
  end
112
117
 
113
118
  view :closed do |args|
114
- frame args.reverse_merge(:content=>true, :body_class=>'closed-content', :toggle_mode=>:close, :optional_toggle=>:show ) do
119
+ frame args.reverse_merge(:content=>true, :body_class=>'closed-content', :toggle_mode=>:close, :optional_toggle=>:show, :optional_edit_toolbar=>:hide ) do
115
120
  _optional_render :closed_content, args
116
121
  end
117
122
  end
@@ -128,12 +133,6 @@ format :html do
128
133
  end
129
134
  end
130
135
 
131
- view :options, :tags=>:unknown_ok do |args|
132
- frame args do
133
- subformat( current_set_card ).render_content args
134
- end
135
- end
136
-
137
136
  def current_set_card
138
137
  set_name = params[:current_set]
139
138
  set_name ||= "#{card.name}+*type" if card.known? && card.type_id==Card::CardtypeID
@@ -143,20 +142,21 @@ format :html do
143
142
 
144
143
 
145
144
  view :related do |args|
146
- if rparams = params[:related]
147
- rcardname = rparams[:name].to_name.to_absolute_name( card.cardname)
148
- rcard = Card.fetch rcardname, :new=>{}
149
-
150
- nest_args = {
151
- :view => ( rparams[:view] || :open ),
145
+ if rparams = args[:related] || params[:related]
146
+ rcard = rparams[:card] || begin
147
+ rcardname = rparams[:name].to_name.to_absolute_name( card.cardname)
148
+ Card.fetch rcardname, :new=>{}
149
+ end
150
+
151
+ nest_args = ( rparams[:slot] || {} ).deep_symbolize_keys.reverse_merge(
152
+ :view => ( rparams[:view] || :open ),
152
153
  :optional_toggle => :hide,
153
- :optional_help => :show,
154
- :optional_menu => :show,
155
- :parent => card
156
- }
157
- nest_args.merge! ( rparams[:slot] || {} ).deep_symbolize_keys
158
-
159
- nest_args[:optional_comment_box] = :show if rparams[:name] == '+discussion' #fixme. yuck!
154
+ :optional_help => :show,
155
+ :optional_menu => :show,
156
+ :optional_close_related_link => :show,
157
+ :parent => card
158
+ )
159
+ nest_args[:optional_comment_box] = :show if rcard.show_comment_box_in_related?
160
160
 
161
161
  frame args do
162
162
  nest rcard, nest_args
@@ -164,6 +164,8 @@ format :html do
164
164
  end
165
165
  end
166
166
 
167
+
168
+
167
169
  view :help, :tags=>:unknown_ok do |args|
168
170
  text = if args[:help_text]
169
171
  args[:help_text]
@@ -6,7 +6,7 @@ format :html do
6
6
  [
7
7
  _optional_render( :name_formgroup, args ),
8
8
  _optional_render( :type_formgroup, args ),
9
- _optional_render( :content_formgroups, args ),
9
+ _optional_render( :content_formgroup, args ),
10
10
  _optional_render( :button_formgroup, args )
11
11
  ]
12
12
  end
@@ -66,7 +66,7 @@ format :html do
66
66
  view :edit, :perms=>:update, :tags=>:unknown_ok do |args|
67
67
  frame_and_form :update, args do
68
68
  [
69
- _optional_render( :content_formgroups, args ),
69
+ _optional_render( :content_formgroup, args ),
70
70
  _optional_render( :button_formgroup, args )
71
71
  ]
72
72
  end
@@ -75,10 +75,13 @@ format :html do
75
75
 
76
76
  def default_edit_args args
77
77
  args[:optional_help] ||= :show
78
+ args[:optional_edit_toolbar] ||= :show
79
+ args[:active_toolbar_view] ||= :edit
78
80
 
79
81
  args[:buttons] ||= %{
80
82
  #{ button_tag 'Submit', :class=>'submit-button', :disable_with=>'Submitting', :situation=>'primary' }
81
- #{ button_tag 'Cancel', :class=>'cancel-button slotter', :href=>path, :type=>'button' }
83
+ #{ button_tag 'Cancel', :class=>'cancel-button slotter', 'data-slot-selector'=>args[:cancel_slot_selector],
84
+ :href=>(args[:cancel_path] || path), :type=>'button' }
82
85
  }
83
86
  end
84
87
 
@@ -102,8 +105,8 @@ format :html do
102
105
  <h5>Are you sure you want to rename <em>#{card.name}</em>?</h5>
103
106
  #{ %{ <h6>This change will...</h6> } if referers.any? || dependents.any? }
104
107
  <ul>
105
- #{ %{<li>automatically alter #{ dependents.size } related name(s). } if dependents.any? }
106
- #{ %{<li>affect at least #{referers.size} reference(s) to "#{card.name}".} if referers.any? }
108
+ #{ %{<li>automatically alter #{ dependents.size } related name(s). </li>} if dependents.any? }
109
+ #{ %{<li>affect at least #{referers.size} reference(s) to "#{card.name}".</li>} if referers.any? }
107
110
  </ul>
108
111
  #{ %{<p>You may choose to <em>update or ignore</em> the references.</p>} if referers.any? }
109
112
  }
@@ -120,10 +123,12 @@ format :html do
120
123
  :referers => referers.size,
121
124
  :card => { :update_referencers => false }
122
125
  )
126
+ args[:optional_edit_toolbar] ||= :show
127
+ args[:active_toolbar_view] ||= :edit_name
123
128
  args[:buttons] = %{
124
129
  #{ button_tag 'Rename and Update', :disable_with=>'Renaming', :class=>'renamer-updater', :situation=>'primary' }
125
130
  #{ button_tag 'Rename', :disable_with=>'Renaming', :class=>'renamer' }
126
- #{ button_tag 'Cancel', :class=>'slotter', :type=>'button', :href=>path(:view=>:edit, :id=>card.id)}
131
+ #{ button_tag 'Cancel', :class=>'slotter', :type=>'button', :href=>path }
127
132
  }
128
133
 
129
134
  end
@@ -141,10 +146,61 @@ format :html do
141
146
 
142
147
  def default_edit_type_args args
143
148
  args[:variety] = :edit #YUCK!
144
- args[:hidden] ||= { :view=>:edit }
149
+ args[:optional_edit_toolbar] ||= :show
150
+ args[:active_toolbar_view] ||= :edit_type
151
+ args[:hidden] ||= { :success=>{:view=>:edit} }
145
152
  args[:buttons] = %{
146
153
  #{ button_tag 'Submit', :disable_with=>'Submitting', :situation=>'primary' }
147
154
  #{ button_tag 'Cancel', :href=>path(:view=>:edit), :type=>'button', :class=>'slotter' }
148
155
  }
149
156
  end
150
- end
157
+
158
+ view :edit_rules, :tags=>:unknown_ok do |args|
159
+ frame args do
160
+ subformat( current_set_card ).render_content args
161
+ end
162
+ end
163
+
164
+ def default_edit_rules_args args
165
+ args[:optional_edit_toolbar] ||= :show
166
+ args[:active_toolbar_view] ||= :edit_rules
167
+ end
168
+
169
+ view :options, {:view=>:edit_rules, :mod=>All::RichHtml::Editing::HtmlFormat} # for backwards compatibility
170
+
171
+
172
+ view :edit_structure do |args|
173
+ slot_args = {:cancel_slot_selector=>'.card-slot.related-view', :cancel_path=>card.format.path(:view=>:edit), :optional_edit_toolbar=>:hide, :hidden=>{:success=>"REDIRECT: #{card.structure.key}"}}
174
+ render_related args.merge(:related=>{:card=>card.structure, :view=>:edit, :slot=>slot_args})
175
+ # frame args do
176
+ # nest card.structure, slot_args.merge(:view=>:edit)
177
+ # end
178
+ end
179
+
180
+ def default_edit_structure_args args
181
+ args[:optional_edit_toolbar] ||= :show
182
+ args[:active_toolbar_view] ||= :edit_structure
183
+ end
184
+
185
+ view :edit_nests do |args|
186
+ #nests = card.fetch(:trait=>:includes)
187
+ includes = Card::Content.new(card.content, card).find_chunks( Card::Chunk::Include )
188
+
189
+ frame args do
190
+ includes.map do |chunk|
191
+ if chunk.referee_card
192
+ nest chunk.referee_card, :view=>:edit_rules, :hide=>'set_label'
193
+ end
194
+ end
195
+ #nest nests, :view=>:content, :items=>{:view=>:edit_rules, :hide=>'set_label'}
196
+ end
197
+ end
198
+
199
+ def default_edit_nests_args args
200
+ args[:optional_edit_toolbar] ||= :show
201
+ args[:active_toolbar_view] ||= :edit_nests
202
+ end
203
+ end
204
+
205
+
206
+
@@ -1,9 +1,9 @@
1
- format :html do
1
+ format :html do
2
2
  def edit_slot args={}
3
3
  #note: @mode should already be :edit here...
4
4
  if args[:structure] || card.structure
5
5
  # multi-card editing
6
-
6
+
7
7
  if args[:core_edit] #need better name!
8
8
  _render_core args
9
9
  else
@@ -13,7 +13,7 @@ format :html do
13
13
  else
14
14
  # single-card edit mode
15
15
  field = content_field form, args
16
-
16
+
17
17
  if [ args[:optional_type_formgroup], args[:optional_name_formgroup] ].member? :show
18
18
  # display content field in formgroup for consistency with other fields
19
19
  formgroup '', field, :editor=>:content
@@ -22,13 +22,13 @@ format :html do
22
22
  end
23
23
  end
24
24
  end
25
-
26
-
25
+
26
+
27
27
  def form_for_multi
28
28
  block = Proc.new {}
29
29
  builder = ActionView::Base.default_form_builder
30
30
  card.name = card.name.gsub(/^#{Regexp.escape(root.card.name)}\+/, '+') if root.card.new_card? ##FIXME -- need to match other relative inclusions.
31
-
31
+
32
32
  builder.new("card[subcards][#{card.relative_name}]", card, template, {}, block)
33
33
  end
34
34
 
@@ -54,40 +54,40 @@ format :html do
54
54
  when String ; [ card_path(action) , nil ] #deprecated
55
55
  else ; raise Card::Error, "unsupported card_form action class: #{action.class}"
56
56
  end
57
-
57
+
58
58
  klasses = Array.wrap( html[:class] )
59
59
  klasses << 'card-form slotter'
60
60
  klasses << 'autosave' if action == :update
61
61
  html[:class] = klasses.join ' '
62
-
62
+
63
63
  html[:recaptcha] ||= 'on' if card.recaptcha_on?
64
64
  html.delete :recaptcha if html[:recaptcha] == :off
65
-
65
+
66
66
  { :url=>url, :remote=>true, :html=>html }
67
67
  end
68
68
 
69
69
  def editor_wrap type=nil
70
- content_tag( :div, :class=>"editor#{ " #{type}-editor" if type }" ) { yield }
70
+ content_tag( :div, :class=>"editor#{ " #{type}-editor" if type }" ) { yield.html_safe }
71
71
  end
72
72
 
73
73
  def formgroup title, content, opts={}
74
- help_text =
74
+ help_text =
75
75
  case opts[:help]
76
76
  when String ; _render_help :help_class=>'help-block', :help_text=> opts[:help]
77
77
  when true ; _render_help :help_class=>'help-block'
78
78
  else ; nil
79
79
  end
80
-
80
+
81
81
  div_args = { :class=>['form-group', opts[:class]].compact*' ' }
82
82
  div_args[:card_id ] = card.id if card.real?
83
- div_args[:card_name] = h card.name if card.name.present?
84
-
83
+ div_args[:card_name] = h card.name if card.name.present?
84
+
85
85
  wrap_with :div, div_args do
86
86
  %{
87
87
  <label>#{ title }</label>
88
88
  <div>
89
89
  #{ editor_wrap( opts[:editor] ) { content } }
90
- #{ help_text }
90
+ #{ help_text }
91
91
  </div>
92
92
  }
93
93
  end
@@ -107,8 +107,8 @@ format :html do
107
107
  end
108
108
  result
109
109
  end
110
-
111
-
110
+
111
+
112
112
  # FIELDSET VIEWS
113
113
 
114
114
  view :name_formgroup do |args|
@@ -129,7 +129,7 @@ format :html do
129
129
  %{<div class="form-group"><div>#{ args[:buttons] }</div></div>}
130
130
  end
131
131
 
132
- view :content_formgroups do |args|
132
+ view :content_formgroup do |args|
133
133
  raw %{
134
134
  <fieldset class="card-editor editor">
135
135
  #{ edit_slot args }
@@ -169,7 +169,7 @@ format :html do
169
169
  #hidden_field_tag 'card[last_action_id_before_edit]', card.last_action_id, :class=>'current_revision_id'
170
170
  end
171
171
  %{
172
- #{ revision_tracking
172
+ #{ revision_tracking
173
173
  }
174
174
  #{ _render_editor options }
175
175
  }
@@ -184,13 +184,13 @@ format :html do
184
184
 
185
185
  view :edit_in_form, :perms=>:update, :tags=>:unknown_ok do |args|
186
186
  eform = form_for_multi
187
-
187
+
188
188
  content = content_field eform, args.merge( :nested=>true )
189
189
  opts = { :editor=>'content', :help=>true, :class=>'card-editor' }
190
-
190
+
191
191
  content += raw( "\n #{ eform.hidden_field :type_id }" ) if card.new_card?
192
192
  opts[:class] += " RIGHT-#{ card.cardname.tag_name.safe_key }" if card.cardname.junction?
193
-
193
+
194
194
  formgroup fancy_title( args[:title] ), content, opts
195
195
  end
196
196
 
@@ -201,7 +201,7 @@ format :html do
201
201
  end
202
202
 
203
203
  # form helpers
204
-
204
+
205
205
  FIELD_HELPERS = %w{hidden_field color_field date_field datetime_field datetime_local_field
206
206
  email_field month_field number_field password_field phone_field
207
207
  range_field search_field telephone_field text_area text_field time_field
@@ -213,13 +213,13 @@ format :html do
213
213
  form.send(method_name, name, options)
214
214
  end
215
215
  end
216
-
216
+
217
217
  def check_box method, options={}, checked_value = "1", unchecked_value = "0"
218
218
  form.check_box method, options, checked_value, unchecked_value
219
219
  end
220
-
220
+
221
221
  def radio_button method, tag_value, options = {}
222
222
  form.radio_button method, tag_value, options
223
223
  end
224
-
224
+
225
225
  end