Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/activities.js.coffee29
-rw-r--r--app/assets/javascripts/admin.js.coffee53
-rw-r--r--app/assets/javascripts/api.js.coffee49
-rw-r--r--app/assets/javascripts/application.js.coffee194
-rw-r--r--app/assets/javascripts/aside.js.coffee17
-rw-r--r--app/assets/javascripts/autosave.js.coffee39
-rw-r--r--app/assets/javascripts/behaviors/details_behavior.coffee15
-rw-r--r--app/assets/javascripts/behaviors/taskable.js.coffee21
-rw-r--r--app/assets/javascripts/behaviors/toggler_behavior.coffee14
-rw-r--r--app/assets/javascripts/blob/blob.js.coffee73
-rw-r--r--app/assets/javascripts/blob/edit_blob.js.coffee44
-rw-r--r--app/assets/javascripts/blob/new_blob.js.coffee21
-rw-r--r--app/assets/javascripts/branch-graph.js.coffee340
-rw-r--r--app/assets/javascripts/calendar.js.coffee38
-rw-r--r--app/assets/javascripts/commit.js.coffee4
-rw-r--r--app/assets/javascripts/commit/file.js.coffee5
-rw-r--r--app/assets/javascripts/commit/image-file.js.coffee126
-rw-r--r--app/assets/javascripts/commits.js.coffee55
-rw-r--r--app/assets/javascripts/confirm_danger_modal.js.coffee18
-rw-r--r--app/assets/javascripts/dashboard.js.coffee3
-rw-r--r--app/assets/javascripts/diff.js.coffee44
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee154
-rw-r--r--app/assets/javascripts/dropzone_input.js.coffee243
-rw-r--r--app/assets/javascripts/extensions/array.js7
-rw-r--r--app/assets/javascripts/extensions/jquery.js.coffee13
-rw-r--r--app/assets/javascripts/flash.js.coffee12
-rw-r--r--app/assets/javascripts/gfm_auto_complete.js.coffee67
-rw-r--r--app/assets/javascripts/group_avatar.js.coffee9
-rw-r--r--app/assets/javascripts/groups.js.coffee4
-rw-r--r--app/assets/javascripts/groups_select.js.coffee41
-rw-r--r--app/assets/javascripts/importer_status.js.coffee35
-rw-r--r--app/assets/javascripts/issuable_form.js.coffee28
-rw-r--r--app/assets/javascripts/issue.js.coffee24
-rw-r--r--app/assets/javascripts/issues.js.coffee85
-rw-r--r--app/assets/javascripts/labels.js.coffee33
-rw-r--r--app/assets/javascripts/lib/jquery.timeago.js181
-rw-r--r--app/assets/javascripts/lib/md5.js211
-rw-r--r--app/assets/javascripts/lib/utf8_encode.js70
-rw-r--r--app/assets/javascripts/merge_request.js.coffee166
-rw-r--r--app/assets/javascripts/merge_requests.js.coffee35
-rw-r--r--app/assets/javascripts/milestone.js.coffee124
-rw-r--r--app/assets/javascripts/namespace_select.js.coffee25
-rw-r--r--app/assets/javascripts/network.js.coffee9
-rw-r--r--app/assets/javascripts/notes.js.coffee481
-rw-r--r--app/assets/javascripts/pager.js.coffee42
-rw-r--r--app/assets/javascripts/profile.js.coffee29
-rw-r--r--app/assets/javascripts/project.js.coffee26
-rw-r--r--app/assets/javascripts/project_avatar.js.coffee9
-rw-r--r--app/assets/javascripts/project_fork.js.coffee5
-rw-r--r--app/assets/javascripts/project_import.js.coffee5
-rw-r--r--app/assets/javascripts/project_members.js.coffee4
-rw-r--r--app/assets/javascripts/project_new.js.coffee11
-rw-r--r--app/assets/javascripts/project_show.js.coffee15
-rw-r--r--app/assets/javascripts/projects_list.js.coffee24
-rw-r--r--app/assets/javascripts/protected_branches.js.coffee21
-rw-r--r--app/assets/javascripts/search_autocomplete.js.coffee11
-rw-r--r--app/assets/javascripts/shortcuts.js.coffee30
-rw-r--r--app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee14
-rw-r--r--app/assets/javascripts/shortcuts_issueable.coffee19
-rw-r--r--app/assets/javascripts/shortcuts_navigation.coffee20
-rw-r--r--app/assets/javascripts/shortcuts_network.js.coffee12
-rw-r--r--app/assets/javascripts/sidebar.js.coffee9
-rw-r--r--app/assets/javascripts/stat_graph.js.coffee6
-rw-r--r--app/assets/javascripts/stat_graph_contributors.js.coffee69
-rw-r--r--app/assets/javascripts/stat_graph_contributors_graph.js.coffee167
-rw-r--r--app/assets/javascripts/stat_graph_contributors_util.js.coffee93
-rw-r--r--app/assets/javascripts/subscription.js.coffee17
-rw-r--r--app/assets/javascripts/tree.js.coffee41
-rw-r--r--app/assets/javascripts/user.js.coffee4
-rw-r--r--app/assets/javascripts/users_select.js.coffee117
-rw-r--r--app/assets/javascripts/wikis.js.coffee9
-rw-r--r--app/assets/javascripts/zen_mode.js.coffee67
72 files changed, 0 insertions, 4155 deletions
diff --git a/app/assets/javascripts/activities.js.coffee b/app/assets/javascripts/activities.js.coffee
deleted file mode 100644
index 777c62dc1b7..00000000000
--- a/app/assets/javascripts/activities.js.coffee
+++ /dev/null
@@ -1,29 +0,0 @@
-class @Activities
- constructor: ->
- Pager.init 20, true
- $(".event_filter_link").bind "click", (event) =>
- event.preventDefault()
- @toggleFilter($(event.currentTarget))
- @reloadActivities()
-
- reloadActivities: ->
- $(".content_list").html ''
- Pager.init 20, true
-
-
- toggleFilter: (sender) ->
- sender.parent().toggleClass "active"
- event_filters = $.cookie("event_filter")
- filter = sender.attr("id").split("_")[0]
- if event_filters
- event_filters = event_filters.split(",")
- else
- event_filters = new Array()
-
- index = event_filters.indexOf(filter)
- if index is -1
- event_filters.push filter
- else
- event_filters.splice index, 1
-
- $.cookie "event_filter", event_filters.join(","), { path: '/' }
diff --git a/app/assets/javascripts/admin.js.coffee b/app/assets/javascripts/admin.js.coffee
deleted file mode 100644
index bcb2e6df7c0..00000000000
--- a/app/assets/javascripts/admin.js.coffee
+++ /dev/null
@@ -1,53 +0,0 @@
-class @Admin
- constructor: ->
- $('input#user_force_random_password').on 'change', (elem) ->
- elems = $('#user_password, #user_password_confirmation')
-
- if $(@).attr 'checked'
- elems.val('').attr 'disabled', true
- else
- elems.removeAttr 'disabled'
-
- $('body').on 'click', '.js-toggle-colors-link', (e) ->
- e.preventDefault()
- $('.js-toggle-colors-link').hide()
- $('.js-toggle-colors-container').show()
-
- $('input#broadcast_message_color').on 'input', ->
- previewColor = $('input#broadcast_message_color').val()
- $('div.broadcast-message-preview').css('background-color', previewColor)
-
- $('input#broadcast_message_font').on 'input', ->
- previewColor = $('input#broadcast_message_font').val()
- $('div.broadcast-message-preview').css('color', previewColor)
-
- $('textarea#broadcast_message_message').on 'input', ->
- previewMessage = $('textarea#broadcast_message_message').val()
- $('div.broadcast-message-preview span').text(previewMessage)
-
- $('.log-tabs a').click (e) ->
- e.preventDefault()
- $(this).tab('show')
-
- $('.log-bottom').click (e) ->
- e.preventDefault()
- visible_log = $(".file-content:visible")
- visible_log.animate({ scrollTop: visible_log.find('ol').height() }, "fast")
-
- modal = $('.change-owner-holder')
-
- $('.change-owner-link').bind "click", (e) ->
- e.preventDefault()
- $(this).hide()
- modal.show()
-
- $('.change-owner-cancel-link').bind "click", (e) ->
- e.preventDefault()
- modal.hide()
- $('.change-owner-link').show()
-
- $('li.project_member').bind 'ajax:success', ->
- Turbolinks.visit(location.href)
-
- $('li.group_member').bind 'ajax:success', ->
- Turbolinks.visit(location.href)
diff --git a/app/assets/javascripts/api.js.coffee b/app/assets/javascripts/api.js.coffee
deleted file mode 100644
index 9e5d594c861..00000000000
--- a/app/assets/javascripts/api.js.coffee
+++ /dev/null
@@ -1,49 +0,0 @@
-@Api =
- groups_path: "/api/:version/groups.json"
- group_path: "/api/:version/groups/:id.json"
- namespaces_path: "/api/:version/namespaces.json"
-
- group: (group_id, callback) ->
- url = Api.buildUrl(Api.group_path)
- url = url.replace(':id', group_id)
-
- $.ajax(
- url: url
- data:
- private_token: gon.api_token
- dataType: "json"
- ).done (group) ->
- callback(group)
-
- # Return groups list. Filtered by query
- # Only active groups retrieved
- groups: (query, skip_ldap, callback) ->
- url = Api.buildUrl(Api.groups_path)
-
- $.ajax(
- url: url
- data:
- private_token: gon.api_token
- search: query
- per_page: 20
- dataType: "json"
- ).done (groups) ->
- callback(groups)
-
- # Return namespaces list. Filtered by query
- namespaces: (query, callback) ->
- url = Api.buildUrl(Api.namespaces_path)
-
- $.ajax(
- url: url
- data:
- private_token: gon.api_token
- search: query
- per_page: 20
- dataType: "json"
- ).done (namespaces) ->
- callback(namespaces)
-
- buildUrl: (url) ->
- url = gon.relative_url_root + url if gon.relative_url_root?
- return url.replace(':version', gon.api_version)
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
deleted file mode 100644
index fda142293bc..00000000000
--- a/app/assets/javascripts/application.js.coffee
+++ /dev/null
@@ -1,194 +0,0 @@
-# This is a manifest file that'll be compiled into including all the files listed below.
-# Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
-# be included in the compiled file accessible from http://example.com/assets/application.js
-# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-# the compiled file.
-#
-#= require jquery
-#= require jquery.ui.all
-#= require jquery_ujs
-#= require jquery.cookie
-#= require jquery.endless-scroll
-#= require jquery.highlight
-#= require jquery.history
-#= require jquery.waitforimages
-#= require jquery.atwho
-#= require jquery.scrollTo
-#= require jquery.blockUI
-#= require jquery.turbolinks
-#= require jquery.sticky-kit.min
-#= require turbolinks
-#= require autosave
-#= require bootstrap
-#= require select2
-#= require raphael
-#= require g.raphael-min
-#= require g.bar-min
-#= require chart-lib.min
-#= require branch-graph
-#= require ace/ace
-#= require ace/ext-searchbox
-#= require d3
-#= require underscore
-#= require nprogress
-#= require nprogress-turbolinks
-#= require dropzone
-#= require mousetrap
-#= require mousetrap/pause
-#= require shortcuts
-#= require shortcuts_navigation
-#= require shortcuts_dashboard_navigation
-#= require shortcuts_issueable
-#= require shortcuts_network
-#= require cal-heatmap
-#= require_tree .
-
-window.slugify = (text) ->
- text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase()
-
-window.ajaxGet = (url) ->
- $.ajax({type: "GET", url: url, dataType: "script"})
-
-window.showAndHide = (selector) ->
-
-window.split = (val) ->
- return val.split( /,\s*/ )
-
-window.extractLast = (term) ->
- return split( term ).pop()
-
-window.rstrip = (val) ->
- return if val then val.replace(/\s+$/, '') else val
-
-# Disable button if text field is empty
-window.disableButtonIfEmptyField = (field_selector, button_selector) ->
- field = $(field_selector)
- closest_submit = field.closest('form').find(button_selector)
-
- closest_submit.disable() if rstrip(field.val()) is ""
-
- field.on 'input', ->
- if rstrip($(@).val()) is ""
- closest_submit.disable()
- else
- closest_submit.enable()
-
-# Disable button if any input field with given selector is empty
-window.disableButtonIfAnyEmptyField = (form, form_selector, button_selector) ->
- closest_submit = form.find(button_selector)
- updateButtons = ->
- filled = true
- form.find('input').filter(form_selector).each ->
- filled = rstrip($(this).val()) != "" || !$(this).attr('required')
-
- if filled
- closest_submit.enable()
- else
- closest_submit.disable()
-
- updateButtons()
- form.keyup(updateButtons)
-
-window.sanitize = (str) ->
- return str.replace(/<(?:.|\n)*?>/gm, '')
-
-window.linkify = (str) ->
- exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
- return str.replace(exp,"<a href='$1'>$1</a>")
-
-window.simpleFormat = (str) ->
- linkify(sanitize(str).replace(/\n/g, '<br />'))
-
-window.unbindEvents = ->
- $(document).unbind('scroll')
- $(document).off('scroll')
-
-window.shiftWindow = ->
- scrollBy 0, -50
-
-document.addEventListener("page:fetch", unbindEvents)
-
-# Scroll the window to avoid the topnav bar
-# https://github.com/twitter/bootstrap/issues/1768
-if location.hash
- setTimeout shiftWindow, 1
-window.addEventListener "hashchange", shiftWindow
-
-$ ->
- # Click a .one_click_select field, select the contents
- $(".one_click_select").on 'click', -> $(@).select()
-
- $('.remove-row').bind 'ajax:success', ->
- $(this).closest('li').fadeOut()
-
- # Initialize select2 selects
- $('select.select2').select2(width: 'resolve', dropdownAutoWidth: true)
-
- # Close select2 on escape
- $('.js-select2').bind 'select2-close', ->
- setTimeout ( ->
- $('.select2-container-active').removeClass('select2-container-active')
- $(':focus').blur()
- ), 1
-
- # Initialize tooltips
- $('.has_tooltip').tooltip()
-
- # Bottom tooltip
- $('.has_bottom_tooltip').tooltip(placement: 'bottom')
-
- # Form submitter
- $('.trigger-submit').on 'change', ->
- $(@).parents('form').submit()
-
- $("abbr.timeago").timeago()
- $('.js-timeago').timeago()
-
- # Flash
- if (flash = $(".flash-container")).length > 0
- flash.click -> $(@).fadeOut()
- flash.show()
-
- # Disable form buttons while a form is submitting
- $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
- buttons = $('[type="submit"]', @)
-
- switch e.type
- when 'ajax:beforeSend', 'submit'
- buttons.disable()
- else
- buttons.enable()
-
- # Show/Hide the profile menu when hovering the account box
- $('.account-box').hover -> $(@).toggleClass('hover')
-
- # Commit show suppressed diff
- $(".diff-content").on "click", ".supp_diff_link", ->
- $(@).next('table').show()
- $(@).remove()
-
- # Show/hide comments on diff
- $("body").on "click", ".js-toggle-diff-comments", (e) ->
- $(@).toggleClass('active')
- $(@).closest(".diff-file").find(".notes_holder").toggle()
- e.preventDefault()
-
- $(document).on "click", '.js-confirm-danger', (e) ->
- e.preventDefault()
- btn = $(e.target)
- text = btn.data("confirm-danger-message")
- form = btn.closest("form")
- new ConfirmDangerModal(form, text)
-
- new Aside()
-
-(($) ->
- # Disable an element and add the 'disabled' Bootstrap class
- $.fn.extend disable: ->
- $(@).attr('disabled', 'disabled').addClass('disabled')
-
- # Enable an element and remove the 'disabled' Bootstrap class
- $.fn.extend enable: ->
- $(@).removeAttr('disabled').removeClass('disabled')
-
-)(jQuery)
diff --git a/app/assets/javascripts/aside.js.coffee b/app/assets/javascripts/aside.js.coffee
deleted file mode 100644
index 85473101944..00000000000
--- a/app/assets/javascripts/aside.js.coffee
+++ /dev/null
@@ -1,17 +0,0 @@
-class @Aside
- constructor: ->
- $(document).off "click", "a.show-aside"
- $(document).on "click", 'a.show-aside', (e) ->
- e.preventDefault()
- btn = $(e.currentTarget)
- icon = btn.find('i')
- console.log('1')
-
- if icon.hasClass('fa-angle-left')
- btn.parent().find('section').hide()
- btn.parent().find('aside').fadeIn()
- icon.removeClass('fa-angle-left').addClass('fa-angle-right')
- else
- btn.parent().find('aside').hide()
- btn.parent().find('section').fadeIn()
- icon.removeClass('fa-angle-right').addClass('fa-angle-left')
diff --git a/app/assets/javascripts/autosave.js.coffee b/app/assets/javascripts/autosave.js.coffee
deleted file mode 100644
index 5d3fe81da74..00000000000
--- a/app/assets/javascripts/autosave.js.coffee
+++ /dev/null
@@ -1,39 +0,0 @@
-class @Autosave
- constructor: (field, key) ->
- @field = field
-
- key = key.join("/") if key.join?
- @key = "autosave/#{key}"
-
- @field.data "autosave", this
-
- @restore()
-
- @field.on "input", => @save()
-
- restore: ->
- return unless window.localStorage?
-
- try
- text = window.localStorage.getItem @key
- catch
- return
-
- @field.val text if text?.length > 0
- @field.trigger "input"
-
- save: ->
- return unless window.localStorage?
-
- text = @field.val()
- if text?.length > 0
- try
- window.localStorage.setItem @key, text
- else
- @reset()
-
- reset: ->
- return unless window.localStorage?
-
- try
- window.localStorage.removeItem @key
diff --git a/app/assets/javascripts/behaviors/details_behavior.coffee b/app/assets/javascripts/behaviors/details_behavior.coffee
deleted file mode 100644
index decab3e1bed..00000000000
--- a/app/assets/javascripts/behaviors/details_behavior.coffee
+++ /dev/null
@@ -1,15 +0,0 @@
-$ ->
- $("body").on "click", ".js-details-target", ->
- container = $(@).closest(".js-details-container")
- container.toggleClass("open")
-
- # Show details content. Hides link after click.
- #
- # %div
- # %a.js-details-expand
- # %div.js-details-content
- #
- $("body").on "click", ".js-details-expand", (e) ->
- $(@).next('.js-details-content').removeClass("hide")
- $(@).hide()
- e.preventDefault()
diff --git a/app/assets/javascripts/behaviors/taskable.js.coffee b/app/assets/javascripts/behaviors/taskable.js.coffee
deleted file mode 100644
index ddce71c1886..00000000000
--- a/app/assets/javascripts/behaviors/taskable.js.coffee
+++ /dev/null
@@ -1,21 +0,0 @@
-window.updateTaskState = (taskableType) ->
- objType = taskableType.data
- isChecked = $(this).prop("checked")
- if $(this).is(":checked")
- stateEvent = "task_check"
- else
- stateEvent = "task_uncheck"
-
- taskableUrl = $("form.edit-" + objType).first().attr("action")
- taskableNum = taskableUrl.match(/\d+$/)
- taskNum = 0
- $("li.task-list-item input:checkbox").each( (index, e) =>
- if e == this
- taskNum = index + 1
- )
-
- $.ajax
- type: "PATCH"
- url: taskableUrl
- data: objType + "[state_event]=" + stateEvent +
- "&" + objType + "[task_num]=" + taskNum
diff --git a/app/assets/javascripts/behaviors/toggler_behavior.coffee b/app/assets/javascripts/behaviors/toggler_behavior.coffee
deleted file mode 100644
index 177b6918270..00000000000
--- a/app/assets/javascripts/behaviors/toggler_behavior.coffee
+++ /dev/null
@@ -1,14 +0,0 @@
-$ ->
- # Toggle button. Show/hide content inside parent container.
- # Button does not change visibility. If button has icon - it changes chevron style.
- #
- # %div.js-toggle-container
- # %a.js-toggle-button
- # %div.js-toggle-content
- #
- $("body").on "click", ".js-toggle-button", (e) ->
- $(@).find('i').
- toggleClass('fa fa-chevron-down').
- toggleClass('fa fa-chevron-up')
- $(@).closest(".js-toggle-container").find(".js-toggle-content").toggle()
- e.preventDefault()
diff --git a/app/assets/javascripts/blob/blob.js.coffee b/app/assets/javascripts/blob/blob.js.coffee
deleted file mode 100644
index 37a175fdbc7..00000000000
--- a/app/assets/javascripts/blob/blob.js.coffee
+++ /dev/null
@@ -1,73 +0,0 @@
-class @BlobView
- constructor: ->
- # handle multi-line select
- handleMultiSelect = (e) ->
- [ first_line, last_line ] = parseSelectedLines()
- [ line_number ] = parseSelectedLines($(this).attr("id"))
- hash = "L#{line_number}"
-
- if e.shiftKey and not isNaN(first_line) and not isNaN(line_number)
- if line_number < first_line
- last_line = first_line
- first_line = line_number
- else
- last_line = line_number
-
- hash = if first_line == last_line then "L#{first_line}" else "L#{first_line}-#{last_line}"
-
- setHash(hash)
- e.preventDefault()
-
- # See if there are lines selected
- # "#L12" and "#L34-56" supported
- highlightBlobLines = (e) ->
- [ first_line, last_line ] = parseSelectedLines()
-
- unless isNaN first_line
- $("#tree-content-holder .highlight .line").removeClass("hll")
- $("#LC#{line}").addClass("hll") for line in [first_line..last_line]
- $.scrollTo("#L#{first_line}", offset: -50) unless e?
-
- # parse selected lines from hash
- # always return first and last line (initialized to NaN)
- parseSelectedLines = (str) ->
- first_line = NaN
- last_line = NaN
- hash = str || window.location.hash
-
- if hash isnt ""
- matches = hash.match(/\#?L(\d+)(\-(\d+))?/)
- first_line = parseInt(matches?[1])
- last_line = parseInt(matches?[3])
- last_line = first_line if isNaN(last_line)
-
- [ first_line, last_line ]
-
- setHash = (hash) ->
- hash = hash.replace(/^\#/, "")
- nodes = $("#" + hash)
- # if any nodes are using this id, they must be temporarily changed
- # also, add a temporary div at the top of the screen to prevent scrolling
- if nodes.length > 0
- scroll_top = $(document).scrollTop()
- nodes.attr("id", "")
- tmp = $("<div></div>")
- .css({ position: "absolute", visibility: "hidden", top: scroll_top + "px" })
- .attr("id", hash)
- .appendTo(document.body)
-
- window.location.hash = hash
-
- # restore the nodes
- if nodes.length > 0
- tmp.remove()
- nodes.attr("id", hash)
-
- # initialize multi-line select
- $("#tree-content-holder .line-numbers a[id^=L]").on("click", handleMultiSelect)
-
- # Highlight the correct lines on load
- highlightBlobLines()
-
- # Highlight the correct lines when the hash part of the URL changes
- $(window).on("hashchange", highlightBlobLines)
diff --git a/app/assets/javascripts/blob/edit_blob.js.coffee b/app/assets/javascripts/blob/edit_blob.js.coffee
deleted file mode 100644
index 2e91a06daa8..00000000000
--- a/app/assets/javascripts/blob/edit_blob.js.coffee
+++ /dev/null
@@ -1,44 +0,0 @@
-class @EditBlob
- constructor: (assets_path, mode)->
- ace.config.set "modePath", assets_path + '/ace'
- ace.config.loadModule "ace/ext/searchbox"
- if mode
- ace_mode = mode
- editor = ace.edit("editor")
- editor.focus()
- @editor = editor
-
- if ace_mode
- editor.getSession().setMode "ace/mode/" + ace_mode
-
- disableButtonIfEmptyField "#commit_message", ".js-commit-button"
- $(".js-commit-button").click ->
- $("#file-content").val editor.getValue()
- $(".file-editor form").submit()
- return false
-
- editModePanes = $(".js-edit-mode-pane")
- editModeLinks = $(".js-edit-mode a")
- editModeLinks.click (event) ->
- event.preventDefault()
- currentLink = $(this)
- paneId = currentLink.attr("href")
- currentPane = editModePanes.filter(paneId)
- editModeLinks.parent().removeClass "active hover"
- currentLink.parent().addClass "active hover"
- editModePanes.hide()
- if paneId is "#preview"
- currentPane.fadeIn 200
- $.post currentLink.data("preview-url"),
- content: editor.getValue()
- , (response) ->
- currentPane.empty().append response
- return
-
- else
- currentPane.fadeIn 200
- editor.focus()
- return
-
- editor: ->
- return @editor
diff --git a/app/assets/javascripts/blob/new_blob.js.coffee b/app/assets/javascripts/blob/new_blob.js.coffee
deleted file mode 100644
index ab8f98715e8..00000000000
--- a/app/assets/javascripts/blob/new_blob.js.coffee
+++ /dev/null
@@ -1,21 +0,0 @@
-class @NewBlob
- constructor: (assets_path, mode)->
- ace.config.set "modePath", assets_path + '/ace'
- ace.config.loadModule "ace/ext/searchbox"
- if mode
- ace_mode = mode
- editor = ace.edit("editor")
- editor.focus()
- @editor = editor
-
- if ace_mode
- editor.getSession().setMode "ace/mode/" + ace_mode
-
- disableButtonIfEmptyField "#commit_message", ".js-commit-button"
- $(".js-commit-button").click ->
- $("#file-content").val editor.getValue()
- $(".file-editor form").submit()
- return false
-
- editor: ->
- return @editor
diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee
deleted file mode 100644
index 010a2b0e42b..00000000000
--- a/app/assets/javascripts/branch-graph.js.coffee
+++ /dev/null
@@ -1,340 +0,0 @@
-class @BranchGraph
- constructor: (@element, @options) ->
- @preparedCommits = {}
- @mtime = 0
- @mspace = 0
- @parents = {}
- @colors = ["#000"]
- @offsetX = 150
- @offsetY = 20
- @unitTime = 30
- @unitSpace = 10
- @prev_start = -1
- @load()
-
- load: ->
- $.ajax
- url: @options.url
- method: "get"
- dataType: "json"
- success: $.proxy((data) ->
- $(".loading", @element).hide()
- @prepareData data.days, data.commits
- @buildGraph()
- , this)
-
- prepareData: (@days, @commits) ->
- @collectParents()
- @graphHeight = $(@element).height()
- @graphWidth = $(@element).width()
- ch = Math.max(@graphHeight, @offsetY + @unitTime * @mtime + 150)
- cw = Math.max(@graphWidth, @offsetX + @unitSpace * @mspace + 300)
- @r = Raphael(@element.get(0), cw, ch)
- @top = @r.set()
- @barHeight = Math.max(@graphHeight, @unitTime * @days.length + 320)
-
- for c in @commits
- c.isParent = true if c.id of @parents
- @preparedCommits[c.id] = c
- @markCommit(c)
-
- @collectColors()
-
- collectParents: ->
- for c in @commits
- @mtime = Math.max(@mtime, c.time)
- @mspace = Math.max(@mspace, c.space)
- for p in c.parents
- @parents[p[0]] = true
- @mspace = Math.max(@mspace, p[1])
-
- collectColors: ->
- k = 0
- while k < @mspace
- @colors.push Raphael.getColor(.8)
- # Skipping a few colors in the spectrum to get more contrast between colors
- Raphael.getColor()
- Raphael.getColor()
- k++
-
- buildGraph: ->
- r = @r
- cuday = 0
- cumonth = ""
-
- r.rect(0, 0, 40, @barHeight).attr fill: "#222"
- r.rect(40, 0, 30, @barHeight).attr fill: "#444"
-
- for day, mm in @days
- if cuday isnt day[0]
- # Dates
- r.text(55, @offsetY + @unitTime * mm, day[0])
- .attr(
- font: "12px Monaco, monospace"
- fill: "#BBB"
- )
- cuday = day[0]
-
- if cumonth isnt day[1]
- # Months
- r.text(20, @offsetY + @unitTime * mm, day[1])
- .attr(
- font: "12px Monaco, monospace"
- fill: "#EEE"
- )
- cumonth = day[1]
-
- @renderPartialGraph()
-
- @bindEvents()
-
- renderPartialGraph: ->
- start = Math.floor((@element.scrollTop() - @offsetY) / @unitTime) - 10
- if start < 0
- isGraphEdge = true
- start = 0
- end = start + 40
- if @commits.length < end
- isGraphEdge = true
- end = @commits.length
-
- if @prev_start == -1 or Math.abs(@prev_start - start) > 10 or isGraphEdge
- i = start
-
- @prev_start = start
-
- while i < end
- commit = @commits[i]
- i += 1
-
- if commit.hasDrawn isnt true
- x = @offsetX + @unitSpace * (@mspace - commit.space)
- y = @offsetY + @unitTime * commit.time
-
- @drawDot(x, y, commit)
-
- @drawLines(x, y, commit)
-
- @appendLabel(x, y, commit)
-
- @appendAnchor(x, y, commit)
-
- commit.hasDrawn = true
-
- @top.toFront()
-
- bindEvents: ->
- element = @element
-
- $(element).scroll (event) =>
- @renderPartialGraph()
-
- scrollDown: =>
- @element.scrollTop @element.scrollTop() + 50
- @renderPartialGraph()
-
- scrollUp: =>
- @element.scrollTop @element.scrollTop() - 50
- @renderPartialGraph()
-
- scrollLeft: =>
- @element.scrollLeft @element.scrollLeft() - 50
- @renderPartialGraph()
-
- scrollRight: =>
- @element.scrollLeft @element.scrollLeft() + 50
- @renderPartialGraph()
-
- scrollBottom: =>
- @element.scrollTop @element.find('svg').height()
-
- scrollTop: =>
- @element.scrollTop 0
-
- appendLabel: (x, y, commit) ->
- return unless commit.refs
-
- r = @r
- shortrefs = commit.refs
- # Truncate if longer than 15 chars
- shortrefs = shortrefs.substr(0, 15) + "…" if shortrefs.length > 17
- text = r.text(x + 4, y, shortrefs).attr(
- "text-anchor": "start"
- font: "10px Monaco, monospace"
- fill: "#FFF"
- title: commit.refs
- )
- textbox = text.getBBox()
- # Create rectangle based on the size of the textbox
- rect = r.rect(x, y - 7, textbox.width + 5, textbox.height + 5, 4).attr(
- fill: "#000"
- "fill-opacity": .5
- stroke: "none"
- )
- triangle = r.path(["M", x - 5, y, "L", x - 15, y - 4, "L", x - 15, y + 4, "Z"]).attr(
- fill: "#000"
- "fill-opacity": .5
- stroke: "none"
- )
-
- label = r.set(rect, text)
- label.transform(["t", -rect.getBBox().width - 15, 0])
-
- # Set text to front
- text.toFront()
-
- appendAnchor: (x, y, commit) ->
- r = @r
- top = @top
- options = @options
- anchor = r.circle(x, y, 10).attr(
- fill: "#000"
- opacity: 0
- cursor: "pointer"
- ).click(->
- window.open options.commit_url.replace("%s", commit.id), "_blank"
- ).hover(->
- @tooltip = r.commitTooltip(x + 5, y, commit)
- top.push @tooltip.insertBefore(this)
- , ->
- @tooltip and @tooltip.remove() and delete @tooltip
- )
- top.push anchor
-
- drawDot: (x, y, commit) ->
- r = @r
- r.circle(x, y, 3).attr(
- fill: @colors[commit.space]
- stroke: "none"
- )
-
- avatar_box_x = @offsetX + @unitSpace * @mspace + 10
- avatar_box_y = y - 10
- r.rect(avatar_box_x, avatar_box_y, 20, 20).attr(
- stroke: @colors[commit.space]
- "stroke-width": 2
- )
- r.image(gon.relative_url_root + commit.author.icon, avatar_box_x, avatar_box_y, 20, 20)
- r.text(@offsetX + @unitSpace * @mspace + 35, y, commit.message.split("\n")[0]).attr(
- "text-anchor": "start"
- font: "14px Monaco, monospace"
- )
-
- drawLines: (x, y, commit) ->
- r = @r
- for parent, i in commit.parents
- parentCommit = @preparedCommits[parent[0]]
- parentY = @offsetY + @unitTime * parentCommit.time
- parentX1 = @offsetX + @unitSpace * (@mspace - parentCommit.space)
- parentX2 = @offsetX + @unitSpace * (@mspace - parent[1])
-
- # Set line color
- if parentCommit.space <= commit.space
- color = @colors[commit.space]
-
- else
- color = @colors[parentCommit.space]
-
- # Build line shape
- if parent[1] is commit.space
- offset = [0, 5]
- arrow = "l-2,5,4,0,-2,-5,0,5"
-
- else if parent[1] < commit.space
- offset = [3, 3]
- arrow = "l5,0,-2,4,-3,-4,4,2"
-
- else
- offset = [-3, 3]
- arrow = "l-5,0,2,4,3,-4,-4,2"
-
- # Start point
- route = ["M", x + offset[0], y + offset[1]]
-
- # Add arrow if not first parent
- if i > 0
- route.push(arrow)
-
- # Circumvent if overlap
- if commit.space isnt parentCommit.space or commit.space isnt parent[1]
- route.push(
- "L", parentX2, y + 10,
- "L", parentX2, parentY - 5,
- )
-
- # End point
- route.push("L", parentX1, parentY)
-
- r
- .path(route)
- .attr(
- stroke: color
- "stroke-width": 2)
-
- markCommit: (commit) ->
- if commit.id is @options.commit_id
- r = @r
- x = @offsetX + @unitSpace * (@mspace - commit.space)
- y = @offsetY + @unitTime * commit.time
- r.path(["M", x + 5, y, "L", x + 15, y + 4, "L", x + 15, y - 4, "Z"]).attr(
- fill: "#000"
- "fill-opacity": .5
- stroke: "none"
- )
- # Displayed in the center
- @element.scrollTop(y - @graphHeight / 2)
-
-Raphael::commitTooltip = (x, y, commit) ->
- boxWidth = 300
- boxHeight = 200
- icon = @image(gon.relative_url_root + commit.author.icon, x, y, 20, 20)
- nameText = @text(x + 25, y + 10, commit.author.name)
- idText = @text(x, y + 35, commit.id)
- messageText = @text(x, y + 50, commit.message)
- textSet = @set(icon, nameText, idText, messageText).attr(
- "text-anchor": "start"
- font: "12px Monaco, monospace"
- )
- nameText.attr(
- font: "14px Arial"
- "font-weight": "bold"
- )
-
- idText.attr fill: "#AAA"
- @textWrap messageText, boxWidth - 50
- rect = @rect(x - 10, y - 10, boxWidth, 100, 4).attr(
- fill: "#FFF"
- stroke: "#000"
- "stroke-linecap": "round"
- "stroke-width": 2
- )
- tooltip = @set(rect, textSet)
- rect.attr(
- height: tooltip.getBBox().height + 10
- width: tooltip.getBBox().width + 10
- )
-
- tooltip.transform ["t", 20, 20]
- tooltip
-
-Raphael::textWrap = (t, width) ->
- content = t.attr("text")
- abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- t.attr text: abc
- letterWidth = t.getBBox().width / abc.length
- t.attr text: content
- words = content.split(" ")
- x = 0
- s = []
-
- for word in words
- if x + (word.length * letterWidth) > width
- s.push "\n"
- x = 0
- x += word.length * letterWidth
- s.push word + " "
-
- t.attr text: s.join("")
- b = t.getBBox()
- h = Math.abs(b.y2) - Math.abs(b.y) + 1
- t.attr y: b.y + h
diff --git a/app/assets/javascripts/calendar.js.coffee b/app/assets/javascripts/calendar.js.coffee
deleted file mode 100644
index 44d75bd694f..00000000000
--- a/app/assets/javascripts/calendar.js.coffee
+++ /dev/null
@@ -1,38 +0,0 @@
-class @Calendar
- options =
- month: "short"
- day: "numeric"
- year: "numeric"
-
- constructor: (timestamps, starting_year, starting_month, calendar_activities_path) ->
- cal = new CalHeatMap()
- cal.init
- itemName: ["contribution"]
- data: timestamps
- start: new Date(starting_year, starting_month)
- domainLabelFormat: "%b"
- id: "cal-heatmap"
- domain: "month"
- subDomain: "day"
- range: 12
- tooltip: true
- label:
- position: "top"
- legend: [
- 0
- 10
- 20
- 30
- ]
- legendCellPadding: 3
- onClick: (date, count) ->
- formated_date = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate()
- $.ajax
- url: calendar_activities_path
- data:
- date: formated_date
- cache: false
- dataType: "html"
- success: (data) ->
- $(".user-calendar-activities").html data
-
diff --git a/app/assets/javascripts/commit.js.coffee b/app/assets/javascripts/commit.js.coffee
deleted file mode 100644
index 0566e239191..00000000000
--- a/app/assets/javascripts/commit.js.coffee
+++ /dev/null
@@ -1,4 +0,0 @@
-class @Commit
- constructor: ->
- $('.files .diff-file').each ->
- new CommitFile(this)
diff --git a/app/assets/javascripts/commit/file.js.coffee b/app/assets/javascripts/commit/file.js.coffee
deleted file mode 100644
index 83e793863b6..00000000000
--- a/app/assets/javascripts/commit/file.js.coffee
+++ /dev/null
@@ -1,5 +0,0 @@
-class @CommitFile
-
- constructor: (file) ->
- if $('.image', file).length
- new ImageFile(file)
diff --git a/app/assets/javascripts/commit/image-file.js.coffee b/app/assets/javascripts/commit/image-file.js.coffee
deleted file mode 100644
index 9e5f49b1f69..00000000000
--- a/app/assets/javascripts/commit/image-file.js.coffee
+++ /dev/null
@@ -1,126 +0,0 @@
-class @ImageFile
-
- # Width where images must fits in, for 2-up this gets divided by 2
- @availWidth = 900
- @viewModes = ['two-up', 'swipe']
-
- constructor: (@file) ->
- # Determine if old and new file has same dimensions, if not show 'two-up' view
- this.requestImageInfo $('.two-up.view .frame.deleted img', @file), (deletedWidth, deletedHeight) =>
- this.requestImageInfo $('.two-up.view .frame.added img', @file), (width, height) =>
- if width == deletedWidth && height == deletedHeight
- this.initViewModes()
- else
- this.initView('two-up')
-
- initViewModes: ->
- viewMode = ImageFile.viewModes[0]
-
- $('.view-modes', @file).removeClass 'hide'
- $('.view-modes-menu', @file).on 'click', 'li', (event) =>
- unless $(event.currentTarget).hasClass('active')
- this.activateViewMode(event.currentTarget.className)
-
- this.activateViewMode(viewMode)
-
- activateViewMode: (viewMode) ->
- $('.view-modes-menu li', @file)
- .removeClass('active')
- .filter(".#{viewMode}").addClass 'active'
- $(".view:visible:not(.#{viewMode})", @file).fadeOut 200, =>
- $(".view.#{viewMode}", @file).fadeIn(200)
- this.initView viewMode
-
- initView: (viewMode) ->
- this.views[viewMode].call(this)
-
- prepareFrames = (view) ->
- maxWidth = 0
- maxHeight = 0
- $('.frame', view).each (index, frame) =>
- width = $(frame).width()
- height = $(frame).height()
- maxWidth = if width > maxWidth then width else maxWidth
- maxHeight = if height > maxHeight then height else maxHeight
- .css
- width: maxWidth
- height: maxHeight
-
- [maxWidth, maxHeight]
-
- views:
- 'two-up': ->
- $('.two-up.view .wrap', @file).each (index, wrap) =>
- $('img', wrap).each ->
- currentWidth = $(this).width()
- if currentWidth > ImageFile.availWidth / 2
- $(this).width ImageFile.availWidth / 2
-
- this.requestImageInfo $('img', wrap), (width, height) ->
- $('.image-info .meta-width', wrap).text "#{width}px"
- $('.image-info .meta-height', wrap).text "#{height}px"
- $('.image-info', wrap).removeClass('hide')
-
- 'swipe': ->
- maxWidth = 0
- maxHeight = 0
-
- $('.swipe.view', @file).each (index, view) =>
-
- [maxWidth, maxHeight] = prepareFrames(view)
-
- $('.swipe-frame', view).css
- width: maxWidth + 16
- height: maxHeight + 28
-
- $('.swipe-wrap', view).css
- width: maxWidth + 1
- height: maxHeight + 2
-
- $('.swipe-bar', view).css
- left: 0
- .draggable
- axis: 'x'
- containment: 'parent'
- drag: (event) ->
- $('.swipe-wrap', view).width (maxWidth + 1) - $(this).position().left
- stop: (event) ->
- $('.swipe-wrap', view).width (maxWidth + 1) - $(this).position().left
-
- 'onion-skin': ->
- maxWidth = 0
- maxHeight = 0
-
- dragTrackWidth = $('.drag-track', @file).width() - $('.dragger', @file).width()
-
- $('.onion-skin.view', @file).each (index, view) =>
-
- [maxWidth, maxHeight] = prepareFrames(view)
-
- $('.onion-skin-frame', view).css
- width: maxWidth + 16
- height: maxHeight + 28
-
- $('.swipe-wrap', view).css
- width: maxWidth + 1
- height: maxHeight + 2
-
- $('.dragger', view).css
- left: dragTrackWidth
- .draggable
- axis: 'x'
- containment: 'parent'
- drag: (event) ->
- $('.frame.added', view).css('opacity', $(this).position().left / dragTrackWidth)
- stop: (event) ->
- $('.frame.added', view).css('opacity', $(this).position().left / dragTrackWidth)
-
-
-
- requestImageInfo: (img, callback) ->
- domImg = img.get(0)
- if domImg.complete
- callback.call(this, domImg.naturalWidth, domImg.naturalHeight)
- else
- img.on 'load', =>
- callback.call(this, domImg.naturalWidth, domImg.naturalHeight)
diff --git a/app/assets/javascripts/commits.js.coffee b/app/assets/javascripts/commits.js.coffee
deleted file mode 100644
index c183e78e513..00000000000
--- a/app/assets/javascripts/commits.js.coffee
+++ /dev/null
@@ -1,55 +0,0 @@
-class @CommitsList
- @data =
- ref: null
- limit: 0
- offset: 0
- @disable = false
-
- @showProgress: ->
- $('.loading').show()
-
- @hideProgress: ->
- $('.loading').hide()
-
- @init: (ref, limit) ->
- $("body").on "click", ".day-commits-table li.commit", (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
- success: (data) ->
- CommitsList.append(data.count, data.html)
- dataType: "json"
-
- @append: (count, html) ->
- $("#commits-list").append(html)
- if count > 0
- @data.offset += count
- else
- @disable = true
-
- @initLoadMore: ->
- $(document).unbind('scroll')
- $(document).endlessScroll
- bottomPixels: 400
- fireDelay: 1000
- fireOnce: true
- ceaseFire: =>
- @disable
- callback: =>
- this.getOld()
diff --git a/app/assets/javascripts/confirm_danger_modal.js.coffee b/app/assets/javascripts/confirm_danger_modal.js.coffee
deleted file mode 100644
index bb99edbd09e..00000000000
--- a/app/assets/javascripts/confirm_danger_modal.js.coffee
+++ /dev/null
@@ -1,18 +0,0 @@
-class @ConfirmDangerModal
- constructor: (form, text) ->
- @form = form
- $('.js-confirm-text').text(text || '')
- $('.js-confirm-danger-input').val('')
- $('#modal-confirm-danger').modal('show')
- project_path = $('.js-confirm-danger-match').text()
- submit = $('.js-confirm-danger-submit')
- submit.disable()
-
- $('.js-confirm-danger-input').on 'input', ->
- if rstrip($(@).val()) is project_path
- submit.enable()
- else
- submit.disable()
-
- $('.js-confirm-danger-submit').on 'click', =>
- @form.submit()
diff --git a/app/assets/javascripts/dashboard.js.coffee b/app/assets/javascripts/dashboard.js.coffee
deleted file mode 100644
index 00ee503ff16..00000000000
--- a/app/assets/javascripts/dashboard.js.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-class @Dashboard
- constructor: ->
- new ProjectsList()
diff --git a/app/assets/javascripts/diff.js.coffee b/app/assets/javascripts/diff.js.coffee
deleted file mode 100644
index 069f91c30e1..00000000000
--- a/app/assets/javascripts/diff.js.coffee
+++ /dev/null
@@ -1,44 +0,0 @@
-class @Diff
- UNFOLD_COUNT = 20
- constructor: ->
- $(document).off('click', '.js-unfold')
- $(document).on('click', '.js-unfold', (event) =>
- target = $(event.target)
- unfoldBottom = target.hasClass('js-unfold-bottom')
- unfold = true
-
- [old_line, line_number] = @lineNumbers(target.parent())
- offset = line_number - old_line
-
- if unfoldBottom
- line_number += 1
- since = line_number
- to = line_number + UNFOLD_COUNT
- else
- [prev_old_line, prev_new_line] = @lineNumbers(target.parent().prev())
- line_number -= 1
- to = line_number
- if line_number - UNFOLD_COUNT > prev_new_line + 1
- since = line_number - UNFOLD_COUNT
- else
- since = prev_new_line + 1
- unfold = false
-
- link = target.parents('.diff-file').attr('data-blob-diff-path')
- params =
- since: since
- to: to
- bottom: unfoldBottom
- offset: offset
- unfold: unfold
-
- $.get(link, params, (response) =>
- target.parent().replaceWith(response)
- )
- )
-
- lineNumbers: (line) ->
- return ([0, 0]) unless line.children().length
- lines = line.children().slice(0, 2)
- line_numbers = ($(l).attr('data-linenumber') for l in lines)
- (parseInt(line_number) for line_number in line_numbers)
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
deleted file mode 100644
index 330ebac6f75..00000000000
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ /dev/null
@@ -1,154 +0,0 @@
-$ ->
- new Dispatcher()
-
-class Dispatcher
- constructor: () ->
- @initSearch()
- @initPageScripts()
-
- initPageScripts: ->
- page = $('body').attr('data-page')
- project_id = $('body').attr('data-project-id')
-
- unless page
- return false
-
- path = page.split(':')
- shortcut_handler = null
-
- switch page
- when 'projects:issues:index'
- Issues.init()
- shortcut_handler = new ShortcutsNavigation()
- when 'projects:issues:show'
- new Issue()
- shortcut_handler = new ShortcutsIssueable()
- new ZenMode()
- when 'projects:milestones:show'
- new Milestone()
- when 'projects:milestones:new', 'projects:milestones:edit'
- new ZenMode()
- when 'projects:compare:show'
- new Diff()
- when 'projects:issues:new','projects:issues:edit'
- GitLab.GfmAutoComplete.setup()
- shortcut_handler = new ShortcutsNavigation()
- new ZenMode()
- new DropzoneInput($('.issue-form'))
- if page == 'projects:issues:new'
- new IssuableForm($('.issue-form'))
- when 'projects:merge_requests:new', 'projects:merge_requests:edit'
- GitLab.GfmAutoComplete.setup()
- new Diff()
- shortcut_handler = new ShortcutsNavigation()
- new ZenMode()
- new DropzoneInput($('.merge-request-form'))
- if page == 'projects:merge_requests:new'
- new IssuableForm($('.merge-request-form'))
- when 'projects:merge_requests:show'
- new Diff()
- shortcut_handler = new ShortcutsIssueable()
- new ZenMode()
- when "projects:merge_requests:diffs"
- new Diff()
- new ZenMode()
- when 'projects:merge_requests:index'
- shortcut_handler = new ShortcutsNavigation()
- MergeRequests.init()
- when 'dashboard:show'
- new Dashboard()
- new Activities()
- when 'dashboard:projects:starred'
- new Activities()
- new ProjectsList()
- when 'projects:commit:show'
- new Commit()
- new Diff()
- new ZenMode()
- shortcut_handler = new ShortcutsNavigation()
- when 'projects:commits:show'
- shortcut_handler = new ShortcutsNavigation()
- when 'projects:show'
- new Activities()
- shortcut_handler = new ShortcutsNavigation()
- when 'groups:show'
- new Activities()
- shortcut_handler = new ShortcutsNavigation()
- new ProjectsList()
- when 'groups:group_members:index'
- new GroupMembers()
- new UsersSelect()
- when 'projects:project_members:index'
- new ProjectMembers()
- new UsersSelect()
- when 'groups:new', 'groups:edit', 'admin:groups:edit'
- new GroupAvatar()
- when 'projects:tree:show'
- new TreeView()
- shortcut_handler = new ShortcutsNavigation()
- when 'projects:blob:show'
- new BlobView()
- shortcut_handler = new ShortcutsNavigation()
- when 'projects:labels:new', 'projects:labels:edit'
- new Labels()
- when 'projects:network:show'
- # Ensure we don't create a particular shortcut handler here. This is
- # already created, where the network graph is created.
- shortcut_handler = true
- when 'projects:forks:new'
- new ProjectFork()
- when 'users:show'
- new User()
- new Activities()
- when 'admin:users:show'
- new ProjectsList()
-
- switch path.first()
- when 'admin'
- new Admin()
- switch path[1]
- when 'groups'
- new UsersSelect()
- when 'projects'
- new NamespaceSelect()
- when 'dashboard'
- shortcut_handler = new ShortcutsDashboardNavigation()
- when 'profiles'
- new Profile()
- when 'projects'
- new Project()
- new ProjectAvatar()
- switch path[1]
- when 'compare'
- shortcut_handler = new ShortcutsNavigation()
- when 'edit'
- shortcut_handler = new ShortcutsNavigation()
- new ProjectNew()
- when 'new'
- new ProjectNew()
- when 'show'
- new ProjectShow()
- when 'issues', 'merge_requests'
- new UsersSelect()
- when 'wikis'
- new Wikis()
- shortcut_handler = new ShortcutsNavigation()
- new ZenMode()
- new DropzoneInput($('.wiki-form'))
- when 'snippets', 'labels', 'graphs'
- shortcut_handler = new ShortcutsNavigation()
- when 'project_members', 'deploy_keys', 'hooks', 'services', 'protected_branches'
- shortcut_handler = new ShortcutsNavigation()
-
-
- # If we haven't installed a custom shortcut handler, install the default one
- if not shortcut_handler
- new Shortcuts()
-
- initSearch: ->
- opts = $('.search-autocomplete-opts')
- path = opts.data('autocomplete-path')
- project_id = opts.data('autocomplete-project-id')
- project_ref = opts.data('autocomplete-project-ref')
-
- new SearchAutocomplete(path, project_id, project_ref)
diff --git a/app/assets/javascripts/dropzone_input.js.coffee b/app/assets/javascripts/dropzone_input.js.coffee
deleted file mode 100644
index fca2a290e2d..00000000000
--- a/app/assets/javascripts/dropzone_input.js.coffee
+++ /dev/null
@@ -1,243 +0,0 @@
-class @DropzoneInput
- constructor: (form) ->
- Dropzone.autoDiscover = false
- alertClass = "alert alert-danger alert-dismissable div-dropzone-alert"
- alertAttr = "class=\"close\" data-dismiss=\"alert\"" + "aria-hidden=\"true\""
- divHover = "<div class=\"div-dropzone-hover\"></div>"
- divSpinner = "<div class=\"div-dropzone-spinner\"></div>"
- divAlert = "<div class=\"" + alertClass + "\"></div>"
- iconPaperclip = "<i class=\"fa fa-paperclip div-dropzone-icon\"></i>"
- iconSpinner = "<i class=\"fa fa-spinner fa-spin div-dropzone-icon\"></i>"
- btnAlert = "<button type=\"button\"" + alertAttr + ">&times;</button>"
- project_uploads_path = window.project_uploads_path or null
- max_file_size = gon.max_file_size or 10
-
- form_textarea = $(form).find("textarea.markdown-area")
- form_textarea.wrap "<div class=\"div-dropzone\"></div>"
- form_textarea.bind 'paste', (event) =>
- handlePaste(event)
-
- form_dropzone = $(form).find('.div-dropzone')
- form_dropzone.parent().addClass "div-dropzone-wrapper"
- form_dropzone.append divHover
- $(".div-dropzone-hover").append iconPaperclip
- form_dropzone.append divSpinner
- $(".div-dropzone-spinner").append iconSpinner
- $(".div-dropzone-spinner").css
- "opacity": 0
- "display": "none"
-
- # Preview button
- $(document).off "click", ".js-md-preview-button"
- $(document).on "click", ".js-md-preview-button", (e) ->
- ###
- Shows the Markdown preview.
-
- Lets the server render GFM into Html and displays it.
- ###
- e.preventDefault()
- form = $(this).closest("form")
- # toggle tabs
- form.find(".js-md-write-button").parent().removeClass "active"
- form.find(".js-md-preview-button").parent().addClass "active"
-
- # toggle content
- form.find(".md-write-holder").hide()
- form.find(".md-preview-holder").show()
-
- preview = form.find(".js-md-preview")
- mdText = form.find(".markdown-area").val()
- if mdText.trim().length is 0
- preview.text "Nothing to preview."
- else
- preview.text "Loading..."
- $.post($(this).data("url"),
- md_text: mdText
- ).success (previewData) ->
- preview.html previewData
-
- # Write button
- $(document).off "click", ".js-md-write-button"
- $(document).on "click", ".js-md-write-button", (e) ->
- ###
- Shows the Markdown textarea.
- ###
- e.preventDefault()
- form = $(this).closest("form")
- # toggle tabs
- form.find(".js-md-write-button").parent().addClass "active"
- form.find(".js-md-preview-button").parent().removeClass "active"
-
- # toggle content
- form.find(".md-write-holder").show()
- form.find(".md-preview-holder").hide()
-
- dropzone = form_dropzone.dropzone(
- url: project_uploads_path
- dictDefaultMessage: ""
- clickable: true
- paramName: "file"
- maxFilesize: max_file_size
- uploadMultiple: false
- headers:
- "X-CSRF-Token": $("meta[name=\"csrf-token\"]").attr("content")
-
- previewContainer: false
-
- processing: ->
- $(".div-dropzone-alert").alert "close"
-
- dragover: ->
- form_textarea.addClass "div-dropzone-focus"
- form.find(".div-dropzone-hover").css "opacity", 0.7
- return
-
- dragleave: ->
- form_textarea.removeClass "div-dropzone-focus"
- form.find(".div-dropzone-hover").css "opacity", 0
- return
-
- drop: ->
- form_textarea.removeClass "div-dropzone-focus"
- form.find(".div-dropzone-hover").css "opacity", 0
- form_textarea.focus()
- return
-
- success: (header, response) ->
- child = $(dropzone[0]).children("textarea")
- $(child).val $(child).val() + formatLink(response.link) + "\n"
- return
-
- error: (temp, errorMessage) ->
- errorAlert = $(form).find('.error-alert')
- checkIfMsgExists = errorAlert.children().length
- if checkIfMsgExists is 0
- errorAlert.append divAlert
- $(".div-dropzone-alert").append btnAlert + errorMessage
- return
-
- sending: ->
- form_dropzone.find(".div-dropzone-spinner").css
- "opacity": 0.7
- "display": "inherit"
- return
-
- complete: ->
- $(".dz-preview").remove()
- $(".markdown-area").trigger "input"
- $(".div-dropzone-spinner").css
- "opacity": 0
- "display": "none"
- return
- )
-
- child = $(dropzone[0]).children("textarea")
-
- formatLink = (link) ->
- text = "[#{link.alt}](#{link.url})"
- text = "!#{text}" if link.is_image
- text
-
- handlePaste = (event) ->
- pasteEvent = event.originalEvent
- if pasteEvent.clipboardData and pasteEvent.clipboardData.items
- image = isImage(pasteEvent)
- if image
- event.preventDefault()
-
- filename = getFilename(pasteEvent) or "image.png"
- text = "{{" + filename + "}}"
- pasteText(text)
- uploadFile image.getAsFile(), filename
-
- isImage = (data) ->
- i = 0
- while i < data.clipboardData.items.length
- item = data.clipboardData.items[i]
- if item.type.indexOf("image") isnt -1
- return item
- i++
- return false
-
- pasteText = (text) ->
- caretStart = $(child)[0].selectionStart
- caretEnd = $(child)[0].selectionEnd
- textEnd = $(child).val().length
-
- beforeSelection = $(child).val().substring 0, caretStart
- afterSelection = $(child).val().substring caretEnd, textEnd
- $(child).val beforeSelection + text + afterSelection
- form_textarea.trigger "input"
-
- getFilename = (e) ->
- if window.clipboardData and window.clipboardData.getData
- value = window.clipboardData.getData("Text")
- else if e.clipboardData and e.clipboardData.getData
- value = e.clipboardData.getData("text/plain")
-
- value = value.split("\r")
- value.first()
-
- uploadFile = (item, filename) ->
- formData = new FormData()
- formData.append "file", item, filename
- $.ajax
- url: project_uploads_path
- type: "POST"
- data: formData
- dataType: "json"
- processData: false
- contentType: false
- headers:
- "X-CSRF-Token": $("meta[name=\"csrf-token\"]").attr("content")
-
- beforeSend: ->
- showSpinner()
- closeAlertMessage()
-
- success: (e, textStatus, response) ->
- insertToTextArea(filename, formatLink(response.responseJSON.link))
-
- error: (response) ->
- showError(response.responseJSON.message)
-
- complete: ->
- closeSpinner()
-
- insertToTextArea = (filename, url) ->
- $(child).val (index, val) ->
- val.replace("{{" + filename + "}}", url + "\n")
-
- appendToTextArea = (url) ->
- $(child).val (index, val) ->
- val + url + "\n"
-
- showSpinner = (e) ->
- form.find(".div-dropzone-spinner").css
- "opacity": 0.7
- "display": "inherit"
-
- closeSpinner = ->
- form.find(".div-dropzone-spinner").css
- "opacity": 0
- "display": "none"
-
- showError = (message) ->
- errorAlert = $(form).find('.error-alert')
- checkIfMsgExists = errorAlert.children().length
- if checkIfMsgExists is 0
- errorAlert.append divAlert
- $(".div-dropzone-alert").append btnAlert + message
-
- closeAlertMessage = ->
- form.find(".div-dropzone-alert").alert "close"
-
- form.find(".markdown-selector").click (e) ->
- e.preventDefault()
- $(@).closest('.gfm-form').find('.div-dropzone').click()
- return
-
- formatLink: (link) ->
- text = "[#{link.alt}](#{link.url})"
- text = "!#{text}" if link.is_image
- text
diff --git a/app/assets/javascripts/extensions/array.js b/app/assets/javascripts/extensions/array.js
deleted file mode 100644
index 24f9e00097c..00000000000
--- a/app/assets/javascripts/extensions/array.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Array.prototype.first = function() {
- return this[0];
-}
-
-Array.prototype.last = function() {
- return this[this.length-1];
-}
diff --git a/app/assets/javascripts/extensions/jquery.js.coffee b/app/assets/javascripts/extensions/jquery.js.coffee
deleted file mode 100644
index 40fb6cb9fc3..00000000000
--- a/app/assets/javascripts/extensions/jquery.js.coffee
+++ /dev/null
@@ -1,13 +0,0 @@
-$.fn.showAndHide = ->
- $(@).show().
- delay(3000).
- fadeOut()
-
-$.fn.enableButton = ->
- $(@).removeAttr('disabled').
- removeClass('disabled')
-
-$.fn.disableButton = ->
- $(@).attr('disabled', 'disabled').
- addClass('disabled')
-
diff --git a/app/assets/javascripts/flash.js.coffee b/app/assets/javascripts/flash.js.coffee
deleted file mode 100644
index b39ab0c4475..00000000000
--- a/app/assets/javascripts/flash.js.coffee
+++ /dev/null
@@ -1,12 +0,0 @@
-class @Flash
- constructor: (message, type)->
- flash = $(".flash-container")
- flash.html("")
-
- $('<div/>',
- class: "flash-#{type}",
- text: message
- ).appendTo(".flash-container")
-
- flash.click -> $(@).fadeOut()
- flash.show()
diff --git a/app/assets/javascripts/gfm_auto_complete.js.coffee b/app/assets/javascripts/gfm_auto_complete.js.coffee
deleted file mode 100644
index 00d56ae5b4b..00000000000
--- a/app/assets/javascripts/gfm_auto_complete.js.coffee
+++ /dev/null
@@ -1,67 +0,0 @@
-# Creates the variables for setting up GFM auto-completion
-
-window.GitLab ?= {}
-GitLab.GfmAutoComplete =
- # private_token: ''
- dataSource: ''
- # Emoji
- Emoji:
- template: '<li data-value="${insert}">${name} <img alt="${name}" height="20" src="${image}" width="20" /></li>'
-
- # Team Members
- Members:
- template: '<li data-value="${username}">${username} <small>${name}</small></li>'
-
- # Issues and MergeRequests
- Issues:
- template: '<li data-value="${id}"><small>${id}</small> ${title} </li>'
-
- # Add GFM auto-completion to all input fields, that accept GFM input.
- setup: ->
- input = $('.js-gfm-input')
-
- # Emoji
- input.atwho
- at: ':'
- tpl: @Emoji.template
- callbacks:
- before_save: (emojis) =>
- $.map emojis, (em) => name: em.name, insert: em.name+ ':', image: em.path
-
- # Team Members
- input.atwho
- at: '@'
- tpl: @Members.template
- search_key: 'search'
- callbacks:
- before_save: (members) =>
- $.map members, (m) => name: m.name, username: m.username, search: "#{m.username} #{m.name}"
-
- input.atwho
- at: '#'
- alias: 'issues'
- search_key: 'search'
- tpl: @Issues.template
- callbacks:
- before_save: (issues) ->
- $.map issues, (i) -> id: i.iid, title: sanitize(i.title), search: "#{i.iid} #{i.title}"
-
- input.atwho
- at: '!'
- alias: 'mergerequests'
- search_key: 'search'
- tpl: @Issues.template
- callbacks:
- before_save: (merges) ->
- $.map merges, (m) -> id: m.iid, title: sanitize(m.title), search: "#{m.iid} #{m.title}"
-
- input.one "focus", =>
- $.getJSON(@dataSource).done (data) ->
- # load members
- input.atwho 'load', "@", data.members
- # load issues
- input.atwho 'load', "issues", data.issues
- # load merge requests
- input.atwho 'load', "mergerequests", data.mergerequests
- # load emojis
- input.atwho 'load', ":", data.emojis
diff --git a/app/assets/javascripts/group_avatar.js.coffee b/app/assets/javascripts/group_avatar.js.coffee
deleted file mode 100644
index 0825fd3ce52..00000000000
--- a/app/assets/javascripts/group_avatar.js.coffee
+++ /dev/null
@@ -1,9 +0,0 @@
-class @GroupAvatar
- constructor: ->
- $('.js-choose-group-avatar-button').bind "click", ->
- form = $(this).closest("form")
- form.find(".js-group-avatar-input").click()
- $('.js-group-avatar-input').bind "change", ->
- form = $(this).closest("form")
- filename = $(this).val().replace(/^.*[\\\/]/, '')
- form.find(".js-avatar-filename").text(filename)
diff --git a/app/assets/javascripts/groups.js.coffee b/app/assets/javascripts/groups.js.coffee
deleted file mode 100644
index cc905e91ea2..00000000000
--- a/app/assets/javascripts/groups.js.coffee
+++ /dev/null
@@ -1,4 +0,0 @@
-class @GroupMembers
- constructor: ->
- $('li.group_member').bind 'ajax:success', ->
- $(this).fadeOut()
diff --git a/app/assets/javascripts/groups_select.js.coffee b/app/assets/javascripts/groups_select.js.coffee
deleted file mode 100644
index 1084e2a17d1..00000000000
--- a/app/assets/javascripts/groups_select.js.coffee
+++ /dev/null
@@ -1,41 +0,0 @@
-class @GroupsSelect
- constructor: ->
- $('.ajax-groups-select').each (i, select) =>
- skip_ldap = $(select).hasClass('skip_ldap')
-
- $(select).select2
- placeholder: "Search for a group"
- multiple: $(select).hasClass('multiselect')
- minimumInputLength: 0
- query: (query) ->
- Api.groups query.term, skip_ldap, (groups) ->
- data = { results: groups }
- query.callback(data)
-
- initSelection: (element, callback) ->
- id = $(element).val()
- if id isnt ""
- Api.group(id, callback)
-
-
- formatResult: (args...) =>
- @formatResult(args...)
- formatSelection: (args...) =>
- @formatSelection(args...)
- dropdownCssClass: "ajax-groups-dropdown"
- escapeMarkup: (m) -> # we do not want to escape markup since we are displaying html in results
- m
-
- formatResult: (group) ->
- if group.avatar_url
- avatar = group.avatar_url
- else
- avatar = gon.default_avatar_url
-
- "<div class='group-result'>
- <div class='group-name'>#{group.name}</div>
- <div class='group-path'>#{group.path}</div>
- </div>"
-
- formatSelection: (group) ->
- group.name
diff --git a/app/assets/javascripts/importer_status.js.coffee b/app/assets/javascripts/importer_status.js.coffee
deleted file mode 100644
index be8d225e73b..00000000000
--- a/app/assets/javascripts/importer_status.js.coffee
+++ /dev/null
@@ -1,35 +0,0 @@
-class @ImporterStatus
- constructor: (@jobs_url, @import_url) ->
- this.initStatusPage()
- this.setAutoUpdate()
-
- initStatusPage: ->
- $(".js-add-to-import").click (event) =>
- new_namespace = null
- tr = $(event.currentTarget).closest("tr")
- id = tr.attr("id").replace("repo_", "")
- if tr.find(".import-target input").length > 0
- new_namespace = tr.find(".import-target input").prop("value")
- tr.find(".import-target").empty().append(new_namespace + "/" + tr.find(".import-target").data("project_name"))
- $.post @import_url, {repo_id: id, new_namespace: new_namespace}, dataType: 'script'
-
- $(".js-import-all").click (event) =>
- $(".js-add-to-import").each ->
- $(this).click()
-
- setAutoUpdate: ->
- setInterval (=>
- $.get @jobs_url, (data) =>
- $.each data, (i, job) =>
- job_item = $("#project_" + job.id)
- status_field = job_item.find(".job-status")
-
- if job.import_status == 'finished'
- job_item.removeClass("active").addClass("success")
- status_field.html('<span><i class="fa fa-check"></i> done</span>')
- else if job.import_status == 'started'
- status_field.html("<i class='fa fa-spinner fa-spin'></i> started")
- else
- status_field.html(job.import_status)
-
- ), 4000
diff --git a/app/assets/javascripts/issuable_form.js.coffee b/app/assets/javascripts/issuable_form.js.coffee
deleted file mode 100644
index abd58bcf978..00000000000
--- a/app/assets/javascripts/issuable_form.js.coffee
+++ /dev/null
@@ -1,28 +0,0 @@
-class @IssuableForm
- constructor: (@form) ->
- @titleField = @form.find("input[name*='[title]']")
- @descriptionField = @form.find("textarea[name*='[description]']")
-
- return unless @titleField.length && @descriptionField.length
-
- @initAutosave()
-
- @form.on "submit", @resetAutosave
- @form.on "click", ".btn-cancel", @resetAutosave
-
- initAutosave: ->
- new Autosave @titleField, [
- document.location.pathname,
- document.location.search,
- "title"
- ]
-
- new Autosave @descriptionField, [
- document.location.pathname,
- document.location.search,
- "description"
- ]
-
- resetAutosave: =>
- @titleField.data("autosave").reset()
- @descriptionField.data("autosave").reset()
diff --git a/app/assets/javascripts/issue.js.coffee b/app/assets/javascripts/issue.js.coffee
deleted file mode 100644
index 4e2e6550eb2..00000000000
--- a/app/assets/javascripts/issue.js.coffee
+++ /dev/null
@@ -1,24 +0,0 @@
-class @Issue
- constructor: ->
- $('.edit-issue.inline-update input[type="submit"]').hide()
- $(".context .inline-update").on "change", "select", ->
- $(this).submit()
- $(".context .inline-update").on "change", "#issue_assignee_id", ->
- $(this).submit()
-
- if $("a.btn-close").length
- $("li.task-list-item input:checkbox").prop("disabled", false)
-
- $('.task-list-item input:checkbox').off('change')
- $('.task-list-item input:checkbox').change('issue', updateTaskState)
-
- $('.issue-details').waitForImages ->
- $('.issuable-affix').affix offset:
- top: ->
- @top = ($('.issuable-affix').offset().top - 70)
- bottom: ->
- @bottom = $('.footer').outerHeight(true)
- $('.issuable-affix').on 'affix.bs.affix', ->
- $(@).width($(@).outerWidth())
- .on 'affixed-top.bs.affix affixed-bottom.bs.affix', ->
- $(@).width('')
diff --git a/app/assets/javascripts/issues.js.coffee b/app/assets/javascripts/issues.js.coffee
deleted file mode 100644
index 40bb9e9cb0c..00000000000
--- a/app/assets/javascripts/issues.js.coffee
+++ /dev/null
@@ -1,85 +0,0 @@
-@Issues =
- init: ->
- Issues.initSearch()
- Issues.initSelects()
- Issues.initChecks()
-
- $("body").on "ajax:success", ".close_issue, .reopen_issue", ->
- t = $(this)
- totalIssues = undefined
- reopen = t.hasClass("reopen_issue")
- $(".issue_counter").each ->
- issue = $(this)
- totalIssues = parseInt($(this).html(), 10)
- if reopen and issue.closest(".main_menu").length
- $(this).html totalIssues + 1
- else
- $(this).html totalIssues - 1
- $("body").on "click", ".issues-other-filters .dropdown-menu a", ->
- $('.issues-list').block(
- message: null,
- overlayCSS:
- backgroundColor: '#DDD'
- opacity: .4
- )
-
- reload: ->
- Issues.initSelects()
- Issues.initChecks()
- $('#filter_issue_search').val($('#issue_search').val())
-
- initSelects: ->
- $("select#update_status").select2(width: 'resolve', dropdownAutoWidth: true)
- $("select#update_assignee_id").select2(width: 'resolve', dropdownAutoWidth: true)
- $("select#update_milestone_id").select2(width: 'resolve', dropdownAutoWidth: true)
- $("select#label_name").select2(width: 'resolve', dropdownAutoWidth: true)
- $("#milestone_id, #assignee_id, #label_name").on "change", ->
- $(this).closest("form").submit()
-
- initChecks: ->
- $(".check_all_issues").click ->
- $(".selected_issue").prop("checked", @checked)
- Issues.checkChanged()
-
- $(".selected_issue").bind "change", Issues.checkChanged
-
- # Make sure we trigger ajax request only after user stop typing
- initSearch: ->
- @timer = null
- $("#issue_search").keyup ->
- clearTimeout(@timer)
- @timer = setTimeout(Issues.filterResults, 500)
-
- filterResults: =>
- form = $("#issue_search_form")
- search = $("#issue_search").val()
- $('.issues-holder').css("opacity", '0.5')
- issues_url = form.attr('action') + '? '+ form.serialize()
-
- $.ajax
- type: "GET"
- url: form.attr('action')
- data: form.serialize()
- complete: ->
- $('.issues-holder').css("opacity", '1.0')
- success: (data) ->
- $('.issues-holder').html(data.html)
- # Change url so if user reload a page - search results are saved
- History.replaceState {page: issues_url}, document.title, issues_url
- Issues.reload()
- dataType: "json"
-
- checkChanged: ->
- checked_issues = $(".selected_issue:checked")
- if checked_issues.length > 0
- ids = []
- $.each checked_issues, (index, value) ->
- ids.push $(value).attr("data-id")
-
- $("#update_issues_ids").val ids
- $(".issues-other-filters").hide()
- $(".issues_bulk_update").show()
- else
- $("#update_issues_ids").val []
- $(".issues_bulk_update").hide()
- $(".issues-other-filters").show()
diff --git a/app/assets/javascripts/labels.js.coffee b/app/assets/javascripts/labels.js.coffee
deleted file mode 100644
index 1bc8840f9ac..00000000000
--- a/app/assets/javascripts/labels.js.coffee
+++ /dev/null
@@ -1,33 +0,0 @@
-class @Labels
- constructor: ->
- form = $('.label-form')
- @setupLabelForm(form)
- @cleanBinding()
- @addBinding()
- @updateColorPreview()
-
- addBinding: ->
- $(document).on 'click', '.suggest-colors a', @setSuggestedColor
- $(document).on 'input', 'input#label_color', @updateColorPreview
-
- cleanBinding: ->
- $(document).off 'click', '.suggest-colors a'
- $(document).off 'input', 'input#label_color'
-
- # Initializes the form to disable the save button if no color or title is entered
- setupLabelForm: (form) ->
- disableButtonIfAnyEmptyField form, '.form-control', form.find('.js-save-button')
-
- # Updates the the preview color with the hex-color input
- updateColorPreview: =>
- previewColor = $('input#label_color').val()
- $('div.label-color-preview').css('background-color', previewColor)
-
- # Updates the preview color with a click on a suggested color
- setSuggestedColor: (e) =>
- color = $(e.currentTarget).data('color')
- $('input#label_color').val(color)
- @updateColorPreview()
- # Notify the form, that color has changed
- $('.label-form').trigger('keyup')
- e.preventDefault()
diff --git a/app/assets/javascripts/lib/jquery.timeago.js b/app/assets/javascripts/lib/jquery.timeago.js
deleted file mode 100644
index cc17aa7d3d1..00000000000
--- a/app/assets/javascripts/lib/jquery.timeago.js
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * Timeago is a jQuery plugin that makes it easy to support automatically
- * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
- *
- * @name timeago
- * @version 1.1.0
- * @requires jQuery v1.2.3+
- * @author Ryan McGeary
- * @license MIT License - http://www.opensource.org/licenses/mit-license.php
- *
- * For usage and examples, visit:
- * http://timeago.yarp.com/
- *
- * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
- */
-
-(function (factory) {
- if (typeof define === 'function' && define.amd) {
- // AMD. Register as an anonymous module.
- define(['jquery'], factory);
- } else {
- // Browser globals
- factory(jQuery);
- }
-}(function ($) {
- $.timeago = function(timestamp) {
- if (timestamp instanceof Date) {
- return inWords(timestamp);
- } else if (typeof timestamp === "string") {
- return inWords($.timeago.parse(timestamp));
- } else if (typeof timestamp === "number") {
- return inWords(new Date(timestamp));
- } else {
- return inWords($.timeago.datetime(timestamp));
- }
- };
- var $t = $.timeago;
-
- $.extend($.timeago, {
- settings: {
- refreshMillis: 60000,
- allowFuture: false,
- strings: {
- prefixAgo: null,
- prefixFromNow: null,
- suffixAgo: "ago",
- suffixFromNow: "from now",
- seconds: "less than a minute",
- minute: "about a minute",
- minutes: "%d minutes",
- hour: "about an hour",
- hours: "about %d hours",
- day: "a day",
- days: "%d days",
- month: "about a month",
- months: "%d months",
- year: "about a year",
- years: "%d years",
- wordSeparator: " ",
- numbers: []
- }
- },
- inWords: function(distanceMillis) {
- var $l = this.settings.strings;
- var prefix = $l.prefixAgo;
- var suffix = $l.suffixAgo;
- if (this.settings.allowFuture) {
- if (distanceMillis < 0) {
- prefix = $l.prefixFromNow;
- suffix = $l.suffixFromNow;
- }
- }
-
- var seconds = Math.abs(distanceMillis) / 1000;
- var minutes = seconds / 60;
- var hours = minutes / 60;
- var days = hours / 24;
- var years = days / 365;
-
- function substitute(stringOrFunction, number) {
- var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
- var value = ($l.numbers && $l.numbers[number]) || number;
- return string.replace(/%d/i, value);
- }
-
- var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
- seconds < 90 && substitute($l.minute, 1) ||
- minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
- minutes < 90 && substitute($l.hour, 1) ||
- hours < 24 && substitute($l.hours, Math.round(hours)) ||
- hours < 42 && substitute($l.day, 1) ||
- days < 30 && substitute($l.days, Math.round(days)) ||
- days < 45 && substitute($l.month, 1) ||
- days < 365 && substitute($l.months, Math.round(days / 30)) ||
- years < 1.5 && substitute($l.year, 1) ||
- substitute($l.years, Math.round(years));
-
- var separator = $l.wordSeparator || "";
- if ($l.wordSeparator === undefined) { separator = " "; }
- return $.trim([prefix, words, suffix].join(separator));
- },
- parse: function(iso8601) {
- var s = $.trim(iso8601);
- s = s.replace(/\.\d+/,""); // remove milliseconds
- s = s.replace(/-/,"/").replace(/-/,"/");
- s = s.replace(/T/," ").replace(/Z/," UTC");
- s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
- return new Date(s);
- },
- datetime: function(elem) {
- var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
- return $t.parse(iso8601);
- },
- isTime: function(elem) {
- // jQuery's `is()` doesn't play well with HTML5 in IE
- return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
- }
- });
-
- // functions that can be called via $(el).timeago('action')
- // init is default when no action is given
- // functions are called with context of a single element
- var functions = {
- init: function(){
- var refresh_el = $.proxy(refresh, this);
- refresh_el();
- var $s = $t.settings;
- if ($s.refreshMillis > 0) {
- setInterval(refresh_el, $s.refreshMillis);
- }
- },
- update: function(time){
- $(this).data('timeago', { datetime: $t.parse(time) });
- refresh.apply(this);
- }
- };
-
- $.fn.timeago = function(action, options) {
- var fn = action ? functions[action] : functions.init;
- if(!fn){
- throw new Error("Unknown function name '"+ action +"' for timeago");
- }
- // each over objects here and call the requested function
- this.each(function(){
- fn.call(this, options);
- });
- return this;
- };
-
- function refresh() {
- var data = prepareData(this);
- if (!isNaN(data.datetime)) {
- $(this).text(inWords(data.datetime));
- }
- return this;
- }
-
- function prepareData(element) {
- element = $(element);
- if (!element.data("timeago")) {
- element.data("timeago", { datetime: $t.datetime(element) });
- var text = $.trim(element.text());
- if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
- element.attr("title", text);
- }
- }
- return element.data("timeago");
- }
-
- function inWords(date) {
- return $t.inWords(distance(date));
- }
-
- function distance(date) {
- return (new Date().getTime() - date.getTime());
- }
-
- // fix for IE6 suckage
- document.createElement("abbr");
- document.createElement("time");
-}));
diff --git a/app/assets/javascripts/lib/md5.js b/app/assets/javascripts/lib/md5.js
deleted file mode 100644
index b63716eaad2..00000000000
--- a/app/assets/javascripts/lib/md5.js
+++ /dev/null
@@ -1,211 +0,0 @@
-function md5 (str) {
- // http://kevin.vanzonneveld.net
- // + original by: Webtoolkit.info (http://www.webtoolkit.info/)
- // + namespaced by: Michael White (http://getsprink.com)
- // + tweaked by: Jack
- // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
- // + input by: Brett Zamir (http://brett-zamir.me)
- // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
- // - depends on: utf8_encode
- // * example 1: md5('Kevin van Zonneveld');
- // * returns 1: '6e658d4bfcb59cc13f96c14450ac40b9'
- var xl;
-
- var rotateLeft = function (lValue, iShiftBits) {
- return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
- };
-
- var addUnsigned = function (lX, lY) {
- var lX4, lY4, lX8, lY8, lResult;
- lX8 = (lX & 0x80000000);
- lY8 = (lY & 0x80000000);
- lX4 = (lX & 0x40000000);
- lY4 = (lY & 0x40000000);
- lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
- if (lX4 & lY4) {
- return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
- }
- if (lX4 | lY4) {
- if (lResult & 0x40000000) {
- return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
- } else {
- return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
- }
- } else {
- return (lResult ^ lX8 ^ lY8);
- }
- };
-
- var _F = function (x, y, z) {
- return (x & y) | ((~x) & z);
- };
- var _G = function (x, y, z) {
- return (x & z) | (y & (~z));
- };
- var _H = function (x, y, z) {
- return (x ^ y ^ z);
- };
- var _I = function (x, y, z) {
- return (y ^ (x | (~z)));
- };
-
- var _FF = function (a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(_F(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var _GG = function (a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(_G(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var _HH = function (a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(_H(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var _II = function (a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(_I(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var convertToWordArray = function (str) {
- var lWordCount;
- var lMessageLength = str.length;
- var lNumberOfWords_temp1 = lMessageLength + 8;
- var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
- var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
- var lWordArray = new Array(lNumberOfWords - 1);
- var lBytePosition = 0;
- var lByteCount = 0;
- while (lByteCount < lMessageLength) {
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
- lBytePosition = (lByteCount % 4) * 8;
- lWordArray[lWordCount] = (lWordArray[lWordCount] | (str.charCodeAt(lByteCount) << lBytePosition));
- lByteCount++;
- }
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
- lBytePosition = (lByteCount % 4) * 8;
- lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
- lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
- lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
- return lWordArray;
- };
-
- var wordToHex = function (lValue) {
- var wordToHexValue = "",
- wordToHexValue_temp = "",
- lByte, lCount;
- for (lCount = 0; lCount <= 3; lCount++) {
- lByte = (lValue >>> (lCount * 8)) & 255;
- wordToHexValue_temp = "0" + lByte.toString(16);
- wordToHexValue = wordToHexValue + wordToHexValue_temp.substr(wordToHexValue_temp.length - 2, 2);
- }
- return wordToHexValue;
- };
-
- var x = [],
- k, AA, BB, CC, DD, a, b, c, d, S11 = 7,
- S12 = 12,
- S13 = 17,
- S14 = 22,
- S21 = 5,
- S22 = 9,
- S23 = 14,
- S24 = 20,
- S31 = 4,
- S32 = 11,
- S33 = 16,
- S34 = 23,
- S41 = 6,
- S42 = 10,
- S43 = 15,
- S44 = 21;
-
- str = this.utf8_encode(str);
- x = convertToWordArray(str);
- a = 0x67452301;
- b = 0xEFCDAB89;
- c = 0x98BADCFE;
- d = 0x10325476;
-
- xl = x.length;
- for (k = 0; k < xl; k += 16) {
- AA = a;
- BB = b;
- CC = c;
- DD = d;
- a = _FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
- d = _FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
- c = _FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
- b = _FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
- a = _FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
- d = _FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
- c = _FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
- b = _FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
- a = _FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
- d = _FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
- c = _FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
- b = _FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
- a = _FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
- d = _FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
- c = _FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
- b = _FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
- a = _GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
- d = _GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
- c = _GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
- b = _GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
- a = _GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
- d = _GG(d, a, b, c, x[k + 10], S22, 0x2441453);
- c = _GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
- b = _GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
- a = _GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
- d = _GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
- c = _GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
- b = _GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
- a = _GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
- d = _GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
- c = _GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
- b = _GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
- a = _HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
- d = _HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
- c = _HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
- b = _HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
- a = _HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
- d = _HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
- c = _HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
- b = _HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
- a = _HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
- d = _HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
- c = _HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
- b = _HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
- a = _HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
- d = _HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
- c = _HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
- b = _HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
- a = _II(a, b, c, d, x[k + 0], S41, 0xF4292244);
- d = _II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
- c = _II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
- b = _II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
- a = _II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
- d = _II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
- c = _II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
- b = _II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
- a = _II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
- d = _II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
- c = _II(c, d, a, b, x[k + 6], S43, 0xA3014314);
- b = _II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
- a = _II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
- d = _II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
- c = _II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
- b = _II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
- a = addUnsigned(a, AA);
- b = addUnsigned(b, BB);
- c = addUnsigned(c, CC);
- d = addUnsigned(d, DD);
- }
-
- var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
-
- return temp.toLowerCase();
-}
diff --git a/app/assets/javascripts/lib/utf8_encode.js b/app/assets/javascripts/lib/utf8_encode.js
deleted file mode 100644
index 39ffe44dae0..00000000000
--- a/app/assets/javascripts/lib/utf8_encode.js
+++ /dev/null
@@ -1,70 +0,0 @@
-function utf8_encode (argString) {
- // http://kevin.vanzonneveld.net
- // + original by: Webtoolkit.info (http://www.webtoolkit.info/)
- // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
- // + improved by: sowberry
- // + tweaked by: Jack
- // + bugfixed by: Onno Marsman
- // + improved by: Yves Sucaet
- // + bugfixed by: Onno Marsman
- // + bugfixed by: Ulrich
- // + bugfixed by: Rafal Kukawski
- // + improved by: kirilloid
- // + bugfixed by: kirilloid
- // * example 1: utf8_encode('Kevin van Zonneveld');
- // * returns 1: 'Kevin van Zonneveld'
-
- if (argString === null || typeof argString === "undefined") {
- return "";
- }
-
- var string = (argString + ''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
- var utftext = '',
- start, end, stringl = 0;
-
- start = end = 0;
- stringl = string.length;
- for (var n = 0; n < stringl; n++) {
- var c1 = string.charCodeAt(n);
- var enc = null;
-
- if (c1 < 128) {
- end++;
- } else if (c1 > 127 && c1 < 2048) {
- enc = String.fromCharCode(
- (c1 >> 6) | 192,
- ( c1 & 63) | 128
- );
- } else if (c1 & 0xF800 != 0xD800) {
- enc = String.fromCharCode(
- (c1 >> 12) | 224,
- ((c1 >> 6) & 63) | 128,
- ( c1 & 63) | 128
- );
- } else { // surrogate pairs
- if (c1 & 0xFC00 != 0xD800) { throw new RangeError("Unmatched trail surrogate at " + n); }
- var c2 = string.charCodeAt(++n);
- if (c2 & 0xFC00 != 0xDC00) { throw new RangeError("Unmatched lead surrogate at " + (n-1)); }
- c1 = ((c1 & 0x3FF) << 10) + (c2 & 0x3FF) + 0x10000;
- enc = String.fromCharCode(
- (c1 >> 18) | 240,
- ((c1 >> 12) & 63) | 128,
- ((c1 >> 6) & 63) | 128,
- ( c1 & 63) | 128
- );
- }
- if (enc !== null) {
- if (end > start) {
- utftext += string.slice(start, end);
- }
- utftext += enc;
- start = end = n + 1;
- }
- }
-
- if (end > start) {
- utftext += string.slice(start, stringl);
- }
-
- return utftext;
-}
diff --git a/app/assets/javascripts/merge_request.js.coffee b/app/assets/javascripts/merge_request.js.coffee
deleted file mode 100644
index fc75f143836..00000000000
--- a/app/assets/javascripts/merge_request.js.coffee
+++ /dev/null
@@ -1,166 +0,0 @@
-class @MergeRequest
- constructor: (@opts) ->
- @initContextWidget()
- this.$el = $('.merge-request')
- @diffs_loaded = if @opts.action == 'diffs' then true else false
- @commits_loaded = false
-
- this.activateTab(@opts.action)
-
- this.bindEvents()
-
- this.initMergeWidget()
- this.$('.show-all-commits').on 'click', =>
- this.showAllCommits()
-
- modal = $('#modal_merge_info').modal(show: false)
-
- disableButtonIfEmptyField '#commit_message', '.accept_merge_request'
-
- if $("a.btn-close").length
- $("li.task-list-item input:checkbox").prop("disabled", false)
-
- $('.merge-request-details').waitForImages ->
- $('.issuable-affix').affix offset:
- top: ->
- @top = ($('.issuable-affix').offset().top - 70)
- bottom: ->
- @bottom = $('.footer').outerHeight(true)
- $('.issuable-affix').on 'affix.bs.affix', ->
- $(@).width($(@).outerWidth())
- .on 'affixed-top.bs.affix affixed-bottom.bs.affix', ->
- $(@).width('')
-
- # Local jQuery finder
- $: (selector) ->
- this.$el.find(selector)
-
- initContextWidget: ->
- $('.edit-merge_request.inline-update input[type="submit"]').hide()
- $(".context .inline-update").on "change", "select", ->
- $(this).submit()
- $(".context .inline-update").on "change", "#merge_request_assignee_id", ->
- $(this).submit()
-
- initMergeWidget: ->
- this.showState( @opts.current_status )
-
- if this.$('.automerge_widget').length and @opts.check_enable
- $.get @opts.url_to_automerge_check, (data) =>
- this.showState( data.merge_status )
- , 'json'
-
- if @opts.ci_enable
- $.get @opts.url_to_ci_check, (data) =>
- this.showCiState data.status
- if data.coverage
- this.showCiCoverage data.coverage
- , 'json'
-
- bindEvents: ->
- this.$('.merge-request-tabs').on 'click', 'a', (event) =>
- a = $(event.currentTarget)
-
- href = a.attr('href')
- History.replaceState {path: href}, document.title, href
-
- event.preventDefault()
-
- this.$('.merge-request-tabs').on 'click', 'li', (event) =>
- this.activateTab($(event.currentTarget).data('action'))
-
- this.$('.accept_merge_request').on 'click', ->
- $('.automerge_widget.can_be_merged').hide()
- $('.merge-in-progress').show()
-
- this.$('.remove_source_branch').on 'click', ->
- $('.remove_source_branch_widget').hide()
- $('.remove_source_branch_in_progress').show()
-
- this.$(".remove_source_branch").on "ajax:success", (e, data, status, xhr) ->
- location.reload()
-
- this.$(".remove_source_branch").on "ajax:error", (e, data, status, xhr) =>
- this.$('.remove_source_branch_widget').hide()
- this.$('.remove_source_branch_in_progress').hide()
- this.$('.remove_source_branch_widget.failed').show()
-
- $('.task-list-item input:checkbox').off('change')
- $('.task-list-item input:checkbox').change('merge_request', updateTaskState)
-
- activateTab: (action) ->
- this.$('.merge-request-tabs li').removeClass 'active'
- this.$('.tab-content').hide()
- switch action
- when 'diffs'
- this.$('.merge-request-tabs .diffs-tab').addClass 'active'
- this.loadDiff() unless @diffs_loaded
- this.$('.diffs').show()
- $(".diff-header").trigger("sticky_kit:recalc")
- when 'commits'
- this.$('.merge-request-tabs .commits-tab').addClass 'active'
- this.$('.commits').show()
- else
- this.$('.merge-request-tabs .notes-tab').addClass 'active'
- this.$('.notes').show()
-
- showState: (state) ->
- $('.automerge_widget').hide()
- $('.automerge_widget.' + state).show()
-
- showCiState: (state) ->
- $('.ci_widget').hide()
- allowed_states = ["failed", "canceled", "running", "pending", "success"]
- if state in allowed_states
- $('.ci_widget.ci-' + state).show()
- switch state
- when "failed", "canceled"
- @setMergeButtonClass('btn-danger')
- when "running", "pending"
- @setMergeButtonClass('btn-warning')
- else
- $('.ci_widget.ci-error').show()
- @setMergeButtonClass('btn-danger')
-
- showCiCoverage: (coverage) ->
- cov_html = $('<span>')
- cov_html.addClass('ci-coverage')
- cov_html.text('Coverage ' + coverage + '%')
- $('.ci_widget:visible').append(cov_html)
-
- loadDiff: (event) ->
- $.ajax
- type: 'GET'
- url: this.$('.merge-request-tabs .diffs-tab a').attr('href') + ".json"
- beforeSend: =>
- this.$('.mr-loading-status .loading').show()
- complete: =>
- @diffs_loaded = true
- this.$('.mr-loading-status .loading').hide()
- success: (data) =>
- this.$(".diffs").html(data.html)
- dataType: 'json'
-
- showAllCommits: ->
- this.$('.first-commits').remove()
- this.$('.all-commits').removeClass 'hide'
-
- alreadyOrCannotBeMerged: ->
- this.$('.automerge_widget').hide()
- this.$('.merge-in-progress').hide()
- this.$('.automerge_widget.already_cannot_be_merged').show()
-
- setMergeButtonClass: (css_class) ->
- $('.accept_merge_request').removeClass("btn-create").addClass(css_class)
-
- mergeInProgress: ->
- $.ajax
- type: 'GET'
- url: $('.merge-request').data('url')
- success: (data) =>
- switch data.state
- when 'merged'
- location.reload()
- else
- setTimeout(merge_request.mergeInProgress, 3000)
- dataType: 'json'
diff --git a/app/assets/javascripts/merge_requests.js.coffee b/app/assets/javascripts/merge_requests.js.coffee
deleted file mode 100644
index 83434c1b9ba..00000000000
--- a/app/assets/javascripts/merge_requests.js.coffee
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# * Filter merge requests
-#
-@MergeRequests =
- init: ->
- MergeRequests.initSearch()
-
- # Make sure we trigger ajax request only after user stop typing
- initSearch: ->
- @timer = null
- $("#issue_search").keyup ->
- clearTimeout(@timer)
- @timer = setTimeout(MergeRequests.filterResults, 500)
-
- filterResults: =>
- form = $("#issue_search_form")
- search = $("#issue_search").val()
- $('.merge-requests-holder').css("opacity", '0.5')
- issues_url = form.attr('action') + '? '+ form.serialize()
-
- $.ajax
- type: "GET"
- url: form.attr('action')
- data: form.serialize()
- complete: ->
- $('.merge-requests-holder').css("opacity", '1.0')
- success: (data) ->
- $('.merge-requests-holder').html(data.html)
- # Change url so if user reload a page - search results are saved
- History.replaceState {page: issues_url}, document.title, issues_url
- MergeRequests.reload()
- dataType: "json"
-
- reload: ->
- $('#filter_issue_search').val($('#issue_search').val())
diff --git a/app/assets/javascripts/milestone.js.coffee b/app/assets/javascripts/milestone.js.coffee
deleted file mode 100644
index d644d50b669..00000000000
--- a/app/assets/javascripts/milestone.js.coffee
+++ /dev/null
@@ -1,124 +0,0 @@
-class @Milestone
- @updateIssue: (li, issue_url, data) ->
- $.ajax
- type: "PUT"
- url: issue_url
- data: data
- success: (data) ->
- if data.saved == true
- if data.assignee_avatar_url
- img_tag = $('<img/>')
- img_tag.attr('src', data.assignee_avatar_url)
- img_tag.addClass('avatar s16')
- $(li).find('.assignee-icon').html(img_tag)
- else
- $(li).find('.assignee-icon').html('')
- $(li).effect 'highlight'
- else
- new Flash("Issue update failed", 'alert')
- dataType: "json"
-
- @sortIssues: (data) ->
- sort_issues_url = location.href + "/sort_issues"
-
- $.ajax
- type: "PUT"
- url: sort_issues_url
- data: data
- success: (data) ->
- if data.saved != true
- new Flash("Issues update failed", 'alert')
- dataType: "json"
-
- @sortMergeRequests: (data) ->
- sort_mr_url = location.href + "/sort_merge_requests"
-
- $.ajax
- type: "PUT"
- url: sort_mr_url
- data: data
- success: (data) ->
- if data.saved != true
- new Flash("MR update failed", 'alert')
- dataType: "json"
-
- @updateMergeRequest: (li, merge_request_url, data) ->
- $.ajax
- type: "PUT"
- url: merge_request_url
- data: data
- success: (data) ->
- if data.saved == true
- if data.assignee_avatar_url
- img_tag = $('<img/>')
- img_tag.attr('src', data.assignee_avatar_url)
- img_tag.addClass('avatar s16')
- $(li).find('.assignee-icon').html(img_tag)
- else
- $(li).find('.assignee-icon').html('')
- $(li).effect 'highlight'
- else
- new Flash("Issue update failed", 'alert')
- dataType: "json"
-
- constructor: ->
- @bindIssuesSorting()
- @bindMergeRequestSorting()
-
- bindIssuesSorting: ->
- $("#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed").sortable(
- connectWith: ".issues-sortable-list",
- dropOnEmpty: true,
- items: "li:not(.ui-sort-disabled)",
- update: (event, ui) ->
- data = $(this).sortable("serialize")
- Milestone.sortIssues(data)
-
- receive: (event, ui) ->
- new_state = $(this).data('state')
- issue_id = ui.item.data('iid')
- issue_url = ui.item.data('url')
-
- data = switch new_state
- when 'ongoing'
- "issue[assignee_id]=" + gon.current_user_id
- when 'unassigned'
- "issue[assignee_id]="
- when 'closed'
- "issue[state_event]=close"
-
- if $(ui.sender).data('state') == "closed"
- data += "&issue[state_event]=reopen"
-
- Milestone.updateIssue(ui.item, issue_url, data)
-
- ).disableSelection()
-
- bindMergeRequestSorting: ->
- $("#merge_requests-list-unassigned, #merge_requests-list-ongoing, #merge_requests-list-closed").sortable(
- connectWith: ".merge_requests-sortable-list",
- dropOnEmpty: true,
- items: "li:not(.ui-sort-disabled)",
- update: (event, ui) ->
- data = $(this).sortable("serialize")
- Milestone.sortMergeRequests(data)
-
- receive: (event, ui) ->
- new_state = $(this).data('state')
- merge_request_id = ui.item.data('iid')
- merge_request_url = ui.item.data('url')
-
- data = switch new_state
- when 'ongoing'
- "merge_request[assignee_id]=" + gon.current_user_id
- when 'unassigned'
- "merge_request[assignee_id]="
- when 'closed'
- "merge_request[state_event]=close"
-
- if $(ui.sender).data('state') == "closed"
- data += "&merge_request[state_event]=reopen"
-
- Milestone.updateMergeRequest(ui.item, merge_request_url, data)
-
- ).disableSelection()
diff --git a/app/assets/javascripts/namespace_select.js.coffee b/app/assets/javascripts/namespace_select.js.coffee
deleted file mode 100644
index a02c4515ccc..00000000000
--- a/app/assets/javascripts/namespace_select.js.coffee
+++ /dev/null
@@ -1,25 +0,0 @@
-class @NamespaceSelect
- constructor: ->
- namespaceFormatResult = (namespace) ->
- markup = "<div class='namespace-result'>"
- markup += "<span class='namespace-kind'>" + namespace.kind + "</span>"
- markup += "<span class='namespace-path'>" + namespace.path + "</span>"
- markup += "</div>"
- markup
-
- formatSelection = (namespace) ->
- namespace.kind + ": " + namespace.path
-
- $('.ajax-namespace-select').each (i, select) ->
- $(select).select2
- placeholder: "Search for namespace"
- multiple: $(select).hasClass('multiselect')
- minimumInputLength: 0
- query: (query) ->
- Api.namespaces query.term, (namespaces) ->
- data = { results: namespaces }
- query.callback(data)
-
- dropdownCssClass: "ajax-namespace-dropdown"
- formatResult: namespaceFormatResult
- formatSelection: formatSelection
diff --git a/app/assets/javascripts/network.js.coffee b/app/assets/javascripts/network.js.coffee
deleted file mode 100644
index f4ef07a50a7..00000000000
--- a/app/assets/javascripts/network.js.coffee
+++ /dev/null
@@ -1,9 +0,0 @@
-class @Network
- constructor: (opts) ->
- $("#filter_ref").click ->
- $(this).closest('form').submit()
-
- @branch_graph = new BranchGraph($(".network-graph"), opts)
-
- vph = $(window).height() - 250
- $('.network-graph').css 'height': (vph + 'px')
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
deleted file mode 100644
index 6dfe10f0006..00000000000
--- a/app/assets/javascripts/notes.js.coffee
+++ /dev/null
@@ -1,481 +0,0 @@
-class @Notes
- @interval: null
-
- constructor: (notes_url, note_ids, last_fetched_at) ->
- @notes_url = notes_url
- @notes_url = gon.relative_url_root + @notes_url if gon.relative_url_root?
- @note_ids = note_ids
- @last_fetched_at = last_fetched_at
- @noteable_url = document.URL
- @initRefresh()
- @setupMainTargetNoteForm()
- @cleanBinding()
- @addBinding()
-
- addBinding: ->
- # add note to UI after creation
- $(document).on "ajax:success", ".js-main-target-form", @addNote
- $(document).on "ajax:success", ".js-discussion-note-form", @addDiscussionNote
-
- # change note in UI after update
- $(document).on "ajax:success", "form.edit_note", @updateNote
-
- # Edit note link
- $(document).on "click", ".js-note-edit", @showEditForm
- $(document).on "click", ".note-edit-cancel", @cancelEdit
-
- # Reopen and close actions for Issue/MR combined with note form submit
- $(document).on "click", ".js-note-target-reopen", @targetReopen
- $(document).on "click", ".js-note-target-close", @targetClose
- $(document).on "click", ".js-comment-button", @updateCloseButton
- $(document).on "keyup", ".js-note-text", @updateTargetButtons
-
- # remove a note (in general)
- $(document).on "click", ".js-note-delete", @removeNote
-
- # delete note attachment
- $(document).on "click", ".js-note-attachment-delete", @removeAttachment
-
- # reset main target form after submit
- $(document).on "ajax:complete", ".js-main-target-form", @reenableTargetFormSubmitButton
- $(document).on "ajax:success", ".js-main-target-form", @resetMainTargetForm
-
- # update the file name when an attachment is selected
- $(document).on "change", ".js-note-attachment-input", @updateFormAttachment
-
- # reply to diff/discussion notes
- $(document).on "click", ".js-discussion-reply-button", @replyToDiscussionNote
-
- # add diff note
- $(document).on "click", ".js-add-diff-note-button", @addDiffNote
-
- # hide diff note form
- $(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm
-
- # fetch notes when tab becomes visible
- $(document).on "visibilitychange", @visibilityChange
-
- @notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea'
- # Chrome doesn't fire keypress or keyup for Command+Enter, so we need keydown.
- $(document).on('keydown', @notes_forms, (e) ->
- return if e.originalEvent.repeat
- if e.keyCode == 10 || ((e.metaKey || e.ctrlKey) && e.keyCode == 13)
- $(@).parents('form').submit()
- )
-
- cleanBinding: ->
- $(document).off "ajax:success", ".js-main-target-form"
- $(document).off "ajax:success", ".js-discussion-note-form"
- $(document).off "ajax:success", "form.edit_note"
- $(document).off "click", ".js-note-edit"
- $(document).off "click", ".note-edit-cancel"
- $(document).off "click", ".js-note-delete"
- $(document).off "click", ".js-note-attachment-delete"
- $(document).off "ajax:complete", ".js-main-target-form"
- $(document).off "ajax:success", ".js-main-target-form"
- $(document).off "click", ".js-discussion-reply-button"
- $(document).off "click", ".js-add-diff-note-button"
- $(document).off "visibilitychange"
- $(document).off "keydown", @notes_forms
- $(document).off "keyup", ".js-note-text"
- $(document).off "click", ".js-note-target-reopen"
- $(document).off "click", ".js-note-target-close"
-
- initRefresh: ->
- clearInterval(Notes.interval)
- Notes.interval = setInterval =>
- @refresh()
- , 15000
-
- refresh: ->
- unless document.hidden or (@noteable_url != document.URL)
- @getContent()
-
- getContent: ->
- $.ajax
- url: @notes_url
- data: "last_fetched_at=" + @last_fetched_at
- dataType: "json"
- success: (data) =>
- notes = data.notes
- @last_fetched_at = data.last_fetched_at
- $.each notes, (i, note) =>
- @renderNote(note)
-
-
- ###
- Render note in main comments area.
-
- Note: for rendering inline notes use renderDiscussionNote
- ###
- renderNote: (note) ->
- # render note if it not present in loaded list
- # or skip if rendered
- if @isNewNote(note)
- @note_ids.push(note.id)
- $('ul.main-notes-list').append(note.html)
-
- ###
- Check if note does not exists on page
- ###
- isNewNote: (note) ->
- $.inArray(note.id, @note_ids) == -1
-
-
- ###
- Render note in discussion area.
-
- Note: for rendering inline notes use renderDiscussionNote
- ###
- renderDiscussionNote: (note) ->
- @note_ids.push(note.id)
- form = $("form[rel='" + note.discussion_id + "']")
- row = form.closest("tr")
-
- # is this the first note of discussion?
- if row.is(".js-temp-notes-holder")
- # insert the note and the reply button after the temp row
- row.after note.discussion_html
-
- # remove the note (will be added again below)
- row.next().find(".note").remove()
-
- # Add note to 'Changes' page discussions
- $(".notes[rel='" + note.discussion_id + "']").append note.html
-
- # Init discussion on 'Discussion' page if it is merge request page
- if $('body').attr('data-page').indexOf('projects:merge_request') == 0
- $('ul.main-notes-list').append(note.discussion_with_diff_html)
- else
- # append new note to all matching discussions
- $(".notes[rel='" + note.discussion_id + "']").append note.html
-
- # cleanup after successfully creating a diff/discussion note
- @removeDiscussionNoteForm(form)
-
- ###
- Called in response the main target form has been successfully submitted.
-
- Removes any errors.
- Resets text and preview.
- Resets buttons.
- ###
- resetMainTargetForm: ->
- form = $(".js-main-target-form")
-
- # remove validation errors
- form.find(".js-errors").remove()
-
- # reset text and preview
- form.find(".js-md-write-button").click()
- form.find(".js-note-text").val("").trigger "input"
-
- form.find(".js-note-text").data("autosave").reset()
-
- reenableTargetFormSubmitButton: ->
- form = $(".js-main-target-form")
-
- form.find(".js-note-text").trigger "input"
-
- ###
- Shows the main form and does some setup on it.
-
- Sets some hidden fields in the form.
- ###
- setupMainTargetNoteForm: ->
-
- # find the form
- form = $(".js-new-note-form")
-
- # insert the form after the button
- form.clone().replaceAll $(".js-main-target-form")
- form = form.prev("form")
-
- # show the form
- @setupNoteForm(form)
-
- # fix classes
- form.removeClass "js-new-note-form"
- form.addClass "js-main-target-form"
-
- # remove unnecessary fields and buttons
- form.find("#note_line_code").remove()
- form.find(".js-close-discussion-note-form").remove()
-
- ###
- General note form setup.
-
- deactivates the submit button when text is empty
- hides the preview button when text is empty
- setup GFM auto complete
- show the form
- ###
- setupNoteForm: (form) ->
- disableButtonIfEmptyField form.find(".js-note-text"), form.find(".js-comment-button")
- form.removeClass "js-new-note-form"
- form.find('.div-dropzone').remove()
-
- # setup preview buttons
- form.find(".js-md-write-button, .js-md-preview-button").tooltip placement: "left"
- previewButton = form.find(".js-md-preview-button")
-
- textarea = form.find(".js-note-text")
-
- textarea.on "input", ->
- if $(this).val().trim() isnt ""
- previewButton.removeClass("turn-off").addClass "turn-on"
- else
- previewButton.removeClass("turn-on").addClass "turn-off"
-
- new Autosave textarea, [
- "Note"
- form.find("#note_commit_id").val()
- form.find("#note_line_code").val()
- form.find("#note_noteable_type").val()
- form.find("#note_noteable_id").val()
- ]
-
- # remove notify commit author checkbox for non-commit notes
- form.find(".js-notify-commit-author").remove() if form.find("#note_noteable_type").val() isnt "Commit"
- GitLab.GfmAutoComplete.setup()
- new DropzoneInput(form)
- form.show()
-
- ###
- Called in response to the new note form being submitted
-
- Adds new note to list.
- ###
- addNote: (xhr, note, status) =>
- @renderNote(note)
- @updateVotes()
-
- ###
- Called in response to the new note form being submitted
-
- Adds new note to list.
- ###
- addDiscussionNote: (xhr, note, status) =>
- @renderDiscussionNote(note)
-
- ###
- Called in response to the edit note form being submitted
-
- Updates the current note field.
- ###
- updateNote: (xhr, note, status) =>
- note_li = $(".note-row-" + note.id)
- note_li.replaceWith(note.html)
- note_li.find('.note-edit-form').hide()
- note_li.find('.note-body > .note-text').show()
-
- ###
- Called in response to clicking the edit note link
-
- Replaces the note text with the note edit form
- Adds a hidden div with the original content of the note to fill the edit note form with
- if the user cancels
- ###
- showEditForm: (e) ->
- e.preventDefault()
- note = $(this).closest(".note")
- note.find(".note-body > .note-text").hide()
- note.find(".note-header").hide()
- base_form = note.find(".note-edit-form")
- form = base_form.clone().insertAfter(base_form)
- form.addClass('current-note-edit-form')
- form.find('.div-dropzone').remove()
-
- # Show the attachment delete link
- note.find(".js-note-attachment-delete").show()
-
- # Setup markdown form
- GitLab.GfmAutoComplete.setup()
- new DropzoneInput(form)
-
- form.show()
- textarea = form.find("textarea")
- textarea.focus()
- disableButtonIfEmptyField textarea, form.find(".js-comment-button")
-
- ###
- Called in response to clicking the edit note link
-
- Hides edit form
- ###
- cancelEdit: (e) ->
- e.preventDefault()
- note = $(this).closest(".note")
- note.find(".note-body > .note-text").show()
- note.find(".note-header").show()
- note.find(".current-note-edit-form").remove()
-
- ###
- Called in response to deleting a note of any kind.
-
- Removes the actual note from view.
- Removes the whole discussion if the last note is being removed.
- ###
- removeNote: ->
- note = $(this).closest(".note")
- notes = note.closest(".notes")
-
- # check if this is the last note for this line
- if notes.find(".note").length is 1
-
- # for discussions
- notes.closest(".discussion").remove()
-
- # for diff lines
- notes.closest("tr").remove()
-
- note.remove()
-
- ###
- Called in response to clicking the delete attachment link
-
- Removes the attachment wrapper view, including image tag if it exists
- Resets the note editing form
- ###
- removeAttachment: ->
- note = $(this).closest(".note")
- note.find(".note-attachment").remove()
- note.find(".note-body > .note-text").show()
- note.find(".js-note-attachment-delete").hide()
- note.find(".note-edit-form").hide()
-
- ###
- Called when clicking on the "reply" button for a diff line.
-
- Shows the note form below the notes.
- ###
- replyToDiscussionNote: (e) =>
- form = $(".js-new-note-form")
- replyLink = $(e.target).closest(".js-discussion-reply-button")
- replyLink.hide()
-
- # insert the form after the button
- form.clone().insertAfter replyLink
-
- # show the form
- @setupDiscussionNoteForm(replyLink, replyLink.next("form"))
-
- ###
- Shows the diff or discussion form and does some setup on it.
-
- Sets some hidden fields in the form.
-
- Note: dataHolder must have the "discussionId", "lineCode", "noteableType"
- and "noteableId" data attributes set.
- ###
- setupDiscussionNoteForm: (dataHolder, form) =>
- # setup note target
- form.attr "rel", dataHolder.data("discussionId")
- form.find("#note_commit_id").val dataHolder.data("commitId")
- form.find("#note_line_code").val dataHolder.data("lineCode")
- form.find("#note_noteable_type").val dataHolder.data("noteableType")
- form.find("#note_noteable_id").val dataHolder.data("noteableId")
- @setupNoteForm form
- form.find(".js-note-text").focus()
- form.addClass "js-discussion-note-form"
-
- ###
- Called when clicking on the "add a comment" button on the side of a diff line.
-
- Inserts a temporary row for the form below the line.
- Sets up the form and shows it.
- ###
- addDiffNote: (e) =>
- e.preventDefault()
- link = e.currentTarget
- form = $(".js-new-note-form")
- row = $(link).closest("tr")
- nextRow = row.next()
-
- # does it already have notes?
- if nextRow.is(".notes_holder")
- replyButton = nextRow.find(".js-discussion-reply-button")
- if replyButton.length > 0
- $.proxy(@replyToDiscussionNote, replyButton).call()
- else
- # add a notes row and insert the form
- row.after "<tr class=\"notes_holder js-temp-notes-holder\"><td class=\"notes_line\" colspan=\"2\"></td><td class=\"notes_content\"></td></tr>"
- form.clone().appendTo row.next().find(".notes_content")
-
- # show the form
- @setupDiscussionNoteForm $(link), row.next().find("form")
-
- ###
- Called in response to "cancel" on a diff note form.
-
- Shows the reply button again.
- Removes the form and if necessary it's temporary row.
- ###
- removeDiscussionNoteForm: (form)->
- row = form.closest("tr")
-
- form.find(".js-note-text").data("autosave").reset()
-
- # show the reply button (will only work for replies)
- form.prev(".js-discussion-reply-button").show()
- if row.is(".js-temp-notes-holder")
- # remove temporary row for diff lines
- row.remove()
- else
- # only remove the form
- form.remove()
-
-
- cancelDiscussionForm: (e) =>
- e.preventDefault()
- form = $(".js-new-note-form")
- form = $(e.target).closest(".js-discussion-note-form")
- @removeDiscussionNoteForm(form)
-
- updateVotes: ->
- true
-
- ###
- Called after an attachment file has been selected.
-
- Updates the file name for the selected attachment.
- ###
- updateFormAttachment: ->
- form = $(this).closest("form")
-
- # get only the basename
- filename = $(this).val().replace(/^.*[\\\/]/, "")
- form.find(".js-attachment-filename").text filename
-
- ###
- Called when the tab visibility changes
- ###
- visibilityChange: =>
- @refresh()
-
- targetReopen: (e) =>
- @submitNoteForm($(e.target).parents('form'))
-
- targetClose: (e) =>
- @submitNoteForm($(e.target).parents('form'))
-
- submitNoteForm: (form) =>
- noteText = form.find(".js-note-text").val()
- if noteText.trim().length > 0
- form.submit()
-
- updateCloseButton: (e) =>
- textarea = $(e.target)
- form = textarea.parents('form')
- form.find('.js-note-target-close').text('Close')
-
- updateTargetButtons: (e) =>
- textarea = $(e.target)
- form = textarea.parents('form')
-
- if textarea.val().trim().length > 0
- form.find('.js-note-target-reopen').text('Comment & reopen')
- form.find('.js-note-target-close').text('Comment & close')
- else
- form.find('.js-note-target-reopen').text('Reopen')
- form.find('.js-note-target-close').text('Close')
diff --git a/app/assets/javascripts/pager.js.coffee b/app/assets/javascripts/pager.js.coffee
deleted file mode 100644
index fe83dc0410e..00000000000
--- a/app/assets/javascripts/pager.js.coffee
+++ /dev/null
@@ -1,42 +0,0 @@
-@Pager =
- init: (@limit = 0, preload, @disable = false) ->
- @loading = $(".loading")
- if preload
- @offset = 0
- @getOld()
- else
- @offset = @limit
- @initLoadMore()
-
- getOld: ->
- @loading.show()
- $.ajax
- type: "GET"
- url: location.href
- data: "limit=" + @limit + "&offset=" + @offset
- complete: =>
- @loading.hide()
- success: (data) ->
- Pager.append(data.count, data.html)
- dataType: "json"
-
- append: (count, html) ->
- $(".content_list").append html
- if count > 0
- @offset += count
- else
- @disable = true
-
- initLoadMore: ->
- $(document).unbind('scroll')
- $(document).endlessScroll
- bottomPixels: 400
- fireDelay: 1000
- fireOnce: true
- ceaseFire: ->
- Pager.disable
-
- callback: (i) =>
- unless @loading.is(':visible')
- @loading.show()
- Pager.getOld()
diff --git a/app/assets/javascripts/profile.js.coffee b/app/assets/javascripts/profile.js.coffee
deleted file mode 100644
index de356fbec77..00000000000
--- a/app/assets/javascripts/profile.js.coffee
+++ /dev/null
@@ -1,29 +0,0 @@
-class @Profile
- constructor: ->
- $('.edit_user .application-theme input, .edit_user .code-preview-theme input').click ->
- # Submit the form
- $('.edit_user').submit()
-
- new Flash("Appearance settings saved", "notice")
-
- $('.update-username form').on 'ajax:before', ->
- $('.loading-gif').show()
- $(this).find('.update-success').hide()
- $(this).find('.update-failed').hide()
-
- $('.update-username form').on 'ajax:complete', ->
- $(this).find('.btn-save').enableButton()
- $(this).find('.loading-gif').hide()
-
- $('.update-notifications').on 'ajax:complete', ->
- $(this).find('.btn-save').enableButton()
-
-
- $('.js-choose-user-avatar-button').bind "click", ->
- form = $(this).closest("form")
- form.find(".js-user-avatar-input").click()
-
- $('.js-user-avatar-input').bind "change", ->
- form = $(this).closest("form")
- filename = $(this).val().replace(/^.*[\\\/]/, '')
- form.find(".js-avatar-filename").text(filename)
diff --git a/app/assets/javascripts/project.js.coffee b/app/assets/javascripts/project.js.coffee
deleted file mode 100644
index eb8c1fa1426..00000000000
--- a/app/assets/javascripts/project.js.coffee
+++ /dev/null
@@ -1,26 +0,0 @@
-class @Project
- constructor: ->
- # Git clone panel switcher
- scope = $ '.git-clone-holder'
- if scope.length > 0
- $('a, button', scope).click ->
- $('a, button', scope).removeClass 'active'
- $(@).addClass 'active'
- $('#project_clone', scope).val $(@).data 'clone'
- $(".clone").text("").append $(@).data 'clone'
-
- # Ref switcher
- $('.project-refs-select').on 'change', ->
- $(@).parents('form').submit()
-
- $('.hide-no-ssh-message').on 'click', (e) ->
- path = '/'
- $.cookie('hide_no_ssh_message', 'false', { path: path })
- $(@).parents('.no-ssh-key-message').remove()
- e.preventDefault()
-
- $('.hide-no-password-message').on 'click', (e) ->
- path = '/'
- $.cookie('hide_no_password_message', 'false', { path: path })
- $(@).parents('.no-password-message').remove()
- e.preventDefault()
diff --git a/app/assets/javascripts/project_avatar.js.coffee b/app/assets/javascripts/project_avatar.js.coffee
deleted file mode 100644
index 8bec6e2ccca..00000000000
--- a/app/assets/javascripts/project_avatar.js.coffee
+++ /dev/null
@@ -1,9 +0,0 @@
-class @ProjectAvatar
- constructor: ->
- $('.js-choose-project-avatar-button').bind 'click', ->
- form = $(this).closest('form')
- form.find('.js-project-avatar-input').click()
- $('.js-project-avatar-input').bind 'change', ->
- form = $(this).closest('form')
- filename = $(this).val().replace(/^.*[\\\/]/, '')
- form.find('.js-avatar-filename').text(filename)
diff --git a/app/assets/javascripts/project_fork.js.coffee b/app/assets/javascripts/project_fork.js.coffee
deleted file mode 100644
index e15a1c4ef76..00000000000
--- a/app/assets/javascripts/project_fork.js.coffee
+++ /dev/null
@@ -1,5 +0,0 @@
-class @ProjectFork
- constructor: ->
- $('.fork-thumbnail a').on 'click', ->
- $('.fork-namespaces').hide()
- $('.save-project-loader').show()
diff --git a/app/assets/javascripts/project_import.js.coffee b/app/assets/javascripts/project_import.js.coffee
deleted file mode 100644
index 6633564a079..00000000000
--- a/app/assets/javascripts/project_import.js.coffee
+++ /dev/null
@@ -1,5 +0,0 @@
-class @ProjectImport
- constructor: ->
- setTimeout ->
- Turbolinks.visit(location.href)
- , 5000
diff --git a/app/assets/javascripts/project_members.js.coffee b/app/assets/javascripts/project_members.js.coffee
deleted file mode 100644
index 896ba7e53ee..00000000000
--- a/app/assets/javascripts/project_members.js.coffee
+++ /dev/null
@@ -1,4 +0,0 @@
-class @ProjectMembers
- constructor: ->
- $('li.project_member').bind 'ajax:success', ->
- $(this).fadeOut()
diff --git a/app/assets/javascripts/project_new.js.coffee b/app/assets/javascripts/project_new.js.coffee
deleted file mode 100644
index 836269c44f9..00000000000
--- a/app/assets/javascripts/project_new.js.coffee
+++ /dev/null
@@ -1,11 +0,0 @@
-class @ProjectNew
- constructor: ->
- $('.project-edit-container').on 'ajax:before', =>
- $('.project-edit-container').hide()
- $('.save-project-loader').show()
-
- @initEvents()
-
-
- initEvents: ->
- disableButtonIfEmptyField '#project_name', '.project-submit'
diff --git a/app/assets/javascripts/project_show.js.coffee b/app/assets/javascripts/project_show.js.coffee
deleted file mode 100644
index 6828ae471e5..00000000000
--- a/app/assets/javascripts/project_show.js.coffee
+++ /dev/null
@@ -1,15 +0,0 @@
-class @ProjectShow
- constructor: ->
- $('.project-home-panel .star').on 'ajax:success', (e, data, status, xhr) ->
- $(@).toggleClass('on').find('.count').html(data.star_count)
- .on 'ajax:error', (e, xhr, status, error) ->
- new Flash('Star toggle failed. Try again later.', 'alert')
-
- $("a[data-toggle='tab']").on "shown.bs.tab", (e) ->
- $.cookie "default_view", $(e.target).attr("href"), { expires: 30, path: '/' }
-
- defaultView = $.cookie("default_view")
- if defaultView
- $("a[href=" + defaultView + "]").tab "show"
- else
- $("a[data-toggle='tab']:first").tab "show"
diff --git a/app/assets/javascripts/projects_list.js.coffee b/app/assets/javascripts/projects_list.js.coffee
deleted file mode 100644
index c0e36d1ccc5..00000000000
--- a/app/assets/javascripts/projects_list.js.coffee
+++ /dev/null
@@ -1,24 +0,0 @@
-class @ProjectsList
- constructor: ->
- $(".projects-list .js-expand").on 'click', (e) ->
- e.preventDefault()
- list = $(this).closest('.projects-list')
- list.find("li").show()
- list.find("li.bottom").hide()
-
- $(".projects-list-filter").keyup ->
- terms = $(this).val()
- uiBox = $(this).closest('.panel')
- if terms == "" || terms == undefined
- uiBox.find(".projects-list li").show()
- else
- uiBox.find(".projects-list li").each (index) ->
- name = $(this).find(".filter-title").text()
-
- if name.toLowerCase().search(terms.toLowerCase()) == -1
- $(this).hide()
- else
- $(this).show()
- uiBox.find(".projects-list li.bottom").hide()
-
-
diff --git a/app/assets/javascripts/protected_branches.js.coffee b/app/assets/javascripts/protected_branches.js.coffee
deleted file mode 100644
index 5753c9d4e72..00000000000
--- a/app/assets/javascripts/protected_branches.js.coffee
+++ /dev/null
@@ -1,21 +0,0 @@
-$ ->
- $(".protected-branches-list :checkbox").change (e) ->
- name = $(this).attr("name")
- if name == "developers_can_push"
- id = $(this).val()
- checked = $(this).is(":checked")
- url = $(this).data("url")
- $.ajax
- type: "PUT"
- url: url
- dataType: "json"
- data:
- id: id
- developers_can_push: checked
-
- success: ->
- row = $(e.target)
- row.closest('tr').effect('highlight')
-
- error: ->
- new Flash("Failed to update branch!", "alert")
diff --git a/app/assets/javascripts/search_autocomplete.js.coffee b/app/assets/javascripts/search_autocomplete.js.coffee
deleted file mode 100644
index c1801365266..00000000000
--- a/app/assets/javascripts/search_autocomplete.js.coffee
+++ /dev/null
@@ -1,11 +0,0 @@
-class @SearchAutocomplete
- constructor: (search_autocomplete_path, project_id, project_ref) ->
- project_id = '' unless project_id
- project_ref = '' unless project_ref
- query = "?project_id=" + project_id + "&project_ref=" + project_ref
-
- $("#search").autocomplete
- source: search_autocomplete_path + query
- minLength: 1
- select: (event, ui) ->
- location.href = ui.item.url
diff --git a/app/assets/javascripts/shortcuts.js.coffee b/app/assets/javascripts/shortcuts.js.coffee
deleted file mode 100644
index e9aeb1e9525..00000000000
--- a/app/assets/javascripts/shortcuts.js.coffee
+++ /dev/null
@@ -1,30 +0,0 @@
-class @Shortcuts
- constructor: ->
- @enabledHelp = []
- Mousetrap.reset()
- Mousetrap.bind('?', @selectiveHelp)
- Mousetrap.bind('s', Shortcuts.focusSearch)
-
- selectiveHelp: (e) =>
- Shortcuts.showHelp(e, @enabledHelp)
-
- @showHelp: (e, location) ->
- if $('#modal-shortcuts').length > 0
- $('#modal-shortcuts').modal('show')
- else
- $.ajax(
- url: '/help/shortcuts',
- dataType: 'script',
- success: (e) ->
- if location and location.length > 0
- for l in location
- $(l).show()
- else
- $('.hidden-shortcut').show()
- $('.js-more-help-button').remove()
- )
- e.preventDefault()
-
- @focusSearch: (e) ->
- $('#search').focus()
- e.preventDefault()
diff --git a/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee b/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee
deleted file mode 100644
index 4a05bdccdb3..00000000000
--- a/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee
+++ /dev/null
@@ -1,14 +0,0 @@
-#= require shortcuts
-
-class @ShortcutsDashboardNavigation extends Shortcuts
- constructor: ->
- super()
- Mousetrap.bind('g a', -> ShortcutsDashboardNavigation.findAndFollowLink('.shortcuts-activity'))
- Mousetrap.bind('g i', -> ShortcutsDashboardNavigation.findAndFollowLink('.shortcuts-issues'))
- Mousetrap.bind('g m', -> ShortcutsDashboardNavigation.findAndFollowLink('.shortcuts-merge_requests'))
- Mousetrap.bind('g p', -> ShortcutsDashboardNavigation.findAndFollowLink('.shortcuts-projects'))
-
- @findAndFollowLink: (selector) ->
- link = $(selector).attr('href')
- if link
- window.location = link
diff --git a/app/assets/javascripts/shortcuts_issueable.coffee b/app/assets/javascripts/shortcuts_issueable.coffee
deleted file mode 100644
index b8dae71e037..00000000000
--- a/app/assets/javascripts/shortcuts_issueable.coffee
+++ /dev/null
@@ -1,19 +0,0 @@
-#= require shortcuts_navigation
-
-class @ShortcutsIssueable extends ShortcutsNavigation
- constructor: (isMergeRequest) ->
- super()
- Mousetrap.bind('a', ->
- $('.js-assignee').select2('open')
- return false
- )
- Mousetrap.bind('m', ->
- $('.js-milestone').select2('open')
- return false
- )
-
- if isMergeRequest
- @enabledHelp.push('.hidden-shortcut.merge_reuests')
- else
- @enabledHelp.push('.hidden-shortcut.issues')
-
diff --git a/app/assets/javascripts/shortcuts_navigation.coffee b/app/assets/javascripts/shortcuts_navigation.coffee
deleted file mode 100644
index 31895fbf2bc..00000000000
--- a/app/assets/javascripts/shortcuts_navigation.coffee
+++ /dev/null
@@ -1,20 +0,0 @@
-#= require shortcuts
-
-class @ShortcutsNavigation extends Shortcuts
- constructor: ->
- super()
- Mousetrap.bind('g p', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-project'))
- Mousetrap.bind('g f', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-tree'))
- Mousetrap.bind('g c', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-commits'))
- Mousetrap.bind('g n', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-network'))
- Mousetrap.bind('g g', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-graphs'))
- Mousetrap.bind('g i', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-issues'))
- Mousetrap.bind('g m', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-merge_requests'))
- Mousetrap.bind('g w', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-wiki'))
- Mousetrap.bind('g s', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-snippets'))
- @enabledHelp.push('.hidden-shortcut.project')
-
- @findAndFollowLink: (selector) ->
- link = $(selector).attr('href')
- if link
- window.location = link
diff --git a/app/assets/javascripts/shortcuts_network.js.coffee b/app/assets/javascripts/shortcuts_network.js.coffee
deleted file mode 100644
index cc95ad7ebfe..00000000000
--- a/app/assets/javascripts/shortcuts_network.js.coffee
+++ /dev/null
@@ -1,12 +0,0 @@
-#= require shortcuts_navigation
-
-class @ShortcutsNetwork extends ShortcutsNavigation
- constructor: (@graph) ->
- super()
- Mousetrap.bind(['left', 'h'], @graph.scrollLeft)
- Mousetrap.bind(['right', 'l'], @graph.scrollRight)
- Mousetrap.bind(['up', 'k'], @graph.scrollUp)
- Mousetrap.bind(['down', 'j'], @graph.scrollDown)
- Mousetrap.bind(['shift+up', 'shift+k'], @graph.scrollTop)
- Mousetrap.bind(['shift+down', 'shift+j'], @graph.scrollBottom)
- @enabledHelp.push('.hidden-shortcut.network')
diff --git a/app/assets/javascripts/sidebar.js.coffee b/app/assets/javascripts/sidebar.js.coffee
deleted file mode 100644
index 2e3f5608257..00000000000
--- a/app/assets/javascripts/sidebar.js.coffee
+++ /dev/null
@@ -1,9 +0,0 @@
-$(document).on("click", '.toggle-nav-collapse', (e) ->
- e.preventDefault()
- collapsed = 'page-sidebar-collapsed'
- expanded = 'page-sidebar-expanded'
-
- $('.page-with-sidebar').toggleClass("#{collapsed} #{expanded}")
- $('.toggle-nav-collapse i').toggleClass("fa-angle-right fa-angle-left")
- $.cookie("collapsed_nav", $('.page-with-sidebar').hasClass(collapsed), { path: '/' })
-)
diff --git a/app/assets/javascripts/stat_graph.js.coffee b/app/assets/javascripts/stat_graph.js.coffee
deleted file mode 100644
index f36c71fd25e..00000000000
--- a/app/assets/javascripts/stat_graph.js.coffee
+++ /dev/null
@@ -1,6 +0,0 @@
-class @StatGraph
- @log: {}
- @get_log: ->
- @log
- @set_log: (data) ->
- @log = data
diff --git a/app/assets/javascripts/stat_graph_contributors.js.coffee b/app/assets/javascripts/stat_graph_contributors.js.coffee
deleted file mode 100644
index 27f0fd31d50..00000000000
--- a/app/assets/javascripts/stat_graph_contributors.js.coffee
+++ /dev/null
@@ -1,69 +0,0 @@
-class @ContributorsStatGraph
- init: (log) ->
- @parsed_log = ContributorsStatGraphUtil.parse_log(log)
- @set_current_field("commits")
- total_commits = ContributorsStatGraphUtil.get_total_data(@parsed_log, @field)
- author_commits = ContributorsStatGraphUtil.get_author_data(@parsed_log, @field)
- @add_master_graph(total_commits)
- @add_authors_graph(author_commits)
- @change_date_header()
- add_master_graph: (total_data) ->
- @master_graph = new ContributorsMasterGraph(total_data)
- @master_graph.draw()
- add_authors_graph: (author_data) ->
- @authors = []
- limited_author_data = author_data.slice(0, 100)
- _.each(limited_author_data, (d) =>
- author_header = @create_author_header(d)
- $(".contributors-list").append(author_header)
- @authors[d.author_name] = author_graph = new ContributorsAuthorGraph(d.dates)
- author_graph.draw()
- )
- format_author_commit_info: (author) ->
- commits = $('<span/>', {
- class: 'graph-author-commits-count'
- })
- commits.text(author.commits + " commits")
- $('<span/>').append(commits)
-
- create_author_header: (author) ->
- list_item = $('<li/>', {
- class: 'person'
- style: 'display: block;'
- })
- author_name = $('<h4>' + author.author_name + '</h4>')
- author_email = $('<p class="graph-author-email">' + author.author_email + '</p>')
- author_commit_info_span = $('<span/>', {
- class: 'commits'
- })
- author_commit_info = @format_author_commit_info(author)
- author_commit_info_span.html(author_commit_info)
- list_item.append(author_name)
- list_item.append(author_email)
- list_item.append(author_commit_info_span)
- list_item
- redraw_master: ->
- total_data = ContributorsStatGraphUtil.get_total_data(@parsed_log, @field)
- @master_graph.set_data(total_data)
- @master_graph.redraw()
- redraw_authors: ->
- $("ol").html("")
- x_domain = ContributorsGraph.prototype.x_domain
- author_commits = ContributorsStatGraphUtil.get_author_data(@parsed_log, @field, x_domain)
- _.each(author_commits, (d) =>
- @redraw_author_commit_info(d)
- $(@authors[d.author_name].list_item).appendTo("ol")
- @authors[d.author_name].set_data(d.dates)
- @authors[d.author_name].redraw()
- )
- set_current_field: (field) ->
- @field = field
- change_date_header: ->
- x_domain = ContributorsGraph.prototype.x_domain
- print_date_format = d3.time.format("%B %e %Y")
- print = print_date_format(x_domain[0]) + " - " + print_date_format(x_domain[1])
- $("#date_header").text(print)
- redraw_author_commit_info: (author) ->
- author_list_item = $(@authors[author.author_name].list_item)
- author_commit_info = @format_author_commit_info(author)
- author_list_item.find("span").html(author_commit_info)
diff --git a/app/assets/javascripts/stat_graph_contributors_graph.js.coffee b/app/assets/javascripts/stat_graph_contributors_graph.js.coffee
deleted file mode 100644
index 8b82d20c6c2..00000000000
--- a/app/assets/javascripts/stat_graph_contributors_graph.js.coffee
+++ /dev/null
@@ -1,167 +0,0 @@
-class @ContributorsGraph
- MARGIN:
- top: 20
- right: 20
- bottom: 30
- left: 50
- x_domain: null
- y_domain: null
- dates: []
- @set_x_domain: (data) =>
- @prototype.x_domain = data
- @set_y_domain: (data) =>
- @prototype.y_domain = [0, d3.max(data, (d) ->
- d.commits = d.commits ? d.additions ? d.deletions
- )]
- @init_x_domain: (data) =>
- @prototype.x_domain = d3.extent(data, (d) ->
- d.date
- )
- @init_y_domain: (data) =>
- @prototype.y_domain = [0, d3.max(data, (d) ->
- d.commits = d.commits ? d.additions ? d.deletions
- )]
- @init_domain: (data) =>
- @init_x_domain(data)
- @init_y_domain(data)
- @set_dates: (data) =>
- @prototype.dates = data
- set_x_domain: ->
- @x.domain(@x_domain)
- set_y_domain: ->
- @y.domain(@y_domain)
- set_domain: ->
- @set_x_domain()
- @set_y_domain()
- create_scale: (width, height) ->
- @x = d3.time.scale().range([0, width]).clamp(true)
- @y = d3.scale.linear().range([height, 0]).nice()
- draw_x_axis: ->
- @svg.append("g").attr("class", "x axis").attr("transform", "translate(0, #{@height})")
- .call(@x_axis)
- draw_y_axis: ->
- @svg.append("g").attr("class", "y axis").call(@y_axis)
- set_data: (data) ->
- @data = data
-
-class @ContributorsMasterGraph extends ContributorsGraph
- constructor: (@data) ->
- @width = $('.container').width() - 345
- @height = 200
- @x = null
- @y = null
- @x_axis = null
- @y_axis = null
- @area = null
- @svg = null
- @brush = null
- @x_max_domain = null
- process_dates: (data) ->
- dates = @get_dates(data)
- @parse_dates(data)
- ContributorsGraph.set_dates(dates)
- get_dates: (data) ->
- _.pluck(data, 'date')
- parse_dates: (data) ->
- parseDate = d3.time.format("%Y-%m-%d").parse
- data.forEach((d) ->
- d.date = parseDate(d.date)
- )
- create_scale: ->
- super @width, @height
- create_axes: ->
- @x_axis = d3.svg.axis().scale(@x).orient("bottom")
- @y_axis = d3.svg.axis().scale(@y).orient("left").ticks(5)
- create_svg: ->
- @svg = d3.select("#contributors-master").append("svg")
- .attr("width", @width + @MARGIN.left + @MARGIN.right)
- .attr("height", @height + @MARGIN.top + @MARGIN.bottom)
- .attr("class", "tint-box")
- .append("g")
- .attr("transform", "translate(" + @MARGIN.left + "," + @MARGIN.top + ")")
- create_area: (x, y) ->
- @area = d3.svg.area().x((d) ->
- x(d.date)
- ).y0(@height).y1((d) ->
- xa = d.commits = d.commits ? d.additions ? d.deletions
- y(xa)
- ).interpolate("basis")
- create_brush: ->
- @brush = d3.svg.brush().x(@x).on("brushend", @update_content)
- draw_path: (data) ->
- @svg.append("path").datum(data).attr("class", "area").attr("d", @area)
- add_brush: ->
- @svg.append("g").attr("class", "selection").call(@brush).selectAll("rect").attr("height", @height)
- update_content: =>
- ContributorsGraph.set_x_domain(if @brush.empty() then @x_max_domain else @brush.extent())
- $("#brush_change").trigger('change')
- draw: ->
- @process_dates(@data)
- @create_scale()
- @create_axes()
- ContributorsGraph.init_domain(@data)
- @x_max_domain = @x_domain
- @set_domain()
- @create_area(@x, @y)
- @create_svg()
- @create_brush()
- @draw_path(@data)
- @draw_x_axis()
- @draw_y_axis()
- @add_brush()
- redraw: ->
- @process_dates(@data)
- ContributorsGraph.set_y_domain(@data)
- @set_y_domain()
- @svg.select("path").datum(@data)
- @svg.select("path").attr("d", @area)
- @svg.select(".y.axis").call(@y_axis)
-
-class @ContributorsAuthorGraph extends ContributorsGraph
- constructor: (@data) ->
- @width = $('.container').width()/2 - 225
- @height = 200
- @x = null
- @y = null
- @x_axis = null
- @y_axis = null
- @area = null
- @svg = null
- @list_item = null
- create_scale: ->
- super @width, @height
- create_axes: ->
- @x_axis = d3.svg.axis().scale(@x).orient("bottom").ticks(8)
- @y_axis = d3.svg.axis().scale(@y).orient("left").ticks(5)
- create_area: (x, y) ->
- @area = d3.svg.area().x((d) ->
- parseDate = d3.time.format("%Y-%m-%d").parse
- x(parseDate(d))
- ).y0(@height).y1((d) =>
- if @data[d]? then y(@data[d]) else y(0)
- ).interpolate("basis")
- create_svg: ->
- @list_item = d3.selectAll(".person")[0].pop()
- @svg = d3.select(@list_item).append("svg")
- .attr("width", @width + @MARGIN.left + @MARGIN.right)
- .attr("height", @height + @MARGIN.top + @MARGIN.bottom)
- .attr("class", "spark")
- .append("g")
- .attr("transform", "translate(" + @MARGIN.left + "," + @MARGIN.top + ")")
- draw_path: (data) ->
- @svg.append("path").datum(data).attr("class", "area-contributor").attr("d", @area)
- draw: ->
- @create_scale()
- @create_axes()
- @set_domain()
- @create_area(@x, @y)
- @create_svg()
- @draw_path(@dates)
- @draw_x_axis()
- @draw_y_axis()
- redraw: ->
- @set_domain()
- @svg.select("path").datum(@dates)
- @svg.select("path").attr("d", @area)
- @svg.select(".x.axis").call(@x_axis)
- @svg.select(".y.axis").call(@y_axis)
diff --git a/app/assets/javascripts/stat_graph_contributors_util.js.coffee b/app/assets/javascripts/stat_graph_contributors_util.js.coffee
deleted file mode 100644
index 1670f5c7bc1..00000000000
--- a/app/assets/javascripts/stat_graph_contributors_util.js.coffee
+++ /dev/null
@@ -1,93 +0,0 @@
-window.ContributorsStatGraphUtil =
- parse_log: (log) ->
- total = {}
- by_author = {}
- for entry in log
- @add_date(entry.date, total) unless total[entry.date]?
- @add_author(entry, by_author) unless by_author[entry.author_name]?
- @add_date(entry.date, by_author[entry.author_name]) unless by_author[entry.author_name][entry.date]
- @store_data(entry, total[entry.date], by_author[entry.author_name][entry.date])
- total = _.toArray(total)
- by_author = _.toArray(by_author)
- total: total, by_author: by_author
-
- add_date: (date, collection) ->
- collection[date] = {}
- collection[date].date = date
-
- add_author: (author, by_author) ->
- by_author[author.author_name] = {}
- by_author[author.author_name].author_name = author.author_name
- by_author[author.author_name].author_email = author.author_email
-
- store_data: (entry, total, by_author) ->
- @store_commits(total, by_author)
- @store_additions(entry, total, by_author)
- @store_deletions(entry, total, by_author)
-
- store_commits: (total, by_author) ->
- @add(total, "commits", 1)
- @add(by_author, "commits", 1)
-
- add: (collection, field, value) ->
- collection[field] ?= 0
- collection[field] += value
-
- store_additions: (entry, total, by_author) ->
- entry.additions ?= 0
- @add(total, "additions", entry.additions)
- @add(by_author, "additions", entry.additions)
-
- store_deletions: (entry, total, by_author) ->
- entry.deletions ?= 0
- @add(total, "deletions", entry.deletions)
- @add(by_author, "deletions", entry.deletions)
-
- get_total_data: (parsed_log, field) ->
- log = parsed_log.total
- total_data = @pick_field(log, field)
- _.sortBy(total_data, (d) ->
- d.date
- )
- pick_field: (log, field) ->
- total_data = []
- _.each(log, (d) ->
- total_data.push(_.pick(d, [field, 'date']))
- )
- total_data
-
- get_author_data: (parsed_log, field, date_range = null) ->
- log = parsed_log.by_author
- author_data = []
-
- _.each(log, (log_entry) =>
- parsed_log_entry = @parse_log_entry(log_entry, field, date_range)
- if not _.isEmpty(parsed_log_entry.dates)
- author_data.push(parsed_log_entry)
- )
-
- _.sortBy(author_data, (d) ->
- d[field]
- ).reverse()
-
- parse_log_entry: (log_entry, field, date_range) ->
- parsed_entry = {}
- parsed_entry.author_name = log_entry.author_name
- parsed_entry.author_email = log_entry.author_email
- parsed_entry.dates = {}
- parsed_entry.commits = parsed_entry.additions = parsed_entry.deletions = 0
- _.each(_.omit(log_entry, 'author_name', 'author_email'), (value, key) =>
- if @in_range(value.date, date_range)
- parsed_entry.dates[value.date] = value[field]
- parsed_entry.commits += value.commits
- parsed_entry.additions += value.additions
- parsed_entry.deletions += value.deletions
- )
- return parsed_entry
-
- in_range: (date, date_range) ->
- if date_range is null || date_range[0] <= new Date(date) <= date_range[1]
- true
- else
- false
-
diff --git a/app/assets/javascripts/subscription.js.coffee b/app/assets/javascripts/subscription.js.coffee
deleted file mode 100644
index 7f41616d4e7..00000000000
--- a/app/assets/javascripts/subscription.js.coffee
+++ /dev/null
@@ -1,17 +0,0 @@
-class @Subscription
- constructor: (url) ->
- $(".subscribe-button").unbind("click").click (event)=>
- btn = $(event.currentTarget)
- action = btn.find("span").text()
- current_status = $(".subscription-status").attr("data-status")
- btn.prop("disabled", true)
-
- $.post url, =>
- btn.prop("disabled", false)
- status = if current_status == "subscribed" then "unsubscribed" else "subscribed"
- $(".subscription-status").attr("data-status", status)
- action = if status == "subscribed" then "Unsubscribe" else "Subscribe"
- btn.find("span").text(action)
- $(".subscription-status>div").toggleClass("hidden")
-
-
diff --git a/app/assets/javascripts/tree.js.coffee b/app/assets/javascripts/tree.js.coffee
deleted file mode 100644
index d428db5b422..00000000000
--- a/app/assets/javascripts/tree.js.coffee
+++ /dev/null
@@ -1,41 +0,0 @@
-class @TreeView
- constructor: ->
- @initKeyNav()
-
- # Code browser tree slider
- # Make the entire tree-item row clickable, but not if clicking another link (like a commit message)
- $(".tree-content-holder .tree-item").on 'click', (e) ->
- if (e.target.nodeName != "A")
- path = $('.tree-item-file-name a', this).attr('href')
- Turbolinks.visit(path)
-
- # Show the "Loading commit data" for only the first element
- $('span.log_loading:first').removeClass('hide')
-
- initKeyNav: ->
- li = $("tr.tree-item")
- liSelected = null
- $('body').keydown (e) ->
- if e.which is 40
- if liSelected
- next = liSelected.next()
- if next.length > 0
- liSelected.removeClass "selected"
- liSelected = next.addClass("selected")
- else
- liSelected = li.eq(0).addClass("selected")
-
- $(liSelected).focus()
- else if e.which is 38
- if liSelected
- next = liSelected.prev()
- if next.length > 0
- liSelected.removeClass "selected"
- liSelected = next.addClass("selected")
- else
- liSelected = li.last().addClass("selected")
-
- $(liSelected).focus()
- else if e.which is 13
- path = $('.tree-item.selected .tree-item-file-name a').attr('href')
- Turbolinks.visit(path)
diff --git a/app/assets/javascripts/user.js.coffee b/app/assets/javascripts/user.js.coffee
deleted file mode 100644
index d0d81f96921..00000000000
--- a/app/assets/javascripts/user.js.coffee
+++ /dev/null
@@ -1,4 +0,0 @@
-class @User
- constructor: ->
- $('.profile-groups-avatars').tooltip("placement": "top")
- new ProjectsList()
diff --git a/app/assets/javascripts/users_select.js.coffee b/app/assets/javascripts/users_select.js.coffee
deleted file mode 100644
index aeeed9ca3cc..00000000000
--- a/app/assets/javascripts/users_select.js.coffee
+++ /dev/null
@@ -1,117 +0,0 @@
-class @UsersSelect
- constructor: ->
- @usersPath = "/autocomplete/users.json"
- @userPath = "/autocomplete/users/:id.json"
-
- $('.ajax-users-select').each (i, select) =>
- @projectId = $(select).data('project-id')
- @groupId = $(select).data('group-id')
- showNullUser = $(select).data('null-user')
- showAnyUser = $(select).data('any-user')
- showEmailUser = $(select).data('email-user')
- firstUser = $(select).data('first-user')
-
- $(select).select2
- placeholder: "Search for a user"
- multiple: $(select).hasClass('multiselect')
- minimumInputLength: 0
- query: (query) =>
- @users query.term, (users) =>
- data = { results: users }
-
- if query.term.length == 0
- if firstUser
- # Move current user to the front of the list
- for obj, index in data.results
- if obj.username == firstUser
- data.results.splice(index, 1)
- data.results.unshift(obj)
- break
-
- if showNullUser
- nullUser = {
- name: 'Unassigned',
- avatar: null,
- username: 'none',
- id: 0
- }
- data.results.unshift(nullUser)
-
- if showAnyUser
- anyUser = {
- name: 'Any',
- avatar: null,
- username: 'none',
- id: null
- }
- data.results.unshift(anyUser)
-
- if showEmailUser && data.results.length == 0 && query.term.match(/^[^@]+@[^@]+$/)
- emailUser = {
- name: "Invite \"#{query.term}\"",
- avatar: null,
- username: query.term,
- id: query.term
- }
- data.results.unshift(emailUser)
-
- query.callback(data)
-
- initSelection: (element, callback) =>
- id = $(element).val()
- if id != "" && id != "0"
- @user(id, callback)
-
- formatResult: (args...) =>
- @formatResult(args...)
- formatSelection: (args...) =>
- @formatSelection(args...)
- dropdownCssClass: "ajax-users-dropdown"
- escapeMarkup: (m) -> # we do not want to escape markup since we are displaying html in results
- m
-
- formatResult: (user) ->
- if user.avatar_url
- avatar = user.avatar_url
- else
- avatar = gon.default_avatar_url
-
- "<div class='user-result'>
- <div class='user-image'><img class='avatar s24' src='#{avatar}'></div>
- <div class='user-name'>#{user.name}</div>
- <div class='user-username'>#{user.username}</div>
- </div>"
-
- formatSelection: (user) ->
- user.name
-
- user: (user_id, callback) =>
- url = @buildUrl(@userPath)
- url = url.replace(':id', user_id)
-
- $.ajax(
- url: url
- dataType: "json"
- ).done (user) ->
- callback(user)
-
- # Return users list. Filtered by query
- # Only active users retrieved
- users: (query, callback) =>
- url = @buildUrl(@usersPath)
-
- $.ajax(
- url: url
- data:
- search: query
- per_page: 20
- active: true
- project_id: @projectId
- group_id: @groupId
- dataType: "json"
- ).done (users) ->
- callback(users)
-
- buildUrl: (url) ->
- url = gon.relative_url_root + url if gon.relative_url_root?
- return url
diff --git a/app/assets/javascripts/wikis.js.coffee b/app/assets/javascripts/wikis.js.coffee
deleted file mode 100644
index 66757565d3a..00000000000
--- a/app/assets/javascripts/wikis.js.coffee
+++ /dev/null
@@ -1,9 +0,0 @@
-class @Wikis
- constructor: ->
- $('.build-new-wiki').bind "click", ->
- field = $('#new_wiki_path')
- slug = field.val()
- path = field.attr('data-wikis-path')
-
- if(slug.length > 0)
- location.href = path + "/" + slug
diff --git a/app/assets/javascripts/zen_mode.js.coffee b/app/assets/javascripts/zen_mode.js.coffee
deleted file mode 100644
index 0fb8f7ed75f..00000000000
--- a/app/assets/javascripts/zen_mode.js.coffee
+++ /dev/null
@@ -1,67 +0,0 @@
-class @ZenMode
- @fullscreen_prefix = 'fullscreen_'
-
- constructor: ->
- @active_zen_area = null
- @active_checkbox = null
- @scroll_position = 0
-
- $(window).scroll =>
- if not @active_checkbox
- @scroll_position = window.pageYOffset
-
- $('body').on 'click', '.zen-enter-link', (e) =>
- e.preventDefault()
- $(e.currentTarget).closest('.zennable').find('.zen-toggle-comment').prop('checked', true)
-
- $('body').on 'click', '.zen-leave-link', (e) =>
- e.preventDefault()
- $(e.currentTarget).closest('.zennable').find('.zen-toggle-comment').prop('checked', false)
-
- $('body').on 'change', '.zen-toggle-comment', (e) =>
- checkbox = e.currentTarget
- if checkbox.checked
- # Disable other keyboard shortcuts in ZEN mode
- Mousetrap.pause()
- @udpateActiveZenArea(checkbox)
- else
- @exitZenMode()
-
- $(document).on 'keydown', (e) =>
- if e.keyCode is $.ui.keyCode.ESCAPE
- @exitZenMode()
- e.preventDefault()
-
- $(window).on 'hashchange', @updateZenModeFromLocationHash
-
- udpateActiveZenArea: (checkbox) =>
- @active_checkbox = $(checkbox)
- @active_checkbox.prop('checked', true)
- @active_zen_area = @active_checkbox.parent().find('textarea')
- @active_zen_area.focus()
- window.location.hash = ZenMode.fullscreen_prefix + @active_checkbox.prop('id')
-
- exitZenMode: =>
- if @active_zen_area isnt null
- Mousetrap.unpause()
- @active_checkbox.prop('checked', false)
- @active_zen_area = null
- @active_checkbox = null
- window.location.hash = ''
- window.scrollTo(window.pageXOffset, @scroll_position)
- # Enable dropzone when leaving ZEN mode
- Dropzone.forElement('.div-dropzone').enable()
-
- checkboxFromLocationHash: (e) ->
- id = $.trim(window.location.hash.replace('#' + ZenMode.fullscreen_prefix, ''))
- if id
- return $('.zennable input[type=checkbox]#' + id)[0]
- else
- return null
-
- updateZenModeFromLocationHash: (e) =>
- checkbox = @checkboxFromLocationHash()
- if checkbox
- @udpateActiveZenArea(checkbox)
- else
- @exitZenMode()