From 3a8385023b2a3df849db1975fe77e2e7e9f5bdca Mon Sep 17 00:00:00 2001 From: Taka Date: Wed, 5 May 2021 07:06:47 +1000 Subject: [PATCH] Fixed Chapter H URL's for derived nationalities. --- vasl_templates/webapp/static/snippets.js | 6 +++- .../default-template-pack/nationalities.json | 9 +++++ .../tests/fixtures/data/ordnance/chinese.json | 8 +++++ .../fixtures/data/ordnance/chinese~gmd.json | 1 + .../tests/fixtures/data/vehicles/chinese.json | 8 +++++ .../fixtures/data/vehicles/chinese~gmd.json | 1 + .../fixtures/vo-notes/chinese/ordnance/1.png | Bin 0 -> 1339 bytes .../fixtures/vo-notes/chinese/vehicles/1.png | Bin 0 -> 1339 bytes vasl_templates/webapp/tests/test_vo_notes.py | 33 ++++++++++++++++++ 9 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 vasl_templates/webapp/tests/fixtures/data/ordnance/chinese.json create mode 100644 vasl_templates/webapp/tests/fixtures/data/ordnance/chinese~gmd.json create mode 100644 vasl_templates/webapp/tests/fixtures/data/vehicles/chinese.json create mode 100644 vasl_templates/webapp/tests/fixtures/data/vehicles/chinese~gmd.json create mode 100644 vasl_templates/webapp/tests/fixtures/vo-notes/chinese/ordnance/1.png create mode 100644 vasl_templates/webapp/tests/fixtures/vo-notes/chinese/vehicles/1.png diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js index 46781b1..150d61d 100644 --- a/vasl_templates/webapp/static/snippets.js +++ b/vasl_templates/webapp/static/snippets.js @@ -580,7 +580,11 @@ function get_vo_note( vo_type, nat, key ) var vo_note = gVehicleOrdnanceNotes[ vo_type ][ nat ][ key ] ; // FUDGE! We need to detect between a full HTML note and an image-based one. // This is not great, but it'll do... :-/ - if ( vo_note.substr( 0, nat.length+1 ) === nat+"/" ) + var nat2 = nat ; + var pos = nat2.indexOf( "~" ) ; + if ( pos > 0 ) + nat2 = nat2.substring( 0, pos ) ; + if ( vo_note.substr( 0, nat2.length+1 ) === nat2+"/" ) return make_app_url( "/" + vo_type + "/" + nat + "/note/" + key, true ) ; else return vo_note ; diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/nationalities.json b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/nationalities.json index 688e3a5..fa5755d 100644 --- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/nationalities.json +++ b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/nationalities.json @@ -24,6 +24,15 @@ "ob_colors": [ "OBCOL:british~canadian","OBCOL2:british~canadian", "OBCOL-BORDER:british~canadian" ] }, +"chinese": { + "display_name": "Chinese", + "ob_colors": [ "OBCOL:chinese","OBCOL2:chinese", "OBCOL-BORDER:chinese" ] +}, +"chinese~gmd": { + "display_name": "Chinese GMD", + "ob_colors": [ "OBCOL:chinese~gmd","OBCOL2:chinese~gmd", "OBCOL-BORDER:chinese~gmd" ] +}, + "french": { "display_name": "French", "ob_colors": [ "OBCOL:french","OBCOL2:french", "OBCOL-BORDER:french" ] diff --git a/vasl_templates/webapp/tests/fixtures/data/ordnance/chinese.json b/vasl_templates/webapp/tests/fixtures/data/ordnance/chinese.json new file mode 100644 index 0000000..bff6403 --- /dev/null +++ b/vasl_templates/webapp/tests/fixtures/data/ordnance/chinese.json @@ -0,0 +1,8 @@ +[ + +{ "name": "a chinese ordnance", + "note_number": "1", + "id": "ch/o:001" +} + +] diff --git a/vasl_templates/webapp/tests/fixtures/data/ordnance/chinese~gmd.json b/vasl_templates/webapp/tests/fixtures/data/ordnance/chinese~gmd.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/vasl_templates/webapp/tests/fixtures/data/ordnance/chinese~gmd.json @@ -0,0 +1 @@ +[] diff --git a/vasl_templates/webapp/tests/fixtures/data/vehicles/chinese.json b/vasl_templates/webapp/tests/fixtures/data/vehicles/chinese.json new file mode 100644 index 0000000..5a7ac10 --- /dev/null +++ b/vasl_templates/webapp/tests/fixtures/data/vehicles/chinese.json @@ -0,0 +1,8 @@ +[ + +{ "name": "a chinese vehicle", + "note_number": "1", + "id": "ch/v:001" +} + +] diff --git a/vasl_templates/webapp/tests/fixtures/data/vehicles/chinese~gmd.json b/vasl_templates/webapp/tests/fixtures/data/vehicles/chinese~gmd.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/vasl_templates/webapp/tests/fixtures/data/vehicles/chinese~gmd.json @@ -0,0 +1 @@ +[] diff --git a/vasl_templates/webapp/tests/fixtures/vo-notes/chinese/ordnance/1.png b/vasl_templates/webapp/tests/fixtures/vo-notes/chinese/ordnance/1.png new file mode 100644 index 0000000000000000000000000000000000000000..62b26786bb3c169f871ad6e5fa6f6712e0ee5a5f GIT binary patch literal 1339 zcmXxkeN>WH90%}6NRUTB)TfC;_T)=Fvm$V~sWiuHVlIR7nC#J_fLAldhyTX}>WmD9N(a2|-D5`$=ZYmNb=wrc(I;0I z0KhCwWKE24-9rO(4m)_f-w6iPc}M3NPeF_&SaP)_k~9^~#P zUqlgI=%mtwQVnxH$}?17BVyi2TmqZNy*g>)E7BZUmiwn+=9R>!ut@NHmmaeUf`~+R zS=)gWnZ+#t}>q1QNq3Pmo0F zL3o`MVRiGGYbEjqV9e0rW+Zt;fPTazI1#B~4(juljTK(-34y>^Vk10=tYak`Q))FA zQ@qA$1)M?;%0|S8>B#%q9ON#5x|@-5rbAzB4k8Icx*HH5mc!6i7&KeJ?#@KYS%C)O zj<7xvj3}$GH#Ihrud+`rS-g0sEve34T2c~I(Q~h-y}f;^r>AGZwTO~(#7qbBk|}wd z3Y)U}oI9|0-@fUycDp@{gdGiZNc_U%CMPFz7cW}$j-GS5uP^4!9_lIBn7z8ItLy3V zL#wvr=Ei)<;cT6h-L7h0@%|X8M!*^DI?NzX9Qw0j6SN!dq-Pwmny~)&ex2tng1RHC zVw6ZKcYcdLp6~58em6=8f$N zz|^KOz7@!@{Gt1I^E)v4f?JiIV3Y@*n1CFFYnaWJGQGwzn#ad<_!|R4BTci2%PTB! zIrFH*pcgwVTmmM@KbQ?hivyW_D|&^5UZyOo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