diff rhodecode/templates/files/files_add.html @ 1485:269905fac50a beta

added uploading of files from web interface directly into repo
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 23 Sep 2011 01:52:48 +0300
parents 1db451a44504
children 53d076664e08
line wrap: on
line diff
--- a/rhodecode/templates/files/files_add.html	Thu Sep 22 15:03:12 2011 +0300
+++ b/rhodecode/templates/files/files_add.html	Fri Sep 23 01:52:48 2011 +0300
@@ -36,7 +36,7 @@
     </div>
     <div class="table">
 		<div id="files_data">
-		  ${h.form(h.url.current(),method='post',id='eform')}
+		  ${h.form(h.url.current(),method='post',id='eform',enctype="multipart/form-data")}
             <h3>${_('Add new file')}</h3>
             <div class="form">
                     <div class="fields">
@@ -50,21 +50,33 @@
                             </div>
                          </div>
                                       
-                        <div class="field">
+                        <div id="filename_container" class="field file">
                             <div class="label">
                                 <label for="filename">${_('File Name')}:</label>
                             </div>
                             <div class="input">
                                 <input type="text" value="" size="30" name="filename" id="filename">
+                                <input type="button" class="ui-button-small" value="upload file" id="upload_file_enable">
                             </div>
-                        </div>                                                    
+                        </div>
+                        <div id="upload_file_container" class="field" style="display:none">
+                          <div class="label">
+                              <label for="location">${_('Upload file')}</label>
+                          </div>
+                          <div class="file">
+                              <input type="file"  size="30" name="upload_file" id="upload_file">
+                              <input type="button" class="ui-button-small" value="create file" id="file_enable">                        
+                          </div>
+                        </div>                                                                      
                     </div>
             </div>            
 			<div id="body" class="codeblock">
-			    <pre id="editor_pre"></pre>
-				<textarea id="editor" name="content" style="display:none"></textarea>
+			    <div id="editor_container">    
+                    <pre id="editor_pre"></pre>
+				    <textarea id="editor" name="content" style="display:none"></textarea>
+                </div>
 				<div style="padding: 10px;color:#666666">${_('commit message')}</div>
-				<textarea id="commit" name="message" style="height: 100px;width: 99%"></textarea>
+				<textarea id="commit" name="message" style="height: 100px;width: 99%;margin-left:4px"></textarea>
 			</div>
 			<div style="text-align: right;padding-top: 5px">
 			<input id="reset" type="button" value="${_('Reset')}" class="ui-button-small" />
@@ -76,9 +88,22 @@
 	                mode:  "null",
 	                lineNumbers:true
 	              });
-			 YUE.on('reset','click',function(){
+			 YUE.on('reset','click',function(e){
 				 window.location="${h.url('files_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path)}";
-			 })
+			 });
+             
+			 YUE.on('file_enable','click',function(){
+                 YUD.setStyle('editor_container','display','');
+                 YUD.setStyle('upload_file_container','display','none');
+                 YUD.setStyle('filename_container','display','');
+             });
+             
+			 YUE.on('upload_file_enable','click',function(){
+				 YUD.setStyle('editor_container','display','none');
+				 YUD.setStyle('upload_file_container','display','');
+				 YUD.setStyle('filename_container','display','none');
+			 });
+			 
 			</script>
 		</div>    
     </div>