mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #16563
[Bug 1271779] Re: Resume layout on mobile devices
Hi Corey,
There's a flag you can use within a .tpl template to see whether the
current user is on a mobile device or not. Two flags, actually.
- $HANDHELD_DEVICE will be true if the user is on a tablet or phone.
- $MOBILE will be true if the user is on a phone.
You can use these in a template file like so:
{if $HANDHELD_DEVICE}<div>mobile content!</div>{else}<div>desktop
content!</div>{/if}
We detect mobile devices using the MobileDetect library
(http://mobiledetect.net/ ). It's worth noting that there's a site
configuration option to let users disable device detection, in which
case if a user disables it, $HANDHELD_DEVICE and $MOBILE will always be
false.
We can also detect whether the user is, specifically, on a tablet
device, but we're not currently passing that info through to the
templates. Though if that's necessary, we could do so pretty easily.
... on the other hand, your specific question was about whether you can
change the template file that gets displayed, based on the device
detection. And the answer to that, is no, you can't. The specific
template file Mahara shows, will always be the one from the user's theme
(or, if their theme doesn't provide a copy of that template, it'll show
the inherited template from the theme's parent, all the way up to the
"raw" theme which is the root parent of all themes.)
Cheers,
Aaron
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1271779
Title:
Resume layout on mobile devices
Status in Mahara ePortfolio:
New
Bug description:
Hi,
We are using a Mahara theme that adapts to screen resolutions / sizes,
which especially targets mobile devices. The main content of the page
is rendered within a narrow column.
The current layout of information in the resume page contains
information that is rendered within a table. This table is too wide to
fit in a narrow column when viewed on mobile devices. You can see this
in the attached screenshot.
While the use of a table for the layout of information works on
desktop and larger devices in a narrow column the rows are too long.
Is there any way to have a mobile specific template which could render
the information in a narrow column friendly format? Perhaps as a
series of lists rather than table rows?
If so where in the code would be a good place to start looking to
implement such a template?
With thanks.
-Corey
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1271779/+subscriptions
References