diff --git a/smash/web/static/js/appointment.js b/smash/web/static/js/appointment.js
index 845958ae381dbe6e03f75ad2146e14af3bdf1b22..852d14ca57b1b6fd8f66c4a7afb4bdbf52fe34bf 100644
--- a/smash/web/static/js/appointment.js
+++ b/smash/web/static/js/appointment.js
@@ -88,5 +88,43 @@ function appointment_type_behaviour(checkboxes, outObject, api_call) {
         }
 
     });
-
 }
+
+function get_calendar_events_function(source, allow_url_redirection) {
+    if (allow_url_redirection === undefined) {
+        allow_url_redirection = false;
+    }
+    return function (start, end, timezone, callback) {
+        $.ajax({
+            data: {
+                // our hypothetical feed requires UNIX timestamps
+                start_date: start.format(),
+                end_date: end.format()
+            },
+            url: source,
+            success: function (doc) {
+                var events = [];
+                for (var i = 0; i < doc.data.length; i++) {
+                    var title = doc.data[i].subject;
+                    if (title != "") {
+                        title += "; type: " + doc.data[i].type;
+                    } else {
+                        title = doc.data[i].title
+                    }
+                    var event = {
+                        title: title,
+                        start: doc.data[i].datetime_when,
+                        end: doc.data[i].datetime_until,
+                        id: doc.data[i].id,
+                        color: doc.data[i].color,
+                    };
+                    if (allow_url_redirection) {
+                        event["url"] = doc.data[i].url;
+                    }
+                    events.push(event)
+                }
+                callback(events);
+            }
+        });
+    }
+}
\ No newline at end of file
diff --git a/smash/web/templates/appointments/index.html b/smash/web/templates/appointments/index.html
index ae811de09c765464c25e6c12402b51a49f69b497..b06cb857ded5c05577ba0d3913c3a895fd9c97d6 100644
--- a/smash/web/templates/appointments/index.html
+++ b/smash/web/templates/appointments/index.html
@@ -65,6 +65,7 @@
     <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script>
     <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script>
     <script src="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.js' %}"></script>
+    <script src="{% static 'js/appointment.js' %}"></script>
 
     <script>
         $(function () {
@@ -104,36 +105,7 @@
                 weekNumbers: true,
                 startParam: "start_date",
                 endParam: "end_date",
-                events: function (start, end, timezone, callback) {
-                    $.ajax({
-                        data: {
-                            // our hypothetical feed requires UNIX timestamps
-                            start_date: start.format(),
-                            end_date: end.format()
-                        },
-                        url: "{% url 'web.api.appointments' full_list %}",
-                        success: function (doc) {
-                            var events = [];
-                            for (var i = 0; i < doc.data.length; i++) {
-                                var title = doc.data[i].subject;
-                                if (title != "") {
-                                    title += "; type: " + doc.data[i].type;
-                                } else {
-                                    title = doc.data[i].title
-                                }
-                                events.push({
-                                    title: title,
-                                    start: doc.data[i].datetime_when,
-                                    end: doc.data[i].datetime_until,
-                                    id: doc.data[i].id,
-                                    color: doc.data[i].color,
-                                    url: doc.data[i].url,
-                                })
-                            }
-                            callback(events);
-                        }
-                    });
-                }
+                events: get_calendar_events_function("{% url 'web.api.appointments' full_list %}", true),
             });
         });
     </script>