wagn 1.14.4 → 1.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/controllers/card_controller.rb +4 -3
- data/db/bootstrap/card_actions.yml +597 -583
- data/db/bootstrap/card_acts.yml +2 -2
- data/db/bootstrap/card_changes.yml +297 -248
- data/db/bootstrap/card_references.yml +3111 -1284
- data/db/bootstrap/cards.yml +1067 -1022
- data/db/migrate_core_cards/20141208132416_partial_reference_type.rb +7 -0
- data/db/migrate_core_cards/20141208162106_add_ace_script.rb +12 -0
- data/db/migrate_core_cards/20141230204340_uri_codename.rb +13 -0
- data/db/version_core_cards.txt +1 -1
- data/features/history.feature +2 -1
- data/features/layouts.feature +4 -0
- data/features/navbox.feature +1 -0
- data/features/step_definitions/wagn_steps.rb +6 -1
- data/features/support/env.rb +1 -1
- data/lib/card/env.rb +1 -1
- data/lib/card/format.rb +35 -48
- data/lib/card/loader.rb +9 -9
- data/lib/card/mailer.rb +0 -2
- data/lib/card/query.rb +8 -8
- data/lib/card/query/{card_spec.rb → card_clause.rb} +42 -42
- data/lib/card/query/{spec.rb → clause.rb} +3 -3
- data/lib/card/query/ref_clause.rb +47 -0
- data/lib/card/query/value_clause.rb +65 -0
- data/lib/card/reference.rb +11 -20
- data/lib/card/set.rb +6 -6
- data/lib/card/set_pattern.rb +5 -1
- data/lib/wagn/commands.rb +28 -14
- data/lib/wagn/config/environments/test.rb +3 -0
- data/lib/wagn/generators/wagn/templates/Gemfile +6 -0
- data/lib/wagn/generators/wagn/templates/Rakefile +1 -0
- data/lib/wagn/generators/wagn/templates/config/application.rb +1 -0
- data/lib/wagn/generators/wagn/templates/spec/javascripts/support/deck_jasmine.yml +56 -0
- data/lib/wagn/generators/wagn/templates/spec/javascripts/support/wagn_jasmine.yml +69 -0
- data/lib/wagn/generators/wagn/wagn_generator.rb +19 -2
- data/lib/wagn/migration.rb +10 -0
- data/lib/wagn/spec_helper.rb +2 -0
- data/lib/wagn/tasks/wagn.rake +9 -16
- data/mod/01_core/chunk/link.rb +2 -2
- data/mod/01_core/chunk/uri.rb +4 -4
- data/mod/01_core/format/html_format.rb +43 -280
- data/mod/01_core/set/all/active_card.rb +2 -0
- data/mod/01_core/set/all/collection.rb +19 -1
- data/mod/01_core/set/all/fetch.rb +5 -0
- data/mod/01_core/set/all/initialize.rb +1 -1
- data/mod/01_core/set/all/references.rb +25 -8
- data/mod/01_core/set/all/templating.rb +1 -1
- data/mod/01_core/set/all/tracked_attributes.rb +1 -1
- data/mod/01_core/set/all/type.rb +1 -1
- data/mod/01_core/set/all/utils.rb +1 -0
- data/mod/01_core/set_pattern/07_type_plus_right.rb +2 -1
- data/mod/01_core/spec/format/html_format_spec.rb +0 -2
- data/mod/01_core/spec/set/all/initialize_spec.rb +4 -4
- data/mod/01_core/spec/set/all/notify_spec.rb +9 -9
- data/mod/02_basic_types/set/type/pointer.rb +19 -8
- data/mod/03_machines/lib/javascript/ace.js +18204 -0
- data/mod/03_machines/lib/javascript/jquery-ui.js +13109 -11440
- data/mod/03_machines/lib/javascript/jquery.autosize.js +52 -33
- data/mod/03_machines/lib/javascript/jquery.fileupload.js +10 -8
- data/mod/03_machines/lib/javascript/jquery.iframe-transport.js +44 -16
- data/mod/03_machines/lib/javascript/jquery.js +4 -9473
- data/mod/03_machines/lib/javascript/jquery_ujs.js +156 -116
- data/mod/03_machines/lib/javascript/jquerymobile.js +14890 -8236
- data/mod/03_machines/lib/javascript/theme-textmate.js +130 -0
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +50 -10
- data/mod/03_machines/set/self/script_ace.rb +8 -0
- data/mod/03_machines/set/type/coffee_script.rb +1 -1
- data/mod/03_machines/set/type/css.rb +0 -2
- data/mod/03_machines/set/type/java_script.rb +1 -1
- data/mod/03_machines/spec/lib/{machine_spec.rb → shared_machine_examples.rb} +0 -0
- data/mod/03_machines/spec/lib/{machine_input_spec.rb → shared_machine_input_examples.rb} +0 -0
- data/mod/03_machines/spec/set/type/scss_spec.rb +2 -2
- data/mod/04_settings/set/right/comment.rb +2 -2
- data/mod/04_settings/set/type/setting.rb +2 -2
- data/mod/04_settings/spec/set/right/structure_spec.rb +2 -2
- data/mod/04_settings/spec/set/right/style_spec.rb +1 -1
- data/mod/05_email/set/type/email_template.rb +3 -2
- data/mod/05_standard/set/all/all_css.rb +1 -1
- data/mod/05_standard/set/all/all_js.rb +1 -1
- data/mod/05_standard/set/all/attach.rb +8 -7
- data/mod/05_standard/set/all/base.rb +6 -34
- data/mod/05_standard/set/all/editing.rb +145 -0
- data/mod/05_standard/set/all/error.rb +203 -0
- data/mod/05_standard/set/all/follow.rb +2 -2
- data/mod/05_standard/set/all/form.rb +211 -0
- data/mod/05_standard/set/all/header.rb +60 -0
- data/mod/05_standard/set/all/history.rb +3 -3
- data/mod/05_standard/set/all/links.rb +101 -0
- data/mod/05_standard/set/all/rich_html.rb +14 -392
- data/mod/05_standard/set/all/wrapper.rb +74 -0
- data/mod/05_standard/set/right/account.rb +1 -2
- data/mod/05_standard/set/rstar/rules.rb +5 -5
- data/mod/05_standard/set/self/account_links.rb +8 -4
- data/mod/05_standard/set/self/head.rb +3 -3
- data/mod/05_standard/set/self/signin.rb +5 -3
- data/mod/05_standard/set/type/search_type.rb +25 -25
- data/mod/05_standard/set/type/set.rb +2 -2
- data/mod/05_standard/set/type/signup.rb +0 -2
- data/mod/05_standard/set/type/uri.rb +11 -0
- data/mod/05_standard/spec/set/all/rich_html_spec.rb +6 -6
- data/mod/05_standard/spec/set/all/rss_spec.rb +1 -1
- data/mod/05_standard/spec/set/type/signup_spec.rb +0 -1
- data/mod/05_standard/spec/set/type/uri_spec.rb +41 -0
- data/public/assets/ace/mode-coffee.js +1 -0
- data/public/assets/ace/mode-css.js +1 -0
- data/public/assets/ace/mode-html.js +1 -0
- data/public/assets/ace/mode-javascript.js +1 -0
- data/public/assets/ace/mode-json.js +1 -0
- data/public/assets/ace/mode-scss.js +922 -0
- data/public/assets/ace/theme-github.js +98 -0
- data/public/assets/ace/theme-textmate.js +1 -0
- data/public/assets/ace/worker-coffee.js +1 -0
- data/public/assets/ace/worker-css.js +1 -0
- data/public/assets/ace/worker-html.js +1 -0
- data/public/assets/ace/worker-javascript.js +1 -0
- data/public/assets/ace/worker-json.js +1 -0
- data/spec/controllers/card_controller_spec.rb +0 -1
- data/spec/controllers/location_spec.rb +0 -2
- data/spec/javascripts/helpers/jasmine-jquery.js +812 -0
- data/spec/javascripts/support/jasmine.yml +8 -6
- data/spec/javascripts/support/jasmine_config.rb +1 -1
- data/spec/javascripts/support/jasmine_runner.rb +1 -1
- data/spec/javascripts/wagn_spec.coffee +2 -0
- data/spec/lib/card/content_spec.rb +28 -6
- data/spec/lib/card/format_spec.rb +62 -15
- data/spec/lib/card/reference_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -2
- data/test/fixtures/card_actions.yml +1260 -1239
- data/test/fixtures/card_acts.yml +347 -341
- data/test/fixtures/card_changes.yml +2345 -2276
- data/test/fixtures/card_references.yml +4098 -1606
- data/test/fixtures/cards.yml +1950 -1887
- metadata +39 -13
- data/lib/card/query/ref_spec.rb +0 -37
- data/lib/card/query/value_spec.rb +0 -65
- data/lib/wagn/location.rb +0 -93
- data/spec/javascripts/helpers/jasmine-config.js +0 -2
- data/spec/javascripts/helpers/jasmine-jquery-1.3.1.js +0 -295
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wagn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-01-
|
13
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -315,6 +315,9 @@ files:
|
|
315
315
|
- db/migrate_core_cards/20141119001955_make_symlinks_relative.rb
|
316
316
|
- db/migrate_core_cards/20141120120605_fix_notification_html_message.rb
|
317
317
|
- db/migrate_core_cards/20141204061304_watchers_to_following.rb
|
318
|
+
- db/migrate_core_cards/20141208132416_partial_reference_type.rb
|
319
|
+
- db/migrate_core_cards/20141208162106_add_ace_script.rb
|
320
|
+
- db/migrate_core_cards/20141230204340_uri_codename.rb
|
318
321
|
- db/migrate_core_cards/data/1.11_help_text.json
|
319
322
|
- db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss
|
320
323
|
- db/migrate_core_cards/data/1.12_stylesheets/common.scss
|
@@ -390,10 +393,10 @@ files:
|
|
390
393
|
- lib/card/mailer.rb
|
391
394
|
- lib/card/name.rb
|
392
395
|
- lib/card/query.rb
|
393
|
-
- lib/card/query/
|
394
|
-
- lib/card/query/
|
395
|
-
- lib/card/query/
|
396
|
-
- lib/card/query/
|
396
|
+
- lib/card/query/card_clause.rb
|
397
|
+
- lib/card/query/clause.rb
|
398
|
+
- lib/card/query/ref_clause.rb
|
399
|
+
- lib/card/query/value_clause.rb
|
397
400
|
- lib/card/reference.rb
|
398
401
|
- lib/card/set.rb
|
399
402
|
- lib/card/set_pattern.rb
|
@@ -446,9 +449,10 @@ files:
|
|
446
449
|
- lib/wagn/generators/wagn/templates/rspec
|
447
450
|
- lib/wagn/generators/wagn/templates/script/wagn
|
448
451
|
- lib/wagn/generators/wagn/templates/simplecov
|
452
|
+
- lib/wagn/generators/wagn/templates/spec/javascripts/support/deck_jasmine.yml
|
453
|
+
- lib/wagn/generators/wagn/templates/spec/javascripts/support/wagn_jasmine.yml
|
449
454
|
- lib/wagn/generators/wagn/templates/spec/spec_helper.rb
|
450
455
|
- lib/wagn/generators/wagn/wagn_generator.rb
|
451
|
-
- lib/wagn/location.rb
|
452
456
|
- lib/wagn/log.rb
|
453
457
|
- lib/wagn/migration.rb
|
454
458
|
- lib/wagn/mods_spec_helper.rb
|
@@ -533,6 +537,7 @@ files:
|
|
533
537
|
- mod/02_basic_types/spec/set/pointer_spec.rb
|
534
538
|
- mod/03_machines/lib/card/machine.rb
|
535
539
|
- mod/03_machines/lib/card/machine_input.rb
|
540
|
+
- mod/03_machines/lib/javascript/ace.js
|
536
541
|
- mod/03_machines/lib/javascript/html5shiv-printshiv.js
|
537
542
|
- mod/03_machines/lib/javascript/jquery-ui.js
|
538
543
|
- mod/03_machines/lib/javascript/jquery.autosize.js
|
@@ -542,6 +547,7 @@ files:
|
|
542
547
|
- mod/03_machines/lib/javascript/jquery.ui.autocomplete.html.js
|
543
548
|
- mod/03_machines/lib/javascript/jquery_ujs.js
|
544
549
|
- mod/03_machines/lib/javascript/jquerymobile.js
|
550
|
+
- mod/03_machines/lib/javascript/theme-textmate.js
|
545
551
|
- mod/03_machines/lib/javascript/tinymce.js
|
546
552
|
- mod/03_machines/lib/javascript/wagn.js.coffee
|
547
553
|
- mod/03_machines/lib/javascript/wagn_menu.js
|
@@ -550,6 +556,7 @@ files:
|
|
550
556
|
- mod/03_machines/lib/stylesheets/jquery-ui-smoothness.css
|
551
557
|
- mod/03_machines/lib/stylesheets/standard.scss
|
552
558
|
- mod/03_machines/set/right/machine_output.rb
|
559
|
+
- mod/03_machines/set/self/script_ace.rb
|
553
560
|
- mod/03_machines/set/self/script_card_menu.rb
|
554
561
|
- mod/03_machines/set/self/script_html5shiv_printshiv.rb
|
555
562
|
- mod/03_machines/set/self/script_jquery.rb
|
@@ -564,8 +571,8 @@ files:
|
|
564
571
|
- mod/03_machines/set/type/java_script.rb
|
565
572
|
- mod/03_machines/set/type/scss.rb
|
566
573
|
- mod/03_machines/set/type/skin.rb
|
567
|
-
- mod/03_machines/spec/lib/
|
568
|
-
- mod/03_machines/spec/lib/
|
574
|
+
- mod/03_machines/spec/lib/shared_machine_examples.rb
|
575
|
+
- mod/03_machines/spec/lib/shared_machine_input_examples.rb
|
569
576
|
- mod/03_machines/spec/set/right/machine_output_spec.rb
|
570
577
|
- mod/03_machines/spec/set/self/style_functional_spec.rb
|
571
578
|
- mod/03_machines/spec/set/self/style_jquery_ui_smoothness_spec.rb
|
@@ -662,15 +669,21 @@ files:
|
|
662
669
|
- mod/05_standard/set/all/attach.rb
|
663
670
|
- mod/05_standard/set/all/base.rb
|
664
671
|
- mod/05_standard/set/all/comment.rb
|
672
|
+
- mod/05_standard/set/all/editing.rb
|
673
|
+
- mod/05_standard/set/all/error.rb
|
665
674
|
- mod/05_standard/set/all/event_viz.rb
|
666
675
|
- mod/05_standard/set/all/file.rb
|
667
676
|
- mod/05_standard/set/all/follow.rb
|
677
|
+
- mod/05_standard/set/all/form.rb
|
678
|
+
- mod/05_standard/set/all/header.rb
|
668
679
|
- mod/05_standard/set/all/history.rb
|
669
680
|
- mod/05_standard/set/all/json.rb
|
681
|
+
- mod/05_standard/set/all/links.rb
|
670
682
|
- mod/05_standard/set/all/observer.rb
|
671
683
|
- mod/05_standard/set/all/rich_html.rb
|
672
684
|
- mod/05_standard/set/all/rss.rb
|
673
685
|
- mod/05_standard/set/all/text.rb
|
686
|
+
- mod/05_standard/set/all/wrapper.rb
|
674
687
|
- mod/05_standard/set/right/account.rb
|
675
688
|
- mod/05_standard/set/right/email.rb
|
676
689
|
- mod/05_standard/set/right/password.rb
|
@@ -706,6 +719,7 @@ files:
|
|
706
719
|
- mod/05_standard/set/type/set.rb
|
707
720
|
- mod/05_standard/set/type/signup.rb
|
708
721
|
- mod/05_standard/set/type/toggle.rb
|
722
|
+
- mod/05_standard/set/type/uri.rb
|
709
723
|
- mod/05_standard/set/type/user.rb
|
710
724
|
- mod/05_standard/spec/chunk/include_spec.rb
|
711
725
|
- mod/05_standard/spec/chunk/link_spec.rb
|
@@ -769,7 +783,21 @@ files:
|
|
769
783
|
- mod/05_standard/spec/set/type/set_spec.rb
|
770
784
|
- mod/05_standard/spec/set/type/signup_spec.rb
|
771
785
|
- mod/05_standard/spec/set/type/toggle_spec.rb
|
786
|
+
- mod/05_standard/spec/set/type/uri_spec.rb
|
772
787
|
- mod/05_standard/spec/set/type/user_spec.rb
|
788
|
+
- public/assets/ace/mode-coffee.js
|
789
|
+
- public/assets/ace/mode-css.js
|
790
|
+
- public/assets/ace/mode-html.js
|
791
|
+
- public/assets/ace/mode-javascript.js
|
792
|
+
- public/assets/ace/mode-json.js
|
793
|
+
- public/assets/ace/mode-scss.js
|
794
|
+
- public/assets/ace/theme-github.js
|
795
|
+
- public/assets/ace/theme-textmate.js
|
796
|
+
- public/assets/ace/worker-coffee.js
|
797
|
+
- public/assets/ace/worker-css.js
|
798
|
+
- public/assets/ace/worker-html.js
|
799
|
+
- public/assets/ace/worker-javascript.js
|
800
|
+
- public/assets/ace/worker-json.js
|
773
801
|
- public/assets/body-bg-660b752b44b87594071f3d0851ac5360.png
|
774
802
|
- public/assets/body-bg-d031f29b6ba7399a6862382c3552f44c.bmp
|
775
803
|
- public/assets/body-bg.bmp
|
@@ -1306,8 +1334,7 @@ files:
|
|
1306
1334
|
- spec/controllers/card_controller_spec.rb
|
1307
1335
|
- spec/controllers/location_spec.rb
|
1308
1336
|
- spec/javascripts/helpers/.gitkeep
|
1309
|
-
- spec/javascripts/helpers/jasmine-
|
1310
|
-
- spec/javascripts/helpers/jasmine-jquery-1.3.1.js
|
1337
|
+
- spec/javascripts/helpers/jasmine-jquery.js
|
1311
1338
|
- spec/javascripts/support/jasmine.yml
|
1312
1339
|
- spec/javascripts/support/jasmine_config.rb
|
1313
1340
|
- spec/javascripts/support/jasmine_runner.rb
|
@@ -1404,8 +1431,7 @@ test_files:
|
|
1404
1431
|
- spec/controllers/card_controller_spec.rb
|
1405
1432
|
- spec/controllers/location_spec.rb
|
1406
1433
|
- spec/javascripts/helpers/.gitkeep
|
1407
|
-
- spec/javascripts/helpers/jasmine-
|
1408
|
-
- spec/javascripts/helpers/jasmine-jquery-1.3.1.js
|
1434
|
+
- spec/javascripts/helpers/jasmine-jquery.js
|
1409
1435
|
- spec/javascripts/support/jasmine.yml
|
1410
1436
|
- spec/javascripts/support/jasmine_config.rb
|
1411
1437
|
- spec/javascripts/support/jasmine_runner.rb
|
data/lib/card/query/ref_spec.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
class Card::Query
|
2
|
-
class RefSpec < Spec
|
3
|
-
REFERENCE_DEFINITIONS = {
|
4
|
-
:refer_to => [ :out ], :referred_to_by => [ :in ],
|
5
|
-
:link_to => [ :out, 'L' ], :linked_to_by => [ :in, 'L' ],
|
6
|
-
:include => [ :out, 'I' ], :included_by => [ :in, 'I' ]
|
7
|
-
}
|
8
|
-
|
9
|
-
REFERENCE_FIELDS = {
|
10
|
-
:out => [ :referer_id, :referee_id ],
|
11
|
-
:in => [ :referee_id, :referer_id ]
|
12
|
-
}
|
13
|
-
|
14
|
-
def initialize key, val, parent
|
15
|
-
@key, @val, @parent = key, val, parent
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_sql *args
|
19
|
-
dir, type = REFERENCE_DEFINITIONS[ @key.to_sym ]
|
20
|
-
field1, field2 = REFERENCE_FIELDS[ dir ]
|
21
|
-
cond = type ? ["ref_type='#{type}'"] : []
|
22
|
-
|
23
|
-
sql = %[select #{field1} as ref_id from card_references]
|
24
|
-
if @val == '_none'
|
25
|
-
cond << "present = 0"
|
26
|
-
else
|
27
|
-
cardspec = CardSpec.build(:return=>'id', :_parent=>@parent).merge(@val)
|
28
|
-
sql << %[ join #{ cardspec.to_sql } as c on #{field2} = c.id]
|
29
|
-
end
|
30
|
-
sql << %[ where #{ cond * ' and ' }] if cond.any?
|
31
|
-
|
32
|
-
"(#{sql})"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
|
@@ -1,65 +0,0 @@
|
|
1
|
-
class Card::Query
|
2
|
-
class ValueSpec < Spec
|
3
|
-
def initialize spec, cardspec
|
4
|
-
@cardspec = cardspec
|
5
|
-
|
6
|
-
# bare value shortcut
|
7
|
-
@spec = case spec
|
8
|
-
when ValueSpec; spec.instance_variable_get('@spec') # FIXME what a hack (what's this for?)
|
9
|
-
when Array; spec
|
10
|
-
when String; ['=', spec]
|
11
|
-
when Integer; ['=', spec]
|
12
|
-
else raise("Invalid Condition Spec #{spec.inspect}")
|
13
|
-
end
|
14
|
-
|
15
|
-
# operator aliases
|
16
|
-
@spec[0] = @spec[0].to_s
|
17
|
-
if target = OPERATORS[@spec[0]]
|
18
|
-
@spec[0] = target
|
19
|
-
end
|
20
|
-
|
21
|
-
# check valid operator
|
22
|
-
raise("Invalid Operator #{@spec[0]}") unless OPERATORS.has_key?(@spec[0])
|
23
|
-
|
24
|
-
# handle IN #FIXME -- shouldn't this handle "not in", too?
|
25
|
-
if @spec[0]=='in' and !@spec[1].is_a?(CardSpec) and !@spec[1].is_a?(RefSpec)
|
26
|
-
@spec = [@spec[0], @spec[1..-1]]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def op
|
31
|
-
@spec[0]
|
32
|
-
end
|
33
|
-
|
34
|
-
def sqlize(v)
|
35
|
-
case v
|
36
|
-
when CardSpec, RefSpec, SqlCond; v.to_sql
|
37
|
-
when Array; "(" + v.flatten.collect {|x| sqlize(x)}.join(',') + ")"
|
38
|
-
else quote(v.to_s)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def to_sql field
|
43
|
-
op,v = @spec
|
44
|
-
#warn "to_sql(#{field}), #{op}, #{v}, #{@cardspec.inspect}"
|
45
|
-
v=@cardspec.selfname if v=='_self'
|
46
|
-
table = @cardspec.table_alias
|
47
|
-
|
48
|
-
#warn "to_sql #{field}, #{v} (#{op})"
|
49
|
-
field, v = case field
|
50
|
-
when "cond"; return "(#{sqlize(v)})"
|
51
|
-
when "name"; ["#{table}.key", [v].flatten.map(&:to_name).map(&:key)]
|
52
|
-
when "content"; ["#{table}.db_content", v]
|
53
|
-
else; ["#{table}.#{safe_sql(field)}", v]
|
54
|
-
end
|
55
|
-
|
56
|
-
v = v[0] if Array===v && v.length==1 && op != 'in'
|
57
|
-
if op=='~'
|
58
|
-
cxn, v = match_prep(v,@cardspec)
|
59
|
-
%{#{field} #{cxn.match(sqlize(v))}}
|
60
|
-
else
|
61
|
-
"#{field} #{op} #{sqlize(v)}"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
data/lib/wagn/location.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
# helper for urls, links, redirects, and other location related things.
|
3
|
-
# note: i'm sure this isn't the optimal name..
|
4
|
-
|
5
|
-
module Wagn::Location
|
6
|
-
|
7
|
-
# we keep a history stack so that in the case of card removal
|
8
|
-
# we can crawl back up to the last un-removed location
|
9
|
-
|
10
|
-
#
|
11
|
-
def location_history
|
12
|
-
#warn "sess #{session.class}, #{session.object_id}"
|
13
|
-
session[:history] ||= [wagn_path('')]
|
14
|
-
if session[:history]
|
15
|
-
session[:history].shift if session[:history].size > 5
|
16
|
-
session[:history]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def save_location
|
21
|
-
return if ajax? || !html? || !@card.known? || (@card.codename == 'signin')
|
22
|
-
discard_locations_for @card
|
23
|
-
@previous_location = wagn_path @card
|
24
|
-
location_history.push @previous_location
|
25
|
-
end
|
26
|
-
|
27
|
-
def previous_location
|
28
|
-
@previous_location ||= location_history.last if location_history
|
29
|
-
end
|
30
|
-
|
31
|
-
def discard_locations_for(card)
|
32
|
-
# quoting necessary because cards have things like "+*" in the names..
|
33
|
-
session[:history] = location_history.reject do |loc|
|
34
|
-
if url_key = url_key_for_location(loc)
|
35
|
-
url_key.to_name.key == card.key
|
36
|
-
end
|
37
|
-
end.compact
|
38
|
-
@previous_location = nil
|
39
|
-
end
|
40
|
-
|
41
|
-
def url_key_for_location(location)
|
42
|
-
location.match( /\/([^\/]*$)/ ) ? $1 : nil
|
43
|
-
end
|
44
|
-
|
45
|
-
def save_interrupted_action uri
|
46
|
-
uri = path(uri) if Hash === uri
|
47
|
-
session[:interrupted_action] = uri
|
48
|
-
end
|
49
|
-
|
50
|
-
def interrupted_action
|
51
|
-
session.delete :interrupted_action
|
52
|
-
end
|
53
|
-
|
54
|
-
# -----------( urls and redirects from application.rb) ----------------
|
55
|
-
|
56
|
-
|
57
|
-
# TESTME
|
58
|
-
def page_path title, opts={}
|
59
|
-
|
60
|
-
format = opts[:format] ? ".#{opts.delete(:format)}" : ''
|
61
|
-
query = opts.present? ? "?#{opts.to_param}" : ''
|
62
|
-
wagn_path "#{title.to_name.url_key}#{format}#{query}"
|
63
|
-
end
|
64
|
-
|
65
|
-
def wagn_path rel #should be in smartname?
|
66
|
-
rel_path = Card===rel ? rel.cardname.url_key : rel.to_s
|
67
|
-
if rel_path =~ /^\//
|
68
|
-
rel_path
|
69
|
-
else
|
70
|
-
"#{ Wagn.config.relative_url_root }/#{ rel_path }"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def wagn_url rel #should be in smartname?
|
75
|
-
if rel =~ /^https?\:/
|
76
|
-
rel
|
77
|
-
else
|
78
|
-
"#{ Card::Env[:protocol] }#{ Card::Env[:host] }#{ wagn_path rel }"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
|
-
# Links ----------------------------------------------------------------------
|
84
|
-
|
85
|
-
def link_to_page( text, title=nil, options={})
|
86
|
-
title ||= text
|
87
|
-
url_options = {}
|
88
|
-
[:type, :view].each { |k| url_options[k] = options.delete(k) if options[k] }
|
89
|
-
url = page_path( title, url_options )
|
90
|
-
link_to text, url, options
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
@@ -1,295 +0,0 @@
|
|
1
|
-
|
2
|
-
var readFixtures = function() {
|
3
|
-
return jasmine.getFixtures().proxyCallTo_('read', arguments);
|
4
|
-
};
|
5
|
-
|
6
|
-
var preloadFixtures = function() {
|
7
|
-
jasmine.getFixtures().proxyCallTo_('preload', arguments);
|
8
|
-
};
|
9
|
-
|
10
|
-
var loadFixtures = function() {
|
11
|
-
jasmine.getFixtures().proxyCallTo_('load', arguments);
|
12
|
-
};
|
13
|
-
|
14
|
-
var setFixtures = function(html) {
|
15
|
-
jasmine.getFixtures().set(html);
|
16
|
-
};
|
17
|
-
|
18
|
-
var sandbox = function(attributes) {
|
19
|
-
return jasmine.getFixtures().sandbox(attributes);
|
20
|
-
};
|
21
|
-
|
22
|
-
var spyOnEvent = function(selector, eventName) {
|
23
|
-
jasmine.JQuery.events.spyOn(selector, eventName);
|
24
|
-
}
|
25
|
-
|
26
|
-
jasmine.getFixtures = function() {
|
27
|
-
return jasmine.currentFixtures_ = jasmine.currentFixtures_ || new jasmine.Fixtures();
|
28
|
-
};
|
29
|
-
|
30
|
-
jasmine.Fixtures = function() {
|
31
|
-
this.containerId = 'jasmine-fixtures';
|
32
|
-
this.fixturesCache_ = {};
|
33
|
-
this.fixturesPath = 'spec/javascripts/fixtures';
|
34
|
-
};
|
35
|
-
|
36
|
-
jasmine.Fixtures.prototype.set = function(html) {
|
37
|
-
this.cleanUp();
|
38
|
-
this.createContainer_(html);
|
39
|
-
};
|
40
|
-
|
41
|
-
jasmine.Fixtures.prototype.preload = function() {
|
42
|
-
this.read.apply(this, arguments);
|
43
|
-
};
|
44
|
-
|
45
|
-
jasmine.Fixtures.prototype.load = function() {
|
46
|
-
this.cleanUp();
|
47
|
-
this.createContainer_(this.read.apply(this, arguments));
|
48
|
-
};
|
49
|
-
|
50
|
-
jasmine.Fixtures.prototype.read = function() {
|
51
|
-
var htmlChunks = [];
|
52
|
-
|
53
|
-
var fixtureUrls = arguments;
|
54
|
-
for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
|
55
|
-
htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]));
|
56
|
-
}
|
57
|
-
|
58
|
-
return htmlChunks.join('');
|
59
|
-
};
|
60
|
-
|
61
|
-
jasmine.Fixtures.prototype.clearCache = function() {
|
62
|
-
this.fixturesCache_ = {};
|
63
|
-
};
|
64
|
-
|
65
|
-
jasmine.Fixtures.prototype.cleanUp = function() {
|
66
|
-
jQuery('#' + this.containerId).remove();
|
67
|
-
};
|
68
|
-
|
69
|
-
jasmine.Fixtures.prototype.sandbox = function(attributes) {
|
70
|
-
var attributesToSet = attributes || {};
|
71
|
-
return jQuery('<div id="sandbox" />').attr(attributesToSet);
|
72
|
-
};
|
73
|
-
|
74
|
-
jasmine.Fixtures.prototype.createContainer_ = function(html) {
|
75
|
-
var container;
|
76
|
-
if(html instanceof jQuery) {
|
77
|
-
container = jQuery('<div id="' + this.containerId + '" />');
|
78
|
-
container.html(html);
|
79
|
-
} else {
|
80
|
-
container = '<div id="' + this.containerId + '">' + html + '</div>'
|
81
|
-
}
|
82
|
-
jQuery('body').append(container);
|
83
|
-
};
|
84
|
-
|
85
|
-
jasmine.Fixtures.prototype.getFixtureHtml_ = function(url) {
|
86
|
-
if (typeof this.fixturesCache_[url] == 'undefined') {
|
87
|
-
this.loadFixtureIntoCache_(url);
|
88
|
-
}
|
89
|
-
return this.fixturesCache_[url];
|
90
|
-
};
|
91
|
-
|
92
|
-
jasmine.Fixtures.prototype.loadFixtureIntoCache_ = function(relativeUrl) {
|
93
|
-
var self = this;
|
94
|
-
var url = this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl;
|
95
|
-
jQuery.ajax({
|
96
|
-
async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded
|
97
|
-
cache: false,
|
98
|
-
dataType: 'html',
|
99
|
-
url: url,
|
100
|
-
success: function(data) {
|
101
|
-
self.fixturesCache_[relativeUrl] = data;
|
102
|
-
},
|
103
|
-
error: function(jqXHR, status, errorThrown) {
|
104
|
-
throw Error('Fixture could not be loaded: ' + url + ' (status: ' + status + ', message: ' + errorThrown.message + ')');
|
105
|
-
}
|
106
|
-
});
|
107
|
-
};
|
108
|
-
|
109
|
-
jasmine.Fixtures.prototype.proxyCallTo_ = function(methodName, passedArguments) {
|
110
|
-
return this[methodName].apply(this, passedArguments);
|
111
|
-
};
|
112
|
-
|
113
|
-
|
114
|
-
jasmine.JQuery = function() {};
|
115
|
-
|
116
|
-
jasmine.JQuery.browserTagCaseIndependentHtml = function(html) {
|
117
|
-
return jQuery('<div/>').append(html).html();
|
118
|
-
};
|
119
|
-
|
120
|
-
jasmine.JQuery.elementToString = function(element) {
|
121
|
-
return jQuery('<div />').append(element.clone()).html();
|
122
|
-
};
|
123
|
-
|
124
|
-
jasmine.JQuery.matchersClass = {};
|
125
|
-
|
126
|
-
(function(namespace) {
|
127
|
-
var data = {
|
128
|
-
spiedEvents: {},
|
129
|
-
handlers: []
|
130
|
-
};
|
131
|
-
|
132
|
-
namespace.events = {
|
133
|
-
spyOn: function(selector, eventName) {
|
134
|
-
var handler = function(e) {
|
135
|
-
data.spiedEvents[[selector, eventName]] = e;
|
136
|
-
};
|
137
|
-
jQuery(selector).bind(eventName, handler);
|
138
|
-
data.handlers.push(handler);
|
139
|
-
},
|
140
|
-
|
141
|
-
wasTriggered: function(selector, eventName) {
|
142
|
-
return !!(data.spiedEvents[[selector, eventName]]);
|
143
|
-
},
|
144
|
-
|
145
|
-
cleanUp: function() {
|
146
|
-
data.spiedEvents = {};
|
147
|
-
data.handlers = [];
|
148
|
-
}
|
149
|
-
}
|
150
|
-
})(jasmine.JQuery);
|
151
|
-
|
152
|
-
(function(){
|
153
|
-
var jQueryMatchers = {
|
154
|
-
toHaveClass: function(className) {
|
155
|
-
return this.actual.hasClass(className);
|
156
|
-
},
|
157
|
-
|
158
|
-
toBeVisible: function() {
|
159
|
-
return this.actual.is(':visible');
|
160
|
-
},
|
161
|
-
|
162
|
-
toBeHidden: function() {
|
163
|
-
return this.actual.is(':hidden');
|
164
|
-
},
|
165
|
-
|
166
|
-
toBeSelected: function() {
|
167
|
-
return this.actual.is(':selected');
|
168
|
-
},
|
169
|
-
|
170
|
-
toBeChecked: function() {
|
171
|
-
return this.actual.is(':checked');
|
172
|
-
},
|
173
|
-
|
174
|
-
toBeEmpty: function() {
|
175
|
-
return this.actual.is(':empty');
|
176
|
-
},
|
177
|
-
|
178
|
-
toExist: function() {
|
179
|
-
return this.actual.size() > 0;
|
180
|
-
},
|
181
|
-
|
182
|
-
toHaveAttr: function(attributeName, expectedAttributeValue) {
|
183
|
-
return hasProperty(this.actual.attr(attributeName), expectedAttributeValue);
|
184
|
-
},
|
185
|
-
|
186
|
-
toHaveId: function(id) {
|
187
|
-
return this.actual.attr('id') == id;
|
188
|
-
},
|
189
|
-
|
190
|
-
toHaveHtml: function(html) {
|
191
|
-
return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html);
|
192
|
-
},
|
193
|
-
|
194
|
-
toHaveText: function(text) {
|
195
|
-
if (text && jQuery.isFunction(text.test)) {
|
196
|
-
return text.test(this.actual.text());
|
197
|
-
} else {
|
198
|
-
return this.actual.text() == text;
|
199
|
-
}
|
200
|
-
},
|
201
|
-
|
202
|
-
toHaveValue: function(value) {
|
203
|
-
return this.actual.val() == value;
|
204
|
-
},
|
205
|
-
|
206
|
-
toHaveData: function(key, expectedValue) {
|
207
|
-
return hasProperty(this.actual.data(key), expectedValue);
|
208
|
-
},
|
209
|
-
|
210
|
-
toBe: function(selector) {
|
211
|
-
return this.actual.is(selector);
|
212
|
-
},
|
213
|
-
|
214
|
-
toContain: function(selector) {
|
215
|
-
return this.actual.find(selector).size() > 0;
|
216
|
-
},
|
217
|
-
|
218
|
-
toBeDisabled: function(selector){
|
219
|
-
return this.actual.is(':disabled');
|
220
|
-
},
|
221
|
-
|
222
|
-
// tests the existence of a specific event binding
|
223
|
-
toHandle: function(eventName) {
|
224
|
-
var events = this.actual.data("events");
|
225
|
-
return events && events[eventName].length > 0;
|
226
|
-
},
|
227
|
-
|
228
|
-
// tests the existence of a specific event binding + handler
|
229
|
-
toHandleWith: function(eventName, eventHandler) {
|
230
|
-
var stack = this.actual.data("events")[eventName];
|
231
|
-
var i;
|
232
|
-
for (i = 0; i < stack.length; i++) {
|
233
|
-
if (stack[i].handler == eventHandler) {
|
234
|
-
return true;
|
235
|
-
}
|
236
|
-
}
|
237
|
-
return false;
|
238
|
-
}
|
239
|
-
};
|
240
|
-
|
241
|
-
var hasProperty = function(actualValue, expectedValue) {
|
242
|
-
if (expectedValue === undefined) {
|
243
|
-
return actualValue !== undefined;
|
244
|
-
}
|
245
|
-
return actualValue == expectedValue;
|
246
|
-
};
|
247
|
-
|
248
|
-
var bindMatcher = function(methodName) {
|
249
|
-
var builtInMatcher = jasmine.Matchers.prototype[methodName];
|
250
|
-
|
251
|
-
jasmine.JQuery.matchersClass[methodName] = function() {
|
252
|
-
if (this.actual instanceof jQuery) {
|
253
|
-
var result = jQueryMatchers[methodName].apply(this, arguments);
|
254
|
-
this.actual = jasmine.JQuery.elementToString(this.actual);
|
255
|
-
return result;
|
256
|
-
}
|
257
|
-
|
258
|
-
if (builtInMatcher) {
|
259
|
-
return builtInMatcher.apply(this, arguments);
|
260
|
-
}
|
261
|
-
|
262
|
-
return false;
|
263
|
-
};
|
264
|
-
};
|
265
|
-
|
266
|
-
for(var methodName in jQueryMatchers) {
|
267
|
-
bindMatcher(methodName);
|
268
|
-
}
|
269
|
-
})();
|
270
|
-
|
271
|
-
beforeEach(function() {
|
272
|
-
this.addMatchers(jasmine.JQuery.matchersClass);
|
273
|
-
this.addMatchers({
|
274
|
-
toHaveBeenTriggeredOn: function(selector) {
|
275
|
-
this.message = function() {
|
276
|
-
return [
|
277
|
-
"Expected event " + this.actual + " to have been triggered on" + selector,
|
278
|
-
"Expected event " + this.actual + " not to have been triggered on" + selector
|
279
|
-
];
|
280
|
-
};
|
281
|
-
return jasmine.JQuery.events.wasTriggered(selector, this.actual);
|
282
|
-
}
|
283
|
-
})
|
284
|
-
});
|
285
|
-
|
286
|
-
afterEach(function() {
|
287
|
-
jasmine.getFixtures().cleanUp();
|
288
|
-
jasmine.JQuery.events.cleanUp();
|
289
|
-
});
|
290
|
-
|
291
|
-
|
292
|
-
//HACKED IN BY ETHAN
|
293
|
-
jasmine.getFixtures().fixturesPath = 'jasmine/';
|
294
|
-
|
295
|
-
|