Changeset 293
- Timestamp:
- 04/04/08 11:25:30 (6 months ago)
- Files:
-
- incubator/vasco/files/css/style.css (modified) (1 diff)
- incubator/vasco/files/index.html (modified) (2 diffs)
- incubator/vasco/files/js/extensions.js (modified) (1 diff)
- incubator/vasco/files/js/vasco.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
incubator/vasco/files/css/style.css
r288 r293 267 267 padding: 0; 268 268 } 269 270 271 /**** Documentation ***/ 272 .docs { 273 border: solid 1px gray; 274 background-color: khaki; 275 font-size: 1.5em; 276 } incubator/vasco/files/index.html
r288 r293 38 38 <ul> 39 39 <li><a href="#" id="routes" class="tab current">routes</a></li> 40 <li><a href="#" id="controllers" class="tab">controllers</a></li>41 40 <li><a href="#" id="docs" class="tab">docs</a></li> 42 <li><a href="#" id="contact" class="tab">contact</a></li>43 41 </ul> 44 42 </div> … … 59 57 </div> 60 58 </div> 61 <div id="controllers_content" style="display:none;" class="content_panel">62 <h1>CONTROLLERS</h1>63 </div>64 59 <div id="docs_content" style="display:none;" class="content_panel"> 65 60 <h1>DOCS</h1> 66 </div> 67 <div id="contact_content" style="display:none;" class="content_panel"> 68 <h1>CONTACT</h1> 61 <div class="docs"> 62 <pre> 63 Vasco 64 ===== 65 66 Vasco is a simple UI for exploring the RESTful routes configured for your application. 67 To install the plugin: 68 69 > script/plugin install http://XXX.XXX.XXX/XXX/XXX 70 71 After installation, the plugin will create a folder in your 72 application's /public directory called vasco. Before you can use 73 the UI, you have to seed it with your application's current data. 74 (It helps if you run rake db:fixtures:load first so that Vasco can suggest IDs for you.) 75 76 > rake vasco:explore 77 78 To use the route explorer, start up your application and point 79 your browser to: 80 81 http://localhost:3000/vasco 82 83 From here, you will be provided with links to all registered 84 RESTful routes. You can perform GETs, POSTs, PUTs and DELETEs. 85 The UI will know not only the routes, but the schema for each 86 model in your application. If there is a standard Rails configuration 87 linking a controller to a model, the UI will present you with a 88 form you can use to fill out model details for POSTs and PUTs, 89 and will even provide default IDs if you have seeded the database 90 with fixture data already. 91 92 93 94 Copyright (c) 2008 Relevance, Inc., released under the MIT license 95 </pre> 96 </div> 69 97 </div> 70 98 incubator/vasco/files/js/extensions.js
r288 r293 55 55 Rest.Request = Class.create({ 56 56 initialize: function(url, options) { 57 default_options = Rest.Request.defaultOptions;57 default_options = Object.extend({}, Rest.Request.defaultOptions); 58 58 final_options = Object.extend(default_options, options); 59 59 console.log(url); incubator/vasco/files/js/vasco.js
r288 r293 1 1 Event.observe(window, 'load', function() { 2 2 new Vasco.RoutesTable(); 3 new Vasco.ControllerList();4 3 new Vasco.Tabs(".tab", ".content_panel"); 5 4 }); 6 5 7 Object.extend(Rest.Request, { 8 defaultOptions: {method: "GET", 6 Object.extend(Rest.Request.defaultOptions, {method: "GET", 9 7 onComplete: function(xhr) { 10 8 $('request').innerHTML = createXhrRequestString(xhr.request); … … 16 14 onFailure: function(xhr) { 17 15 $('response').innerHTML = "<h2>FAILURE</h2>" + xhr.responseText.escapeHTML(); 18 } }16 } 19 17 }); 20 18 … … 50 48 }); 51 49 52 53 Vasco.ControllerList = Class.create({54 initialize: function() {55 results = "<ul>";56 vascoControllers.each(function(controller) {57 results += "<li>" + controller + "</li>";58 });59 results += "</ul>";60 $('controllers_content').innerHTML = results;61 }62 });63 50 64 51 Vasco.RouteLink = Class.create({ … … 127 114 form += "</table></form>"; 128 115 Dialog.confirm("Update with: " + form, 129 {className: "alphacube", width:500, height:500, okLabel: "c lose",116 {className: "alphacube", width:500, height:500, okLabel: "commit", 130 117 ok:function(win) { 131 118 new Rest.Create("http://localhost:3000" + $('url_from_win').value + ".xml", {postBody: formToXML('form_from_window', $('type_from_window').value)}); … … 145 132 }); 146 133 form += "</table></form>"; 147 Dialog.confirm("Update with: " + form, {className: "alphacube", width:500, height:500, okLabel: "c lose", ok:function(win) {134 Dialog.confirm("Update with: " + form, {className: "alphacube", width:500, height:500, okLabel: "commit", ok:function(win) { 148 135 new Rest.Update("http://localhost:3000" + $('url_from_win').value.replace(":id", $('id').value) + ".xml", {postBody: formToXML('form_from_window', $('type_from_window').value)}); 149 136 return true; … … 153 140 154 141 function getIdFromWindow(route_url, suggested_match) { 155 Dialog.confirm("ID to try: <input type='text' id='id_from_win' value='" + suggested_match + "'/><input type='hidden' id='url_from_win' value='" + route_url + "'/>", {className: "alphacube", width:300, height:100, okLabel: "c lose", ok:function(win) {142 Dialog.confirm("ID to try: <input type='text' id='id_from_win' value='" + suggested_match + "'/><input type='hidden' id='url_from_win' value='" + route_url + "'/>", {className: "alphacube", width:300, height:100, okLabel: "commit", ok:function(win) { 156 143 new Rest.Request("http://localhost:3000" + $('url_from_win').value.replace(":id", $('id_from_win').value) + ".xml"); 157 144 return true; … … 160 147 161 148 function deleteIdFromWindow(route_url, suggested_match) { 162 Dialog.confirm("ID to try: <input type='text' id='id_from_win' value='" + suggested_match + "'/><input type='hidden' id='url_from_win' value='" + route_url + "'/>", {className: "alphacube", width:300, height:100, okLabel: "c lose", ok:function(win) {149 Dialog.confirm("ID to try: <input type='text' id='id_from_win' value='" + suggested_match + "'/><input type='hidden' id='url_from_win' value='" + route_url + "'/>", {className: "alphacube", width:300, height:100, okLabel: "commit", ok:function(win) { 163 150 new Rest.Delete("http://localhost:3000" + $('url_from_win').value.replace(":id", $('id_from_win').value) + ".xml"); 164 151 return true;
