Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
JSONtemp
50 changes: 35 additions & 15 deletions gojs.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
from flask import Flask, render_template, request
import ast
import ast, json
app = Flask(__name__)

currModel = {}
tempNo = 0

with open('../templates/jstemplates/datum.json') as data_file:
currModel = json.load(data_file)

@app.route('/')
def hello_world():
# with open('/static/tmp/test.txt', 'r') as myfile:
# stable = myfile.read()
return render_template('index.html',currModel=json.dumps(currModel))

# return render_template('index.html', passin=stable)
return render_template('index.html')
@app.route('/savecurrmodel', methods = ['GET','POST'])
def postdata():
currModel = json.loads(request.args.get("payload"))
global tempNo
with open("tempNo.txt", "r") as tempNoFile:
tempNo = int(tempNoFile.readlines()[0])
with open('JSONtemp/temp'+str(tempNo)+'.txt', 'w') as write_file:
json.dump(currModel, write_file, indent=4, sort_keys=True)
tempNo += 1
with open("tempNo.txt", "w") as tempNoFile:
tempNoFile.write(str(tempNo))
return "OK"

@app.route('/loadtemplate', methods = ['GET'])
def loadtemplate():
print "******bp1"
loadFileName = request.args.get("payload")
print "******bp2 " + loadFileName
loadTemplate = {}
with open("../templates/jstemplates/" + loadFileName) as loadFile:
loadTemplate = loadFile.readlines()
print "******bp3 " + " ".join(loadTemplate)
return " ".join(loadTemplate), 200

@app.route('/postdata/', methods = ['GET', 'POST'])
def postdata():
print "post"
x = request.form['posted_data']
# card_dictionary = ast.literal_eval(request.form['posted_data'])
# print card_dictionary['loc']
# print card_dictionary
# print x
# print render_template('test_card.html')
return render_template('test_card.html')
@app.errorhandler(500)
def handle_bad_request(e):
print e

@app.errorhandler(400)
def handle_bad_request(e):
print e

if __name__ == '__main__':
app.run()
62 changes: 55 additions & 7 deletions static/css/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/css/index.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 60 additions & 7 deletions static/css/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ body {
overflow: scroll;
}

.js-editAnswerType {
display: inline-block;
width: 90%;
}

.js-editIconIcon {
color: $grey500;
display: inline-block;
Expand Down Expand Up @@ -131,6 +126,7 @@ body {
opacity: 0;
transition: .5s all;
display: inline-block;
z-index: 20;
}

#mySavedModel {
Expand All @@ -139,11 +135,13 @@ body {

.js-editButtonWrapper {
display: inline-block;
z-index: 0;
}

.js-editButtonIcon {
margin-left: 5px;
margin-right: 5px;
margin-bottom: 10px;
min-width: 50px;
overflow: scroll;
display: inline-block;
Expand All @@ -157,7 +155,7 @@ body {
max-width: 75px;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 0px;
margin-bottom: 10px;
display: none;
text-transform: uppercase;
height: 54px;
Expand All @@ -177,7 +175,7 @@ body {
-moz-box-shadow: none;
box-shadow: none;
margin-left: 10px;
min-width: 75px;
min-width: 100px;
}

.diagramEditButton:hover {
Expand All @@ -192,3 +190,58 @@ body {
.diagramEditButton:disabled:hover {
background-color: $parchment;
}

.ddButtonWrapper {
display: inline-block;
position:relative;
}

.ddButton {
position:absolute;
display: none;
cursor: pointer;
margin: 0px;
li {
padding: 2px 6px 2px 6px;
border-bottom: 0px;
}
li:last-child {
border-bottom: 1px solid $ink;
}
}
.ddButton.show {
display:block;
z-index:1;
top:25px;
}

.js-editAnswerType {
-webkit-border-radius: 2px;
-webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
-webkit-padding-end: 20px;
-webkit-padding-start: 2px;
-webkit-user-select: none;
border: 1px solid #AAA;
color: #555;
font-size: inherit;
margin: 20px;
overflow: hidden;
padding: 5px 10px;
text-overflow: ellipsis;
white-space: nowrap;
width: 80%;
display: inline-block;
}

.zoom {
position: absolute;
top: 5px;
left: 5px;
z-index: 999;
.diagramEditButton {
display: block;
min-width: 30px;
margin-bottom: 2px;
margin-left: 0px;
}
}
Loading