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
@@ -0,0 +1,29 @@
1
+ def history?
2
+ false
3
+ end
4
+
5
+ event :store_in_session, :after=>:approve, :on=>:create do
6
+ Env.session[key] = db_content
7
+ self.db_content = ''
8
+ end
9
+
10
+ event :update_in_session, :after=>:approve, :on=>:update do
11
+ if db_content_changed?
12
+ Env.session[key] = db_content
13
+ self.db_content = ''
14
+ end
15
+ end
16
+
17
+ event :delete_in_session, :after=>:approve, :on=>:delete do
18
+ Env.session[key] = nil
19
+ abort :success
20
+ end
21
+
22
+ def content
23
+ Env.session[key]
24
+ end
25
+
26
+ format :html do
27
+ view :editor, :mod=>PlainText::HtmlFormat
28
+ end
29
+
@@ -22,7 +22,7 @@ format :html do
22
22
  if settings.present?
23
23
  group_name = Card::Setting.group_names[group_key] || group.to_s
24
24
  heading_id = "heading-#{group_key}"
25
- collapse_id = "collpase-#{group_key}"
25
+ collapse_id = "collapse-#{card.cardname.safe_key}-#{group_key}"
26
26
  output [
27
27
  (content_tag :div, :class=>'panel panel-default' do
28
28
  content_tag :div, :class=>'panel-heading', :role=>'tab', :id=>heading_id do
@@ -0,0 +1,60 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ describe Card::Set::All::RichHtml::Editing do
4
+ before do
5
+ @mycard = Card['A'].format
6
+ end
7
+
8
+
9
+ def assert_active_toolbar_pill view, content, related_view=false
10
+ view_selector = related_view ? 'related' : view
11
+ assert_view_select @mycard.render(view), "div[class~='card-slot #{view_selector}-view']" do
12
+ assert_select 'nav[class="slotter toolbar navbar navbar-inverse"]' do
13
+ assert_select 'ul[class="nav navbar-nav nav-pills"]' do
14
+ assert_select 'li[class~="active"] > a', content
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ describe "edit view" do
21
+ it "has toolbar with active 'content' pill" do
22
+ assert_active_toolbar_pill :edit, 'content'
23
+ end
24
+ end
25
+
26
+ describe 'edit_type view' do
27
+ it "has toolbar with active 'type' pill" do
28
+ assert_active_toolbar_pill :edit_type, 'type'
29
+ end
30
+ end
31
+
32
+ describe 'edit_name view' do
33
+ it "has toolbar with active 'name' pill" do
34
+ assert_active_toolbar_pill :edit_name, 'name'
35
+ end
36
+ end
37
+
38
+ describe 'edit_structure view' do
39
+ before do
40
+ @mycard = Card["Iliad"].format
41
+ end
42
+ it "has toolbar with active 'rules' pill" do
43
+ Card::Auth.as_bot do
44
+ assert_active_toolbar_pill :edit_structure, 'rules', true
45
+ end
46
+ end
47
+ end
48
+
49
+ describe 'edit_nests view' do
50
+ before do
51
+ Card::Auth.as_bot do
52
+ Card.create! :name=>'Iliad+author', :content=>'Homer'
53
+ end
54
+ @mycard = Card["Iliad"].format
55
+ end
56
+ it "has toolbar with active 'nests' pill" do
57
+ assert_active_toolbar_pill :edit_nests, 'nests'
58
+ end
59
+ end
60
+ end
@@ -1,21 +1,21 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- describe Card::Set::All::RichHtml::Form do
3
+ describe Card::Set::All::RichHtml::Form do
4
4
  describe "type_list" do
5
5
  before do
6
6
  @card = Card['UserForm'] # no cards with this type
7
7
  end
8
-
8
+
9
9
  it "should get type options from type_field renderer method" do
10
10
  expect(@card.format.type_field).to match(/<option [^>]*selected/)
11
11
  tf=@card.format.type_field(:no_current_type=>true)
12
12
  expect(tf).not_to match(/<option [^>]*selected/)
13
- expect(tf.scan(/<option /).length).to eq(25)
13
+ expect(tf.scan(/<option /).length).to eq(26)
14
14
  tf=@card.format.type_field
15
15
  expect(tf).to match(/<option [^>]*selected/)
16
- expect(tf.scan(/<option /).length).to eq(25)
16
+ expect(tf.scan(/<option /).length).to eq(26)
17
17
  end
18
-
18
+
19
19
  it "should get type list" do
20
20
  Card::Auth.as :anonymous do
21
21
  tf=@card.format.type_field(:no_current_type=>true)
@@ -27,7 +27,7 @@ describe Card::Set::All::RichHtml::Form do
27
27
  end
28
28
  end
29
29
  end
30
-
30
+
31
31
  context "type and header" do
32
32
  it "should render type without no-edit class when no cards of type" do
33
33
  card = Card['UserForm'] # no cards with this type
@@ -1,5 +1,19 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  describe Card::Set::Type::Cardtype do
4
- # SPECSTUB
4
+ describe 'add_button view' do
5
+ it 'creates link with correct path' do
6
+ add_link = render_content "{{Basic|add_button}}"
7
+ assert_view_select add_link, 'a[href=/new/Basic]', 'Add Basic'
8
+ end
9
+ it 'handles title argument' do
10
+ add_link = render_content "{{Basic|add_button;title: custom link text}}"
11
+ assert_view_select add_link, 'a[href=/new/Basic]', 'custom link text'
12
+ end
13
+ it 'handles params' do
14
+ add_link = render_content "{{Basic|add_button;params:_project=_self}}"
15
+ assert_view_select add_link, 'a[href=/new/Basic?_project=Tempo+Rary+2]'
16
+ end
17
+ end
5
18
  end
19
+
@@ -0,0 +1,27 @@
1
+ wagn.slotReady(function(slot) {
2
+ slot.find('.modal.fade').on('loaded.bs.modal', function(e) {
3
+ $(this).trigger('slotReady');
4
+ });
5
+ slot.find('[data-toggle=\'modal\']').off("click").on('click', function(e) {
6
+ var $_this, href, modal_selector;
7
+ e.preventDefault();
8
+ e.stopPropagation();
9
+ $_this = $(this);
10
+ href = $_this.attr('href');
11
+ modal_selector = $_this.data('target');
12
+ $(modal_selector).modal('show');
13
+ $.ajax({
14
+ url: href,
15
+ type: 'GET',
16
+ success: function(html) {
17
+ $(modal_selector + ' .modal-content').html(html);
18
+ return $(modal_selector).trigger('loaded.bs.modal');
19
+ },
20
+ error: function(jqXHR, textStatus) {
21
+ $(modal_selector + ' .modal-content').html(jqXHR.responseText);
22
+ return $(modal_selector).trigger('loaded.bs.modal');
23
+ }
24
+ });
25
+ return false;
26
+ });
27
+ });
@@ -8,15 +8,16 @@ format :html do
8
8
  # Options
9
9
  # :header => { :content=>String, :brand=>( String | {:name=>, :href=>} ) }
10
10
  def navbar id, opts={}
11
- opts[:class] ||= ''
12
- opts[:class] += " navbar navbar-#{opts.delete(:navbar_type) || 'default'}"
11
+ nav_opts = opts[:nav_opts] || {}
12
+ nav_opts[:class] ||= (opts[:class] || '')
13
+ nav_opts[:class] += " navbar navbar-#{opts.delete(:navbar_type) || 'default'}"
13
14
  header_opts = opts[:header] || {}
14
15
  if opts[:toggle_align] == :left
15
16
  opts[:collapsed_content] ||= ''
16
17
  opts[:collapsed_content] += navbar_toggle(id, opts[:toggle], 'pull-left navbar-link').html_safe
17
18
  opts[:toggle] = :hide
18
19
  end
19
- wrap_with :nav, :class=>opts[:class] do
20
+ wrap_with :nav, nav_opts do
20
21
  [
21
22
  navbar_header(id, header_opts.delete(:content), header_opts.reverse_merge(:toggle=>opts[:toggle])),
22
23
  (content_tag(:div, opts[:collapsed_content].html_safe, :class=>'container-fluid') if opts[:collapsed_content]),
@@ -1,5 +1,7 @@
1
1
  view :raw do |args|
2
- File.read "#{Cardio.gem_root}/mod/06_bootstrap/lib/javascript/bootstrap.js"
2
+ [ "bootstrap.js", "bootstrap_modal_wagn.js" ].map do |name|
3
+ File.read "#{Cardio.gem_root}/mod/06_bootstrap/lib/javascript/#{name}"
4
+ end.join("\n")
3
5
  end
4
6
 
5
7
  format(:html) { include BootstrapCards::HtmlFormat }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.2
4
+ version: 1.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-05-11 00:00:00.000000000 Z
14
+ date: 2015-06-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: smartname
@@ -272,6 +272,7 @@ files:
272
272
  - db/migrate_core_cards/20150331135745_new_card_menu.rb
273
273
  - db/migrate_core_cards/20150508212032_menu_compatibility.rb
274
274
  - db/migrate_core_cards/20150510031118_fix_skin_images.rb
275
+ - db/migrate_core_cards/20150528084659_add_session_cardtype.rb
275
276
  - db/migrate_core_cards/data/1.11_help_text.json
276
277
  - db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss
277
278
  - db/migrate_core_cards/data/1.12_stylesheets/common.scss
@@ -371,6 +372,7 @@ files:
371
372
  - lib/card/simplecov_helper.rb
372
373
  - lib/card/spec_helper.rb
373
374
  - lib/card/version.rb
375
+ - lib/card/view_name.rb
374
376
  - lib/cardio.rb
375
377
  - lib/generators/card.rb
376
378
  - lib/generators/card/format/USAGE
@@ -634,6 +636,7 @@ files:
634
636
  - mod/05_standard/set/all/rich_html/toolbar.rb
635
637
  - mod/05_standard/set/all/rich_html/wrapper.rb
636
638
  - mod/05_standard/set/right/account.rb
639
+ - mod/05_standard/set/right/discussion.rb
637
640
  - mod/05_standard/set/right/email.rb
638
641
  - mod/05_standard/set/right/password.rb
639
642
  - mod/05_standard/set/right/salt.rb
@@ -665,6 +668,7 @@ files:
665
668
  - mod/05_standard/set/type/number.rb
666
669
  - mod/05_standard/set/type/phrase.rb
667
670
  - mod/05_standard/set/type/search_type.rb
671
+ - mod/05_standard/set/type/session.rb
668
672
  - mod/05_standard/set/type/set.rb
669
673
  - mod/05_standard/set/type/signup.rb
670
674
  - mod/05_standard/set/type/toggle.rb
@@ -687,6 +691,7 @@ files:
687
691
  - mod/05_standard/spec/set/all/error_spec.rb
688
692
  - mod/05_standard/spec/set/all/event_viz_spec.rb
689
693
  - mod/05_standard/spec/set/all/history_spec.rb
694
+ - mod/05_standard/spec/set/all/rich_html/editing_spec.rb
690
695
  - mod/05_standard/spec/set/all/rich_html/form_spec.rb
691
696
  - mod/05_standard/spec/set/all/rich_html/wrapper_spec.rb
692
697
  - mod/05_standard/spec/set/right/account_spec.rb
@@ -809,6 +814,7 @@ files:
809
814
  - mod/06_bootstrap/file/yeti_skin/small-image.png
810
815
  - mod/06_bootstrap/lib/javascript/bootstrap.js
811
816
  - mod/06_bootstrap/lib/javascript/bootstrap.min.js
817
+ - mod/06_bootstrap/lib/javascript/bootstrap_modal_wagn.js
812
818
  - mod/06_bootstrap/lib/javascript/smartmenu.js
813
819
  - mod/06_bootstrap/lib/stylesheets/bootstrap/_alerts.scss
814
820
  - mod/06_bootstrap/lib/stylesheets/bootstrap/_badges.scss