annotate rhodecode/templates/files/files_add.html @ 4026:a60a0e9092c6

added codemirror edit mode with autodetection
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 20 Jun 2013 23:53:18 +0200
parents 072a37c44f58
children ffd45b185016
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 <%inherit file="/base/base.html"/>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 <%def name="title()">
3582
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3559
diff changeset
4 ${_('%s Files Add') % c.repo_name} &middot; ${c.rhodecode_name}
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 </%def>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 <%def name="js_extra()">
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 <script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script>
4026
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
9 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
10 <script type="text/javascript" src="${h.url('/js/mode/meta.js')}"></script>
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 </%def>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 <%def name="css_extra()">
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 </%def>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15
3620
a2afaf84330c fixed missing page_nav in files edit/add
Marcin Kuzminski <marcin@python-works.com>
parents: 3602
diff changeset
16 <%def name="page_nav()">
a2afaf84330c fixed missing page_nav in files edit/add
Marcin Kuzminski <marcin@python-works.com>
parents: 3602
diff changeset
17 ${self.menu('repositories')}
a2afaf84330c fixed missing page_nav in files edit/add
Marcin Kuzminski <marcin@python-works.com>
parents: 3602
diff changeset
18 </%def>
a2afaf84330c fixed missing page_nav in files edit/add
Marcin Kuzminski <marcin@python-works.com>
parents: 3602
diff changeset
19
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 <%def name="breadcrumbs_links()">
3602
bb1eecda3172 clean-up of breadcrumbs on pages with repo context bar
Mads Kiilerich <madski@unity3d.com>
parents: 3583
diff changeset
21 ${_('Add file')} @ ${h.show_id(c.cs)}
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22 </%def>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 <%def name="main()">
3988
072a37c44f58 templates: drop context_bar, use repo_context_bar directly
Mads Kiilerich <madski@unity3d.com>
parents: 3887
diff changeset
25 ${self.repo_context_bar('files')}
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 <div class="box">
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 <!-- box / title -->
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28 <div class="title">
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 ${self.breadcrumbs()}
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 <ul class="links">
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 <li>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 <span style="text-transform: uppercase;">
3654
ec6354949623 Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents: 3620
diff changeset
33 <a href="#">${_('Branch')}: ${c.cs.branch}</a></span>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1756
diff changeset
34 </li>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1756
diff changeset
35 </ul>
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 </div>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37 <div class="table">
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
38 <div id="files_data">
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
39 ${h.form(h.url.current(),method='post',id='eform',enctype="multipart/form-data")}
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40 <h3>${_('Add new file')}</h3>
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41 <div class="form">
1603
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
42 <div class="fields">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
43 <div id="filename_container" class="field file">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
44 <div class="label">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
45 <label for="filename">${_('File Name')}:</label>
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
46 </div>
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
47 <div class="input">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
48 <input type="text" value="" size="30" name="filename" id="filename">
1756
Marcin Kuzminski <marcin@python-works.com>
parents: 1720
diff changeset
49 ${_('or')} <span class="ui-btn" id="upload_file_enable">${_('Upload file')}</span>
1603
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
50 </div>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1756
diff changeset
51 </div>
1603
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
52 <div id="upload_file_container" class="field" style="display:none">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
53 <div class="label">
3559
328eb707fe3f added more strict checks for file path in add file controller
Marcin Kuzminski <marcin@python-works.com>
parents: 3237
diff changeset
54 <label for="upload_file_container">${_('Upload file')}</label>
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 </div>
1603
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
56 <div class="file">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
57 <input type="file" size="30" name="upload_file" id="upload_file">
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1756
diff changeset
58 ${_('or')} <span class="ui-btn" id="file_enable">${_('Create new file')}</span>
1603
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
59 </div>
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
60 </div>
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
61 <div class="field">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
62 <div class="label">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
63 <label for="location">${_('Location')}</label>
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
64 </div>
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
65 <div class="input">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
66 <input type="text" value="${c.f_path}" size="30" name="location" id="location">
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
67 ${_('use / to separate directories')}
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
68 </div>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1756
diff changeset
69 </div>
1603
53d076664e08 Changed order of add file form inputs.
Marcin Kuzminski <marcin@python-works.com>
parents: 1485
diff changeset
70 </div>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1756
diff changeset
71 </div>
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
72 <div id="body" class="codeblock">
4026
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
73 <div class="code-header">
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
74 <label class="commit" for="set_mode">${_('New file mode')}</label>
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
75 ${h.select('set_mode','plain',[('plain',_('plain'))])}
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
76 </div>
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
77 <div id="editor_container">
1485
269905fac50a added uploading of files from web interface directly into repo
Marcin Kuzminski <marcin@python-works.com>
parents: 1484
diff changeset
78 <pre id="editor_pre"></pre>
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
79 <textarea id="editor" name="content" style="display:none"></textarea>
1485
269905fac50a added uploading of files from web interface directly into repo
Marcin Kuzminski <marcin@python-works.com>
parents: 1484
diff changeset
80 </div>
3654
ec6354949623 Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents: 3620
diff changeset
81 <div style="padding: 10px;color:#666666">${_('Commit message')}</div>
3237
f5dd76e2a7af disable file editing when not on branch head fixes issue #462
Marcin Kuzminski <marcin@python-works.com>
parents: 3198
diff changeset
82 <textarea id="commit" name="message" style="height: 100px;width: 99%;margin-left:4px" placeholder="${c.default_message}"></textarea>
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
83 </div>
3887
4930abd96a7e minor css fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 3654
diff changeset
84 <div style="text-align: left;padding-top: 5px">
1756
Marcin Kuzminski <marcin@python-works.com>
parents: 1720
diff changeset
85 ${h.submit('commit',_('Commit changes'),class_="ui-btn")}
Marcin Kuzminski <marcin@python-works.com>
parents: 1720
diff changeset
86 ${h.reset('reset',_('Reset'),class_="ui-btn")}
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
87 </div>
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
88 ${h.end_form()}
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
89 <script type="text/javascript">
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
90 var reset_url = "${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path)}";
4026
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
91 var myCodeMirror = initCodeMirror('editor',reset_url);
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
92 CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}";
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
93
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
94 //inject new modes
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
95 var modes_select = YUD.get('set_mode');
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
96 for(var i=0;i<CodeMirror.modeInfo.length;i++){
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
97 var m = CodeMirror.modeInfo[i];
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
98 var opt = new Option(m.name, m.mode);
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
99 modes_select.options[i+1] = opt
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
100 }
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
101 YUE.on(modes_select, 'change', function(e){
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
102 var selected = e.currentTarget;
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
103 var new_mode = selected.options[selected.selectedIndex].value;
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
104 setCodeMirrorMode(myCodeMirror, new_mode);
a60a0e9092c6 added codemirror edit mode with autodetection
Marcin Kuzminski <marcin@python-works.com>
parents: 3988
diff changeset
105 })
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
106 </script>
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2492
diff changeset
107 </div>
1483
7b67b0dcad6d Added initial support for creating new nodes in repos
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
108 </div>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1756
diff changeset
109 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1756
diff changeset
110 </%def>