forked from erdl/survey_admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
601 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/python3 | ||
from ubuntuStation import app, db | ||
#from flask import Flask | ||
import os | ||
|
||
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1' | ||
app.run(debug=True, host='0.0.0.0', port=8989) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
$(function() { | ||
$("div[data-toggle=fieldset]").each(function() { | ||
var $this = $(this); | ||
|
||
//Add new entry | ||
$this.find("button[data-toggle=fieldset-add-row]").click(function() { | ||
var target = $($(this).data("target")) | ||
console.log(target); | ||
var oldrow = target.find("[data-toggle=fieldset-entry]:last"); | ||
var row = oldrow.clone(true, true); | ||
console.log(row.find(":input")[0]); | ||
var elem_id = row.find(":input")[0].id; | ||
var elem_num = parseInt(elem_id.replace(/.*-(\d{1,4})-.*/m, '$1')) + 1; | ||
row.attr('data-id', elem_num); | ||
row.find(":input").each(function() { | ||
console.log(this); | ||
var id = $(this).attr('id').replace('-' + (elem_num - 1) + '-', '-' + (elem_num) + '-'); | ||
$(this).attr('name', id).attr('id', id).val('').removeAttr("checked"); | ||
}); | ||
oldrow.after(row); | ||
}); //End add new entry | ||
|
||
//Remove row | ||
$this.find("button[data-toggle=fieldset-remove-row]").click(function() { | ||
if($this.find("[data-toggle=fieldset-entry]").length > 1) { | ||
var thisRow = $(this).closest("[data-toggle=fieldset-entry]"); | ||
thisRow.remove(); | ||
} | ||
}); //End remove row | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<div class="well"> | ||
{% from "_formhelpers.html" import render_field %} | ||
{{ form.csrf_token }} | ||
<h1>Edit Question</h1> | ||
<p class="text-muted">Edit an existing question.</p> | ||
<div class="container"> | ||
<form action={{ url_for('edit_question_form', questionid=qid) }} method="post" name="edit_question_form"> | ||
<fieldset> | ||
{{ form.hidden_tag() }} | ||
<div class="form-group"> | ||
{{ render_field(form.questiontext) }} | ||
</div> | ||
<div class="form-group"> | ||
{{ render_field(form.questiondescription) }} | ||
</div> | ||
<div class="form-group" style="margin-bottom:35px"> | ||
{{ render_field(form.questiontype) }} | ||
</div> | ||
<div data-toggle="fieldset" id="option-fieldset"> | ||
<label>Add more entries</label> | ||
<button type="button" data-toggle="fieldset-add-row" | ||
data-target="#option-fieldset">+</button> | ||
<table> | ||
<tr> | ||
<th>Option</th> | ||
<th>Response Position</th> | ||
<th> | ||
<a href="http://www.color-hex.com/" target="_blank" >Option Color</a> | ||
</th> | ||
</tr> | ||
{% for entries in form.entries %} | ||
<tr data-toggle="fieldset-entry"> | ||
<td>{{ entries.option }}</td> | ||
<td>{{ entries.responseposition }}</td> | ||
<td>{{ entries.optioncolor }}</td> | ||
<td><button type="button" data-toggle="fieldset-remove-row" id="entries-{{loop.index0}}-remove">-</button></td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</div> | ||
<script src="https://code.jquery.com/jquery-2.1.4.js"></script> | ||
<script src="{{ url_for("static", filename="questionpage.js") }}"></script> | ||
<script type="text/javascript"> | ||
var csrf_token = "{{ csrf_token() }}"; | ||
|
||
$.ajaxSetup({ | ||
beforeSend: function(xhr, settings) { | ||
if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) { | ||
xhr.setRequestHeader("X-CSRFToken", csrf_token); | ||
} | ||
} | ||
}); | ||
</script> | ||
<a href="{{ url_for('question_page', questionid=qid) }}" class="btn btn-default">Cancel</a> | ||
<button type ="submit" name="action" class="btn btn-primary" value="Submit">Submit</button> | ||
<!--<button type ="submit" name="action" style="margin-right:150px;float:right" class="btn btn-danger" value="Delete">Delete</button>--> | ||
</fieldset> | ||
</form> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<div class="well"> | ||
{% from "_formhelpers.html" import render_field %} | ||
{{ form.csrf_token }} | ||
<h1>Edit Survey</h1> | ||
<p class="text-muted">Edit an existing survey.</p> | ||
<div class="container"> | ||
<form action={{ url_for('edit_survey_form', surveyid=sid) }} method="post" name="edit_survey_form"> | ||
<fieldset> | ||
{{ form.hidden_tag() }} | ||
<div class="form-group"> | ||
{{ render_field(form.surveyname) }} | ||
</div> | ||
<div class="form-group"> | ||
{{ render_field(form.description) }} | ||
</div> | ||
<div class="form-group"> | ||
{{ render_field(form.question) }} | ||
</div> | ||
<a href="{{ url_for('show_surveys') }}" class="btn btn-default">Cancel</a> | ||
<button type ="submit" name="action" class="btn btn-primary" value="Submit">Submit</button> | ||
<!--<button type ="submit" name="action" style="margin-right:150px;float:right" class="btn btn-danger" value="Delete">Delete</button>--> | ||
</fieldset> | ||
</form> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<div class="well"> | ||
{% from "_formhelpers.html" import render_field %} | ||
{{ form.csrf_token }} | ||
<h1>Edit User</h1> | ||
<p class="text-muted">Edit an user's credentials.</p> | ||
<div class="container"> | ||
<form action={{ url_for('edit_user_form', id=id) }} method="post" name="edit_user_form"> | ||
<fieldset> | ||
{{ form.hidden_tag() }} | ||
<div class="form-group"> | ||
{{ render_field(form.name) }} | ||
</div> | ||
<div class="form-group"> | ||
{{ render_field(form.email) }} | ||
</div> | ||
<a href="{{ url_for('show_users') }}" class="btn btn-default">Cancel</a> | ||
<button type ="submit" name="action" class="btn btn-primary" value="Submit">Submit</button> | ||
<!--<button type ="submit" name="action" style="margin-right:150px;float:right" class="btn btn-danger" value="Delete">Delete</button>--> | ||
</fieldset> | ||
</form> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,10 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<div class="well"> | ||
{% from "_formhelpers.html" import render_field %} | ||
{{ form.csrf_token }} | ||
<h1>Log In</h1> | ||
<p class="text-danger">You must log in to see this page.</p> | ||
<div class="container"> | ||
<form action="/login" method="post" name="login_form"> | ||
{{ form.hidden_tag() }} | ||
<div class="form-group"> | ||
{{ render_field(form.username) }} | ||
</div> | ||
<div class="form-group"> | ||
{{ render_field(form.password) }} | ||
</div> | ||
<button type=submit class="btn btn-primary" value=Submit>Submit</button> | ||
</fieldset> | ||
</form> | ||
<a href="{{auth_url}}" class="btn";"><img src="static/google_login.png" width="335.2" height="68.8"></a> | ||
</div> | ||
</div> | ||
{% endblock %} |
Oops, something went wrong.