Got bug detail editing working, except for the summary.
authorSteve Losh <steve@stevelosh.com>
Sun, 1 Feb 2009 22:28:05 +0000 (17:28 -0500)
committerSteve Losh <steve@stevelosh.com>
Sun, 1 Feb 2009 22:28:05 +0000 (17:28 -0500)
.be/bugs/0be47243-c172-4de9-b71b-d5dea60f91d5/values [new file with mode: 0644]
.be/bugs/cfb52b6c-d1a6-4018-a255-27cc1c878193/values [new file with mode: 0644]
cfbe.py
static/style/cfbe.css
templates/base.html
templates/bug.html

diff --git a/.be/bugs/0be47243-c172-4de9-b71b-d5dea60f91d5/values b/.be/bugs/0be47243-c172-4de9-b71b-d5dea60f91d5/values
new file mode 100644 (file)
index 0000000..93bc968
--- /dev/null
@@ -0,0 +1,49 @@
+
+
+
+assigned=Steve Losh <steve@stevelosh.com>
+
+
+
+
+
+
+creator=Steve Losh <steve@stevelosh.com>
+
+
+
+
+
+
+severity=minor
+
+
+
+
+
+
+status=open
+
+
+
+
+
+
+summary=Fix the null creation date bug.  See bug ee6 in the BE repo for an example that breaks things.
+
+
+
+
+
+
+target=alpha
+
+
+
+
+
+
+time=Sun, 01 Feb 2009 21:26:49 +0000
+
+
+
diff --git a/.be/bugs/cfb52b6c-d1a6-4018-a255-27cc1c878193/values b/.be/bugs/cfb52b6c-d1a6-4018-a255-27cc1c878193/values
new file mode 100644 (file)
index 0000000..49fa830
--- /dev/null
@@ -0,0 +1,49 @@
+
+
+
+assigned=Steve Losh <steve@stevelosh.com>
+
+
+
+
+
+
+creator=Steve Losh <steve@stevelosh.com>
+
+
+
+
+
+
+severity=minor
+
+
+
+
+
+
+status=open
+
+
+
+
+
+
+summary=Change the write operations to be inline/AJAJ operations.
+
+
+
+
+
+
+target=beta
+
+
+
+
+
+
+time=Sun, 01 Feb 2009 21:15:35 +0000
+
+
+
diff --git a/cfbe.py b/cfbe.py
index 0a8db776d0ab58ee48501df0bc4bd6ac5f234713..9724fe77135cee2fb4d4d54ea85610a4c8121ce2 100755 (executable)
--- a/cfbe.py
+++ b/cfbe.py
@@ -23,19 +23,22 @@ class WebInterface:
         self.repository_name = self.bd.root.split('/')[-1]
     
     def get_common_information(self):
-        possible_assignees = list(set([bug.assigned for bug in self.bd if bug.assigned != None]))
+        possible_assignees = list(set([bug.assigned for bug in self.bd if unicode(bug.assigned) != 'None']))
         possible_assignees.sort(key=unicode.lower)
         
-        possible_targets = list(set([bug.target for bug in self.bd if bug.target != None]))
+        possible_targets = list(set([bug.target for bug in self.bd if unicode(bug.target) != 'None']))
         possible_targets.sort(key=unicode.lower)
         
         possible_statuses = [u'open', u'assigned', u'test', u'unconfirmed', 
-                             u'wishlist', u'closed', u'disabled', u'fixed', 
-                             u'wontfix']
+                             u'closed', u'disabled', u'fixed', u'wontfix']
+        
+        possible_severities = [u'minor', u'serious', u'critical', u'fatal', 
+                               u'wishlist']
         
         return {'possible_assignees': possible_assignees,
                 'possible_targets': possible_targets,
                 'possible_statuses': possible_statuses,
+                'possible_severities': possible_severities,
                 'repository_name': self.repository_name,}
     
     def filter_bugs(self, status, assignee, target):
@@ -77,6 +80,7 @@ class WebInterface:
                                assignees=common_info['possible_assignees'],
                                targets=common_info['possible_targets'],
                                statuses=common_info['possible_statuses'],
+                               severities=common_info['possible_severities'],
                                repository_name=common_info['repository_name'])
     
     
@@ -94,6 +98,7 @@ class WebInterface:
                                assignees=common_info['possible_assignees'],
                                targets=common_info['possible_targets'],
                                statuses=common_info['possible_statuses'],
+                               severities=common_info['possible_severities'],
                                repository_name=common_info['repository_name'])
     
     
@@ -117,7 +122,26 @@ class WebInterface:
         
         raise cherrypy.HTTPRedirect('/bug?id=%s' % (shortname,), status=302)
     
+    @cherrypy.expose
+    def edit(self, id, status, target, assignee, severity, summary=''):
+        """The view that handles editing bug details."""
+        bug = self.bd.bug_from_uuid(id)
+        shortname = self.bd.bug_shortname(bug)
+        
+        if summary.strip() != '':
+            bug.summary = summary
+        else:
+            bug.status = status if status != 'None' else None
+            bug.target = target if target != 'None' else None
+            bug.assigned = assignee if assignee != 'None' else None
+            bug.severity = severity if severity != 'None' else None
+            
+        bug.save()
+        
+        raise cherrypy.HTTPRedirect('/bug?id=%s' % (shortname,), status=302)
+    
 
 config = '/Users/sjl/Documents/cherryflavoredbugseverywhere/cfbe.config'
 bug_root = '/Users/sjl/Desktop/be/.be'
