~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/tutorial/templates/exercise_delete.html

  • Committer: Nick Chadwick
  • Date: 2009-03-10 13:35:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1162.
  • Revision ID: chadnickbok@gmail.com-20090310133539-1zerqg77sy6izqku
Exercise objects in the database module, along with their test cases,
now have delete() methods, which allow for 'safe' removal. Calling
this method will only delete an exercise if it has no saves or attempts
associated with it.

Updated ExerciseDeleteView to make use of this new functionality.

Updated ExerciseDeleteView, and its template, to be clearer in their
control flow.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
  <body>
11
11
    <h1>Delete Exercise - ${exercise.id}</h1>
12
12
    <div id="ivle_padding">
13
 
    <py:if test="deleted">
14
 
      <h3>Exercise Deleted</h3>
15
 
      <a href="/+exercises">Return to Exercise List</a>
16
 
    </py:if>
17
 
    <py:if test="deleted == False">
18
 
      <py:if test="hasworksheets == False">
19
 
        <h3>Identifier:</h3>
20
 
        <p>${exercise.id}</p>
21
 
        <h3>Name:</h3>
22
 
        <p>${exercise.name}</p>
23
 
        <p>Are you sure you wish to delete this exercise?</p>
24
 
        <form action="${path}" method="POST">
25
 
          <input type="submit" value="Delete"/>
26
 
        </form>
27
 
      </py:if>
28
 
      <py:if test="hasworksheets">
29
 
          <h3>Denied</h3>
30
 
          <p>You cannot delete this exercise, as it has been associated with a worksheet.</p>
31
 
      </py:if>
32
 
    </py:if>
 
13
    <py:choose test="method">
 
14
      <py:when test="'POST'">
 
15
        <py:choose test="deleted">
 
16
          <py:when test="True">
 
17
            <h3>Exercise Deleted</h3>
 
18
            <a href="/+exercises">Return to Exercise List</a>
 
19
          </py:when>
 
20
          <py:otherwise>
 
21
            <h3>Error Deleting Exercise</h3>
 
22
            <p>The specified exercise could not be deleted. This could be because it is linked to one or more worksheets.</p>
 
23
          </py:otherwise>
 
24
        </py:choose>
 
25
      </py:when>
 
26
      <py:otherwise>
 
27
        <py:choose test="has_worksheets">
 
28
          <py:when test="True">
 
29
            <h3>Denied</h3>
 
30
            <p>You cannot delete this exercise, as it has been associated with a worksheet.</p>
 
31
          </py:when>
 
32
          <py:otherwise>
 
33
            <h3>Identifier:</h3>
 
34
            <p>${exercise.id}</p>
 
35
            <h3>Name:</h3>
 
36
            <p>${exercise.name}</p>
 
37
            <p>Are you sure you wish to delete this exercise?</p>
 
38
            <form action="${path}" method="POST">
 
39
              <input type="submit" value="Delete"/>
 
40
            </form>
 
41
          </py:otherwise>
 
42
        </py:choose>
 
43
      </py:otherwise>
 
44
    </py:choose>
33
45
    </div>
34
46
  </body>
35
47
</html>