summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/build_artifacts.js.coffee14
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee2
-rw-r--r--app/views/projects/artifacts/browse.html.haml13
3 files changed, 16 insertions, 13 deletions
diff --git a/app/assets/javascripts/build_artifacts.js.coffee b/app/assets/javascripts/build_artifacts.js.coffee
new file mode 100644
index 00000000000..5ae6cba56c8
--- /dev/null
+++ b/app/assets/javascripts/build_artifacts.js.coffee
@@ -0,0 +1,14 @@
+class @BuildArtifacts
+ constructor: () ->
+ @disablePropagation()
+ @setupEntryClick()
+
+ disablePropagation: ->
+ $('.top-block').on 'click', '.download', (e) ->
+ e.stopPropagation()
+ $('.tree-holder').on 'click', 'tr[data-link] a', (e) ->
+ e.stopImmediatePropagation()
+
+ setupEntryClick: ->
+ $('.tree-holder').on 'click', 'tr[data-link]', (e) ->
+ window.location = @dataset.link
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index 0d88e8d254a..2cdf01d874c 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -100,6 +100,8 @@ class Dispatcher
shortcut_handler = true
when 'projects:forks:new'
new ProjectFork()
+ when 'projects:artifacts:browse'
+ new BuildArtifacts()
when 'users:show'
new User()
new Activities()
diff --git a/app/views/projects/artifacts/browse.html.haml b/app/views/projects/artifacts/browse.html.haml
index 8a6fb785708..84034c8bf16 100644
--- a/app/views/projects/artifacts/browse.html.haml
+++ b/app/views/projects/artifacts/browse.html.haml
@@ -20,16 +20,3 @@
- if @entry.empty?
.center Empty
-
-:javascript
- $('.top-block').on('click', '.download', function(e) {
- e.stopPropagation();
- });
-
- $('.tree-holder').on('click', 'tr[data-link] a', function(e) {
- e.stopImmediatePropagation();
- });
-
- $('.tree-holder').on('click', 'tr[data-link]', function(e) {
- window.location = this.dataset.link;
- });