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
@@ -8,8 +8,8 @@ format :html do
8
8
  #{ _optional_render :title, args }
9
9
  </div>
10
10
  </div>
11
- #{ _optional_render :toolbar, args, :hide}
12
- #{ _optional_render :edit_toolbar, args, :hide}
11
+ #{ _optional_render :toolbar, args, (toolbar_pinned? ? :show : :hide) }
12
+ #{ _optional_render :edit_toolbar, args, (edit_toolbar_pinned? ? :show : :hide)}
13
13
  #{ _optional_render :account_toolbar, args, :hide}
14
14
  }
15
15
  end
@@ -2,7 +2,7 @@ format :html do
2
2
  view :menu, :denial=>:blank, :tags=>:unknown_ok do |args|
3
3
  return _render_template_closer if args[:menu_hack] == :template_closer
4
4
  return '' if card.unknown?
5
- wrap_with :div, :class=>'menu-slot' do
5
+ wrap_with :div, :class=>'menu-slot nodblclick' do
6
6
  [
7
7
  _optional_render(:horizontal_menu, args, :hide),
8
8
  _render_menu_link(args),
@@ -19,10 +19,10 @@ format :html do
19
19
  else
20
20
  'show-on-hover'
21
21
  end
22
- content_tag :div, :class=>"vertical-card-menu card-menu #{css_class}" do
23
- content_tag :div, :class=>'btn-group slotter card-slot pull-right' do
24
- view_link(glyphicon(args[:menu_icon]), :vertical_menu, :path_opts=>path_opts).html_safe
25
- end
22
+ wrap_with :div, :class=>"vertical-card-menu card-menu #{css_class}" do
23
+ content_tag :div, :class=>'btn-group slotter card-slot pull-right' do
24
+ view_link(glyphicon(args[:menu_icon]), :vertical_menu, :path_opts=>path_opts).html_safe
25
+ end
26
26
  end
27
27
  end
28
28
 
@@ -57,15 +57,14 @@ format :html do
57
57
 
58
58
  def menu_edit_link args
59
59
  opts = {
60
- :view=>:related,
61
- :path_opts=>{ :related=>{:name=>card.name, :view=>:edit, :slot=>{:hide=>'header'}},
62
- :slot=>{:show=>'edit_toolbar', :hide=>'type_link'}}
60
+ :view=>:edit,
61
+ :path_opts=>{ :slot=>{:show=>'edit_toolbar', :hide=>'type_link'}}
63
62
  }
64
63
  menu_item('edit', 'edit', opts, args[:html_args] )
65
64
  end
66
65
 
67
66
  def menu_discuss_link args
68
- menu_item('discuss', 'comment', { :related=>Card[:discussion].name }, args[:html_args])
67
+ menu_item('discuss', 'comment', { :related=>Card[:discussion].key }, args[:html_args])
69
68
  end
70
69
 
71
70
  def menu_page_link args
@@ -77,7 +76,7 @@ format :html do
77
76
  end
78
77
 
79
78
  def menu_account_link args
80
- opts = { :related=>{:name=>'+*account',:view=>:edit},
79
+ opts = { :related=>{:name=>'+*account',:view=>:edit,:slot=>{:hide=>'edit_toolbar'}},
81
80
  :path_opts=>{:slot=>{:show=>:account_toolbar}} }
82
81
  menu_item('account', 'user',opts, args[:html_args])
83
82
  end
@@ -1,4 +1,13 @@
1
+
1
2
  format :html do
3
+ def edit_toolbar_pinned?
4
+ Card[:edit_toolbar_pinned].content == 'true'
5
+ end
6
+
7
+ def toolbar_pinned?
8
+ Card[:toolbar_pinned].content == 'true'
9
+ end
10
+
2
11
  view :toolbar do |args|
3
12
  navbar "toolbar-#{card.cardname.safe_key}-#{args[:home_view]}", :toggle_align=>:left, :class=>"slotter toolbar", :navbar_type=>'inverse',
4
13
  :collapsed_content=>close_link('pull-right visible-xs') do
@@ -21,14 +30,19 @@ format :html do
21
30
 
22
31
  def close_link css_class
23
32
  wrap_with :ul, :class=>"nav navbar-nav #{css_class}" do
24
- wrap_with :li do
25
- view_link(glyphicon('remove'), :open)
26
- end
33
+ [
34
+ toolbar_pin_link,
35
+ "<li>#{view_link(glyphicon('remove'), :home, :title=>'cancel')}</li>"
36
+ ]
27
37
  end
28
38
  end
29
39
 
30
40
  view :edit_toolbar do |args|
31
41
  id = "edit-toolbar-#{card.cardname.safe_key}-#{args[:home_view]}"
42
+ navbar_right = ''
43
+ navbar_right += edit_toolbar_autosave_link if card.drafts.present?
44
+ navbar_right += edit_toolbar_pin_link
45
+ navbar_right += edit_toolbar_close_link
32
46
 
33
47
  navbar id, :toggle=>'Edit<span class="caret"></span>', :toggle_align=>:left,
34
48
  :class=>'slotter toolbar', :navbar_type=>'inverse', :collapsed_content=>close_link('pull-right visible-xs') do
@@ -43,14 +57,7 @@ format :html do
43
57
  _optional_render(:edit_nests_button, args, :show),
44
58
  ]
45
59
  end),
