comparison 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
comparison
equal deleted inserted replaced
1484:1db451a44504 1485:269905fac50a
34 </li> 34 </li>
35 </ul> 35 </ul>
36 </div> 36 </div>
37 <div class="table"> 37 <div class="table">
38 <div id="files_data"> 38 <div id="files_data">
39 ${h.form(h.url.current(),method='post',id='eform')} 39 ${h.form(h.url.current(),method='post',id='eform',enctype="multipart/form-data")}
40 <h3>${_('Add new file')}</h3> 40 <h3>${_('Add new file')}</h3>
41 <div class="form"> 41 <div class="form">
42 <div class="fields"> 42 <div class="fields">
43 <div class="field"> 43 <div class="field">
44 <div class="label"> 44 <div class="label">
48 <input type="text" value="${c.f_path}" size="30" name="location" id="location"> 48 <input type="text" value="${c.f_path}" size="30" name="location" id="location">
49 ${_('use / to separate directories')} 49 ${_('use / to separate directories')}
50 </div> 50 </div>
51 </div> 51 </div>
52 52
53 <div class="field"> 53 <div id="filename_container" class="field file">
54 <div class="label"> 54 <div class="label">
55 <label for="filename">${_('File Name')}:</label> 55 <label for="filename">${_('File Name')}:</label>
56 </div> 56 </div>
57 <div class="input"> 57 <div class="input">
58 <input type="text" value="" size="30" name="filename" id="filename"> 58 <input type="text" value="" size="30" name="filename" id="filename">
59 <input type="button" class="ui-button-small" value="upload file" id="upload_file_enable">
59 </div> 60 </div>
60 </div> 61 </div>
62 <div id="upload_file_container" class="field" style="display:none">
63 <div class="label">
64 <label for="location">${_('Upload file')}</label>
65 </div>
66 <div class="file">
67 <input type="file" size="30" name="upload_file" id="upload_file">
68 <input type="button" class="ui-button-small" value="create file" id="file_enable">
69 </div>
70 </div>
61 </div> 71 </div>
62 </div> 72 </div>
63 <div id="body" class="codeblock"> 73 <div id="body" class="codeblock">
64 <pre id="editor_pre"></pre> 74 <div id="editor_container">
65 <textarea id="editor" name="content" style="display:none"></textarea> 75 <pre id="editor_pre"></pre>
76 <textarea id="editor" name="content" style="display:none"></textarea>
77 </div>
66 <div style="padding: 10px;color:#666666">${_('commit message')}</div> 78 <div style="padding: 10px;color:#666666">${_('commit message')}</div>
67 <textarea id="commit" name="message" style="height: 100px;width: 99%"></textarea> 79 <textarea id="commit" name="message" style="height: 100px;width: 99%;margin-left:4px"></textarea>
68 </div> 80 </div>
69 <div style="text-align: right;padding-top: 5px"> 81 <div style="text-align: right;padding-top: 5px">
70 <input id="reset" type="button" value="${_('Reset')}" class="ui-button-small" /> 82 <input id="reset" type="button" value="${_('Reset')}" class="ui-button-small" />
71 ${h.submit('commit',_('Commit changes'),class_="ui-button-small-blue")} 83 ${h.submit('commit',_('Commit changes'),class_="ui-button-small-blue")}
72 </div> 84 </div>
74 <script type="text/javascript"> 86 <script type="text/javascript">
75 var myCodeMirror = CodeMirror.fromTextArea(YUD.get('editor'),{ 87 var myCodeMirror = CodeMirror.fromTextArea(YUD.get('editor'),{
76 mode: "null", 88 mode: "null",
77 lineNumbers:true 89 lineNumbers:true
78 }); 90 });
79 YUE.on('reset','click',function(){ 91 YUE.on('reset','click',function(e){
80 window.location="${h.url('files_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path)}"; 92 window.location="${h.url('files_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path)}";
81 }) 93 });
94
95 YUE.on('file_enable','click',function(){
96 YUD.setStyle('editor_container','display','');
97 YUD.setStyle('upload_file_container','display','none');
98 YUD.setStyle('filename_container','display','');
99 });
100
101 YUE.on('upload_file_enable','click',function(){
102 YUD.setStyle('editor_container','display','none');
103 YUD.setStyle('upload_file_container','display','');
104 YUD.setStyle('filename_container','display','none');
105 });
106
82 </script> 107 </script>
83 </div> 108 </div>
84 </div> 109 </div>
85 </div> 110 </div>
86 </%def> 111 </%def>