Implemented bug editing.
authorSteve Losh <steve@stevelosh.com>
Sun, 1 Feb 2009 23:02:31 +0000 (18:02 -0500)
committerSteve Losh <steve@stevelosh.com>
Sun, 1 Feb 2009 23:02:31 +0000 (18:02 -0500)
.be/bugs/545311df-8c88-4504-9f83-11d7c5d8aa50/comments/88d54d29-7312-4bb3-bc50-1970bdb2bb0e/body [new file with mode: 0644]
.be/bugs/545311df-8c88-4504-9f83-11d7c5d8aa50/comments/88d54d29-7312-4bb3-bc50-1970bdb2bb0e/values [new file with mode: 0644]
.be/bugs/545311df-8c88-4504-9f83-11d7c5d8aa50/values
.be/bugs/d63d0bdd-e025-4f7c-9fcf-47a71de6d4d4/values [new file with mode: 0644]
cfbe.py
static/style/cfbe.css
templates/bug.html

diff --git a/.be/bugs/545311df-8c88-4504-9f83-11d7c5d8aa50/comments/88d54d29-7312-4bb3-bc50-1970bdb2bb0e/body b/.be/bugs/545311df-8c88-4504-9f83-11d7c5d8aa50/comments/88d54d29-7312-4bb3-bc50-1970bdb2bb0e/body
new file mode 100644 (file)
index 0000000..5becd48
--- /dev/null
@@ -0,0 +1 @@
+Apparently the summary can only be one line.  That makes the whitespace issue less relevant.
\ No newline at end of file
diff --git a/.be/bugs/545311df-8c88-4504-9f83-11d7c5d8aa50/comments/88d54d29-7312-4bb3-bc50-1970bdb2bb0e/values b/.be/bugs/545311df-8c88-4504-9f83-11d7c5d8aa50/comments/88d54d29-7312-4bb3-bc50-1970bdb2bb0e/values
new file mode 100644 (file)
index 0000000..41f53c6
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Sun, 01 Feb 2009 22:49:29 +0000
+
+
+
+
+
+
+From=Steve Losh <steve@stevelosh.com>
+
+
+
index 8ed8ba9aa024633b1986102b993f9d3b37d410cd..ee7978beee56e6741492fb623e7934ec8ba110ba 100644 (file)
@@ -1,7 +1,7 @@
 
 
 
-assigned=Steve Losh <steve@stevelosh.com>
+assigned=Steve Losh
 
 
 
@@ -22,14 +22,14 @@ severity=minor
 
 
 
