Produced by Araxis Merge on 12/7/2018 11:36:04 AM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\SCRUB\MHED\MHED\VAR 4.10.0\var-web-release-4.10@e10f18de1ef\veteran-appointment-requests\app\modules\new-appointment-request | readme.md | Mon Oct 22 23:25:20 2018 UTC |
| 2 | C:\MHED-scrubbed\MHED\MHED\VAR 4.10.0\var-web-release-4.10@e10f18de1ef\veteran-appointment-requests\app\modules\new-appointment-request | readme.md | Fri Dec 7 13:07:32 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 314 |
| Changed | 2 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | # New Appo intment Re quests | |
| 2 | ||
| 3 | *Note: Thi s folder i s using a different file struc ture than most other modules o n this pro ject. The reason for this is t hat by spe rating the models an d the view s into sep arate dire ctories it is easier to adhere to basic MVC princi ples. This change wa s made in the story VAR-10192, and one o f the goal s of that story was to help dr aw clearer boundarie s between the data a nd the dis playing of that data * | |
| 4 | ||
| 5 | ||
| 6 | The struct ure of thi s folder i s broken d own into t hree basic parts | |
| 7 | 1. Common Components - These a re aspects of the fo rm that ar e the same regardles s of it di rect sched uling or r equest sch eduling is being use d | |
| 8 | 2. Direct Components - These a re items t hat a spec ific to di rect (appo intment) s cheduling and have n o impact o n request scheduling | |
| 9 | 3. Request Component s - Like d irect comp onents, th ese items have no ov erlap. Th ey only im pact the r equest por tion of th e form. | |
| 10 | ||
| 11 | ## Views | |
| 12 | ||
| 13 | 1. section -view.js - The form component itself, ex tends ques tion-view. js | |
| 14 | 2. header. js - A sma ll item-vi ew respons ible for d rawing the common he adings of the views | |
| 15 | 3. layout- view.js - Typically a view tha t controls the combi nation of the header and the s ection vie w. | |
| 16 | ||
| 17 | ## Models | |
| 18 | In general all views in this f older shar e a single common mo del (resou rces/commo n/model), but hold t heir own i ndependent collectio n. | |
| 19 | The model is build d ynamically as each v iew add an other inde pendent vi ew specifi c model in to the com mon model as the use r selects items. | |
| 20 | The common model als o adds sho rt cuts fo r accessin g data fro m other mo dels that it holds. In genera l each vie w should o nly write to their o wn nested model, but read from any that they need too. | |
| 21 | ||
| 22 | The common model is use primar ily for ev enting. | |
| 23 | ||
| 24 | The direct /request m odel, exte nd the com mon model and is use d for writ e back. | |
| 25 | ||
| 26 | ```javascr ipt | |
| 27 | var direct Model = ne w DirectMo del(common Model.attr ibutes); | |
| 28 | directMode l.save(); | |
| 29 | ``` | |
| 30 | ||
| 31 | # Example of adding a new view | |
| 32 | ||
| 33 | The follow ing is an example of adding a new common view: | |
| 34 | ||
| 35 | ```javascr ipt | |
| 36 | // main.js | |
| 37 | define(['m arionette' , 'common/ model', 'v iews/layou t'], funct ion(Mn, Mo del, Layou tView) { | |
| 38 | 'use s trict'; | |
| 39 | ||
| 40 | return Mn.View.e xtend({ | |
| 41 | re gions: { | |
| 42 | layout: '#layout' | |
| 43 | }, | |
| 44 | ||
| 45 | mo delEvents: { | |
| 46 | 'change: whatever': 'doWhatev er' | |
| 47 | }, | |
| 48 | ||
| 49 | in itialize: function() { | |
| 50 | this.mod el = new M odel(); | |
| 51 | }, | |
| 52 | ||
| 53 | on Render: fu nction() { | |
| 54 | var regi on = this. getRegion( 'layout'); | |
| 55 | region.s how(new La youtView({ | |
| 56 | mode l: this.mo del | |
| 57 | })); | |
| 58 | }, | |
| 59 | ||
| 60 | do Whatever: function() { /* .. * / } | |
| 61 | }) | |
| 62 | ||
| 63 | }); | |
| 64 | ||
| 65 | ||
| 66 | // collect ion.js | |
| 67 | define(['b ackbone', 'models/ab stract-col lection'], function( Backbone, Collection ) { | |
| 68 | 'use s trict'; | |
| 69 | ||
| 70 | // abs tract-coll ection and abstract- model shou ld be used when you are commun icating wi th the API | |
| 71 | // oth erwise, an normal Ba ckbone.Col lection/Mo del is fin e. | |
| 72 | ||
| 73 | // You can custo mize your collection s and mode ls all you want | |
| 74 | var Mo del = Back bone.Model .extend({ | |
| 75 | ||
| 76 | // not neede d but shou ld probabl y set this when poss ible | |
| 77 | // 'value' s hould corr espond to the form ' value' | |
| 78 | id Attribute: 'value' | |
| 79 | ||
| 80 | /* .. */ | |
| 81 | }); | |
| 82 | ||
| 83 | // The abstract collection and model is writte n in such a way so t hat it sho uld | |
| 84 | // be safe to do anything you want w ith it wit hout worry ing about breaking i ts functio nality | |
| 85 | // tre at them li ke any oth er backbon e model or collectio n. | |
| 86 | return Collectio n.extend({ | |
| 87 | re sourceName : 'whateve r-resource s', | |
| 88 | mo del: Model | |
| 89 | /* .. */ | |
| 90 | }) | |
| 91 | }); | |
| 92 | ||
| 93 | ||
| 94 | // layout. js | |
| 95 | define(['m arionette' , 'this/vi ew/collect ion', 'vie w/section' , 'view/he ader'], fu nction(Mn, Collectio n, Section , Header) { | |
| 96 | 'use s trict'; | |
| 97 | ||
| 98 | return Mn.View.e xtend({ | |
| 99 | re gion: { | |
| 100 | header: '#header', | |
| 101 | section: '#section ' | |
| 102 | }, | |
| 103 | ||
| 104 | in itialize: function() { | |
| 105 | this.col lection = new Collec tion(); | |
| 106 | this.lis tenTo(this .collectio n, 'fetch: success', this.onSuc cess); | |
| 107 | this.col lection.fe tch(); | |
| 108 | }, | |
| 109 | ||
| 110 | // Anything extending the abstra ct collect ion or mod el will fi re a succe ss or erro r event | |
| 111 | // When the request co mes back f rom the se rver | |
| 112 | on Success: f unction() { | |
| 113 | var regi on = this. getRegion( 'section') ; | |
| 114 | region.s how(new Se ction({ | |
| 115 | mode l: this.mo del, | |
| 116 | ||
| 117 | // t his.collec tion is re served in the Questi onView :( | |
| 118 | // a ny name is fine here , and in m ost case ' data' is t oo generic | |
| 119 | data : this.col lection | |
| 120 | })) | |
| 121 | }, | |
| 122 | ||
| 123 | // Header ca n be shown without w aiting on anything e lse | |
| 124 | on Render: fu nction() { | |
| 125 | var regi on = this. getRegion( 'header'); | |
| 126 | region.s how(new He ader()) | |
| 127 | } | |
| 128 | }); | |
| 129 | ||
| 130 | }); | |
| 131 | ||
| 132 | ||
| 133 | // section .js | |
| 134 | define(['q uestion-vi ew'], func tion(QV) { | |
| 135 | 'use s trict'; | |
| 136 | ||
| 137 | return QV.extend ({ | |
| 138 | co llectionEv ents: { | |
| 139 | 'change:va lue': 'upd ateF DNS el' | |
| 140 | }, | |
| 141 | ||
| 142 | // Normal Se tup | |
| 143 | ||
| 144 | updateF DNS el: functi on(model) { | |
| 145 | var id = model.get ('value'); | |
| 146 | ||
| 147 | // this. data hold the collec tion from the layout -view | |
| 148 | var coll ectionMode l = this.d ata.get(id ) | |
| 149 | ||
| 150 | // Set t he entire model, and not just the value | |
| 151 | this.mod el.set('wh atever', c ollectionM odel); | |
| 152 | // The s pecific va lues neede d for writ eback shou ld be extr acted | |
| 153 | // durin g writebac k. This i s better b ecause it keeps each views inf ormation | |
| 154 | // uniqu e, while a t the same time offe r access t o any othe r view tha t may need that | |
| 155 | // same informatio n. | |
| 156 | } | |
| 157 | }) | |
| 158 | }); | |
| 159 | ``` |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.