Show More
@@ -36,7 +36,7 b' from pylons.decorators import jsonify' | |||||
36 |
|
36 | |||
37 | from vcs.conf import settings |
|
37 | from vcs.conf import settings | |
38 | from vcs.exceptions import RepositoryError, ChangesetDoesNotExistError, \ |
|
38 | from vcs.exceptions import RepositoryError, ChangesetDoesNotExistError, \ | |
39 | EmptyRepositoryError, ImproperArchiveTypeError, VCSError |
|
39 | EmptyRepositoryError, ImproperArchiveTypeError, VCSError, NodeAlreadyExistsError | |
40 | from vcs.nodes import FileNode, NodeKind |
|
40 | from vcs.nodes import FileNode, NodeKind | |
41 | from vcs.utils import diffs as differ |
|
41 | from vcs.utils import diffs as differ | |
42 |
|
42 | |||
@@ -310,6 +310,12 b' class FilesController(BaseRepoController' | |||||
310 | % (f_path)) |
|
310 | % (f_path)) | |
311 | location = r_post.get('location') |
|
311 | location = r_post.get('location') | |
312 | filename = r_post.get('filename') |
|
312 | filename = r_post.get('filename') | |
|
313 | file_obj = r_post.get('upload_file', None) | |||
|
314 | ||||
|
315 | if file_obj is not None and hasattr(file_obj, 'filename'): | |||
|
316 | filename = file_obj.filename | |||
|
317 | content = file_obj.file | |||
|
318 | ||||
313 | node_path = os.path.join(location, filename) |
|
319 | node_path = os.path.join(location, filename) | |
314 | author = self.rhodecode_user.full_contact |
|
320 | author = self.rhodecode_user.full_contact | |
315 |
|
321 | |||
@@ -330,7 +336,8 b' class FilesController(BaseRepoController' | |||||
330 | content=content, f_path=node_path) |
|
336 | content=content, f_path=node_path) | |
331 | h.flash(_('Successfully committed to %s' % node_path), |
|
337 | h.flash(_('Successfully committed to %s' % node_path), | |
332 | category='success') |
|
338 | category='success') | |
333 |
|
339 | except NodeAlreadyExistsError, e: | ||
|
340 | h.flash(_(e), category='error') | |||
334 | except Exception: |
|
341 | except Exception: | |
335 | log.error(traceback.format_exc()) |
|
342 | log.error(traceback.format_exc()) | |
336 | h.flash(_('Error occurred during commit'), category='error') |
|
343 | h.flash(_('Error occurred during commit'), category='error') |
@@ -360,7 +360,12 b' class ScmModel(BaseModel):' | |||||
360 | from vcs.backends.git import GitInMemoryChangeset as IMC |
|
360 | from vcs.backends.git import GitInMemoryChangeset as IMC | |
361 | # decoding here will force that we have proper encoded values |
|
361 | # decoding here will force that we have proper encoded values | |
362 | # in any other case this will throw exceptions and deny commit |
|
362 | # in any other case this will throw exceptions and deny commit | |
|
363 | ||||
|
364 | if isinstance(content,(basestring,)): | |||
363 | content = safe_str(content) |
|
365 | content = safe_str(content) | |
|
366 | elif isinstance(content,file): | |||
|
367 | content = content.read() | |||
|
368 | ||||
364 | message = safe_str(message) |
|
369 | message = safe_str(message) | |
365 | path = safe_str(f_path) |
|
370 | path = safe_str(f_path) | |
366 | author = safe_str(author) |
|
371 | author = safe_str(author) |
@@ -4,6 +4,7 b'' | |||||
4 | line-height: 1em; |
|
4 | line-height: 1em; | |
5 | font-family: monospace; |
|
5 | font-family: monospace; | |
6 | _position: relative; /* IE6 hack */ |
|
6 | _position: relative; /* IE6 hack */ | |
|
7 | margin:20px; | |||
7 | } |
|
8 | } | |
8 |
|
9 | |||
9 | .CodeMirror-gutter { |
|
10 | .CodeMirror-gutter { |
@@ -928,6 +928,9 b' font-weight:700;' | |||||
928 | #content div.box div.form div.fields div.field div.input { |
|
928 | #content div.box div.form div.fields div.field div.input { | |
929 | margin:0 0 0 200px; |
|
929 | margin:0 0 0 200px; | |
930 | } |
|
930 | } | |
|
931 | #content div.box div.form div.fields div.field div.file { | |||
|
932 | margin:0 0 0 200px; | |||
|
933 | } | |||
931 | #content div.box-left div.form div.fields div.field div.input,#content div.box-right div.form div.fields div.field div.input { |
|
934 | #content div.box-left div.form div.fields div.field div.input,#content div.box-right div.form div.fields div.field div.input { | |
932 | margin:0 0 0 0px; |
|
935 | margin:0 0 0 0px; | |
933 | } |
|
936 | } | |
@@ -945,6 +948,17 b' margin:0;' | |||||
945 | padding:7px 7px 6px; |
|
948 | padding:7px 7px 6px; | |
946 | } |
|
949 | } | |
947 |
|
950 | |||
|
951 | #content div.box div.form div.fields div.field div.file input { | |||
|
952 | background: none repeat scroll 0 0 #FFFFFF; | |||
|
953 | border-color: #B3B3B3 #EAEAEA #EAEAEA #B3B3B3; | |||
|
954 | border-style: solid; | |||
|
955 | border-width: 1px; | |||
|
956 | color: #000000; | |||
|
957 | font-family: Lucida Grande,Verdana,Lucida Sans Regular,Lucida Sans Unicode,Arial,sans-serif; | |||
|
958 | font-size: 11px; | |||
|
959 | margin: 0; | |||
|
960 | padding: 7px 7px 6px; | |||
|
961 | } | |||
948 |
|
962 | |||
949 |
|
963 | |||
950 | #content div.box div.form div.fields div.field div.input input.small { |
|
964 | #content div.box div.form div.fields div.field div.input input.small { | |
@@ -2359,20 +2373,20 b' border:1px solid #316293;' | |||||
2359 |
|
2373 | |||
2360 |
|
2374 | |||
2361 | input.ui-button-small { |
|
2375 | input.ui-button-small { | |
2362 | background:#e5e3e3 url("../images/button.png") repeat-x; |
|
2376 | background:#e5e3e3 url("../images/button.png") repeat-x !important; | |
2363 | border-top:1px solid #DDD; |
|
2377 | border-top:1px solid #DDD !important; | |
2364 | border-left:1px solid #c6c6c6; |
|
2378 | border-left:1px solid #c6c6c6 !important; | |
2365 | border-right:1px solid #DDD; |
|
2379 | border-right:1px solid #DDD !important; | |
2366 | border-bottom:1px solid #c6c6c6; |
|
2380 | border-bottom:1px solid #c6c6c6 !important; | |
2367 | color:#515151; |
|
2381 | color:#515151 !important; | |
2368 | outline:none; |
|
2382 | outline:none !important; | |
2369 | margin:0; |
|
2383 | margin:0 !important; | |
2370 | -webkit-border-radius: 4px 4px 4px 4px; |
|
2384 | -webkit-border-radius: 4px 4px 4px 4px !important; | |
2371 | -khtml-border-radius: 4px 4px 4px 4px; |
|
2385 | -khtml-border-radius: 4px 4px 4px 4px !important; | |
2372 | -moz-border-radius: 4px 4px 4px 4px; |
|
2386 | -moz-border-radius: 4px 4px 4px 4px !important; | |
2373 | border-radius: 4px 4px 4px 4px; |
|
2387 | border-radius: 4px 4px 4px 4px !important; | |
2374 | box-shadow: 0 1px 0 #ececec; |
|
2388 | box-shadow: 0 1px 0 #ececec !important; | |
2375 | cursor: pointer; |
|
2389 | cursor: pointer !important; | |
2376 | } |
|
2390 | } | |
2377 |
|
2391 | |||
2378 | input.ui-button-small:hover { |
|
2392 | input.ui-button-small:hover { |
@@ -36,7 +36,7 b'' | |||||
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"> | |
@@ -50,21 +50,33 b'' | |||||
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"> | |||
|
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"> | |||
59 |
|
|
69 | </div> | |
60 | </div> |
|
70 | </div> | |
61 | </div> |
|
71 | </div> | |
62 | </div> |
|
72 | </div> | |
63 | <div id="body" class="codeblock"> |
|
73 | <div id="body" class="codeblock"> | |
|
74 | <div id="editor_container"> | |||
64 |
|
|
75 | <pre id="editor_pre"></pre> | |
65 | <textarea id="editor" name="content" style="display:none"></textarea> |
|
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" /> | |
@@ -76,9 +88,22 b'' | |||||
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> |
@@ -42,7 +42,7 b'' | |||||
42 | <pre id="editor_pre"></pre> |
|
42 | <pre id="editor_pre"></pre> | |
43 | <textarea id="editor" name="content" style="display:none">${c.file.content|n}</textarea> |
|
43 | <textarea id="editor" name="content" style="display:none">${c.file.content|n}</textarea> | |
44 | <div style="padding: 10px;color:#666666">${_('commit message')}</div> |
|
44 | <div style="padding: 10px;color:#666666">${_('commit message')}</div> | |
45 |
<textarea id="commit" name="message" style="height: |
|
45 | <textarea id="commit" name="message" style="height: 60px;width: 99%;margin-left:4px"></textarea> | |
46 | </div> |
|
46 | </div> | |
47 | <div style="text-align: right;padding-top: 5px"> |
|
47 | <div style="text-align: right;padding-top: 5px"> | |
48 | <input id="reset" type="button" value="${_('Reset')}" class="ui-button-small" /> |
|
48 | <input id="reset" type="button" value="${_('Reset')}" class="ui-button-small" /> |
General Comments 0
You need to be logged in to leave comments.
Login now