Changeset 169:a4e64e748072
- Timestamp:
- 08/21/08 19:30:55 (2 years ago)
- Branch:
- default
- convert_revision:
- svn:10edda23-d834-0410-9182-b00384516d49/trunk@179
- Location:
- microfacts/public
- Files:
-
- 7 added
- 4 removed
- 4 modified
-
behaviour/app/controllers/geochronopage_controller.js (modified) (1 diff)
-
behaviour/app/views/mapview.js (added)
-
behaviour/app/views/timelineview.js (added)
-
behaviour/lib/domainobject.js (modified) (2 diffs)
-
behaviour/lib/mapcontroller.js (deleted)
-
behaviour/lib/moovc.js (added)
-
behaviour/lib/timelinecontroller.js (deleted)
-
behaviour/load.js (modified) (7 diffs)
-
test/index.html (modified) (3 diffs)
-
test/spec/domain_data.js (added)
-
test/spec/geochronopage_controller_spec.js (added)
-
test/spec/mapcontroller_spec.js (deleted)
-
test/spec/mapview_spec.js (added)
-
test/spec/timelinecontroller_spec.js (deleted)
-
test/spec/timelineview_spec.js (added)
Legend:
- Unmodified
- Added
- Removed
-
microfacts/public/behaviour/app/controllers/geochronopage_controller.js
r162 r169 1 1 var GeochronoPageController = new Class({ 2 Extends: Controller, 2 Extends: BaseController, 3 name: 'GeochronoPageController', 3 4 4 onFactletSelect: function(factlet) { 5 console.log('GeoChronoPageController: saw factletSelect event'); 6 console.log(factlet); 7 this.fireEvent('factletSelect', factlet); 8 }, 5 setupViews: function (element) { 6 this.element.getElements('#map').each(function (el) { 7 this.log("Creating map view for element:"); 8 this.log(el); 9 var view = new MapView(el); 10 this.addView(view); 11 }, this); 12 this.element.getElements('#timeline').each(function (el) { 13 this.log("Creating timeline view for element:"); 14 this.log(el); 15 var view = new TimelineView(el); 16 this.addView(view); 17 }, this); 18 this.log('Done'); 19 20 this.model.startWithThread( 21 payloadThread, // From HTML doc. 22 payloadThreadFactlets // From HTML doc. 23 ); 24 } 9 25 10 onFactletUnselect: function(factlet) {11 console.log('GeoChronoPageController: saw factletUnselect event');12 console.log(factlet);13 this.fireEvent('factletUnselect', factlet);14 },15 16 initialize: function (element) {17 this.initModel();18 console.log('GeochronoPageController: initialize');19 this.controllers = [];20 element.getElements('#map').each(function (el) {21 console.log("Constructing map controller for element:");22 console.log(el);23 var controller = new MapController(el);24 this.addController(controller);25 }, this);26 element.getElements('#timeline').each(function (el) {27 console.log("Constructing timeline controller for element:");28 console.log(el);29 var controller = new TimelineController(el);30 this.addController(controller);31 }, this);32 console.log('Done');33 34 this.model.startWithThread(payloadThread, payloadThreadFactlets);35 },36 37 initModel: function (payloadThread) {38 this.model = new Model();39 this.model.addEvent('threadStart', this.onThreadStart.bind(this));40 },41 42 onThreadStart: function() {43 console.log('ThreadPageController: onThreadStart');44 console.log(arguments);45 this.fireEvent('threadStart', arguments);46 },47 48 addController: function(controller) {49 console.log("Adding controller:");50 console.log(controller);51 this.controllers.push(controller);52 this.addEvent('threadStart', controller.onThreadStart.bind(controller));53 controller.addEvent('factletSelect', this.onFactletSelect.bind(this));54 this.addEvent('factletSelect', controller.onFactletSelect.bind(controller));55 controller.addEvent('factletUnselect', this.onFactletUnselect.bind(this));56 this.addEvent('factletUnselect', controller.onFactletUnselect.bind(controller));57 }58 26 }); 59 27 -
microfacts/public/behaviour/lib/domainobject.js
r153 r169 1 1 var DomainObject = new Class({ 2 Implements: [Events, Options],2 Extends: BaseModel, 3 3 4 4 options: { … … 59 59 60 60 requestFailure: function (json) { 61 console.error("request failed!");62 console.error(arguments);61 this.error("request failed!"); 62 this.error(arguments); 63 63 } 64 64 }); 65 66 // TODO: Move below functionality to Model. 65 67 66 68 DomainObject.Register = { 'Thread': {}, 'Factlet': {} }; -
microfacts/public/behaviour/load.js
r163 r169 36 36 }); 37 37 38 loader.addModule({ 39 name: "simile", 40 type: "js", 41 path: "vendor/simile/timeline/timeline-api.js", 42 varName: "Timeline" 43 }); 44 38 45 // ==================================================== 39 46 // = Base classes, DomainObject, View, Controller, Delegator = … … 41 48 42 49 loader.addModule({ 50 name: "moovc", 51 type: "js", 52 path: "lib/moovc.js?" + Math.random(), 53 requires: ['mootools'], 54 varName: "LayerBase" 55 }); 56 57 loader.addModule({ 43 58 name: "model", 44 59 type: "js", 45 60 path: "app/models/model.js?" + Math.random(), 46 requires: ['moo tools'],61 requires: ['moovc'], 47 62 varName: "Model" 48 63 }); … … 52 67 type: "js", 53 68 path: "lib/domainobject.js?" + Math.random(), 54 requires: ['moo tools'],69 requires: ['moovc'], 55 70 varName: "DomainObject" 56 71 }); … … 60 75 type: "js", 61 76 path: "lib/view.js?" + Math.random(), 62 requires: ['moo tools'],77 requires: ['moovc'], 63 78 varName: "View" 64 79 }); … … 121 136 }); 122 137 138 loader.addModule({ 139 name: "mapview", 140 type: "js", 141 path: "app/views/mapview.js?" + Math.random(), 142 requires: ['moovc', 'openlayers'], 143 varName: "MapView" 144 }); 145 146 loader.addModule({ 147 name: "timelineview", 148 type: "js", 149 path: "app/views/timelineview.js?" + Math.random(), 150 requires: ['moovc', 'simile'], 151 varName: "TimelineView" 152 }); 153 123 154 // =============== 124 155 // = Controllers = … … 163 194 164 195 loader.addModule({ 165 name: "simile",166 type: "js",167 path: "vendor/simile/timeline/timeline-api.js",168 varName: "Timeline"169 });170 171 loader.addModule({172 name: "mapcontroller",173 type: "js",174 path: "lib/mapcontroller.js?" + Math.random(),175 requires: ['controller', 'openlayers'],176 varName: "MapController"177 });178 179 loader.addModule({180 name: "timelinecontroller",181 type: "js",182 path: "lib/timelinecontroller.js?" + Math.random(),183 requires: ['mootools', 'simile'],184 varName: "TimelineController"185 });186 187 loader.addModule({188 196 name: "microfacts", 189 197 type: "js", 190 198 path: "app/microfacts.js?" + Math.random(), 191 requires: ['domainobject', 'view', 'controller', 'microfactscontroller', 'factletcontroller', 'threadfactletscontroller', 'map controller', 'timelinecontroller'],199 requires: ['domainobject', 'view', 'controller', 'microfactscontroller', 'factletcontroller', 'threadfactletscontroller', 'mapview', 'timelineview', 'geochronopagecontroller'], 192 200 varName: "Microfacts" 193 201 }); … … 205 213 type: "js", 206 214 path: "app/controllers/geochronopage_controller.js?" + Math.random(), 207 requires: ['mo del', 'domainobject', 'view', 'controller', 'thread', 'factlet', 'mapcontroller', 'timelinecontroller'],215 requires: ['moovc', 'model', 'domainobject', 'view', 'controller', 'thread', 'factlet', 'mapview', 'timelineview'], 208 216 varName: "GeochronoPageController" 209 217 }); -
microfacts/public/test/index.html
r166 r169 30 30 position: absolute; 31 31 bottom: 0; 32 visibility: hidden; 32 33 } 33 34 </style> … … 49 50 </script> 50 51 52 <script type="text/javascript" src="spec/domain_data.js?123"></script> 51 53 <script type="text/javascript" src="spec/model_spec.js?123"></script> 52 54 <script type="text/javascript" src="spec/controller_spec.js?123"></script> 53 55 <script type="text/javascript" src="spec/view_spec.js?123"></script> 56 <script type="text/javascript" src="spec/mapview_spec.js?123"></script> 57 <script type="text/javascript" src="spec/timelineview_spec.js?123"></script> 58 <script type="text/javascript" src="spec/geochronopage_controller_spec.js?123"></script> 59 <!-- 54 60 <script type="text/javascript" src="spec/threadfactletscontroller_spec.js?123"></script> 55 <!--56 <script type="text/javascript" src="spec/mapcontroller_spec.js?123"></script>57 <script type="text/javascript" src="spec/timelinecontroller_spec.js?123"></script>58 61 --> 59 62 … … 98 101 </div> 99 102 </div> 100 103 104 <script type="text/javascript" charset="utf-8"> 105 var payloadThread = {"factlets": [1030, 1031, 1032], "id": 364, "title": "The Bloomsbury Group"}; 106 var payloadThreadFactlets = [{"end": "1941-03-28 00:00:00", "description": "(Adeline) Virginia Woolf (n\u00e9e Stephen; 25 January 1882 \u2013 28 March 1941) was an English novelist and essayist regarded as one of the foremost modernist literary figures of the twentieth century.\n\nDuring the interwar period, Woolf was a significant figure in London literary society and a member of the Bloomsbury Group. Her most famous works include the novels Mrs Dalloway (1925), To the Lighthouse (1927), and Orlando (1928), and the book-length essay A Room of One's Own (1929) with its famous dictum, 'a woman must have money and a room of her own if she is to write fiction.'", "title": "Virginia Woolf", "start": "1882-01-25 00:00:00", "location": {"type": "Point", "coordinates": [-0.12553, 51.50842]}, "id": 1030}, {"end": "1932-01-21 00:00:00", "description": "British writer and critic. He is best known for establishing a new form of biography in which psychological insight and sympathy are combined with irreverence and wit. His 1921 biography Queen Victoria was awarded the James Tait Black Memorial Prize.", "title": "Lytton Strachey", "start": "1880-03-01 00:00:00", "location": null, "id": 1031}, {"end": "1946-04-21 00:00:00", "description": "John Maynard Keynes, 1st Baron Keynes (Styled: The Rt. Hon. The Lord Keynes), CB (5 June 1883 \u2013 21 April 1946) was a British economist whose ideas, called Keynesian economics, had a major impact on modern economic and political theory as well as on many governments' fiscal policies. He advocated interventionist government policy, by which the government would use fiscal and monetary measures to mitigate the adverse effects of economic recessions, depressions and booms. He is one of the fathers of modern theoretical macroeconomics.", "title": "John Maynard Keynes", "start": "1883-06-05 00:00:00", "location": null, "id": 1032}]; 107 </script> 108 101 109 </body> 102 110 </html>
