瀏覽代碼

Previous/next buttons

Maarten van den Berg 6 年之前
父節點
當前提交
cea66c0de8

+ 7 - 0
app/assets/stylesheets/application.scss

@@ -99,3 +99,10 @@ table.collapse.in {
99 99
   margin-top: 0;
100 100
   margin-bottom: 0;
101 101
 }
102
+
103
+/* Ellipsis fixes for previous/next buttons. */
104
+.ellipsize-50 {
105
+  overflow: hidden;
106
+  text-overflow: ellipsis;
107
+  max-width: 50%;
108
+}

+ 15 - 0
app/views/activities/_prev_next.html.haml

@@ -0,0 +1,15 @@
1
+.row.form-group
2
+  .col-xs-12
3
+    - if @activity.previous_in_group
4
+      = link_to group_activity_path(@group, @activity.previous_in_group), class: 'btn btn-default ellipsize-50' do
5
+        %span
6
+          %i.fas.fa-arrow-left
7
+        %span
8
+          = @activity.previous_in_group.name
9
+
10
+    - if @activity.next_in_group
11
+      = link_to group_activity_path(@group, @activity.next_in_group), class: 'btn btn-default ellipsize-50 pull-right' do
12
+        %span.pull-right{style: "margin-left: 3px"}
13
+          %i.fas.fa-arrow-right
14
+        %span
15
+          = @activity.next_in_group.name

+ 1 - 0
app/views/activities/edit.html.haml

@@ -1,3 +1,4 @@
1
+= render partial: 'activities/prev_next'
1 2
 %h1
2 3
   = t 'activities.edit'
3 4
 

+ 2 - 0
app/views/activities/show.html.haml

@@ -1,4 +1,6 @@
1 1
 - all_buttons = @activity.may_change?(current_person)
2
+= render partial: 'activities/prev_next'
3
+
2 4
 .row
3 5
   .col-md-9
4 6
     .panel.panel-default

+ 3 - 0
config/locales/aardbei_en.yml

@@ -38,6 +38,9 @@ en:
38 38
   send_email: "Send email"
39 39
   overview: "Overzicht"
40 40
 
41
+  next: "Next"
42
+  previous: "Previous"
43
+
41 44
   somethingbroke: "Something broke!"
42 45
 
43 46
   areyousure: "Are you sure?"

+ 3 - 0
config/locales/aardbei_nl.yml

@@ -17,6 +17,9 @@ nl:
17 17
   send_email: "Email versturen"
18 18
   overview: "Overzicht"
19 19
 
20
+  next: "Volgende"
21
+  previous: "Vorige"
22
+
20 23
   areyousure: "Weet je het zeker?"
21 24
 
22 25
   somethingbroke: "Er is iets misgegaan! Neem contact op als dit blijft gebeuren."