Skip to content

Loading…

Removing ajax handler from submission-button #181

Closed
wants to merge 1 commit into from

2 participants

@daviddavis

This will fix the new and edit pages by allowing them to work the same as before the code box refactoring.

@amalloy
4clojure member

Cherry-picked into the release branch and applied. Thanks.

@amalloy amalloy closed this
@amalloy
4clojure member

On reflection I should have merged instead of cherry-picking; I thought that wouldn't work but of course it would have. So, sorry for the inconvenience but upstream develop is probably no longer a fast-forward of yours. Let me know if you have trouble getting up to date, but IIRC you're pretty competent with git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 22, 2011
  1. Removing ajax handler from submission-button to fix the edit problem …

    David Davis committed
    …and new problem pages
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 1 deletion.
  1. +8 −1 resources/public/script/codebox.js
  2. +1 −0 src/foreclojure/problems.clj
View
9 resources/public/script/codebox.js
@@ -22,7 +22,8 @@ var CodeBox = {
this.setupEditor();
}
- this.submitButtons.live("click", $.proxy(this.run, this));
+ $("#run-button").live("click", $.proxy(this.run, this));
+ $("#submission-button").live("click", $.proxy(this.submitProblem, this));
},
setupEditor: function() {
@@ -58,6 +59,12 @@ var CodeBox = {
$("#code-div").toggle('fast');
},
+ submitProblem: function(e) {
+ e.preventDefault();
+ $("#code-box").val(this.getCode());
+ $("#code-box").closest("form").submit();
+ },
+
run: function(e) {
e.preventDefault();
View
1 src/foreclojure/problems.clj
@@ -305,6 +305,7 @@ Return a map, {:message, :error, :url, :num-tests-passed}."
[:p#instruct "Code which fills in the blank: "]
(when (wants-no-javascript-codebox?) [:span#disable-javascript-codebox])
(text-area {:id "code-box"
+ :name "code"
:spellcheck "false"}
:code (escape-html
(or (session/flash-get :code)
Something went wrong with that request. Please try again.