Kaynağa Gözat

Add view and translations

Maarten van den Berg 6 yıl önce
ebeveyn
işleme
fb5ebaa18f

+ 2 - 0
app/assets/javascripts/dashboard.coffee

@@ -1,3 +1,5 @@
1 1
 # Place all the behaviors and hooks related to the matching controller here.
2 2
 # All this logic will automatically be available in application.js.
3 3
 # You can use CoffeeScript in this file: http://coffeescript.org/
4
+$(document).on 'turbolinks:load', ->
5
+  clipboard = new Clipboard('.copy-url')

+ 2 - 0
app/assets/javascripts/settings.coffee

@@ -0,0 +1,2 @@
1
+$(document).on 'turbolinks:load', ->
2
+  clipboard = new Clipboard('.copy-url')

+ 7 - 0
app/models/person.rb

@@ -95,6 +95,13 @@ class Person < ApplicationRecord
95 95
 
96 96
     return result
97 97
   end
98
+
99
+  # @return [String]
100
+  #   the URL to access this person's calendar.
101
+  def calendar_url
102
+    person_calendar_url self.calendar_token
103
+  end
104
+
98 105
   private
99 106
   # Assert that the person's birth date, if any, lies in the past.
100 107
   def birth_date_cannot_be_in_future

+ 23 - 1
app/views/dashboard/settings.html.haml

@@ -2,6 +2,28 @@
2 2
   = t 'settings.settings'
3 3
 
4 4
 %h2
5
+  = t 'settings.calendar'
6
+
7
+.row
8
+  .col-md-12
9
+    %em
10
+      = t 'settings.descriptions.calendar'
11
+
12
+    .form-group
13
+      .input-group
14
+        = text_field_tag(:calurl, person_calendar_url(@person.calendar_token), readonly: true, id: 'calurl', class: 'form-control')
15
+        %span.input-group-btn
16
+          = button_tag(class: 'btn btn-default copy-url', data: {'clipboard-target': '#calurl'}) do
17
+            %i.fa.fa-files-o
18
+
19
+    .form-group
20
+      .input-group
21
+        = text_field_tag(:calurl_nocancel, person_calendar_url(@person.calendar_token, skipcancel: 1), readonly: true, id: 'calurl-skipcancel', class: 'form-control')
22
+        %span.input-group-btn
23
+          = button_tag(class: 'btn btn-default copy-url', data: {'clipboard-target': '#calurl-skipcancel'}) do
24
+            %i.fa.fa-files-o
25
+
26
+%h2
5 27
   = t 'settings.email_settings'
6 28
 
7 29
 = form_tag(update_email_settings_path, method: "post", class: "form") do
@@ -10,7 +32,7 @@
10 32
       %label
11 33
         = check_box_tag(:send_attendance_reminder, 'send_attendance_reminder', @send_attendance_reminder)
12 34
         = t('settings.names.send_attendance_reminder')
13
-    .col-md-6
35
+    .col-md-8
14 36
       %p
15 37
         %em= t 'settings.descriptions.send_attendance_reminder'
16 38
 

+ 5 - 0
config/locales/settings_en.yml

@@ -4,9 +4,14 @@ en:
4 4
     saved: "Preferences saved!"
5 5
     email_settings: "Email notifications"
6 6
     change_password: "Change password"
7
+    logout_all_sessions: "Log out everywhere"
8
+    calendar: "Calendar integration"
7 9
 
8 10
     names:
9 11
       send_attendance_reminder: "Send notification on auto-respond"
10 12
 
11 13
     descriptions:
12 14
       send_attendance_reminder: "Receive an email if you haven't responded to an activity and your response is automatically set to 'attending'. When youreceive this reminder, you still have the possibility to change your response."
15
+      logout_all_sessions: "Pressing this button will require you to enter your password again on each of your devices. This will also happen if you change your password."
16
+      logged_in_at_count: "You are logged in on %{count} devices."
17
+      calendar: "Copy one of the following URLs to a calendar application (such as Google Calendar) to automatically make an event for each activity. The first URL will include all activities, the second url will omit activities where you are not attending."

+ 2 - 0
config/locales/settings_nl.yml

@@ -5,6 +5,7 @@ nl:
5 5
     email_settings: "Emailnotificaties"
6 6
     change_password: "Wachtwoord veranderen"
7 7
     logout_all_sessions: "Overal afmelden"
8
+    calendar: "Kalenderkoppeling"
8 9
 
9 10
     names:
10 11
       send_attendance_reminder: "Stuur een herinnering bij niet gereageerd"
@@ -13,3 +14,4 @@ nl:
13 14
       send_attendance_reminder: "Ontvang een email als je niet hebt gereageerd op een activiteit en je reactie automatisch op 'aanwezig' wordt gezet. Wanneer je deze herinnering ontvangt is het nog mogelijk om je reactie aan te passen."
14 15
       logout_all_sessions: "Deze knop indrukken zorgt ervoor dat je overal je wachtwoord opnieuw moet invoeren. Dit gebeurt ook als je je wachtwoord verandert."
15 16
       logged_in_at_count: "Je hebt op het moment %{count} actieve sessie(s)."
17
+      calendar: "Kopieer een van de volgende URL's naar een agenda-programma (bijvoorbeeld Google Calendar) om automatisch een evenement aan te laten maken voor elke activiteit. De eerste URL zal alle activiteiten overnemen, de tweede URL laat activiteiten weg waar je op 'Afwezig' staat."