Merge lp:~sil/summit/mobile-view-for-daily-page into lp:summit

Proposed by Stuart Langridge
Status: Merged
Approved by: Michael Hall
Approved revision: 281
Merged at revision: 281
Proposed branch: lp:~sil/summit/mobile-view-for-daily-page
Merge into: lp:summit
Diff against target: 123 lines (+93/-1)
1 file modified
summit/schedule/templates/schedule/daily.html (+93/-1)
To merge this branch: bzr merge lp:~sil/summit/mobile-view-for-daily-page
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Review via email: mp+90555@code.launchpad.net

Commit message

Custom styles for devices less than 480px wide; tiny bit of JS to override the hover stuff and toggle the details div on and off; one extra class added as a convenience hook.

Description of the change

Custom styles for devices less than 480px wide; tiny bit of JS to override the hover stuff and toggle the details div on and off; one extra class added as a convenience hook.

To post a comment you must log in.
280. By Stuart Langridge

tweak width to 481 to cope with 480px wide phones like mhall's droidx; make mouseover override dynamic rather than onload; black background for track titles in details

281. By Stuart Langridge

tweak track titles ul background

Revision history for this message
Michael Hall (mhall119) wrote :

awesome!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'summit/schedule/templates/schedule/daily.html'
2--- summit/schedule/templates/schedule/daily.html 2012-01-27 02:03:43 +0000
3+++ summit/schedule/templates/schedule/daily.html 2012-01-28 02:38:24 +0000
4@@ -6,6 +6,7 @@
5 {% endblock %}
6
7 {% block head %}
8+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
9 {{ block.super }}
10 <script language="JavaScript">
11
12@@ -70,6 +71,55 @@
13 font-size: 0.7pc;
14 }
15
16+/* Mobile view */
17+@media screen and (max-width: 481px) {
18+ /* turn off a bunch of stuff */
19+ aside#top-nav, header#page-header, aside#page-related, footer#page-footer { display: none; }
20+ section#main-section .container, article.main-content {
21+ width: auto;
22+ margin: 0; padding: 0;
23+ }
24+ .schedule-head > a { display: none; } /* qr code */
25+ div.schedule-head .schedule-date {
26+ display: block;
27+ overflow: auto;
28+ font-size: 16px;
29+ text-align: center;
30+ margin: 0;
31+ }
32+ div.schedule-head .schedule-date a {
33+ display: block;
34+ float: right;
35+ background: #eee;
36+ width: 33%;
37+ text-align: center;
38+ }
39+ div.schedule-head .schedule-date a:nth-child(1) {
40+ float: left;
41+ }
42+ table.basic {
43+ margin-top: 0;
44+ width: 100%;
45+ }
46+ div.agenda-details {
47+ background-color: #eee;
48+ border-width: 0;
49+ color: black;
50+ font-size: 1em;
51+ position: static;
52+ max-width: 100%;
53+ min-width: 100%;
54+ width: 100%;
55+ padding: 5px;
56+ margin: 0;
57+ border-radius: 0;
58+ }
59+ div.agenda-details ul {
60+ background: #101010;
61+ padding-left: 4px;
62+ }
63+}
64+
65 </style>
66 {% endblock %}
67
68@@ -108,7 +158,7 @@
69 <tr style="background-color: {% ifequal agenda.meeting.type 'plenary' %}#ffffe0{% else %}{{ agenda.meeting.track_color }}{% endifequal %}; {% if agenda.meeting.private %}border: 1px; border-style: solid; border-color: #FF0000;{% endif %}">
70 <td width="75%">
71 <span onMouseOver="show_agenda_details({{agenda.id}});" onMouseOut="hide_agenda_details({{agenda.id}});;">
72- <a href="{{agenda.meeting.meeting_page_url}}" style="color: #000000;">
73+ <a href="{{agenda.meeting.meeting_page_url}}" style="color: #000000;" class="main-agenda-item-name">
74 {% if attendee in agenda.meeting.attendees %}
75 <img class="icon" src="/media/img/attending.png">
76 {% else %}
77@@ -153,4 +203,46 @@
78 <br /><br /><br /><br />
79 </article>
80
81+<script>
82+/* Mobile handler for clicking a link */
83+/* put at the bottom of the page so that the relevant elements exist */
84+document.querySelector("article.main-content").addEventListener("click", function(e) {
85+ /* Only handle clicking on the main links in the table */
86+ if (e.target.nodeName.toLowerCase() == "a" && e.target.className == "main-agenda-item-name") {
87+ /* only override links if we're in mobile mode */
88+ if (document.documentElement.clientWidth > 481) return;
89+ e.stopPropagation();
90+ e.preventDefault();
91+ /* toggle display of the details div */
92+ var details_div = e.target.parentNode.getElementsByTagName("div")[0];
93+ details_div.style.display = details_div.style.display == "block" ? "none" : "block";
94+ /* and add a link to the specific page to the top of the details div, if
95+ we haven't already */
96+ var links = details_div.getElementsByClassName("real-link");
97+ if (links.length == 0) {
98+ var a = document.createElement("a");
99+ a.href = e.target.href;
100+ a.appendChild(document.createTextNode("View details of this session"));
101+ a.className = "real-link";
102+ details_div.insertBefore(a, details_div.firstChild);
103+ }
104+ }
105+});
106+
107+/* override the mouseover/mouseout functions in mobile mode */
108+var old_show_agenda_details = show_agenda_details;
109+var old_hide_agenda_details = hide_agenda_details;
110+show_agenda_details = function(agenda_id) {
111+ if (document.documentElement.clientWidth > 481) {
112+ return old_show_agenda_details(agenda_id);
113+ }
114+};
115+hide_agenda_details = function(agenda_id) {
116+ if (document.documentElement.clientWidth > 481) {
117+ return old_hide_agenda_details(agenda_id);
118+ }
119+};
120+
121+</script>
122+
123 {% endblock %}

Subscribers

People subscribed via source and target branches