auto restore last attempt training

![screen shot 2014-09-07 at 22 55 35](https://cloud.githubusercontent.com/assets/4983239/4178625/2f710756-369f-11e4-837b-8bb14d17017b.png)

1. If a student haven't done a coding question, his code will be saved and auto restore next time.

2.provide a button if he wants to revert to the template code

3.UI is not beautiful.. need improve
I tried this, one issue is if I do that there will be an empty blank at the
beginning of code. how to solve ?

On Thu, Sep 11, 2014 at 12:14 AM, Raymoond Tang <notifications@github.com>
wrote:

> In app/views/assessment/training_submissions/_do_coding.html.erb:
>
> >              language="<%= question.language.codemirror_mode %>"
> > -            version="<%= question.language.version %>"><%= prefilled %></textarea>
> > +            version="<%= question.language.version %>"><% if !finished && last_attempt %><%= last_attempt %><% else %><%= prefilled %><% end %></textarea>
>
> make this into multiple line for readability
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Coursemology/coursemology.org/pull/203/files#r17371078>
> .
>