46
- (wrap_with :ul, :class=>'nav navbar-nav navbar-right' do
47
- wrap_each_with :li do
48
- [
49
- (view_link('autosaved draft', :edit, :path_opts=>{:edit_draft=>true, :slot=>{:show=>:edit_toolbar}}, :class=>'navbar-link slotter') if card.drafts.present?),
50
- view_link(glyphicon('remove', 'hidden-xs'), :open)
51
- ]
52
- end
53
- end)
60
+ content_tag( :ul, navbar_right.html_safe, :class=>'nav navbar-nav navbar-right' )
54
61
  ]
55
62
  end
56
63
  end
@@ -58,12 +65,13 @@ format :html do
58
65
  view :account_toolbar do |args|
59
66
  if card.accountable?
60
67
  links = []
61
- links << account_pill( 'account', true, :view=>:edit)
68
+ links << account_pill( 'account', true, :view=>:edit, :slot=>{:hide=>'edit_toolbar'})
62
69
  links << account_pill( 'roles')
63
70
  links << account_pill( 'created')
64
71
  links << account_pill( 'edited')
65
72
  links << account_pill( 'follow')
66
- navbar 'account-toolbar',:toggle_align=>:left, :collapsed_content=>close_link('pull-right visible-xs'), :navbar_type=>'inverse', :class=>"slotter toolbar", 'data-slot-selector'=>'.card-body > .card-slot' do
73
+ navbar 'account-toolbar',:toggle_align=>:left, :collapsed_content=>close_link('pull-right visible-xs'), :navbar_type=>'inverse',
74
+ :class=>"slotter toolbar", :nav_opts=>{'data-slot-selector'=>'.card-slot.related-view > .card-frame > .card-body > .card-slot'} do
67
75
  [
68
76
  content_tag(:ul, links.join("\n").html_safe, :class=>'nav navbar-nav nav-pills'),
69
77
  content_tag(:ul, "<li>#{view_link(glyphicon('remove','hidden-xs'), :open)}</li>".html_safe, :class=>'nav navbar-nav navbar-right'),
@@ -77,7 +85,7 @@ format :html do
77
85
  [
78
86
  _optional_render(:history_button, args, :show),
79
87
  _optional_render(:delete_button, args, (card.ok?(:delete) ? :show : :hide)),
80
- _optional_render(:refresh_button, args)
88
+ _optional_render(:refresh_button, args, :hide)
81
89
  ]
82
90
  end
83
91
  end
@@ -106,12 +114,12 @@ format :html do
106
114
  toolbar_button('rules', 'wrench', 'hidden-xs hidden-sm', :view=>'options')
107
115
  end
108
116
  view :related_button do |args|
109
- btn_dropdown(glyphicon('tree-deciduous')+' related', [
110
- menu_item('children', 'baby-formula', :related=>'*children'),
111
- menu_item('mates', 'bed', :related=>'*mates'),
112
-
113
- menu_item('references out', 'log-out', :related=>'*refers_to'),
114
- menu_item('references in', 'log-in', :related=>'*referred_to_by')
117
+ path_opts = {:slot=>{:show=>:toolbar}}
118
+ btn_dropdown('related', 'tree-deciduous', [
119
+ menu_item('children', 'baby-formula', {:related=>'*children', :path_opts=>path_opts}),
120
+ menu_item('mates', 'bed', {:related=>'*mates', :path_opts=>path_opts}),
121
+ menu_item('references out', 'log-out', {:related=>'*refers_to', :path_opts=>path_opts}),
122
+ menu_item('references in', 'log-in', {:related=>'*referred_to_by', :path_opts=>path_opts})
115
123
 
116
124
  ], :class=>'related')
117
125
  end
@@ -131,29 +139,28 @@ format :html do
131
139
  toolbar_button('refresh', 'refresh', 'hidden-xs hidden-sm hidden-md hidden-lg', :view=>args[:home_view] || :open)
132
140
  end
133
141
 
134
-
135
142
  view :edit_content_button do |args|
136
- pill_view_link( 'content', 'edit', true)
143
+ pill_view_link 'content', :edit, args
137
144
  end
138
145
  view :edit_name_button do |args|
139
- pill_view_link( 'name','edit_name')
146
+ pill_view_link 'name',:edit_name, args
140
147
  end
141
148
  view :edit_type_button do |args|
142
- pill_view_link( 'type', 'edit_type')
149
+ pill_view_link 'type', :edit_type, args
143
150
  end
144
151
  view :edit_rules_button do |args|
145
152
  if structure_editable?
146
- rule_items = []
147
- rule_items << pill_card_link('structure', card.structure, false, :view=>:edit, :slot=>{:hide=>:toggle})
148
- rule_items << pill_view_link('...', 'options')
149
- pill_dropdown('rules', rule_items)
153
+ active = [:edit_rules, :edit_structure].include? args.delete(:active_toolbar_view)
154
+ rule_items = pill_view_link 'structure', :edit_structure, args
155
+ rule_items += pill_view_link '...', :edit_rules, args
156
+ pill_dropdown 'rules', rule_items, active
150
157
  else
151
- pill_view_link('rules', 'options')
158
+ pill_view_link 'rules', :edit_rules, args
152
159
  end
153
160
  end
154
161
  view :edit_nests_button do |args|
155
162
  if (nests = card.fetch(:trait=>:includes)) && nests.item_names.present?
156
- pill_card_link('nests', nests, false, :slot=>{:hide=>'header', :items=>{:view=>:options, :hide=>'set_label'}})
163
+ pill_view_link 'nests', :edit_nests, args
157
164
  end
158
165
  end
159
166
 
@@ -162,38 +169,33 @@ format :html do
162
169
  view_link(glyphicon('edit'),'edit_type', :class=>'navbar-link slotter', 'data-toggle'=>'tooltip', :title=>'edit type')
163
170
  end
164
171
 
165
- def toolbar_button text, symbol, hide, target
166
- btn_class = 'btn btn-default'
172
+ def toolbar_button text, symbol, hide, tag_args
173
+ tag_args[:class] = [ tag_args[:class], 'btn btn-default' ].compact * ' '
174
+ tag_args[:title] ||= text
167
175
  link_text = "#{glyphicon symbol}<span class='menu-item-label #{hide}'>#{text}</span>"
168
176
 
169
- if target[:page]
170
- card_link target[:page], :class=>btn_class, :text=>link_text, :path_opts=>{:slot=>{:show=>:toolbar}}
171
- elsif target[:view]
172
- view_link link_text, target[:view], :class=>btn_class, :path_opts=>{:slot=>{:show=>:toolbar}}
177
+ if cardname = tag_args.delete(:page)
178
+ card_link cardname, :class=>klass, :text=>link_text
179
+ elsif viewname = tag_args.delete(:view)
180
+ tag_args[:path_opts] ||= {:slot=>{:show=>:toolbar}}
181
+ view_link link_text, viewname, tag_args
173
182
  else
174
- target[:class] ||= ''
175
- target[:class] += " #{btn_class}"
176
- path_opts = target.delete(:path_opts) || {}
177
- path_opts.merge! :action=>target.delete(:action)
178
- link_to link_text, path_opts, target
183
+ path_opts = tag_args.delete(:path_opts) || {}
184
+ path_opts.merge! :action=>tag_args.delete(:action)
185
+ link_to link_text, path_opts, tag_args
179
186
  end
180
187
  end
181
188
 
182
- def pill_view_link name, view, active=false, path_opts={}
183
- opts = {:class=>'slotter', :role=>'pill', 'data-slot-selector'=>'.card-body > .card-slot',
184
- :path_opts=>path_opts.merge(:slot=>{:hide=>'toggle menu header'})}
185
- li_pill view_link(name, view, opts), active
186
- end
187
-
188
- def pill_card_link name, card, active=false, path_opts={}
189
- opts = {:text=>name, :role=>'pill', :remote=>true, :class=>'slotter', 'data-slot-selector'=>'.card-body > .card-slot',
190
- :path_opts=>path_opts}
191
- li_pill card_link(card, opts), active
189
+ def pill_view_link name, view, args
190
+ active_view = args[:active_toolbar_view] || args[:home_view]
191
+ opts = {:class=>'slotter', :role=>'pill'}
192
+ li_pill view_link(name, view, opts), active_view == view
192
193
  end
193
194
 
194
195
  def account_pill name, active=false, path_opts={}
195
- opts = {:text=>name, :role=>'pill', :remote=>true,
196
- :path_opts=>path_opts.merge(:slot=>{:hide=>:toggle})}
196
+ opts = {:text=>name, :role=>'pill', :remote=>true, :path_opts=>path_opts}
197
+ opts[:path_opts][:slot] ||= {}
198
+ opts[:path_opts][:slot][:hide] = "toggle #{opts[:path_opts][:slot][:hide]}"
197
199
  li_pill card_link("#{card.name}+*#{name}", opts), active
198
200
  end
199
201
 
@@ -201,37 +203,64 @@ format :html do
201
203
  "<li role='presentation' #{"class='active'" if active}>#{content}</li>"
202
204
  end
203
205
 
204
- def pill_dropdown name, items
206
+ def pill_dropdown name, items, active=false
205
207
  %{
206
- <li role="presentation" class="dropdown">
208
+ <li role="presentation" class="dropdown #{'active' if active}">
207
209
  <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-expanded="false">
208
210
  #{name} <span class="caret"></span>
209
211
  </a>
210
- <ul class="dropdown-menu" role="menu">
211
- #{items.map {|item| "<li>#{item}</li>"}.join "\n"}
212
- </ul>
212
+ #{ dropdown_list items }
213
213
  </li>
214
214
  }
215
215
  end
216
216
 
217
-
218
- def btn_dropdown name, items, opts={}
219
- dropdown =
220
- if items.kind_of? Array
221
- items.map {|item| "<li>#{item}</li>"}.join "\n"
222
- else
223
- items
224
- end
217
+ def btn_dropdown name, icon, items, opts={}
225
218
  %{
226
219
  <div class="btn-group" role="group">
227
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
228
- #{name}
220
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" title="#{name}" aria-expanded="false">
221
+ #{glyphicon icon} #{name}
229
222
  <span class="caret"></span>
230
223
  </button>
231
- <ul class="dropdown-menu #{opts[:class] if opts[:class]}" role="menu">
232
- #{dropdown}
233
- </ul>
224
+ #{ dropdown_list items, opts[:class] }
234
225
  </div>
235
226
  }
236
227
  end
228
+
229
+ def dropdown_list items, extra_css_class=nil
230
+ if items.kind_of? Array
231
+ items = items.map {|item| "<li>#{item}</li>"}.join "\n"
232
+ end
233
+ %{
234
+ <ul class="dropdown-menu #{extra_css_class}" role="menu">
235
+ #{items}
236
+ </ul>
237
+ }
238
+ end
239
+
240
+ def toolbar_pin_link
241
+ %{
242
+ <li class='toolbar-pin #{'in' unless toolbar_pinned?}active'>
243
+ <a href='#' title='#{'un' if toolbar_pinned?}pin'>#{glyphicon 'pushpin'}</a>
244
+ </li>
245
+ }
246
+ end
247
+
248
+ def edit_toolbar_pin_link
249
+ %{
250
+ <li class='edit-toolbar-pin #{'in' unless edit_toolbar_pinned?}active'>
251
+ <a href='#' title='#{'un' if edit_toolbar_pinned?}pin'>#{glyphicon 'pushpin'}</a>
252
+ </li>
253
+ }
254
+ end
255
+
256
+ def edit_toolbar_close_link
257
+ link = view_link glyphicon('remove', 'hidden-xs'), :home, :path_opts=>{:slot=>{:hide=>:edit_toolbar}}
258
+ "<li>#{link}</li>"
259
+ end
260
+
261
+ def edit_toolbar_autosave_link
262
+ link = view_link('autosaved draft', :edit, :path_opts=>{:edit_draft=>true, :slot=>{:show=>:edit_toolbar}}, :class=>'navbar-link slotter')
263
+ "<li>#{link}</li>"
264
+ end
265
+
237
266
  end
@@ -16,6 +16,7 @@ format :html do
16
16
  end
17
17
 
18
18
  def wrap args = {}
19
+ @slot_view = @current_view
19
20
  classes = [
20
21
  ( 'card-slot' unless args[:no_slot] ),
21
22
  "#{ @current_view }-view",
@@ -60,6 +61,7 @@ format :html do
60
61
  _optional_render( :header, args, :show),
61
62
  (%{ <div class="card-subheader">#{ args[:subheader] }</div> } if args[:subheader]),
62
63
  _optional_render( :help, args.merge(:help_class=>'alert alert-info'), :hide),
64
+ (_render( :close_related_link, args) if @slot_view == :related),
63
65
  wrap_body(args) { output( yield args ) } ,
64
66
  ]
65
67
  end
@@ -120,4 +122,8 @@ format :html do
120
122
  end.join "\n"
121
123
  end
122
124
 
125
+ view :close_related_link do |args|
126
+ card_link( args[:parent], :text=>glyphicon('remove'), :view=>:home, :remote=>true, :class=>'pull-right slotter close-related-view', :title=>'cancel', 'data-slot-selector'=>'.card-slot.related-view')
127
+ end
128
+
123
129
  end
@@ -0,0 +1,3 @@
1
+ def show_comment_box_in_related?
2
+ true
3
+ end
@@ -156,7 +156,9 @@ format :html do
156
156
  [
157
157
  delete_button,
158
158
  button_tag( 'Submit', :class=>'rule-submit-button', :situation=>'primary' ),
159
- card_link( args[:success][:id], :text=>'Cancel', :class=>'rule-cancel-button btn btn-default', :path_opts=>{:view=>args[:success][:view]} )
159
+ card_link( args[:success][:id], :text=>'Cancel', :class=>'rule-cancel-button btn btn-default',
160
+ :path_opts=>{:view=>args[:success][:view], :success=>'true'}
161
+ )
160
162
  ]
161
163
  end
162
164
  }
@@ -277,13 +279,13 @@ format :html do
277
279
  end
278
280
  %{<span class="rule-delete-section">#{ button_tag 'Delete', b_args }</span>}
279
281
  end
280
- cancel_path = path :view=>( card.new_card? ? :closed_rule : :open_rule )
282
+ cancel_path = path :view=>( card.new_card? ? :closed_rule : :open_rule ), :success=>'true'
281
283
  wrap_with( :div, :class=>'button-area' ) do
282
284
  [
283
285
  delete_button,
284
286
  button_tag( 'Submit', :class=>'rule-submit-button', :situation=>'primary' ),
285
287
  button_tag( 'Cancel', :class=>'rule-cancel-button slotter', :type=>'button',
286
- :href=>cancel_path, :success=>true )
288
+ :href=>cancel_path )
287
289
  ]
288
290
  end
289
291
  end
@@ -411,24 +413,3 @@ end
411
413
 
412
414
 
413
415
 
414
- #
415
-
416
- =begin
417
-
418
- def repair_set
419
- @set_repair_attempted = true
420
- if real?
421
- reset_patterns
422
- template # repair happens in template loading
423
- include_set_modules
424
- end
425
- end
426
-
427
- def method_missing method_id, *args
428
- if !@set_repair_attempted and repair_set
429
- send method_id, *args
430
- else
431
- super
432
- end
433
- end
434
- =end
@@ -11,8 +11,37 @@ format :html do
11
11
  %{<div>Sorry, this card must remain a Cardtype so long as there are <strong>#{ card.name }</strong> cards.</div>}
12
12
  else
13
13
  super args
14
- end
14
+ end
15
15
  end
16
+
17
+ view :add_link do |args|
18
+ args[:title] ||= "Add #{card.name}"
19
+ link_to _render_title(args), _render_add_path(args), :class=>args[:css_class]
20
+ end
21
+
22
+ view :add_button, :view=>:add_link
23
+ def default_add_button_args args
24
+ args[:css_class] = 'btn btn-default'
25
+ end
26
+
27
+ view :add_url do |args|
28
+ card_url _render_add_path(args)
29
+ end
30
+
31
+ view :add_path do |args|
32
+ path_args = {}
33
+ if args[:params]
34
+ context = ((@parent && @parent.card) || card).name
35
+ Rack::Utils.parse_nested_query(args[:params]).each do |key, value|
36
+ value = value.to_name.to_absolute(context) if value
37
+ key = key.to_name.to_absolute(context)
38
+ path_args[key] = value
39
+ end
40
+ end
41
+ path_args[:action] = 'new'
42
+ page_path card.cardname, path_args
43
+ end
44
+
16
45
  end
17
46
 
18
47
 
@@ -28,7 +57,7 @@ def followed_by? user_id = nil
28
57
  end
29
58
 
30
59
  def default_follow_set_card
31
- Card.fetch("#{name}+*type")
60
+ Card.fetch("#{name}+*type")
32
61
  end
33
62
 
34
63