TinyPortal

Development => Support => Topic started by: bigguy on December 04, 2018, 12:36:43 AM

Title: Collapse button
Post by: bigguy on December 04, 2018, 12:36:43 AM
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 04, 2018, 12:42:51 AM
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 04, 2018, 12:43:52 AM
Right there is fine if it could be moved down a bit.
Title: Re: Collapse button
Post by: bigguy on December 04, 2018, 12:44:28 AM
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 04, 2018, 06:24:00 AM
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, 11: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, 03:10:59 PM
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:

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, 03:19:16 PM
Quote from: @rjen on December 04, 2018, 03:10:59 PM
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, 04:40:55 PM
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, 05:16:36 PM
That is not what I meant, but maybe even better...  O0
Title: Re: Collapse button
Post by: tino on December 04, 2018, 05:30:23 PM
Quote from: @rjen on December 04, 2018, 05:16:36 PM
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, 07: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, 08:18:34 PM
Quote from: @rjen on December 04, 2018, 07:50:46 PM
I like the solution. So much that I just coded is into my repository.

Try this instead...

$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, 08: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, 08:26:42 PM
Quote from: @rjen on December 04, 2018, 08:25:08 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, 08: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, 08: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).


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, 09: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, 09: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, 10:00:59 PM
Yep, I use Chrome
Title: Re: Collapse button
Post by: @rjen on December 04, 2018, 10: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, 10:11:33 PM
Quote from: @rjen on December 04, 2018, 10: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)

What page are you accessing?
Title: Re: Collapse button
Post by: tino on December 04, 2018, 10:13:56 PM
Quote from: tino on December 04, 2018, 10:11:33 PM
Quote from: @rjen on December 04, 2018, 10: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)

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, 11: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:
<div style="float: right; margin-right: 0.5em; margin-top: -1.5em;">
I changed it to:
<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, 08:24:01 AM
Quote from: bigguy on December 04, 2018, 11: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:
<div style="float: right; margin-right: 0.5em; margin-top: -1.5em;">
I changed it to:
<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, 08:31:07 AM
Quote from: @rjen on December 05, 2018, 08:24:01 AM
Quote from: bigguy on December 04, 2018, 11: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:
<div style="float: right; margin-right: 0.5em; margin-top: -1.5em;">
I changed it to:
<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, 12:13:30 PM
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, 12:47:59 PM
Quote from: bigguy on December 05, 2018, 12:13:30 PM
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, 01:22:39 PM
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, 02:00:14 PM
Quote from: bigguy on December 05, 2018, 01:22:39 PM
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, 03:12:54 PM
Quote from: bigguy on December 05, 2018, 01:22:39 PM
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, 03:32:14 PM
Thank you very much. It's an honour. :)