diff --git a/rhodecode/apps/repository/__init__.py b/rhodecode/apps/repository/__init__.py --- a/rhodecode/apps/repository/__init__.py +++ b/rhodecode/apps/repository/__init__.py @@ -172,6 +172,10 @@ def includeme(config): pattern='/{repo_name:.*?[^/]}/add_file/{commit_id}/{f_path:.*}', repo_route=True) config.add_route( + name='repo_files_upload_file', + pattern='/{repo_name:.*?[^/]}/upload_file/{commit_id}/{f_path:.*}', + repo_route=True) + config.add_route( name='repo_files_create_file', pattern='/{repo_name:.*?[^/]}/create_file/{commit_id}/{f_path:.*}', repo_route=True) diff --git a/rhodecode/apps/repository/views/repo_files.py b/rhodecode/apps/repository/views/repo_files.py --- a/rhodecode/apps/repository/views/repo_files.py +++ b/rhodecode/apps/repository/views/repo_files.py @@ -1250,6 +1250,9 @@ class RepoFilesView(RepoAppView): @view_config( route_name='repo_files_add_file', request_method='GET', renderer='rhodecode:templates/files/files_add.mako') + @view_config( + route_name='repo_files_upload_file', request_method='GET', + renderer='rhodecode:templates/files/files_upload.mako') def repo_files_add_file(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/templates/files/files_add.mako b/rhodecode/templates/files/files_add.mako --- a/rhodecode/templates/files/files_add.mako +++ b/rhodecode/templates/files/files_add.mako @@ -25,6 +25,7 @@
${self.breadcrumbs()}
+ ${h.secure_form(h.route_path('repo_files_create_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', enctype="multipart/form-data", class_="form-horizontal", request=request)}
@@ -32,14 +33,9 @@ ${_('Path')}:
-
- ${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path, request.GET.get('at'))} - ${_('Specify Custom Path')} -
-
@@ -49,27 +45,12 @@
-

${_('or')} ${_('Upload File')}

+
- +
@@ -120,21 +101,6 @@ } }); - $('#specify-custom-path').on('click', function(e){ - e.preventDefault(); - $('#specify-custom-path-container').hide(); - $('#remove-custom-path-container').show(); - $('#destination-label').css('margin-top', '13px'); - }); - - $('#remove-custom-path').on('click', function(e){ - e.preventDefault(); - $('#specify-custom-path-container').show(); - $('#remove-custom-path-container').hide(); - $('#location').val('${c.f_path}'); - $('#destination-label').css('margin-top', '0'); - }); - var hide_upload = function(){ $('#files_data').show(); $('#upload_file_container').hide(); @@ -146,26 +112,6 @@ hide_upload(); }); - $('#upload_file_enable').on('click', function(e){ - e.preventDefault(); - $('#files_data').hide(); - $('#upload_file_container').show(); - $('#filename_container').hide(); - if (detectIE() && detectIE() <= 9) { - $('#upload_file_container .file-upload-input label').hide(); - $('#upload_file_container .file-upload-input span').hide(); - $('#upload_file_container .file-upload-input input').show(); - } - }); - - $('#upload_file').on('change', function() { - if (this.files && this.files[0]) { - $('#filename_upload').val(this.files[0].name); - } - }); - - hide_upload(); - var renderer = ""; var reset_url = "${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}"; var myCodeMirror = initCodeMirror('editor', reset_url, false); diff --git a/rhodecode/templates/files/files_browser.mako b/rhodecode/templates/files/files_browser.mako --- a/rhodecode/templates/files/files_browser.mako +++ b/rhodecode/templates/files/files_browser.mako @@ -18,10 +18,10 @@ % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
- + ${_('Upload File')} - + ${_('Add File')}
diff --git a/rhodecode/templates/files/files_upload.mako b/rhodecode/templates/files/files_upload.mako new file mode 100644 --- /dev/null +++ b/rhodecode/templates/files/files_upload.mako @@ -0,0 +1,190 @@ +<%inherit file="/base/base.mako"/> + +<%def name="title()"> + ${_('%s Files Add') % c.repo_name} + %if c.rhodecode_name: + · ${h.branding(c.rhodecode_name)} + %endif + + +<%def name="menu_bar_nav()"> + ${self.menu_items(active='repositories')} + + +<%def name="breadcrumbs_links()"> + ${_('Add new file')} @ ${h.show_id(c.commit)} ${_('Branch')}: ${c.commit.branch} + + +<%def name="menu_bar_subnav()"> + ${self.repo_menu(active='files')} + + +<%def name="main()"> +
+ +
+ ${self.breadcrumbs()} +
+ + ${h.secure_form(h.route_path('repo_files_create_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', enctype="multipart/form-data", class_="form-horizontal", request=request)} +
+
+
+ ${_('Path')}: +
+
+
+ ${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path, request.GET.get('at'))} / + +
+
+
+ +
+
+ ${_('Filename')}: +
+
+ +
+
+ ${_('Upload file')}: +
+
+ + + +
+
+ +
+ +
+
+
+
+
+ ${h.dropdownmenu('set_mode','plain',[('plain',_('plain'))],enable_filter=True)} + + ${h.dropdownmenu('line_wrap', 'off', [('on', _('on')), ('off', _('off')),])} + + +
+
+
+

+                    
+                    
+
+
+
+
+ +
+
+
+ ${_('Commit Message')}: +
+
+
+ +
+
+
+
+ ${h.reset('reset',_('Cancel'),class_="btn btn-small")} + ${h.submit('commit_btn',_('Commit changes'),class_="btn btn-small btn-success")} +
+
+ ${h.end_form()} +
+ +