Created
December 7, 2012 22:45
-
-
Save moschlar/4237143 to your computer and use it in GitHub Desktop.
Generated HTML
This file contains hidden or 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
<script type="text/javascript">ace.require("ace/ext/textarea").transformTextarea(document.getElementById("source")).getSession().setMode("ace/mode/java")</script> | |
<script type="text/javascript">ace.require("ace/ext/textarea").transformTextarea(document.getElementById("source")).getSession().setMode("ace/mode/java").getSession().setMode("ace/mode/java")</script> |
This file contains hidden or 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
diff --git a/sauce/widgets/submission.py b/sauce/widgets/submission.py | |
index e89fd1f..85a76da 100644 | |
--- a/sauce/widgets/submission.py | |
+++ b/sauce/widgets/submission.py | |
@@ -7,6 +7,8 @@ Created on 17.03.2012 | |
import tw2.core as twc | |
import tw2.bootstrap.forms as twbf | |
+import tw2.ace as twa | |
+ | |
try: | |
from tw2.jqplugins.chosen import ChosenSingleSelectField as SingleSelectField | |
except ImportError: | |
@@ -24,7 +26,7 @@ class SubmissionForm(twbf.HorizontalForm): | |
help_text=u'An automatically generated filename may not meet the '\ | |
'language\'s requirements (e.g. the Java class name)', | |
css_class='span3') | |
- source = twbf.TextArea(placeholder=u'Paste your source code here', | |
+ source = twa.AceWidget(placeholder=u'Paste your source code here', | |
css_class='span7', rows=10) | |
source_file = twbf.FileField(css_class='span7') | |
@@ -34,4 +36,5 @@ class SubmissionForm(twbf.HorizontalForm): | |
def prepare(self): | |
self.child.c.language_id.options = [(l.id, l.name) for l in self.value.assignment.allowed_languages] | |
+ self.child.c.source.mode = self.value.language.name.lower() | |
super(SubmissionForm, self).prepare() |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
''' | |
Created on 17.03.2012 | |
@author: moschlar | |
''' | |
import tw2.core as twc | |
import tw2.bootstrap.forms as twbf | |
import tw2.ace as twa | |
try: | |
from tw2.jqplugins.chosen import ChosenSingleSelectField as SingleSelectField | |
except ImportError: | |
from tw2.forms.bootstrap import SingleSelectField | |
class SubmissionForm(twbf.HorizontalForm): | |
title = 'Submission' | |
id = twbf.HiddenField(validator=twc.IntValidator) | |
assignment_id = twbf.HiddenField(validator=twc.IntValidator) | |
filename = twbf.TextField(placeholder=u'Enter a filename, if needed', | |
help_text=u'An automatically generated filename may not meet the '\ | |
'language\'s requirements (e.g. the Java class name)', | |
css_class='span3') | |
source = twa.AceWidget(placeholder=u'Paste your source code here', | |
css_class='span7', rows=10) | |
source_file = twbf.FileField(css_class='span7') | |
language_id = SingleSelectField(options=[], prompt_text=None, | |
css_class='span3', | |
required=True, validator=twc.IntValidator(required=True)) | |
def prepare(self): | |
self.child.c.language_id.options = [(l.id, l.name) for l in self.value.assignment.allowed_languages] | |
self.child.c.source.mode = self.value.language.name.lower() | |
super(SubmissionForm, self).prepare() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment