Numerous bugfixes.

portnov [2008-06-14 15:45:58]
Numerous bugfixes.
Filename
media/css/main.css
mgmt/views.py
pygit/views.py
templates/bug_body.html
templates/git_commits.html
diff --git a/media/css/main.css b/media/css/main.css
index a97bba0..c073000 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -30,8 +30,8 @@ table {
 }

 td {
-  border-right: 1px #ddd solid;
-  border-bottom: 1px #888 solid;
+  border-right: 1px #ddd dashed;
+  border-bottom: 1px #ddd solid;
   padding: 0.6ex;
 }

@@ -260,7 +260,7 @@ span.pager {
 }

 .bug {
-  border: 1px #888 solid;
+  border: 1px #ddd solid;
   padding: 1ex;
   margin-bottom: 1ex;
 }
@@ -286,8 +286,9 @@ span.pager {
 }

 .request {
-  border: 1px #888 solid;
+  border: 1px #ddd solid;
   padding: 1ex;
+  margin-bottom: 1em;
 }

 .request-state-1 {
diff --git a/mgmt/views.py b/mgmt/views.py
index db799f7..1c02a21 100644
--- a/mgmt/views.py
+++ b/mgmt/views.py
@@ -156,6 +156,7 @@ def project_bugs(request,id):
        'can_report': can_report},
        request)

+@login_required
 def bug_report(request,pid):
   project = Project.objects.get(pk=pid)
   if request.method=='POST':
@@ -323,12 +324,27 @@ def one_bug(request,id):
 @check_auth(Bug,'edit')
 def edit_bug(request,bug):
   if request.method=='POST':
-    name = request.POST['name']
-    text = request.POST['text']
-    bug.name = name
-    bug.text = text
-    bug.save()
-  form = BugForm(dict(name=bug.name, text=bug.text))
+    form = BugForm(request.POST)
+    if form.is_valid():
+      name = form.cleaned_data['name']
+      text = form.cleaned_data['text']
+      comp = form.cleaned_data['component']
+      actions = form.cleaned_data['your_actions']
+      expected = form.cleaned_data['expected']
+      unexpected = form.cleaned_data['unexpected']
+      bug.name = name
+      bug.text = text
+      bug.component = comp
+      bug.actions = actions
+      bug.expected = expected
+      bug.unexpected = unexpected
+      bug.save()
+  form = BugForm({'name': bug.name,
+                  'text': bug.text,
+                  'component': bug.component,
+                  'your_actions': bug.actions,
+                  'expected': bug.expected,
+                  'unexpected': bug.unexpected})
   return render_it('edit_bug.html',
       {'project': bug.project,
        'bug': bug,
diff --git a/pygit/views.py b/pygit/views.py
index 1ddb017..6af6cc9 100644
--- a/pygit/views.py
+++ b/pygit/views.py
@@ -75,6 +75,7 @@ def commits(request,rid,branch='master'):
   cs = pygit.commits(rid,branch,50)
   return render_it('git_commits.html',
       {'repo': repo_rid(rid),
+       'current_branch': branch,
        'commits': cs},
       request)

diff --git a/templates/bug_body.html b/templates/bug_body.html
index f158658..24ae9ab 100644
--- a/templates/bug_body.html
+++ b/templates/bug_body.html
@@ -14,8 +14,8 @@
         {% if bug.component %}
           <p><strong>Компонент:</strong> {{bug.component}}</p>
         {% endif %}
-        <p><strong>Действия для воспроизведения:</strong> {{bug.actions}}</p>
-        <p><strong>Ожидаемое поведение:</strong> {{bug.expected}}</p>
-        <p><strong>Получаемое поведение:</strong> {{bug.unexpected}}</p>
+        <p><strong>Действия для воспроизведения:</strong> {{bug.actions|markdown|safe}}</p>
+        <p><strong>Что ожидали:</strong> {{bug.expected|markdown|safe}}</p>
+        <p><strong>Что получили:</strong> {{bug.unexpected|markdown|safe}}</p>
         <div>{{bug.text|markdown|safe}}</div>
       </div>
diff --git a/templates/git_commits.html b/templates/git_commits.html
index ffe7b57..9444769 100644
--- a/templates/git_commits.html
+++ b/templates/git_commits.html
@@ -4,5 +4,12 @@

 {% block git %}
 <h1>Последние коммиты в репозитории {{repo.description}}</h1>
-{% include "commits_table.html" %}
+<table>
+  {% for id,dt,author,message in commits %}
+    <tr>
+      <td><a href='{% url pygit.views.diff_all repo.rid,current_branch,id %}'>{{id}}</a></td>
+      <td>{{dt}}</td><td>{{author}}</td><td>{{message}}</td>
+    </tr>
+  {% endfor %}
+</table>
 {% endblock %}
ViewGit