~launchpad-pqm/launchpad/devel

14104.4.1 by Ian Booth
Add ajax batch navigation to milestones page and branch listings
1
<div id="branches-table-listing"
4939.2.3 by Curtis Hovey
Added namespaces to bug* templates and fixed markup.
2
  xmlns:tal="http://xml.zope.org/namespaces/tal"
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
3
  xmlns:metal="http://xml.zope.org/namespaces/metal"
4939.2.3 by Curtis Hovey
Added namespaces to bug* templates and fixed markup.
4
>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
5
  <form method="get" name="filter" id="filter_form"
6
        style="padding-bottom: 0.5em"
6096.5.7 by Tim Penhey
Working branch selection.
7
        tal:attributes="action context/view/form_action|context/request/URL">
4960.1.26 by Michael Hudson
mpt inspired changes
8
    <label for="field.lifecycle">
9
      Branches with status:
10
    </label>
5395.1.7 by Tim Penhey
Changing the selector to a checkbox.
11
    <tal:lifecycle-selector replace="structure context/view/widgets/lifecycle"/>
5395.1.8 by Tim Penhey
pagetest fixes
12
    <tal:sort-by replace="structure context/view/widgets/sort_by"
13
                 condition="context/view/widgets/sort_by|nothing"/>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
14
    <noscript>
15
      <input type="submit" value="Filter"/>
16
    </noscript>
17
  </form>
18
19
<script type="text/javascript">
4960.1.27 by Michael Hudson
review inspired changes
20
function submit_filter() {
8283.5.12 by Martin Albisetti
Fix styling issues
21
    getElement('filter_form').submit();
4960.1.27 by Michael Hudson
review inspired changes
22
}
23
24
function hookUpFilterSubmission () {
8283.5.12 by Martin Albisetti
Fix styling issues
25
    connect('field.lifecycle', 'onchange', submit_filter);
26
    if (getElement('field.sort_by')) {
27
        connect('field.sort_by', 'onchange', submit_filter);
28
    }
4960.1.27 by Michael Hudson
review inspired changes
29
}
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
30
function show_commit(id) {
8283.5.12 by Martin Albisetti
Fix styling issues
31
    var div = document.getElementById('branch-log-' + id);
32
    if (div) {
33
        div.style.display = "block";
34
    }
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
35
}
36
function hide_commit(id) {
8283.5.12 by Martin Albisetti
Fix styling issues
37
    var div = document.getElementById('branch-log-' + id);
38
    if (div) {
39
        div.style.display = "none";
40
    }
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
41
}
8283.5.1 by Martin Albisetti
Begin proof of concept
42
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
43
</script>
44
14160.2.1 by Ian Booth
Add back js call inside feature flag check
45
<tal:comment
46
tal:condition="not: request/features/ajax.batch_navigator.enabled"
47
replace='structure string:&lt;script type="text/javascript"&gt;
48
    registerLaunchpadFunction(hookUpFilterSubmission);
49
&lt;/script&gt;'/>
50
9109.1.19 by Barry Warsaw
Addressed many of the review comments:
51
  <tal:needs-batch condition="context/has_multiple_pages">
14104.4.7 by Ian Booth
Improve javascript
52
    <div id="branch-batch-links">
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
53
      <tal:navigation replace="structure context/@@+navigation-links-upper" />
54
    </div>
55
  </tal:needs-batch>
56
57
  <table tal:attributes="class context/table_class" id="branchtable">
58
    <thead>
59
      <tr>
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
60
        <th colspan="2">Name</th>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
61
        <th>Status</th>
4619.1.1 by Tim Penhey
Project cloud preview, and more... for code front page listings.
62
        <th tal:condition="context/show_column/date_created|nothing">
63
          Registered
64
        </th>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
65
        <th tal:condition="context/show_column/product|nothing">
4619.1.11 by Tim Penhey
Renamed Product to Project on branch listings headings, updated docstrings in the branch interfaces for visible_by_user, and added a little more testing to the cross product branch listings.
66
          Project
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
67
        </th>
5834.3.1 by Tim Penhey
Split out the date last modified and revision author from the last commit.
68
        <th>Last Modified</th>
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
69
        <th>Last Commit</th>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
70
      </tr>
71
    </thead>
72
    <tbody>
7083.4.1 by Martin Albisetti
Show message for setting development focus inline instead of in a random warning message.
73
        <tal:allow-setting-dev-focus condition="context/view/show_set_development_focus">
74
        <tal:missing-dev-focus define="product context/view/context;
75
                                       dev_focus context/view/has_development_focus_branch"
76
             condition="not: dev_focus">
