Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11853 closed enhancement (fixed)

Modular preference pages with child panels

Reported by: Peter Suter Owned by: Peter Suter
Priority: normal Milestone: 1.1.3
Component: notification Version:
Severity: normal Keywords: preferences
Cc: Branch:
Release Notes:

Preference panels now support modular child panels.

API Changes:

IPreferencePanelProvider.get_preference_panels() can now return (panel, label, parent_panel) triples to make child panels appear as part of the indicated parent panel.

Internal Changes:

Description (last modified by Peter Suter)

th:AnnouncerPlugin has IAnnouncementPreferenceProvider to allow components to add "boxes" to shared pages from IPreferencePanelProvider. Multiple plugins can provide a coherent user interface to notification preferences without impairing modularity in code.

For the Advanced Notification proposal we could instead simply extend IPreferencePanelProvider itself slightly to allow child panels.

Proposed changes: changeset:advanced-notification-preferences.4/psuter.hg

Attachments (0)

Change History (9)

comment:1 by Peter Suter, 9 years ago

Owner: set to Peter Suter
Status: newassigned

comment:2 by Peter Suter, 9 years ago

See #11870 for an example where Watch Ticket Components is an optional child of the Notifications panel.

comment:3 by Peter Suter, 9 years ago

Description: modified (diff)

comment:4 by Peter Suter, 9 years ago

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [13510].

comment:5 by Jun Omae, 9 years ago

Sorry for late response.

}#content.prefs ... in prefs.css should be split by line separator.

-}#content.prefs tr.field { height: 30px; }
+}
+#content.prefs tr.field { height: 30px; }

panel parameter of IPreferencePanelProvider.get_preference_panels() is used without changes in id attribute of h2 element in prefs.html. I think we should prepend userprefs_ to the id like <h2 id="userprefs_$name">.

At trunk/trac/prefs/templates/prefs.html@13510:34#L31, tab_ prefix is used for id attribute in tabs list.

comment:6 by Jun Omae, 9 years ago

Or I think it should be like this.

  • trac/prefs/templates/prefs.html

    diff --git a/trac/prefs/templates/prefs.html b/trac/prefs/templates/prefs.html
    index 58fed66..e061f50 100644
    a b  
    3838      <div id="tabcontent" py:with="has_forms = list(select('.//form'))">
    3939        <form id="userprefs" action="" method="post" py:strip="has_forms">
    4040          ${select("*|text()")}
    41           <div py:for="(name, title, child) in child_panels">
    42             <div class="prefs_child">
    43               <h2 id="${name}">${title}</h2>
    44               ${child}
    45             </div>
     41          <div py:for="(name, title, child) in child_panels"
     42               id="userprefs_$name" class="prefs_child">
     43            <h2>${title}</h2>
     44            ${child}
    4645          </div>
    4746          <div class="buttons" py:if="not has_forms">
    4847            <input type="hidden" name="action" value="save" />

in reply to:  5 ; comment:7 by Peter Suter, 9 years ago

Replying to jomae:

}#content.prefs ... in prefs.css should be split by line separator.

Oops, that must have slipped in during rebase. Fixed in [13511]. Thanks.

panel parameter of IPreferencePanelProvider.get_preference_panels() is used without changes in id attribute of h2 element in prefs.html. I think we should prepend userprefs_ to the id like <h2 id="userprefs_$name">.

Or I think it should be like this. […]

I used <h2 id="${name}"> so e.g in this example (#11870) we can link to the anchor /prefs/notification#watch_component and the title is highlighted. With your changes that would not work.

(There's also <h2 id="subscriptions"> for linking and highlighting /prefs/notification#subscriptions. Do you think it is also problematic?)

Thanks for reviewing!

Version 0, edited 9 years ago by Peter Suter (next)

in reply to:  7 comment:8 by Jun Omae, 9 years ago

Replying to psuter:

I used <h2 id="${name}"> so e.g in this example (#11870) we can link to the anchor /prefs/notification#watch_component and the title is highlighted. With your changes that would not work.

Okay. I understand use case.

Instead of the userprefs_ prefix, would a -section suffix work? (Similar to TracIni#notification-section)

(There's also <h2 id="subscriptions"> for linking and highlighting /prefs/notification#subscriptions. Do you think it is also problematic?)

I think that -section suffix would be good as well. I consider that appending prefix or suffix would prevent conflicting with id attribute in other elements. Otherwise, core and plugin developers should be careful about the conflicting. I was not sure that panel parameter is used for id attribute.

comment:9 by Peter Suter, 9 years ago

OK, committed -section suffix in [13522].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Peter Suter to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.