Permalink
Browse files

Using new RequireJS plugin, optimized stylesheets

  • Loading branch information...
1 parent d844221 commit 6bac983ef02ec63bbbbe3d5fe80c649dc4579818 @jakefeasel committed Sep 17, 2012
Showing with 4,241 additions and 12 deletions.
  1. +11 −0 javascripts_min/build.txt
  2. +1 −0 javascripts_min/fiddle_backbone/app.js
  3. +1 −0 javascripts_min/fiddle_backbone/models/DBType.js
  4. +1 −0 javascripts_min/fiddle_backbone/models/DBTypesList.js
  5. +1 −0 javascripts_min/fiddle_backbone/models/MyFiddleHistory.js
  6. +1 −0 javascripts_min/fiddle_backbone/models/Query.js
  7. +1 −0 javascripts_min/fiddle_backbone/models/SchemaDef.js
  8. +1 −0 javascripts_min/fiddle_backbone/models/UsedFiddle.js
  9. +1 −0 javascripts_min/fiddle_backbone/router.js
  10. +8 −0 javascripts_min/fiddle_backbone/templates/dbTypes.html
  11. +50 −0 javascripts_min/fiddle_backbone/templates/queryPlaintextOutput.html
  12. +59 −0 javascripts_min/fiddle_backbone/templates/queryTabularOutput.html
  13. +13 −0 javascripts_min/fiddle_backbone/templates/schemaBrowser.html
  14. +5 −0 javascripts_min/fiddle_backbone/templates/schemaOutput.html
  15. +1 −0 javascripts_min/fiddle_backbone/views/DBTypesList.js
  16. +1 −0 javascripts_min/fiddle_backbone/views/Query.js
  17. +1 −0 javascripts_min/fiddle_backbone/views/SchemaDef.js
  18. +6 −0 javascripts_min/libs/backbone.js
  19. +20 −0 javascripts_min/libs/bootstrap/bootstrap-collapse.js
  20. +20 −0 javascripts_min/libs/bootstrap/bootstrap-dropdown.js
  21. +20 −0 javascripts_min/libs/bootstrap/bootstrap-modal.js
  22. +20 −0 javascripts_min/libs/bootstrap/bootstrap-popover.js
  23. +20 −0 javascripts_min/libs/bootstrap/bootstrap-tab.js
  24. +21 −0 javascripts_min/libs/bootstrap/bootstrap-tooltip.js
  25. +1 −0 javascripts_min/libs/browserEngines/engines.js
  26. +1 −0 javascripts_min/libs/browserEngines/sqlite_driver.js
  27. +1 −0 javascripts_min/libs/browserEngines/sqljs_driver.js
  28. +1 −0 javascripts_min/libs/browserEngines/websql_driver.js
  29. +1 −0 javascripts_min/libs/codemirror/codemirror.js
  30. +1 −0 javascripts_min/libs/codemirror/mode/mysql/mysql.js
  31. +1 −0 javascripts_min/libs/codemirror/mode/plsql/plsql.js
  32. +15 −0 javascripts_min/libs/date.format.js
  33. +1 −0 javascripts_min/libs/ddl_builder.js
  34. +1 −0 javascripts_min/libs/fiddleEditor.js
  35. +1 −0 javascripts_min/libs/handlebars-1.0.0.beta.6.js
  36. +1 −0 javascripts_min/libs/handlebarsHelpers/divider_display.js
  37. +1 −0 javascripts_min/libs/handlebarsHelpers/each_simple_value_with_index.js
  38. +1 −0 javascripts_min/libs/handlebarsHelpers/each_with_index.js
  39. +1 −0 javascripts_min/libs/handlebarsHelpers/result_display.js
  40. +1 −0 javascripts_min/libs/handlebarsHelpers/result_display_padded.js
  41. +1 −0 javascripts_min/libs/idselector.js
  42. +15 −0 javascripts_min/libs/jquery/jquery.blockUI.js
  43. +11 −0 javascripts_min/libs/jquery/jquery.cookie.js
  44. +24 −0 javascripts_min/libs/jquery/jquery.js
  45. +1 −0 javascripts_min/libs/json2.js
  46. +1 −0 javascripts_min/libs/renderTerminator.js
  47. +9 −0 javascripts_min/libs/underscore.js
  48. +1 −0 javascripts_min/libs/xplans/mssql.js
  49. +1 −0 javascripts_min/libs/xplans/oracle/flashver.js
  50. +1 −0 javascripts_min/libs/xplans/oracle/loadswf.js
  51. +7 −1 javascripts_min/main.js
  52. +7 −0 javascripts_min/text.js
  53. BIN plugins/{RequireJS-0.1.1.zip → RequireJS-0.2.zip}
  54. +171 −5 plugins/RequireJS/RequireJS.cfc
  55. +3,657 −0 plugins/RequireJS/less-rhino-1.3.0.js
  56. +5 −0 stylesheets_min/_index.css
  57. +1 −0 stylesheets_min/bootstrap-responsive.min.css
  58. +1 −0 stylesheets_min/bootstrap.css
  59. +1 −0 stylesheets_min/codemirror.css
  60. +1 −0 stylesheets_min/fiddle.css
  61. +1 −0 stylesheets_min/qp.css
  62. +1 −0 stylesheets_min/test.css
  63. +9 −6 views/layout.cfm
