Put pick file button back
Joris van Zundert [Wed, 19 Sep 2012 09:16:39 +0000 (11:16 +0200)]
root/css/style.css
root/js/componentload.js
root/src/index.tt

index d221869..ef7034b 100644 (file)
@@ -206,3 +206,18 @@ div.pager_left_button.greyed_out, div.pager_left_button.greyed_out:hover {
     font-weight: bold;
     color: #ff3333;
 }
+#new_file {
+    position: absolute;
+    top: -50px;
+    opacity: 0.0;
+}
+#new_file_name {
+    font-weight: bold;
+}
+#new_name, #new_lang, #new_public, #new_file_name_container {
+    margin-bottom: 6px;
+}
+#new_file_label {
+    float: left;
+    padding-right: 8px;
+}
\ No newline at end of file
index 522c879..4c17616 100644 (file)
@@ -188,8 +188,10 @@ function display_error( jqXHR, el ) {
 function file_selected( e ) {
        if( e.files.length == 1 ) {
                $('#upload_button').button('enable');
+               $('#new_file_name_container').html( '<span id="new_file_name">' + e.files[0].name + '</span>' );
        } else {
                $('#upload_button').button('disable');
+               $('#new_file_name_container').html( '(Use \'pick file\' to select a tradition file to upload.)' );
        }
 }
 
@@ -438,6 +440,13 @@ $(document).ready( function() {
                 upload_new();
             }
                  },
+                 pick_file: {
+                   text: 'Pick File',
+                   id: 'pick_file_button',
+                   click: function() {
+                $('#new_file').click();
+            }
+                 },
                  Cancel: function() {
                    $('#upload-collation-dialog').dialog('close');
                  }
index cdac15f..ffc2642 100644 (file)
@@ -141,8 +141,9 @@ var textOnLoad = "[% withtradition %]";
     <!-- File upload dialog box -->
     <div id="upload-collation-dialog" title="Upload a collation">
       <div id="upload_container">
-        <label for="new_file">Collation file: </label>
-               <input id="new_file" name="file" type="file" onchange="file_selected(this)"><br/>
+               <input id="new_file" name="file" type="file" onchange="file_selected(this)">
+               <label for="new_file" id="new_file_label">Collation file: </label>
+        <div id="new_file_name_container" onclick="$('#new_file').click();">&nbsp;(Use 'pick file' to select a tradition file to upload.)</div>
         <form id="new_tradition">
             <label for="new_name">Name of this text / tradition: </label>
             <input id="new_name" type="text" name="name" size="40"/><br/>