Bug 216733 - forums.freebsd.org customization breaks responsive design
Summary: forums.freebsd.org customization breaks responsive design
Status: Closed FIXED
Alias: None
Product: Services
Classification: Unclassified
Component: Forums (show other bugs)
Version: unspecified
Hardware: Any Any
: --- Affects Some People
Assignee: Forum Adminstrators
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2017-02-02 17:41 UTC by Michael Gmelin
Modified: 2017-12-26 20:32 UTC (History)
5 users (show)

See Also:


Attachments
Screenshot of forums on iPhone (Safari) (171.37 KB, image/png)
2017-02-02 17:41 UTC, Michael Gmelin
no flags Details
Javascript for testing the new layout (7.92 KB, text/plain)
2017-08-28 15:58 UTC, Michael Gmelin
no flags Details
Screen shot of low res chrome making use of the responsive design (144.76 KB, image/png)
2017-08-28 16:02 UTC, Michael Gmelin
no flags Details
Minimized version of javascript (4.83 KB, application/x-javascript)
2017-10-27 18:25 UTC, Michael Gmelin
no flags Details
Human readable version of the mobile layout fix (10.91 KB, application/x-javascript)
2017-10-27 18:26 UTC, Michael Gmelin
no flags Details
Screenshot with patch on iPhone (183.24 KB, image/png)
2017-12-26 19:26 UTC, Michael Gmelin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Gmelin freebsd_committer freebsd_triage 2017-02-02 17:41:42 UTC
Created attachment 179537 [details]
Screenshot of forums on iPhone (Safari)

The forum software used is capable of adapting to mobile devices. The freebsd.org header line breaks this and makes the page render quite ugly. Please see attached screenshot on iPhone for an example.

I asked a friend and he'll come up with a fix over the weekend, that's why I assigned the bug to myself.

Please let me know if there is a specific format for a patch, otherwise it'll just be an HTML diff the forum admins can apply to the page themselves.
Comment 1 Michael Gmelin freebsd_committer freebsd_triage 2017-08-28 15:58:27 UTC
Created attachment 185843 [details]
Javascript for testing the new layout

Thanks for bringing my attention to this again (completely forgot). We made a demo of how this could work.

This is how you can test this in Chrome:

1. Go to https://forums.freebsd.org/
2. Right click and select "Inspect" (Or Ctrl-Shift-I)
3. Go to the Console and paste the content of forumResponse.js into it
4. Enter fbsdForumsMobileOptionsTester.test(1);

Now the responsive design is enabled, you can play with different resolutions in Chrome.

If you like this approach, we can discuss how to integrate it into the forums (either using the same "patch" approach, as it's unintrusive [making it part of the header] or doing something more elegant, that might also be harder to maintain)

-m
Comment 2 Michael Gmelin freebsd_committer freebsd_triage 2017-08-28 16:02:11 UTC
Created attachment 185844 [details]
Screen shot of low res chrome making use of the responsive design

See this attachment for an example of the responsive design in chrome (crappy fonts due to my chromium/x config).
Comment 3 Daniel Gerzo freebsd_committer freebsd_triage 2017-08-30 19:06:03 UTC
Hi, I tried the described procedure and I get the following:

Object {isSubmenuOpen: false, test: function, css: function, addMenuButtons: function, cloneDonateButtonToSidebar: function…}
fbsdForumsMobileOptionsTester.test(1);
undefined

and nothing happens.
Comment 4 Michael Gmelin freebsd_committer freebsd_triage 2017-08-31 00:22:19 UTC
(In reply to Daniel Gerzo from comment #3)

This certainly works. Chrome on Mac as well as Chromium on FreeBSD. Maybe you didn't hit enter after pasting.

Please see here for a screencast of how to actually do the procedure described above: https://blog.grem.de/bits/freebsdforum.mp4

I hope this helps you to reproduce.
Comment 5 Daniel Gerzo freebsd_committer freebsd_triage 2017-08-31 06:43:02 UTC
Ah, OK, when I saw undefined after I hit enter I actually thought it doesn't work. Since I was going full screen I didn't notice the change on the screen, so it may actually work. I will test it again when I come back home.
Comment 6 Michael Gmelin freebsd_committer freebsd_triage 2017-08-31 13:17:10 UTC
(In reply to Daniel Gerzo from comment #5)

Well of course, the responsive design only changes the look of the page if the resolution requires it to do so (we didn't want to change the appearance on a normal desktop). I agree that "undefined" is a bit confusing, this is, because that function doesn't return anything. Lesson learned: Next time we'll make the "test function" return something more encouraging like:

 > fbsdForumsMobileOptionsTester.test(1);
 < "Ok, ready to go"
Comment 7 Daniel Gerzo freebsd_committer freebsd_triage 2017-09-02 10:34:06 UTC
OK so I tested it and it seems to work fine. So in order to implement it, should I just add the javascript file to the header with <script src="...."></script> and that's it?
Comment 8 Michael Gmelin freebsd_committer freebsd_triage 2017-10-27 18:25:29 UTC
Created attachment 187529 [details]
Minimized version of javascript

See next attachment for how to include
Comment 9 Michael Gmelin freebsd_committer freebsd_triage 2017-10-27 18:26:40 UTC
Created attachment 187530 [details]
Human readable version of the mobile layout fix
Comment 10 Michael Gmelin freebsd_committer freebsd_triage 2017-10-27 18:28:51 UTC
To include the layout, simply add the script tag like in (if you can't place it there, you can also put it anywhere in the body as well):

<html>
<head>
 <script src="path/to/freebsd-forums-mobile-layout-fixer.min.js">
...
</head>
...
Comment 11 Daniel Gerzo freebsd_committer freebsd_triage 2017-12-26 13:49:26 UTC
Hi, I have added the patch, let me know if it works as expected.
Comment 12 Lars Engels freebsd_committer freebsd_triage 2017-12-26 14:55:40 UTC
Works for me on Android. Thanks a lot!
Comment 13 Michael Gmelin freebsd_committer freebsd_triage 2017-12-26 19:26:48 UTC
Created attachment 189122 [details]
Screenshot with patch on iPhone

This works now, please see attached screenshot on iPhone
Comment 14 Daniel Gerzo freebsd_committer freebsd_triage 2017-12-26 20:32:15 UTC
thanks for working on it!