Luke Plant avatar Luke Plant committed 6968f41

Cleanup

Comments (0)

Files changed (4)

static/connections.js

     return connections.join("");
 }
 
-function updateMatrixFromRaw () {
-    var raw = $("#connections-raw").val();
+function updateMatrixFromRaw (raw) {
     var rows = raw.trim().split(/\n/);
     var m = [];
     for (i in rows) {
             alert("There is no data entered yet");
             return;
         }
-        $("#connections-raw").val(getRawConnectionsData());
+        $("#file-data-raw").val(getRawConnectionsData());
         $('#download-container').append('<iframe height="1", width="1" frameborder="0" src="' + $SCRIPT_ROOT + '/download-form/"></iframe>');
     }
 
         xhr.onreadystatechange = function(e) {
             if (this.readyState == 4) {
                 console.log(['xhr upload complete', e]);
-                $("#connections-raw").val(xhr.response);
-                updateMatrixFromRaw();
+                updateMatrixFromRaw(xhr.response);
             }
         };
         xhr.open('post', $SCRIPT_ROOT + "/upload-connections/", true);

templates/download_iframe.html

     $SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
   </script>
   <body>
-    <form method="POST" action="{{ url_for('download_connections') }}">
+    <form method="POST" action="{{ url_for('download_file') }}">
       <textarea name="data"></textarea>
     </form>
   </body>
   <script type="text/javascript">
-    var data = $(window.parent.document).find("#connections-raw").val();
+    var data = $(window.parent.document).find("#file-data-raw").val();
     $('textarea').val(data);
     $('form').submit();
   </script>

templates/index.html

     </div>
 
     <div style="display: none;">
-      <textarea id="connections-raw" rows="20" cols="50"></textarea>
+      <textarea id="file-data-raw" rows="20" cols="50"></textarea>
     </div>
 
     <h2>Parameters</h2>
     return render_template('download_iframe.html')
 
 
-@app.route('/download-connections/', methods=['POST'])
-def download_connections():
+@app.route('/download-file/', methods=['POST'])
+def download_file():
     response = Response(mimetype="text/plain",
                         headers=[("Content-Disposition", "attachment; filename=connections.txt"),
                                  ])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.