Commit 847c2044 authored by Nicolas Wavrant's avatar Nicolas Wavrant

Now display diff file in a popup box

Conflicts:
	slapos/runner/views.py
parent ca9b829b
...@@ -127,4 +127,12 @@ ...@@ -127,4 +127,12 @@
</div> </div>
</div> </div>
</div> </div>
<!-- This contains the hidden content for inline calls -->
<a id='inlineViewer' style='display:none' href="#inline_content">Inline HTML</a>
<div style='display:none'>
<div id='inline_content' style='padding:10px; background:#fff;'>
</div>
</div>
{% endblock %} {% endblock %}
{% extends "layout.html" %}
{% block title %}Diff for '{{project}}'{% endblock %}
{% block head %}
{{ super() }}
<script src="{{ url_for('static', filename='js/ace/ace.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/ace/theme-crimson_editor.js') }}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready( function() {
var editor = ace.edit("editor");
editor.setTheme("ace/theme/crimson_editor");
var CurentMode = require("ace/mode/text").Mode;
editor.getSession().setMode(new CurentMode());
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
editor.setReadOnly(true);
});
</script>
{% endblock %}
{% block body %}
<form action="{{ url_for('manageProject') }}" method=get>
<dl>
<dd><h2 class='title'>Diff file for "{{project}}"</h2></dd>
<dd>
<div class="main_content">
<pre id="editor">
{{ diff }}
</pre>
</div>
</dd>
<dd><input type=submit value="Back" class="button"></dd>
</dl>
</form>
{% endblock %}
...@@ -376,16 +376,13 @@ def newBranch(): ...@@ -376,16 +376,13 @@ def newBranch():
return jsonify(code=0, result="Can not read folder: Permission Denied") return jsonify(code=0, result="Can not read folder: Permission Denied")
def getProjectDiff(project): def getProjectDiff():
path = os.path.join(app.config['workspace'], project)
return render_template('projectDiff.html', project=project,
diff=getDiff(path))
def commitProjectFiles():
path = realpath(app.config, request.form['project']) path = realpath(app.config, request.form['project'])
if path: if path:
return gitCommit(path, request.form['msg']) return jsonify(code=1, result=getDiff(path))
else: else:
return jsonify(code=0, result="Can not read folder: Permission Denied") return jsonify(code=0,
result="Error: No such file or directory. PERMISSION DENIED!")
def pushProjectFiles(): def pushProjectFiles():
...@@ -695,8 +692,8 @@ app.add_url_rule("/commitProjectFiles", 'commitProjectFiles', commitProjectFiles ...@@ -695,8 +692,8 @@ app.add_url_rule("/commitProjectFiles", 'commitProjectFiles', commitProjectFiles
methods=['POST']) methods=['POST'])
app.add_url_rule("/pushProjectFiles", 'pushProjectFiles', pushProjectFiles, app.add_url_rule("/pushProjectFiles", 'pushProjectFiles', pushProjectFiles,
methods=['POST']) methods=['POST'])
app.add_url_rule("/getProjectDiff/<project>", 'getProjectDiff', getProjectDiff, app.add_url_rule("/getProjectDiff", 'getProjectDiff', getProjectDiff,
methods=['GET']) methods=['POST'])
app.add_url_rule("/newBranch", 'newBranch', newBranch, methods=['POST']) app.add_url_rule("/newBranch", 'newBranch', newBranch, methods=['POST'])
app.add_url_rule("/changeBranch", 'changeBranch', changeBranch, methods=['POST']) app.add_url_rule("/changeBranch", 'changeBranch', changeBranch, methods=['POST'])
app.add_url_rule("/saveFileContent", 'saveFileContent', saveFileContent, app.add_url_rule("/saveFileContent", 'saveFileContent', saveFileContent,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment