TinyPortal

Development => Support => Topic started by: bigguy on December 03, 2018, 05:36:43 PM

Title: Collapse button
Post by: bigguy on December 03, 2018, 05:36:43 PM
I think there is something wrong with the collapse button to collapse side panels. It overlays on the updated topics link. It should maybe be moved down a bit. I have a block enabled on my forum to the right of the boards. See attachment
Title: Re: Collapse button
Post by: tino on December 03, 2018, 05:42:51 PM
That's been known about but we conveniently ignored it... I think as we didn't know where to actually put it!
Title: Re: Collapse button
Post by: bigguy on December 03, 2018, 05:43:52 PM
Right there is fine if it could be moved down a bit.
Title: Re: Collapse button
Post by: bigguy on December 03, 2018, 05:44:28 PM
You might have to move the block down a bit as well but it's fine there.
Title: Re: Collapse button
Post by: lurkalot on December 03, 2018, 11:24:00 PM
I tend to turn them off at the moment, at least until we find a new position for them.

Tinyportal Admin > Settings > Allow the panels to be collapsed?  Yes / No
Title: Re: Collapse button
Post by: bigguy on December 04, 2018, 04:30:18 AM
There are some people on my site that actually use it to collapse the side bar. They don't like using it in the forum. SO I either leave it up for them or get rid of the block, which I don't wanna do. I'll deal with it for now. ;)
Title: Re: Collapse button
Post by: @rjen on December 04, 2018, 08:10:59 AM
Looking at the buttons (again)

We can drop them below the text, but that will create a white space above all content.
A fixed position in a panel is not suitable , since sites may all look and behave differently as to what panels are shown.

See attachment 1:
option 1: is with the white space

option 2: 2.1 has a very nice dropmenu on top with empty spaces.
Tino, do you know if it is possible to add an element in there?


option 3: see attachment two.
We could suppress the buttons in 2.1 and maybe include a standard block with the upshrink icons?

I created a php block to show the buttons in the right side bar now for demonstration purposes.

The block code is:
Code: [Select]
global $context;

echo '
<div style="float: right;  margin-right: 0.5em;">', $context['TPortal']['upshrinkpanel'] , '</div>';

Title: Re: Collapse button
Post by: tino on December 04, 2018, 08:19:16 AM
option 2: 2.1 has a very nice dropmenu on top with empty spaces.
Tino, do you know if it is possible to add an element in there?

We could I think using the buffer hook and add it in the html. I can't see a easier way.
Title: Re: Collapse button
Post by: tino on December 04, 2018, 09:40:55 AM
Like this...

Thats putting this in tpAddCopy

Quote
$buffer = str_replace('<li class="unread_links">', '<span class="tp_upshrink" style="float:right; margin-top:6px; padding-left:10px;">'.$context['TPortal']['upshrinkpanel'].'</span><li class="unread_links">', $buffer);

The css should be in the css file under the class tp_upshrink but inline was quick and easy to show it. 
Title: Re: Collapse button
Post by: @rjen on December 04, 2018, 10:16:36 AM
That is not what I meant, but maybe even better...  O0
Title: Re: Collapse button
Post by: tino on December 04, 2018, 10:30:23 AM
That is not what I meant, but maybe even better...  O0

It will only show for logged in users mind. So will need some thinking about for people who aren't logged in. Although you could argue they shouldn't be able to collapse the panels.
Title: Re: Collapse button
Post by: @rjen on December 04, 2018, 12:50:46 PM
I like the solution. So much that I just coded is into my repository.

So 2.0 remains the way it was, 2.1 can get that location.
The only downside is that the collapse buttons will only be available for logged-in users.

How do the others feel about that? Shall I commit it?
If we do not like it, we can always reverse it again...
Title: Re: Collapse button
Post by: tino on December 04, 2018, 01:18:34 PM
I like the solution. So much that I just coded is into my repository.

Try this instead...

Code: [Select]
$buffer = preg_replace('~<div class="navigate_section">\s*<ul>~', '<div class="navigate_section"><ul><span class="tp_upshrink" style="float:right; margin-top:6px; padding-left:10px;">'.$context['TPortal']['upshrinkpanel'].'</span>', $buffer);
Title: Re: Collapse button
Post by: @rjen on December 04, 2018, 01:25:08 PM
Better  O0

but somehow two buttons go missing for guests... need to check why first.
Title: Re: Collapse button
Post by: tino on December 04, 2018, 01:26:42 PM
Better  O0

but somehow two buttons go missing for guests... need to check why first.

Do you have the css and my inline styling? It's ok for me
Title: Re: Collapse button
Post by: tino on December 04, 2018, 01:29:19 PM
It does need different styling on less than a 720px screen though. Probably align it to the left so it fits with the other items.
Title: Re: Collapse button
Post by: @rjen on December 04, 2018, 01:55:44 PM
Ok, fixed it. Looks good, I'll submit the PR.


I just noticed that in the console the toggle is throwing some error (not related to this change).

Code: [Select]
index.php:103 Uncaught TypeError: Cannot read property 'style' of null
    at togglepanel (index.php:103)
    at HTMLAnchorElement.onclick (index.php:441)