+# bug_root = '/Users/sjl/Documents/cherryflavoredbugseverywhere/.be'
 cherrypy.quickstart(WebInterface(bug_root), '/', config)
index 2ad25fcfd9f69068aab0d0adb5151b04c3fbb089..8c7cef9820ea72b33e70a6ca784fb67f4e66c976 100644 (file)
@@ -23,6 +23,8 @@ span#filters a { margin-left: 1.5em; }
 a:link, a:visited, a:active { color: #d03; text-decoration: none; font-weight: bold; }
 a:hover { color: #60b305; }
 
+.header-with-link { display: inline-block; }
+.header-link { margin-left: 1em; }
 
 table#bug-list { width: 100%; border-collapse: collapse; border: 0.084em solid #ccc; }
 table#bug-list td, table#bug-list th { border: 0em; border-bottom: 0.084em solid #ccc; text-align: left; }
@@ -48,4 +50,8 @@ form#create-form input#create-summary { width: 30em; font-weight: 700; }
 form#create-form button#create-button { }
 
 form#add-comment-form { display: none; margin-top: 1.5em; }
-p#add-comment-link {margin-top: 1.5em; }
\ No newline at end of file
+p#add-comment-link {margin-top: 1.5em; }
+
+form#bug-details-edit-form { display: none; }
+form#bug-details-edit-form label { font-weight: 700; width: 7.5em; margin-left: 0em; margin-right: 1em; text-align: right; }
+form#bug-details-edit-form .field { padding-left: 0em;}
\ No newline at end of file
index c860e659d76f0ca0ec70f623053240c687e9e6e0..250322434614f060267c217027a1f5d67a5e5b5c 100644 (file)
                     e.preventDefault();
                 });
                 
-                $('#add-comment').click(function(e) {
-                    $('#add-comment-link').hide();
-                    $('#add-comment-form').fadeIn('fast');
-                    e.preventDefault();
-                });
-                
                 $('table tr:odd').addClass('stripe');
             });
         </script>
+        
+        {% block script %}{% endblock %}
     </head>
     
     <body>
index 2cdbb280d52b731db4f907b3d079948b5256b39b..01a2476af4decf3b7b06d775315449ad15586938 100644 (file)
@@ -4,11 +4,38 @@
     Bug {{ bd.bug_shortname(bug) }} &ndash; {{ bug.summary }}
 {% endblock %}
 
+{% block script %}
+    <script type="text/javascript">
+        $(function() {
+            $('#add-comment').click(function(e) {
+                $('#add-comment-link').hide();
+                $('#add-comment-form').fadeIn('fast');
+                e.preventDefault();
+            });
+            
+            $('#edit-bug-details').click(function(e) {
+                $('#bug-details').hide();
+                $('#bug-details-edit-form').fadeIn('fast');
+                e.preventDefault();
+            });
+            
+            $('#bug-details-edit-status option[value="{{ bug.status }}"]').attr('selected', 'yes');
+            $('#bug-details-edit-target option[value="{{ bug.target }}"]').attr('selected', 'yes');
+            $('#bug-details-edit-assignee option[value="{{ bug.assigned }}"]').attr('selected', 'yes');
+            $('#bug-details-edit-severity option[value="{{ bug.severity }}"]').attr('selected', 'yes');
+        });
+    </script>
+{% endblock %}
+
 {% block content %}
     <p class="creation-info">Created on {{ bug.time|datetimeformat }} by {{ bug.creator|e }}</p>
     
-    <h3>Bug Details</h3>
-    <p>
+    <h3 class="header-with-link">Bug Details</h3>
+    <span class="header-link">
+        <a href="" id="edit-bug-details">edit</a>
+    </span>
+    
+    <p id="bug-details">
         <span class="detail-field-header">Status:</span>
         <span class="detail-field-contents">{{ bug.status }}</span><br />
         
         <span class="detail-field-contents">{{ bug.uuid }}</span><br />
     </p>
     
+    <form id="bug-details-edit-form" class="horizontal" action="/edit" method="post">
+        <fieldset>
+            <input type="hidden" name="id" value="{{ bug.uuid }}" />
+            <div class="field">
+                <label for="bug-details-edit-status">Status:</label>
+                <select id="bug-details-edit-status" name="status">
+                    {% for status in statuses %}
+                        <option value="{{ status }}">{{ status }}</option>
+                    {% endfor %}
+                </select>
+            </div>
+            <div class="field">
+                <label for="bug-details-edit-severity">Severity:</label>
+                <select id="bug-details-edit-severity" name="severity">
+                    {% for severity in severities %}
+                        <option value="{{ severity }}">{{ severity }}</option>
+                    {% endfor %}
+                </select>
+            </div>
+            <div class="field">
+                <label for="bug-details-edit-target">Scheduled for:</label>
+                <select id="bug-details-edit-target" name="target">
+                    <option value="None">Unscheduled</option>
+                    {% for target in targets %}
+                        <option value="{{ target }}">{{ target }}</option>
+                    {% endfor %}
+                </select>
+            </div>
+            <div class="field">
+                <label for="bug-details-edit-assignee">Assigned to:</label>
+                <select id="bug-details-edit-assignee" name="assignee">
+                    <option value="None">Unassigned</option>
+                    {% for assignee in assignees %}
+                        <option value="{{ assignee }}">{{ assignee }}</option>
+                    {% endfor %}
+                </select>
+            </div>
+            <div class="buttons">
+                <button type="submit">Save Changes</button>
+                <button type="reset">Discard Changes</button>
+            </div>
+        </fieldset>
+    </form>
+    
     <h3>Summary</h3>
     <p>
         {{ bug.summary }}