]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/controllers.js
Added attachment creation from link/name
[bookstack] / resources / assets / js / controllers.js
index b5353e7d9d2b315df46456bf69336b725f2a1cc5..bc2d43fc8eb0e5e933cd46637b31821480de3b18 100644 (file)
@@ -606,6 +606,18 @@ module.exports = function (ngApp, events) {
                   });
             };
 
+            $scope.attachLinkSubmit = function(fileName, fileLink) {
+                $http.post('/files/link', {
+                    uploaded_to: pageId,
+                    name: fileName,
+                    link: fileLink
+                }).then(resp => {
+                    $scope.files.unshift(resp.data);
+                    events.emit('success', 'Link attached');
+                });
+                $scope.fileName = $scope.fileLink = '';
+            };
+
         }]);
 
 };