-status=open
+status=closed
 
 
 
 
 
 
-summary=Implement bug updating (not comments.
+summary=Implement bug updating (not comments).  Check on the whitespace of the summary field while you're at it.
 
 
 
diff --git a/.be/bugs/d63d0bdd-e025-4f7c-9fcf-47a71de6d4d4/values b/.be/bugs/d63d0bdd-e025-4f7c-9fcf-47a71de6d4d4/values
new file mode 100644 (file)
index 0000000..2d28890
--- /dev/null
@@ -0,0 +1,49 @@
+
+
+
+assigned=Steve Losh
+
+
+
+
+
+
+creator=Steve Losh <steve@stevelosh.com>
+
+
+
+
+
+
+severity=minor
+
+
+
+
+
+
+status=closed
+
+
+
+
+
+
+summary=Reset the state of the values when choosing "Discard Changes."
+
+
+
+
+
+
+target=alpha
+
+
+
+
+
+
+time=Sun, 01 Feb 2009 22:55:13 +0000
+
+
+
diff --git a/cfbe.py b/cfbe.py
index 9724fe77135cee2fb4d4d54ea85610a4c8121ce2..3de43e706d5dda2cb9307b7cedd248583727ba9a 100755 (executable)
--- a/cfbe.py
+++ b/cfbe.py
@@ -123,12 +123,12 @@ class WebInterface:
         raise cherrypy.HTTPRedirect('/bug?id=%s' % (shortname,), status=302)
     
     @cherrypy.expose
-    def edit(self, id, status, target, assignee, severity, summary=''):
+    def edit(self, id, status=None, target=None, assignee=None, severity=None, summary=None):
         """The view that handles editing bug details."""
         bug = self.bd.bug_from_uuid(id)
         shortname = self.bd.bug_shortname(bug)
         
-        if summary.strip() != '':
+        if summary != None:
             bug.summary = summary
         else:
             bug.status = status if status != 'None' else None
@@ -142,6 +142,6 @@ class WebInterface:
     
 
 config = '/Users/sjl/Documents/cherryflavoredbugseverywhere/cfbe.config'
-bug_root = '/Users/sjl/Desktop/be/.be'
-bug_root = '/Users/sjl/Documents/cherryflavoredbugseverywhere/.be'
+bug_root = '/Users/sjl/Desktop/be/.be'
+bug_root = '/Users/sjl/Documents/cherryflavoredbugseverywhere/.be'
 cherrypy.quickstart(WebInterface(bug_root), '/', config)
index 8c7cef9820ea72b33e70a6ca784fb67f4e66c976..34bac92e3ff29566e871e0a2a91d25e7b2665a1f 100644 (file)
@@ -54,4 +54,7 @@ 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
+form#bug-details-edit-form .field { padding-left: 0em; }
+
+form#bug-summary-edit-form { display: none; }
+input#bug-summary-edit-body { width: 100%; }
\ No newline at end of file
index 01a2476af4decf3b7b06d775315449ad15586938..48571e96f67f6dedc6cf8adf5f814b656532e387 100644 (file)
@@ -1,12 +1,19 @@
 {% extends "base.html" %}
 
 {% block page_title %}
-    Bug {{ bd.bug_shortname(bug) }} &ndash; {{ bug.summary }}
+    Bug {{ bd.bug_shortname(bug) }} &ndash; {{ bug.summary|truncate(50) }}
 {% endblock %}
 
 {% block script %}
     <script type="text/javascript">
         $(function() {
+            function set_current_detail_default_values() {
+                $('#bug-details-edit-status option[value="{{ bug.status }}"]').attr('selected', 'yes');
+                $('#bug-details-edit-target option[value="{{ bug.target|e }}"]').attr('selected', 'yes');
+                $('#bug-details-edit-assignee option[value="{{ bug.assigned|striptags }}"]').attr('selected', 'yes');
+                $('#bug-details-edit-severity option[value="{{ bug.severity }}"]').attr('selected', 'yes');
+            }
+            
             $('#add-comment').click(function(e) {
                 $('#add-comment-link').hide();
                 $('#add-comment-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');
+            $('#bug-details-edit-form button[type="reset"]').click(function(e) {
+                $('#bug-details-edit-form').hide();
+                $('#bug-details').fadeIn('fast', function() { set_current_detail_default_values(); } );
+            });
+            
+            $('#edit-bug-summary').click(function(e) {
+                $('#bug-summary').hide();
+                $('#bug-summary-edit-form').fadeIn('fast');
+                e.preventDefault();
+            });
+            
+            $('#bug-summary-edit-form button[type="reset"]').click(function(e) {
+                $('#bug-summary-edit-form').hide();
+                $('#bug-summary').fadeIn('fast', function() { set_current_detail_default_values(); } );
+            });
+            
+            set_current_detail_default_values();
         });
     </script>
 {% endblock %}
@@ -76,7 +96,7 @@
                 <select id="bug-details-edit-target" name="target">
                     <option value="None">Unscheduled</option>
                     {% for target in targets %}
-                        <option value="{{ target }}">{{ target }}</option>
+                        <option value="{{ target|e }}">{{ target }}</option>
                     {% endfor %}
                 </select>
             </div>
                 <select id="bug-details-edit-assignee" name="assignee">
                     <option value="None">Unassigned</option>
                     {% for assignee in assignees %}
-                        <option value="{{ assignee }}">{{ assignee }}</option>
+                        <option value="{{ assignee|striptags }}">{{ assignee|striptags|e }}</option>
                     {% endfor %}
                 </select>
             </div>
         </fieldset>
     </form>
     
-    <h3>Summary</h3>
-    <p>
+    <h3 class="header-with-link">Summary</h3>
+    <span class="header-link">
+        <a href="" id="edit-bug-summary">edit</a>
+    </span>
+    <p id="bug-summary">
         {{ bug.summary }}
     </p>
     
+    <form id="bug-summary-edit-form" class="vertical" action="/edit" method="post">
+        <fieldset>
+            <input type="hidden" name="id" value="{{ bug.uuid }}" />
+            <div class="field">
+                <input type="text" id="bug-summary-edit-body" name="summary" value="{{ bug.summary }}" />
+            </div>
+            <div class="buttons">
+                <button type="submit">Save Changes</button>
+                <button type="reset">Discard Changes</button>
+            </div>
+        </fieldset>
+    </form>
+    
     <h3>Comments</h3>
     {% for comment in bug.comments() %}
         <div class="bug-comment">
         <fieldset>
             <input type="hidden" name="id" value="{{ bug.uuid }}" />
             <div class="field">
-                <label for="add-comment-body">Comment</label>
                 <textarea cols="60" rows="6" id="add-comment-body" name="body"></textarea>
             </div>
             <div class="buttons">