#11550 closed defect (fixed)
folding.js not available on report pages
Reported by: | Owned by: | Ryan J Ollos | |
---|---|---|---|
Priority: | normal | Milestone: | 1.3.2 |
Component: | report system | Version: | 1.0.1 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: |
|
||
Internal Changes: |
Description
- folding.js is not included on report pages
- jQuery(".foldable").enableFolding(true, true) is not called on report pages
Via plugins (I'm using http://trac-hacks.org/wiki/CollapsiblePlugin, but I've found others that simply add "foldable" divs), it is possible to create collapsible sections in wiki formatted text, via a macro. This works great in wiki pages, and in tickets, but not in reports.
- Report descriptions can contain wiki formatting
- Report results (e.g. "SELECT foo AS description") can as well
- Yet foldable sections work in neither.
I believe this could be fixed by adding folding.js to the script includes for report pages, and adding "$(".foldable").enableFolding(true, true);" to the jQuery(document).ready({…}) section.
Attachments (0)
Change History (12)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
folding.js
is added to so many page that it could make sense to just add it on every page. Here is a quick implementation on the trunk: log:rjollos.git:t11550. I'd like to hear what the other devs have to say about it though.
I don't think it make sense to call $(".foldable").enableFolding(true, true);
on every page. We don't always want to call the function with arguments autofold = true
and snap = true
.
For a proposed solution to your issue, see th:#11627.
comment:3 by , 11 years ago
Cc: | added |
---|
comment:4 by , 11 years ago
Worth noting, from my own experiments, that calling "$(".foldable").enableFolding(true, true)" on a report page with dynamic variables causes poor things to happen to the foldable section used for editing of the variables.
(However, I was cribbing from the behavior of wiki pages, which do call that for every page.)
follow-up: 6 comment:5 by , 11 years ago
We might consider adding the feature of allowing code blocks to be folded in Trac using a keyword such as folded.
{{{#!default folded=true }}} {{{#!default folded=false }}}
What I would find really useful is to be able to fold a code block leaving N lines visible. That would allow us to edit user comments when they paste huge diffs, tracebacks or log messages into tickets, collapsing them to make the ticket more readable.
follow-up: 8 comment:6 by , 11 years ago
We might consider adding the feature of allowing code blocks to be folded in Trac using a keyword such as folded.
Yeah, I have the same idea inspired by th:CollapsiblePlugin.
What I would find really useful is to be able to fold a code block leaving N lines visible. That would allow us to edit user comments when they paste huge diffs, tracebacks or log messages into tickets, collapsing them to make the ticket more readable.
Sounds good.
Another thing. I think Trac should merge to one javascript file from many small javascript files except jquery and jquery-ui. It would reduce number of requests to static files and improve a bit of response.
comment:7 by , 11 years ago
(Please excuse the brainstorming. The below bits of code are untested, and likely have errors.)
I am envisioning a macro that takes 3 arguments:
- a wiki-formatted string that defines the label, e.g. === heading ===, heading, etc.
- a boolean defining whether or not the section starts folded.
- a boolean defining whether or not the page snaps to the section when unfolding it.
The macro would add the class "foldable" to the target, and add "collapsed" to the parent if it starts folded and "snapping" to the parent if it is to snap. Then the javascript could "simply" do:
jQuery(document).ready({ jQuery('.foldable').unbind('click').click(function(eventObject) { var div = $(eventObject.parentNode).toggleClass('collapsed'); var snapping = div.hasClass('snapping'); var unfolded = !div.hasClass('collapsed') if (snapping && unfolded) { $('body').scrollTo(eventObject); } return snapping && unfolded; }); })
The above would effectively replace the enableFolding functionality of folding.js.
comment:8 by , 11 years ago
Replying to jomae:
Another thing. I think Trac should merge to one javascript file from many small javascript files except jquery and jquery-ui. It would reduce number of requests to static files and improve a bit of response.
Combining the JavaScript files has been proposed for implementation in #10672.
comment:9 by , 10 years ago
Milestone: | → next-major-releases |
---|
comment:10 by , 8 years ago
Cc: | removed |
---|---|
Milestone: | next-major-releases → 1.3.2 |
Owner: | set to |
Status: | new → assigned |
Proposed changes in [bc1a19dd/rjollos.git]. In the near future I plan to look at extending WikiProcessors so they can be folded (#12741).
comment:11 by , 8 years ago
API Changes: | modified (diff) |
---|
comment:12 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Committed to trunk in r15700.
I don't have a patch handy, unfortunately. If I end up making one I will add in comments.