← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/no-editablecontexttitle into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/no-editablecontexttitle into lp:launchpad.

Commit message:
Drop inline editability of the project title. It's a very rare operation that doesn't justify cluttering the UI and code.

Requested reviews:
  William Grant (wgrant): code

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/no-editablecontexttitle/+merge/243003

Drop inline editability of the project title. It's a very rare operation that doesn't justify cluttering the UI and code.
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/app/browser/launchpad.py'
--- lib/lp/app/browser/launchpad.py	2014-11-27 00:35:38 +0000
+++ lib/lp/app/browser/launchpad.py	2014-11-27 06:43:51 +0000
@@ -81,7 +81,6 @@
     POSTToNonCanonicalURL,
     )
 from lp.app.interfaces.headings import (
-    IEditableContextTitle,
     IHeadingBreadcrumb,
     IMajorHeadingView,
     )
@@ -383,16 +382,9 @@
     def heading(self):
         """Return the heading text for the page.
 
-        If the view provides `IEditableContextTitle` then the top heading is
-        rendered from the view's `title_edit_widget` and is generally
-        editable.
-
-        Otherwise, if the context provides `IHeadingContext` then we return an
+        If the context provides `IHeadingContext` then we return an
         H1, else an H2.
         """
-        # Check the view; is the title editable?
-        if IEditableContextTitle.providedBy(self.context):
-            return self.context.title_edit_widget()
         # The title is static, but only the context's index view gets an H1.
         heading = 'h1' if IMajorHeadingView.providedBy(self.context) else 'h2'
         # If there is actually no root context, then it's a top-level

=== modified file 'lib/lp/app/browser/tests/watermark.txt'
--- lib/lp/app/browser/tests/watermark.txt	2014-11-17 17:58:17 +0000
+++ lib/lp/app/browser/tests/watermark.txt	2014-11-27 06:43:51 +0000
@@ -120,22 +120,3 @@
     ...     implements(IMajorHeadingView)
     >>> print get_hierarchy(widget, viewcls=HeadingView).heading()
     <h1>Widget</h1>
-
-
-Editable headings
-=================
-
-Some index pages also allow for editing the context's title.  To specify
-this, the view must implement IEditableContextTitle and provide an method
-that returns all the HTML necessary to edit the context, including the
-appropriate H tag.
-
-    >>> from lp.app.interfaces.headings import IEditableContextTitle
-    >>> class EditableView(TrivialView):
-    ...     implements(IEditableContextTitle)
-    ...     def __init__(self, context):
-    ...         self.context = context
-    ...     def title_edit_widget(self):
-    ...         return '<h0>EDIT ME</h0>'
-    >>> print get_hierarchy(widget, viewcls=EditableView).heading()
-    <h0>EDIT ME</h0>

=== modified file 'lib/lp/app/interfaces/headings.py'
--- lib/lp/app/interfaces/headings.py	2014-11-17 18:36:16 +0000
+++ lib/lp/app/interfaces/headings.py	2014-11-27 06:43:51 +0000
@@ -5,7 +5,6 @@
 
 __metaclass__ = type
 __all__ = [
-    'IEditableContextTitle',
     'IHeadingBreadcrumb',
     'IMajorHeadingView',
     ]
@@ -18,12 +17,5 @@
     """This view's page should get a major heading (i.e. H1)."""
 
 
-class IEditableContextTitle(Interface):
-    """Interface specifying that the context has an editable title."""
-
-    def title_edit_widget():
-        """Return the HTML of the editable title widget."""
-
-
 class IHeadingBreadcrumb(Interface):
     """This breadcrumb can appear in header and thereby has no facet."""

=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py	2014-09-08 08:07:06 +0000
+++ lib/lp/registry/browser/product.py	2014-11-27 06:43:51 +0000
@@ -104,7 +104,6 @@
     ServiceUsage,
     )
 from lp.app.errors import NotFoundError
-from lp.app.interfaces.headings import IEditableContextTitle
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.app.utilities import json_dump_information_types
 from lp.app.vocabularies import InformationTypeVocabulary
@@ -877,7 +876,7 @@
 class ProductView(PillarViewMixin, HasAnnouncementsView, SortSeriesMixin,
                   FeedsMixin, ProductDownloadFileMixin):
 
-    implements(IProductActionMenu, IEditableContextTitle)
+    implements(IProductActionMenu)
 
     @property
     def maintainer_widget(self):
@@ -905,11 +904,6 @@
         super(ProductView, self).initialize()
         self.status_message = None
         product = self.context
-        title_field = IProduct['title']
-        title = "Edit this title"
-        self.title_edit_widget = TextLineEditorWidget(
-            product, title_field, title, 'h1', max_width='95%',
-            truncate_lines=2)
         programming_lang = IProduct['programminglang']
         title = 'Edit programming languages'
         additional_arguments = {


References