1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 10:26:17 +00:00
Files
seahub/templates/repo_edit_file.html

64 lines
2.3 KiB
HTML
Raw Normal View History

2012-08-06 20:29:14 +08:00
{% extends base_template %}
{% load seahub_tags %}
{% block main_panel %}
2012-08-07 11:47:10 +08:00
<h2>编辑 {{ u_filename }}</h2>
2012-08-06 20:29:14 +08:00
<div class="w100 ovhd">
<p class="path fleft">
当前路径:
{% for name, link in zipped %}
{% if not forloop.last %}
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> /
{% else %}
{{ name }}
{% endif %}
{% endfor %}
</p>
<div class="file-op fright">
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/files/?p={{ path }}">返回</a>
</div>
</div>
<div id="file-view">
<div id="docu-view" class="vh"></div>
2012-08-06 20:29:14 +08:00
</div>
<form action="" method="post" id="file-edit-form" class="hide">
2012-08-06 20:29:14 +08:00
<input type="hidden" name="modified-file" />
<input type="submit" class="submit" value="提交" />
</form>
{% endblock %}
{% block extra_script %}
<script type="text/javascript" src="{{MEDIA_URL}}ace/ace.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}ace/theme-twilight.js"></script>
{% include "snippets/file_view_js.html" %}
{% if fileext == 'markdown' or fileext == 'md' %}
<script type="text/javascript" src="{{MEDIA_URL}}ace/mode-markdown.js"></script>
{% endif %}
2012-08-06 20:29:14 +08:00
<script type="text/javascript">
{% if file_content %}
editor = ace.edit("docu-view");
$('#docu-view').removeClass('vh');
editor.setShowPrintMargin(false); // rm the vertical line in the center
editor.renderer.scrollBar.element.style.display = "none"; // hide right scrollbar
editor.renderer.scrollBar.width = 0; // enlarge ace_content width
editor.setTheme("ace/theme/twilight");
{% include "snippets/editor_set_mode.html" %}
editor.session.getDocument().setValue('{{ file_content|escapejs }}');
$('#docu-view').css({'position': 'relative', 'height': (editor.session.getScreenLength() + 1) * parseInt($('#docu-view').css('line-height'))}); // '+ 1': offer space for bottom scrollbar
editor.session.setScrollLeft(0); // make bottom scrollbar start from the left-most
editor.resize(); // fix some problem for showing some file in ie8
$('#file-edit-form').removeClass('hide');
2012-08-06 20:29:14 +08:00
$('#file-edit-form').submit(function() {
$(this).find('[name="modified-file"]').val(editor.session.getValue());
});
{% endif %}
{% if err %}
$('#file-view').html('<p class="error">{{ err }}</p>');
{% endif %}
2012-08-06 20:29:14 +08:00
</script>
{% endblock %}