7083.4.4 by Martin Albisetti
Tweaks recommended in review
77
      <tal:ignore condition="nothing">
7083.4.1 by Martin Albisetti
Show message for setting development focus inline instead of in a random warning message.
78
        Only show the warning and link if the user can actually set the development focus
7083.4.4 by Martin Albisetti
Tweaks recommended in review
79
      </tal:ignore>
7083.4.1 by Martin Albisetti
Show message for setting development focus inline instead of in a random warning message.
80
      <tr tal:condition="product/required:launchpad.Edit"
7083.4.4 by Martin Albisetti
Tweaks recommended in review
81
          tal:define="edit_link product/development_focus/fmt:url/+linkbranchtoseries">
11515.8.14 by Brad Crittenden
Update tests for new rules not showing the portlets if code hosting is unconfigured.
82
        <td colspan="5" class="branch-no-dev-focus">A development focus branch hasn't
7083.4.4 by Martin Albisetti
Tweaks recommended in review
83
            been specified, <a tal:attributes="href edit_link">set it now</a>.</td>
7083.4.1 by Martin Albisetti
Show message for setting development focus inline instead of in a random warning message.
84
      </tr>
85
      </tal:missing-dev-focus>
86
      </tal:allow-setting-dev-focus>
6096.5.7 by Tim Penhey
Working branch selection.
87
      <tr tal:repeat="branch context/branches">
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
88
        <td>
11515.8.15 by Brad Crittenden
Updates from review.
89
          <a tal:attributes="href branch/fmt:url"
90
             tal:content="structure branch/bzr_identity/fmt:break-long-words"
91
             class="sprite branch">Name
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
92
          </a>
7566.3.24 by Brad Crittenden
Merge from trunk
93
          <tal:associated-series repeat="series branch/active_series"
5805.2.4 by Tim Penhey
Get the pagetests working.
94
                                 condition="context/view/show_series_links">
6096.5.2 by Tim Penhey
Looks right.
95
            <tal:first-series condition="repeat/series/start">
7083.4.2 by Martin Albisetti
* Fixed failing tests
96
            <br/><strong style="margin-left: 2.5em;">Series:</strong>
6096.5.2 by Tim Penhey
Looks right.
97
            </tal:first-series>
98
            <tal:comment condition="nothing">
99
              The lack of whitespace in the following tal expression
100
              is there to make sure the comma immediately follows the series
101
              link rather than having a space after it.
102
            </tal:comment>
103
            <tal:series-link>
9772.8.1 by Michael Hudson
test and short (but painful to write!) test
104
              <a tal:attributes="href series/fmt:url:mainsite" tal:content="series/name">
6096.5.2 by Tim Penhey
Looks right.
105
                trunk
106
              </a></tal:series-link><tal:comma condition="not: repeat/series/end">,</tal:comma>
107
          </tal:associated-series>
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
108
        </td>
109
        <td align="right" style="padding-right: 5px">
4789.5.5 by Tim Penhey
Badge doctest working appropriately now.
110
          <tal:badges replace="structure branch/badges:small"/>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
111
        </td>
112
        <td>
9109.1.19 by Barry Warsaw
Addressed many of the review comments:
113
          <span tal:condition="not:context/has_multiple_pages"
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
114
                tal:content="branch/lifecycle_status/sortkey"
115
                class="sortkey">23</span>
116
          <span tal:content="branch/lifecycle_status/title"
117
                tal:attributes="
118
                  class string:branchstatus${branch/lifecycle_status/name}">
119
                  Status</span>
120
        </td>
4619.1.1 by Tim Penhey
Project cloud preview, and more... for code front page listings.
121
        <td tal:condition="context/show_column/date_created|nothing">
122
          <span class="sortkey"
123
                tal:content="branch/date_created/fmt:datetime">
124
            2005-02-12 13:45 EST
125
          </span>
126
          <span tal:attributes="title branch/date_created/fmt:datetime"
13334.1.1 by Steve Kowalik
Drop since_{updated,created} properties, and all uses of them, switching to
127
                tal:content="branch/date_created/fmt:approximatedate">
4619.1.1 by Tim Penhey
Project cloud preview, and more... for code front page listings.
128
            sometime
13334.1.1 by Steve Kowalik
Drop since_{updated,created} properties, and all uses of them, switching to
129
            </span>
4619.1.1 by Tim Penhey
Project cloud preview, and more... for code front page listings.
130
        </td>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
131
        <td tal:condition="context/show_column/product|nothing">
132
          <a tal:condition="branch/product"
133
             tal:attributes="href branch/product/fmt:url"
