Procházet zdrojové kódy

Dashboard responsiveness

Maarten van den Berg %!s(int64=7) %!d(string=před) roky
rodič
revize
364a3a2636
1 změnil soubory, kde provedl 117 přidání a 53 odebrání
  1. 117 53
      app/views/dashboard/home.html.haml

+ 117 - 53
app/views/dashboard/home.html.haml

@@ -2,42 +2,79 @@
2 2
   .row
3 3
     - if @need_response.any?
4 4
       .col-md-12
5
-        .panel.panel-default
6
-          .panel-heading
7
-            = t 'activities.state.need_response'
5
+        .hidden-xs
6
+          .panel.panel-default
7
+            .panel-heading
8
+              = t 'activities.state.need_response'
8 9
 
9
-          .panel-body
10
-            %table.table.table-bordered
11
-              %thead
12
-                %tr
13
-                  %th
14
-                    = t 'activities.attrs.name'
15
-                  %th
16
-                    = t 'activities.attrs.group'
17
-                  %th
18
-                    = t 'activities.attrs.when'
19
-                  %th
20
-                    = t 'activities.attrs.where'
21
-                  %th
22
-                    = t 'activities.attrs.actions'
10
+            .panel-body
11
+              %table.table.table-bordered
12
+                %thead
13
+                  %tr
14
+                    %th
15
+                      = t 'activities.attrs.name'
16
+                    %th
17
+                      = t 'activities.attrs.group'
18
+                    %th
19
+                      = t 'activities.attrs.when'
20
+                    %th
21
+                      = t 'activities.attrs.where'
22
+                    %th
23
+                      = t 'activities.attrs.actions'
23 24
 
