##// END OF EJS Templates
files: fixed branch icon for SVN...
dan -
r3755:2e97cecb new-ui
parent child Browse files
Show More
@@ -0,0 +1,9 b''
1 <%namespace name="sourceblock" file="/codeblocks/source.mako"/>
2
3 <%def name="render_lines(lines)">
4 <table class="cb codehilite">
5 %for line_num, tokens in enumerate(lines, 1):
6 ${sourceblock.render_line(line_num, tokens)}
7 %endfor
8 </table>
9 </%def>
@@ -1,110 +1,114 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('{} Files Add').format(c.repo_name)}
4 ${_('{} Files Add').format(c.repo_name)}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
11 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()"></%def>
14 <%def name="breadcrumbs_links()"></%def>
15
15
16 <%def name="menu_bar_subnav()">
16 <%def name="menu_bar_subnav()">
17 ${self.repo_menu(active='files')}
17 ${self.repo_menu(active='files')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21
21
22 <div class="box">
22 <div class="box">
23
23
24 <div class="edit-file-title">
24 <div class="edit-file-title">
25 <span class="title-heading">${_('Add new file')} @ <code>${h.show_id(c.commit)}</code></span>
25 <span class="title-heading">${_('Add new file')} @ <code>${h.show_id(c.commit)}</code></span>
26 <span class="tag branchtag"><i class="icon-branch"></i> ${c.commit.branch}</span>
26 % if c.commit.branch:
27 <span class="tag branchtag">
28 <i class="icon-branch"></i> ${c.commit.branch}
29 </span>
30 % endif
27 </div>
31 </div>
28
32
29 ${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', request=request)}
33 ${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', request=request)}
30 <div class="edit-file-fieldset">
34 <div class="edit-file-fieldset">
31 <div class="path-items">
35 <div class="path-items">
32 <ul>
36 <ul>
33 <li class="breadcrumb-path">
37 <li class="breadcrumb-path">
34 <div>
38 <div>
35 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
39 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
36 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">${c.f_path}</a> ${('/' if c.f_path else '')}
40 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">${c.f_path}</a> ${('/' if c.f_path else '')}
37 </div>
41 </div>
38 </li>
42 </li>
39 <li class="location-path">
43 <li class="location-path">
40 <input class="file-name-input input-small" type="text" value="" name="filename" id="filename" placeholder="${_('Filename e.g example.py, or docs/readme.md')}">
44 <input class="file-name-input input-small" type="text" value="" name="filename" id="filename" placeholder="${_('Filename e.g example.py, or docs/readme.md')}">
41 </li>
45 </li>
42 </ul>
46 </ul>
43 </div>
47 </div>
44
48
45 </div>
49 </div>
46
50
47 <div class="table">
51 <div class="table">
48 <div id="files_data">
52 <div id="files_data">
49
53
50 <div id="codeblock" class="codeblock">
54 <div id="codeblock" class="codeblock">
51 <div class="editor-items">
55 <div class="editor-items">
52 <div class="editor-action active show-editor pull-left" onclick="fileEditor.showEditor(); return false">
56 <div class="editor-action active show-editor pull-left" onclick="fileEditor.showEditor(); return false">
53 ${_('Edit')}
57 ${_('Edit')}
54 </div>
58 </div>
55
59
56 <div class="editor-action show-preview pull-left" onclick="fileEditor.showPreview(); return false">
60 <div class="editor-action show-preview pull-left" onclick="fileEditor.showPreview(); return false">
57 ${_('Preview')}
61 ${_('Preview')}
58 </div>
62 </div>
59
63
60 <div class="pull-right">
64 <div class="pull-right">
61 ${h.dropdownmenu('line_wrap', 'off', [('on', _('Line wraps on')), ('off', _('line wraps off'))], extra_classes=['last-item'])}
65 ${h.dropdownmenu('line_wrap', 'off', [('on', _('Line wraps on')), ('off', _('line wraps off'))], extra_classes=['last-item'])}
62 </div>
66 </div>
63 <div class="pull-right">
67 <div class="pull-right">
64 ${h.dropdownmenu('set_mode','plain',[('plain', _('plain'))], enable_filter=True)}
68 ${h.dropdownmenu('set_mode','plain',[('plain', _('plain'))], enable_filter=True)}
65 </div>
69 </div>
66 </div>
70 </div>
67
71
68 <div id="editor_container">
72 <div id="editor_container">
69 <pre id="editor_pre"></pre>
73 <pre id="editor_pre"></pre>
70 <textarea id="editor" name="content" ></textarea>
74 <textarea id="editor" name="content" ></textarea>
71 <div id="editor_preview"></div>
75 <div id="editor_preview"></div>
72 </div>
76 </div>
73 </div>
77 </div>
74 </div>
78 </div>
75 </div>
79 </div>
76
80
77 <div class="edit-file-fieldset">
81 <div class="edit-file-fieldset">
78 <div class="fieldset">
82 <div class="fieldset">
79 <div class="message">
83 <div class="message">
80 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
84 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
81 </div>
85 </div>
82 </div>
86 </div>
83 <div class="pull-left">
87 <div class="pull-left">
84 ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
88 ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
85 </div>
89 </div>
86 </div>
90 </div>
87 ${h.end_form()}
91 ${h.end_form()}
88 </div>
92 </div>
89
93
90 <script type="text/javascript">
94 <script type="text/javascript">
91
95
92 $(document).ready(function () {
96 $(document).ready(function () {
93 var modes_select = $('#set_mode');
97 var modes_select = $('#set_mode');
94 var filename_selector = '#filename';
98 var filename_selector = '#filename';
95 fillCodeMirrorOptions(modes_select);
99 fillCodeMirrorOptions(modes_select);
96
100
97 fileEditor = new FileEditor('#editor');
101 fileEditor = new FileEditor('#editor');
98
102
99 // on change of select field set mode
103 // on change of select field set mode
100 setCodeMirrorModeFromSelect(modes_select, filename_selector, fileEditor.cm, null);
104 setCodeMirrorModeFromSelect(modes_select, filename_selector, fileEditor.cm, null);
101
105
102 // on entering the new filename set mode, from given extension
106 // on entering the new filename set mode, from given extension
103 setCodeMirrorModeFromInput(modes_select, filename_selector, fileEditor.cm, null);
107 setCodeMirrorModeFromInput(modes_select, filename_selector, fileEditor.cm, null);
104
108
105 $('#filename').focus();
109 $('#filename').focus();
106
110
107 });
111 });
108
112
109 </script>
113 </script>
110 </%def>
114 </%def>
@@ -1,85 +1,89 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('{} Files Delete').format(c.repo_name)}
4 ${_('{} Files Delete').format(c.repo_name)}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
11 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()"></%def>
14 <%def name="breadcrumbs_links()"></%def>
15
15
16 <%def name="menu_bar_subnav()">
16 <%def name="menu_bar_subnav()">
17 ${self.repo_menu(active='files')}
17 ${self.repo_menu(active='files')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21
21
22 <div class="box">
22 <div class="box">
23
23
24 <div class="edit-file-title">
24 <div class="edit-file-title">
25 <span class="title-heading">${_('Delete file')} @ <code>${h.show_id(c.commit)}</code></span>
25 <span class="title-heading">${_('Delete file')} @ <code>${h.show_id(c.commit)}</code></span>
26 <span class="tag branchtag"><i class="icon-branch"></i> ${c.commit.branch}</span>
26 % if c.commit.branch:
27 <span class="tag branchtag">
28 <i class="icon-branch"></i> ${c.commit.branch}
29 </span>
30 % endif
27 </div>
31 </div>
28
32
29 ${h.secure_form(h.route_path('repo_files_delete_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', request=request)}
33 ${h.secure_form(h.route_path('repo_files_delete_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', request=request)}
30 <div class="edit-file-fieldset">
34 <div class="edit-file-fieldset">
31 <div class="path-items">
35 <div class="path-items">
32 <li class="breadcrumb-path">
36 <li class="breadcrumb-path">
33 <div>
37 <div>
34 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
38 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
35 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.file.dir_path)}">${c.file.dir_path}</a> ${('/' if c.file.dir_path else '')}
39 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.file.dir_path)}">${c.file.dir_path}</a> ${('/' if c.file.dir_path else '')}
36 </div>
40 </div>
37 </li>
41 </li>
38 <li class="location-path">
42 <li class="location-path">
39 <input type="hidden" value="${c.f_path}" name="root_path">
43 <input type="hidden" value="${c.f_path}" name="root_path">
40 <input class="file-name-input input-small" type="text" value="${c.file.name}" name="filename" id="filename" disabled="disabled">
44 <input class="file-name-input input-small" type="text" value="${c.file.name}" name="filename" id="filename" disabled="disabled">
41 </li>
45 </li>
42 </div>
46 </div>
43
47
44 </div>
48 </div>
45
49
46 <div id="codeblock" class="codeblock delete-file-preview">
50 <div id="codeblock" class="codeblock delete-file-preview">
47 <div class="code-body">
51 <div class="code-body">
48 %if c.file.is_binary:
52 %if c.file.is_binary:
49 ${_('Binary file (%s)') % c.file.mimetype}
53 ${_('Binary file (%s)') % c.file.mimetype}
50 %else:
54 %else:
51 %if c.file.size < c.visual.cut_off_limit_file:
55 %if c.file.size < c.visual.cut_off_limit_file:
52 ${h.pygmentize(c.file,linenos=True,anchorlinenos=False,cssclass="code-highlight")}
56 ${h.pygmentize(c.file,linenos=True,anchorlinenos=False,cssclass="code-highlight")}
53 %else:
57 %else:
54 ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'),
58 ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'),
55 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
59 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
56 %endif
60 %endif
57 %endif
61 %endif
58 </div>
62 </div>
59 </div>
63 </div>
60
64
61 <div class="edit-file-fieldset">
65 <div class="edit-file-fieldset">
62 <div class="fieldset">
66 <div class="fieldset">
63 <div class="message">
67 <div class="message">
64 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
68 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
65 </div>
69 </div>
66 </div>
70 </div>
67 <div class="pull-left">
71 <div class="pull-left">
68 ${h.submit('commit',_('Commit changes'),class_="btn btn-small btn-danger-action")}
72 ${h.submit('commit',_('Commit changes'),class_="btn btn-small btn-danger-action")}
69 </div>
73 </div>
70 </div>
74 </div>
71 ${h.end_form()}
75 ${h.end_form()}
72 </div>
76 </div>
73
77
74
78
75 <script type="text/javascript">
79 <script type="text/javascript">
76
80
77 $(document).ready(function () {
81 $(document).ready(function () {
78
82
79 fileEditor = new FileEditor('#editor');
83 fileEditor = new FileEditor('#editor');
80
84
81 });
85 });
82
86
83 </script>
87 </script>
84
88
85 </%def>
89 </%def>
@@ -1,120 +1,124 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('{} Files Edit').format(c.repo_name)}
4 ${_('{} Files Edit').format(c.repo_name)}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
11 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()"></%def>
14 <%def name="breadcrumbs_links()"></%def>
15
15
16 <%def name="menu_bar_subnav()">
16 <%def name="menu_bar_subnav()">
17 ${self.repo_menu(active='files')}
17 ${self.repo_menu(active='files')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21
21
22 <div class="box">
22 <div class="box">
23
23
24 <div class="edit-file-title">
24 <div class="edit-file-title">
25 <span class="title-heading">${_('Edit file')} @ <code>${h.show_id(c.commit)}</code></span>
25 <span class="title-heading">${_('Edit file')} @ <code>${h.show_id(c.commit)}</code></span>
26 <span class="tag branchtag"><i class="icon-branch"></i> ${c.commit.branch}</span>
26 % if c.commit.branch:
27 <span class="tag branchtag">
28 <i class="icon-branch"></i> ${c.commit.branch}
29 </span>
30 % endif
27 </div>
31 </div>
28
32
29 ${h.secure_form(h.route_path('repo_files_update_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', request=request)}
33 ${h.secure_form(h.route_path('repo_files_update_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', request=request)}
30 <div class="edit-file-fieldset">
34 <div class="edit-file-fieldset">
31 <div class="path-items">
35 <div class="path-items">
32 <ul>
36 <ul>
33 <li class="breadcrumb-path">
37 <li class="breadcrumb-path">
34 <div>
38 <div>
35 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
39 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
36 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.file.dir_path)}">${c.file.dir_path}</a> ${('/' if c.file.dir_path else '')}
40 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.file.dir_path)}">${c.file.dir_path}</a> ${('/' if c.file.dir_path else '')}
37 </div>
41 </div>
38 </li>
42 </li>
39 <li class="location-path">
43 <li class="location-path">
40 <input type="hidden" value="${c.f_path}" name="root_path">
44 <input type="hidden" value="${c.f_path}" name="root_path">
41 <input class="file-name-input input-small" type="text" value="${c.file.name}" name="filename" id="filename" placeholder="${_('Filename e.g example.py, or docs/readme.md')}">
45 <input class="file-name-input input-small" type="text" value="${c.file.name}" name="filename" id="filename" placeholder="${_('Filename e.g example.py, or docs/readme.md')}">
42 </li>
46 </li>
43 </ul>
47 </ul>
44 </div>
48 </div>
45
49
46 </div>
50 </div>
47
51
48 <div class="table">
52 <div class="table">
49 <div id="files_data">
53 <div id="files_data">
50
54
51 <div id="codeblock" class="codeblock">
55 <div id="codeblock" class="codeblock">
52 <div class="editor-items">
56 <div class="editor-items">
53 <div class="editor-action active show-editor pull-left" onclick="fileEditor.showEditor(); return false">
57 <div class="editor-action active show-editor pull-left" onclick="fileEditor.showEditor(); return false">
54 ${_('Edit')}
58 ${_('Edit')}
55 </div>
59 </div>
56
60
57 <div class="editor-action show-preview pull-left" onclick="fileEditor.showPreview(); return false">
61 <div class="editor-action show-preview pull-left" onclick="fileEditor.showPreview(); return false">
58 ${_('Preview')}
62 ${_('Preview')}
59 </div>
63 </div>
60
64
61 <div class="pull-right">
65 <div class="pull-right">
62 ${h.dropdownmenu('line_wrap', 'off', [('on', _('Line wraps on')), ('off', _('line wraps off')),])}
66 ${h.dropdownmenu('line_wrap', 'off', [('on', _('Line wraps on')), ('off', _('line wraps off')),])}
63 </div>
67 </div>
64 <div class="pull-right">
68 <div class="pull-right">
65 ${h.dropdownmenu('set_mode','plain',[('plain', _('plain'))],enable_filter=True)}
69 ${h.dropdownmenu('set_mode','plain',[('plain', _('plain'))],enable_filter=True)}
66 </div>
70 </div>
67 </div>
71 </div>
68
72
69 <div id="editor_container">
73 <div id="editor_container">
70 <pre id="editor_pre"></pre>
74 <pre id="editor_pre"></pre>
71 <textarea id="editor" name="content" >${h.escape(c.file.content)|n}</textarea>
75 <textarea id="editor" name="content" >${h.escape(c.file.content)|n}</textarea>
72 <div id="editor_preview" ></div>
76 <div id="editor_preview" ></div>
73 </div>
77 </div>
74 </div>
78 </div>
75 </div>
79 </div>
76 </div>
80 </div>
77
81
78 <div class="edit-file-fieldset">
82 <div class="edit-file-fieldset">
79 <div class="fieldset">
83 <div class="fieldset">
80 <div class="message">
84 <div class="message">
81 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
85 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
82 </div>
86 </div>
83 </div>
87 </div>
84 <div class="pull-left">
88 <div class="pull-left">
85 ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
89 ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
86 </div>
90 </div>
87 </div>
91 </div>
88 ${h.end_form()}
92 ${h.end_form()}
89 </div>
93 </div>
90
94
91 <script type="text/javascript">
95 <script type="text/javascript">
92
96
93 $(document).ready(function() {
97 $(document).ready(function() {
94 var modes_select = $('#set_mode');
98 var modes_select = $('#set_mode');
95 var filename_selector = '#filename';
99 var filename_selector = '#filename';
96 fillCodeMirrorOptions(modes_select);
100 fillCodeMirrorOptions(modes_select);
97
101
98 fileEditor = new FileEditor('#editor');
102 fileEditor = new FileEditor('#editor');
99
103
100 // try to detect the mode based on the file we edit
104 // try to detect the mode based on the file we edit
101 var detected_mode = detectCodeMirrorMode("${c.file.name}", "${c.file.mimetype}");
105 var detected_mode = detectCodeMirrorMode("${c.file.name}", "${c.file.mimetype}");
102
106
103 if (detected_mode) {
107 if (detected_mode) {
104 setCodeMirrorMode(fileEditor.cm, detected_mode);
108 setCodeMirrorMode(fileEditor.cm, detected_mode);
105
109
106 var mimetype = $(modes_select).find("option[mode={0}]".format(detected_mode)).val();
110 var mimetype = $(modes_select).find("option[mode={0}]".format(detected_mode)).val();
107 $(modes_select).select2("val", mimetype).trigger('change');
111 $(modes_select).select2("val", mimetype).trigger('change');
108 }
112 }
109
113
110 // on change of select field set mode
114 // on change of select field set mode
111 setCodeMirrorModeFromSelect(modes_select, filename_selector, fileEditor.cm, null);
115 setCodeMirrorModeFromSelect(modes_select, filename_selector, fileEditor.cm, null);
112
116
113 // on entering the new filename set mode, from given extension
117 // on entering the new filename set mode, from given extension
114 setCodeMirrorModeFromInput(modes_select, filename_selector, fileEditor.cm, null);
118 setCodeMirrorModeFromInput(modes_select, filename_selector, fileEditor.cm, null);
115
119
116 });
120 });
117
121
118
122
119 </script>
123 </script>
120 </%def>
124 </%def>
@@ -1,207 +1,211 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('{} Files Upload').format(c.repo_name)}
4 ${_('{} Files Upload').format(c.repo_name)}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
11 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()"></%def>
14 <%def name="breadcrumbs_links()"></%def>
15
15
16 <%def name="menu_bar_subnav()">
16 <%def name="menu_bar_subnav()">
17 ${self.repo_menu(active='files')}
17 ${self.repo_menu(active='files')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21
21
22 <div class="box">
22 <div class="box">
23 ## Template for uploads
23 ## Template for uploads
24 <div style="display: none" id="tpl-dropzone">
24 <div style="display: none" id="tpl-dropzone">
25 <div class="dz-preview dz-file-preview">
25 <div class="dz-preview dz-file-preview">
26 <div class="dz-details">
26 <div class="dz-details">
27
27
28 <div class="dz-filename">
28 <div class="dz-filename">
29 <span data-dz-name></span>
29 <span data-dz-name></span>
30 </div>
30 </div>
31 <div class="dz-filename-size">
31 <div class="dz-filename-size">
32 <span class="dz-size" data-dz-size></span>
32 <span class="dz-size" data-dz-size></span>
33
33
34 </div>
34 </div>
35
35
36 <div class="dz-sending" style="display: none">${_('Uploading...')}</div>
36 <div class="dz-sending" style="display: none">${_('Uploading...')}</div>
37 <div class="dz-response" style="display: none">
37 <div class="dz-response" style="display: none">
38 ${_('Uploaded')} 100%
38 ${_('Uploaded')} 100%
39 </div>
39 </div>
40
40
41 </div>
41 </div>
42 <div class="dz-progress">
42 <div class="dz-progress">
43 <span class="dz-upload" data-dz-uploadprogress></span>
43 <span class="dz-upload" data-dz-uploadprogress></span>
44 </div>
44 </div>
45
45
46 <div class="dz-error-message">
46 <div class="dz-error-message">
47 </div>
47 </div>
48 </div>
48 </div>
49 </div>
49 </div>
50
50
51 <div class="edit-file-title">
51 <div class="edit-file-title">
52 <span class="title-heading">${_('Upload new file')} @ <code>${h.show_id(c.commit)}</code></span>
52 <span class="title-heading">${_('Upload new file')} @ <code>${h.show_id(c.commit)}</code></span>
53 <span class="tag branchtag"><i class="icon-branch"></i> ${c.commit.branch}</span>
53 % if c.commit.branch:
54 <span class="tag branchtag">
55 <i class="icon-branch"></i> ${c.commit.branch}
56 </span>
57 % endif
54 </div>
58 </div>
55
59
56 <% form_url = h.route_path('repo_files_upload_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path) %>
60 <% form_url = h.route_path('repo_files_upload_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path) %>
57 ##${h.secure_form(form_url, id='eform', enctype="multipart/form-data", request=request)}
61 ##${h.secure_form(form_url, id='eform', enctype="multipart/form-data", request=request)}
58 <div class="edit-file-fieldset">
62 <div class="edit-file-fieldset">
59 <div class="path-items">
63 <div class="path-items">
60 <ul>
64 <ul>
61 <li class="breadcrumb-path">
65 <li class="breadcrumb-path">
62 <div>
66 <div>
63 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
67 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
64 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">${c.f_path}</a> ${('/' if c.f_path else '')}
68 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">${c.f_path}</a> ${('/' if c.f_path else '')}
65 </div>
69 </div>
66 </li>
70 </li>
67 <li class="location-path">
71 <li class="location-path">
68
72
69 </li>
73 </li>
70 </ul>
74 </ul>
71 </div>
75 </div>
72
76
73 </div>
77 </div>
74
78
75 <div class="upload-form table">
79 <div class="upload-form table">
76 <div id="files_data">
80 <div id="files_data">
77
81
78 <div class="dropzone-wrapper" id="file-uploader">
82 <div class="dropzone-wrapper" id="file-uploader">
79 <div class="dropzone-pure">
83 <div class="dropzone-pure">
80 <div class="dz-message">
84 <div class="dz-message">
81 <i class="icon-upload" style="font-size:36px"></i></br>
85 <i class="icon-upload" style="font-size:36px"></i></br>
82 ${_("Drag'n Drop files here or")} <span class="link">${_('Choose your files')}</span>.<br>
86 ${_("Drag'n Drop files here or")} <span class="link">${_('Choose your files')}</span>.<br>
83 </div>
87 </div>
84 </div>
88 </div>
85
89
86 </div>
90 </div>
87 </div>
91 </div>
88
92
89 </div>
93 </div>
90
94
91 <div class="upload-form edit-file-fieldset">
95 <div class="upload-form edit-file-fieldset">
92 <div class="fieldset">
96 <div class="fieldset">
93 <div class="message">
97 <div class="message">
94 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
98 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
95 </div>
99 </div>
96 </div>
100 </div>
97 <div class="pull-left">
101 <div class="pull-left">
98 ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
102 ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
99 </div>
103 </div>
100 </div>
104 </div>
101 ##${h.end_form()}
105 ##${h.end_form()}
102
106
103 <div class="file-upload-transaction-wrapper" style="display: none">
107 <div class="file-upload-transaction-wrapper" style="display: none">
104 <div class="file-upload-transaction">
108 <div class="file-upload-transaction">
105 <h3>${_('Commiting...')}</h3>
109 <h3>${_('Commiting...')}</h3>
106 <p>${_('Please wait while the files are being uploaded')}</p>
110 <p>${_('Please wait while the files are being uploaded')}</p>
107 <p class="error" style="display: none">
111 <p class="error" style="display: none">
108
112
109 </p>
113 </p>
110 <i class="icon-spin animate-spin"></i>
114 <i class="icon-spin animate-spin"></i>
111 <p></p>
115 <p></p>
112 </div>
116 </div>
113 </div>
117 </div>
114
118
115 </div>
119 </div>
116
120
117 <script type="text/javascript">
121 <script type="text/javascript">
118
122
119 $(document).ready(function () {
123 $(document).ready(function () {
120
124
121 //see: https://www.dropzonejs.com/#configuration
125 //see: https://www.dropzonejs.com/#configuration
122 myDropzone = new Dropzone("div#file-uploader", {
126 myDropzone = new Dropzone("div#file-uploader", {
123 url: "${form_url}",
127 url: "${form_url}",
124 headers: {"X-CSRF-Token": CSRF_TOKEN},
128 headers: {"X-CSRF-Token": CSRF_TOKEN},
125 paramName: function () {
129 paramName: function () {
126 return "files_upload"
130 return "files_upload"
127 }, // The name that will be used to transfer the file
131 }, // The name that will be used to transfer the file
128 parallelUploads: 20,
132 parallelUploads: 20,
129 maxFiles: 20,
133 maxFiles: 20,
130 uploadMultiple: true,
134 uploadMultiple: true,
131 //chunking: true, // use chunking transfer, not supported at the moment
135 //chunking: true, // use chunking transfer, not supported at the moment
132 //maxFilesize: 2, // in MBs
136 //maxFilesize: 2, // in MBs
133 autoProcessQueue: false, // if false queue will not be processed automatically.
137 autoProcessQueue: false, // if false queue will not be processed automatically.
134 createImageThumbnails: false,
138 createImageThumbnails: false,
135 previewTemplate: document.querySelector('#tpl-dropzone').innerHTML,
139 previewTemplate: document.querySelector('#tpl-dropzone').innerHTML,
136 accept: function (file, done) {
140 accept: function (file, done) {
137 done();
141 done();
138 },
142 },
139 init: function () {
143 init: function () {
140 this.on("addedfile", function (file) {
144 this.on("addedfile", function (file) {
141
145
142 });
146 });
143
147
144 this.on("sending", function (file, xhr, formData) {
148 this.on("sending", function (file, xhr, formData) {
145 formData.append("message", $('#commit').val());
149 formData.append("message", $('#commit').val());
146 $(file.previewElement).find('.dz-sending').show();
150 $(file.previewElement).find('.dz-sending').show();
147 });
151 });
148
152
149 this.on("success", function (file, response) {
153 this.on("success", function (file, response) {
150 $(file.previewElement).find('.dz-sending').hide();
154 $(file.previewElement).find('.dz-sending').hide();
151 $(file.previewElement).find('.dz-response').show();
155 $(file.previewElement).find('.dz-response').show();
152
156
153 if (response.error !== null) {
157 if (response.error !== null) {
154 $('.file-upload-transaction-wrapper .error').html('ERROR: {0}'.format(response.error));
158 $('.file-upload-transaction-wrapper .error').html('ERROR: {0}'.format(response.error));
155 $('.file-upload-transaction-wrapper .error').show();
159 $('.file-upload-transaction-wrapper .error').show();
156 $('.file-upload-transaction-wrapper i').hide()
160 $('.file-upload-transaction-wrapper i').hide()
157 }
161 }
158
162
159 var redirect_url = response.redirect_url || '/';
163 var redirect_url = response.redirect_url || '/';
160 window.location = redirect_url
164 window.location = redirect_url
161
165
162 });
166 });
163
167
164 this.on("error", function (file, errorMessage, xhr) {
168 this.on("error", function (file, errorMessage, xhr) {
165 var error = null;
169 var error = null;
166
170
167 if (xhr !== undefined){
171 if (xhr !== undefined){
168 var httpStatus = xhr.status + " " + xhr.statusText;
172 var httpStatus = xhr.status + " " + xhr.statusText;
169 if (xhr.status >= 500) {
173 if (xhr.status >= 500) {
170 error = httpStatus;
174 error = httpStatus;
171 }
175 }
172 }
176 }
173
177
174 if (error === null) {
178 if (error === null) {
175 error = errorMessage.error || errorMessage || httpStatus;
179 error = errorMessage.error || errorMessage || httpStatus;
176 }
180 }
177
181
178 $(file.previewElement).find('.dz-error-message').html('ERROR: {0}'.format(error));
182 $(file.previewElement).find('.dz-error-message').html('ERROR: {0}'.format(error));
179 });
183 });
180 }
184 }
181 });
185 });
182
186
183 $('#commit_btn').on('click', function(e) {
187 $('#commit_btn').on('click', function(e) {
184 e.preventDefault();
188 e.preventDefault();
185 var button = $(this);
189 var button = $(this);
186 if (button.hasClass('clicked')) {
190 if (button.hasClass('clicked')) {
187 button.attr('disabled', true);
191 button.attr('disabled', true);
188 } else {
192 } else {
189 button.addClass('clicked');
193 button.addClass('clicked');
190 }
194 }
191
195
192 var files = myDropzone.getQueuedFiles();
196 var files = myDropzone.getQueuedFiles();
193 if (files.length === 0) {
197 if (files.length === 0) {
194 alert("Missing files");
198 alert("Missing files");
195 e.preventDefault();
199 e.preventDefault();
196 }
200 }
197
201
198 $('.upload-form').hide();
202 $('.upload-form').hide();
199 $('.file-upload-transaction-wrapper').show();
203 $('.file-upload-transaction-wrapper').show();
200 myDropzone.processQueue();
204 myDropzone.processQueue();
201
205
202 });
206 });
203
207
204 });
208 });
205
209
206 </script>
210 </script>
207 </%def>
211 </%def>
General Comments 0
You need to be logged in to leave comments. Login now