summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/commits.js.coffee
diff options
context:
space:
mode:
authorKoen Punt <koen@koenpunt.nl>2012-12-01 13:49:21 +0100
committerKoen Punt <koen@koenpunt.nl>2013-01-27 18:27:32 +0100
commite33debc2147966525246bad999d0cacc4e676585 (patch)
treec97b0aab18d179ed017f4273f6813b97c8ad81a2 /app/assets/javascripts/commits.js.coffee
parent6ab6c55de5516ac636b5ca1147c1d1f81831c599 (diff)
downloadgitlab-ce-e33debc2147966525246bad999d0cacc4e676585.tar.gz
Updated commit diff view with some minor visual modifications
Prepared diff view for multiple view modes Converted commits.js to coffeescript image info in separate coffeescript file Added swipe view mode Added onion skin viewMode
Diffstat (limited to 'app/assets/javascripts/commits.js.coffee')
-rw-r--r--app/assets/javascripts/commits.js.coffee54
1 files changed, 54 insertions, 0 deletions
diff --git a/app/assets/javascripts/commits.js.coffee b/app/assets/javascripts/commits.js.coffee
new file mode 100644
index 00000000000..47d6fcf8089
--- /dev/null
+++ b/app/assets/javascripts/commits.js.coffee
@@ -0,0 +1,54 @@
+class CommitsList
+ @data =
+ ref: null
+ limit: 0
+ offset: 0
+ @disable = false
+
+ @showProgress: ->
+ $('.loading').show()
+
+ @hideProgress: ->
+ $('.loading').hide()
+
+ @init: (ref, limit) ->
+ $(".day-commits-table li.commit").live 'click', (event) ->
+ if event.target.nodeName != "A"
+ location.href = $(this).attr("url")
+ e.stopPropagation()
+ return false
+
+ @data.ref = ref
+ @data.limit = limit
+ @data.offset = limit
+
+ this.initLoadMore()
+ this.showProgress();
+
+ @getOld: ->
+ this.showProgress()
+ $.ajax
+ type: "GET"
+ url: location.href
+ data: @data
+ complete: this.hideProgress
+ dataType: "script"
+
+ @append: (count, html) ->
+ $("#commits-list").append(html)
+ if count > 0
+ @data.offset += count
+ else
+ @disable = true
+
+ @initLoadMore: ->
+ $(document).endlessScroll
+ bottomPixels: 400
+ fireDelay: 1000
+ fireOnce: true
+ ceaseFire: =>
+ @disable
+ callback: =>
+ this.getOld()
+
+this.CommitsList = CommitsList \ No newline at end of file