24
-              %tbody
25
-                - @need_response.each do |p|
26
-                  - e = p.activity
27
-                  %tr{class: p.row_class, data: {activity_id: e.id, person_id: current_person.id}}
28
-                    %td
29
-                      = link_to group_activity_path(e.group, e) do
30
-                        = e.name
31
-                    %td
32
-                      = e.group.name
33
-                    %td
34
-                      = e.start
35
-                    %td
36
-                      = e.location
37
-                    %td
38
-                      = render partial: "activities/presence_buttons", locals: {activity: e, person: current_person, state: p.attending}
39
-          .panel-footer.text-center.sv-nomargins
40
-            = will_paginate @need_response, param_name: 'nrpage', renderer: WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'pagination-sm pagination'
25
+                %tbody
26
+                  - @need_response.each do |p|
27
+                    - e = p.activity
28
+                    %tr{class: p.row_class, data: {activity_id: e.id, person_id: current_person.id}}
29
+                      %td
30
+                        = link_to group_activity_path(e.group, e) do
31
+                          = e.name
32
+                      %td
33
+                        = e.group.name
34
+                      %td
35
+                        = e.start
36
+                      %td
37
+                        = e.location
38
+                      %td
39
+                        = render partial: "activities/presence_buttons", locals: {activity: e, person: current_person, state: p.attending}
40
+            .panel-footer.text-center.sv-nomargins
41
+              = will_paginate @need_response, param_name: 'nrpage', renderer: WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'pagination-sm pagination'
42
+        .hidden-sm.hidden-md.hidden-lg
43
+          .panel.panel-default
44
+            .panel-heading
45
+              %a{role: 'button', href: '#needresponse-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
46
+
47
+                %span.sv-show-collapsed
48
+                  %i.fa.fa-angle-down
49
+
50
+                %span.sv-show-expanded
51
+                  %i.fa.fa-angle-up
52
+
53
+                = t 'activities.state.need_response'
54
+                %span.badge
55
+                  = @need_response.count
56
+
57
+            .panel-body.collapse#needresponse-collapse
58
+              %table.table
59
+                %tbody
60
+                  - @need_response.each do |p|
61
+                    - e = p.activity
62
+                    %tr{class: p.row_class, data: {activity_id: e.id, person_id: p.person_id}}
63
+                      %td
64
+                        = link_to group_activity_path(e.group, e) do
65
+                          = e.name
66
+
67
+                      %td
68
+                        = l e.start, format: :short
69
+
70
+                    %tr{class: p.row_class, data: {activity_id: e.id, person_id: p.person_id}}
71
+                      %td
72
+                        = e.location
73
+
74
+                      %td
75
+                        = render partial: 'activities/presence_buttons', locals: {activity: e, person: p.person, state: p.attending}
76
+              .sv-nomargins.text-center
77
+                = will_paginate @need_response, page_links: false, param_name: 'nrpage', renderer: WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'pagination-sm pagination'
41 78
   .row
42 79
     .col-md-6
43 80
       .panel.panel-default
@@ -67,26 +104,53 @@
67 104
                   %td
68 105
                     = link_to group_activity_url(a.group, a) do
69 106
                       = a.name
70
-                      = render partial: "activities/state_counts", locals: {counts: a.state_counts}
107
+                      = "(#{a.human_state_counts})"
71 108
 
72 109
   .row
73 110
     .col-md-12
74
-      .panel.panel-default
75
-        .panel-heading
76
-          = t 'dashboard.participant_you'
111
+      .hidden-xs
112
+        .panel.panel-default
113
+          .panel-heading
114
+            = t 'dashboard.participant_you'
77 115
 
78
-        .panel-body
79
-          %table.table.table-striped
80
-            %tbody
81
-              - @upcoming.each do |p|
82
-                - e = p.activity
83
-                %tr{class: p.row_class, data: {activity_id: e.id, person_id: current_person.id}}
84
-                  %td
85
-                    = link_to group_activity_path(e.group, e) do
86
-                      = e.name
87
-                  %td
88
-                    = render partial: "activities/presence_buttons", locals: {activity: e, person: current_person, state: p.attending}
89
-                  %td
90
-                    = editable p, :notes, url: presence_group_activity_path(e.group, e, person_id: current_person.id), title: t('activities.participant.notes'), value: p.notes, emptytext: t('activities.participant.add_notes')
91
-        .panel-footer.text-center.sv-nomargins
92
-          = will_paginate(@upcoming, param_name: 'upage', renderer: WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'pagination-sm pagination')
116
+          .panel-body
117
+            %table.table.table-striped
118
+              %tbody
119
+                - @upcoming.each do |p|
120
+                  - e = p.activity
121
+                  %tr{class: p.row_class, data: {activity_id: e.id, person_id: current_person.id}}
122
+                    %td
123
+                      = link_to group_activity_path(e.group, e) do
124
+                        = e.name
125
+                    %td
126
+                      = render partial: "activities/presence_buttons", locals: {activity: e, person: current_person, state: p.attending}
127
+                    %td
128
+                      = editable p, :notes, url: presence_group_activity_path(e.group, e, person_id: current_person.id), title: t('activities.participant.notes'), value: p.notes, emptytext: t('activities.participant.add_notes')
129
+          .panel-footer.text-center.sv-nomargins
130
+            = will_paginate(@upcoming, param_name: 'upage', renderer: WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'pagination-sm pagination')
131
+      .hidden-sm.hidden-md.hidden-lg
132
+        .panel.panel-default
133
+          .panel-heading
134
+            = t 'dashboard.participant_you'
135
+            %span.badge
136
+              = @upcoming.count
137
+
138
+          .panel-body
139
+            %table.table
140
+              %tbody
141
+                - @upcoming.each do |p|
142
+                  - e = p.activity
143
+                  %tr{class: p.row_class, data: {activity_id: e.id, person_id: p.person_id}}
144
+                    %td
145
+                      = link_to group_activity_path(e.group, e) do
146
+                        = e.name
147
+
148
+                    %td
149
+                      = render partial: 'activities/presence_buttons', locals: {activity: e, person: p.person, state: p.attending}
150
+
151
+                  %tr{class: p.row_class, data: {activity_id: e.id, person_id: p.person_id}}
152
+                    %td{colspan: 2}
153
+                      = editable p, :notes, url: presence_group_activity_path(e.group, e, person_id: p.person_id), title: t('activities.participant.notes'), value: p.notes, emptytext: t('activities.participant.add_notes')
154
+
155
+            .sv-nomargins.text-center
156
+              = will_paginate @upcoming, page_links: false, param_name: 'upage', renderer: WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'pagination-sm pagination'