What's that?
Title: Re: Collapse button
Post by: tino on December 04, 2018, 02:54:56 PM
I don't get that, I get the can't find the element error
Title: Re: Collapse button
Post by: tino on December 04, 2018, 02:57:07 PM
Ok its the same error Chrome ( which I guess you use ) reports it differently to Firefox. It means it can't find the elementid img which is correct as it's not called that.
Title: Re: Collapse button
Post by: @rjen on December 04, 2018, 03:00:59 PM
Yep, I use Chrome
Title: Re: Collapse button
Post by: @rjen on December 04, 2018, 03:02:31 PM
Seeing these errors now...

8: Undefined index: TPortal
 https://test2.fjr-club.nl/index.php?topic=20318.0
 /home/deb77453/domains/fjr-club.nl/public_html/test2/Sources/TPassimilate.php (Line 60)
Title: Re: Collapse button
Post by: tino on December 04, 2018, 03:11:33 PM
Seeing these errors now...

8: Undefined index: TPortal
 https://test2.fjr-club.nl/index.php?topic=20318.0
 /home/deb77453/domains/fjr-club.nl/public_html/test2/Sources/TPassimilate.php (Line 60)

What page are you accessing?
Title: Re: Collapse button
Post by: tino on December 04, 2018, 03:13:56 PM
Seeing these errors now...

8: Undefined index: TPortal
 https://test2.fjr-club.nl/index.php?topic=20318.0
 /home/deb77453/domains/fjr-club.nl/public_html/test2/Sources/TPassimilate.php (Line 60)

What page are you accessing?

Ignore me, I don't get that error you can silence it by adding additional checks but I would guess TPortal_init hadn't run on a scheduled task
Title: Re: Collapse button
Post by: bigguy on December 04, 2018, 04:58:34 PM
I'm not sure what file it is in but There is this inline piece of css that I have been playing with:
Code: [Select]
<div style="float: right; margin-right: 0.5em; margin-top: -1.5em;">I changed it to:
Code: [Select]
<div style="float: right; margin-right: 0.5em; margin-top: -3em;">It sits nicely above the links for unread replies and stuff. (I thought I would tell ya's what my next edit would be lol. If I can find it.)

EDIT: I changed that using the editor in FF btw
Title: Re: Collapse button
Post by: @rjen on December 05, 2018, 01:24:01 AM
I'm not sure what file it is in but There is this inline piece of css that I have been playing with:
Code: [Select]
<div style="float: right; margin-right: 0.5em; margin-top: -1.5em;">I changed it to:
Code: [Select]
<div style="float: right; margin-right: 0.5em; margin-top: -3em;">It sits nicely above the links for unread replies and stuff. (I thought I would tell ya's what my next edit would be lol. If I can find it.)

EDIT: I changed that using the editor in FF btw

That can work on a site with a certain theme, but may give problems on mobile display, so we will go for the more universal fix I guess...
Title: Re: Collapse button
Post by: lurkalot on December 05, 2018, 01:31:07 AM
I'm not sure what file it is in but There is this inline piece of css that I have been playing with:
Code: [Select]
<div style="float: right; margin-right: 0.5em; margin-top: -1.5em;">I changed it to:
Code: [Select]
<div style="float: right; margin-right: 0.5em; margin-top: -3em;">It sits nicely above the links for unread replies and stuff. (I thought I would tell ya's what my next edit would be lol. If I can find it.)

EDIT: I changed that using the editor in FF btw

That can work on a site with a certain theme, but may give problems on mobile display, so we will go for the more universal fix I guess...

Yep, bigguy for out of the box TP we've got to go with something that'll fit in all themes and scenarios where possible.  There's no problem with anyone customising for their individual needs though.
Title: Re: Collapse button
Post by: bigguy on December 05, 2018, 05:13:30 AM
Oh that's no problem. I understand completely. Like I said if I knew were it was I would edit it. Since I can't find what file it is in I can wait til you guys fix it no problem.
Title: Re: Collapse button
Post by: @rjen on December 05, 2018, 05:47:59 AM
Oh that's no problem. I understand completely. Like I said if I knew were it was I would edit it. Since I can't find what file it is in I can wait til you guys fix it no problem.

Perhaps you would be interested to become a beta-tester (which is pretty much what you are for SMF2.1 anyway..  ;) )
The updated working version of TP1.6.2 is available...
Title: Re: Collapse button
Post by: bigguy on December 05, 2018, 06:22:39 AM
If you guys wanna put me in that go ahead. I don't mind testing. Can I access 1.6.2 ???
Title: Re: Collapse button
Post by: tino on December 05, 2018, 07:00:14 AM
If you guys wanna put me in that go ahead. I don't mind testing. Can I access 1.6.2 ???

It's available on GitHub from the master branch, if not when lurkalot gives you access it's in the beta board.
Title: Re: Collapse button
Post by: lurkalot on December 05, 2018, 08:12:54 AM
If you guys wanna put me in that go ahead. I don't mind testing. Can I access 1.6.2 ???

You should see it now, https://www.tinyportal.net/index.php?topic=36198.0

Welcome to the Beta group.  ;)
Title: Re: Collapse button
Post by: bigguy on December 05, 2018, 08:32:14 AM
Thank you very much. It's an honour. :)