134
             tal:content="branch/product/name">
4152.2.1 by Francis J. Lacoste
Rename "product" to "project" and "product series" to "release series" in visible template parts.
135
               Project
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
136
          </a>
137
        </td>
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
138
5834.3.1 by Tim Penhey
Split out the date last modified and revision author from the last commit.
139
        <td>
140
          <span class="sortkey"
141
                tal:content="branch/date_last_modified/fmt:datetime">
142
            2005-02-12 13:45 EST
143
          </span>
9080.8.29 by Tim Penhey
Remove the is_development_focus use from the page templates.
144
          <span tal:attributes="title branch/date_last_modified/fmt:datetime"
13334.1.1 by Steve Kowalik
Drop since_{updated,created} properties, and all uses of them, switching to
145
                tal:content="branch/date_last_modified/fmt:approximatedate">
9080.8.29 by Tim Penhey
Remove the is_development_focus use from the page templates.
146
            sometime
13334.1.1 by Steve Kowalik
Drop since_{updated,created} properties, and all uses of them, switching to
147
          </span>
5834.3.1 by Tim Penhey
Split out the date last modified and revision author from the last commit.
148
        </td>
149
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
150
        <tal:no_commit condition="not: branch/last_commit">
151
          <td>
152
            <em>
153
              <metal:no-revision-message
154
                use-macro="branch/@@+macros/no-revision-message" />
155
            </em>
156
          </td>
157
        </tal:no_commit>
158
159
        <tal:has_commit condition="branch/last_commit">
160
          <td tal:attributes="onmouseover string:show_commit(${branch/id});
161
                              onmouseout string:hide_commit(${branch/id});">
5743.2.4 by Tim Penhey
Page tests now pass.
162
            <div class="lastCommit">
7723.1.1 by Michael Hudson
fix the bug
163
              <a tal:attributes="href branch/revision_codebrowse_link"
164
                 tal:content="branch/revision_count">1234</a>.
5743.2.4 by Tim Penhey
Page tests now pass.
165
              <tal:revision-log replace="branch/revision_log/fmt:shorten/40"/>
166
            </div>
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
167
            <div class="popupTitle"
12337.2.3 by Jeroen Vermeulen
Use formatter for RevisionAuthor; prefetch author info.
168
              tal:attributes="id string:branch-log-${branch/id};
169
                              onmouseover string:hide_commit(${branch/id});">
170
              <p>
171
                <strong>Author:</strong>
172
                <tal:author
173
                  replace="structure branch/revision_author/fmt:link" />
174
                <br/>
175
                <strong>Revision Date:</strong>
176
                <tal:revision-date
177
                  replace="branch/revision_date/fmt:datetime"/>
178
              </p>
179
              <tal:commit-msg
180
                replace="structure branch/revision_log/fmt:text-to-html"/>
6020.3.1 by Tim Penhey
Fix pagetests.
181
            </div>
5834.3.1 by Tim Penhey
Split out the date last modified and revision author from the last commit.
182
          </td>
183
5743.2.2 by Tim Penhey
Listing now has revision number and codebrowse hyperlink.
184
        </tal:has_commit>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
185
      </tr>
186
      <tr tal:condition="not:context/batch/total">
3814.2.16 by Tim Penhey
view updated post review
187
        <td tal:attributes="colspan context/column_count">
188
          <div id="no-branch-message"
14621.1.1 by Rick harding
Remove the structure, there's no html content in the no branch messages
189
               tal:content="context/view/no_branch_message" />
3814.2.16 by Tim Penhey
view updated post review
190
        </td>
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
191
      </tr>
192
    </tbody>
193
  </table>
194
14104.4.7 by Ian Booth
Improve javascript
195
  <tal:navigation replace="structure context/@@+navigation-links-lower" />
3814.2.11 by Tim Penhey
Note to self: must bzr status before commit
196
14104.4.8 by Ian Booth
Add feature flag
197
  <tal:comment
198
    tal:condition="request/features/ajax.batch_navigator.enabled"
199
    replace='structure string:&lt;script type="text/javascript"&gt;
200
    LPS.use("lp.app.batchnavigator",
201
        function(Y) {
202
            Y.on("domready", function () {
203
                var config = {
204
                    contentBox: "#branches-table-listing",
205
                    post_refresh_hook: hookUpFilterSubmission
206
                };
207
                new Y.lp.app.batchnavigator.BatchNavigatorHooks(config);
208
            });
209
        });
210
  &lt;/script&gt;'/>
3847.2.44 by Mark Shuttleworth
Update fmt:datetime pages to use fmt:displaydate or fmt:approximatedate
211
</div>