@@ -17,15 +17,26 @@ fiddle_backbone/models/DBTypesList.js
fiddle_backbone/models/SchemaDef.js
fiddle_backbone/models/Query.js
libs/handlebars-1.0.0.beta.6.js
+text.js
+text!fiddle_backbone/templates/dbTypes.html
fiddle_backbone/views/DBTypesList.js
libs/codemirror/codemirror.js
libs/codemirror/mode/mysql/mysql.js
libs/fiddleEditor.js
libs/renderTerminator.js
+text!fiddle_backbone/templates/schemaOutput.html
+text!fiddle_backbone/templates/schemaBrowser.html
fiddle_backbone/views/SchemaDef.js
libs/xplans/oracle/flashver.js
libs/xplans/oracle/loadswf.js
libs/xplans/mssql.js
+text!fiddle_backbone/templates/queryTabularOutput.html
+text!fiddle_backbone/templates/queryPlaintextOutput.html
+libs/handlebarsHelpers/divider_display.js
+libs/handlebarsHelpers/each_simple_value_with_index.js
+libs/handlebarsHelpers/each_with_index.js
+libs/handlebarsHelpers/result_display_padded.js
+libs/handlebarsHelpers/result_display.js
fiddle_backbone/views/Query.js
fiddle_backbone/router.js
libs/jquery/jquery.blockUI.js
@@ -0,0 +1 @@
+define(["BrowserEngines/engines","fiddle_backbone/models/UsedFiddle","fiddle_backbone/models/MyFiddleHistory","fiddle_backbone/models/DBTypesList","fiddle_backbone/models/SchemaDef","fiddle_backbone/models/Query","fiddle_backbone/views/DBTypesList","fiddle_backbone/views/SchemaDef","fiddle_backbone/views/Query","fiddle_backbone/router","libs/renderTerminator","libs/jquery/jquery.blockUI","libs/jquery/jquery.cookie","Bootstrap/bootstrap-collapse","Bootstrap/bootstrap-tab","Bootstrap/bootstrap-dropdown","Bootstrap/bootstrap-modal","Bootstrap/bootstrap-tooltip","Bootstrap/bootstrap-popover"],function(e,t,n,r,i,s,o,u,a,f,l){var c=function(c){var h={},p=new n,d=new r,v=new i({browserEngines:e}),m=new s({schemaDef:v}),g=new o({el:$("#db_type_id")[0],collection:d}),y=new u({id:"schema_ddl",model:v,output_el:$("#output"),browser_el:$("#browser")}),b=new a({id:"sql",model:m,output_el:$("#output")});d.on("change",function(){g.render(),v.has("dbType")&&v.set("ready",v.get("dbType").id==this.getSelectedType().id)}),v.on("change",function(){this.hasChanged("ready")&&y.updateDependents(),this.hasChanged("errorMessage")&&y.renderOutput(),this.hasChanged("schema_structure")&&y.renderSchemaBrowser()}),v.on("reloaded",function(){this.set("dbType",d.getSelectedType()),y.render()}),m.on("reloaded",function(){this.set({pendingChanges:!1},{silent:!0}),b.render()}),v.on("built failed",function(){$("#buildSchema label").prop("disabled",!1),$("#buildSchema label").html($("#buildSchema label").data("originalValue")),y.renderOutput(),y.renderSchemaBrowser()}),m.on("change",function(){(this.hasChanged("sql")||this.hasChanged("statement_separator"))&&!this.hasChanged("id")&&!this.get("pendingChanges")&&this.set({pendingChanges:!0},{silent:!0})}),m.on("executed",function(){var e=$(".runQuery");e.prop("disabled",!1),e.html(e.data("originalValue")),this.set({pendingChanges:!1},{silent:!0}),b.renderOutput()}),$("#buildSchema").click(function(e){var t=$("label",this);e.preventDefault();if(t.prop("disabled"))return!1;t.data("originalValue",t.html()),t.prop("disabled",!0).text("Building Schema..."),v.build(d)});var w=function(e){var t=$(".runQuery");e.preventDefault();if(t.prop("disabled"))return!1;t.data("originalValue",t.html()),t.prop("disabled",!0).text("Executing SQL..."),b.checkForSelectedText(),m.execute()};return $(".runQuery").click(w),$(document).keyup(function(e){e.keyCode==116&&(e.preventDefault(),w(e))}),$("#runQueryOptions li a").click(function(e){e.preventDefault(),b.setOutputType(this.id),b.renderOutput()}),$("#queryPrettify").click(function(e){var t=$(this);t.attr("disabled",!0),e.preventDefault(),$.post("index.cfm/proxy/formatSQL",{sql:m.get("sql")},function(e){m.set({sql:e}),m.trigger("reloaded"),m.set({pendingChanges:!0}),t.attr("disabled",!1)})}),$(".terminator .dropdown-menu a").on("click",function(e){e.preventDefault(),l($(this).closest(".panel"),$(this).attr("href")),$(this).closest(".panel").hasClass("schema")?y.handleSchemaChange():m.set({pendingChanges:!0,statement_separator:$(this).attr("href")},{silent:!0})}),$(window).bind("beforeunload",function(){if(m.get("pendingChanges"))return"Warning! You have made changes to your query which will be lost. Continue?'"}),d.on("reset",function(){h=f.initialize(d,v,m,p,g),this.length&&!this.getSelectedType()&&this.setSelectedType(this.first().id,!0),g.render(),y.render(),b.render()}),p.on("change reset remove",function(){localStorage&&localStorage.setItem("fiddleHistory",JSON.stringify(this.toJSON()))}),$("#clear").click(function(e){e.preventDefault(),v.reset(),m.reset(),h.navigate("!"+d.getSelectedType().id,{trigger:!0})}),$("#sample").click(function(e){e.preventDefault(),h.navigate("!"+d.getSelectedType().get("sample_fragment"),{trigger:!0})}),d.on("change",function(){g.render(),m.id&&v.get("short_code").length&&v.get("dbType").id==this.getSelectedType().id?h.navigate("!"+this.getSelectedType().id+"/"+v.get("short_code")+"/"+m.id):v.get("short_code").length&&v.get("dbType").id==this.getSelectedType().id?h.navigate("!"+this.getSelectedType().id+"/"+v.get("short_code")):h.navigate("!"+this.getSelectedType().id)}),v.on("built",function(){p.insert(new t({fragment:"!"+this.get("dbType").id+"/"+this.get("short_code")})),h.navigate("!"+this.get("dbType").id+"/"+this.get("short_code"))}),m.on("executed",function(){var e=this.get("schemaDef");p.insert(new t({fragment:"!"+e.get("dbType").id+"/"+e.get("short_code")+"/"+this.id})),h.navigate("!"+e.get("dbType").id+"/"+e.get("short_code")+"/"+this.id)}),d.reset(c),{dbTypes:d,schemaDef:v,schemaDefView:y,queryView:b}};return{initialize:c}})
@@ -0,0 +1 @@
+define(["Backbone"],function(e){var t=e.Model.extend({defaults:{sample_fragment:"",notes:"",simple_name:"",full_name:"",selected:!1,context:"host",className:""}});return t})
@@ -0,0 +1 @@
+define(["Backbone","fiddle_backbone/models/DBType"],function(e,t){var n=e.Collection.extend({model:t,getSelectedType:function(){var e=this.filter(function(e){return e.get("selected")});return e.length?e[0]:!1},setSelectedType:function(e,t){this.each(function(t){t.set({selected:t.id==e},{silent:!0})}),t||this.trigger("change")}});return n})
@@ -0,0 +1 @@
+define(["Backbone","fiddle_backbone/models/UsedFiddle"],function(e,t){var n=e.Collection.extend({model:t,comparator:function(e,t){return e.get("last_used")==t.get("last_used")?0:e.get("last_used")>t.get("last_used")?-1:1},insert:function(e){if(!$("#user_choices",this).length){var t=this.find(function(t){return t.get("fragment")==e.get("fragment")});t?(t.set("last_used",e.get("last_used")),this.sort()):this.add(e),this.trigger("change")}},initialize:function(){try{if(localStorage){var e=localStorage.getItem("fiddleHistory");e&&e.length&&this.add($.parseJSON(e))}}catch(t){}}});return n})
@@ -0,0 +1 @@
+define(["jQuery","Backbone"],function(e,t){var n=t.Model.extend({defaults:{id:0,sql:"",sets:[],pendingChanges:!1,statement_separator:";"},reset:function(){this.set(this.defaults),this.trigger("reloaded")},execute:function(){var t=this;if(!this.has("schemaDef")||!this.get("schemaDef").has("dbType")||!this.get("schemaDef").get("ready"))return!1;e.ajax({type:"POST",url:"index.cfm/fiddles/runQuery",data:{db_type_id:this.get("schemaDef").get("dbType").id,schema_short_code:this.get("schemaDef").get("short_code"),statement_separator:this.get("statement_separator"),sql:this.get("sql")},dataType:"json",success:function(e,n,r){t.get("schemaDef").get("dbType").get("context")=="browser"?t.get("schemaDef").get("browserEngines")[t.get("schemaDef").get("dbType").get("className")].executeQuery({sql:t.get("sql"),statement_separator:t.get("statement_separator"),success:function(n){t.set({id:e.ID,sets:n}),t.trigger("executed")},error:function(e){t.set({sets:[{SUCCEEDED:!1,ERRORMESSAGE:e}]}),t.trigger("executed")}}):t.set({id:e.ID,sets:e.sets})},error:function(e,n,r){t.set({sets:[]})},complete:function(e,n){t.trigger("executed")}})}});return n})
@@ -0,0 +1 @@
+define(["Backbone"],function(e){var t=e.Model.extend({defaults:{ddl:"",short_code:"",simple_name:"",full_name:"",valid:!0,errorMessage:"",loading:!1,ready:!1,schema_structure:[],statement_separator:";",browserEngines:{}},reset:function(){this.set(this.defaults),this.trigger("reloaded")},build:function(e){var t=e.getSelectedType(),n=this;if(!t)return!1;(!this.has("dbType")||this.get("dbType").id!=t.id)&&this.set("dbType",t),$.ajax({type:"POST",url:"index.cfm/fiddles/createSchema",data:{statement_separator:this.get("statement_separator"),db_type_id:this.get("dbType").id,schema_ddl:this.get("ddl")},dataType:"json",success:function(e,r,i){e.short_code?t.get("context")=="browser"?n.get("browserEngines")[t.get("className")].buildSchema({short_code:$.trim(e.short_code),statement_separator:n.get("statement_separator"),ddl:n.get("ddl"),success:function(){n.set({short_code:$.trim(e.short_code),ready:!0,valid:!0,errorMessage:""}),n.get("browserEngines")[t.get("className")].getSchemaStructure({callback:function(e){n.set({schema_structure:e}),n.trigger("built")}})},error:function(t){n.set({short_code:$.trim(e.short_code),ready:!1,valid:!1,errorMessage:t,schema_structure:[]}),n.trigger("failed")}}):(n.set({short_code:$.trim(e.short_code),ready:!0,valid:!0,errorMessage:"",schema_structure:e.schema_structure}),n.trigger("built")):(n.set({short_code:"",ready:!1,valid:!1,errorMessage:e.error,schema_structure:[]}),n.trigger("failed"))},error:function(e,t,r){n.set({short_code:"",ready:!1,valid:!1,errorMessage:r,schema_structure:[]}),n.trigger("failed")}})}});return t})
@@ -0,0 +1 @@
+define(["Backbone"],function(e){var t=e.Model.extend({defaults:{fragment:"",full_name:"",ddl:"",sql:""},initialize:function(){this.set("last_used",new Date)}});return t})
@@ -0,0 +1 @@
+define(["jQuery","Underscore","Backbone","libs/renderTerminator","fiddle_backbone/models/UsedFiddle"],function(e,t,n,r,i){var s=function(s,o,u,a,f){var l=n.Router.extend({routes:{"!:db_type_id":"DBType","!:db_type_id/:short_code":"SchemaDef","!:db_type_id/:short_code/:query_id":"Query","!:db_type_id/:short_code/:query_id/:set_id":"SetAnchor"},DBType:function(e){s.setSelectedType(e,!0),f.render()},SchemaDef:function(e,t){this.loadContent(e,"!"+e+"/"+t)},Query:function(e,t,n){this.loadContent(e,"!"+e+"/"+t+"/"+n)},SetAnchor:function(n,r,i,a){var f=function(){e("#set_"+a).length&&(window.scrollTo(0,e("#set_"+a).offset().top-50),e("#set_"+a).addClass("highlight"))};!s.getSelectedType()||s.getSelectedType().get("id")!=n||o.get("short_code")!=r||u.get("id")!=i?(u.bind("reloaded",t.once(f)),this.loadContent(n,"!"+n+"/"+r+"/"+i)):(e(".set").removeClass("highlight"),f())},loadContent:function(n,f){this.DBType(n);if(u.get("pendingChanges")&&!confirm("Warning! You have made changes to your query which will be lost. Continue?'"))return!1;o.set("loading",!0),e(".helpTip").css("display","none"),e("body").block({message:"Loading..."}),e.getJSON("index.cfm/fiddles/loadContent",{fragment:f},function(f){o.set("loading",!1);if(f.short_code){var l=s.getSelectedType();l.get("context")=="browser"?(l.get("className")=="sqljs"&&o.get("browserEngines").websql.nativeSQLite&&confirm("Fiddle originally built with SQL.js, but you have WebSQL available - would you like to use that instead (it'll be faster to load)?")&&(s.setSelectedType(e("#db_type_id a:contains('WebSQL')").closest("li").attr("db_type_id")),l=s.getSelectedType(),o.set({ddl:f.ddl,dbType:l,statement_separator:f.schema_statement_separator}),f.sql&&(u.set({schemaDef:o,sql:f.sql,statement_separator:f.query_statement_separator}),o.on("built",t.once(function(){u.execute()}))),o.build(s)),o.get("browserEngines")[l.get("className")].buildSchema({short_code:e.trim(f.short_code),statement_separator:f.schema_statement_separator,ddl:f.ddl,success:function(){o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!0,errorMessage:"",statement_separator:f.schema_statement_separator,dbType:s.getSelectedType()}),r(e(".panel.schema"),f.schema_statement_separator),f.sql?(a.insert(new i({fragment:"!"+n+"/"+f.short_code+"/"+f.id})),u.set({id:f.id,sql:f.sql,statement_separator:f.query_statement_separator})):a.insert(new i({fragment:"!"+n+"/"+f.short_code})),o.get("browserEngines")[l.get("className")].getSchemaStructure({callback:function(t){o.set({schema_structure:t}),o.trigger("reloaded"),f.sql?o.get("browserEngines")[l.get("className")].executeQuery({sql:f.sql,statement_separator:f.query_statement_separator,success:function(t){u.set({sets:t}),u.trigger("reloaded"),e("body").unblock()},error:function(t){u.set({sets:[]}),u.trigger("reloaded"),e("body").unblock()}}):e("body").unblock()}})},error:function(t){o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!1,errorMessage:t,dbType:s.getSelectedType(),statement_separator:f.schema_statement_separator,schema_structure:[]}),r(e(".panel.schema"),f.schema_statement_separator),f.sql&&(u.set({id:f.id,sql:f.sql,statement_separator:f.query_statement_separator,schemaDef:o}),u.trigger("reloaded")),o.trigger("failed"),o.trigger("reloaded"),e("body").unblock()}})):(o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!0,errorMessage:"",statement_separator:f.schema_statement_separator,schema_structure:f.schema_structure}),r(e(".panel.schema"),f.schema_statement_separator),o.trigger("reloaded"),f.sql?(a.insert(new i({fragment:"!"+n+"/"+f.short_code+"/"+f.id})),u.set({id:f.id,sql:f.sql,sets:f.sets,statement_separator:f.query_statement_separator}),u.trigger("reloaded")):a.insert(new i({fragment:"!"+n+"/"+f.short_code})),e("body").unblock())}else e("body").unblock()})}}),c=new l;return n.history.start({pushState:!1}),c};return{initialize:s}})
@@ -0,0 +1,8 @@
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ {{selectedFullName}} <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ {{#each dbTypes}}
+ <li db_type_id="{{this.id}}" class="{{this.className}}"><a href="#"><i class="icon-tag"></i>{{this.full_name}}</a></li>
+ {{/each}}
+ </ul>
@@ -0,0 +1,50 @@
+ {{#if id}}
+ {{#each_with_index sets}}
+ <div class="set" id="set_{{index}}">
+ {{#if this.RESULTS.DATA.length}}
+ <pre class="results">
+|{{#each_simple_value_with_index this.RESULTS.COLUMNS}} {{result_display_padded ../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}}
+-{{#each_simple_value_with_index this.RESULTS.COLUMNS}}-{{divider_display ../this/RESULTS/COLUMNWIDTHS}}--{{/each_simple_value_with_index}}{{#each this.RESULTS.DATA}}
+|{{#each_simple_value_with_index this}} {{result_display_padded ../../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}}{{/each}}
+ </pre>
+ {{/if}}
+ {{#if this.SUCCEEDED}}
+ <div id="messages_{{index}}" class="alert alert-success database-messages">
+ <i class="icon-ok"></i>
+ Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms
+ {{#if this.EXECUTIONPLAN.DATA.length}}
+ <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a>
+ {{/if}}
+ <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a>
+ </div>
+
+ {{#if this.EXECUTIONPLAN.DATA.length}}
+ <table class="executionPlan table table-bordered">
+ <tr>
+ {{#each this.EXECUTIONPLAN.COLUMNS}}
+ <th>{{this}}</th>
+ {{/each}}
+ </tr>
+ {{#each this.EXECUTIONPLAN.DATA}}
+ <tr>
+ {{#each this}}
+ <td><div style="position:relative">{{{this}}}</div></td>
+ {{/each}}
+ </tr>
+ {{/each}}
+
+ {{#if ../../../schemaDef/dbType/isSQLServer}}
+ <tr>
+ <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a></td>
+ </tr>
+ {{/if}}
+
+ </table>
+ {{/if}}
+
+ {{else}}
+ <div id="messages_{{index}}" class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div>
+ {{/if}}
+ </div>
+ {{/each_with_index}}
+ {{/if}}
@@ -0,0 +1,59 @@
+ {{#if id}}
+ {{#each_with_index sets}}
+ <div class="set" id="set_{{index}}">
+ {{#if this.RESULTS.DATA.length}}
+ <table class="results table table-bordered table-striped">
+ <tr>
+ {{#each this.RESULTS.COLUMNS}}
+ <th>{{this}}</th>
+ {{/each}}
+ </tr>
+ {{#each this.RESULTS.DATA}}
+ <tr>
+ {{#each this}}
+ <td>{{result_display this this}}</td>
+ {{/each}}
+ </tr>
+ {{/each}}
+ </table>
+ {{/if}}
+ {{#if this.SUCCEEDED}}
+ <div id="messages_{{index}}" class="alert alert-success database-messages">
+ <i class="icon-ok"></i>
+ Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms
+ {{#if this.EXECUTIONPLAN.DATA.length}}
+ <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a>
+ {{/if}}
+ <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a>
+ </div>
+
+ {{#if this.EXECUTIONPLAN.DATA.length}}
+ <table class="executionPlan table table-bordered">
+ <tr>
+ {{#each this.EXECUTIONPLAN.COLUMNS}}
+ <th>{{this}}</th>
+ {{/each}}
+ </tr>
+ {{#each this.EXECUTIONPLAN.DATA}}
+ <tr>
+ {{#each this}}
+ <td><div style="position:relative">{{{this}}}</div></td>
+ {{/each}}
+ </tr>
+ {{/each}}
+
+ {{#if ../../../schemaDef/dbType/isSQLServer}}
+ <tr>
+ <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a> | <a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp?ad=201208-sqlfiddle-pe" target="_new">Download SQL Sentry Plan Explorer (free)</a></td>
+ </tr>
+ {{/if}}
+
+ </table>
+ {{/if}}
+
+ {{else}}
+ <div id="messages_{{index}}" class="alert alert-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div>
+ {{/if}}
+ </div>
+ {{/each_with_index}}
+ {{/if}}
@@ -0,0 +1,13 @@
+ <h3>Schema Browser</h3>
+ <ul class="tables">
+ {{#each objects}}
+ <li>
+ <a href="#{{this.table_name}}"><i class="icon-plus"></i> {{this.table_name}}</a> ({{this.table_type}})
+ <ul class="columns">
+ {{#each this.columns}}
+ <li>{{name}} {{type}}</li>
+ {{/each}}
+ </ul>
+ </li>
+ {{/each}}
+ </ul>
@@ -0,0 +1,5 @@
+ {{#if errorMessage}}
+ <div class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{errorMessage}}</div>
+ {{else}}
+ <div class="alert alert-success database-messages"><i class="icon-ok"></i>Schema Ready</div>
+ {{/if}}
@@ -0,0 +1 @@
+define(["jQuery","Backbone","Handlebars","text!fiddle_backbone/templates/dbTypes.html"],function(e,t,n,r){var i=t.View.extend({initialize:function(){this.compiledTemplate=n.compile(r)},events:{"click ul.dropdown-menu li":"clickDBType"},clickDBType:function(t){t.preventDefault(),this.collection.setSelectedType(e(t.currentTarget).attr("db_type_id"))},render:function(){var t=this.collection.getSelectedType();return e(this.el).html(this.compiledTemplate({dbTypes:this.collection.map(function(e){var t=e.toJSON();return t.className=t.selected?"active":"",t}),selectedFullName:t.get("full_name")})),e("#db_type_label_collapsed .navbar-text").text(t.get("full_name")),this}});return i})
Oops, something went wrong.

0 comments on commit 6bac983

Please sign in to comment.