17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1410 Views |
-
The new page is not highlighted in the left panel

3 July 2007 at 5:54pm
Hi,
do you have the same weird behaviour? When I create a new page and click on this page in the left panel, then this page is not highlighted, but appears correctly in the right panel. In the left panel, the home page is highlighted usually.I use FF 2.0 under Linux.
cheers
andy -
Re: The new page is not highlighted in the left panel

4 July 2007 at 2:18am Last edited: 4 July 2007 2:27am
Yeah, this behaviour's been bugging me for awhile, so I had a look at it. The problem is that the regular expression that that's used to get the ID of the item you're highlighting doesn't understand the IDs given to new pages before they're saved.
A regular ID looks like "record-1" (which is the homepage), but a newly created page has an ID like "record-new-Page-0-1" which is the first - number 1 - new page in the page root (which has an ID of 0).
What the regex does is take everything after the final "-" in the ID, which ends up with "1" for both the examples above, hence the problem.
Now I'm no regex expert, so this probably isn't the best way but it seems to fix the problem if you go into /jsparty/tree/tree.js, and change about line 497 from
if(this.id.match(/-([^-]+)$/)) return RegExp.$1;
to
if(this.id.match(/([^-]+)-(.+)$/)) return RegExp.$2;
What this does is get everything after the FIRST "-" instead of the last one, so the homepage above will still return "1", but the new page will return "new-Page-0-1", which is what we want.
Then again there might be a reason why it works like it does...
-
Re: The new page is not highlighted in the left panel

4 July 2007 at 9:37am Last edited: 4 July 2007 9:39am
Andy: Thanks for reporting this.
Nathan: Thanks for fixing this! You also fixed a Usability Issue and saved me some work.
I've applied your fix to the gsoc branch of jsparty:
------------------------------------------------------------------------
r37735 | elofgren | 2007-07-03 16:33:15 -0500 (Tue, 03 Jul 2007) | 5 linesBUGFIX: Fix bug 'The new page is not highlighted in the left panel'
Reported and fixed here: http://www.silverstripe.com/bugs/flat/1895
Thanks xmedeko and nathancox!
Also fixes usability issue #26: http://www.elijahlofgren.com/silverstripe/use-bold-highlighting-when-creating-new-pages/------------------------------------------------------------------------
Thanks again,
Elijah
-
Re: The new page is not highlighted in the left panel

4 July 2007 at 9:46am
Thanks for looking into this, this has been bugging me for some time as well
-
Re: The new page is not highlighted in the left panel

4 July 2007 at 9:59am
Another bug which may (or may not) be related to this;
If you click go to add a page, and try and add say 15 pages in quick succession (by pressing the go button every second or so), the 'parent' page seems to be randomly selected as the new pages gets placed in a number folders, seemingly at random.
-
Re: The new page is not highlighted in the left panel

4 July 2007 at 10:23am
Nathan: thanks very much.
Did somebody examine the other similar regexps in the tree.js? (lines 69, 220). Should they be changed as well?
-
Re: The new page is not highlighted in the left panel

4 July 2007 at 11:26am
I haven't noticed any problems that those other regexes could be causing, but then again I just don't want to go back into the JavaScript.
Complex JavaScript like this is what makes me lock my doors at night, so I might stick to the PHP
| 1410 Views | ||
|
Page:
1
|
Go to Top |




