diff options
author | Job van der Voort <jobvandervoort@gmail.com> | 2015-04-21 17:21:51 +0300 |
---|---|---|
committer | Job van der Voort <jobvandervoort@gmail.com> | 2015-04-21 17:21:51 +0300 |
commit | a8e93b7f51d968c1380ed210499869b62b07fd15 (patch) | |
tree | c864e80dfd9cf4f83fcede678acc986e3a125bf5 /app | |
parent | 0625b15a481b3a3edd88110b3c18031ad9068d2f (diff) |
Version 7.10.0.rc5v7.10.0.rc5
Diffstat (limited to 'app')
961 files changed, 0 insertions, 42283 deletions
diff --git a/app/assets/images/authbuttons/bitbucket_64.png b/app/assets/images/authbuttons/bitbucket_64.png Binary files differdeleted file mode 100644 index 4b90a57bc7d..00000000000 --- a/app/assets/images/authbuttons/bitbucket_64.png +++ /dev/null diff --git a/app/assets/images/authbuttons/github_64.png b/app/assets/images/authbuttons/github_64.png Binary files differdeleted file mode 100644 index dc7c03d1005..00000000000 --- a/app/assets/images/authbuttons/github_64.png +++ /dev/null diff --git a/app/assets/images/authbuttons/gitlab_64.png b/app/assets/images/authbuttons/gitlab_64.png Binary files differdeleted file mode 100644 index 31281a19444..00000000000 --- a/app/assets/images/authbuttons/gitlab_64.png +++ /dev/null diff --git a/app/assets/images/authbuttons/google_64.png b/app/assets/images/authbuttons/google_64.png Binary files differdeleted file mode 100644 index 94a0e089c6e..00000000000 --- a/app/assets/images/authbuttons/google_64.png +++ /dev/null diff --git a/app/assets/images/authbuttons/twitter_64.png b/app/assets/images/authbuttons/twitter_64.png Binary files differdeleted file mode 100644 index 5c9f14cb077..00000000000 --- a/app/assets/images/authbuttons/twitter_64.png +++ /dev/null diff --git a/app/assets/images/bg-header.png b/app/assets/images/bg-header.png Binary files differdeleted file mode 100644 index 639271c6faf..00000000000 --- a/app/assets/images/bg-header.png +++ /dev/null diff --git a/app/assets/images/bg_fallback.png b/app/assets/images/bg_fallback.png Binary files differdeleted file mode 100644 index e5fe659ba63..00000000000 --- a/app/assets/images/bg_fallback.png +++ /dev/null diff --git a/app/assets/images/brand_logo.png b/app/assets/images/brand_logo.png Binary files differdeleted file mode 100644 index 9c564bb6141..00000000000 --- a/app/assets/images/brand_logo.png +++ /dev/null diff --git a/app/assets/images/chosen-sprite.png b/app/assets/images/chosen-sprite.png Binary files differdeleted file mode 100644 index 3d936b07d44..00000000000 --- a/app/assets/images/chosen-sprite.png +++ /dev/null diff --git a/app/assets/images/dark-scheme-preview.png b/app/assets/images/dark-scheme-preview.png Binary files differdeleted file mode 100644 index 2ef58e52549..00000000000 --- a/app/assets/images/dark-scheme-preview.png +++ /dev/null diff --git a/app/assets/images/diff_note_add.png b/app/assets/images/diff_note_add.png Binary files differdeleted file mode 100644 index 0084422e330..00000000000 --- a/app/assets/images/diff_note_add.png +++ /dev/null diff --git a/app/assets/images/favicon.ico b/app/assets/images/favicon.ico Binary files differdeleted file mode 100644 index bfb74960c48..00000000000 --- a/app/assets/images/favicon.ico +++ /dev/null diff --git a/app/assets/images/gitorious-logo-black.png b/app/assets/images/gitorious-logo-black.png Binary files differdeleted file mode 100644 index 78f17a9af79..00000000000 --- a/app/assets/images/gitorious-logo-black.png +++ /dev/null diff --git a/app/assets/images/gitorious-logo-blue.png b/app/assets/images/gitorious-logo-blue.png Binary files differdeleted file mode 100644 index 4962cffba31..00000000000 --- a/app/assets/images/gitorious-logo-blue.png +++ /dev/null diff --git a/app/assets/images/icon-link.png b/app/assets/images/icon-link.png Binary files differdeleted file mode 100644 index 60021d5ac47..00000000000 --- a/app/assets/images/icon-link.png +++ /dev/null diff --git a/app/assets/images/icon-search.png b/app/assets/images/icon-search.png Binary files differdeleted file mode 100644 index 3c1c146541d..00000000000 --- a/app/assets/images/icon-search.png +++ /dev/null diff --git a/app/assets/images/icon_sprite.png b/app/assets/images/icon_sprite.png Binary files differdeleted file mode 100644 index 2e7a5023398..00000000000 --- a/app/assets/images/icon_sprite.png +++ /dev/null diff --git a/app/assets/images/images.png b/app/assets/images/images.png Binary files differdeleted file mode 100644 index ad146246caf..00000000000 --- a/app/assets/images/images.png +++ /dev/null diff --git a/app/assets/images/logo-white.png b/app/assets/images/logo-white.png Binary files differdeleted file mode 100644 index 917bcfcb7e7..00000000000 --- a/app/assets/images/logo-white.png +++ /dev/null diff --git a/app/assets/images/monokai-scheme-preview.png b/app/assets/images/monokai-scheme-preview.png Binary files differdeleted file mode 100644 index fbb339c6a91..00000000000 --- a/app/assets/images/monokai-scheme-preview.png +++ /dev/null diff --git a/app/assets/images/move.png b/app/assets/images/move.png Binary files differdeleted file mode 100644 index 6a0567f8f25..00000000000 --- a/app/assets/images/move.png +++ /dev/null diff --git a/app/assets/images/no_avatar.png b/app/assets/images/no_avatar.png Binary files differdeleted file mode 100644 index 8287acbce13..00000000000 --- a/app/assets/images/no_avatar.png +++ /dev/null diff --git a/app/assets/images/no_group_avatar.png b/app/assets/images/no_group_avatar.png Binary files differdeleted file mode 100644 index bfb31bb2184..00000000000 --- a/app/assets/images/no_group_avatar.png +++ /dev/null diff --git a/app/assets/images/onion_skin_sprites.gif b/app/assets/images/onion_skin_sprites.gif Binary files differdeleted file mode 100644 index 337aa1bfb63..00000000000 --- a/app/assets/images/onion_skin_sprites.gif +++ /dev/null diff --git a/app/assets/images/progress_bar.gif b/app/assets/images/progress_bar.gif Binary files differdeleted file mode 100644 index c3d43fa40b2..00000000000 --- a/app/assets/images/progress_bar.gif +++ /dev/null diff --git a/app/assets/images/slider_handles.png b/app/assets/images/slider_handles.png Binary files differdeleted file mode 100644 index 884378ec96a..00000000000 --- a/app/assets/images/slider_handles.png +++ /dev/null diff --git a/app/assets/images/solarized-dark-scheme-preview.png b/app/assets/images/solarized-dark-scheme-preview.png Binary files differdeleted file mode 100644 index 7ed7336896b..00000000000 --- a/app/assets/images/solarized-dark-scheme-preview.png +++ /dev/null diff --git a/app/assets/images/solarized-light-scheme-preview.png b/app/assets/images/solarized-light-scheme-preview.png Binary files differdeleted file mode 100644 index c50db75449b..00000000000 --- a/app/assets/images/solarized-light-scheme-preview.png +++ /dev/null diff --git a/app/assets/images/swipemode_sprites.gif b/app/assets/images/swipemode_sprites.gif Binary files differdeleted file mode 100644 index b010b4e4482..00000000000 --- a/app/assets/images/swipemode_sprites.gif +++ /dev/null diff --git a/app/assets/images/switch_icon.png b/app/assets/images/switch_icon.png Binary files differdeleted file mode 100644 index c6b6c8d9521..00000000000 --- a/app/assets/images/switch_icon.png +++ /dev/null diff --git a/app/assets/images/trans_bg.gif b/app/assets/images/trans_bg.gif Binary files differdeleted file mode 100644 index 1a1c9c15ec7..00000000000 --- a/app/assets/images/trans_bg.gif +++ /dev/null diff --git a/app/assets/images/white-scheme-preview.png b/app/assets/images/white-scheme-preview.png Binary files differdeleted file mode 100644 index fc4c40b9227..00000000000 --- a/app/assets/images/white-scheme-preview.png +++ /dev/null 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 + ">×</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() diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss deleted file mode 100644 index 015ff2ce4ec..00000000000 --- a/app/assets/stylesheets/application.scss +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This is a manifest file that'll automatically include all the stylesheets available in this directory - * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at - * the top of the compiled file, but it's generally better to create a new file per style scope. - *= require jquery.ui.datepicker - *= require jquery.ui.autocomplete - *= require jquery.atwho - *= require select2 - *= require_self - *= require dropzone/basic - *= require cal-heatmap -*/ - - -@import "base/variables"; -@import "base/mixins"; -@import "base/layout"; - - -/** - * Customized Twitter bootstrap - */ -@import 'base/gl_variables'; -@import 'base/gl_bootstrap'; - -/** - * NProgress load bar css - */ -@import 'nprogress'; -@import 'nprogress-bootstrap'; - -/** - * Font icons - * - */ -@import "font-awesome"; - -/** - * Generic css (forms, nav etc): - */ -@import "generic/*"; - -/** - * Page specific styles (issues, projects etc): - */ - -@import "pages/*"; - -/** - * Code highlight - */ -@import "highlight/*"; - -/** - * UI themes: - */ -@import "themes/*"; - -/** - * Styles for JS behaviors. - */ -@import "behaviors.scss"; diff --git a/app/assets/stylesheets/base/gl_bootstrap.scss b/app/assets/stylesheets/base/gl_bootstrap.scss deleted file mode 100644 index 62a3eade5c7..00000000000 --- a/app/assets/stylesheets/base/gl_bootstrap.scss +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Twitter bootstrap with GitLab customizations/additions - * - */ - -// Core variables and mixins -@import "bootstrap/variables"; -@import "bootstrap/mixins"; - -// Reset -@import "bootstrap/normalize"; -@import "bootstrap/print"; - -// Core CSS -@import "bootstrap/scaffolding"; -@import "bootstrap/type"; -@import "bootstrap/code"; -@import "bootstrap/grid"; -@import "bootstrap/tables"; -@import "bootstrap/forms"; -@import "bootstrap/buttons"; - -// Components -@import "bootstrap/component-animations"; -@import "bootstrap/dropdowns"; -@import "bootstrap/button-groups"; -@import "bootstrap/input-groups"; -@import "bootstrap/navs"; -@import "bootstrap/navbar"; -@import "bootstrap/breadcrumbs"; -@import "bootstrap/pagination"; -@import "bootstrap/pager"; -@import "bootstrap/labels"; -@import "bootstrap/badges"; -@import "bootstrap/jumbotron"; -@import "bootstrap/thumbnails"; -@import "bootstrap/alerts"; -@import "bootstrap/progress-bars"; -@import "bootstrap/list-group"; -@import "bootstrap/wells"; -@import "bootstrap/close"; -@import "bootstrap/panels"; - -// Components w/ JavaScript -@import "bootstrap/modals"; -@import "bootstrap/tooltip"; -@import "bootstrap/popovers"; -@import "bootstrap/carousel"; - -// Utility classes -.clearfix { - @include clearfix(); -} -.center-block { - @include center-block(); -} -.pull-right { - float: right !important; -} -.pull-left { - float: left !important; -} -.hide { - display: none; -} -.show { - display: block !important; -} -.invisible { - visibility: hidden; -} -.text-hide { - @include text-hide(); -} -.hidden { - display: none !important; - visibility: hidden !important; -} -.affix { - position: fixed; -} - -@import "bootstrap/responsive-utilities"; - -// Labels -.label { - padding: 2px 4px; - font-size: 12px; - font-style: normal; - font-weight: normal; - display: inline-block; - - &.label-gray { - background-color: #eee; - color: #999; - text-shadow: none; - } - - &.label-inverse { - background-color: #333333; - } -} - -// Nav tabs -.nav.nav-tabs { - margin-bottom: 15px; - - li { - > a { - margin-right: 5px; - line-height: 20px; - border-color: #EEE; - color: #888; - border-bottom: 1px solid #ddd; - .badge { - background-color: #eee; - color: #888; - text-shadow: 0 1px 1px #fff; - } - i[class~="fa"] { - line-height: 14px; - } - } - &.active { - > a { - border-color: #CCC; - border-bottom: 1px solid #fff; - color: #333; - font-weight: bold; - } - } - } -} - -.nav-tabs > li > a, -.nav-pills > li > a { - color: #666; -} - -/** - * fix to keep tooltips position in top navigation bar - * - */ -.navbar .nav > li { - position: relative; - white-space: nowrap; -} - -/** - * Add some extra stuff to panels - * - */ -.panel { - .panel-heading { - font-weight: bold; - - .panel-head-actions { - position: relative; - top: -5px; - float: right; - } - } - - .panel-body { - form { - margin: 0; - } - - .form-actions { - margin: -15px; - margin-top: 18px; - } - } - - .panel-footer { - .pagination { - margin: 0; - } - } - - &.panel-small { - .panel-heading { - padding: 6px 15px; - font-size: 13px; - font-weight: normal; - a { - color: #777; - } - } - } -} - -.panel-succes .panel-heading, -.panel-info .panel-heading, -.panel-danger .panel-heading, -.panel-warning .panel-heading, -.panel-primary .panel-heading, -.alert { - a:not(.btn) { - @extend .alert-link; - color: #fff; - text-decoration: underline; - } -} - -// Typography ================================================================= - -.text-primary, -.text-primary:hover { - color: $brand-primary; -} - -.text-success, -.text-success:hover { - color: $brand-success; -} - -.text-danger, -.text-danger:hover { - color: $brand-danger; -} - -.text-warning, -.text-warning:hover { - color: $brand-warning; -} - -.text-info, -.text-info:hover { - color: $brand-info; -} - -// Tables ===================================================================== - -table.table { - .dropdown-menu a { - text-decoration: none; - } - - .success, - .warning, - .danger, - .info { - color: #fff; - - a:not(.btn) { - text-decoration: underline; - color: #fff; - } - } -} diff --git a/app/assets/stylesheets/base/gl_variables.scss b/app/assets/stylesheets/base/gl_variables.scss deleted file mode 100644 index 56f4c794e1b..00000000000 --- a/app/assets/stylesheets/base/gl_variables.scss +++ /dev/null @@ -1,133 +0,0 @@ -// Override Bootstrap variables here (defaults from bootstrap-sass v3.3.3): -// For all variables see https://github.com/twbs/bootstrap-sass/blob/master/templates/project/_bootstrap-variables.sass -// -// Variables -// -------------------------------------------------- - - -//== Colors -// -//## Gray and brand colors for use across Bootstrap. - -// $gray-base: #000 -// $gray-darker: lighten($gray-base, 13.5%) // #222 -// $gray-dark: lighten($gray-base, 20%) // #333 -// $gray: lighten($gray-base, 33.5%) // #555 -// $gray-light: lighten($gray-base, 46.7%) // #777 -// $gray-lighter: lighten($gray-base, 93.5%) // #eee - -$brand-primary: $gl-primary; -$brand-success: $gl-success; -$brand-info: $gl-info; -$brand-warning: $gl-warning; -$brand-danger: $gl-danger; - - -//== Scaffolding -// -$text-color: $gl-text-color; -$link-color: $gl-link-color; - - -//== Typography -// -//## Font, line-height, and color for body text, headings, and more. - -$font-family-sans-serif: $regular_font; -$font-family-monospace: $monospace_font; -$font-size-base: $gl-font-size; - - -//== Components -// -//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start). - -$padding-base-vertical: 6px; -$padding-base-horizontal: 14px; - - -//== Forms -// -//## - -$input-color: $text-color; -$input-border: #DDD; -$input-border-focus: $brand-info; -$legend-color: $text-color; - - -//== Pagination -// -//## - -$pagination-color: #fff; -$pagination-bg: $brand-success; -$pagination-border: transparent; - -$pagination-hover-color: #fff; -$pagination-hover-bg: darken($brand-success, 15%); -$pagination-hover-border: transparent; - -$pagination-active-color: #fff; -$pagination-active-bg: darken($brand-success, 15%); -$pagination-active-border: transparent; - -$pagination-disabled-color: #b4bcc2; -$pagination-disabled-bg: lighten($brand-success, 15%); -$pagination-disabled-border: transparent; - - -//== Form states and alerts -// -//## Define colors for form feedback states and, by default, alerts. - -$state-success-text: #fff; -$state-success-bg: $brand-success; -$state-success-border: $brand-success; - -$state-info-text: #fff; -$state-info-bg: $brand-info; -$state-info-border: $brand-info; - -$state-warning-text: #fff; -$state-warning-bg: $brand-warning; -$state-warning-border: $brand-warning; - -$state-danger-text: #fff; -$state-danger-bg: $brand-danger; -$state-danger-border: $brand-danger; - - -//== Alerts -// -//## Define alert colors, border radius, and padding. - -$alert-border-radius: 0; - - -//== Panels -// -//## - -$panel-border-radius: 0; -$panel-default-text: $text-color; -$panel-default-border: $border-color; -$panel-default-heading-bg: $background-color; - - -//== Wells -// -//## - -$well-bg: #F9F9F9; -$well-border: #EEE; - -//== Code -// -//## - -$code-color: #c7254e; -$code-bg: #f9f2f4; - -$kbd-color: #fff; -$kbd-bg: #333; diff --git a/app/assets/stylesheets/base/layout.scss b/app/assets/stylesheets/base/layout.scss deleted file mode 100644 index 62c11b06368..00000000000 --- a/app/assets/stylesheets/base/layout.scss +++ /dev/null @@ -1,22 +0,0 @@ -html { - overflow-y: scroll; - - &.touch .tooltip { display: none !important; } - - body { - padding-top: 46px; - } -} - -.container { - padding-top: 0; - z-index: 5; -} - -.container .content { - margin: 0 0; -} - -.navless-container { - margin-top: 30px; -} diff --git a/app/assets/stylesheets/base/mixins.scss b/app/assets/stylesheets/base/mixins.scss deleted file mode 100644 index 216f25cdcd5..00000000000 --- a/app/assets/stylesheets/base/mixins.scss +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Generic mixins - */ - @mixin box-shadow($shadow) { - -webkit-box-shadow: $shadow; - -moz-box-shadow: $shadow; - -ms-box-shadow: $shadow; - -o-box-shadow: $shadow; - box-shadow: $shadow; -} - -@mixin border-radius($radius) { - -webkit-border-radius: $radius; - -moz-border-radius: $radius; - -ms-border-radius: $radius; - -o-border-radius: $radius; - border-radius: $radius; -} - -@mixin border-radius-left($radius) { - @include border-radius($radius 0 0 $radius) -} - -@mixin linear-gradient($from, $to) { - background-image: -webkit-gradient(linear, 0 0, 0 100%, from($from), to($to)); - background-image: -webkit-linear-gradient($from, $to); - background-image: -moz-linear-gradient($from, $to); - background-image: -ms-linear-gradient($from, $to); - background-image: -o-linear-gradient($from, $to); -} - -@mixin transition($transition) { - -webkit-transition: $transition; - -moz-transition: $transition; - -ms-transition: $transition; - -o-transition: $transition; - transition: $transition; -} - -/** - * Prefilled mixins - * Mixins with fixed values - */ - -@mixin shade { - @include box-shadow(0 0 3px #ddd); -} - -@mixin solid-shade { - @include box-shadow(0 0 0 3px #f1f1f1); -} - -@mixin header-font { - color: $style_color; - font-size: 16px; - line-height: 44px; - font-weight: normal; -} - -@mixin md-typography { - font-size: 15px; - line-height: 1.5; - - img { - max-width: 100%; - } - - *:first-child { - margin-top: 0; - } - - code { - font-family: $monospace_font; - white-space: pre; - word-wrap: normal; - padding: 0; - } - - h1 { - margin-top: 45px; - font-size: 2.5em; - } - - h2 { - margin-top: 40px; - font-size: 2em; - } - - h3 { - margin-top: 35px; - font-size: 1.5em; - } - - h4 { - margin-top: 30px; - font-size: 1.2em; - } - - blockquote p { - color: #888; - font-size: 15px; - line-height: 1.5; - } - - table { - @extend .table; - @extend .table-bordered; - th { - background: #EEE; - } - } - - p > code { - font-size: inherit; - font-weight: inherit; - color: #555; - } - - li { - line-height: 1.5; - } - - a[href*="/uploads/"], a[href*="storage.googleapis.com/google-code-attachments/"] { - &:before { - margin-right: 4px; - - font: normal normal normal 14px/1 FontAwesome; - font-size: inherit; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - content: "\f0c6"; - } - - &:hover:before { - text-decoration: none; - } - } -} - -@mixin str-truncated($max_width: 82%) { - display: inline-block; - overflow: hidden; - text-overflow: ellipsis; - vertical-align: top; - white-space: nowrap; - max-width: $max_width; -} diff --git a/app/assets/stylesheets/base/variables.scss b/app/assets/stylesheets/base/variables.scss deleted file mode 100644 index 596376c3970..00000000000 --- a/app/assets/stylesheets/base/variables.scss +++ /dev/null @@ -1,34 +0,0 @@ -$style_color: #474D57; -$hover: #FFF3EB; -$gl-text-color: #222222; -$gl-link-color: #446e9b; -$nprogress-color: #c0392b; -$gl-font-size: 14px; -$list-font-size: 15px; -$sidebar_width: 230px; -$avatar_radius: 50%; -$code_font_size: 13px; -$code_line_height: 1.5; -$border-color: #E5E5E5; -$background-color: #f5f5f5; - -/* - * State colors: - */ -$gl-primary: #446e9b; -$gl-success: #019875; -$gl-info: #029ACF; -$gl-warning: #EB9532; -$gl-danger: #d9534f; - -/* - * Commit Diff Colors - */ -$added: #63c363; -$deleted: #f77; - -/* - * Fonts - */ -$monospace_font: 'Menlo', 'Liberation Mono', 'Consolas', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Courier New', 'andale mono', 'lucida console', monospace; -$regular_font: "Helvetica Neue", Helvetica, Arial, sans-serif; diff --git a/app/assets/stylesheets/behaviors.scss b/app/assets/stylesheets/behaviors.scss deleted file mode 100644 index 469f4f296ae..00000000000 --- a/app/assets/stylesheets/behaviors.scss +++ /dev/null @@ -1,22 +0,0 @@ -// Details -//-------- -.js-details-container { - .content { - display: none; - &.hide { display: block; } - } - &.open .content { - display: block; - &.hide { display: none; } - } -} - -// Toggle between two states. -.js-toggler-container { - .turn-on { display: block; } - .turn-off { display: none; } - &.on { - .turn-on { display: none; } - .turn-off { display: block; } - } -} diff --git a/app/assets/stylesheets/generic/avatar.scss b/app/assets/stylesheets/generic/avatar.scss deleted file mode 100644 index 8595887c3b9..00000000000 --- a/app/assets/stylesheets/generic/avatar.scss +++ /dev/null @@ -1,42 +0,0 @@ -.avatar { - float: left; - margin-right: 12px; - width: 40px; - height: 40px; - padding: 0; - @include border-radius($avatar_radius); - - &.avatar-inline { - float: none; - margin-left: 4px; - margin-bottom: 2px; - - &.s16 { margin-right: 4px; } - &.s24 { margin-right: 4px; } - } - - &.group-avatar, &.project-avatar, &.avatar-tile { - @include border-radius(0px); - } - - &.s16 { width: 16px; height: 16px; margin-right: 6px; } - &.s24 { width: 24px; height: 24px; margin-right: 8px; } - &.s26 { width: 26px; height: 26px; margin-right: 8px; } - &.s32 { width: 32px; height: 32px; margin-right: 10px; } - &.s60 { width: 60px; height: 60px; margin-right: 12px; } - &.s90 { width: 90px; height: 90px; margin-right: 15px; } - &.s160 { width: 160px; height: 160px; margin-right: 20px; } -} - -.identicon { - text-align: center; - vertical-align: top; - - &.s16 { font-size: 12px; line-height: 1.33; } - &.s24 { font-size: 14px; line-height: 1.8; } - &.s26 { font-size: 20px; line-height: 1.33; } - &.s32 { font-size: 22px; line-height: 32px; } - &.s60 { font-size: 32px; line-height: 60px; } - &.s90 { font-size: 36px; line-height: 90px; } - &.s160 { font-size: 96px; line-height: 1.33; } -} diff --git a/app/assets/stylesheets/generic/blocks.scss b/app/assets/stylesheets/generic/blocks.scss deleted file mode 100644 index 3536a68f416..00000000000 --- a/app/assets/stylesheets/generic/blocks.scss +++ /dev/null @@ -1,19 +0,0 @@ -.light-well { - background: #f9f9f9; - padding: 15px; -} - -.centered-light-block { - text-align: center; - color: #888; - margin: 20px; -} - -.nothing-here-block { - text-align: center; - padding: 20px; - color: #666; - font-weight: normal; - font-size: 16px; - line-height: 36px; -} diff --git a/app/assets/stylesheets/generic/buttons.scss b/app/assets/stylesheets/generic/buttons.scss deleted file mode 100644 index cd6bf64c0ae..00000000000 --- a/app/assets/stylesheets/generic/buttons.scss +++ /dev/null @@ -1,74 +0,0 @@ -.btn { - @extend .btn-default; - - &.btn-new { - @extend .btn-success; - } - - &.btn-create { - @extend .btn-success; - } - - &.btn-save { - @extend .btn-primary; - } - - &.btn-remove { - @extend .btn-danger; - } - - &.btn-cancel { - float: right; - } - - &.btn-close { - color: $gl-danger; - border-color: $gl-danger; - &:hover { - color: #B94A48; - } - } - - &.btn-reopen { - color: $gl-success; - border-color: $gl-success; - &:hover { - color: #468847; - } - } - - &.btn-grouped { - margin-right: 7px; - float: left; - &:last-child { - margin-right: 0px; - } - } - - &.btn-save { - @extend .btn-primary; - } - - &.btn-new, &.btn-create { - @extend .btn-success; - } -} - -.btn-block { - width: 100%; - margin: 0; - margin-bottom: 15px; - &.btn { - padding: 6px 0; - } -} - -.btn-group { - &.btn-grouped { - margin-right: 7px; - float: left; - &:last-child { - margin-right: 0px; - } - } -} diff --git a/app/assets/stylesheets/generic/calendar.scss b/app/assets/stylesheets/generic/calendar.scss deleted file mode 100644 index a36fefe22c5..00000000000 --- a/app/assets/stylesheets/generic/calendar.scss +++ /dev/null @@ -1,90 +0,0 @@ -.user-calendar-activities { - .calendar_onclick_hr { - padding: 0; - margin: 10px 0; - } - - .str-truncated { - max-width: 70%; - } - - .text-expander { - background: #eee; - color: #555; - padding: 0 5px; - cursor: pointer; - margin-left: 4px; - &:hover { - background-color: #ddd; - } - } -} -/** -* This overwrites the default values of the cal-heatmap gem -*/ -.calendar { - .qi { - background-color: #999; - fill: #fff; - } - - .q1 { - background-color: #dae289; - fill: #ededed; - } - - .q2 { - background-color: #cedb9c; - fill: #ACD5F2; - } - - .q3 { - background-color: #b5cf6b; - fill: #7FA8D1; - } - - .q4 { - background-color: #637939; - fill: #49729B; - } - - .q5 { - background-color: #3b6427; - fill: #254E77; - } - - .domain-background { - fill: none; - shape-rendering: crispedges; - } - - .ch-tooltip { - position: absolute; - display: none; - margin-top: 22px; - margin-left: 1px; - font-size: 13px; - padding: 3px; - font-weight: 550; - background-color: #222; - span { - position: absolute; - width: 200px; - text-align: center; - visibility: hidden; - border-radius: 10px; - &:after { - content: ''; - position: absolute; - top: 100%; - left: 50%; - margin-left: -8px; - width: 0; - height: 0; - border-top: 8px solid #000000; - border-right: 8px solid transparent; - border-left: 8px solid transparent; - } - } - } -} diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss deleted file mode 100644 index 7c3021989a8..00000000000 --- a/app/assets/stylesheets/generic/common.scss +++ /dev/null @@ -1,376 +0,0 @@ -/** COLORS **/ -.cgray { color: gray } -.clgray { color: #BBB } -.cred { color: #D12F19 } -.cgreen { color: #4a2 } -.cdark { color: #444 } - -/** COMMON CLASSES **/ -.prepend-top-10 { margin-top:10px } -.prepend-top-20 { margin-top:20px } -.prepend-left-10 { margin-left:10px } -.prepend-left-20 { margin-left:20px } -.append-right-10 { margin-right:10px } -.append-right-20 { margin-right:20px } -.append-bottom-10 { margin-bottom:10px } -.append-bottom-15 { margin-bottom:15px } -.append-bottom-20 { margin-bottom:20px } -.inline { display: inline-block } -.center { text-align: center } - -.underlined-link { text-decoration: underline; } -.hint { font-style: italic; color: #999; } -.light { color: #888 } - -.slead { - color: #666; - font-size: 15px; - margin-bottom: 12px; - font-weight: normal; - line-height: 24px; -} - -.tab-content { - overflow: visible; -} - -pre { - &.clean { - background: none; - border: none; - margin: 0; - padding: 0; - } - - &.well-pre { - border: 1px solid #EEE; - background: #f9f9f9; - border-radius: 0; - color: #555; - } -} - -.dropdown-menu > li > a { - text-shadow: none; -} - -.dropdown-menu-align-right { - left: auto; - right: 0px; -} - -.dropdown-menu > li > a:hover, -.dropdown-menu > li > a:focus { - background: $gl-primary; - color: #FFF -} - -.str-truncated { - @include str-truncated; -} - -/** FLASH message **/ -.author_link { - color: $gl-link-color; -} - -.help li { color:$style_color; } - -.back-link { - font-size: 14px; -} - -table a code { - position: relative; - top: -2px; - margin-right: 3px; -} - -.loading { - margin: 20px auto; - height: 40px; - color: #555; - font-size: 32px; - text-align: center; -} - -span.update-author { - display: block; - color: #999; - font-weight: normal; - font-style: italic; - strong { - font-weight: bold; - font-style: normal; - } -} - -.user-mention { - color: #2FA0BB; - font-weight: bold; -} - -.field_with_errors { - display: inline; -} - -.line_holder { - &:hover { - td { - background: #FFFFCF !important; - } - } -} - -p.time { - color: #999; - font-size: 90%; - margin: 30px 3px 3px 2px; -} - -.highlight { - text-shadow: none; -} - -.highlight_word { - background: #fafe3d; -} - -.thin_area{ - height: 150px; -} - -// Fixes alignment on notes. -.new_note { - label { - text-align: left; - } -} - -// Fix issue with notes & lists creating a bunch of bottom borders. -li.note { - img { max-width:100% } - .note-title { - li { - border-bottom:none !important; - } - } -} - -.markdown { - img { - max-width: 100%; - } -} - -.wiki_content code, .readme code{ - background-color: inherit; -} - -.project_member_show { - td:first-child { - color: #aaa; - } -} - -.rss-icon { - img { - width: 24px; - vertical-align: top; - } - - strong { - line-height: 24px; - } -} - -.supp_diff_link, -.show-all-commits { - cursor: pointer; -} - -.git_error_tips { - @extend .col-md-6; - text-align: left; - margin-top: 40px; - pre { - background: white; - border: none; - font-size: 12px; - } -} - -.error-message { - padding: 10px; - background: #C67; - margin: 0; - color: #FFF; - - a { - color: #fff; - text-decoration: underline; - } -} - -.browser-alert { - padding: 10px; - text-align: center; - background: #C67; - color: #fff; - font-weight: bold; - a { - color: #fff; - text-decoration: underline; - } -} - -.warning_message { - border-left: 4px solid #ed9; - color: #b90; - padding: 10px; - margin-bottom: 10px; - background: #ffffe6; - padding-left: 20px; - - &.centered { - text-align: center; - } -} - -.gitlab-promo { - a { - color: #aaa; - margin-right: 30px; - } -} - -.milestone { - &.milestone-closed { - background: #f9f9f9; - } - .progress { - margin-bottom: 0; - margin-top: 4px; - } -} - -.control-group { - .controls { - span { - &.descr { - position: relative; - top: 2px; - left: 5px; - color: #666; - } - } - } -} - -img.emoji { - height: 20px; - vertical-align: middle; - width: 20px; -} - -.chart { - overflow: hidden; - height: 220px; -} - -.description-block { - @extend .light-well; - @extend .light; - margin-bottom: 10px; -} - -table { - td.permission-x { - background: #D9EDF7 !important; - text-align: center; - } -} - -.dashboard-intro-icon { - float: left; - text-align: center; - font-size: 32px; - color: #AAA; - width: 60px; -} - -.dashboard-intro-text { - display: inline-block; - margin-left: -60px; - padding-left: 60px; - width: 100%; -} - -.btn-sign-in { - margin-top: 5px; - text-shadow: none; -} - -.side-filters { - fieldset { - margin-bottom: 15px; - } -} - -.wiki .highlight, .note-body .highlight { - margin-bottom: 9px; -} - -.wiki .code { - overflow-x: auto; -} - -.footer-links { - margin-bottom: 20px; - a { - margin-right: 15px; - } -} - -.search_box { - position: relative; - padding: 30px; - text-align: center; - background-color: #F9F9F9; - border: 1px solid #DDDDDD; - border-radius: 0px; -} - -.search_glyph { - color: #555; - font-size: 42px; -} - -.task-status { - margin-left: 10px; -} - -#nprogress .spinner { - top: auto !important; - bottom: 20px !important; - left: 20px !important; -} - -.header-with-avatar { - h3 { - margin: 0; - font-weight: bold; - } - - .username { - font-size: 18px; - color: #666; - margin-top: 8px; - } - - .description { - font-size: 16px; - color: #666; - margin-top: 8px; - } -} diff --git a/app/assets/stylesheets/generic/files.scss b/app/assets/stylesheets/generic/files.scss deleted file mode 100644 index 8014dcb165b..00000000000 --- a/app/assets/stylesheets/generic/files.scss +++ /dev/null @@ -1,145 +0,0 @@ -/** - * File content holder - * - */ -.file-holder { - border: 1px solid $border-color; - margin-bottom: 1em; - - table { - @extend .table; - } - - .file-title { - position: relative; - background: $background-color; - border-bottom: 1px solid $border-color; - text-shadow: 0 1px 1px #fff; - margin: 0; - text-align: left; - padding: 10px 15px; - - .file-actions { - float: right; - position: absolute; - top: 5px; - right: 15px; - - .btn { - padding: 0px 10px; - font-size: 13px; - line-height: 28px; - } - } - - .left-options { - margin-top: -3px; - } - } - .file-content { - background: #fff; - - &.image_file { - background: #eee; - text-align: center; - img { - padding: 100px; - max-width: 50%; - } - } - - &.wiki { - padding: 25px; - - .highlight { - margin-bottom: 9px; - - > pre { - margin: 0; - } - } - } - - &.blob_file { - - } - - &.blob-no-preview { - background: #eee; - text-shadow: 0 1px 2px #FFF; - padding: 100px 0; - } - - /** - * Blame file - */ - &.blame { - table { - border: none; - box-shadow: none; - margin: 0; - } - tr { - border-bottom: 1px solid #eee; - } - td { - &:first-child { - border-left: none; - } - &:last-child { - border-right: none; - } - background: #fff; - padding: 5px; - } - .author, - .blame_commit { - background: $background-color; - vertical-align: top; - } - .lines { - pre { - padding: 0; - margin: 0; - background: none; - border: none; - } - } - } - - &.logs { - background: #eee; - max-height: 700px; - overflow-y: auto; - - ol { - margin-left: 40px; - padding: 10px 0; - border-left: 1px solid $border-color; - margin-bottom: 0; - background: white; - li { - color: #888; - p { - margin: 0; - color: #333; - line-height: 24px; - padding-left: 10px; - } - - &:hover { - background: $hover; - } - } - } - } - - /** - * Code file - */ - &.code { - padding: 0; - } - } -} - diff --git a/app/assets/stylesheets/generic/filters.scss b/app/assets/stylesheets/generic/filters.scss deleted file mode 100644 index bd93a79722d..00000000000 --- a/app/assets/stylesheets/generic/filters.scss +++ /dev/null @@ -1,55 +0,0 @@ -.filter-item { - margin-right: 15px; -} - -.issues-state-filters { - li.active a { - border-color: #DDD !important; - - &, &:hover, &:active, &.active { - background: #f5f5f5 !important; - border-bottom: 1px solid #f5f5f5 !important; - } - } -} - -.issues-details-filters { - font-size: 13px; - background: #f5f5f5; - margin: -10px 0; - padding: 10px 15px; - margin-top: -15px; - border-left: 1px solid #DDD; - border-right: 1px solid #DDD; - - .btn { - font-size: 13px; - } -} - -@media (min-width: 800px) { - .issues-filters, - .issues_bulk_update { - select, .select2-container { - width: 120px !important; - display: inline-block; - } - } -} - -@media (min-width: 1200px) { - .issues-filters, - .issues_bulk_update { - select, .select2-container { - width: 150px !important; - display: inline-block; - } - } -} - -.issues-filters, -.issues_bulk_update { - .select2-container .select2-choice { - color: #444 !important; - } -} diff --git a/app/assets/stylesheets/generic/flash.scss b/app/assets/stylesheets/generic/flash.scss deleted file mode 100644 index 82eb50ad4be..00000000000 --- a/app/assets/stylesheets/generic/flash.scss +++ /dev/null @@ -1,17 +0,0 @@ -.flash-container { - cursor: pointer; - margin: 0; - font-size: 14px; - width: 100%; - z-index: 100; - - .flash-notice { - @extend .alert; - @extend .alert-info; - } - - .flash-alert { - @extend .alert; - @extend .alert-danger; - } -} diff --git a/app/assets/stylesheets/generic/forms.scss b/app/assets/stylesheets/generic/forms.scss deleted file mode 100644 index 266041403e0..00000000000 --- a/app/assets/stylesheets/generic/forms.scss +++ /dev/null @@ -1,95 +0,0 @@ -textarea { - resize: vertical; -} - -input[type='search'].search-text-input { - background-image: image-url("icon-search.png"); - background-repeat: no-repeat; - background-position: 10px; - padding-left: 25px; -} - -input[type='text'].danger { - background: #F2DEDE!important; - border-color: #D66; - text-shadow: 0 1px 1px #fff -} - -.datetime-controls { - select { - width: 100px; - } -} - -.form-actions { - padding: 17px 20px 18px; - margin-top: 18px; - margin-bottom: 18px; - background-color: $background-color; - border-top: 1px solid $border-color; -} - -@media (min-width: $screen-sm-min) { - .form-actions { - padding-left: 17%; - } -} - -label { - &.control-label { - @extend .col-sm-2; - } - - &.inline-label { - margin: 0; - } -} - -.inline-input-group { - width: 250px; -} - -.input-mx-250 { - max-width: 250px; -} - -.input-mn-300 { - min-width: 300px; -} - -.custom-form-control { - width: 150px; -} - -@media (min-width: $screen-sm-min) { - .custom-form-control { - width: 150px; - } -} - -/* Medium devices (desktops, 992px and up) */ -@media (min-width: $screen-md-min) { - .custom-form-control { - width: 170px; - } -} - -/* Large devices (large desktops, 1200px and up) */ -@media (min-width: $screen-lg-min) { - .custom-form-control { - width: 200px; - } -} - -.fieldset-form fieldset { - margin-bottom: 20px; -} - -.form-control { - @include box-shadow(none); -} - -.issuable-description, -.wiki-content { - margin-top: 35px; -} diff --git a/app/assets/stylesheets/generic/gfm.scss b/app/assets/stylesheets/generic/gfm.scss deleted file mode 100644 index 8fac5e534fa..00000000000 --- a/app/assets/stylesheets/generic/gfm.scss +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Styles that apply to all GFM related forms. - */ -.issue-form, .merge-request-form, .wiki-form { - .description { - height: 16em; - border-top-left-radius: 0; - } -} - -.wiki-form { - .description { - height: 26em; - } -} - -.milestone-form { - .description { - height: 14em; - } -} diff --git a/app/assets/stylesheets/generic/highlight.scss b/app/assets/stylesheets/generic/highlight.scss deleted file mode 100644 index 2e13ee842e0..00000000000 --- a/app/assets/stylesheets/generic/highlight.scss +++ /dev/null @@ -1,70 +0,0 @@ -.file-content.code { - border: none; - box-shadow: none; - margin: 0px; - padding: 0px; - table-layout: fixed; - - pre { - padding: 10px; - border: none; - border-radius: 0; - font-family: $monospace_font; - font-size: $code_font_size !important; - line-height: $code_line_height !important; - margin: 0; - overflow: auto; - overflow-y: hidden; - white-space: pre; - word-wrap: normal; - - code { - font-family: $monospace_font; - white-space: pre; - word-wrap: normal; - padding: 0; - - .line { - display: inline; - } - } - } - - .line-numbers { - padding: 10px; - text-align: right; - float: left; - - a { - font-family: $monospace_font; - display: block; - font-size: $code_font_size !important; - line-height: $code_line_height !important; - white-space: nowrap; - - i { - visibility: hidden; - @extend .pull-left; - } - - &:hover i { - visibility: visible; - } - } - } -} - -.note-text .code { - border: none; - box-shadow: none; - background: $background-color; - padding: 1em; - overflow-x: auto; - - code { - font-family: $monospace_font; - white-space: pre; - word-wrap: normal; - padding: 0; - } -} diff --git a/app/assets/stylesheets/generic/issue_box.scss b/app/assets/stylesheets/generic/issue_box.scss deleted file mode 100644 index 9558f241b7c..00000000000 --- a/app/assets/stylesheets/generic/issue_box.scss +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Issue box for showing Open/Closed state: - * Used for Issue#show page, MergeRequest#show page etc - * - */ - -.issue-box { - display: inline-block; - padding: 7px 13px; - font-weight: normal; - margin-right: 5px; - - &.issue-box-closed { - background-color: $gl-danger; - color: #FFF; - } - - &.issue-box-merged { - background-color: $gl-primary; - color: #FFF; - } - - &.issue-box-open { - background-color: $gl-success; - color: #FFF; - } - - &.issue-box-expired { - background: #cea61b; - color: #FFF; - } -} diff --git a/app/assets/stylesheets/generic/jquery.scss b/app/assets/stylesheets/generic/jquery.scss deleted file mode 100644 index 871b808bad4..00000000000 --- a/app/assets/stylesheets/generic/jquery.scss +++ /dev/null @@ -1,55 +0,0 @@ -.ui-widget { - font-family: $regular_font; - font-size: $font-size-base; - - &.ui-datepicker-inline { - border: 1px solid #DDD; - padding: 10px; - width: 270px; - - .ui-datepicker-header { - background: #FFF; - border-color: #DDD; - } - - .ui-datepicker-calendar td a { - padding: 5px; - text-align: center; - } - } - - &.ui-autocomplete { - border-color: #DDD; - padding: 0; - margin-top: 2px; - z-index: 1001; - - .ui-menu-item a { - padding: 4px 10px; - } - } - - .ui-state-default { - border: 1px solid #FFF; - background: #FFF; - color: #777; - } - - .ui-state-highlight { - border: 1px solid #EEE; - background: #EEE; - } - - .ui-state-active { - border: 1px solid $gl-primary; - background: $gl-primary; - color: #FFF; - } - - .ui-state-hover, - .ui-state-focus { - border: 1px solid $hover; - background: $hover; - color: #333; - } -} diff --git a/app/assets/stylesheets/generic/lists.scss b/app/assets/stylesheets/generic/lists.scss deleted file mode 100644 index 08bf6e943d2..00000000000 --- a/app/assets/stylesheets/generic/lists.scss +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Well styled list - * - */ -.well-list { - margin: 0; - padding: 0; - list-style: none; - - li { - padding: 10px 15px; - min-height: 20px; - border-bottom: 1px solid #eee; - border-bottom: 1px solid rgba(0, 0, 0, 0.05); - - &:after { - content: " "; - display: table; - clear: both; - } - - &.disabled { - color: #888; - } - - &.unstyled { - &:hover { - background: none; - } - } - - &.warning-row { - background-color: #fcf8e3; - border-color: #faebcc; - color: #8a6d3b; - } - - &.smoke { background-color: $background-color; } - - &:hover { - background: $hover; - border-bottom: 1px solid darken($hover, 10%); - } - - &:last-child { - border-bottom: none; - - &.bottom { - background: $background-color; - } - } - - .author { color: #999; } - - .list-item-name { - float: left; - position: relative; - top: 3px; - } - - p { - padding-top: 1px; - margin: 0; - color: $gray-dark; - img { - position: relative; - top: 3px; - } - } - - .well-title { - font-size: $list-font-size; - line-height: 18px; - } - - .row_title { - color: $gray-dark; - - &:hover { - color: $text-color; - text-decoration: underline; - } - } - } -} - -ol, ul { - &.styled { - li { - padding: 2px; - } - } -} - -/** light list with border-bottom between li **/ -ul.bordered-list { - margin: 5px 0px; - padding: 0px; - li { - padding: 5px 0; - border-bottom: 1px solid #EEE; - overflow: hidden; - display: block; - margin: 0px; - &:last-child { border:none } - &.active { - background: #f9f9f9; - a { font-weight: bold; } - } - - &.light { - a { color: #777; } - } - } - - &.top-list { - li:first-child { - padding-top: 0; - h4, h5 { - margin-top: 0; - } - } - } -} - -li.task-list-item { - list-style-type: none; -} diff --git a/app/assets/stylesheets/generic/markdown_area.scss b/app/assets/stylesheets/generic/markdown_area.scss deleted file mode 100644 index eb39b6bb7e9..00000000000 --- a/app/assets/stylesheets/generic/markdown_area.scss +++ /dev/null @@ -1,87 +0,0 @@ -.div-dropzone-wrapper { - .div-dropzone { - position: relative; - padding: 0; - border: 0; - margin-bottom: 5px; - - .div-dropzone-focus { - border-color: #66afe9 !important; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6) !important; - outline: 0 !important; - } - - .div-dropzone-hover { - position: absolute; - top: 50%; - left: 50%; - margin-top: -0.5em; - margin-left: -0.6em; - opacity: 0; - font-size: 50px; - transition: opacity 200ms ease-in-out; - pointer-events: none; - } - - .div-dropzone-spinner { - position: absolute; - top: 100%; - left: 100%; - margin-top: -1.1em; - margin-left: -1.1em; - opacity: 0; - font-size: 30px; - transition: opacity 200ms ease-in-out; - } - - .div-dropzone-icon { - display: block; - text-align: center; - font-size: inherit; - } - - .dz-preview { - display: none; - } - } -} - -.div-dropzone-alert { - margin-top: 5px; - margin-bottom: 0; - transition: opacity 200ms ease-in-out; -} - -.md-preview-holder { - background: #FFF; - border: 1px solid #ddd; - min-height: 100px; - padding: 5px; - box-shadow: none; -} - -.new_note, -.edit_note, -.issuable-description, -.milestone-description, -.wiki-content, -.merge-request-form { - .nav-tabs { - margin-bottom: 0; - border: none; - - li a, - li.active a { - border: 1px solid #DDD; - } - } -} - -.markdown-area { - background: #FFF; - border: 1px solid #ddd; - min-height: 100px; - padding: 5px; - box-shadow: none; - width: 100%; -} diff --git a/app/assets/stylesheets/generic/mobile.scss b/app/assets/stylesheets/generic/mobile.scss deleted file mode 100644 index 71a1fc4493f..00000000000 --- a/app/assets/stylesheets/generic/mobile.scss +++ /dev/null @@ -1,69 +0,0 @@ -/** Common mobile (screen XS, SM) styles **/ -@media (max-width: $screen-xs-max) { - .container .content { - margin-top: 20px; - } - - .nav.nav-tabs > li > a { - padding: 10px; - font-size: 12px; - margin-right: 3px; - - .badge { - display: none; - } - } - - .issues-filters, - .dash-projects-filters, - .check-all-holder { - display: none; - } - - .rss-btn { - display: none !important; - } - - .project-home-links { - display: none; - } -} - -@media (max-width: $screen-sm-max) { - .issues-filters { - .milestone-filter, .labels-filter { - display: none; - } - } - - .page-title { - .note_created_ago, .new-issue-link { - display: none; - } - } - - .issue_edited_ago, .note_edited_ago { - display: none; - } - - aside { - display: none; - } - - .show-aside { - display: block !important; - } -} - -.show-aside { - display: none; - position: fixed; - right: 0px; - top: 30%; - padding: 5px 15px; - background: #EEE; - font-size: 20px; - color: #777; - z-index: 100; - @include box-shadow(0 1px 2px #DDD); -} diff --git a/app/assets/stylesheets/generic/nav_sidebar.scss b/app/assets/stylesheets/generic/nav_sidebar.scss deleted file mode 100644 index 3bcb7b81333..00000000000 --- a/app/assets/stylesheets/generic/nav_sidebar.scss +++ /dev/null @@ -1,193 +0,0 @@ -.page-with-sidebar { - background: $background-color; - - .sidebar-wrapper { - position: fixed; - top: 0; - left: 0; - height: 100%; - border-right: 1px solid $border-color; - } -} - -.sidebar-wrapper { - z-index: 99; - background: $background-color; -} - -.content-wrapper { - width: 100%; - padding: 15px; - background: #FFF; -} - -.nav-sidebar { - margin: 0; - list-style: none; - - &.navbar-collapse { - padding: 0px !important; - } -} - -.nav-sidebar li a .count { - float: right; - background: #eee; - padding: 0px 8px; - @include border-radius(6px); -} - -.nav-sidebar li { - &.active a { - color: $text-color; - background: #FFF !important; - font-weight: bold; - border: 1px solid #EEE; - border-right: 1px solid transparent; - border-left: 3px solid $style_color; - - &.no-highlight { - background: none !important; - border: none; - } - - i { - color: $text-color; - } - } -} - -.nav-sidebar li { - &.separate-item { - border-top: 1px solid $border-color; - padding-top: 10px; - margin-top: 10px; - } - - a { - color: $gray; - display: block; - text-decoration: none; - padding: 8px 15px; - font-size: 13px; - line-height: 20px; - padding-left: 20px; - - &:hover { - text-decoration: none; - color: $text-color; - background: $border-color; - } - - &:active, &:focus { - text-decoration: none; - } - - i { - width: 20px; - color: $gray-light; - margin-right: 23px; - } - } -} - -.sidebar-subnav { - margin-left: 0px; - padding-left: 0px; - - li { - list-style: none; - } -} - -@mixin expanded-sidebar { - padding-left: $sidebar_width; - - .sidebar-wrapper { - width: $sidebar_width; - - .nav-sidebar { - margin-top: 29px; - position: fixed; - top: 45px; - width: $sidebar_width; - } - } - - .content-wrapper { - padding: 20px; - } -} - -@mixin folded-sidebar { - padding-left: 50px; - - .sidebar-wrapper { - width: 52px; - - .nav-sidebar { - margin-top: 29px; - position: fixed; - top: 45px; - width: 52px; - - li a { - padding-left: 18px; - font-size: 14px; - padding: 8px 15px; - text-align: center; - - - & > span { - display: none; - } - } - } - - .collapse-nav a { - left: 0px; - padding: 7px 23px 3px 22px; - } - } -} - -.collapse-nav a { - position: fixed; - top: 46px; - padding: 5px 13px 5px 13px; - left: 198px; - font-size: 13px; - background: transparent; - color: black; - border-left: 1px solid $border-color; - border-bottom: 1px solid $border-color; -} - -.collapse-nav a:hover { - text-decoration: none; - background: #f2f6f7; -} - -@media (max-width: $screen-md-max) { - .page-sidebar-collapsed { - @include folded-sidebar; - } - - .page-sidebar-expanded { - @include folded-sidebar; - } - - .collapse-nav { - display: none; - } -} - -@media(min-width: $screen-md-max) { - .page-sidebar-collapsed { - @include folded-sidebar; - } - - .page-sidebar-expanded { - @include expanded-sidebar; - } -} diff --git a/app/assets/stylesheets/generic/selects.scss b/app/assets/stylesheets/generic/selects.scss deleted file mode 100644 index d8e0dc028d1..00000000000 --- a/app/assets/stylesheets/generic/selects.scss +++ /dev/null @@ -1,118 +0,0 @@ -/** Select2 selectbox style override **/ -.select2-container, .select2-container.select2-drop-above { - .select2-choice { - background: #FFF; - border-color: #DDD; - height: 34px; - padding: 6px 14px; - font-size: 14px; - line-height: 1.42857143; - - @include border-radius(4px); - - .select2-arrow { - background: #FFF; - border-left: none; - padding-top: 3px; - } - } -} - -.select2-container-multi .select2-choices { - @include border-radius(4px); - border-color: #CCC; -} - -.select2-container-multi .select2-choices .select2-search-field input { - padding: 8px 14px; - font-size: 13px; - line-height: 18px; - height: auto; -} - -.select2-drop-active { - border: 1px solid #BBB !important; - margin-top: 4px; - font-size: 13px; - - &.select2-drop-above { - margin-bottom: 8px; - } - - .select2-search input { - background: #fafafa; - border-color: #DDD; - } - - .select2-results { - max-height: 350px; - .select2-highlighted { - background: $gl-primary; - } - } -} - -.select2-container { - width: 100% !important; -} - -/** Branch/tag selector **/ -.project-refs-form .select2-container { - width: 160px !important; -} - -.ajax-users-dropdown, .ajax-project-users-dropdown { - .select2-search { - padding-top: 4px; - } -} - -.ajax-users-select { - width: 400px; - - &.input-large { - width: 210px; - } - - &.input-clamp { - max-width: 100%; - } -} - -.group-result { - .group-image { - float: left; - } - .group-name { - font-weight: bold; - } - .group-path { - color: #999; - } -} - -.user-result { - .user-image { - float: left; - } - .user-name { - } - .user-username { - color: #999; - } -} - -.namespace-result { - .namespace-kind { - color: #AAA; - font-weight: normal; - } - .namespace-path { - margin-left: 10px; - font-weight: bolder; - } -} - -.ajax-users-dropdown { - min-width: 225px !important; -} diff --git a/app/assets/stylesheets/generic/tables.scss b/app/assets/stylesheets/generic/tables.scss deleted file mode 100644 index a66e45577de..00000000000 --- a/app/assets/stylesheets/generic/tables.scss +++ /dev/null @@ -1,20 +0,0 @@ -table { - &.table { - tr { - td, th { - padding: 8px 10px; - line-height: 20px; - vertical-align: middle; - } - th { - font-weight: normal; - font-size: 15px; - border-bottom: 1px solid $border-color !important; - } - td { - border-color: #F1F1F1 !important; - border-bottom: 1px solid; - } - } - } -} diff --git a/app/assets/stylesheets/generic/timeline.scss b/app/assets/stylesheets/generic/timeline.scss deleted file mode 100644 index 97831eb7c27..00000000000 --- a/app/assets/stylesheets/generic/timeline.scss +++ /dev/null @@ -1,134 +0,0 @@ -.timeline { - list-style: none; - padding: 20px 0 20px; - position: relative; - - &:before { - top: 0; - bottom: 0; - position: absolute; - content: " "; - width: 3px; - background-color: #eeeeee; - margin-left: 29px; - } - - .timeline-entry { - position: relative; - margin-top: 5px; - margin-left: 30px; - margin-bottom: 10px; - clear: both; - - - &:target { - .timeline-entry-inner .timeline-content { - -webkit-animation:target-note 2s linear; - background: $hover; - } - } - - .timeline-entry-inner { - position: relative; - margin-left: -20px; - - &:before, &:after { - content: " "; - display: table; - } - - .timeline-icon { - margin-top: 2px; - background: #fff; - color: #737881; - float: left; - @include border-radius($avatar_radius); - @include box-shadow(0 0 0 3px #EEE); - overflow: hidden; - - .avatar { - margin: 0; - padding: 0; - } - } - - .timeline-content { - position: relative; - background: $background-color; - padding: 10px 15px; - margin-left: 60px; - - img { - max-width: 100%; - } - - &:after { - content: ''; - display: block; - position: absolute; - width: 0; - height: 0; - border-style: solid; - border-width: 9px 9px 9px 0; - border-color: transparent $background-color transparent transparent; - left: 0; - top: 10px; - margin-left: -9px; - } - } - } - } - - .system-note .timeline-entry-inner { - .timeline-icon { - background: none; - margin-left: 12px; - margin-top: 0; - @include box-shadow(none); - - span { - margin: 0 2px; - font-size: 16px; - color: #eeeeee; - } - } - - .timeline-content { - background: none; - margin-left: 45px; - padding: 0px 15px; - - &:after { border: 0; } - - .note-header { - span { font-size: 12px; } - - .avatar { - margin-right: 5px; - } - } - - .note-text { - font-size: 12px; - margin-left: 20px; - } - } - } -} - -@media (max-width: $screen-xs-max) { - .timeline { - &:before { - background: none; - } - .timeline-entry .timeline-entry-inner { - .timeline-icon { - display: none; - } - - .timeline-content { - margin-left: 0; - } - } - } -} diff --git a/app/assets/stylesheets/generic/typography.scss b/app/assets/stylesheets/generic/typography.scss deleted file mode 100644 index 80190424c1b..00000000000 --- a/app/assets/stylesheets/generic/typography.scss +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Headers - * - */ -.page-title { - margin-top: 0px; - line-height: 1.5; - font-weight: normal; - margin-bottom: 5px; -} - -/** CODE **/ -pre { - font-family: $monospace_font; - - &.dark { - background: #333; - color: $background-color; - } -} - -.monospace { - font-family: $monospace_font; -} - -/** - * Wiki typography - * - */ -.wiki { - @include md-typography; - - word-wrap: break-word; - - /* Link to current header. */ - h1, h2, h3, h4, h5, h6 { - position: relative; - &:hover > :last-child { - $size: 16px; - position: absolute; - right: 100%; - top: 50%; - margin-top: -$size/2; - margin-right: 0px; - padding-right: 20px; - display: inline-block; - width: $size; - height: $size; - background-image: image-url("icon-link.png"); - background-size: contain; - background-repeat: no-repeat; - } - } - - ul { - padding: 0; - margin: 0 0 9px 25px !important; - } -} - -.md { - @include md-typography; -} - -/** - * Textareas intended for GFM - * - */ -textarea.js-gfm-input { - font-family: $monospace_font; -} - -.strikethrough { - text-decoration: line-through; -} diff --git a/app/assets/stylesheets/generic/zen.scss b/app/assets/stylesheets/generic/zen.scss deleted file mode 100644 index 26afc21a6ab..00000000000 --- a/app/assets/stylesheets/generic/zen.scss +++ /dev/null @@ -1,98 +0,0 @@ -.zennable { - position: relative; - - input { - display: none; - } - - .zen-enter-link { - color: #888; - position: absolute; - top: -26px; - right: 4px; - } - - .zen-leave-link { - display: none; - color: #888; - position: absolute; - top: 10px; - right: 10px; - padding: 5px; - font-size: 36px; - - &:hover { - color: #111; - } - } - - input:checked ~ .zen-backdrop .zen-enter-link { - display: none; - } - - input:checked ~ .zen-backdrop .zen-leave-link { - display: block; - position: absolute; - top: 0; - } - - input:checked ~ .zen-backdrop { - background-color: white; - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - z-index: 1031; - - textarea { - border: none; - box-shadow: none; - border-radius: 0; - color: #000; - font-size: 20px; - line-height: 26px; - padding: 30px; - display: block; - outline: none; - resize: none; - height: 100vh; - max-width: 900px; - margin: 0 auto; - } - } - - .zen-backdrop textarea::-webkit-input-placeholder { - color: white; - } - - .zen-backdrop textarea:-moz-placeholder { - color: white; - } - - .zen-backdrop textarea::-moz-placeholder { - color: white; - } - - .zen-backdrop textarea:-ms-input-placeholder { - color: white; - } - - input:checked ~ .zen-backdrop textarea::-webkit-input-placeholder { - color: #999; - } - - input:checked ~ .zen-backdrop textarea:-moz-placeholder { - color: #999; - opacity: 1; - } - - input:checked ~ .zen-backdrop textarea::-moz-placeholder { - color: #999; - opacity: 1; - } - - input:checked ~ .zen-backdrop textarea:-ms-input-placeholder { - color: #999; - } -} diff --git a/app/assets/stylesheets/highlight/dark.scss b/app/assets/stylesheets/highlight/dark.scss deleted file mode 100644 index c8cb18ec35f..00000000000 --- a/app/assets/stylesheets/highlight/dark.scss +++ /dev/null @@ -1,88 +0,0 @@ -/* https://github.com/MozMorris/tomorrow-pygments */ -pre.code.highlight.dark, -.code.dark { - - background-color: #1d1f21; - color: #c5c8c6; - - pre.code, - .line-numbers, - .line-numbers a { - background-color: #1d1f21 !important; - color: #c5c8c6 !important; - } - - pre.code { - border-left: 1px solid #666; - } - - // highlight line via anchor - pre .hll { - background-color: #557 !important; - } - - .hll { background-color: #373b41 } - .c { color: #969896 } /* Comment */ - .err { color: #cc6666 } /* Error */ - .k { color: #b294bb } /* Keyword */ - .l { color: #de935f } /* Literal */ - .n { color: #c5c8c6 } /* Name */ - .o { color: #8abeb7 } /* Operator */ - .p { color: #c5c8c6 } /* Punctuation */ - .cm { color: #969896 } /* Comment.Multiline */ - .cp { color: #969896 } /* Comment.Preproc */ - .c1 { color: #969896 } /* Comment.Single */ - .cs { color: #969896 } /* Comment.Special */ - .gd { color: #cc6666 } /* Generic.Deleted */ - .ge { font-style: italic } /* Generic.Emph */ - .gh { color: #c5c8c6; font-weight: bold } /* Generic.Heading */ - .gi { color: #b5bd68 } /* Generic.Inserted */ - .gp { color: #969896; font-weight: bold } /* Generic.Prompt */ - .gs { font-weight: bold } /* Generic.Strong */ - .gu { color: #8abeb7; font-weight: bold } /* Generic.Subheading */ - .kc { color: #b294bb } /* Keyword.Constant */ - .kd { color: #b294bb } /* Keyword.Declaration */ - .kn { color: #8abeb7 } /* Keyword.Namespace */ - .kp { color: #b294bb } /* Keyword.Pseudo */ - .kr { color: #b294bb } /* Keyword.Reserved */ - .kt { color: #f0c674 } /* Keyword.Type */ - .ld { color: #b5bd68 } /* Literal.Date */ - .m { color: #de935f } /* Literal.Number */ - .s { color: #b5bd68 } /* Literal.String */ - .na { color: #81a2be } /* Name.Attribute */ - .nb { color: #c5c8c6 } /* Name.Builtin */ - .nc { color: #f0c674 } /* Name.Class */ - .no { color: #cc6666 } /* Name.Constant */ - .nd { color: #8abeb7 } /* Name.Decorator */ - .ni { color: #c5c8c6 } /* Name.Entity */ - .ne { color: #cc6666 } /* Name.Exception */ - .nf { color: #81a2be } /* Name.Function */ - .nl { color: #c5c8c6 } /* Name.Label */ - .nn { color: #f0c674 } /* Name.Namespace */ - .nx { color: #81a2be } /* Name.Other */ - .py { color: #c5c8c6 } /* Name.Property */ - .nt { color: #8abeb7 } /* Name.Tag */ - .nv { color: #cc6666 } /* Name.Variable */ - .ow { color: #8abeb7 } /* Operator.Word */ - .w { color: #c5c8c6 } /* Text.Whitespace */ - .mf { color: #de935f } /* Literal.Number.Float */ - .mh { color: #de935f } /* Literal.Number.Hex */ - .mi { color: #de935f } /* Literal.Number.Integer */ - .mo { color: #de935f } /* Literal.Number.Oct */ - .sb { color: #b5bd68 } /* Literal.String.Backtick */ - .sc { color: #c5c8c6 } /* Literal.String.Char */ - .sd { color: #969896 } /* Literal.String.Doc */ - .s2 { color: #b5bd68 } /* Literal.String.Double */ - .se { color: #de935f } /* Literal.String.Escape */ - .sh { color: #b5bd68 } /* Literal.String.Heredoc */ - .si { color: #de935f } /* Literal.String.Interpol */ - .sx { color: #b5bd68 } /* Literal.String.Other */ - .sr { color: #b5bd68 } /* Literal.String.Regex */ - .s1 { color: #b5bd68 } /* Literal.String.Single */ - .ss { color: #b5bd68 } /* Literal.String.Symbol */ - .bp { color: #c5c8c6 } /* Name.Builtin.Pseudo */ - .vc { color: #cc6666 } /* Name.Variable.Class */ - .vg { color: #cc6666 } /* Name.Variable.Global */ - .vi { color: #cc6666 } /* Name.Variable.Instance */ - .il { color: #de935f } /* Literal.Number.Integer.Long */ -} diff --git a/app/assets/stylesheets/highlight/monokai.scss b/app/assets/stylesheets/highlight/monokai.scss deleted file mode 100644 index 001e8b31020..00000000000 --- a/app/assets/stylesheets/highlight/monokai.scss +++ /dev/null @@ -1,88 +0,0 @@ -/* https://github.com/richleland/pygments-css/blob/master/monokai.css */ -pre.code.monokai, -.code.monokai { - - background: #272822; - color: #f8f8f2; - - pre.highlight, - .line-numbers, - .line-numbers a { - background:#272822 !important; - color:#f8f8f2 !important; - } - - pre.code { - border-left: 1px solid #555; - } - - // highlight line via anchor - pre .hll { - background-color: #49483e !important; - } - - .hll { background-color: #49483e } - .c { color: #75715e } /* Comment */ - .err { color: #960050; background-color: #1e0010 } /* Error */ - .k { color: #66d9ef } /* Keyword */ - .l { color: #ae81ff } /* Literal */ - .n { color: #f8f8f2 } /* Name */ - .o { color: #f92672 } /* Operator */ - .p { color: #f8f8f2 } /* Punctuation */ - .cm { color: #75715e } /* Comment.Multiline */ - .cp { color: #75715e } /* Comment.Preproc */ - .c1 { color: #75715e } /* Comment.Single */ - .cs { color: #75715e } /* Comment.Special */ - .ge { font-style: italic } /* Generic.Emph */ - .gs { font-weight: bold } /* Generic.Strong */ - .kc { color: #66d9ef } /* Keyword.Constant */ - .kd { color: #66d9ef } /* Keyword.Declaration */ - .kn { color: #f92672 } /* Keyword.Namespace */ - .kp { color: #66d9ef } /* Keyword.Pseudo */ - .kr { color: #66d9ef } /* Keyword.Reserved */ - .kt { color: #66d9ef } /* Keyword.Type */ - .ld { color: #e6db74 } /* Literal.Date */ - .m { color: #ae81ff } /* Literal.Number */ - .s { color: #e6db74 } /* Literal.String */ - .na { color: #a6e22e } /* Name.Attribute */ - .nb { color: #f8f8f2 } /* Name.Builtin */ - .nc { color: #a6e22e } /* Name.Class */ - .no { color: #66d9ef } /* Name.Constant */ - .nd { color: #a6e22e } /* Name.Decorator */ - .ni { color: #f8f8f2 } /* Name.Entity */ - .ne { color: #a6e22e } /* Name.Exception */ - .nf { color: #a6e22e } /* Name.Function */ - .nl { color: #f8f8f2 } /* Name.Label */ - .nn { color: #f8f8f2 } /* Name.Namespace */ - .nx { color: #a6e22e } /* Name.Other */ - .py { color: #f8f8f2 } /* Name.Property */ - .nt { color: #f92672 } /* Name.Tag */ - .nv { color: #f8f8f2 } /* Name.Variable */ - .ow { color: #f92672 } /* Operator.Word */ - .w { color: #f8f8f2 } /* Text.Whitespace */ - .mf { color: #ae81ff } /* Literal.Number.Float */ - .mh { color: #ae81ff } /* Literal.Number.Hex */ - .mi { color: #ae81ff } /* Literal.Number.Integer */ - .mo { color: #ae81ff } /* Literal.Number.Oct */ - .sb { color: #e6db74 } /* Literal.String.Backtick */ - .sc { color: #e6db74 } /* Literal.String.Char */ - .sd { color: #e6db74 } /* Literal.String.Doc */ - .s2 { color: #e6db74 } /* Literal.String.Double */ - .se { color: #ae81ff } /* Literal.String.Escape */ - .sh { color: #e6db74 } /* Literal.String.Heredoc */ - .si { color: #e6db74 } /* Literal.String.Interpol */ - .sx { color: #e6db74 } /* Literal.String.Other */ - .sr { color: #e6db74 } /* Literal.String.Regex */ - .s1 { color: #e6db74 } /* Literal.String.Single */ - .ss { color: #e6db74 } /* Literal.String.Symbol */ - .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ - .vc { color: #f8f8f2 } /* Name.Variable.Class */ - .vg { color: #f8f8f2 } /* Name.Variable.Global */ - .vi { color: #f8f8f2 } /* Name.Variable.Instance */ - .il { color: #ae81ff } /* Literal.Number.Integer.Long */ - - .gh { } /* Generic Heading & Diff Header */ - .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */ - .gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */ - .gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */ -} diff --git a/app/assets/stylesheets/highlight/solarized_dark.scss b/app/assets/stylesheets/highlight/solarized_dark.scss deleted file mode 100644 index f5b827e7c02..00000000000 --- a/app/assets/stylesheets/highlight/solarized_dark.scss +++ /dev/null @@ -1,110 +0,0 @@ -/* https://gist.github.com/qguv/7936275 */ -pre.code.highlight.solarized-dark, -.code.solarized-dark { - - background-color: #002b36; - color: #93a1a1; - - pre.code, - .line-numbers, - .line-numbers a { - background-color: #002b36 !important; - color: #93a1a1 !important; - } - - pre.code { - border-left: 1px solid #113b46; - } - - // highlight line via anchor - pre .hll { - background-color: #174652 !important; - } - - /* Solarized Dark - - For use with Jekyll and Pygments - - http://ethanschoonover.com/solarized - - SOLARIZED HEX ROLE - --------- -------- ------------------------------------------ - base03 #002b36 background - base01 #586e75 comments / secondary content - base1 #93a1a1 body text / default code / primary content - orange #cb4b16 constants - red #dc322f regex, special keywords - blue #268bd2 reserved keywords - cyan #2aa198 strings, numbers - green #859900 operators, other keywords - */ - - .c { color: #586e75 } /* Comment */ - .err { color: #93a1a1 } /* Error */ - .g { color: #93a1a1 } /* Generic */ - .k { color: #859900 } /* Keyword */ - .l { color: #93a1a1 } /* Literal */ - .n { color: #93a1a1 } /* Name */ - .o { color: #859900 } /* Operator */ - .x { color: #cb4b16 } /* Other */ - .p { color: #93a1a1 } /* Punctuation */ - .cm { color: #586e75 } /* Comment.Multiline */ - .cp { color: #859900 } /* Comment.Preproc */ - .c1 { color: #586e75 } /* Comment.Single */ - .cs { color: #859900 } /* Comment.Special */ - .gd { color: #2aa198 } /* Generic.Deleted */ - .ge { color: #93a1a1; font-style: italic } /* Generic.Emph */ - .gr { color: #dc322f } /* Generic.Error */ - .gh { color: #cb4b16 } /* Generic.Heading */ - .gi { color: #859900 } /* Generic.Inserted */ - .go { color: #93a1a1 } /* Generic.Output */ - .gp { color: #93a1a1 } /* Generic.Prompt */ - .gs { color: #93a1a1; font-weight: bold } /* Generic.Strong */ - .gu { color: #cb4b16 } /* Generic.Subheading */ - .gt { color: #93a1a1 } /* Generic.Traceback */ - .kc { color: #cb4b16 } /* Keyword.Constant */ - .kd { color: #268bd2 } /* Keyword.Declaration */ - .kn { color: #859900 } /* Keyword.Namespace */ - .kp { color: #859900 } /* Keyword.Pseudo */ - .kr { color: #268bd2 } /* Keyword.Reserved */ - .kt { color: #dc322f } /* Keyword.Type */ - .ld { color: #93a1a1 } /* Literal.Date */ - .m { color: #2aa198 } /* Literal.Number */ - .s { color: #2aa198 } /* Literal.String */ - .na { color: #93a1a1 } /* Name.Attribute */ - .nb { color: #B58900 } /* Name.Builtin */ - .nc { color: #268bd2 } /* Name.Class */ - .no { color: #cb4b16 } /* Name.Constant */ - .nd { color: #268bd2 } /* Name.Decorator */ - .ni { color: #cb4b16 } /* Name.Entity */ - .ne { color: #cb4b16 } /* Name.Exception */ - .nf { color: #268bd2 } /* Name.Function */ - .nl { color: #93a1a1 } /* Name.Label */ - .nn { color: #93a1a1 } /* Name.Namespace */ - .nx { color: #93a1a1 } /* Name.Other */ - .py { color: #93a1a1 } /* Name.Property */ - .nt { color: #268bd2 } /* Name.Tag */ - .nv { color: #268bd2 } /* Name.Variable */ - .ow { color: #859900 } /* Operator.Word */ - .w { color: #93a1a1 } /* Text.Whitespace */ - .mf { color: #2aa198 } /* Literal.Number.Float */ - .mh { color: #2aa198 } /* Literal.Number.Hex */ - .mi { color: #2aa198 } /* Literal.Number.Integer */ - .mo { color: #2aa198 } /* Literal.Number.Oct */ - .sb { color: #586e75 } /* Literal.String.Backtick */ - .sc { color: #2aa198 } /* Literal.String.Char */ - .sd { color: #93a1a1 } /* Literal.String.Doc */ - .s2 { color: #2aa198 } /* Literal.String.Double */ - .se { color: #cb4b16 } /* Literal.String.Escape */ - .sh { color: #93a1a1 } /* Literal.String.Heredoc */ - .si { color: #2aa198 } /* Literal.String.Interpol */ - .sx { color: #2aa198 } /* Literal.String.Other */ - .sr { color: #dc322f } /* Literal.String.Regex */ - .s1 { color: #2aa198 } /* Literal.String.Single */ - .ss { color: #2aa198 } /* Literal.String.Symbol */ - .bp { color: #268bd2 } /* Name.Builtin.Pseudo */ - .vc { color: #268bd2 } /* Name.Variable.Class */ - .vg { color: #268bd2 } /* Name.Variable.Global */ - .vi { color: #268bd2 } /* Name.Variable.Instance */ - .il { color: #2aa198 } /* Literal.Number.Integer.Long */ -} diff --git a/app/assets/stylesheets/highlight/solarized_light.scss b/app/assets/stylesheets/highlight/solarized_light.scss deleted file mode 100644 index 6b44c00c305..00000000000 --- a/app/assets/stylesheets/highlight/solarized_light.scss +++ /dev/null @@ -1,110 +0,0 @@ -/* https://gist.github.com/qguv/7936275 */ -pre.code.highlight.solarized-light, -.code.solarized-light { - - background-color: #fdf6e3; - color: #586e75; - - pre.code, - .line-numbers, - .line-numbers a { - background-color: #fdf6e3 !important; - color: #586e75 !important; - } - - pre.code { - border-left: 1px solid #c5d0d4; - } - - // highlight line via anchor - pre .hll { - background-color: #ddd8c5 !important; - } - - /* Solarized Light - - For use with Jekyll and Pygments - - http://ethanschoonover.com/solarized - - SOLARIZED HEX ROLE - --------- -------- ------------------------------------------ - base01 #586e75 body text / default code / primary content - base1 #93a1a1 comments / secondary content - base3 #fdf6e3 background - orange #cb4b16 constants - red #dc322f regex, special keywords - blue #268bd2 reserved keywords - cyan #2aa198 strings, numbers - green #859900 operators, other keywords - */ - - .c { color: #93a1a1 } /* Comment */ - .err { color: #586e75 } /* Error */ - .g { color: #586e75 } /* Generic */ - .k { color: #859900 } /* Keyword */ - .l { color: #586e75 } /* Literal */ - .n { color: #586e75 } /* Name */ - .o { color: #859900 } /* Operator */ - .x { color: #cb4b16 } /* Other */ - .p { color: #586e75 } /* Punctuation */ - .cm { color: #93a1a1 } /* Comment.Multiline */ - .cp { color: #859900 } /* Comment.Preproc */ - .c1 { color: #93a1a1 } /* Comment.Single */ - .cs { color: #859900 } /* Comment.Special */ - .gd { color: #2aa198 } /* Generic.Deleted */ - .ge { color: #586e75; font-style: italic } /* Generic.Emph */ - .gr { color: #dc322f } /* Generic.Error */ - .gh { color: #cb4b16 } /* Generic.Heading */ - .gi { color: #859900 } /* Generic.Inserted */ - .go { color: #586e75 } /* Generic.Output */ - .gp { color: #586e75 } /* Generic.Prompt */ - .gs { color: #586e75; font-weight: bold } /* Generic.Strong */ - .gu { color: #cb4b16 } /* Generic.Subheading */ - .gt { color: #586e75 } /* Generic.Traceback */ - .kc { color: #cb4b16 } /* Keyword.Constant */ - .kd { color: #268bd2 } /* Keyword.Declaration */ - .kn { color: #859900 } /* Keyword.Namespace */ - .kp { color: #859900 } /* Keyword.Pseudo */ - .kr { color: #268bd2 } /* Keyword.Reserved */ - .kt { color: #dc322f } /* Keyword.Type */ - .ld { color: #586e75 } /* Literal.Date */ - .m { color: #2aa198 } /* Literal.Number */ - .s { color: #2aa198 } /* Literal.String */ - .na { color: #586e75 } /* Name.Attribute */ - .nb { color: #B58900 } /* Name.Builtin */ - .nc { color: #268bd2 } /* Name.Class */ - .no { color: #cb4b16 } /* Name.Constant */ - .nd { color: #268bd2 } /* Name.Decorator */ - .ni { color: #cb4b16 } /* Name.Entity */ - .ne { color: #cb4b16 } /* Name.Exception */ - .nf { color: #268bd2 } /* Name.Function */ - .nl { color: #586e75 } /* Name.Label */ - .nn { color: #586e75 } /* Name.Namespace */ - .nx { color: #586e75 } /* Name.Other */ - .py { color: #586e75 } /* Name.Property */ - .nt { color: #268bd2 } /* Name.Tag */ - .nv { color: #268bd2 } /* Name.Variable */ - .ow { color: #859900 } /* Operator.Word */ - .w { color: #586e75 } /* Text.Whitespace */ - .mf { color: #2aa198 } /* Literal.Number.Float */ - .mh { color: #2aa198 } /* Literal.Number.Hex */ - .mi { color: #2aa198 } /* Literal.Number.Integer */ - .mo { color: #2aa198 } /* Literal.Number.Oct */ - .sb { color: #93a1a1 } /* Literal.String.Backtick */ - .sc { color: #2aa198 } /* Literal.String.Char */ - .sd { color: #586e75 } /* Literal.String.Doc */ - .s2 { color: #2aa198 } /* Literal.String.Double */ - .se { color: #cb4b16 } /* Literal.String.Escape */ - .sh { color: #586e75 } /* Literal.String.Heredoc */ - .si { color: #2aa198 } /* Literal.String.Interpol */ - .sx { color: #2aa198 } /* Literal.String.Other */ - .sr { color: #dc322f } /* Literal.String.Regex */ - .s1 { color: #2aa198 } /* Literal.String.Single */ - .ss { color: #2aa198 } /* Literal.String.Symbol */ - .bp { color: #268bd2 } /* Name.Builtin.Pseudo */ - .vc { color: #268bd2 } /* Name.Variable.Class */ - .vg { color: #268bd2 } /* Name.Variable.Global */ - .vi { color: #268bd2 } /* Name.Variable.Instance */ - .il { color: #2aa198 } /* Literal.Number.Integer.Long */ -} diff --git a/app/assets/stylesheets/highlight/white.scss b/app/assets/stylesheets/highlight/white.scss deleted file mode 100644 index a52ffc971d1..00000000000 --- a/app/assets/stylesheets/highlight/white.scss +++ /dev/null @@ -1,87 +0,0 @@ -/* https://github.com/aahan/pygments-github-style */ -pre.code.highlight.white, -.code.white { - - background-color: #fff; - color: #333; - - pre.highlight, - .line-numbers, - .line-numbers a { - background-color: #fff !important; - color: #333 !important; - } - - pre.code { - border-left: 1px solid #bbb; - } - - // highlight line via anchor - pre .hll { - background-color: #f8eec7 !important; - } - - .hll { background-color: #f8f8f8 } - .c { color: #999988; font-style: italic; } - .err { color: #a61717; background-color: #e3d2d2; } - .k { font-weight: bold; } - .o { font-weight: bold; } - .cm { color: #999988; font-style: italic; } - .cp { color: #999999; font-weight: bold; } - .c1 { color: #999988; font-style: italic; } - .cs { color: #999999; font-weight: bold; font-style: italic; } - .gd { color: #000000; background-color: #ffdddd; } - .gd .x { color: #000000; background-color: #ffaaaa; } - .ge { font-style: italic; } - .gr { color: #aa0000; } - .gh { color: #999999; } - .gi { color: #000000; background-color: #ddffdd; } - .gi .x { color: #000000; background-color: #aaffaa; } - .go { color: #888888; } - .gp { color: #555555; } - .gs { font-weight: bold; } - .gu { color: #800080; font-weight: bold; } - .gt { color: #aa0000; } - .kc { font-weight: bold; } - .kd { font-weight: bold; } - .kn { font-weight: bold; } - .kp { font-weight: bold; } - .kr { font-weight: bold; } - .kt { color: #445588; font-weight: bold; } - .m { color: #009999; } - .s { color: #dd1144; } - .n { color: #333333; } - .na { color: teal; } - .nb { color: #0086b3; } - .nc { color: #445588; font-weight: bold; } - .no { color: teal; } - .ni { color: purple; } - .ne { color: #990000; font-weight: bold; } - .nf { color: #990000; font-weight: bold; } - .nn { color: #555555; } - .nt { color: navy; } - .nv { color: teal; } - .ow { font-weight: bold; } - .w { color: #bbbbbb; } - .mf { color: #009999; } - .mh { color: #009999; } - .mi { color: #009999; } - .mo { color: #009999; } - .sb { color: #dd1144; } - .sc { color: #dd1144; } - .sd { color: #dd1144; } - .s2 { color: #dd1144; } - .se { color: #dd1144; } - .sh { color: #dd1144; } - .si { color: #dd1144; } - .sx { color: #dd1144; } - .sr { color: #009926; } - .s1 { color: #dd1144; } - .ss { color: #990073; } - .bp { color: #999999; } - .vc { color: teal; } - .vg { color: teal; } - .vi { color: teal; } - .il { color: #009999; } - .gc { color: #999; background-color: #EAF2F5; } -} diff --git a/app/assets/stylesheets/pages/admin.scss b/app/assets/stylesheets/pages/admin.scss deleted file mode 100644 index 144852e7874..00000000000 --- a/app/assets/stylesheets/pages/admin.scss +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Admin area - * - */ -.admin-dashboard { - .data { - a { - h1 { - line-height: 48px; - font-size: 48px; - padding: 20px; - text-align: center; - font-weight: normal; - } - } - } - - .str-truncated { - max-width: 60%; - } -} - -.admin-filter form { - .select2-container { - width: 100% - } - - .controls { - margin-left: 130px; - } - - .form-actions { - padding-left: 130px; - background: #fff - } - - .visibility-levels { - .controls { - margin-bottom: 9px; - } - - i { - color: inherit; - } - } -} - -.broadcast-messages { - .message { - line-height: 2; - } -} - -.broadcast-message { - @extend .alert-warning; - padding: 10px; - text-align: center; -} - -.broadcast-message-preview { - @extend .broadcast-message; - margin-bottom: 20px; -} diff --git a/app/assets/stylesheets/pages/commit.scss b/app/assets/stylesheets/pages/commit.scss deleted file mode 100644 index e7125c03993..00000000000 --- a/app/assets/stylesheets/pages/commit.scss +++ /dev/null @@ -1,123 +0,0 @@ -.commit-title{ - display: block; -} - -.commit-title{ - margin-bottom: 10px; -} - -.commit-author, .commit-committer{ - display: block; - color: #999; - font-weight: normal; - font-style: italic; -} - -.commit-author strong, .commit-committer strong{ - font-weight: bold; - font-style: normal; -} - -.commit-description { - background: none; - border: none; - margin: 0; - padding: 0; - margin-top: 10px; -} - -.commit-stat-summary { - color: #666; - font-size: 14px; - font-weight: normal; - padding: 3px 0; - margin-bottom: 10px; -} - -.commit-info-row { - margin-bottom: 10px; - .avatar { - @extend .avatar-inline; - } - .commit-committer-link, - .commit-author-link { - color: #444; - font-weight: bold; - } -} - -.commit-box { - margin: 10px 0; - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - padding: 20px 0; - - .commit-title { - margin: 0; - } - - .commit-description { - margin-top: 15px; - } -} - -.file-stats a { - color: $style_color; -} - -.file-stats { - .new-file { - a { - color: #090; - } - i { - color: #1BCF00; - } - } - .renamed-file { - i { - color: #FE9300; - } - } - .deleted-file { - a { - color: #B00; - } - i { - color: #EE0000; - } - } - .edit-file{ - i{ - color: #555; - } - } -} - -/* - * Commit message textarea for web editor and - * custom merge request message - */ -.commit-message-container { - background-color: $body-bg; - position: relative; - font-family: $monospace_font; - $left: 12px; - .max-width-marker { - width: 72ch; - color: rgba(0, 0, 0, 0.0); - font-family: inherit; - left: $left; - height: 100%; - border-right: 1px solid mix($input-border, white); - position: absolute; - z-index: 1; - } - > textarea { - background-color: rgba(0, 0, 0, 0.0); - font-family: inherit; - padding-left: $left; - position: relative; - z-index: 2; - } -} diff --git a/app/assets/stylesheets/pages/commits.scss b/app/assets/stylesheets/pages/commits.scss deleted file mode 100644 index 84361e15481..00000000000 --- a/app/assets/stylesheets/pages/commits.scss +++ /dev/null @@ -1,118 +0,0 @@ -.commits-compare-switch{ - @extend .btn; - background: image-url("switch_icon.png") no-repeat center center; - text-indent: -9999px; - float: left; - margin-right: 9px; -} - -.lists-separator { - margin: 10px 0; - border-color: #DDD; -} - -.commits-row { - ul { - margin: 0; - - li.commit { - padding: 8px 0; - } - } - - .commits-row-date { - font-size: 15px; - line-height: 20px; - margin-bottom: 5px; - } -} - -.commits-feed-holder { - float: right; - - .btn { - padding: 4px 12px; - } -} - -li.commit { - .commit-row-title { - font-size: $list-font-size; - line-height: 20px; - margin-bottom: 2px; - - .notes_count { - float: right; - margin-right: 10px; - } - - .commit_short_id { - min-width: 65px; - font-family: $monospace_font; - } - - .str-truncated { - max-width: 70%; - } - - .commit-row-message { - color: #444; - - &:hover { - text-decoration: underline; - } - } - - .text-expander { - background: #eee; - color: #555; - padding: 0 5px; - cursor: pointer; - margin-left: 4px; - &:hover { - background-color: #ddd; - } - } - } - - .commit-row-description { - font-size: 14px; - border-left: 1px solid #EEE; - padding: 10px 15px; - margin: 5px 0 10px 5px; - background: #f9f9f9; - display: none; - - pre { - border: none; - background: inherit; - padding: 0; - margin: 0; - } - } - - .commit-row-info { - color: #777; - line-height: 24px; - font-size: 13px; - - a { - color: #777; - } - - .committed_ago { - display: inline-block; - } - } - - &.inline-commit { - .commit-row-title { - font-size: 13px; - } - - .committed_ago { - float: right; - @extend .cgray; - } - } -} diff --git a/app/assets/stylesheets/pages/dashboard.scss b/app/assets/stylesheets/pages/dashboard.scss deleted file mode 100644 index af9c83e5dc8..00000000000 --- a/app/assets/stylesheets/pages/dashboard.scss +++ /dev/null @@ -1,93 +0,0 @@ -.dashboard { - .side { - .panel { - .panel-heading { - background: #EEE; - border-top-left-radius: 0; - } - border-top-left-radius: 0; - } - } -} - -.dashboard-search-filter { - padding:5px; - - .search-text-input { - float:left; - @extend .col-md-2; - } - .btn { - margin-left: 5px; - float:left; - } -} - -.project-row, .group-row { - padding: 0 !important; - font-size: 14px; - line-height: 24px; - - .str-truncated { - max-width: 72%; - } - - a { - display: block; - padding: 8px 15px; - } - - .project-name, .group-name { - font-weight: 500; - } - - .arrow { - float: right; - margin: 0; - font-size: 20px; - } - - .last-activity { - float: right; - font-size: 12px; - color: #AAA; - display: block; - .date { - color: #777; - } - } -} - -.project-description { - overflow: hidden; -} - -.project-access-icon { - margin-left: 10px; - float: left; - margin-right: 15px; - margin-bottom: 15px; - - i { - color: #888; - } -} - -.dash-project-avatar { - float: left; - - .avatar { - margin-top: -8px; - margin-left: -15px; - @include border-radius(0px); - } - .identicon { - line-height: 40px; - } -} - -.dash-project-access-icon { - float: left; - margin-right: 5px; - width: 16px; -} diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss deleted file mode 100644 index af6ea58382f..00000000000 --- a/app/assets/stylesheets/pages/diff.scss +++ /dev/null @@ -1,358 +0,0 @@ -.diff-file { - border: 1px solid $border-color; - margin-bottom: 1em; - - .diff-header { - position: relative; - background: $background-color; - border-bottom: 1px solid $border-color; - padding: 10px 15px; - color: #555; - z-index: 10; - - > span { - font-family: $monospace_font; - word-break: break-all; - margin-right: 200px; - display: block; - - .file-mode { - margin-left: 10px; - color: #777; - } - } - - .diff-btn-group { - float: right; - position: absolute; - top: 5px; - right: 15px; - - .btn { - padding: 0px 10px; - font-size: 13px; - line-height: 28px; - } - } - - .commit-short-id { - font-family: $monospace_font; - font-size: smaller; - } - } - .diff-content { - overflow: auto; - overflow-y: hidden; - background: #FFF; - color: #333; - font-size: $code_font_size; - .old { - span.idiff { - background-color: #f8cbcb; - } - } - .new { - span.idiff { - background-color: #a6f3a6; - } - } - .unfold { - cursor: pointer; - } - - .file-mode-changed { - padding: 10px; - color: #777; - } - - table { - width: 100%; - font-family: $monospace_font; - border: none; - margin: 0px; - padding: 0px; - td { - line-height: $code_line_height; - font-size: $code_font_size; - } - } - - tr.line_holder.parallel{ - .old_line, .new_line, .diff_line { - min-width: 50px; - } - - td.line_content.parallel{ - width: 50%; - } - } - - .old_line, .new_line, .diff_line { - margin: 0px; - padding: 0px; - border: none; - background: $background-color; - color: rgba(0,0,0,0.3); - padding: 0px 5px; - border-right: 1px solid $border-color; - text-align: right; - min-width: 35px; - max-width: 50px; - width: 35px; - @include user-select(none); - a { - float: left; - width: 35px; - font-weight: normal; - color: rgba(0,0,0,0.3); - &:hover { - text-decoration: underline; - } - } - &.new { - background: #CFD; - } - &.old { - background: #FDD; - } - } - .diff_line { - padding: 0; - } - .line_holder { - &.old .old_line, - &.old .new_line { - background: #ffdddd; - border-color: #f1c0c0; - } - &.new .old_line, - &.new .new_line { - background: #dbffdb; - border-color: #c1e9c1; - } - } - .line_content { - display: block; - margin: 0px; - padding: 0px 0.5em; - border: none; - &.new { - background: #eaffea; - } - &.old { - background: #ffecec; - } - &.matched { - color: $border-color; - background: #fafafa; - } - &.parallel { - display: table-cell; - } - } - } - .image { - background: #ddd; - text-align: center; - padding: 30px; - .wrap{ - display: inline-block; - } - - .frame { - display: inline-block; - background-color: #fff; - line-height: 0; - img{ - border: 1px solid #FFF; - background: image-url('trans_bg.gif'); - max-width: 100%; - } - &.deleted { - border: 1px solid $deleted; - } - - &.added { - border: 1px solid $added; - } - } - .image-info{ - font-size: 12px; - margin: 5px 0 0 0; - color: grey; - } - - .view.swipe{ - position: relative; - - .swipe-frame{ - display: block; - margin: auto; - position: relative; - } - .swipe-wrap{ - overflow: hidden; - border-left: 1px solid #999; - position: absolute; - display: block; - top: 13px; - right: 7px; - } - .frame{ - top: 0; - right: 0; - position: absolute; - &.deleted{ - margin: 0; - display: block; - top: 13px; - right: 7px; - } - } - .swipe-bar{ - display: block; - height: 100%; - width: 15px; - z-index: 100; - position: absolute; - cursor: pointer; - &:hover{ - .top-handle{ - background-position: -15px 3px; - } - .bottom-handle{ - background-position: -15px -11px; - } - }; - .top-handle{ - display: block; - height: 14px; - width: 15px; - position: absolute; - top: 0px; - background: image-url('swipemode_sprites.gif') 0 3px no-repeat; - } - .bottom-handle{ - display: block; - height: 14px; - width: 15px; - position: absolute; - bottom: 0px; - background: image-url('swipemode_sprites.gif') 0 -11px no-repeat; - } - } - } //.view.swipe - .view.onion-skin{ - .onion-skin-frame{ - display: block; - margin: auto; - position: relative; - } - .frame.added, .frame.deleted { - position: absolute; - display: block; - top: 0px; - left: 0px; - } - .controls{ - display: block; - height: 14px; - width: 300px; - z-index: 100; - position: absolute; - bottom: 0px; - left: 50%; - margin-left: -150px; - - .drag-track{ - display: block; - position: absolute; - left: 12px; - height: 10px; - width: 276px; - background: image-url('onion_skin_sprites.gif') -4px -20px repeat-x; - } - - .dragger { - display: block; - position: absolute; - left: 0px; - top: 0px; - height: 14px; - width: 14px; - background: image-url('onion_skin_sprites.gif') 0px -34px repeat-x; - cursor: pointer; - } - - .transparent { - display: block; - position: absolute; - top: 2px; - right: 0px; - height: 10px; - width: 10px; - background: image-url('onion_skin_sprites.gif') -2px 0px no-repeat; - } - - .opaque { - display: block; - position: absolute; - top: 2px; - left: 0px; - height: 10px; - width: 10px; - background: image-url('onion_skin_sprites.gif') -2px -10px no-repeat; - } - } - } //.view.onion-skin - } - .view-modes{ - padding: 10px; - text-align: center; - background: #EEE; - - ul, li{ - list-style: none; - margin: 0; - padding: 0; - display: inline-block; - } - - li{ - color: grey; - border-left: 1px solid #c1c1c1; - padding: 0 12px 0 16px; - cursor: pointer; - &:first-child{ - border-left: none; - } - &:hover{ - text-decoration: underline; - } - &.active{ - &:hover{ - text-decoration: none; - } - cursor: default; - color: #333; - } - &.disabled{ - display: none; - } - } - } -} - -.file-content .diff-file { - margin: 0; - border: none; -} - -.diff-file .line_content { - white-space: pre; -} - -.diff-wrap-lines .line_content { - white-space: pre-wrap; -} - diff --git a/app/assets/stylesheets/pages/editor.scss b/app/assets/stylesheets/pages/editor.scss deleted file mode 100644 index 759ba6b1c22..00000000000 --- a/app/assets/stylesheets/pages/editor.scss +++ /dev/null @@ -1,54 +0,0 @@ -.file-editor { - #editor{ - border: none; - @include border-radius(0); - height: 500px; - margin: 0; - padding: 0; - position: relative; - width: 100%; - } - - .cancel-btn { - color: #B94A48; - &:hover { - color: #B94A48; - } - } - .commit-button-annotation { - display: inline-block; - margin: 0; - padding: 2px; - - > * { - float: left; - } - - .message { - display: inline-block; - margin: 5px 8px 0 8px; - } - } - - .file-title { - @extend .monospace; - font-size: 14px; - padding: 5px; - } - - .editor-ref { - background: $background-color; - padding: 11px 15px; - border-right: 1px solid #CCC; - display: inline-block; - margin: -5px -5px; - margin-right: 10px; - } - - .editor-file-name { - .new-file-name { - display: inline-block; - width: 200px; - } - } -} diff --git a/app/assets/stylesheets/pages/errors.scss b/app/assets/stylesheets/pages/errors.scss deleted file mode 100644 index 32d2d7b1dbf..00000000000 --- a/app/assets/stylesheets/pages/errors.scss +++ /dev/null @@ -1,14 +0,0 @@ -.error-page { - max-width: 400px; - margin: 0 auto; - - h1, h2, h3 { - text-align: center; - } - - h1 { - font-size: 56px; - line-height: 100px; - font-weight: 300; - } -} diff --git a/app/assets/stylesheets/pages/events.scss b/app/assets/stylesheets/pages/events.scss deleted file mode 100644 index d4af7506d5b..00000000000 --- a/app/assets/stylesheets/pages/events.scss +++ /dev/null @@ -1,197 +0,0 @@ -/** - * Events labels - * - */ -.event_label { - &.pushed { - padding: 0 2px; - } - - &.opened { - padding: 0 2px; - } - - &.closed { - padding: 0 2px; - } - - &.merged { - padding: 0 2px; - } - - &.left, - &.joined { - padding: 0 2px; - float: none; - } -} - -/** - * Dashboard events feed - * - */ -.event-item { - &:first-child { - padding-top: 0; - } - - &.event-inline { - .avatar { - position: relative; - top: -2px; - } - } - - padding: 12px 0px; - border-bottom: 1px solid #eee; - .event-title { - max-width: 70%; - @include str-truncated(calc(100% - 174px)); - font-weight: 500; - font-size: 14px; - .author_name { - color: #333; - } - } - .event-body { - font-size: 13px; - margin-left: 35px; - margin-right: 80px; - color: #777; - - .event-note { - margin-top: 5px; - word-wrap: break-word; - - .md { - font-size: 13px; - - iframe.twitter-share-button { - vertical-align: bottom; - } - } - - pre { - border: none; - background: #f9f9f9; - border-radius: 0; - color: #777; - margin: 0 20px; - overflow: hidden; - } - - .note-image-attach { - margin-top: 4px; - margin-left: 0px; - max-width: 200px; - float: none; - } - - p:last-child { - margin-bottom: 0; - } - } - .event-note-icon { - color: #777; - float: left; - font-size: 16px; - line-height: 16px; - margin-right: 5px; - } - } - .event_icon { - position: relative; - float: right; - border: 1px solid #EEE; - padding: 5px; - @include border-radius(5px); - background: #F9F9F9; - margin-left: 10px; - top: -6px; - img { - width: 20px; - } - } - - &:last-child { border:none } - - .event_commits { - margin-top: 5px; - - li { - &.commit { - background: transparent; - padding: 3px; - padding-left: 0; - border: none; - .commit-row-title { - font-size: 12px; - } - } - &.commits-stat { - display: block; - padding: 3px; - padding-left: 0; - - &:hover { - background: none; - } - } - } - } - - .event-item-timestamp { - float: right; - color: #999; - line-height: 22px; - } -} - - -/* - * Last push widget - */ -.event-last-push { - overflow: auto; - .event-last-push-text { - @include str-truncated(100%); - padding: 5px 0; - font-size: 13px; - float:left; - margin-right: -150px; - padding-right: 150px; - line-height: 20px; - } -} - -@media (max-width: $screen-xs-max) { - .event-item { - .event-title { - white-space: normal; - overflow: visible; - max-width: 100%; - } - .avatar { - display: none; - } - - .event-body { - margin: 0; - border-left: 2px solid #DDD; - padding-left: 10px; - } - - .event-item-timestamp { - display: none; - } - } -} - -.event_filter { - li a { - font-size: 13px; - padding: 5px 10px; - background: $background-color; - margin-left: 4px; - } -} diff --git a/app/assets/stylesheets/pages/explore.scss b/app/assets/stylesheets/pages/explore.scss deleted file mode 100644 index 9b92128624c..00000000000 --- a/app/assets/stylesheets/pages/explore.scss +++ /dev/null @@ -1,8 +0,0 @@ -.explore-title { - text-align: center; - - h3 { - font-weight: normal; - font-size: 30px; - } -} diff --git a/app/assets/stylesheets/pages/graph.scss b/app/assets/stylesheets/pages/graph.scss deleted file mode 100644 index c3b10d144e1..00000000000 --- a/app/assets/stylesheets/pages/graph.scss +++ /dev/null @@ -1,37 +0,0 @@ -.project-network { - border: 1px solid $border-color; - - .controls { - color: #888; - font-size: 14px; - padding: 5px; - border-bottom: 1px solid $border-color; - background: #EEE; - } - - .network-graph { - background: #FFF; - height: 500px; - overflow-y: scroll; - overflow-x: hidden; - } -} - -.graphs { - .graph-author-commits-count { - } - - .graph-author-email { - float: right; - color: #777; - } - - .graph-additions { - color: #4a2; - } - - .graph-deletions { - color: #d12f19; - } -} - diff --git a/app/assets/stylesheets/pages/groups.scss b/app/assets/stylesheets/pages/groups.scss deleted file mode 100644 index 2b1b747139a..00000000000 --- a/app/assets/stylesheets/pages/groups.scss +++ /dev/null @@ -1,12 +0,0 @@ -.new-group-member-holder { - margin-top: 50px; - padding-top: 20px; -} - -.member-search-form { - float: left; -} - -.milestone-row { - @include str-truncated(90%); -} diff --git a/app/assets/stylesheets/pages/header.scss b/app/assets/stylesheets/pages/header.scss deleted file mode 100644 index dde19b801f8..00000000000 --- a/app/assets/stylesheets/pages/header.scss +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Application Header - * - */ -header { - &.navbar-gitlab { - z-index: 100; - margin-bottom: 0; - min-height: 40px; - border: none; - width: 100%; - - .navbar-inner { - filter: none; - - .nav > li > a { - font-size: 14px; - line-height: 32px; - padding: 6px 10px; - - &:hover, &:focus, &:active { - background: none; - } - } - - /** NAV block with links and profile **/ - .nav { - float: right; - margin-right: 0; - } - - .navbar-toggle { - color: $style_color; - margin: 0; - padding: 10px; - border-radius: 0; - - button i { font-size: 22px; } - - &.collapsed { background-color: transparent !important;} - - &:hover { - background-color: #EEE; - } - } - } - - .turbolink-spinner { - font-size: 20px; - margin-right: 10px; - } - - @media (max-width: $screen-xs-max) { - border-width: 0; - font-size: 18px; - - .title { - @include str-truncated(70%); - } - - .navbar-collapse { - margin-top: 47px; - padding-right: 0; - padding-left: 0; - } - - .navbar-nav { - margin: 5px 0; - - .visible-xs, .visable-sm { - display: table-cell !important; - } - } - - li { - display: table-cell; - width: 1%; - - a { - text-align: center; - font-size: 18px !important; - } - } - } - } - - .container { - width: 100% !important; - padding: 0px; - } - - /** - * - * Logo holder - * - */ - .app_logo { - float: left; - margin-right: 9px; - - a { - float: left; - padding: 5px 0; - height: 46px; - width: 52px; - text-align: center; - - img { - width: 36px; - height: 36px; - } - } - &:hover { - background-color: #EEE; - } - } - - /** - * - * Project / Area name - * - */ - .title { - position: relative; - float: left; - margin: 0; - margin-left: 5px; - @include header-font; - @include str-truncated(37%); - } - - .profile-pic { - padding: 0px !important; - width: 46px; - height: 46px; - margin-left: 5px; - img { - width: 46px; - height: 46px; - } - } - - /** - * - * Search box - * - */ - .search { - margin-right: 10px; - margin-left: 10px; - margin-top: 8px; - - form { - margin: 0; - padding: 0; - } - - .search-input { - background-image: image-url("icon-search.png"); - background-repeat: no-repeat; - background-position: 10px; - height: inherit; - padding: 4px 6px; - padding-left: 25px; - font-size: 13px; - @include border-radius(3px); - border: 1px solid #c6c6c6; - box-shadow: none; - @include transition(all 0.15s ease-in 0s); - } - } -} - -.search .search-input { - width: 300px; - &:focus { - width: 330px; - } -} - -@media (max-width: 1200px) { - .search .search-input { - width: 200px; - &:focus { - width: 230px; - } - } -} - -@media (max-width: $screen-xs-max) { - #nprogress .spinner { - right: 35px !important; - } -} diff --git a/app/assets/stylesheets/pages/help.scss b/app/assets/stylesheets/pages/help.scss deleted file mode 100644 index 6da7a2511a2..00000000000 --- a/app/assets/stylesheets/pages/help.scss +++ /dev/null @@ -1,70 +0,0 @@ -.documentation-index { - h1 { - margin: 0; - } - - h2 { - font-size: 20px; - } - - li { - line-height: 24px; - color: #888; - - a { - margin-right: 3px; - } - } -} - - -.shortcut-mappings { - font-size: 12px; - color: #555; - - tbody:first-child tr:first-child { - padding-top: 0 - } - - th { - padding-top: 15px; - line-height: 1.5; - color: #333; - text-align: left - } - - td { - padding-top: 3px; - padding-bottom: 3px; - vertical-align: top; - line-height: 20px - } - - .shortcut { - padding-right: 10px; - color: #999; - text-align: right; - white-space: nowrap - } - - .key { - @extend .label; - @extend .label-inverse; - font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; - padding: 3px 5px; - } -} - -.modal-body { - position: relative; - overflow-y: auto; - padding: 15px; -} - -body.modal-open { - overflow: hidden; -} - -.modal .modal-dialog { - width: 860px; -} diff --git a/app/assets/stylesheets/pages/import.scss b/app/assets/stylesheets/pages/import.scss deleted file mode 100644 index 3df4bb84bd2..00000000000 --- a/app/assets/stylesheets/pages/import.scss +++ /dev/null @@ -1,18 +0,0 @@ -i.icon-gitorious { - display: inline-block; - background-position: 0px 0px; - background-size: contain; - background-repeat: no-repeat; -} - -i.icon-gitorious-small { - background-image: image-url('gitorious-logo-blue.png'); - width: 13px; - height: 13px; -} - -i.icon-gitorious-big { - background-image: image-url('gitorious-logo-black.png'); - width: 18px; - height: 18px; -} diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss deleted file mode 100644 index a640a4e2051..00000000000 --- a/app/assets/stylesheets/pages/issuable.scss +++ /dev/null @@ -1,47 +0,0 @@ -@media (max-width: $screen-sm-max) { - .issuable-affix { - margin-top: 20px; - } -} - -@media (max-width: $screen-md-max) { - .issuable-affix { - position: static; - } -} - -@media (min-width: $screen-md-max) { - .issuable-affix { - &.affix-top { - position: static; - } - - &.affix { - position: fixed; - top: 70px; - width: 220px; - } - } -} - -.issuable-context-title { - font-size: 14px; - line-height: 1.4; - margin-bottom: 5px; - - .avatar { - margin-left: 0; - } - - label { - color: #666; - font-weight: normal; - margin-right: 4px; - } -} - -.issuable-affix .context { - font-size: 13px; - - .btn { font-size: 13px; } -} diff --git a/app/assets/stylesheets/pages/issues.scss b/app/assets/stylesheets/pages/issues.scss deleted file mode 100644 index cd86a9be8b2..00000000000 --- a/app/assets/stylesheets/pages/issues.scss +++ /dev/null @@ -1,156 +0,0 @@ -.issues-list { - .issue { - padding: 10px 15px; - position: relative; - - .issue-title { - margin-bottom: 5px; - font-size: $list-font-size; - font-weight: bold; - } - - .issue-info { - color: #999; - font-size: 13px; - } - - .issue-check { - float: left; - padding-right: 8px; - margin-bottom: 10px; - min-width: 15px; - } - - .issue-labels { - display: inline-block; - } - - .issue-actions { - display: none; - position: absolute; - top: 10px; - right: 15px; - } - - &:hover { - .issue-actions { - display: block; - } - } - } -} - -.check-all-holder { - line-height: 36px; - float: left; - margin-right: 15px; -} - -.issues_content { - .title { - height: 40px; - } - - form { - margin: 0; - } -} - -.participants { - margin-bottom: 20px; -} - -.issue-search-form { - margin: 0; - height: 24px; - - .issue_search { - border: 1px solid #DDD !important; - background-color: #f4f4f4; - } -} - -.issue-show-labels { - a { - margin-right: 5px; - margin-bottom: 5px; - display: inline-block; - .color-label { - padding: 6px 10px; - } - } -} - -form.edit-issue { - margin: 0; -} - -.merge-request, -.issue { - &.today { - background: #EFE; - border-color: #CEC; - } - - &.closed { - background: #F9F9F9; - border-color: #E5E5E5; - } - - &.merged { - background: #F9F9F9; - border-color: #E5E5E5; - } -} - -@media (max-width: $screen-xs-max) { - .issue-btn-group { - width: 100%; - margin-top: 5px; - - .btn-group { - width: 100%; - - ul { - width: 100%; - text-align: center; - } - } - - .btn { - width: 100%; - margin-top: -1px; - - &:first-child:not(:last-child) { - border-radius: 4px 4px 0 0; - } - - &:not(:first-child):not(:last-child) { - border-radius: 0; - } - - &:last-child:not(:first-child) { - border-radius: 0 0 4px 4px; - } - } - } - - .issue { - &:hover .issue-actions { - display: none !important; - } - - .issue-updated-at { - display: none; - } - } -} - -h2.issue-title { - margin-top: 0; - font-weight: bold; -} - -.issue-form .select2-container { - width: 250px !important; -} diff --git a/app/assets/stylesheets/pages/labels.scss b/app/assets/stylesheets/pages/labels.scss deleted file mode 100644 index d1590e42fcb..00000000000 --- a/app/assets/stylesheets/pages/labels.scss +++ /dev/null @@ -1,21 +0,0 @@ -.suggest-colors { - margin-top: 5px; - a { - @include border-radius(4px); - width: 30px; - height: 30px; - display: inline-block; - margin-right: 10px; - } -} - -.manage-labels-list { - .label { - padding: 9px; - font-size: 14px; - } -} - -.color-label { - padding: 3px 4px; -} diff --git a/app/assets/stylesheets/pages/login.scss b/app/assets/stylesheets/pages/login.scss deleted file mode 100644 index 83b866c3a64..00000000000 --- a/app/assets/stylesheets/pages/login.scss +++ /dev/null @@ -1,124 +0,0 @@ -/* Login Page */ -.login-page { - .container { - max-width: 960px; - } - - .navbar-gitlab .container { - max-width: none; - } - - .brand-holder { - font-size: 18px; - line-height: 1.5; - - p { - color: #888; - } - - h1:first-child { - font-weight: normal; - margin-bottom: 30px; - } - - img { - max-width: 100%; - margin-bottom: 30px; - } - - a { - font-weight: bold; - } - } - - .login-box{ - background: #fafafa; - border-radius: 10px; - box-shadow: 0 0px 2px #CCC; - padding: 15px; - - .login-heading h3 { - font-weight: 300; - line-height: 1.5; - margin: 0 0 10px 0; - } - - .login-footer { - margin-top: 10px; - - p:last-child { - margin-bottom: 0; - } - } - - a.forgot { - float: right; - padding-top: 6px - } - - .nav .active a { - background: transparent; - } - } - - .form-control { - font-size: 14px; - padding: 10px 8px; - width: 100%; - height: auto; - - &.top { - @include border-radius(5px 5px 0 0); - margin-bottom: 0px; - } - - &.bottom { - @include border-radius(0 0 5px 5px); - border-top: 0; - margin-bottom: 20px; - } - - &.middle { - border-top: 0; - margin-bottom:0px; - @include border-radius(0); - } - - &:active, &:focus { - background-color: #FFF; - } - } - - .devise-errors { - h2 { - margin-top: 0; - font-size: 14px; - color: #a00; - } - } - - .remember-me { - margin-top: -10px; - - label { - font-weight: normal; - } - } -} - -@media (max-width: $screen-xs-max) { - .login-page { - .col-sm-5.pull-right { - float: none !important; - } - } -} - -.oauth-image-link { - margin-right: 10px; - - img { - width: 32px; - height: 32px; - } -} diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss deleted file mode 100644 index 8abd4207beb..00000000000 --- a/app/assets/stylesheets/pages/merge_requests.scss +++ /dev/null @@ -1,191 +0,0 @@ - - /** - * MR -> show: Automerge widget - * - */ -.automerge_widget { - form { - margin-bottom: 0; - .clearfix { - margin-bottom: 0; - } - } - - .accept-merge-holder { - .accept-action { - display: inline-block; - } - - .accept-control { - display: inline-block; - margin: 0; - margin-left: 20px; - padding: 10px 0; - line-height: 20px; - font-weight: bold; - - .remove_source_checkbox { - margin: 0; - font-weight: bold; - } - } - } -} - -@media(min-width: $screen-sm-max) { - .merge-request .merge-request-tabs{ - margin: 20px 0; - - li { - a { - padding: 15px 40px; - font-size: 14px; - } - } - } -} - -.mr_source_commit, -.mr_target_commit { - .commit { - margin: 0; - padding: 2px 0; - list-style: none; - &:hover { - background: none; - } - } -} - -.label-branch { - @include border-radius(4px); - padding: 3px 4px; - border: none; - background: $hover; - color: #333; - font-family: $monospace_font; - font-weight: normal; - overflow: hidden; - - .label-project { - @include border-radius-left(4px); - padding: 3px 4px; - background: #279; - position: relative; - left: -4px; - letter-spacing: -1px; - } -} - -.mr-list { - .merge-request { - padding: 10px 15px; - position: relative; - - .merge-request-title { - margin-bottom: 5px; - font-size: $list-font-size; - font-weight: bold; - } - - .merge-request-info { - color: #999; - font-size: 13px; - - .merge-request-labels { - display: inline-block; - } - } - } -} - -.merge-request-angle { - text-align: center; - margin: 0 auto; - font-size: 2em; - line-height: 1.1; -} - -.merge-request-form-info { - padding-top: 15px; -} - -// hide mr close link for inline diff comment form -.diff-file .close-mr-link, -.diff-file .reopen-mr-link { - display: none; -} - -.mr-state-widget { - font-size: 13px; - background: #F9F9F9; - margin-bottom: 20px; - color: #666; - border: 1px solid #EEE; - @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.09)); - - .ci_widget { - padding: 10px 15px; - font-size: 15px; - border-bottom: 1px solid #BBB; - color: #777; - background-color: $background-color; - - &.ci-success { - color: $gl-success; - border-color: $gl-success; - background-color: #F1FAF1; - } - - &.ci-pending, - &.ci-running { - color: $gl-warning; - border-color: $gl-warning; - background-color: #FAF5F1; - } - - &.ci-failed, - &.ci-canceled, - &.ci-error { - color: $gl-danger; - border-color: $gl-danger; - background-color: #FAF1F1; - } - } - - .mr-widget-body { - padding: 10px 15px; - - h4 { - font-weight: normal; - } - - p:last-child { - margin-bottom: 0; - } - } - - .mr-widget-footer { - padding: 10px 15px; - border-top: 1px solid #EEE; - } - - .ci-coverage { - float: right; - } -} - -.merge-request-show-labels { - a { - margin-right: 5px; - margin-bottom: 5px; - display: inline-block; - .color-label { - padding: 6px 10px; - } - } -} - -.merge-request-form .select2-container { - width: 250px !important; -} diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss deleted file mode 100644 index 15e3948e402..00000000000 --- a/app/assets/stylesheets/pages/milestone.scss +++ /dev/null @@ -1,9 +0,0 @@ -.issues-sortable-list .str-truncated { - max-width: 90%; -} - -li.milestone { - h4 { - font-weight: bold; - } -} diff --git a/app/assets/stylesheets/pages/note_form.scss b/app/assets/stylesheets/pages/note_form.scss deleted file mode 100644 index a0522030785..00000000000 --- a/app/assets/stylesheets/pages/note_form.scss +++ /dev/null @@ -1,175 +0,0 @@ -/** - * Note Form - */ - -.comment-btn { - @extend .btn-create; -} -.reply-btn { - @extend .btn-primary; -} -.diff-file .diff-content { - tr.line_holder:hover { - &> td.line_content { - background: $hover !important; - border-color: darken($hover, 10%) !important; - } - &> td.new_line, - &> td.old_line { - background: darken($hover, 4%) !important; - border-color: darken($hover, 10%) !important; - } - } - - tr.line_holder:hover > td .line_note_link { - opacity: 1.0; - filter: alpha(opacity=100); - } -} -.diff-file, -.discussion { - .new_note { - margin: 0; - border: none; - } -} -.new_note { - display: none; -} - -.new_note, .edit_note { - .buttons { - float: left; - margin-top: 8px; - } - .clearfix { - margin-bottom: 0; - } - - .note-preview-holder { - > p { - overflow-x: auto; - } - } - - img { - max-width: 100%; - } - - .note_text { - width: 100%; - } -} - -/* loading indicator */ -.notes-busy { - margin: 18px; -} - -.note-image-attach { - @extend .col-md-4; - @extend .thumbnail; - margin-left: 45px; - float: none; -} - -.common-note-form { - margin: 0; - background: #F9F9F9; - padding: 5px; - border: 1px solid #DDD; -} - -.note-form-actions { - background: #F9F9F9; - height: 45px; - - .note-form-option { - margin-top: 8px; - margin-left: 30px; - @extend .pull-left; - } - - .js-notify-commit-author { - float: left; - } - - .write-preview-btn { - // makes the "absolute" position for links relative to this - position: relative; - - // preview/edit buttons - > a { - position: absolute; - right: 5px; - top: 8px; - } - } -} - -.note-edit-form { - display: none; - font-size: 13px; - - .form-actions { - padding-left: 20px; - - .btn-save { - float: left; - } - - .note-form-option { - float: left; - padding: 2px 0 0 25px; - } - } -} - -.js-note-attachment-delete { - display: none; -} - -.parallel-comment { - padding: 6px; -} - -.error-alert > .alert { - margin-top: 5px; - margin-bottom: 5px; -} - -.discussion-body, -.diff-file { - .notes .note { - border-color: #ddd; - padding: 10px 15px; - } - - .discussion-reply-holder { - background: #f9f9f9; - padding: 10px 15px; - border-top: 1px solid #DDD; - } -} - -.discussion-notes-count { - font-size: 16px; -} - -.edit_note { - .markdown-area { - min-height: 140px; - } - .note-form-actions { - background: transparent; - } -} - -.comment-hints { - color: #999; - background: #FFF; - padding: 5px; - margin-top: -11px; - border: 1px solid #DDD; - font-size: 13px; -} diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss deleted file mode 100644 index facd7e19314..00000000000 --- a/app/assets/stylesheets/pages/notes.scss +++ /dev/null @@ -1,206 +0,0 @@ -/** - * Notes - */ - -@-webkit-keyframes targe3-note { - from { background:#fffff0; } - 50% { background:#ffffd3; } - to { background:#fffff0; } -} - -ul.notes { - display: block; - list-style: none; - margin: 0px; - padding: 0px; - - .discussion-header, - .note-header { - @extend .cgray; - padding-bottom: 15px; - - a:hover { - text-decoration: none; - } - - .avatar { - float: left; - margin-right: 10px; - } - - .discussion-last-update, - .note-last-update { - &:before { - content: "\00b7"; - } - font-size: 13px; - } - .author { - color: #333; - font-weight: bold; - &:hover { - color: $gl-link-color; - } - } - .author-username { - } - } - - .discussion { - overflow: hidden; - display: block; - position:relative; - } - - .note { - display: block; - position:relative; - .note-body { - overflow: auto; - .note-text { - overflow: auto; - word-wrap: break-word; - @include md-typography; - - hr { - margin: 10px 0; - } - } - } - .note-header { - padding-bottom: 3px; - } - - &:last-child { - border-bottom: none; - } - } -} - -// Diff code in discussion view -.discussion-body .diff-file { - .diff-header > span { - margin-right: 10px; - } - .line_content { - white-space: pre-wrap; - } -} - -.diff-file .notes_holder { - font-size: 13px; - line-height: 18px; - font-family: $regular_font; - - td { - border: 1px solid #ddd; - border-left: none; - - &.notes_line { - text-align: center; - padding: 10px 0; - background: #FFF; - } - &.notes_line2 { - text-align: center; - padding: 10px 0; - border-left: 1px solid #ddd !important; - } - &.notes_content { - background-color: #fff; - border-width: 1px 0; - padding-top: 0; - vertical-align: top; - &.parallel{ - border-width: 1px; - } - } - } -} - -/** - * Actions for Discussions/Notes - */ - -.discussion, -.note { - &.note:hover { - .note-actions { display: block; } - } - .discussion-header:hover { - .discussion-actions { display: block; } - } - - .discussion-actions, - .note-actions { - display: none; - float: right; - - [class~="fa"] { - font-size: 16px; - line-height: 16px; - vertical-align: middle; - } - - a { - @extend .cgray; - - &:hover { - &.danger { @extend .cred; } - } - } - } -} -.diff-file .note .note-actions { - right: 0; - top: 0; -} - - -/** - * Line note button on the side of diffs - */ - -.diff-file tr.line_holder { - @mixin show-add-diff-note { - filter: alpha(opacity=100); - opacity: 1.0; - } - - .add-diff-note { - margin-top: -4px; - @include border-radius(40px); - background: #FFF; - padding: 4px; - font-size: 16px; - color: $gl-link-color; - margin-left: -60px; - position: absolute; - z-index: 10; - width: 32px; - - transition: all 0.2s ease; - - // "hide" it by default - opacity: 0.0; - filter: alpha(opacity=0); - - &:hover { - width: 38px; - font-size: 20px; - background: $gl-info; - color: #FFF; - @include show-add-diff-note; - } - } - - // "show" the icon also if we just hover somewhere over the line - &:hover > td { - background: $hover !important; - - .add-diff-note { - @include show-add-diff-note; - } - } -} - diff --git a/app/assets/stylesheets/pages/notifications.scss b/app/assets/stylesheets/pages/notifications.scss deleted file mode 100644 index cc273f55222..00000000000 --- a/app/assets/stylesheets/pages/notifications.scss +++ /dev/null @@ -1,22 +0,0 @@ -.global-notifications-form .level-title { - font-size: 15px; - color: #333; - font-weight: bold; -} - -.notification-icon-holder { - width: 20px; - float: left; -} - -.ns-part { - color: $gl-primary; -} - -.ns-watch { - color: $gl-success; -} - -.ns-mute { - color: $gl-danger; -} diff --git a/app/assets/stylesheets/pages/profile.scss b/app/assets/stylesheets/pages/profile.scss deleted file mode 100644 index 65655d4bfa3..00000000000 --- a/app/assets/stylesheets/pages/profile.scss +++ /dev/null @@ -1,95 +0,0 @@ -.account-page { - fieldset { - margin-bottom: 15px; - padding-bottom: 15px; - } -} - -.btn-build-token { - float: left; - padding: 6px 20px; - margin-right: 12px; -} - -.profile-avatar-form-option { - hr { - margin: 10px 0; - } -} - -/* - * Appearance settings - * - */ -.themes_opts { - label { - margin-right: 20px; - text-align: center; - - .prev { - height: 80px; - width: 160px; - margin-bottom: 10px; - @include border-radius(4px); - - &.classic { - background: #31363e; - } - - &.default { - background: #f1f1f1; - } - - &.modern { - background: #009871; - } - - &.gray { - background: #373737; - } - - &.violet { - background: #548; - } - - &.blue { - background: #2980b9; - } - } - } -} - -.code_highlight_opts { - margin-top: 10px; - - label { - margin-right: 20px; - text-align: center; - - .prev { - width: 160px; - margin-bottom: 10px; - - img { - max-width: 100%; - @include border-radius(4px); - } - } - } -} - -.oauth-buttons { - .btn-group { - margin-right: 10px; - } - - .btn { - line-height: 36px; - height: 56px; - - img { - width: 32px; - height: 32px; - } - } -} diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss deleted file mode 100644 index c005470355e..00000000000 --- a/app/assets/stylesheets/pages/projects.scss +++ /dev/null @@ -1,328 +0,0 @@ -.new_project, -.edit_project { - fieldset.features { - .control-label { - font-weight: bold; - } - } -} - -.project-name-holder { - .help-inline { - vertical-align: top; - padding: 7px; - } -} - -.project-home-panel { - margin-bottom: 20px; - position: relative; - padding-left: 85px; - - &.empty-project { - border-bottom: 0px; - padding-bottom: 15px; - margin-bottom: 0px; - } - - .project-identicon-holder { - position: absolute; - left: 0; - - .avatar { - width: 70px; - height: 70px; - } - - .identicon { - font-size: 45px; - line-height: 1.6; - } - - .avatar, .identicon { - @include border-radius(4px); - box-shadow: 0 1px 2px #ddd; - } - } - - .project-home-dropdown { - margin-left: 10px; - float: right; - } - - .project-home-row { - @extend .clearfix; - margin-bottom: 15px; - - &.project-home-row-top { - margin-bottom: 15px; - } - - .project-home-desc { - font-size: 16px; - line-height: 1.3; - margin-right: 215px; - } - - .project-home-desc { - float: left; - color: $gray; - } - } - - .visibility-level-label { - color: $gray; - i { - color: inherit; - } - } - - .project-repo-buttons { - margin-top: -3px; - position: absolute; - right: 0; - width: 260px; - text-align: right; - - .btn { - font-weight: bold; - font-size: 14px; - line-height: 16px; - - .count { - padding-left: 10px; - border-left: 1px solid #ccc; - display: inline-block; - margin-left: 10px; - } - } - } -} - -.project-home-links { - padding: 10px 0px; - float: right; - a { - margin-left: 10px; - font-weight: 500; - } -} - -.git-clone-holder { - .project-home-dropdown + & { - margin-right: 45px; - } - - .form-control { - cursor: auto; - @extend .monospace; - background: #FAFAFA; - width: 100%; - } - - .input-group-addon { - background: #FAFAFA; - } -} - -.project-visibility-level-holder { - .radio { - margin-bottom: 10px; - - i { - margin: 0 3px; - font-size: 20px; - } - - .option-title { - font-weight: bold; - display: inline-block; - } - - .option-descr { - margin-left: 24px; - color: $gray; - } - } -} - -.save-project-loader { - margin-top: 50px; - margin-bottom: 50px; - color: #555; -} - -ul.nav.nav-projects-tabs { - @extend .nav-tabs; - - padding-left: 8px; - - li { - a { - padding: 6px 25px; - margin-top: 2px; - border-color: #DDD; - background-color: #EEE; - text-shadow: 0 1px 1px white; - color: #555; - } - &.active { - a { - font-weight: bold; - } - } - } -} - -.project_member_row form { - margin: 0px; -} - -.my-projects, -.public-projects { - li { - .project-info { - margin-bottom: 10px; - overflow: hidden; - } - - .access-icon { - color: #AAA; - margin-left: 10px; - i { - color: #AAA; - } - } - } -} - -.public-clone { - background: #EEE; - color: #777; - padding: 6px 10px; - margin: 1px; - font-weight: normal; -} - -.public-projects .repo-info { - color: #777; - - a { - color: #777; - } -} - -.project-side { - .btn-block { - background-image: none; - - .btn, &.btn { - white-space: normal; - text-align: left; - padding: 10px 15px; - - &.dropdown-toggle { - text-align: center; - } - - &:hover { - background-color: #eee; - border-color: #DDD; - } - } - - .count { - float: right; - font-weight: 500; - text-shadow: 0 1px #FFF; - } - - &.btn-group-justified { - .btn { - width: 100%; - } - .dropdown-toggle { - width: 30px; - padding: 10px; - } - ul { - width: 100%; - } - } - } - - .project-fork-icon { - float: left; - font-size: 26px; - margin-right: 10px; - line-height: 1.5; - } -} - -.transfer-project .select2-container { - min-width: 200px; -} - -.deploy-project-label { - margin: 1px; -} - -.vs-public { - color: $gl-primary; -} - -.vs-internal { - color: $gl-warning; -} - -.vs-private { - color: $gl-success; -} - -.breadcrumb.repo-breadcrumb { - padding: 2px 0; - background: white; - border: none; - font-size: 16px; - - > li + li:before { - padding: 0 3px; - color: #999; - } -} - -.fork-namespaces { - .thumbnail { - - &.fork-exists-thumbnail { - border-color: #EEE; - - .caption { - color: #999; - } - } - - &.fork-thumbnail { - border-color: #AAA; - - &:hover { - background-color: $hover; - } - } - - a { - text-decoration: none; - } - } -} - -table.table.protected-branches-list tr.no-border { - th, td { - border: 0; - } -} - -.project-import .btn { - float: left; - margin-right: 10px; -} diff --git a/app/assets/stylesheets/pages/search.scss b/app/assets/stylesheets/pages/search.scss deleted file mode 100644 index bdaa17ac339..00000000000 --- a/app/assets/stylesheets/pages/search.scss +++ /dev/null @@ -1,7 +0,0 @@ -.search-results { - .search-result-row { - border-bottom: 1px solid #EEE; - padding-bottom: 10px; - margin-bottom: 10px; - } -} diff --git a/app/assets/stylesheets/pages/snippets.scss b/app/assets/stylesheets/pages/snippets.scss deleted file mode 100644 index d79591d9915..00000000000 --- a/app/assets/stylesheets/pages/snippets.scss +++ /dev/null @@ -1,8 +0,0 @@ -.my-snippets li:first-child { - h4 { margin-top: 0; } - padding-top: 0; -} - -.snippet-form-holder .file-holder .file-title { - padding: 2px; -} diff --git a/app/assets/stylesheets/pages/stat_graph.scss b/app/assets/stylesheets/pages/stat_graph.scss deleted file mode 100644 index b9be47e7700..00000000000 --- a/app/assets/stylesheets/pages/stat_graph.scss +++ /dev/null @@ -1,50 +0,0 @@ -.tint-box { - background: #f3f3f3; - position: relative; - margin-bottom: 10px; -} - -.area { - fill: #1db34f; - fill-opacity: 0.5; -} - -.axis { - fill: #aaa; - font-size: 10px; -} - -#contributors { - .contributors-list { - margin: 0 0 10px 0; - list-style: none; - padding: 0; - } - - .person { - &:nth-child(even) { - float: right; - } - float: left; - margin-top: 10px; - } - - .person .spark { - display: block; - background: #f3f3f3; - } - - .person .area-contributor { - fill: #f17f49; - } -} - -.selection rect { - fill: #333; - fill-opacity: 0.1; - stroke: #333; - stroke-width: 1px; - stroke-opacity: 0.4; - shape-rendering: crispedges; - stroke-dasharray: 3 3; -} diff --git a/app/assets/stylesheets/pages/themes.scss b/app/assets/stylesheets/pages/themes.scss deleted file mode 100644 index e69de29bb2d..00000000000 --- a/app/assets/stylesheets/pages/themes.scss +++ /dev/null diff --git a/app/assets/stylesheets/pages/tree.scss b/app/assets/stylesheets/pages/tree.scss deleted file mode 100644 index 57f63b52aa1..00000000000 --- a/app/assets/stylesheets/pages/tree.scss +++ /dev/null @@ -1,153 +0,0 @@ -.tree-holder { - .tree-content-holder { - float: left; - width: 100%; - } - - .tree_progress { - display: none; - margin: 20px; - &.loading { - display: block; - } - } - - .tree-table { - @extend .table; - @include border-radius(0); - - tr { - &:hover { - td { - background: $hover; - border-top: 1px solid #ADF; - border-bottom: 1px solid #ADF; - } - cursor: pointer; - } - &.selected { - td { - background: $background-color; - border-top: 1px solid #EEE; - border-bottom: 1px solid #EEE; - } - } - } - } - - .tree-item { - .tree-item-file-name { - max-width: 320px; - vertical-align: middle; - - i, a { - color: $gl-link-color; - } - - img { - position: relative; - top:-1px; - } - } - - .tree_commit { - max-width: 320px; - } - - .tree_time_ago { - min-width: 135px; - } - } - - .tree_author { - padding-right: 8px; - - .commit-author-name { - color: gray; - } - } - - .tree_commit { - color: gray; - - .tree-commit-link { - color: gray; - - &:hover { - text-decoration: underline; - } - } - } - - .blame { - img.avatar { - border: 0 none; - float: none; - margin: 0; - padding: 0; - } - td.blame-commit { - background: #f9f9f9; - min-width: 350px; - } - td.blame-numbers { - pre { - color: #AAA; - white-space: pre; - } - background: #f1f1f1; - border-left: 1px solid #DDD; - } - td.lines { - code { - font-family: $monospace_font; - } - } - } -} - -.tree-download-holder .btn { - padding: 4px 12px; -} - -.tree-ref-holder { - float: left; - margin-right: 15px; - - .select2-container .select2-choice, .select2-container.select2-drop-above .select2-choice { - padding: 4px 12px; - } -} - -.readme-holder { - .readme-file-title { - font-size: 14px; - font-weight: bold; - margin-bottom: 20px; - color: #777; - border-bottom: 1px solid #DDD; - padding: 10px 0; - } -} - -.blob-commit-info { - list-style: none; - margin: 0; - padding: 0; - margin-bottom: 10px; - - .commit { - padding: 10px 15px; - - .commit-row-title { - font-size: 13px; - - .commit-row-message { - font-weight: normal; - color: #555; - } - } - } -} - -#modal-remove-blob > .modal-dialog { width: 850px; } diff --git a/app/assets/stylesheets/pages/ui_dev_kit.scss b/app/assets/stylesheets/pages/ui_dev_kit.scss deleted file mode 100644 index 277afa1db9e..00000000000 --- a/app/assets/stylesheets/pages/ui_dev_kit.scss +++ /dev/null @@ -1,9 +0,0 @@ -.gitlab-ui-dev-kit { - > h2 { - font-size: 27px; - border-bottom: 1px solid #CCC; - color: #666; - margin: 30px 0; - font-weight: bold; - } -} diff --git a/app/assets/stylesheets/pages/votes.scss b/app/assets/stylesheets/pages/votes.scss deleted file mode 100644 index dc9a7d71e8b..00000000000 --- a/app/assets/stylesheets/pages/votes.scss +++ /dev/null @@ -1,4 +0,0 @@ -.votes-inline { - display: inline-block; - margin: 0 8px; -} diff --git a/app/assets/stylesheets/pages/wiki.scss b/app/assets/stylesheets/pages/wiki.scss deleted file mode 100644 index dfaeba41cf6..00000000000 --- a/app/assets/stylesheets/pages/wiki.scss +++ /dev/null @@ -1,6 +0,0 @@ -.title .edit-wiki-header { - width: 780px; - margin-left: auto; - margin-right: auto; - padding-right: 7px; -} diff --git a/app/assets/stylesheets/print.scss b/app/assets/stylesheets/print.scss deleted file mode 100644 index 1be0551ad3b..00000000000 --- a/app/assets/stylesheets/print.scss +++ /dev/null @@ -1,17 +0,0 @@ -/* Generic print styles */ -header, nav, nav.main-nav, nav.navbar-collapse, nav.navbar-collapse.collapse {display: none!important;} -.profiler-results {display: none;} - -/* Styles targeted specifically at printing files */ -.tree-ref-holder, .tree-holder .breadcrumb, .blob-commit-info {display: none;} -.file-title {display: none;} -.file-holder {border: none;} - -.wiki h1, .wiki h2, .wiki h3, .wiki h4, .wiki h5, .wiki h6 {margin-top: 17px; } -.wiki h1 {font-size: 30px;} -.wiki h2 {font-size: 22px;} -.wiki h3 {font-size: 18px; font-weight: bold; } - -.sidebar-wrapper { display: none; } -.nav { display: none; } -.btn { display: none; } diff --git a/app/assets/stylesheets/themes/dark-theme.scss b/app/assets/stylesheets/themes/dark-theme.scss deleted file mode 100644 index b7b22a8724e..00000000000 --- a/app/assets/stylesheets/themes/dark-theme.scss +++ /dev/null @@ -1,63 +0,0 @@ -@mixin dark-theme($color-light, $color, $color-darker, $color-dark) { - header { - &.navbar-gitlab { - .navbar-inner { - background: $color; - - .navbar-toggle { - color: #FFF; - } - - .app_logo, .navbar-toggle { - &:hover { - background-color: $color-darker; - } - } - - .app_logo { - background-color: $color-dark; - } - - .title { - color: #FFF; - - a { - color: #FFF; - &:hover { - text-decoration: underline; - } - } - } - - .search { - .search-input { - background-color: $color-light; - background-color: rgba(255, 255, 255, 0.5); - border: 1px solid $color-light; - - &:focus { - background-color: white; - } - } - } - - .search-input::-webkit-input-placeholder { - color: #666; - } - - .nav > li > a { - color: $color-light; - - &:hover, &:focus, &:active { - background: none; - color: #FFF; - } - } - - .search-input { - border-color: $color-light; - } - } - } - } -} diff --git a/app/assets/stylesheets/themes/ui_basic.scss b/app/assets/stylesheets/themes/ui_basic.scss deleted file mode 100644 index 097d5c5b73c..00000000000 --- a/app/assets/stylesheets/themes/ui_basic.scss +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file represent some UI that can be changed - * during web app restyle or theme select. - * - */ -.ui_basic { - header { - &.navbar-gitlab { - .navbar-inner { - background: #F1F1F1; - border-bottom: 1px solid #DDD; - - .title { - color: #555; - - a { - color: #555; - &:hover { - text-decoration: underline; - } - } - } - - .nav > li > a { - color: $style_color; - } - } - } - } -} diff --git a/app/assets/stylesheets/themes/ui_blue.scss b/app/assets/stylesheets/themes/ui_blue.scss deleted file mode 100644 index e223058be8b..00000000000 --- a/app/assets/stylesheets/themes/ui_blue.scss +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Blue GitLab UI theme - */ -.ui_blue { - @include dark-theme(#BECDE9, #2980b9, #1970a9, #096099); -} diff --git a/app/assets/stylesheets/themes/ui_color.scss b/app/assets/stylesheets/themes/ui_color.scss deleted file mode 100644 index 7ac6903b2e4..00000000000 --- a/app/assets/stylesheets/themes/ui_color.scss +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Violet GitLab UI theme - */ -.ui_color { - @include dark-theme(#98C, #548, #436, #325); -} diff --git a/app/assets/stylesheets/themes/ui_gray.scss b/app/assets/stylesheets/themes/ui_gray.scss deleted file mode 100644 index 9257e5f4d40..00000000000 --- a/app/assets/stylesheets/themes/ui_gray.scss +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Gray GitLab UI theme - */ -.ui_gray { - @include dark-theme(#979797, #373737, #272727, #222222); -} diff --git a/app/assets/stylesheets/themes/ui_mars.scss b/app/assets/stylesheets/themes/ui_mars.scss deleted file mode 100644 index 4caf5843d9b..00000000000 --- a/app/assets/stylesheets/themes/ui_mars.scss +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Classic GitLab UI theme - */ -.ui_mars { - @include dark-theme(#979DA7, #474D57, #373D47, #24272D); -} diff --git a/app/assets/stylesheets/themes/ui_modern.scss b/app/assets/stylesheets/themes/ui_modern.scss deleted file mode 100644 index 70449882317..00000000000 --- a/app/assets/stylesheets/themes/ui_modern.scss +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Modern GitLab UI theme - */ -.ui_modern { - @include dark-theme(#ADC, #019875, #018865, #017855); -} diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb deleted file mode 100644 index 6a8f20f6047..00000000000 --- a/app/controllers/admin/application_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Provides a base class for Admin controllers to subclass -# -# Automatically sets the layout and ensures an administrator is logged in -class Admin::ApplicationController < ApplicationController - layout 'admin' - before_filter :authenticate_admin! - - def authenticate_admin! - return render_404 unless current_user.is_admin? - end -end diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb deleted file mode 100644 index b5fda196bf0..00000000000 --- a/app/controllers/admin/application_settings_controller.rb +++ /dev/null @@ -1,45 +0,0 @@ -class Admin::ApplicationSettingsController < Admin::ApplicationController - before_filter :set_application_setting - - def show - end - - def update - if @application_setting.update_attributes(application_setting_params) - redirect_to admin_application_settings_path, - notice: 'Application settings saved successfully' - else - render :show - end - end - - private - - def set_application_setting - @application_setting = ApplicationSetting.current - end - - def application_setting_params - restricted_levels = params[:application_setting][:restricted_visibility_levels] - if restricted_levels.nil? - params[:application_setting][:restricted_visibility_levels] = [] - else - restricted_levels.map! do |level| - level.to_i - end - end - - params.require(:application_setting).permit( - :default_projects_limit, - :default_branch_protection, - :signup_enabled, - :signin_enabled, - :gravatar_enabled, - :twitter_sharing_enabled, - :sign_in_text, - :home_page_url, - :max_attachment_size, - restricted_visibility_levels: [] - ) - end -end diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb deleted file mode 100644 index 471d24934a0..00000000000 --- a/app/controllers/admin/applications_controller.rb +++ /dev/null @@ -1,52 +0,0 @@ -class Admin::ApplicationsController < Admin::ApplicationController - before_action :set_application, only: [:show, :edit, :update, :destroy] - - def index - @applications = Doorkeeper::Application.where("owner_id IS NULL") - end - - def show - end - - def new - @application = Doorkeeper::Application.new - end - - def edit - end - - def create - @application = Doorkeeper::Application.new(application_params) - - if @application.save - flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) - redirect_to admin_application_url(@application) - else - render :new - end - end - - def update - if @application.update(application_params) - redirect_to admin_application_path(@application), notice: 'Application was successfully updated.' - else - render :edit - end - end - - def destroy - @application.destroy - redirect_to admin_applications_url, notice: 'Application was successfully destroyed.' - end - - private - - def set_application - @application = Doorkeeper::Application.where("owner_id IS NULL").find(params[:id]) - end - - # Only allow a trusted parameter "white list" through. - def application_params - params[:doorkeeper_application].permit(:name, :redirect_uri) - end -end diff --git a/app/controllers/admin/background_jobs_controller.rb b/app/controllers/admin/background_jobs_controller.rb deleted file mode 100644 index 338496013a0..00000000000 --- a/app/controllers/admin/background_jobs_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Admin::BackgroundJobsController < Admin::ApplicationController - def show - ps_output, _ = Gitlab::Popen.popen(%W(ps -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command)) - @sidekiq_processes = ps_output.split("\n").grep(/sidekiq/) - end -end diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb deleted file mode 100644 index e1643bb34bf..00000000000 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ /dev/null @@ -1,39 +0,0 @@ -class Admin::BroadcastMessagesController < Admin::ApplicationController - before_filter :broadcast_messages - - def index - @broadcast_message = BroadcastMessage.new - end - - def create - @broadcast_message = BroadcastMessage.new(broadcast_message_params) - - if @broadcast_message.save - redirect_to admin_broadcast_messages_path, notice: 'Broadcast Message was successfully created.' - else - render :index - end - end - - def destroy - BroadcastMessage.find(params[:id]).destroy - - respond_to do |format| - format.html { redirect_to :back } - format.js { render nothing: true } - end - end - - protected - - def broadcast_messages - @broadcast_messages ||= BroadcastMessage.order("starts_at DESC").page(params[:page]) - end - - def broadcast_message_params - params.require(:broadcast_message).permit( - :alert_type, :color, :ends_at, :font, - :message, :starts_at - ) - end -end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb deleted file mode 100644 index c491e5c7550..00000000000 --- a/app/controllers/admin/dashboard_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Admin::DashboardController < Admin::ApplicationController - def index - @projects = Project.limit(10) - @users = User.limit(10) - @groups = Group.limit(10) - end -end diff --git a/app/controllers/admin/deploy_keys_controller.rb b/app/controllers/admin/deploy_keys_controller.rb deleted file mode 100644 index e93603bef36..00000000000 --- a/app/controllers/admin/deploy_keys_controller.rb +++ /dev/null @@ -1,49 +0,0 @@ -class Admin::DeployKeysController < Admin::ApplicationController - before_filter :deploy_keys, only: [:index] - before_filter :deploy_key, only: [:show, :destroy] - - def index - - end - - def show - - end - - def new - @deploy_key = deploy_keys.new - end - - def create - @deploy_key = deploy_keys.new(deploy_key_params) - - if @deploy_key.save - redirect_to admin_deploy_keys_path - else - render "new" - end - end - - def destroy - deploy_key.destroy - - respond_to do |format| - format.html { redirect_to admin_deploy_keys_path } - format.json { head :ok } - end - end - - protected - - def deploy_key - @deploy_key ||= deploy_keys.find(params[:id]) - end - - def deploy_keys - @deploy_keys ||= DeployKey.are_public - end - - def deploy_key_params - params.require(:deploy_key).permit(:key, :title) - end -end diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb deleted file mode 100644 index 22d045fc388..00000000000 --- a/app/controllers/admin/groups_controller.rb +++ /dev/null @@ -1,64 +0,0 @@ -class Admin::GroupsController < Admin::ApplicationController - before_filter :group, only: [:edit, :show, :update, :destroy, :project_update, :members_update] - - def index - @groups = Group.all - @groups = @groups.sort(@sort = params[:sort]) - @groups = @groups.search(params[:name]) if params[:name].present? - @groups = @groups.page(params[:page]).per(PER_PAGE) - end - - def show - @members = @group.members.order("access_level DESC").page(params[:members_page]).per(PER_PAGE) - @projects = @group.projects.page(params[:projects_page]).per(PER_PAGE) - end - - def new - @group = Group.new - end - - def edit - end - - def create - @group = Group.new(group_params) - @group.name = @group.path.dup unless @group.name - - if @group.save - @group.add_owner(current_user) - redirect_to [:admin, @group], notice: 'Group was successfully created.' - else - render "new" - end - end - - def update - if @group.update_attributes(group_params) - redirect_to [:admin, @group], notice: 'Group was successfully updated.' - else - render "edit" - end - end - - def members_update - @group.add_users(params[:user_ids].split(','), params[:access_level], current_user) - - redirect_to [:admin, @group], notice: 'Users were successfully added.' - end - - def destroy - @group.destroy - - redirect_to admin_groups_path, notice: 'Group was successfully deleted.' - end - - private - - def group - @group = Group.find_by(path: params[:id]) - end - - def group_params - params.require(:group).permit(:name, :description, :path, :avatar) - end -end diff --git a/app/controllers/admin/hooks_controller.rb b/app/controllers/admin/hooks_controller.rb deleted file mode 100644 index 0a463239d74..00000000000 --- a/app/controllers/admin/hooks_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Admin::HooksController < Admin::ApplicationController - def index - @hooks = SystemHook.all - @hook = SystemHook.new - end - - def create - @hook = SystemHook.new(hook_params) - - if @hook.save - redirect_to admin_hooks_path, notice: 'Hook was successfully created.' - else - @hooks = SystemHook.all - render :index - end - end - - def destroy - @hook = SystemHook.find(params[:id]) - @hook.destroy - - redirect_to admin_hooks_path - end - - - def test - @hook = SystemHook.find(params[:hook_id]) - data = { - event_name: "project_create", - name: "Ruby", - path: "ruby", - project_id: 1, - owner_name: "Someone", - owner_email: "example@gitlabhq.com" - } - @hook.execute(data) - - redirect_to :back - end - - def hook_params - params.require(:hook).permit(:url) - end -end diff --git a/app/controllers/admin/keys_controller.rb b/app/controllers/admin/keys_controller.rb deleted file mode 100644 index 21111bb44f5..00000000000 --- a/app/controllers/admin/keys_controller.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Admin::KeysController < Admin::ApplicationController - before_filter :user, only: [:show, :destroy] - - def show - @key = user.keys.find(params[:id]) - - respond_to do |format| - format.html - format.js { render nothing: true } - end - end - - def destroy - key = user.keys.find(params[:id]) - - respond_to do |format| - if key.destroy - format.html { redirect_to [:admin, user], notice: 'User key was successfully removed.' } - else - format.html { redirect_to [:admin, user], alert: 'Failed to remove user key.' } - end - end - end - - protected - - def user - @user ||= User.find_by!(username: params[:user_id]) - end - - def key_params - params.require(:user_id, :id) - end -end diff --git a/app/controllers/admin/logs_controller.rb b/app/controllers/admin/logs_controller.rb deleted file mode 100644 index b999018dde4..00000000000 --- a/app/controllers/admin/logs_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Admin::LogsController < Admin::ApplicationController -end diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb deleted file mode 100644 index 5176a8399ae..00000000000 --- a/app/controllers/admin/projects_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Admin::ProjectsController < Admin::ApplicationController - before_filter :project, only: [:show, :transfer] - before_filter :group, only: [:show, :transfer] - before_filter :repository, only: [:show, :transfer] - - def index - @projects = Project.all - @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present? - @projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present? - @projects = @projects.with_push if params[:with_push].present? - @projects = @projects.abandoned if params[:abandoned].present? - @projects = @projects.search(params[:name]) if params[:name].present? - @projects = @projects.sort(@sort = params[:sort]) - @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(PER_PAGE) - end - - def show - if @group - @group_members = @group.members.order("access_level DESC").page(params[:group_members_page]).per(PER_PAGE) - end - - @project_members = @project.project_members.page(params[:project_members_page]).per(PER_PAGE) - end - - def transfer - ::Projects::TransferService.new(@project, current_user, params.dup).execute - - @project.reload - redirect_to admin_namespace_project_path(@project.namespace, @project) - end - - protected - - def project - @project = Project.find_with_namespace( - [params[:namespace_id], '/', params[:id]].join('') - ) - @project || render_404 - end - - def group - @group ||= @project.group - end -end diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb deleted file mode 100644 index 76a938c5fe4..00000000000 --- a/app/controllers/admin/services_controller.rb +++ /dev/null @@ -1,54 +0,0 @@ -class Admin::ServicesController < Admin::ApplicationController - before_filter :service, only: [:edit, :update] - - def index - @services = services_templates - end - - def edit - unless service.present? - redirect_to admin_application_settings_services_path, - alert: "Service is unknown or it doesn't exist" - end - end - - def update - if service.update_attributes(application_services_params[:service]) - redirect_to admin_application_settings_services_path, - notice: 'Application settings saved successfully' - else - render :edit - end - end - - private - - def services_templates - templates = [] - - Service.available_services_names.each do |service_name| - service_template = service_name.concat("_service").camelize.constantize - templates << service_template.where(template: true).first_or_create - end - - templates - end - - def service - @service ||= Service.where(id: params[:id], template: true).first - end - - def application_services_params - params.permit(:id, - service: [ - :title, :token, :type, :active, :api_key, :subdomain, - :room, :recipients, :project_url, :webhook, - :user_key, :device, :priority, :sound, :bamboo_url, :username, :password, - :build_key, :server, :teamcity_url, :build_type, - :description, :issues_url, :new_issue_url, :restrict_to_branch, - :send_from_committer_email, :disable_diffs, - :push_events, :tag_push_events, :note_events, :issues_events, - :merge_requests_events - ]) - end -end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb deleted file mode 100644 index b4c011f213c..00000000000 --- a/app/controllers/admin/users_controller.rb +++ /dev/null @@ -1,128 +0,0 @@ -class Admin::UsersController < Admin::ApplicationController - before_filter :user, only: [:show, :edit, :update, :destroy] - - def index - @users = User.order_name_asc.filter(params[:filter]) - @users = @users.search(params[:name]) if params[:name].present? - @users = @users.sort(@sort = params[:sort]) - @users = @users.page(params[:page]) - end - - def show - @personal_projects = user.personal_projects - @joined_projects = user.projects.joined(@user) - @keys = user.keys - end - - def new - @user = User.new - end - - def edit - user - end - - def block - if user.block - redirect_to :back, notice: "Successfully blocked" - else - redirect_to :back, alert: "Error occurred. User was not blocked" - end - end - - def unblock - if user.activate - redirect_to :back, notice: "Successfully unblocked" - else - redirect_to :back, alert: "Error occurred. User was not unblocked" - end - end - - def create - opts = { - force_random_password: true, - password_expires_at: nil - } - - @user = User.new(user_params.merge(opts)) - @user.created_by_id = current_user.id - @user.generate_password - @user.generate_reset_token - @user.skip_confirmation! - - respond_to do |format| - if @user.save - format.html { redirect_to [:admin, @user], notice: 'User was successfully created.' } - format.json { render json: @user, status: :created, location: @user } - else - format.html { render "new" } - format.json { render json: @user.errors, status: :unprocessable_entity } - end - end - end - - def update - user_params_with_pass = user_params.dup - - if params[:user][:password].present? - user_params_with_pass.merge!( - password: params[:user][:password], - password_confirmation: params[:user][:password_confirmation], - ) - end - - respond_to do |format| - user.skip_reconfirmation! - if user.update_attributes(user_params_with_pass) - format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' } - format.json { head :ok } - else - # restore username to keep form action url. - user.username = params[:id] - format.html { render "edit" } - format.json { render json: user.errors, status: :unprocessable_entity } - end - end - end - - def destroy - # 1. Remove groups where user is the only owner - user.solo_owned_groups.map(&:destroy) - - # 2. Remove user with all authored content including personal projects - user.destroy - - respond_to do |format| - format.html { redirect_to admin_users_path } - format.json { head :ok } - end - end - - def remove_email - email = user.emails.find(params[:email_id]) - email.destroy - - user.set_notification_email - user.save if user.notification_email_changed? - - respond_to do |format| - format.html { redirect_to :back, notice: "Successfully removed email." } - format.js { render nothing: true } - end - end - - protected - - def user - @user ||= User.find_by!(username: params[:id]) - end - - def user_params - params.require(:user).permit( - :email, :remember_me, :bio, :name, :username, - :skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :force_random_password, - :extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key, :hide_no_password, - :projects_limit, :can_create_group, :admin, :key_id - ) - end -end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb deleted file mode 100644 index 920a981e7c9..00000000000 --- a/app/controllers/application_controller.rb +++ /dev/null @@ -1,345 +0,0 @@ -require 'gon' - -class ApplicationController < ActionController::Base - include Gitlab::CurrentSettings - include GitlabRoutingHelper - - PER_PAGE = 20 - - before_filter :authenticate_user_from_token! - before_filter :authenticate_user! - before_filter :reject_blocked! - before_filter :check_password_expiration - before_filter :ldap_security_check - before_filter :default_headers - before_filter :add_gon_variables - before_filter :configure_permitted_parameters, if: :devise_controller? - before_filter :require_email, unless: :devise_controller? - - protect_from_forgery with: :exception - - helper_method :abilities, :can?, :current_application_settings - helper_method :github_import_enabled?, :gitlab_import_enabled?, :bitbucket_import_enabled? - - rescue_from Encoding::CompatibilityError do |exception| - log_exception(exception) - render "errors/encoding", layout: "errors", status: 500 - end - - rescue_from ActiveRecord::RecordNotFound do |exception| - log_exception(exception) - render "errors/not_found", layout: "errors", status: 404 - end - - protected - - # From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example - # https://gist.github.com/josevalim/fb706b1e933ef01e4fb6 - def authenticate_user_from_token! - user_token = if params[:authenticity_token].presence - params[:authenticity_token].presence - elsif params[:private_token].presence - params[:private_token].presence - end - user = user_token && User.find_by_authentication_token(user_token.to_s) - - if user - # Notice we are passing store false, so the user is not - # actually stored in the session and a token is needed - # for every request. If you want the token to work as a - # sign in token, you can simply remove store: false. - sign_in user, store: false - end - end - - def authenticate_user!(*args) - # If user is not signed-in and tries to access root_path - redirect him to landing page - if current_application_settings.home_page_url.present? - if current_user.nil? && controller_name == 'dashboard' && action_name == 'show' - redirect_to current_application_settings.home_page_url and return - end - end - - super(*args) - end - - def log_exception(exception) - application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace - application_trace.map!{ |t| " #{t}\n" } - logger.error "\n#{exception.class.name} (#{exception.message}):\n#{application_trace.join}" - end - - def reject_blocked! - if current_user && current_user.blocked? - sign_out current_user - flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it." - redirect_to new_user_session_path - end - end - - def after_sign_in_path_for(resource) - if resource.is_a?(User) && resource.respond_to?(:blocked?) && resource.blocked? - sign_out resource - flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it." - new_user_session_path - else - stored_location_for(:redirect) || stored_location_for(resource) || root_path - end - end - - def abilities - Ability.abilities - end - - def can?(object, action, subject) - abilities.allowed?(object, action, subject) - end - - def project - unless @project - namespace = params[:namespace_id] - id = params[:project_id] || params[:id] - - # Redirect from - # localhost/group/project.git - # to - # localhost/group/project - # - if id =~ /\.git\Z/ - redirect_to request.original_url.gsub(/\.git\Z/, '') and return - end - - @project = Project.find_with_namespace("#{namespace}/#{id}") - - if @project and can?(current_user, :read_project, @project) - @project - elsif current_user.nil? - @project = nil - authenticate_user! - else - @project = nil - render_404 and return - end - end - @project - end - - def repository - @repository ||= project.repository - rescue Grit::NoSuchPathError => e - log_exception(e) - nil - end - - def authorize_project!(action) - return access_denied! unless can?(current_user, action, project) - end - - def authorize_labels! - # Labels should be accessible for issues and/or merge requests - authorize_read_issue! || authorize_read_merge_request! - end - - def access_denied! - render "errors/access_denied", layout: "errors", status: 404 - end - - def not_found! - render "errors/not_found", layout: "errors", status: 404 - end - - def git_not_found! - render "errors/git_not_found", layout: "errors", status: 404 - end - - def method_missing(method_sym, *arguments, &block) - if method_sym.to_s =~ /\Aauthorize_(.*)!\z/ - authorize_project!($1.to_sym) - else - super - end - end - - def render_403 - head :forbidden - end - - def render_404 - render file: Rails.root.join("public", "404"), layout: false, status: "404" - end - - def require_non_empty_project - redirect_to @project if @project.empty_repo? - end - - def no_cache_headers - response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" - response.headers["Pragma"] = "no-cache" - response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT" - end - - def default_url_options - if !Rails.env.test? - port = Gitlab.config.gitlab.port unless Gitlab.config.gitlab_on_standard_port? - { host: Gitlab.config.gitlab.host, - protocol: Gitlab.config.gitlab.protocol, - port: port, - script_name: Gitlab.config.gitlab.relative_url_root } - else - super - end - end - - def default_headers - headers['X-Frame-Options'] = 'DENY' - headers['X-XSS-Protection'] = '1; mode=block' - headers['X-UA-Compatible'] = 'IE=edge' - headers['X-Content-Type-Options'] = 'nosniff' - headers['Strict-Transport-Security'] = 'max-age=31536000' if Gitlab.config.gitlab.https - end - - def add_gon_variables - gon.default_issues_tracker = Project.new.default_issue_tracker.to_param - gon.api_version = API::API.version - gon.relative_url_root = Gitlab.config.gitlab.relative_url_root - gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s - gon.max_file_size = current_application_settings.max_attachment_size; - - if current_user - gon.current_user_id = current_user.id - gon.api_token = current_user.private_token - end - end - - def check_password_expiration - if current_user && current_user.password_expires_at && current_user.password_expires_at < Time.now && !current_user.ldap_user? - redirect_to new_profile_password_path and return - end - end - - def ldap_security_check - if current_user && current_user.requires_ldap_check? - unless Gitlab::LDAP::Access.allowed?(current_user) - sign_out current_user - flash[:alert] = "Access denied for your LDAP account." - redirect_to new_user_session_path - end - end - end - - def event_filter - filters = cookies['event_filter'].split(',') if cookies['event_filter'].present? - @event_filter ||= EventFilter.new(filters) - end - - def gitlab_ldap_access(&block) - Gitlab::LDAP::Access.open { |access| block.call(access) } - end - - # JSON for infinite scroll via Pager object - def pager_json(partial, count) - html = render_to_string( - partial, - layout: false, - formats: [:html] - ) - - render json: { - html: html, - count: count - } - end - - def view_to_html_string(partial) - render_to_string( - partial, - layout: false, - formats: [:html] - ) - end - - def configure_permitted_parameters - devise_parameter_sanitizer.sanitize(:sign_in) { |u| u.permit(:username, :email, :password, :login, :remember_me) } - end - - def hexdigest(string) - Digest::SHA1.hexdigest string - end - - def require_email - if current_user && current_user.temp_oauth_email? - redirect_to profile_path, notice: 'Please complete your profile with email address' and return - end - end - - def set_filters_params - params[:sort] ||= 'created_desc' - params[:scope] = 'all' if params[:scope].blank? - params[:state] = 'opened' if params[:state].blank? - - @filter_params = params.dup - - if @project - @filter_params[:project_id] = @project.id - elsif @group - @filter_params[:group_id] = @group.id - else - # TODO: this filter ignore issues/mr created in public or - # internal repos where you are not a member. Enable this filter - # or improve current implementation to filter only issues you - # created or assigned or mentioned - #@filter_params[:authorized_only] = true - end - - @filter_params - end - - def set_filter_values(collection) - assignee_id = @filter_params[:assignee_id] - author_id = @filter_params[:author_id] - milestone_id = @filter_params[:milestone_id] - - @sort = @filter_params[:sort] - @assignees = User.where(id: collection.pluck(:assignee_id)) - @authors = User.where(id: collection.pluck(:author_id)) - @milestones = Milestone.where(id: collection.pluck(:milestone_id)) - - if assignee_id.present? && !assignee_id.to_i.zero? - @assignee = @assignees.find_by(id: assignee_id) - end - - if author_id.present? && !author_id.to_i.zero? - @author = @authors.find_by(id: author_id) - end - - if milestone_id.present? && !milestone_id.to_i.zero? - @milestone = @milestones.find_by(id: milestone_id) - end - end - - def get_issues_collection - set_filters_params - issues = IssuesFinder.new.execute(current_user, @filter_params) - set_filter_values(issues) - issues - end - - def get_merge_requests_collection - set_filters_params - merge_requests = MergeRequestsFinder.new.execute(current_user, @filter_params) - set_filter_values(merge_requests) - merge_requests - end - - def github_import_enabled? - OauthHelper.enabled_oauth_providers.include?(:github) - end - - def gitlab_import_enabled? - OauthHelper.enabled_oauth_providers.include?(:gitlab) - end - - def bitbucket_import_enabled? - OauthHelper.enabled_oauth_providers.include?(:bitbucket) && Gitlab::BitbucketImport.public_key.present? - end -end diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb deleted file mode 100644 index 11af9895261..00000000000 --- a/app/controllers/autocomplete_controller.rb +++ /dev/null @@ -1,30 +0,0 @@ -class AutocompleteController < ApplicationController - def users - @users = - if params[:project_id].present? - project = Project.find(params[:project_id]) - - if can?(current_user, :read_project, project) - project.team.users - end - elsif params[:group_id] - group = Group.find(params[:group_id]) - - if can?(current_user, :read_group, group) - group.users - end - else - User.all - end - - @users = @users.search(params[:search]) if params[:search].present? - @users = @users.active - @users = @users.page(params[:page]).per(PER_PAGE) - render json: @users, only: [:name, :username, :id], methods: [:avatar_url] - end - - def user - @user = User.find(params[:id]) - render json: @user, only: [:name, :username, :id], methods: [:avatar_url] - end -end diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb deleted file mode 100644 index af1faca93f6..00000000000 --- a/app/controllers/confirmations_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -class ConfirmationsController < Devise::ConfirmationsController - - protected - - def after_confirmation_path_for(resource_name, resource) - if signed_in?(resource_name) - after_sign_in_path_for(resource) - else - sign_in(resource) - if signed_in?(resource_name) - after_sign_in_path_for(resource) - else - new_session_path(resource_name) - end - end - end -end diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb deleted file mode 100644 index ed14f4e1f3b..00000000000 --- a/app/controllers/dashboard/groups_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Dashboard::GroupsController < ApplicationController - def index - @group_members = current_user.group_members.page(params[:page]).per(PER_PAGE) - end -end diff --git a/app/controllers/dashboard/milestones_controller.rb b/app/controllers/dashboard/milestones_controller.rb deleted file mode 100644 index cb51792df16..00000000000 --- a/app/controllers/dashboard/milestones_controller.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Dashboard::MilestonesController < ApplicationController - before_filter :load_projects - - def index - project_milestones = case params[:state] - when 'all'; state - when 'closed'; state('closed') - else state('active') - end - @dashboard_milestones = Milestones::GroupService.new(project_milestones).execute - @dashboard_milestones = Kaminari.paginate_array(@dashboard_milestones).page(params[:page]).per(PER_PAGE) - end - - def show - project_milestones = Milestone.where(project_id: @projects).order("due_date ASC") - @dashboard_milestone = Milestones::GroupService.new(project_milestones).milestone(title) - end - - private - - def load_projects - @projects = current_user.authorized_projects.sorted_by_activity.non_archived - end - - def title - params[:title] - end - - def state(state = nil) - conditions = { project_id: @projects } - conditions.reverse_merge!(state: state) if state - Milestone.where(conditions).order("title ASC") - end -end diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb deleted file mode 100644 index 56e6fcc41ca..00000000000 --- a/app/controllers/dashboard/projects_controller.rb +++ /dev/null @@ -1,27 +0,0 @@ -class Dashboard::ProjectsController < ApplicationController - before_filter :event_filter - - def starred - @projects = current_user.starred_projects - @projects = @projects.includes(:namespace, :forked_from_project, :tags) - @projects = @projects.sort(@sort = params[:sort]) - @groups = [] - - respond_to do |format| - format.html - - format.json do - load_events - pager_json("events/_events", @events.count) - end - end - end - - private - - def load_events - @events = Event.in_projects(@projects.pluck(:id)) - @events = @event_filter.apply_filter(@events).with_associations - @events = @events.limit(20).offset(params[:offset] || 0) - end -end diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb deleted file mode 100644 index 9bd853ed5c7..00000000000 --- a/app/controllers/dashboard_controller.rb +++ /dev/null @@ -1,54 +0,0 @@ -class DashboardController < ApplicationController - respond_to :html - - before_filter :load_projects, except: [:projects] - before_filter :event_filter, only: :show - - def show - @projects = @projects.includes(:namespace) - @last_push = current_user.recent_push - - respond_to do |format| - format.html - - format.json do - load_events - pager_json("events/_events", @events.count) - end - - format.atom do - load_events - render layout: false - end - end - end - - def merge_requests - @merge_requests = get_merge_requests_collection - @merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE) - @merge_requests = @merge_requests.preload(:author, :target_project) - end - - def issues - @issues = get_issues_collection - @issues = @issues.page(params[:page]).per(PER_PAGE) - @issues = @issues.preload(:author, :project) - - respond_to do |format| - format.html - format.atom { render layout: false } - end - end - - protected - - def load_projects - @projects = current_user.authorized_projects.sorted_by_activity.non_archived - end - - def load_events - @events = Event.in_projects(current_user.authorized_projects.pluck(:id)) - @events = @event_filter.apply_filter(@events).with_associations - @events = @events.limit(20).offset(params[:offset] || 0) - end -end diff --git a/app/controllers/explore/groups_controller.rb b/app/controllers/explore/groups_controller.rb deleted file mode 100644 index c51a4a211a6..00000000000 --- a/app/controllers/explore/groups_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Explore::GroupsController < ApplicationController - skip_before_filter :authenticate_user!, - :reject_blocked, :set_current_user_for_observers - - layout "explore" - - def index - @groups = GroupsFinder.new.execute(current_user) - @groups = @groups.search(params[:search]) if params[:search].present? - @groups = @groups.sort(@sort = params[:sort]) - @groups = @groups.page(params[:page]).per(PER_PAGE) - end -end diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb deleted file mode 100644 index b295f295bb1..00000000000 --- a/app/controllers/explore/projects_controller.rb +++ /dev/null @@ -1,27 +0,0 @@ -class Explore::ProjectsController < ApplicationController - skip_before_filter :authenticate_user!, - :reject_blocked - - layout 'explore' - - def index - @projects = ProjectsFinder.new.execute(current_user) - @tags = @projects.tags_on(:tags) - @projects = @projects.tagged_with(params[:tag]) if params[:tag].present? - @projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present? - @projects = @projects.search(params[:search]) if params[:search].present? - @projects = @projects.sort(@sort = params[:sort]) - @projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE) - end - - def trending - @trending_projects = TrendingProjectsFinder.new.execute(current_user) - @trending_projects = @trending_projects.page(params[:page]).per(PER_PAGE) - end - - def starred - @starred_projects = ProjectsFinder.new.execute(current_user) - @starred_projects = @starred_projects.reorder('star_count DESC') - @starred_projects = @starred_projects.page(params[:page]).per(PER_PAGE) - end -end diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb deleted file mode 100644 index 469a6813ee2..00000000000 --- a/app/controllers/groups/application_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class Groups::ApplicationController < ApplicationController - - private - - def authorize_read_group! - unless @group and can?(current_user, :read_group, @group) - if current_user.nil? - return authenticate_user! - else - return render_404 - end - end - end - - def authorize_admin_group! - unless can?(current_user, :admin_group, group) - return render_404 - end - end - - def determine_layout - if current_user - 'group' - else - 'public_group' - end - end -end diff --git a/app/controllers/groups/avatars_controller.rb b/app/controllers/groups/avatars_controller.rb deleted file mode 100644 index 38071410f40..00000000000 --- a/app/controllers/groups/avatars_controller.rb +++ /dev/null @@ -1,12 +0,0 @@ -class Groups::AvatarsController < ApplicationController - layout "profile" - - def destroy - @group = Group.find_by(path: params[:group_id]) - @group.remove_avatar! - - @group.save - - redirect_to edit_group_path(@group) - end -end diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb deleted file mode 100644 index 265cf4f0f4a..00000000000 --- a/app/controllers/groups/group_members_controller.rb +++ /dev/null @@ -1,84 +0,0 @@ -class Groups::GroupMembersController < Groups::ApplicationController - skip_before_filter :authenticate_user!, only: [:index] - before_filter :group - - # Authorize - before_filter :authorize_read_group! - before_filter :authorize_admin_group!, except: [:index, :leave] - - layout :determine_layout - - def index - @project = @group.projects.find(params[:project_id]) if params[:project_id] - @members = @group.group_members - @members = @members.non_invite unless can?(current_user, :admin_group, @group) - - if params[:search].present? - users = @group.users.search(params[:search]).to_a - @members = @members.where(user_id: users) - end - - @members = @members.order('access_level DESC').page(params[:page]).per(50) - @group_member = GroupMember.new - end - - def create - @group.add_users(params[:user_ids].split(','), params[:access_level], current_user) - - redirect_to group_group_members_path(@group), notice: 'Users were successfully added.' - end - - def update - @member = @group.group_members.find(params[:id]) - @member.update_attributes(member_params) - end - - def destroy - @group_member = @group.group_members.find(params[:id]) - - if can?(current_user, :destroy_group_member, @group_member) # May fail if last owner. - @group_member.destroy - respond_to do |format| - format.html { redirect_to group_group_members_path(@group), notice: 'User was successfully removed from group.' } - format.js { render nothing: true } - end - else - return render_403 - end - end - - def resend_invite - redirect_path = group_group_members_path(@group) - - @group_member = @group.group_members.find(params[:id]) - - if @group_member.invite? - @group_member.resend_invite - - redirect_to redirect_path, notice: 'The invitation was successfully resent.' - else - redirect_to redirect_path, alert: 'The invitation has already been accepted.' - end - end - - def leave - @group_member = @group.group_members.where(user_id: current_user.id).first - - if can?(current_user, :destroy_group_member, @group_member) - @group_member.destroy - redirect_to(dashboard_groups_path, notice: "You left #{group.name} group.") - else - return render_403 - end - end - - protected - - def group - @group ||= Group.find_by(path: params[:group_id]) - end - - def member_params - params.require(:group_member).permit(:access_level, :user_id) - end -end diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb deleted file mode 100644 index 546ff2cc71f..00000000000 --- a/app/controllers/groups/milestones_controller.rb +++ /dev/null @@ -1,56 +0,0 @@ -class Groups::MilestonesController < ApplicationController - layout 'group' - - before_filter :authorize_group_milestone!, only: :update - - def index - project_milestones = case params[:state] - when 'all'; state - when 'closed'; state('closed') - else state('active') - end - @group_milestones = Milestones::GroupService.new(project_milestones).execute - @group_milestones = Kaminari.paginate_array(@group_milestones).page(params[:page]).per(PER_PAGE) - end - - def show - project_milestones = Milestone.where(project_id: group.projects).order("due_date ASC") - @group_milestone = Milestones::GroupService.new(project_milestones).milestone(title) - end - - def update - project_milestones = Milestone.where(project_id: group.projects).order("due_date ASC") - @group_milestones = Milestones::GroupService.new(project_milestones).milestone(title) - - @group_milestones.milestones.each do |milestone| - Milestones::UpdateService.new(milestone.project, current_user, params[:milestone]).execute(milestone) - end - - respond_to do |format| - format.js - format.html do - redirect_to group_milestones_path(group) - end - end - end - - private - - def group - @group ||= Group.find_by(path: params[:group_id]) - end - - def title - params[:title] - end - - def state(state = nil) - conditions = { project_id: group.projects } - conditions.reverse_merge!(state: state) if state - Milestone.where(conditions).order("title ASC") - end - - def authorize_group_milestone! - return render_404 unless can?(current_user, :admin_group, group) - end -end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb deleted file mode 100644 index 7af3c077182..00000000000 --- a/app/controllers/groups_controller.rb +++ /dev/null @@ -1,145 +0,0 @@ -class GroupsController < Groups::ApplicationController - skip_before_filter :authenticate_user!, only: [:show, :issues, :merge_requests] - respond_to :html - before_filter :group, except: [:new, :create] - - # Authorize - before_filter :authorize_read_group!, except: [:new, :create] - before_filter :authorize_admin_group!, only: [:edit, :update, :destroy, :projects] - before_filter :authorize_create_group!, only: [:new, :create] - - # Load group projects - before_filter :load_projects, except: [:new, :create, :projects, :edit, :update] - before_filter :event_filter, only: :show - before_filter :set_title, only: [:new, :create] - - layout :determine_layout - - def new - @group = Group.new - end - - def create - @group = Group.new(group_params) - @group.name = @group.path.dup unless @group.name - - if @group.save - @group.add_owner(current_user) - redirect_to @group, notice: 'Group was successfully created.' - else - render action: "new" - end - end - - def show - @last_push = current_user.recent_push if current_user - @projects = @projects.includes(:namespace) - - respond_to do |format| - format.html - - format.json do - load_events - pager_json("events/_events", @events.count) - end - - format.atom do - load_events - render layout: false - end - end - end - - def merge_requests - @merge_requests = get_merge_requests_collection - @merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE) - @merge_requests = @merge_requests.preload(:author, :target_project) - end - - def issues - @issues = get_issues_collection - @issues = @issues.page(params[:page]).per(PER_PAGE) - @issues = @issues.preload(:author, :project) - - respond_to do |format| - format.html - format.atom { render layout: false } - end - end - - def edit - end - - def projects - @projects = @group.projects.page(params[:page]) - end - - def update - if @group.update_attributes(group_params) - redirect_to edit_group_path(@group), notice: 'Group was successfully updated.' - else - render action: "edit" - end - end - - def destroy - @group.destroy - - redirect_to root_path, notice: 'Group was removed.' - end - - protected - - def group - @group ||= Group.find_by(path: params[:id]) - end - - def load_projects - @projects ||= ProjectsFinder.new.execute(current_user, group: group).sorted_by_activity.non_archived - end - - def project_ids - @projects.pluck(:id) - end - - # Dont allow unauthorized access to group - def authorize_read_group! - unless @group and (@projects.present? or can?(current_user, :read_group, @group)) - if current_user.nil? - return authenticate_user! - else - return render_404 - end - end - end - - def authorize_create_group! - unless can?(current_user, :create_group, nil) - return render_404 - end - end - - def set_title - @title = 'New Group' - end - - def determine_layout - if [:new, :create].include?(action_name.to_sym) - 'navless' - elsif current_user - 'group' - else - 'public_group' - end - end - - def group_params - params.require(:group).permit(:name, :description, :path, :avatar) - end - - def load_events - @events = Event.in_projects(project_ids) - @events = event_filter.apply_filter(@events).with_associations - @events = @events.limit(20).offset(params[:offset] || 0) - end -end diff --git a/app/controllers/import/base_controller.rb b/app/controllers/import/base_controller.rb deleted file mode 100644 index 93a7ace3530..00000000000 --- a/app/controllers/import/base_controller.rb +++ /dev/null @@ -1,19 +0,0 @@ -class Import::BaseController < ApplicationController - - private - - def get_or_create_namespace - begin - namespace = Group.create!(name: @target_namespace, path: @target_namespace, owner: current_user) - namespace.add_owner(current_user) - rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid - namespace = Namespace.find_by_path_or_name(@target_namespace) - unless current_user.can?(:create_projects, namespace) - @already_been_taken = true - return false - end - end - - namespace - end -end diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb deleted file mode 100644 index bb8d7e0235c..00000000000 --- a/app/controllers/import/bitbucket_controller.rb +++ /dev/null @@ -1,82 +0,0 @@ -class Import::BitbucketController < Import::BaseController - before_filter :verify_bitbucket_import_enabled - before_filter :bitbucket_auth, except: :callback - - rescue_from OAuth::Error, with: :bitbucket_unauthorized - - def callback - request_token = session.delete(:oauth_request_token) - raise "Session expired!" if request_token.nil? - - request_token.symbolize_keys! - - access_token = client.get_token(request_token, params[:oauth_verifier], callback_import_bitbucket_url) - - current_user.bitbucket_access_token = access_token.token - current_user.bitbucket_access_token_secret = access_token.secret - - current_user.save - redirect_to status_import_bitbucket_url - end - - def status - @repos = client.projects - - @already_added_projects = current_user.created_projects.where(import_type: "bitbucket") - already_added_projects_names = @already_added_projects.pluck(:import_source) - - @repos.to_a.reject!{ |repo| already_added_projects_names.include? "#{repo["owner"]}/#{repo["slug"]}" } - end - - def jobs - jobs = current_user.created_projects.where(import_type: "bitbucket").to_json(only: [:id, :import_status]) - render json: jobs - end - - def create - @repo_id = params[:repo_id] || "" - repo = client.project(@repo_id.gsub("___", "/")) - @project_name = repo["slug"] - - repo_owner = repo["owner"] - repo_owner = current_user.username if repo_owner == client.user["user"]["username"] - @target_namespace = params[:new_namespace].presence || repo_owner - - namespace = get_or_create_namespace || (render and return) - - unless Gitlab::BitbucketImport::KeyAdder.new(repo, current_user).execute - @access_denied = true - render - return - end - - @project = Gitlab::BitbucketImport::ProjectCreator.new(repo, namespace, current_user).execute - end - - private - - def client - @client ||= Gitlab::BitbucketImport::Client.new(current_user.bitbucket_access_token, current_user.bitbucket_access_token_secret) - end - - def verify_bitbucket_import_enabled - not_found! unless bitbucket_import_enabled? - end - - def bitbucket_auth - if current_user.bitbucket_access_token.blank? - go_to_bitbucket_for_permissions - end - end - - def go_to_bitbucket_for_permissions - request_token = client.request_token(callback_import_bitbucket_url) - session[:oauth_request_token] = request_token - - redirect_to client.authorize_url(request_token, callback_import_bitbucket_url) - end - - def bitbucket_unauthorized - go_to_bitbucket_for_permissions - end -end diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb deleted file mode 100644 index 87b41454c77..00000000000 --- a/app/controllers/import/github_controller.rb +++ /dev/null @@ -1,68 +0,0 @@ -class Import::GithubController < Import::BaseController - before_filter :verify_github_import_enabled - before_filter :github_auth, except: :callback - - rescue_from Octokit::Unauthorized, with: :github_unauthorized - - def callback - token = client.get_token(params[:code]) - current_user.github_access_token = token - current_user.save - redirect_to status_import_github_url - end - - def status - @repos = client.repos - client.orgs.each do |org| - @repos += client.org_repos(org.login) - end - - @already_added_projects = current_user.created_projects.where(import_type: "github") - already_added_projects_names = @already_added_projects.pluck(:import_source) - - @repos.reject!{ |repo| already_added_projects_names.include? repo.full_name } - end - - def jobs - jobs = current_user.created_projects.where(import_type: "github").to_json(only: [:id, :import_status]) - render json: jobs - end - - def create - @repo_id = params[:repo_id].to_i - repo = client.repo(@repo_id) - @project_name = repo.name - - repo_owner = repo.owner.login - repo_owner = current_user.username if repo_owner == client.user.login - @target_namespace = params[:new_namespace].presence || repo_owner - - namespace = get_or_create_namespace || (render and return) - - @project = Gitlab::GithubImport::ProjectCreator.new(repo, namespace, current_user).execute - end - - private - - def client - @client ||= Gitlab::GithubImport::Client.new(current_user.github_access_token) - end - - def verify_github_import_enabled - not_found! unless github_import_enabled? - end - - def github_auth - if current_user.github_access_token.blank? - go_to_github_for_permissions - end - end - - def go_to_github_for_permissions - redirect_to client.authorize_url(callback_import_github_url) - end - - def github_unauthorized - go_to_github_for_permissions - end -end diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb deleted file mode 100644 index bddbfded812..00000000000 --- a/app/controllers/import/gitlab_controller.rb +++ /dev/null @@ -1,65 +0,0 @@ -class Import::GitlabController < Import::BaseController - before_filter :verify_gitlab_import_enabled - before_filter :gitlab_auth, except: :callback - - rescue_from OAuth2::Error, with: :gitlab_unauthorized - - def callback - token = client.get_token(params[:code], callback_import_gitlab_url) - current_user.gitlab_access_token = token - current_user.save - redirect_to status_import_gitlab_url - end - - def status - @repos = client.projects - - @already_added_projects = current_user.created_projects.where(import_type: "gitlab") - already_added_projects_names = @already_added_projects.pluck(:import_source) - - @repos = @repos.to_a.reject{ |repo| already_added_projects_names.include? repo["path_with_namespace"] } - end - - def jobs - jobs = current_user.created_projects.where(import_type: "gitlab").to_json(only: [:id, :import_status]) - render json: jobs - end - - def create - @repo_id = params[:repo_id].to_i - repo = client.project(@repo_id) - @project_name = repo["name"] - - repo_owner = repo["namespace"]["path"] - repo_owner = current_user.username if repo_owner == client.user["username"] - @target_namespace = params[:new_namespace].presence || repo_owner - - namespace = get_or_create_namespace || (render and return) - - @project = Gitlab::GitlabImport::ProjectCreator.new(repo, namespace, current_user).execute - end - - private - - def client - @client ||= Gitlab::GitlabImport::Client.new(current_user.gitlab_access_token) - end - - def verify_gitlab_import_enabled - not_found! unless gitlab_import_enabled? - end - - def gitlab_auth - if current_user.gitlab_access_token.blank? - go_to_gitlab_for_permissions - end - end - - def go_to_gitlab_for_permissions - redirect_to client.authorize_url(callback_import_gitlab_url) - end - - def gitlab_unauthorized - go_to_gitlab_for_permissions - end -end diff --git a/app/controllers/import/gitorious_controller.rb b/app/controllers/import/gitorious_controller.rb deleted file mode 100644 index 6067a87ee04..00000000000 --- a/app/controllers/import/gitorious_controller.rb +++ /dev/null @@ -1,43 +0,0 @@ -class Import::GitoriousController < Import::BaseController - - def new - redirect_to client.authorize_url(callback_import_gitorious_url) - end - - def callback - session[:gitorious_repos] = params[:repos] - redirect_to status_import_gitorious_url - end - - def status - @repos = client.repos - - @already_added_projects = current_user.created_projects.where(import_type: "gitorious") - already_added_projects_names = @already_added_projects.pluck(:import_source) - - @repos.reject! { |repo| already_added_projects_names.include? repo.full_name } - end - - def jobs - jobs = current_user.created_projects.where(import_type: "gitorious").to_json(only: [:id, :import_status]) - render json: jobs - end - - def create - @repo_id = params[:repo_id] - repo = client.repo(@repo_id) - @target_namespace = params[:new_namespace].presence || repo.namespace - @project_name = repo.name - - namespace = get_or_create_namespace || (render and return) - - @project = Gitlab::GitoriousImport::ProjectCreator.new(repo, namespace, current_user).execute - end - - private - - def client - @client ||= Gitlab::GitoriousImport::Client.new(session[:gitorious_repos]) - end - -end diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb deleted file mode 100644 index 1f97ff16c55..00000000000 --- a/app/controllers/invites_controller.rb +++ /dev/null @@ -1,83 +0,0 @@ -class InvitesController < ApplicationController - before_filter :member - skip_before_filter :authenticate_user!, only: :decline - - respond_to :html - - layout 'navless' - - def show - - end - - def accept - if member.accept_invite!(current_user) - label, path = source_info(member.source) - - redirect_to path, notice: "You have been granted #{member.human_access} access to #{label}." - else - redirect_to :back, alert: "The invitation could not be accepted." - end - end - - def decline - if member.decline_invite! - label, _ = source_info(member.source) - - path = - if current_user - dashboard_path - else - new_user_session_path - end - - redirect_to path, notice: "You have declined the invitation to join #{label}." - else - redirect_to :back, alert: "The invitation could not be declined." - end - end - - private - - def member - return @member if defined?(@member) - - @token = params[:id] - @member = Member.find_by_invite_token(@token) - - unless @member - render_404 and return - end - - @member - end - - def authenticate_user! - return if current_user - - notice = "To accept this invitation, sign in" - notice << " or create an account" if current_application_settings.signup_enabled? - notice << "." - - store_location_for :user, request.fullpath - redirect_to new_user_session_path, notice: notice - end - - def source_info(source) - case source - when Project - project = member.source - label = "project #{project.name_with_namespace}" - path = namespace_project_path(project.namespace, project) - when Group - group = member.source - label = "group #{group.name}" - path = group_path(group) - else - label = "who knows what" - path = dashboard_path - end - - [label, path] - end -end diff --git a/app/controllers/namespaces_controller.rb b/app/controllers/namespaces_controller.rb deleted file mode 100644 index 386d103ee5a..00000000000 --- a/app/controllers/namespaces_controller.rb +++ /dev/null @@ -1,25 +0,0 @@ -class NamespacesController < ApplicationController - skip_before_filter :authenticate_user! - - def show - namespace = Namespace.find_by(path: params[:id]) - - if namespace - if namespace.is_a?(Group) - group = namespace - else - user = namespace.owner - end - end - - if user - redirect_to user_path(user) - elsif group && can?(current_user, :read_group, group) - redirect_to group_path(group) - elsif current_user.nil? - authenticate_user! - else - render_404 - end - end -end diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb deleted file mode 100644 index efa291d9397..00000000000 --- a/app/controllers/oauth/applications_controller.rb +++ /dev/null @@ -1,39 +0,0 @@ -class Oauth::ApplicationsController < Doorkeeper::ApplicationsController - before_filter :authenticate_user! - layout "profile" - - def index - head :forbidden and return - end - - def create - @application = Doorkeeper::Application.new(application_params) - - @application.owner = current_user - - if @application.save - flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) - redirect_to oauth_application_url(@application) - else - render :new - end - end - - def destroy - if @application.destroy - flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :destroy]) - end - - redirect_to applications_profile_url - end - - private - - def set_application - @application = current_user.oauth_applications.find(params[:id]) - end - - rescue_from ActiveRecord::RecordNotFound do |exception| - render "errors/not_found", layout: "errors", status: 404 - end -end diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb deleted file mode 100644 index a57b4a60c24..00000000000 --- a/app/controllers/oauth/authorizations_controller.rb +++ /dev/null @@ -1,57 +0,0 @@ -class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController - before_filter :authenticate_resource_owner! - layout "profile" - - def new - if pre_auth.authorizable? - if skip_authorization? || matching_token? - auth = authorization.authorize - redirect_to auth.redirect_uri - else - render "doorkeeper/authorizations/new" - end - else - render "doorkeeper/authorizations/error" - end - end - - # TODO: Handle raise invalid authorization - def create - redirect_or_render authorization.authorize - end - - def destroy - redirect_or_render authorization.deny - end - - private - - def matching_token? - Doorkeeper::AccessToken.matching_token_for(pre_auth.client, - current_resource_owner.id, - pre_auth.scopes) - end - - def redirect_or_render(auth) - if auth.redirectable? - redirect_to auth.redirect_uri - else - render json: auth.body, status: auth.status - end - end - - def pre_auth - @pre_auth ||= - Doorkeeper::OAuth::PreAuthorization.new(Doorkeeper.configuration, - server.client_via_uid, - params) - end - - def authorization - @authorization ||= strategy.request - end - - def strategy - @strategy ||= server.authorization_request(pre_auth.response_type) - end -end diff --git a/app/controllers/oauth/authorized_applications_controller.rb b/app/controllers/oauth/authorized_applications_controller.rb deleted file mode 100644 index 0b27ce7da72..00000000000 --- a/app/controllers/oauth/authorized_applications_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController - layout "profile" - - def destroy - Doorkeeper::AccessToken.revoke_all_for(params[:id], current_resource_owner) - redirect_to applications_profile_url, notice: I18n.t(:notice, scope: [:doorkeeper, :flash, :authorized_applications, :destroy]) - end -end diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb deleted file mode 100644 index bb9d65c9ed6..00000000000 --- a/app/controllers/omniauth_callbacks_controller.rb +++ /dev/null @@ -1,76 +0,0 @@ -class OmniauthCallbacksController < Devise::OmniauthCallbacksController - Gitlab.config.omniauth.providers.each do |provider| - define_method provider['name'] do - handle_omniauth - end - end - - # Extend the standard message generation to accept our custom exception - def failure_message - exception = env["omniauth.error"] - error = exception.error_reason if exception.respond_to?(:error_reason) - error ||= exception.error if exception.respond_to?(:error) - error ||= exception.message if exception.respond_to?(:message) - error ||= env["omniauth.error.type"].to_s - error.to_s.humanize if error - end - - # We only find ourselves here - # if the authentication to LDAP was successful. - def ldap - @user = Gitlab::LDAP::User.new(oauth) - @user.save if @user.changed? # will also save new users - gl_user = @user.gl_user - gl_user.remember_me = true if @user.persisted? - - # Do additional LDAP checks for the user filter and EE features - if @user.allowed? - sign_in_and_redirect(gl_user) - else - flash[:alert] = "Access denied for your LDAP account." - redirect_to new_user_session_path - end - end - - def omniauth_error - @provider = params[:provider] - @error = params[:error] - render 'errors/omniauth_error', layout: "errors", status: 422 - end - - private - - def handle_omniauth - if current_user - # Add new authentication method - current_user.identities.find_or_create_by(extern_uid: oauth['uid'], provider: oauth['provider']) - redirect_to profile_account_path, notice: 'Authentication method updated' - else - @user = Gitlab::OAuth::User.new(oauth) - @user.save - - # Only allow properly saved users to login. - if @user.persisted? && @user.valid? - sign_in_and_redirect(@user.gl_user) - else - error_message = - if @user.gl_user.errors.any? - @user.gl_user.errors.map do |attribute, message| - "#{attribute} #{message}" - end.join(", ") - else - '' - end - - redirect_to omniauth_error_path(oauth['provider'], error: error_message) and return - end - end - rescue Gitlab::OAuth::ForbiddenAction => e - flash[:notice] = e.message - redirect_to new_user_session_path - end - - def oauth - @oauth ||= request.env['omniauth.auth'] - end -end diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb deleted file mode 100644 index dcbbe5baa4b..00000000000 --- a/app/controllers/passwords_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -class PasswordsController < Devise::PasswordsController - - def create - email = resource_params[:email] - resource_found = resource_class.find_by_email(email) - if resource_found && resource_found.ldap_user? - flash[:alert] = "Cannot reset password for LDAP user." - respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name)) and return - end - - self.resource = resource_class.send_reset_password_instructions(resource_params) - if successfully_sent?(resource) - respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name)) - else - respond_with(resource) - end - end -end diff --git a/app/controllers/profiles/accounts_controller.rb b/app/controllers/profiles/accounts_controller.rb deleted file mode 100644 index 9bd34fe2261..00000000000 --- a/app/controllers/profiles/accounts_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Profiles::AccountsController < ApplicationController - layout "profile" - - def show - @user = current_user - end - - def unlink - provider = params[:provider] - current_user.identities.find_by(provider: provider).destroy - redirect_to profile_account_path - end -end diff --git a/app/controllers/profiles/avatars_controller.rb b/app/controllers/profiles/avatars_controller.rb deleted file mode 100644 index 57f3bbf0627..00000000000 --- a/app/controllers/profiles/avatars_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Profiles::AvatarsController < ApplicationController - layout "profile" - - def destroy - @user = current_user - @user.remove_avatar! - - @user.save - @user.reset_events_cache - - redirect_to profile_path - end -end diff --git a/app/controllers/profiles/emails_controller.rb b/app/controllers/profiles/emails_controller.rb deleted file mode 100644 index 954c98c0d9f..00000000000 --- a/app/controllers/profiles/emails_controller.rb +++ /dev/null @@ -1,37 +0,0 @@ -class Profiles::EmailsController < ApplicationController - layout "profile" - - def index - @primary = current_user.email - @public_email = current_user.public_email - @emails = current_user.emails - end - - def create - @email = current_user.emails.new(email_params) - - flash[:alert] = @email.errors.full_messages.first unless @email.save - - redirect_to profile_emails_url - end - - def destroy - @email = current_user.emails.find(params[:id]) - @email.destroy - - current_user.set_notification_email - current_user.set_public_email - current_user.save if current_user.notification_email_changed? or current_user.public_email_changed? - - respond_to do |format| - format.html { redirect_to profile_emails_url } - format.js { render nothing: true } - end - end - - private - - def email_params - params.require(:email).permit(:email) - end -end diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb deleted file mode 100644 index 4e2bd0a9b4b..00000000000 --- a/app/controllers/profiles/keys_controller.rb +++ /dev/null @@ -1,61 +0,0 @@ -class Profiles::KeysController < ApplicationController - layout "profile" - skip_before_filter :authenticate_user!, only: [:get_keys] - - def index - @keys = current_user.keys - end - - def show - @key = current_user.keys.find(params[:id]) - end - - def new - @key = current_user.keys.new - end - - def create - @key = current_user.keys.new(key_params) - - if @key.save - redirect_to profile_key_path(@key) - else - render 'new' - end - end - - def destroy - @key = current_user.keys.find(params[:id]) - @key.destroy - - respond_to do |format| - format.html { redirect_to profile_keys_url } - format.js { render nothing: true } - end - end - - # Get all keys of a user(params[:username]) in a text format - # Helpful for sysadmins to put in respective servers - def get_keys - if params[:username].present? - begin - user = User.find_by_username(params[:username]) - if user.present? - render text: user.all_ssh_keys.join("\n"), content_type: "text/plain" - else - render_404 and return - end - rescue => e - render text: e.message - end - else - render_404 and return - end - end - - private - - def key_params - params.require(:key).permit(:title, :key) - end -end diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb deleted file mode 100644 index 3fdcbbab61b..00000000000 --- a/app/controllers/profiles/notifications_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Profiles::NotificationsController < ApplicationController - layout 'profile' - - def show - @user = current_user - @notification = current_user.notification - @project_members = current_user.project_members - @group_members = current_user.group_members - end - - def update - type = params[:notification_type] - - @saved = if type == 'global' - current_user.update_attributes(user_params) - elsif type == 'group' - group_member = current_user.group_members.find(params[:notification_id]) - group_member.notification_level = params[:notification_level] - group_member.save - else - project_member = current_user.project_members.find(params[:notification_id]) - project_member.notification_level = params[:notification_level] - project_member.save - end - - respond_to do |format| - format.html do - if @saved - flash[:notice] = "Notification settings saved" - else - flash[:alert] = "Failed to save new settings" - end - - redirect_to :back - end - - format.js - end - end - - def user_params - params.require(:user).permit(:notification_email, :notification_level) - end -end diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb deleted file mode 100644 index 0c614969a3f..00000000000 --- a/app/controllers/profiles/passwords_controller.rb +++ /dev/null @@ -1,88 +0,0 @@ -class Profiles::PasswordsController < ApplicationController - layout :determine_layout - - skip_before_filter :check_password_expiration, only: [:new, :create] - - before_filter :set_user - before_filter :set_title - before_filter :authorize_change_password! - - def new - end - - def create - unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) - redirect_to new_profile_password_path, alert: 'You must provide a valid current password' - return - end - - new_password = user_params[:password] - new_password_confirmation = user_params[:password_confirmation] - - result = @user.update_attributes( - password: new_password, - password_confirmation: new_password_confirmation, - password_automatically_set: false - ) - - if result - @user.update_attributes(password_expires_at: nil) - redirect_to root_path, notice: 'Password successfully changed' - else - render :new - end - end - - def edit - end - - def update - password_attributes = user_params.select do |key, value| - %w(password password_confirmation).include?(key.to_s) - end - password_attributes[:password_automatically_set] = false - - unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) - redirect_to edit_profile_password_path, alert: 'You must provide a valid current password' - return - end - - if @user.update_attributes(password_attributes) - flash[:notice] = "Password was successfully updated. Please login with it" - redirect_to new_user_session_path - else - render 'edit' - end - end - - def reset - current_user.send_reset_password_instructions - redirect_to edit_profile_password_path, notice: 'We sent you an email with reset password instructions' - end - - private - - def set_user - @user = current_user - end - - def set_title - @title = "New password" - end - - def determine_layout - if [:new, :create].include?(action_name.to_sym) - 'navless' - else - 'profile' - end - end - - def authorize_change_password! - return render_404 if @user.ldap_user? - end - - def user_params - params.require(:user).permit(:current_password, :password, :password_confirmation) - end -end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb deleted file mode 100644 index 7f76906066d..00000000000 --- a/app/controllers/profiles_controller.rb +++ /dev/null @@ -1,76 +0,0 @@ -class ProfilesController < ApplicationController - include ActionView::Helpers::SanitizeHelper - - before_filter :user - before_filter :authorize_change_username!, only: :update_username - skip_before_filter :require_email, only: [:show, :update] - - layout 'profile' - - def show - end - - def design - end - - def applications - @applications = current_user.oauth_applications - @authorized_tokens = current_user.oauth_authorized_tokens - @authorized_apps = @authorized_tokens.map(&:application).uniq - end - - def update - user_params.except!(:email) if @user.ldap_user? - - if @user.update_attributes(user_params) - flash[:notice] = "Profile was successfully updated" - else - messages = @user.errors.full_messages.uniq.join('. ') - flash[:alert] = "Failed to update profile. #{messages}" - end - - respond_to do |format| - format.html { redirect_to :back } - format.js - end - end - - def reset_private_token - if current_user.reset_authentication_token! - flash[:notice] = "Token was successfully updated" - end - - redirect_to profile_account_path - end - - def history - @events = current_user.recent_events.page(params[:page]).per(PER_PAGE) - end - - def update_username - @user.update_attributes(username: user_params[:username]) - - respond_to do |format| - format.js - end - end - - private - - def user - @user = current_user - end - - def authorize_change_username! - return render_404 unless @user.can_change_username? - end - - def user_params - params.require(:user).permit( - :email, :password, :password_confirmation, :bio, :name, - :username, :skype, :linkedin, :twitter, :website_url, - :color_scheme_id, :theme_id, :avatar, :hide_no_ssh_key, - :hide_no_password, :location, :public_email - ) - end -end diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb deleted file mode 100644 index 4719933394f..00000000000 --- a/app/controllers/projects/application_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -class Projects::ApplicationController < ApplicationController - before_filter :project - before_filter :repository - layout :determine_layout - - def authenticate_user! - # Restrict access to Projects area only - # for non-signed users - if !current_user - id = params[:project_id] || params[:id] - project_with_namespace = "#{params[:namespace_id]}/#{id}" - @project = Project.find_with_namespace(project_with_namespace) - - return if @project && @project.public? - end - - super - end - - def determine_layout - if current_user - 'projects' - else - 'public_projects' - end - end - - def require_branch_head - unless @repository.branch_names.include?(@ref) - redirect_to( - namespace_project_tree_path(@project.namespace, @project, @ref), - notice: "This action is not allowed unless you are on top of a branch" - ) - end - end -end diff --git a/app/controllers/projects/avatars_controller.rb b/app/controllers/projects/avatars_controller.rb deleted file mode 100644 index a482b90880d..00000000000 --- a/app/controllers/projects/avatars_controller.rb +++ /dev/null @@ -1,29 +0,0 @@ -class Projects::AvatarsController < Projects::ApplicationController - layout 'project' - - before_filter :project - - def show - @blob = @project.repository.blob_at_branch('master', @project.avatar_in_git) - if @blob - headers['X-Content-Type-Options'] = 'nosniff' - send_data( - @blob.data, - type: @blob.mime_type, - disposition: 'inline', - filename: @blob.name - ) - else - not_found! - end - end - - def destroy - @project.remove_avatar! - - @project.save - @project.reset_events_cache - - redirect_to edit_project_path(@project) - end -end diff --git a/app/controllers/projects/blame_controller.rb b/app/controllers/projects/blame_controller.rb deleted file mode 100644 index a87b8270a22..00000000000 --- a/app/controllers/projects/blame_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -# Controller for viewing a file's blame -class Projects::BlameController < Projects::ApplicationController - include ExtractsPath - - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! - - def show - @blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path) - @blob = @blame.blob - end -end diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb deleted file mode 100644 index 4b7eb4df298..00000000000 --- a/app/controllers/projects/blob_controller.rb +++ /dev/null @@ -1,163 +0,0 @@ -# Controller for viewing a file's blame -class Projects::BlobController < Projects::ApplicationController - include ExtractsPath - include ActionView::Helpers::SanitizeHelper - - # Raised when given an invalid file path - class InvalidPathError < StandardError; end - - before_filter :require_non_empty_project, except: [:new, :create] - before_filter :authorize_download_code! - before_filter :authorize_push_code!, only: [:destroy] - before_filter :assign_blob_vars - before_filter :commit, except: [:new, :create] - before_filter :blob, except: [:new, :create] - before_filter :from_merge_request, only: [:edit, :update] - before_filter :after_edit_path, only: [:edit, :update] - before_filter :require_branch_head, only: [:edit, :update] - - def new - commit unless @repository.empty? - end - - def create - file_path = File.join(@path, File.basename(params[:file_name])) - result = Files::CreateService.new( - @project, - current_user, - params.merge(new_branch: sanitized_new_branch_name), - @ref, - file_path - ).execute - - if result[:status] == :success - flash[:notice] = "Your changes have been successfully committed" - ref = sanitized_new_branch_name.presence || @ref - redirect_to namespace_project_blob_path(@project.namespace, @project, File.join(ref, file_path)) - else - flash[:alert] = result[:message] - render :new - end - end - - def show - end - - def edit - @last_commit = Gitlab::Git::Commit.last_for_path(@repository, @ref, @path).sha - end - - def update - result = Files::UpdateService. - new( - @project, - current_user, - params.merge(new_branch: sanitized_new_branch_name), - @ref, - @path - ).execute - - if result[:status] == :success - flash[:notice] = "Your changes have been successfully committed" - - if from_merge_request - from_merge_request.reload_code - end - - redirect_to after_edit_path - else - flash[:alert] = result[:message] - render :edit - end - end - - def preview - @content = params[:content] - diffy = Diffy::Diff.new(@blob.data, @content, diff: '-U 3', include_diff_info: true) - @diff_lines = Gitlab::Diff::Parser.new.parse(diffy.diff.scan(/.*\n/)) - - render layout: false - end - - def destroy - result = Files::DeleteService.new(@project, current_user, params, @ref, @path).execute - - if result[:status] == :success - flash[:notice] = "Your changes have been successfully committed" - redirect_to namespace_project_tree_path(@project.namespace, @project, - @ref) - else - flash[:alert] = result[:message] - render :show - end - end - - def diff - @form = UnfoldForm.new(params) - @lines = @blob.data.lines[@form.since - 1..@form.to - 1] - - if @form.bottom? - @match_line = '' - else - lines_length = @lines.length - 1 - line = [@form.since, lines_length].join(',') - @match_line = "@@ -#{line}+#{line} @@" - end - - render layout: false - end - - private - - def blob - @blob ||= @repository.blob_at(@commit.id, @path) - - if @blob - @blob - else - if tree = @repository.tree(@commit.id, @path) - if tree.entries.any? - redirect_to namespace_project_tree_path(@project.namespace, @project, File.join(@ref, @path)) and return - end - end - - return not_found! - end - end - - def commit - @commit = @repository.commit(@ref) - - return not_found! unless @commit - end - - def assign_blob_vars - @id = params[:id] - @ref, @path = extract_ref(@id) - - - rescue InvalidPathError - not_found! - end - - def after_edit_path - @after_edit_path ||= - if from_merge_request - diffs_namespace_project_merge_request_path(from_merge_request.target_project.namespace, from_merge_request.target_project, from_merge_request) + - "#file-path-#{hexdigest(@path)}" - elsif sanitized_new_branch_name.present? - namespace_project_blob_path(@project.namespace, @project, File.join(sanitized_new_branch_name, @path)) - else - namespace_project_blob_path(@project.namespace, @project, @id) - end - end - - def from_merge_request - # If blob edit was initiated from merge request page - @from_merge_request ||= MergeRequest.find_by(id: params[:from_merge_request_id]) - end - - def sanitized_new_branch_name - @new_branch ||= sanitize(strip_tags(params[:new_branch])) - end -end diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb deleted file mode 100644 index f049e96e61d..00000000000 --- a/app/controllers/projects/branches_controller.rb +++ /dev/null @@ -1,46 +0,0 @@ -class Projects::BranchesController < Projects::ApplicationController - include ActionView::Helpers::SanitizeHelper - # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - before_filter :authorize_push_code!, only: [:create, :destroy] - - def index - @sort = params[:sort] || 'name' - @branches = @repository.branches_sorted_by(@sort) - @branches = Kaminari.paginate_array(@branches).page(params[:page]).per(PER_PAGE) - end - - def recent - @branches = @repository.recent_branches - end - - def create - branch_name = sanitize(strip_tags(params[:branch_name])) - ref = sanitize(strip_tags(params[:ref])) - result = CreateBranchService.new(project, current_user). - execute(branch_name, ref) - - if result[:status] == :success - @branch = result[:branch] - redirect_to namespace_project_tree_path(@project.namespace, @project, - @branch.name) - else - @error = result[:message] - render action: 'new' - end - end - - def destroy - DeleteBranchService.new(project, current_user).execute(params[:id]) - @branch_name = params[:id] - - respond_to do |format| - format.html do - redirect_to namespace_project_branches_path(@project.namespace, - @project) - end - format.js - end - end -end diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb deleted file mode 100644 index 87e39f1363a..00000000000 --- a/app/controllers/projects/commit_controller.rb +++ /dev/null @@ -1,41 +0,0 @@ -# Controller for a specific Commit -# -# Not to be confused with CommitsController, plural. -class Projects::CommitController < Projects::ApplicationController - # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - before_filter :commit - - def show - return git_not_found! unless @commit - - @line_notes = @project.notes.for_commit_id(commit.id).inline - @diffs = @commit.diffs - @note = @project.build_commit_note(commit) - @notes_count = @project.notes.for_commit_id(commit.id).count - @notes = @project.notes.for_commit_id(@commit.id).not_inline.fresh - @noteable = @commit - @comments_allowed = @reply_allowed = true - @comments_target = { - noteable_type: 'Commit', - commit_id: @commit.id - } - - respond_to do |format| - format.html - format.diff { render text: @commit.to_diff } - format.patch { render text: @commit.to_patch } - end - end - - def branches - @branches = @project.repository.branch_names_contains(commit.id) - @tags = @project.repository.tag_names_contains(commit.id) - render layout: false - end - - def commit - @commit ||= @project.repository.commit(params[:id]) - end -end diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb deleted file mode 100644 index 4b6ab437476..00000000000 --- a/app/controllers/projects/commits_controller.rb +++ /dev/null @@ -1,24 +0,0 @@ -require "base64" - -class Projects::CommitsController < Projects::ApplicationController - include ExtractsPath - - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! - - def show - @repo = @project.repository - @limit, @offset = (params[:limit] || 40), (params[:offset] || 0) - - @commits = @repo.commits(@ref, @path, @limit, @offset) - @note_counts = Note.where(commit_id: @commits.map(&:id)). - group(:commit_id).count - - respond_to do |format| - format.html - format.json { pager_json("projects/commits/_commits", @commits.size) } - format.atom { render layout: false } - end - end -end diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb deleted file mode 100644 index 146808fa562..00000000000 --- a/app/controllers/projects/compare_controller.rb +++ /dev/null @@ -1,31 +0,0 @@ -class Projects::CompareController < Projects::ApplicationController - # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - - def index - end - - def show - base_ref = params[:from] - head_ref = params[:to] - - compare_result = CompareService.new.execute( - current_user, - @project, - head_ref, - @project, - base_ref - ) - - @commits = compare_result.commits - @diffs = compare_result.diffs - @commit = @commits.last - @line_notes = [] - end - - def create - redirect_to namespace_project_compare_path(@project.namespace, @project, - params[:from], params[:to]) - end -end diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb deleted file mode 100644 index 6fba3ce299b..00000000000 --- a/app/controllers/projects/deploy_keys_controller.rb +++ /dev/null @@ -1,65 +0,0 @@ -class Projects::DeployKeysController < Projects::ApplicationController - respond_to :html - - # Authorize - before_filter :authorize_admin_project! - - layout "project_settings" - - def index - @enabled_keys = @project.deploy_keys - - @available_keys = accessible_keys - @enabled_keys - @available_project_keys = current_user.project_deploy_keys - @enabled_keys - @available_public_keys = DeployKey.are_public - @enabled_keys - - # Public keys that are already used by another accessible project are already - # in @available_project_keys. - @available_public_keys -= @available_project_keys - end - - def show - @key = @project.deploy_keys.find(params[:id]) - end - - def new - @key = @project.deploy_keys.new - - respond_with(@key) - end - - def create - @key = DeployKey.new(deploy_key_params) - - if @key.valid? && @project.deploy_keys << @key - redirect_to namespace_project_deploy_keys_path(@project.namespace, - @project) - else - render "new" - end - end - - def enable - @key = accessible_keys.find(params[:id]) - @project.deploy_keys << @key - - redirect_to namespace_project_deploy_keys_path(@project.namespace, - @project) - end - - def disable - @project.deploy_keys_projects.find_by(deploy_key_id: params[:id]).destroy - - redirect_to :back - end - - protected - - def accessible_keys - @accessible_keys ||= current_user.accessible_deploy_keys - end - - def deploy_key_params - params.require(:deploy_key).permit(:key, :title) - end -end diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb deleted file mode 100644 index 21a151a426e..00000000000 --- a/app/controllers/projects/forks_controller.rb +++ /dev/null @@ -1,25 +0,0 @@ -class Projects::ForksController < Projects::ApplicationController - # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - - def new - @namespaces = current_user.manageable_namespaces - @namespaces.delete(@project.namespace) - end - - def create - namespace = Namespace.find(params[:namespace_key]) - @forked_project = ::Projects::ForkService.new(project, current_user, namespace: namespace).execute - - if @forked_project.saved? && @forked_project.forked? - redirect_to( - namespace_project_path(@forked_project.namespace, @forked_project), - notice: 'Project was successfully forked.' - ) - else - @title = 'Fork project' - render :error - end - end -end diff --git a/app/controllers/projects/graphs_controller.rb b/app/controllers/projects/graphs_controller.rb deleted file mode 100644 index 6e54af356e0..00000000000 --- a/app/controllers/projects/graphs_controller.rb +++ /dev/null @@ -1,39 +0,0 @@ -class Projects::GraphsController < Projects::ApplicationController - # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - - def show - respond_to do |format| - format.html - format.json do - fetch_graph - end - end - end - - def commits - @commits = @project.repository.commits(nil, nil, 2000, 0, true) - @commits_graph = Gitlab::Graphs::Commits.new(@commits) - @commits_per_week_days = @commits_graph.commits_per_week_days - @commits_per_time = @commits_graph.commits_per_time - @commits_per_month = @commits_graph.commits_per_month - end - - private - - def fetch_graph - @commits = @project.repository.commits(nil, nil, 6000, 0, true) - @log = [] - - @commits.each do |commit| - @log << { - author_name: commit.author_name, - author_email: commit.author_email, - date: commit.committed_date.strftime("%Y-%m-%d") - } - end - - render json: @log.to_json - end -end diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb deleted file mode 100644 index ba95bb13e1f..00000000000 --- a/app/controllers/projects/hooks_controller.rb +++ /dev/null @@ -1,58 +0,0 @@ -class Projects::HooksController < Projects::ApplicationController - # Authorize - before_filter :authorize_admin_project! - - respond_to :html - - layout "project_settings" - - def index - @hooks = @project.hooks - @hook = ProjectHook.new - end - - def create - @hook = @project.hooks.new(hook_params) - @hook.save - - if @hook.valid? - redirect_to namespace_project_hooks_path(@project.namespace, @project) - else - @hooks = @project.hooks.select(&:persisted?) - render :index - end - end - - def test - if !@project.empty_repo? - status = TestHookService.new.execute(hook, current_user) - - if status - flash[:notice] = 'Hook successfully executed.' - else - flash[:alert] = 'Hook execution failed. '\ - 'Ensure hook URL is correct and service is up.' - end - else - flash[:alert] = 'Hook execution failed. Ensure the project has commits.' - end - - redirect_to :back - end - - def destroy - hook.destroy - - redirect_to namespace_project_hooks_path(@project.namespace, @project) - end - - private - - def hook - @hook ||= @project.hooks.find(params[:id]) - end - - def hook_params - params.require(:hook).permit(:url, :push_events, :issues_events, :merge_requests_events, :tag_push_events) - end -end diff --git a/app/controllers/projects/imports_controller.rb b/app/controllers/projects/imports_controller.rb deleted file mode 100644 index b64491b4666..00000000000 --- a/app/controllers/projects/imports_controller.rb +++ /dev/null @@ -1,51 +0,0 @@ -class Projects::ImportsController < Projects::ApplicationController - # Authorize - before_filter :authorize_admin_project! - before_filter :require_no_repo - before_filter :redirect_if_progress, except: :show - - def new - end - - def create - @project.import_url = params[:project][:import_url] - - if @project.save - @project.reload - - if @project.import_failed? - @project.import_retry - else - @project.import_start - end - end - - redirect_to namespace_project_import_path(@project.namespace, @project) - end - - def show - unless @project.import_in_progress? - if @project.import_finished? - redirect_to(project_path(@project)) and return - else - redirect_to new_namespace_project_import_path(@project.namespace, - @project) && return - end - end - end - - private - - def require_no_repo - if @project.repository_exists? && !@project.import_in_progress? - redirect_to(namespace_project_path(@project.namespace, @project)) and return - end - end - - def redirect_if_progress - if @project.import_in_progress? - redirect_to namespace_project_import_path(@project.namespace, @project) && - return - end - end -end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb deleted file mode 100644 index 88302276b5e..00000000000 --- a/app/controllers/projects/issues_controller.rb +++ /dev/null @@ -1,159 +0,0 @@ -class Projects::IssuesController < Projects::ApplicationController - before_filter :module_enabled - before_filter :issue, only: [:edit, :update, :show, :toggle_subscription] - - # Allow read any issue - before_filter :authorize_read_issue! - - # Allow write(create) issue - before_filter :authorize_write_issue!, only: [:new, :create] - - # Allow modify issue - before_filter :authorize_modify_issue!, only: [:edit, :update] - - # Allow issues bulk update - before_filter :authorize_admin_issues!, only: [:bulk_update] - - respond_to :html - - def index - terms = params['issue_search'] - @issues = get_issues_collection - @issues = @issues.full_search(terms) if terms.present? - @issues = @issues.page(params[:page]).per(PER_PAGE) - - respond_to do |format| - format.html - format.atom { render layout: false } - format.json do - render json: { - html: view_to_html_string("projects/issues/_issues") - } - end - end - end - - def new - params[:issue] ||= ActionController::Parameters.new( - assignee_id: "" - ) - - @issue = @project.issues.new(issue_params) - respond_with(@issue) - end - - def edit - respond_with(@issue) - end - - def show - @note = @project.notes.new(noteable: @issue) - @notes = @issue.notes.inc_author.fresh - @noteable = @issue - - respond_with(@issue) - end - - def create - @issue = Issues::CreateService.new(project, current_user, issue_params).execute - - respond_to do |format| - format.html do - if @issue.valid? - redirect_to issue_path(@issue) - else - render :new - end - end - format.js do |format| - @link = @issue.attachment.url.to_js - end - end - end - - def update - @issue = Issues::UpdateService.new(project, current_user, issue_params).execute(issue) - - respond_to do |format| - format.js - format.html do - if @issue.valid? - redirect_to issue_path(@issue) - else - render :edit - end - end - format.json do - render json: { - saved: @issue.valid?, - assignee_avatar_url: @issue.assignee.try(:avatar_url) - } - end - end - end - - def bulk_update - result = Issues::BulkUpdateService.new(project, current_user, bulk_update_params).execute - redirect_to :back, notice: "#{result[:count]} issues updated" - end - - def toggle_subscription - @issue.toggle_subscription(current_user) - - render nothing: true - end - - protected - - def issue - @issue ||= begin - @project.issues.find_by!(iid: params[:id]) - rescue ActiveRecord::RecordNotFound - redirect_old - end - end - - def authorize_modify_issue! - return render_404 unless can?(current_user, :modify_issue, @issue) - end - - def authorize_admin_issues! - return render_404 unless can?(current_user, :admin_issue, @project) - end - - def module_enabled - return render_404 unless @project.issues_enabled - end - - # Since iids are implemented only in 6.1 - # user may navigate to issue page using old global ids. - # - # To prevent 404 errors we provide a redirect to correct iids until 7.0 release - # - def redirect_old - issue = @project.issues.find_by(id: params[:id]) - - if issue - redirect_to issue_path(issue) - return - else - raise ActiveRecord::RecordNotFound.new - end - end - - def issue_params - params.require(:issue).permit( - :title, :assignee_id, :position, :description, - :milestone_id, :state_event, :task_num, label_ids: [] - ) - end - - def bulk_update_params - params.require(:update).permit( - :issues_ids, - :assignee_id, - :milestone_id, - :state_event - ) - end -end diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb deleted file mode 100644 index 207a01ed3b0..00000000000 --- a/app/controllers/projects/labels_controller.rb +++ /dev/null @@ -1,82 +0,0 @@ -class Projects::LabelsController < Projects::ApplicationController - before_filter :module_enabled - before_filter :label, only: [:edit, :update, :destroy] - before_filter :authorize_labels! - before_filter :authorize_admin_labels!, except: [:index] - - respond_to :js, :html - - def index - @labels = @project.labels.page(params[:page]).per(PER_PAGE) - end - - def new - @label = @project.labels.new - end - - def create - @label = @project.labels.create(label_params) - - if @label.valid? - redirect_to namespace_project_labels_path(@project.namespace, @project) - else - render 'new' - end - end - - def edit - end - - def update - if @label.update_attributes(label_params) - redirect_to namespace_project_labels_path(@project.namespace, @project) - else - render 'edit' - end - end - - def generate - Gitlab::IssuesLabels.generate(@project) - - if params[:redirect] == 'issues' - redirect_to namespace_project_issues_path(@project.namespace, @project) - elsif params[:redirect] == 'merge_requests' - redirect_to namespace_project_merge_requests_path(@project.namespace, - @project) - else - redirect_to namespace_project_labels_path(@project.namespace, @project) - end - end - - def destroy - @label.destroy - - respond_to do |format| - format.html do - redirect_to(namespace_project_labels_path(@project.namespace, @project), - notice: 'Label was removed') - end - format.js - end - end - - protected - - def module_enabled - unless @project.issues_enabled || @project.merge_requests_enabled - return render_404 - end - end - - def label_params - params.require(:label).permit(:title, :color) - end - - def label - @label = @project.labels.find(params[:id]) - end - - def authorize_admin_labels! - return render_404 unless can?(current_user, :admin_label, @project) - end -end diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb deleted file mode 100644 index 47ce8467358..00000000000 --- a/app/controllers/projects/merge_requests_controller.rb +++ /dev/null @@ -1,270 +0,0 @@ -require 'gitlab/satellite/satellite' - -class Projects::MergeRequestsController < Projects::ApplicationController - before_filter :module_enabled - before_filter :merge_request, only: [:edit, :update, :show, :diffs, :automerge, :automerge_check, :ci_status, :toggle_subscription] - before_filter :closes_issues, only: [:edit, :update, :show, :diffs] - before_filter :validates_merge_request, only: [:show, :diffs] - before_filter :define_show_vars, only: [:show, :diffs] - - # Allow read any merge_request - before_filter :authorize_read_merge_request! - - # Allow write(create) merge_request - before_filter :authorize_write_merge_request!, only: [:new, :create] - - # Allow modify merge_request - before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] - - def index - terms = params['issue_search'] - @merge_requests = get_merge_requests_collection - @merge_requests = @merge_requests.full_search(terms) if terms.present? - @merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE) - - respond_to do |format| - format.html - format.json do - render json: { - html: view_to_html_string("projects/merge_requests/_merge_requests") - } - end - end - end - - def show - @note_counts = Note.where(commit_id: @merge_request.commits.map(&:id)). - group(:commit_id).count - - respond_to do |format| - format.html - format.json { render json: @merge_request } - format.diff { render text: @merge_request.to_diff(current_user) } - format.patch { render text: @merge_request.to_patch(current_user) } - end - end - - def diffs - @commit = @merge_request.last_commit - @comments_allowed = @reply_allowed = true - @comments_target = { - noteable_type: 'MergeRequest', - noteable_id: @merge_request.id - } - @line_notes = @merge_request.notes.where("line_code is not null") - - respond_to do |format| - format.html - format.json { render json: { html: view_to_html_string("projects/merge_requests/show/_diffs") } } - end - end - - def new - params[:merge_request] ||= ActionController::Parameters.new(source_project: @project) - @merge_request = MergeRequests::BuildService.new(project, current_user, merge_request_params).execute - - @target_branches = if @merge_request.target_project - @merge_request.target_project.repository.branch_names - else - [] - end - - @target_project = merge_request.target_project - @source_project = merge_request.source_project - @commits = @merge_request.compare_commits - @commit = @merge_request.compare_commits.last - @diffs = @merge_request.compare_diffs - @note_counts = Note.where(commit_id: @commits.map(&:id)). - group(:commit_id).count - end - - def edit - @source_project = @merge_request.source_project - @target_project = @merge_request.target_project - @target_branches = @merge_request.target_project.repository.branch_names - end - - def create - @target_branches ||= [] - @merge_request = MergeRequests::CreateService.new(project, current_user, merge_request_params).execute - - if @merge_request.valid? - redirect_to(merge_request_path(@merge_request)) - else - @source_project = @merge_request.source_project - @target_project = @merge_request.target_project - render action: "new" - end - end - - def update - @merge_request = MergeRequests::UpdateService.new(project, current_user, merge_request_params).execute(@merge_request) - - if @merge_request.valid? - respond_to do |format| - format.js - format.html do - redirect_to([@merge_request.target_project.namespace.becomes(Namespace), - @merge_request.target_project, @merge_request]) - end - format.json do - render json: { - saved: @merge_request.valid?, - assignee_avatar_url: @merge_request.assignee.try(:avatar_url) - } - end - end - else - render "edit" - end - end - - def automerge_check - if @merge_request.unchecked? - @merge_request.check_if_can_be_merged - end - - render json: { merge_status: @merge_request.merge_status_name } - end - - def automerge - return access_denied! unless allowed_to_merge? - - if @merge_request.open? && @merge_request.can_be_merged? - AutoMergeWorker.perform_async(@merge_request.id, current_user.id, params) - @status = true - else - @status = false - end - end - - def branch_from - #This is always source - @source_project = @merge_request.nil? ? @project : @merge_request.source_project - @commit = @repository.commit(params[:ref]) if params[:ref].present? - end - - def branch_to - @target_project = selected_target_project - @commit = @target_project.repository.commit(params[:ref]) if params[:ref].present? - end - - def update_branches - @target_project = selected_target_project - @target_branches = @target_project.repository.branch_names - - respond_to do |format| - format.js - end - end - - def ci_status - ci_service = @merge_request.source_project.ci_service - status = ci_service.commit_status(merge_request.last_commit.sha, merge_request.source_branch) - - if ci_service.respond_to?(:commit_coverage) - coverage = ci_service.commit_coverage(merge_request.last_commit.sha, merge_request.source_branch) - end - - response = { - status: status, - coverage: coverage - } - - render json: response - end - - def toggle_subscription - @merge_request.toggle_subscription(current_user) - - render nothing: true - end - - protected - - def selected_target_project - if @project.id.to_s == params[:target_project_id] || @project.forked_project_link.nil? - @project - else - @project.forked_project_link.forked_from_project - end - end - - def merge_request - @merge_request ||= @project.merge_requests.find_by!(iid: params[:id]) - end - - def closes_issues - @closes_issues ||= @merge_request.closes_issues - end - - def authorize_modify_merge_request! - return render_404 unless can?(current_user, :modify_merge_request, @merge_request) - end - - def authorize_admin_merge_request! - return render_404 unless can?(current_user, :admin_merge_request, @merge_request) - end - - def module_enabled - return render_404 unless @project.merge_requests_enabled - end - - def validates_merge_request - # If source project was removed (Ex. mr from fork to origin) - return invalid_mr unless @merge_request.source_project - - # Show git not found page - # if there is no saved commits between source & target branch - if @merge_request.commits.blank? - # and if target branch doesn't exist - return invalid_mr unless @merge_request.target_branch_exists? - - # or if source branch doesn't exist - return invalid_mr unless @merge_request.source_branch_exists? - end - end - - def define_show_vars - # Build a note object for comment form - @note = @project.notes.new(noteable: @merge_request) - @notes = @merge_request.mr_and_commit_notes.inc_author.fresh - @discussions = Note.discussions_from_notes(@notes) - @noteable = @merge_request - - # Get commits from repository - # or from cache if already merged - @commits = @merge_request.commits - - @merge_request_diff = @merge_request.merge_request_diff - @allowed_to_merge = allowed_to_merge? - @show_merge_controls = @merge_request.open? && @commits.any? && @allowed_to_merge - @source_branch = @merge_request.source_project.repository.find_branch(@merge_request.source_branch).try(:name) - - if @merge_request.locked_long_ago? - @merge_request.unlock_mr - @merge_request.close - end - end - - def allowed_to_merge? - allowed_to_push_code?(project, @merge_request.target_branch) - end - - def invalid_mr - # Render special view for MR with removed source or target branch - render 'invalid' - end - - def allowed_to_push_code?(project, branch) - ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(branch) - end - - def merge_request_params - params.require(:merge_request).permit( - :title, :assignee_id, :source_project_id, :source_branch, - :target_project_id, :target_branch, :milestone_id, - :state_event, :description, :task_num, label_ids: [] - ) - end -end diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb deleted file mode 100644 index b49b549547a..00000000000 --- a/app/controllers/projects/milestones_controller.rb +++ /dev/null @@ -1,116 +0,0 @@ -class Projects::MilestonesController < Projects::ApplicationController - before_filter :module_enabled - before_filter :milestone, only: [:edit, :update, :destroy, :show, :sort_issues, :sort_merge_requests] - - # Allow read any milestone - before_filter :authorize_read_milestone! - - # Allow admin milestone - before_filter :authorize_admin_milestone!, except: [:index, :show] - - respond_to :html - - def index - @milestones = case params[:state] - when 'all'; @project.milestones.order("state, due_date DESC") - when 'closed'; @project.milestones.closed.order("due_date DESC") - else @project.milestones.active.order("due_date ASC") - end - - @milestones = @milestones.includes(:project) - @milestones = @milestones.page(params[:page]).per(PER_PAGE) - end - - def new - @milestone = @project.milestones.new - respond_with(@milestone) - end - - def edit - respond_with(@milestone) - end - - def show - @issues = @milestone.issues - @users = @milestone.participants.uniq - @merge_requests = @milestone.merge_requests - end - - def create - @milestone = Milestones::CreateService.new(project, current_user, milestone_params).execute - - if @milestone.save - redirect_to namespace_project_milestone_path(@project.namespace, - @project, @milestone) - else - render "new" - end - end - - def update - @milestone = Milestones::UpdateService.new(project, current_user, milestone_params).execute(milestone) - - respond_to do |format| - format.js - format.html do - if @milestone.valid? - redirect_to namespace_project_milestone_path(@project.namespace, - @project, @milestone) - else - render :edit - end - end - end - end - - def destroy - return access_denied! unless can?(current_user, :admin_milestone, @milestone) - - @milestone.destroy - - respond_to do |format| - format.html { redirect_to namespace_project_milestones_path } - format.js { render nothing: true } - end - end - - def sort_issues - @issues = @milestone.issues.where(id: params['sortable_issue']) - @issues.each do |issue| - issue.position = params['sortable_issue'].index(issue.id.to_s) + 1 - issue.save - end - - render json: { saved: true } - end - - def sort_merge_requests - @merge_requests = @milestone.merge_requests.where(id: params['sortable_merge_request']) - @merge_requests.each do |merge_request| - merge_request.position = params['sortable_merge_request'].index(merge_request.id.to_s) + 1 - merge_request.save - end - - render json: { saved: true } - end - - protected - - def milestone - @milestone ||= @project.milestones.find_by!(iid: params[:id]) - end - - def authorize_admin_milestone! - return render_404 unless can?(current_user, :admin_milestone, @project) - end - - def module_enabled - unless @project.issues_enabled || @project.merge_requests_enabled - return render_404 - end - end - - def milestone_params - params.require(:milestone).permit(:title, :description, :due_date, :state_event) - end -end diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb deleted file mode 100644 index 83d1c1dacae..00000000000 --- a/app/controllers/projects/network_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -class Projects::NetworkController < Projects::ApplicationController - include ExtractsPath - include ApplicationHelper - - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! - - def show - respond_to do |format| - format.html - - format.json do - @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) - end - end - end -end diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb deleted file mode 100644 index 868629a0bc4..00000000000 --- a/app/controllers/projects/notes_controller.rb +++ /dev/null @@ -1,125 +0,0 @@ -class Projects::NotesController < Projects::ApplicationController - # Authorize - before_filter :authorize_read_note! - before_filter :authorize_write_note!, only: [:create] - before_filter :authorize_admin_note!, only: [:update, :destroy] - before_filter :find_current_user_notes, except: [:destroy, :delete_attachment] - - def index - current_fetched_at = Time.now.to_i - - notes_json = { notes: [], last_fetched_at: current_fetched_at } - - @notes.each do |note| - notes_json[:notes] << { - id: note.id, - html: note_to_html(note) - } - end - - render json: notes_json - end - - def create - @note = Notes::CreateService.new(project, current_user, note_params).execute - - respond_to do |format| - format.json { render_note_json(@note) } - format.html { redirect_to :back } - end - end - - def update - if note.editable? - note.update_attributes(note_params) - note.reset_events_cache - end - - respond_to do |format| - format.json { render_note_json(note) } - format.html { redirect_to :back } - end - end - - def destroy - if note.editable? - note.destroy - note.reset_events_cache - end - - respond_to do |format| - format.js { render nothing: true } - end - end - - def delete_attachment - note.remove_attachment! - note.update_attribute(:attachment, nil) - - respond_to do |format| - format.js { render nothing: true } - end - end - - private - - def note - @note ||= @project.notes.find(params[:id]) - end - - def note_to_html(note) - render_to_string( - "projects/notes/_note", - layout: false, - formats: [:html], - locals: { note: note } - ) - end - - def note_to_discussion_html(note) - render_to_string( - "projects/notes/_diff_notes_with_reply", - layout: false, - formats: [:html], - locals: { notes: [note] } - ) - end - - def note_to_discussion_with_diff_html(note) - return unless note.for_diff_line? - - render_to_string( - "projects/notes/_discussion", - layout: false, - formats: [:html], - locals: { discussion_notes: [note] } - ) - end - - def render_note_json(note) - render json: { - id: note.id, - discussion_id: note.discussion_id, - html: note_to_html(note), - discussion_html: note_to_discussion_html(note), - discussion_with_diff_html: note_to_discussion_with_diff_html(note) - } - end - - def authorize_admin_note! - return access_denied! unless can?(current_user, :admin_note, note) - end - - def note_params - params.require(:note).permit( - :note, :noteable, :noteable_id, :noteable_type, :project_id, - :attachment, :line_code, :commit_id - ) - end - - private - - def find_current_user_notes - @notes = NotesFinder.new.execute(project, current_user, params) - end -end diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb deleted file mode 100644 index 72967a26ff1..00000000000 --- a/app/controllers/projects/project_members_controller.rb +++ /dev/null @@ -1,98 +0,0 @@ -class Projects::ProjectMembersController < Projects::ApplicationController - # Authorize - before_filter :authorize_admin_project!, except: :leave - - layout "project_settings" - - def index - @project_members = @project.project_members - @project_members = @project_members.non_invite unless can?(current_user, :admin_project, @project) - - if params[:search].present? - users = @project.users.search(params[:search]).to_a - @project_members = @project_members.where(user_id: users) - end - - @project_members = @project_members.order('access_level DESC') - - @group = @project.group - if @group - @group_members = @group.group_members - @group_members = @group_members.non_invite unless can?(current_user, :admin_group, @group) - - if params[:search].present? - users = @group.users.search(params[:search]).to_a - @group_members = @group_members.where(user_id: users) - end - - @group_members = @group_members.order('access_level DESC').limit(20) - end - - @project_member = @project.project_members.new - end - - def new - @project_member = @project.project_members.new - end - - def create - @project.team.add_users(params[:user_ids].split(','), params[:access_level], current_user) - - redirect_to namespace_project_project_members_path(@project.namespace, @project) - end - - def update - @project_member = @project.project_members.find(params[:id]) - @project_member.update_attributes(member_params) - end - - def destroy - @project_member = @project.project_members.find(params[:id]) - @project_member.destroy - - respond_to do |format| - format.html do - redirect_to namespace_project_project_members_path(@project.namespace, @project) - end - format.js { render nothing: true } - end - end - - def resend_invite - redirect_path = namespace_project_project_members_path(@project.namespace, @project) - - @project_member = @project.project_members.find(params[:id]) - - if @project_member.invite? - @project_member.resend_invite - - redirect_to redirect_path, notice: 'The invitation was successfully resent.' - else - redirect_to redirect_path, alert: 'The invitation has already been accepted.' - end - end - - def leave - @project.project_members.find_by(user_id: current_user).destroy - - respond_to do |format| - format.html { redirect_to :back } - format.js { render nothing: true } - end - end - - def apply_import - giver = Project.find(params[:source_project_id]) - status = @project.team.import(giver, current_user) - notice = status ? "Successfully imported" : "Import failed" - - redirect_to(namespace_project_project_members_path(project.namespace, project), - notice: notice) - end - - protected - - def member_params - params.require(:project_member).permit(:user_id, :access_level) - end -end diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb deleted file mode 100644 index ac36ac6fcd3..00000000000 --- a/app/controllers/projects/protected_branches_controller.rb +++ /dev/null @@ -1,51 +0,0 @@ -class Projects::ProtectedBranchesController < Projects::ApplicationController - # Authorize - before_filter :require_non_empty_project - before_filter :authorize_admin_project! - - layout "project_settings" - - def index - @branches = @project.protected_branches.to_a - @protected_branch = @project.protected_branches.new - end - - def create - @project.protected_branches.create(protected_branch_params) - redirect_to namespace_project_protected_branches_path(@project.namespace, - @project) - end - - def update - protected_branch = @project.protected_branches.find(params[:id]) - - if protected_branch && - protected_branch.update_attributes( - developers_can_push: params[:developers_can_push] - ) - - respond_to do |format| - format.json { render json: protected_branch, status: :ok } - end - else - respond_to do |format| - format.json { render json: protected_branch.errors, status: :unprocessable_entity } - end - end - end - - def destroy - @project.protected_branches.find(params[:id]).destroy - - respond_to do |format| - format.html { redirect_to namespace_project_protected_branches_path } - format.js { render nothing: true } - end - end - - private - - def protected_branch_params - params.require(:protected_branch).permit(:name, :developers_can_push) - end -end diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb deleted file mode 100644 index b1a029ce696..00000000000 --- a/app/controllers/projects/raw_controller.rb +++ /dev/null @@ -1,37 +0,0 @@ -# Controller for viewing a file's raw -class Projects::RawController < Projects::ApplicationController - include ExtractsPath - - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! - - def show - @blob = @repository.blob_at(@commit.id, @path) - - if @blob - type = get_blob_type - - headers['X-Content-Type-Options'] = 'nosniff' - - send_data( - @blob.data, - type: type, - disposition: 'inline', - filename: @blob.name - ) - else - not_found! - end - end - - private - - def get_blob_type - if @blob.text? - 'text/plain; charset=utf-8' - else - 'application/octet-stream' - end - end -end diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb deleted file mode 100644 index ec3b2b8d75a..00000000000 --- a/app/controllers/projects/refs_controller.rb +++ /dev/null @@ -1,64 +0,0 @@ -class Projects::RefsController < Projects::ApplicationController - include ExtractsPath - - before_filter :require_non_empty_project - before_filter :assign_ref_vars - before_filter :authorize_download_code! - - def switch - respond_to do |format| - format.html do - new_path = if params[:destination] == "tree" - namespace_project_tree_path(@project.namespace, @project, - (@id)) - elsif params[:destination] == "blob" - namespace_project_blob_path(@project.namespace, @project, - (@id)) - elsif params[:destination] == "graph" - namespace_project_network_path(@project.namespace, @project, @id, @options) - else - namespace_project_commits_path(@project.namespace, @project, @id) - end - - redirect_to new_path - end - format.js do - @ref = params[:ref] - define_tree_vars - tree - render "tree" - end - end - end - - def logs_tree - @offset = if params[:offset].present? - params[:offset].to_i - else - 0 - end - - @limit = 25 - - @path = params[:path] - - contents = [] - contents.push(*tree.trees) - contents.push(*tree.blobs) - contents.push(*tree.submodules) - - @logs = contents[@offset, @limit].to_a.map do |content| - file = @path ? File.join(@path, content.name) : content.name - last_commit = @repo.last_commit_for_path(@commit.id, file) - { - file_name: content.name, - commit: last_commit - } - end - - respond_to do |format| - format.html { render_404 } - format.js - end - end -end diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb deleted file mode 100644 index 96defb0c721..00000000000 --- a/app/controllers/projects/repositories_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class Projects::RepositoriesController < Projects::ApplicationController - # Authorize - before_filter :require_non_empty_project, except: :create - before_filter :authorize_download_code! - before_filter :authorize_admin_project!, only: :create - - def create - @project.create_repository - - redirect_to project_path(@project) - end - - def archive - begin - file_path = ArchiveRepositoryService.new(@project, params[:ref], params[:format]).execute - rescue - return head :not_found - end - - if file_path - # Send file to user - response.headers["Content-Length"] = File.open(file_path).size.to_s - send_file file_path - else - redirect_to request.fullpath - end - end -end diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb deleted file mode 100644 index 9a484c109ba..00000000000 --- a/app/controllers/projects/services_controller.rb +++ /dev/null @@ -1,59 +0,0 @@ -class Projects::ServicesController < Projects::ApplicationController - # Authorize - before_filter :authorize_admin_project! - before_filter :service, only: [:edit, :update, :test] - - respond_to :html - - layout "project_settings" - - def index - @project.build_missing_services - @services = @project.services.visible.reload - end - - def edit - end - - def update - if @service.update_attributes(service_params) - redirect_to( - edit_namespace_project_service_path(@project.namespace, @project, - @service.to_param, notice: - 'Successfully updated.') - ) - else - render 'edit' - end - end - - def test - data = Gitlab::PushDataBuilder.build_sample(project, current_user) - if @service.execute(data) - message = { notice: 'We sent a request to the provided URL' } - else - message = { alert: 'We tried to send a request to the provided URL but an error occured' } - end - - redirect_to :back, message - end - - private - - def service - @service ||= @project.services.find { |service| service.to_param == params[:id] } - end - - def service_params - params.require(:service).permit( - :title, :token, :type, :active, :api_key, :subdomain, - :room, :recipients, :project_url, :webhook, - :user_key, :device, :priority, :sound, :bamboo_url, :username, :password, - :build_key, :server, :teamcity_url, :build_type, - :description, :issues_url, :new_issue_url, :restrict_to_branch, :channel, - :colorize_messages, :channels, - :push_events, :issues_events, :merge_requests_events, :tag_push_events, - :note_events, :send_from_committer_email, :disable_diffs, :external_wiki_url - ) - end -end diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb deleted file mode 100644 index ed268400373..00000000000 --- a/app/controllers/projects/snippets_controller.rb +++ /dev/null @@ -1,93 +0,0 @@ -class Projects::SnippetsController < Projects::ApplicationController - before_filter :module_enabled - before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] - - # Allow read any snippet - before_filter :authorize_read_project_snippet! - - # Allow write(create) snippet - before_filter :authorize_write_project_snippet!, only: [:new, :create] - - # Allow modify snippet - before_filter :authorize_modify_project_snippet!, only: [:edit, :update] - - # Allow destroy snippet - before_filter :authorize_admin_project_snippet!, only: [:destroy] - - respond_to :html - - def index - @snippets = SnippetsFinder.new.execute(current_user, { - filter: :by_project, - project: @project - }) - end - - def new - @snippet = @project.snippets.build - end - - def create - @snippet = CreateSnippetService.new(@project, current_user, - snippet_params).execute - respond_with(@snippet, - location: namespace_project_snippet_path(@project.namespace, - @project, @snippet)) - end - - def edit - end - - def update - UpdateSnippetService.new(project, current_user, @snippet, - snippet_params).execute - respond_with(@snippet, - location: namespace_project_snippet_path(@project.namespace, - @project, @snippet)) - end - - def show - @note = @project.notes.new(noteable: @snippet) - @notes = @snippet.notes.fresh - @noteable = @snippet - end - - def destroy - return access_denied! unless can?(current_user, :admin_project_snippet, @snippet) - - @snippet.destroy - - redirect_to namespace_project_snippets_path(@project.namespace, @project) - end - - def raw - send_data( - @snippet.content, - type: 'text/plain; charset=utf-8', - disposition: 'inline', - filename: @snippet.sanitized_file_name - ) - end - - protected - - def snippet - @snippet ||= @project.snippets.find(params[:id]) - end - - def authorize_modify_project_snippet! - return render_404 unless can?(current_user, :modify_project_snippet, @snippet) - end - - def authorize_admin_project_snippet! - return render_404 unless can?(current_user, :admin_project_snippet, @snippet) - end - - def module_enabled - return render_404 unless @project.snippets_enabled - end - - def snippet_params - params.require(:project_snippet).permit(:title, :content, :file_name, :private, :visibility_level) - end -end diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb deleted file mode 100644 index 83f4937bce3..00000000000 --- a/app/controllers/projects/tags_controller.rb +++ /dev/null @@ -1,37 +0,0 @@ -class Projects::TagsController < Projects::ApplicationController - # Authorize - before_filter :require_non_empty_project - before_filter :authorize_download_code! - before_filter :authorize_push_code!, only: [:create] - before_filter :authorize_admin_project!, only: [:destroy] - - def index - sorted = VersionSorter.rsort(@repository.tag_names) - @tags = Kaminari.paginate_array(sorted).page(params[:page]).per(PER_PAGE) - end - - def create - result = CreateTagService.new(@project, current_user). - execute(params[:tag_name], params[:ref], params[:message]) - - if result[:status] == :success - @tag = result[:tag] - redirect_to namespace_project_tags_path(@project.namespace, @project) - else - @error = result[:message] - render action: 'new' - end - end - - def destroy - DeleteTagService.new(project, current_user).execute(params[:id]) - - respond_to do |format| - format.html do - redirect_to namespace_project_tags_path(@project.namespace, - @project) - end - format.js - end - end -end diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb deleted file mode 100644 index b23010bf595..00000000000 --- a/app/controllers/projects/tree_controller.rb +++ /dev/null @@ -1,27 +0,0 @@ -# Controller for viewing a repository's file structure -class Projects::TreeController < Projects::ApplicationController - include ExtractsPath - - before_filter :require_non_empty_project, except: [:new, :create] - before_filter :assign_ref_vars - before_filter :authorize_download_code! - - def show - if tree.entries.empty? - if @repository.blob_at(@commit.id, @path) - redirect_to( - namespace_project_blob_path(@project.namespace, @project, - File.join(@ref, @path)) - ) and return - else - return not_found! - end - end - - respond_to do |format| - format.html - # Disable cache so browser history works - format.js { no_cache_headers } - end - end -end diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb deleted file mode 100644 index aeb7f0699f5..00000000000 --- a/app/controllers/projects/wikis_controller.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'project_wiki' - -class Projects::WikisController < Projects::ApplicationController - before_filter :authorize_read_wiki! - before_filter :authorize_write_wiki!, only: [:edit, :create, :history] - before_filter :authorize_admin_wiki!, only: :destroy - before_filter :load_project_wiki - include WikiHelper - - def pages - @wiki_pages = Kaminari.paginate_array(@project_wiki.pages).page(params[:page]).per(PER_PAGE) - end - - def show - @page = @project_wiki.find_page(params[:id], params[:version_id]) - - if @page - render 'show' - elsif file = @project_wiki.find_file(params[:id], params[:version_id]) - if file.on_disk? - send_file file.on_disk_path, disposition: 'inline' - else - send_data( - file.raw_data, - type: file.mime_type, - disposition: 'inline', - filename: file.name - ) - end - else - return render('empty') unless can?(current_user, :write_wiki, @project) - @page = WikiPage.new(@project_wiki) - @page.title = params[:id] - - render 'edit' - end - end - - def edit - @page = @project_wiki.find_page(params[:id]) - end - - def update - @page = @project_wiki.find_page(params[:id]) - - return render('empty') unless can?(current_user, :write_wiki, @project) - - if @page.update(content, format, message) - redirect_to( - namespace_project_wiki_path(@project.namespace, @project, @page), - notice: 'Wiki was successfully updated.' - ) - else - render 'edit' - end - end - - def create - @page = WikiPage.new(@project_wiki) - - if @page.create(wiki_params) - redirect_to( - namespace_project_wiki_path(@project.namespace, @project, @page), - notice: 'Wiki was successfully updated.' - ) - else - render action: "edit" - end - end - - def history - @page = @project_wiki.find_page(params[:id]) - - unless @page - redirect_to( - namespace_project_wiki_path(@project.namespace, @project, :home), - notice: "Page not found" - ) - end - end - - def destroy - @page = @project_wiki.find_page(params[:id]) - @page.delete if @page - - redirect_to( - namespace_project_wiki_path(@project.namespace, @project, :home), - notice: "Page was successfully deleted" - ) - end - - def git_access - end - - private - - def load_project_wiki - @project_wiki = ProjectWiki.new(@project, current_user) - - # Call #wiki to make sure the Wiki Repo is initialized - @project_wiki.wiki - rescue ProjectWiki::CouldNotCreateWikiError => ex - flash[:notice] = "Could not create Wiki Repository at this time. Please try again later." - redirect_to project_path(@project) - return false - end - - def wiki_params - params[:wiki].slice(:title, :content, :format, :message) - end - - def content - params[:wiki][:content] - end - - def format - params[:wiki][:format] - end - - def message - params[:wiki][:message] - end -end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb deleted file mode 100644 index 0f28794b736..00000000000 --- a/app/controllers/projects_controller.rb +++ /dev/null @@ -1,198 +0,0 @@ -class ProjectsController < ApplicationController - prepend_before_filter :render_go_import, only: [:show] - skip_before_filter :authenticate_user!, only: [:show] - before_filter :project, except: [:new, :create] - before_filter :repository, except: [:new, :create] - - # Authorize - before_filter :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive] - before_filter :set_title, only: [:new, :create] - before_filter :event_filter, only: :show - - layout 'navless', only: [:new, :create, :fork] - - def new - @project = Project.new - end - - def edit - render 'edit', layout: 'project_settings' - end - - def create - @project = ::Projects::CreateService.new(current_user, project_params).execute - - if @project.saved? - redirect_to( - project_path(@project), - notice: 'Project was successfully created.' - ) - else - render 'new' - end - end - - def update - status = ::Projects::UpdateService.new(@project, current_user, project_params).execute - - respond_to do |format| - if status - flash[:notice] = 'Project was successfully updated.' - format.html do - redirect_to( - edit_project_path(@project), - notice: 'Project was successfully updated.' - ) - end - format.js - else - format.html { render 'edit', layout: 'project_settings' } - format.js - end - end - end - - def transfer - transfer_params = params.permit(:new_namespace_id) - ::Projects::TransferService.new(project, current_user, transfer_params).execute - if @project.errors[:namespace_id].present? - flash[:alert] = @project.errors[:namespace_id].first - end - end - - def show - if @project.import_in_progress? - redirect_to namespace_project_import_path(@project.namespace, @project) - return - end - - limit = (params[:limit] || 20).to_i - - @show_star = !(current_user && current_user.starred?(@project)) - - respond_to do |format| - format.html do - if @project.repository_exists? - if @project.empty_repo? - render 'projects/empty', layout: user_layout - else - @last_push = current_user.recent_push(@project.id) if current_user - render :show, layout: user_layout - end - else - render 'projects/no_repo', layout: user_layout - end - end - - format.json do - @events = @project.events.recent - @events = event_filter.apply_filter(@events).with_associations - @events = @events.limit(limit).offset(params[:offset] || 0) - pager_json('events/_events', @events.count) - end - end - end - - def destroy - return access_denied! unless can?(current_user, :remove_project, @project) - - ::Projects::DestroyService.new(@project, current_user, {}).execute - - respond_to do |format| - format.html do - flash[:alert] = 'Project deleted.' - - if request.referer.include?('/admin') - redirect_to admin_namespaces_projects_path - else - redirect_to dashboard_path - end - end - end - end - - def autocomplete_sources - note_type = params['type'] - note_id = params['type_id'] - autocomplete = ::Projects::AutocompleteService.new(@project) - participants = ::Projects::ParticipantsService.new(@project, current_user).execute(note_type, note_id) - - @suggestions = { - emojis: autocomplete_emojis, - issues: autocomplete.issues, - mergerequests: autocomplete.merge_requests, - members: participants - } - - respond_to do |format| - format.json { render json: @suggestions } - end - end - - def archive - return access_denied! unless can?(current_user, :archive_project, @project) - @project.archive! - - respond_to do |format| - format.html { redirect_to project_path(@project) } - end - end - - def unarchive - return access_denied! unless can?(current_user, :archive_project, @project) - @project.unarchive! - - respond_to do |format| - format.html { redirect_to project_path(@project) } - end - end - - def toggle_star - current_user.toggle_star(@project) - @project.reload - render json: { star_count: @project.star_count } - end - - def markdown_preview - render text: view_context.markdown(params[:md_text]) - end - - private - - def set_title - @title = 'New Project' - end - - def user_layout - current_user ? 'projects' : 'public_projects' - end - - def project_params - params.require(:project).permit( - :name, :path, :description, :issues_tracker, :tag_list, - :issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :default_branch, - :wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id, :avatar - ) - end - - def autocomplete_emojis - Rails.cache.fetch("autocomplete-emoji-#{Gemojione::VERSION}") do - Emoji.emojis.map do |name, emoji| - { - name: name, - path: view_context.image_url("emoji/#{emoji["unicode"]}.png") - } - end - end - end - - def render_go_import - return unless params["go-get"] == "1" - - @namespace = params[:namespace_id] - @id = params[:project_id] || params[:id] - @id = @id.gsub(/\.git\Z/, "") - - render "go_import", layout: false - end -end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb deleted file mode 100644 index 38d116a4ee3..00000000000 --- a/app/controllers/registrations_controller.rb +++ /dev/null @@ -1,41 +0,0 @@ -class RegistrationsController < Devise::RegistrationsController - before_filter :signup_enabled? - - def new - redirect_to(new_user_session_path) - end - - def destroy - current_user.destroy - - respond_to do |format| - format.html { redirect_to new_user_session_path, notice: "Account successfully removed." } - end - end - - protected - - def build_resource(hash=nil) - super - end - - def after_sign_up_path_for(_resource) - new_user_session_path - end - - def after_inactive_sign_up_path_for(_resource) - new_user_session_path - end - - private - - def signup_enabled? - unless current_application_settings.signup_enabled? - redirect_to(new_user_session_path) - end - end - - def sign_up_params - params.require(:user).permit(:username, :email, :name, :password, :password_confirmation) - end -end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb deleted file mode 100644 index c5828d0b2df..00000000000 --- a/app/controllers/search_controller.rb +++ /dev/null @@ -1,55 +0,0 @@ -class SearchController < ApplicationController - include SearchHelper - - def show - return if params[:search].nil? || params[:search].blank? - - if params[:project_id].present? - @project = Project.find_by(id: params[:project_id]) - @project = nil unless can?(current_user, :download_code, @project) - end - - if params[:group_id].present? - @group = Group.find_by(id: params[:group_id]) - @group = nil unless can?(current_user, :read_group, @group) - end - - @scope = params[:scope] - @show_snippets = params[:snippets].eql? 'true' - - @search_results = - if @project - unless %w(blobs notes issues merge_requests wiki_blobs). - include?(@scope) - @scope = 'blobs' - end - - Search::ProjectService.new(@project, current_user, params).execute - elsif @show_snippets - unless %w(snippet_blobs snippet_titles).include?(@scope) - @scope = 'snippet_blobs' - end - - Search::SnippetService.new(current_user, params).execute - else - unless %w(projects issues merge_requests).include?(@scope) - @scope = 'projects' - end - Search::GlobalService.new(current_user, params).execute - end - @objects = @search_results.objects(@scope, params[:page]) - end - - def autocomplete - term = params[:term] - - if params[:project_id].present? - @project = Project.find_by(id: params[:project_id]) - @project = nil unless can?(current_user, :read_project, @project) - end - - @ref = params[:project_ref] if params[:project_ref].present? - - render json: search_autocomplete_opts(term).to_json - end -end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb deleted file mode 100644 index 3f11d7afe6f..00000000000 --- a/app/controllers/sessions_controller.rb +++ /dev/null @@ -1,37 +0,0 @@ -class SessionsController < Devise::SessionsController - def new - redirect_path = - if request.referer.present? && (params['redirect_to_referer'] == 'yes') - referer_uri = URI(request.referer) - if referer_uri.host == Gitlab.config.gitlab.host - referer_uri.path - else - request.fullpath - end - else - request.fullpath - end - - # Prevent a 'you are already signed in' message directly after signing: - # we should never redirect to '/users/sign_in' after signing in successfully. - unless redirect_path == '/users/sign_in' - store_location_for(:redirect, redirect_path) - end - - if Gitlab.config.ldap.enabled - @ldap_servers = Gitlab::LDAP::Config.servers - end - - super - end - - def create - super do |resource| - # User has successfully signed in, so clear any unused reset tokens - if resource.reset_password_token.present? - resource.update_attributes(reset_password_token: nil, - reset_password_sent_at: nil) - end - end - end -end diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb deleted file mode 100644 index cd52556b203..00000000000 --- a/app/controllers/snippets_controller.rb +++ /dev/null @@ -1,113 +0,0 @@ -class SnippetsController < ApplicationController - before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] - - # Allow modify snippet - before_filter :authorize_modify_snippet!, only: [:edit, :update] - - # Allow destroy snippet - before_filter :authorize_admin_snippet!, only: [:destroy] - - before_filter :set_title - - skip_before_filter :authenticate_user!, only: [:index, :user_index, :show, :raw] - - respond_to :html - - layout :determine_layout - - def index - @snippets = SnippetsFinder.new.execute(current_user, filter: :all).page(params[:page]).per(PER_PAGE) - end - - def user_index - @user = User.find_by(username: params[:username]) - - render_404 and return unless @user - - @snippets = SnippetsFinder.new.execute(current_user, { - filter: :by_user, - user: @user, - scope: params[:scope] }). - page(params[:page]).per(PER_PAGE) - - if @user == current_user - render 'current_user_index' - else - render 'user_index' - end - end - - def new - @snippet = PersonalSnippet.new - end - - def create - @snippet = CreateSnippetService.new(nil, current_user, - snippet_params).execute - - respond_with @snippet.becomes(Snippet) - end - - def edit - end - - def update - UpdateSnippetService.new(nil, current_user, @snippet, - snippet_params).execute - respond_with @snippet.becomes(Snippet) - end - - def show - end - - def destroy - return access_denied! unless can?(current_user, :admin_personal_snippet, @snippet) - - @snippet.destroy - - redirect_to snippets_path - end - - def raw - send_data( - @snippet.content, - type: 'text/plain; charset=utf-8', - disposition: 'inline', - filename: @snippet.sanitized_file_name - ) - end - - protected - - def snippet - @snippet ||= if current_user - PersonalSnippet.where("author_id = ? OR visibility_level IN (?)", - current_user.id, - [Snippet::PUBLIC, Snippet::INTERNAL]). - find(params[:id]) - else - PersonalSnippet.are_public.find(params[:id]) - end - end - - def authorize_modify_snippet! - return render_404 unless can?(current_user, :modify_personal_snippet, @snippet) - end - - def authorize_admin_snippet! - return render_404 unless can?(current_user, :admin_personal_snippet, @snippet) - end - - def set_title - @title = 'Snippets' - @title_url = snippets_path - end - - def snippet_params - params.require(:personal_snippet).permit(:title, :content, :file_name, :private, :visibility_level) - end - - def determine_layout - current_user ? 'navless' : 'public_users' - end -end diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb deleted file mode 100644 index c5f3da54ea2..00000000000 --- a/app/controllers/uploads_controller.rb +++ /dev/null @@ -1,71 +0,0 @@ -class UploadsController < ApplicationController - skip_before_filter :authenticate_user! - before_filter :find_model, :authorize_access! - - def show - uploader = @model.send(upload_mount) - - unless uploader.file_storage? - return redirect_to uploader.url - end - - unless uploader.file && uploader.file.exists? - return not_found! - end - - disposition = uploader.image? ? 'inline' : 'attachment' - send_file uploader.file.path, disposition: disposition - end - - private - - def find_model - unless upload_model && upload_mount - return not_found! - end - - @model = upload_model.find(params[:id]) - end - - def authorize_access! - authorized = - case @model - when Project - can?(current_user, :read_project, @model) - when Group - can?(current_user, :read_group, @model) - when Note - can?(current_user, :read_project, @model.project) - else - # No authentication required for user avatars. - true - end - - return if authorized - - if current_user - not_found! - else - authenticate_user! - end - end - - def upload_model - upload_models = { - user: User, - project: Project, - note: Note, - group: Group - } - - upload_models[params[:model].to_sym] - end - - def upload_mount - upload_mounts = %w(avatar attachment file) - - if upload_mounts.include?(params[:mounted_as]) - params[:mounted_as] - end - end -end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb deleted file mode 100644 index 679d6897ce9..00000000000 --- a/app/controllers/users_controller.rb +++ /dev/null @@ -1,97 +0,0 @@ -class UsersController < ApplicationController - skip_before_filter :authenticate_user! - before_filter :set_user - layout :determine_layout - - def show - @contributed_projects = contributed_projects.joined(@user). - reject(&:forked?) - - @projects = @user.personal_projects. - where(id: authorized_projects_ids).includes(:namespace) - - # Collect only groups common for both users - @groups = @user.groups & GroupsFinder.new.execute(current_user) - - @title = @user.name - @title_url = user_path(@user) - - respond_to do |format| - format.html - - format.atom do - load_events - render layout: false - end - - format.json do - load_events - pager_json("events/_events", @events.count) - end - end - end - - def calendar - calendar = contributions_calendar - @timestamps = calendar.timestamps - @starting_year = calendar.starting_year - @starting_month = calendar.starting_month - - render 'calendar', layout: false - end - - def calendar_activities - @calendar_date = Date.parse(params[:date]) rescue nil - @events = [] - - if @calendar_date - @events = contributions_calendar.events_by_date(@calendar_date) - end - - render 'calendar_activities', layout: false - end - - def determine_layout - if current_user - 'navless' - else - 'public_users' - end - end - - private - - def set_user - @user = User.find_by_username!(params[:username]) - - unless current_user || @user.public_profile? - return authenticate_user! - end - end - - def authorized_projects_ids - # Projects user can view - @authorized_projects_ids ||= - ProjectsFinder.new.execute(current_user).pluck(:id) - end - - def contributed_projects - @contributed_projects = Project. - where(id: authorized_projects_ids & @user.contributed_projects_ids). - includes(:namespace) - end - - def contributions_calendar - @contributions_calendar ||= Gitlab::ContributionsCalendar. - new(contributed_projects.reject(&:forked?), @user) - end - - def load_events - # Get user activity feed for projects common for both users - @events = @user.recent_events. - where(project_id: authorized_projects_ids). - with_associations - - @events = @events.limit(20).offset(params[:offset] || 0) - end -end diff --git a/app/finders/README.md b/app/finders/README.md deleted file mode 100644 index 1f46518d230..00000000000 --- a/app/finders/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Finders - -This type of classes responsible for collection items based on different conditions. -To prevent lookup methods in models like this: - -```ruby -class Project - def issues_for_user_filtered_by(user, filter) - # A lot of logic not related to project model itself - end -end - -issues = project.issues_for_user_filtered_by(user, params) -``` - -Better use this: - -```ruby -issues = IssuesFinder.new.execute(project, user, filter) -``` - -It will help keep models thiner. diff --git a/app/finders/groups_finder.rb b/app/finders/groups_finder.rb deleted file mode 100644 index d3597ef0901..00000000000 --- a/app/finders/groups_finder.rb +++ /dev/null @@ -1,38 +0,0 @@ -class GroupsFinder - def execute(current_user, options = {}) - all_groups(current_user) - end - - private - - def all_groups(current_user) - if current_user - if current_user.authorized_groups.any? - # User has access to groups - # - # Return only: - # groups with public projects - # groups with internal projects - # groups with joined projects - # - group_ids = Project.public_and_internal_only.pluck(:namespace_id) + - current_user.authorized_groups.pluck(:id) - Group.where(id: group_ids) - else - # User has no group membership - # - # Return only: - # groups with public projects - # groups with internal projects - # - Group.where(id: Project.public_and_internal_only.pluck(:namespace_id)) - end - else - # Not authenticated - # - # Return only: - # groups with public projects - Group.where(id: Project.public_only.pluck(:namespace_id)) - end - end -end diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb deleted file mode 100644 index 2c0702073d4..00000000000 --- a/app/finders/issuable_finder.rb +++ /dev/null @@ -1,160 +0,0 @@ -# IssuableFinder -# -# Used to filter Issues and MergeRequests collections by set of params -# -# Arguments: -# klass - actual class like Issue or MergeRequest -# current_user - which user use -# params: -# scope: 'created-by-me' or 'assigned-to-me' or 'all' -# state: 'open' or 'closed' or 'all' -# group_id: integer -# project_id: integer -# milestone_id: integer -# assignee_id: integer -# search: string -# label_name: string -# sort: string -# -require_relative 'projects_finder' - -class IssuableFinder - NONE = '0' - - attr_accessor :current_user, :params - - def execute(current_user, params) - @current_user = current_user - @params = params - - items = init_collection - items = by_scope(items) - items = by_state(items) - items = by_group(items) - items = by_project(items) - items = by_search(items) - items = by_milestone(items) - items = by_assignee(items) - items = by_author(items) - items = by_label(items) - items = sort(items) - end - - private - - def init_collection - table_name = klass.table_name - - if project - if Ability.abilities.allowed?(current_user, :read_project, project) - project.send(table_name) - else - [] - end - elsif current_user && params[:authorized_only].presence && !current_user_related? - klass.of_projects(current_user.authorized_projects).references(:project) - else - klass.of_projects(ProjectsFinder.new.execute(current_user)).references(:project) - end - end - - def by_scope(items) - case params[:scope] - when 'created-by-me', 'authored' then - items.where(author_id: current_user.id) - when 'all' then - items - when 'assigned-to-me' then - items.where(assignee_id: current_user.id) - else - raise 'You must specify default scope' - end - end - - def by_state(items) - case params[:state] - when 'closed' - items.closed - when 'all' - items - when 'opened' - items.opened - else - raise 'You must specify default state' - end - end - - def by_group(items) - if params[:group_id].present? - items = items.of_group(Group.find(params[:group_id])) - end - - items - end - - def by_project(items) - if params[:project_id].present? - items = items.of_projects(params[:project_id]) - end - - items - end - - def by_search(items) - if params[:search].present? - items = items.search(params[:search]) - end - - items - end - - def sort(items) - items.sort(params[:sort]) - end - - def by_milestone(items) - if params[:milestone_id].present? - items = items.where(milestone_id: (params[:milestone_id] == NONE ? nil : params[:milestone_id])) - end - - items - end - - def by_assignee(items) - if params[:assignee_id].present? - items = items.where(assignee_id: (params[:assignee_id] == NONE ? nil : params[:assignee_id])) - end - - items - end - - def by_author(items) - if params[:author_id].present? - items = items.where(author_id: (params[:author_id] == NONE ? nil : params[:author_id])) - end - - items - end - - def by_label(items) - if params[:label_name].present? - label_names = params[:label_name].split(",") - - item_ids = LabelLink.joins(:label). - where('labels.title in (?)', label_names). - where(target_type: klass.name).pluck(:target_id) - - items = items.where(id: item_ids) - end - - items - end - - def project - Project.where(id: params[:project_id]).first if params[:project_id].present? - end - - def current_user_related? - params[:scope] == 'created-by-me' || params[:scope] == 'authored' || params[:scope] == 'assigned-to-me' - end -end diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb deleted file mode 100644 index 20a2b0ce8f0..00000000000 --- a/app/finders/issues_finder.rb +++ /dev/null @@ -1,22 +0,0 @@ -# Finders::Issues class -# -# Used to filter Issues collections by set of params -# -# Arguments: -# current_user - which user use -# params: -# scope: 'created-by-me' or 'assigned-to-me' or 'all' -# state: 'open' or 'closed' or 'all' -# group_id: integer -# project_id: integer -# milestone_id: integer -# assignee_id: integer -# search: string -# label_name: string -# sort: string -# -class IssuesFinder < IssuableFinder - def klass - Issue - end -end diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb deleted file mode 100644 index b258216d0d4..00000000000 --- a/app/finders/merge_requests_finder.rb +++ /dev/null @@ -1,22 +0,0 @@ -# Finders::MergeRequest class -# -# Used to filter MergeRequests collections by set of params -# -# Arguments: -# current_user - which user use -# params: -# scope: 'created-by-me' or 'assigned-to-me' or 'all' -# state: 'open' or 'closed' or 'all' -# group_id: integer -# project_id: integer -# milestone_id: integer -# assignee_id: integer -# search: string -# label_name: string -# sort: string -# -class MergeRequestsFinder < IssuableFinder - def klass - MergeRequest - end -end diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb deleted file mode 100644 index ab252821b52..00000000000 --- a/app/finders/notes_finder.rb +++ /dev/null @@ -1,27 +0,0 @@ -class NotesFinder - FETCH_OVERLAP = 5.seconds - - def execute(project, current_user, params) - target_type = params[:target_type] - target_id = params[:target_id] - # Default to 0 to remain compatible with old clients - last_fetched_at = Time.at(params.fetch(:last_fetched_at, 0).to_i) - - notes = - case target_type - when "commit" - project.notes.for_commit_id(target_id).not_inline - when "issue" - project.issues.find(target_id).notes.inc_author - when "merge_request" - project.merge_requests.find(target_id).mr_and_commit_notes.inc_author - when "snippet", "project_snippet" - project.snippets.find(target_id).notes - else - raise 'invalid target_type' - end - - # Use overlapping intervals to avoid worrying about race conditions - notes.where('updated_at > ?', last_fetched_at - FETCH_OVERLAP).fresh - end -end diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb deleted file mode 100644 index c81bb51583a..00000000000 --- a/app/finders/projects_finder.rb +++ /dev/null @@ -1,89 +0,0 @@ -class ProjectsFinder - def execute(current_user, options = {}) - group = options[:group] - - if group - group_projects(current_user, group) - else - all_projects(current_user) - end - end - - private - - def group_projects(current_user, group) - if current_user - if group.users.include?(current_user) - # User is group member - # - # Return ALL group projects - group.projects - else - projects_members = ProjectMember.in_projects(group.projects). - with_user(current_user) - - if projects_members.any? - # User is a project member - # - # Return only: - # public projects - # internal projects - # joined projects - # - group.projects.where( - "projects.id IN (?) OR projects.visibility_level IN (?)", - projects_members.pluck(:source_id), - Project.public_and_internal_levels - ) - else - # User has no access to group or group projects - # - # Return only: - # public projects - # internal projects - # - group.projects.public_and_internal_only - end - end - else - # Not authenticated - # - # Return only: - # public projects - group.projects.public_only - end - end - - def all_projects(current_user) - if current_user - if current_user.authorized_projects.any? - # User has access to private projects - # - # Return only: - # public projects - # internal projects - # joined projects - # - Project.where( - "projects.id IN (?) OR projects.visibility_level IN (?)", - current_user.authorized_projects.pluck(:id), - Project.public_and_internal_levels - ) - else - # User has no access to private projects - # - # Return only: - # public projects - # internal projects - # - Project.public_and_internal_only - end - else - # Not authenticated - # - # Return only: - # public projects - Project.public_only - end - end -end diff --git a/app/finders/snippets_finder.rb b/app/finders/snippets_finder.rb deleted file mode 100644 index 07b5759443b..00000000000 --- a/app/finders/snippets_finder.rb +++ /dev/null @@ -1,63 +0,0 @@ -class SnippetsFinder - def execute(current_user, params = {}) - filter = params[:filter] - - case filter - when :all then - snippets(current_user).fresh.non_expired - when :by_user then - by_user(current_user, params[:user], params[:scope]) - when :by_project - by_project(current_user, params[:project]) - end - end - - private - - def snippets(current_user) - if current_user - Snippet.public_and_internal - else - # Not authenticated - # - # Return only: - # public snippets - Snippet.are_public - end - end - - def by_user(current_user, user, scope) - snippets = user.snippets.fresh.non_expired - - return snippets.are_public unless current_user - - if user == current_user - case scope - when 'are_internal' then - snippets.are_internal - when 'are_private' then - snippets.are_private - when 'are_public' then - snippets.are_public - else - snippets - end - else - snippets.public_and_internal - end - end - - def by_project(current_user, project) - snippets = project.snippets.fresh.non_expired - - if current_user - if project.team.member?(current_user.id) - snippets - else - snippets.public_and_internal - end - else - snippets.are_public - end - end -end diff --git a/app/finders/trending_projects_finder.rb b/app/finders/trending_projects_finder.rb deleted file mode 100644 index a79bd47d986..00000000000 --- a/app/finders/trending_projects_finder.rb +++ /dev/null @@ -1,19 +0,0 @@ -class TrendingProjectsFinder - def execute(current_user, start_date = nil) - start_date ||= Date.today - 1.month - - projects = projects_for(current_user) - - # Determine trending projects based on comments count - # for period of time - ex. month - projects.joins(:notes).where('notes.created_at > ?', start_date). - select("projects.*, count(notes.id) as ncount"). - group("projects.id").reorder("ncount DESC") - end - - private - - def projects_for(current_user) - ProjectsFinder.new.execute(current_user) - end -end diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb deleted file mode 100644 index bb8d5683807..00000000000 --- a/app/helpers/appearances_helper.rb +++ /dev/null @@ -1,21 +0,0 @@ -module AppearancesHelper - def brand_item - nil - end - - def brand_title - 'GitLab Community Edition' - end - - def brand_image - nil - end - - def brand_text - nil - end - - def brand_header_logo - image_tag 'logo-white.png' - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb deleted file mode 100644 index 20457572a08..00000000000 --- a/app/helpers/application_helper.rb +++ /dev/null @@ -1,325 +0,0 @@ -require 'digest/md5' -require 'uri' - -module ApplicationHelper - COLOR_SCHEMES = { - 1 => 'white', - 2 => 'dark', - 3 => 'solarized-light', - 4 => 'solarized-dark', - 5 => 'monokai', - } - COLOR_SCHEMES.default = 'white' - - # Helper method to access the COLOR_SCHEMES - # - # The keys are the `color_scheme_ids` - # The values are the `name` of the scheme. - # - # The preview images are `name-scheme-preview.png` - # The stylesheets should use the css class `.name` - def color_schemes - COLOR_SCHEMES.freeze - end - - # Check if a particular controller is the current one - # - # args - One or more controller names to check - # - # Examples - # - # # On TreeController - # current_controller?(:tree) # => true - # current_controller?(:commits) # => false - # current_controller?(:commits, :tree) # => true - def current_controller?(*args) - args.any? { |v| v.to_s.downcase == controller.controller_name } - end - - # Check if a particular action is the current one - # - # args - One or more action names to check - # - # Examples - # - # # On Projects#new - # current_action?(:new) # => true - # current_action?(:create) # => false - # current_action?(:new, :create) # => true - def current_action?(*args) - args.any? { |v| v.to_s.downcase == action_name } - end - - def project_icon(project_id, options = {}) - project = - if project_id.is_a?(Project) - project = project_id - else - Project.find_with_namespace(project_id) - end - - if project.avatar_url - image_tag project.avatar_url, options - else # generated icon - project_identicon(project, options) - end - end - - def project_identicon(project, options = {}) - allowed_colors = { - red: 'FFEBEE', - purple: 'F3E5F5', - indigo: 'E8EAF6', - blue: 'E3F2FD', - teal: 'E0F2F1', - orange: 'FBE9E7', - gray: 'EEEEEE' - } - - options[:class] ||= '' - options[:class] << ' identicon' - bg_key = project.id % 7 - style = "background-color: ##{ allowed_colors.values[bg_key] }; color: #555" - - content_tag(:div, class: options[:class], style: style) do - project.name[0, 1].upcase - end - end - - def avatar_icon(user_email = '', size = nil) - user = User.find_by(email: user_email) - - if user - user.avatar_url(size) || default_avatar - else - gravatar_icon(user_email, size) - end - end - - def gravatar_icon(user_email = '', size = nil) - GravatarService.new.execute(user_email, size) || - default_avatar - end - - def default_avatar - image_path('no_avatar.png') - end - - def last_commit(project) - if project.repo_exists? - time_ago_with_tooltip(project.repository.commit.committed_date) - else - 'Never' - end - rescue - 'Never' - end - - def grouped_options_refs - repository = @project.repository - - options = [ - ['Branches', repository.branch_names], - ['Tags', VersionSorter.rsort(repository.tag_names)] - ] - - # If reference is commit id - we should add it to branch/tag selectbox - if(@ref && !options.flatten.include?(@ref) && - @ref =~ /\A[0-9a-zA-Z]{6,52}\z/) - options << ['Commit', [@ref]] - end - - grouped_options_for_select(options, @ref || @project.default_branch) - end - - def emoji_autocomplete_source - # should be an array of strings - # so to_s can be called, because it is sufficient and to_json is too slow - Emoji.names.to_s - end - - def app_theme - Gitlab::Theme.css_class_by_id(current_user.try(:theme_id)) - end - - def theme_type - Gitlab::Theme.type_css_class_by_id(current_user.try(:theme_id)) - end - - def user_color_scheme_class - COLOR_SCHEMES[current_user.try(:color_scheme_id)] if defined?(current_user) - end - - # Define whenever show last push event - # with suggestion to create MR - def show_last_push_widget?(event) - # Skip if event is not about added or modified non-master branch - return false unless event && event.last_push_to_non_root? && !event.rm_ref? - - project = event.project - - # Skip if project repo is empty or MR disabled - return false unless project && !project.empty_repo? && project.merge_requests_enabled - - # Skip if user already created appropriate MR - return false if project.merge_requests.where(source_branch: event.branch_name).opened.any? - - # Skip if user removed branch right after that - return false unless project.repository.branch_names.include?(event.branch_name) - - true - end - - def hexdigest(string) - Digest::SHA1.hexdigest string - end - - def simple_sanitize(str) - sanitize(str, tags: %w(a span)) - end - - def body_data_page - path = controller.controller_path.split('/') - namespace = path.first if path.second - - [namespace, controller.controller_name, controller.action_name].compact.join(':') - end - - # shortcut for gitlab config - def gitlab_config - Gitlab.config.gitlab - end - - # shortcut for gitlab extra config - def extra_config - Gitlab.config.extra - end - - def search_placeholder - if @project && @project.persisted? - 'Search in this project' - elsif @snippet || @snippets || @show_snippets - 'Search snippets' - elsif @group && @group.persisted? - 'Search in this group' - else - 'Search' - end - end - - def broadcast_message - BroadcastMessage.current - end - - def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago') - capture_haml do - haml_tag :time, date.to_s, - class: html_class, datetime: date.getutc.iso8601, title: date.stamp('Aug 21, 2011 9:23pm'), - data: { toggle: 'tooltip', placement: placement } - - haml_tag :script, "$('." + html_class + "').timeago().tooltip()" - end.html_safe - end - - def render_markup(file_name, file_content) - GitHub::Markup.render(file_name, file_content). - force_encoding(file_content.encoding).html_safe - rescue RuntimeError - simple_format(file_content) - end - - def markup?(filename) - Gitlab::MarkdownHelper.markup?(filename) - end - - def gitlab_markdown?(filename) - Gitlab::MarkdownHelper.gitlab_markdown?(filename) - end - - # Overrides ActionView::Helpers::UrlHelper#link_to to add `rel="nofollow"` to - # external links - def link_to(name = nil, options = nil, html_options = {}) - if options.kind_of?(String) - if !options.start_with?('#', '/') - html_options = add_nofollow(options, html_options) - end - end - - super - end - - # Add `"rel=nofollow"` to external links - # - # link - String link to check - # html_options - Hash of `html_options` passed to `link_to` - # - # Returns `html_options`, adding `rel: nofollow` for external links - def add_nofollow(link, html_options = {}) - uri = URI(link) - - if uri && uri.absolute? && uri.host != Gitlab.config.gitlab.host - rel = html_options.fetch(:rel, '') - html_options[:rel] = (rel + ' nofollow').strip - end - - html_options - end - - def escaped_autolink(text) - auto_link ERB::Util.html_escape(text), link: :urls - end - - def promo_host - 'about.gitlab.com' - end - - def promo_url - 'https://' + promo_host - end - - def page_filter_path(options = {}) - without = options.delete(:without) - - exist_opts = { - state: params[:state], - scope: params[:scope], - label_name: params[:label_name], - milestone_id: params[:milestone_id], - assignee_id: params[:assignee_id], - author_id: params[:author_id], - sort: params[:sort], - } - - options = exist_opts.merge(options) - - if without.present? - without.each do |key| - options.delete(key) - end - end - - path = request.path - path << "?#{options.to_param}" - path - end - - def outdated_browser? - browser.ie? && browser.version.to_i < 10 - end - - def path_to_key(key, admin = false) - if admin - admin_user_key_path(@user, key) - else - profile_key_path(key) - end - end - - def nav_sidebar_class - if nav_menu_collapsed? - "page-sidebar-collapsed" - else - "page-sidebar-expanded" - end - end -end diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb deleted file mode 100644 index 241d6075c9f..00000000000 --- a/app/helpers/application_settings_helper.rb +++ /dev/null @@ -1,38 +0,0 @@ -module ApplicationSettingsHelper - def gravatar_enabled? - current_application_settings.gravatar_enabled? - end - - def twitter_sharing_enabled? - current_application_settings.twitter_sharing_enabled? - end - - def signup_enabled? - current_application_settings.signup_enabled? - end - - def signin_enabled? - current_application_settings.signin_enabled? - end - - def extra_sign_in_text - current_application_settings.sign_in_text - end - - # Return a group of checkboxes that use Bootstrap's button plugin for a - # toggle button effect. - def restricted_level_checkboxes(help_block_id) - Gitlab::VisibilityLevel.options.map do |name, level| - checked = restricted_visibility_levels(true).include?(level) - css_class = 'btn btn-primary' - css_class += ' active' if checked - checkbox_name = 'application_setting[restricted_visibility_levels][]' - - label_tag(checkbox_name, class: css_class) do - check_box_tag(checkbox_name, level, checked, - autocomplete: 'off', - 'aria-describedby' => help_block_id) + name - end - end - end -end diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb deleted file mode 100644 index 4ea838ca447..00000000000 --- a/app/helpers/blob_helper.rb +++ /dev/null @@ -1,72 +0,0 @@ -module BlobHelper - def highlight(blob_name, blob_content, nowrap = false) - formatter = Rugments::Formatters::HTML.new( - nowrap: nowrap, - cssclass: 'code highlight', - lineanchors: true, - lineanchorsid: 'LC' - ) - - begin - lexer = Rugments::Lexer.guess(filename: blob_name, source: blob_content) - rescue Rugments::Lexer::AmbiguousGuess - lexer = Rugments::Lexers::PlainText - end - - formatter.format(lexer.lex(blob_content)).html_safe - end - - def no_highlight_files - %w(credits changelog news copying copyright license authors) - end - - def edit_blob_link(project, ref, path, options = {}) - blob = - begin - project.repository.blob_at(ref, path) - rescue - nil - end - - if blob && blob.text? - text = 'Edit' - after = options[:after] || '' - from_mr = options[:from_merge_request_id] - link_opts = {} - link_opts[:from_merge_request_id] = from_mr if from_mr - cls = 'btn btn-small' - if allowed_tree_edit?(project, ref) - link_to(text, - namespace_project_edit_blob_path(project.namespace, project, - tree_join(ref, path), - link_opts), - class: cls - ) - else - content_tag :span, text, class: cls + ' disabled' - end + after.html_safe - else - '' - end - end - - def leave_edit_message - "Leave edit mode?\nAll unsaved changes will be lost." - end - - def editing_preview_title(filename) - if Gitlab::MarkdownHelper.previewable?(filename) - 'Preview' - else - 'Preview changes' - end - end - - # Return an image icon depending on the file mode and extension - # - # mode - File unix mode - # mode - File name - def blob_icon(mode, name) - icon("#{file_type_icon_class('file', mode, name)} fw") - end -end diff --git a/app/helpers/branches_helper.rb b/app/helpers/branches_helper.rb deleted file mode 100644 index d6eaa7d57bc..00000000000 --- a/app/helpers/branches_helper.rb +++ /dev/null @@ -1,17 +0,0 @@ -module BranchesHelper - def can_remove_branch?(project, branch_name) - if project.protected_branch? branch_name - false - elsif branch_name == project.repository.root_ref - false - else - can?(current_user, :push_code, project) - end - end - - def can_push_branch?(project, branch_name) - return false unless project.repository.branch_names.include?(branch_name) - - ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(branch_name) - end -end diff --git a/app/helpers/broadcast_messages_helper.rb b/app/helpers/broadcast_messages_helper.rb deleted file mode 100644 index 29ff47663da..00000000000 --- a/app/helpers/broadcast_messages_helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -module BroadcastMessagesHelper - def broadcast_styling(broadcast_message) - if(broadcast_message.color || broadcast_message.font) - "background-color:#{broadcast_message.color};color:#{broadcast_message.font}" - else - "" - end - end -end diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb deleted file mode 100644 index d13d80be293..00000000000 --- a/app/helpers/commits_helper.rb +++ /dev/null @@ -1,183 +0,0 @@ -# encoding: utf-8 -module CommitsHelper - # Returns a link to the commit author. If the author has a matching user and - # is a member of the current @project it will link to the team member page. - # Otherwise it will link to the author email as specified in the commit. - # - # options: - # avatar: true will prepend the avatar image - # size: size of the avatar image in px - def commit_author_link(commit, options = {}) - commit_person_link(commit, options.merge(source: :author)) - end - - # Just like #author_link but for the committer. - def commit_committer_link(commit, options = {}) - commit_person_link(commit, options.merge(source: :committer)) - end - - def image_diff_class(diff) - if diff.deleted_file - "deleted" - elsif diff.new_file - "added" - else - nil - end - end - - def commit_to_html(commit, project, inline = true) - template = inline ? "inline_commit" : "commit" - escape_javascript(render "projects/commits/#{template}", commit: commit, project: project) unless commit.nil? - end - - # Breadcrumb links for a Project and, if applicable, a tree path - def commits_breadcrumbs - return unless @project && @ref - - # Add the root project link and the arrow icon - crumbs = content_tag(:li) do - link_to( - @project.path, - namespace_project_commits_path(@project.namespace, @project, @ref) - ) - end - - if @path - parts = @path.split('/') - - parts.each_with_index do |part, i| - crumbs << content_tag(:li) do - # The text is just the individual part, but the link needs all the parts before it - link_to( - part, - namespace_project_commits_path( - @project.namespace, - @project, - tree_join(@ref, parts[0..i].join('/')) - ) - ) - end - end - end - - crumbs.html_safe - end - - # Return Project default branch, if it present in array - # Else - first branch in array (mb last actual branch) - def commit_default_branch(project, branches) - branches.include?(project.default_branch) ? branches.delete(project.default_branch) : branches.pop - end - - # Returns the sorted alphabetically links to branches, separated by a comma - def commit_branches_links(project, branches) - branches.sort.map do |branch| - link_to( - namespace_project_tree_path(project.namespace, project, branch) - ) do - content_tag :span, class: 'label label-gray' do - icon('code-fork') + ' ' + branch - end - end - end.join(" ").html_safe - end - - # Returns the sorted links to tags, separated by a comma - def commit_tags_links(project, tags) - sorted = VersionSorter.rsort(tags) - sorted.map do |tag| - link_to( - namespace_project_commits_path(project.namespace, project, - project.repository.find_tag(tag).name) - ) do - content_tag :span, class: 'label label-gray' do - icon('tag') + ' ' + tag - end - end - end.join(" ").html_safe - end - - def link_to_browse_code(project, commit) - if current_controller?(:projects, :commits) - if @repo.blob_at(commit.id, @path) - return link_to( - "Browse File »", - namespace_project_blob_path(project.namespace, project, - tree_join(commit.id, @path)), - class: "pull-right" - ) - elsif @path.present? - return link_to( - "Browse Dir »", - namespace_project_tree_path(project.namespace, project, - tree_join(commit.id, @path)), - class: "pull-right" - ) - end - end - link_to( - "Browse Code »", - namespace_project_tree_path(project.namespace, project, commit), - class: "pull-right" - ) - end - - protected - - # Private: Returns a link to a person. If the person has a matching user and - # is a member of the current @project it will link to the team member page. - # Otherwise it will link to the person email as specified in the commit. - # - # options: - # source: one of :author or :committer - # avatar: true will prepend the avatar image - # size: size of the avatar image in px - def commit_person_link(commit, options = {}) - user = commit.send(options[:source]) - - source_name = clean(commit.send "#{options[:source]}_name".to_sym) - source_email = clean(commit.send "#{options[:source]}_email".to_sym) - - person_name = user.try(:name) || source_name - person_email = user.try(:email) || source_email - - text = - if options[:avatar] - avatar = image_tag(avatar_icon(person_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "") - %Q{#{avatar} <span class="commit-#{options[:source]}-name">#{person_name}</span>} - else - person_name - end - - options = { - class: "commit-#{options[:source]}-link has_tooltip", - data: { :'original-title' => sanitize(source_email) } - } - - if user.nil? - mail_to(source_email, text.html_safe, options) - else - link_to(text.html_safe, user_path(user), options) - end - end - - def view_file_btn(commit_sha, diff, project) - link_to( - namespace_project_blob_path(project.namespace, project, - tree_join(commit_sha, diff.new_path)), - class: 'btn btn-small view-file js-view-file' - ) do - raw('View file @') + content_tag(:span, commit_sha[0..6], - class: 'commit-short-id') - end - end - - def truncate_sha(sha) - Commit.truncate_sha(sha) - end - - def clean(string) - Sanitize.clean(string, remove_contents: true) - end -end diff --git a/app/helpers/compare_helper.rb b/app/helpers/compare_helper.rb deleted file mode 100644 index 01847c6b807..00000000000 --- a/app/helpers/compare_helper.rb +++ /dev/null @@ -1,22 +0,0 @@ -module CompareHelper - def compare_to_mr_button? - @project.merge_requests_enabled && - params[:from].present? && - params[:to].present? && - @repository.branch_names.include?(params[:from]) && - @repository.branch_names.include?(params[:to]) && - params[:from] != params[:to] && - !@refs_are_same - end - - def compare_mr_path - new_namespace_project_merge_request_path( - @project.namespace, - @project, - merge_request: { - source_branch: params[:to], - target_branch: params[:from] - } - ) - end -end diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb deleted file mode 100644 index c25b54eadc6..00000000000 --- a/app/helpers/dashboard_helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -module DashboardHelper - def assigned_issues_dashboard_path - issues_dashboard_path(assignee_id: current_user.id) - end - - def assigned_mrs_dashboard_path - merge_requests_dashboard_path(assignee_id: current_user.id) - end -end diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb deleted file mode 100644 index 4f42972a4dd..00000000000 --- a/app/helpers/diff_helper.rb +++ /dev/null @@ -1,157 +0,0 @@ -module DiffHelper - def allowed_diff_size - if diff_hard_limit_enabled? - Commit::DIFF_HARD_LIMIT_FILES - else - Commit::DIFF_SAFE_FILES - end - end - - def safe_diff_files(diffs) - diffs.first(allowed_diff_size).map do |diff| - Gitlab::Diff::File.new(diff) - end - end - - def show_diff_size_warning?(diffs) - diffs.size > allowed_diff_size - end - - def diff_hard_limit_enabled? - # Enabling hard limit allows user to see more diff information - if params[:force_show_diff].present? - true - else - false - end - end - - def generate_line_code(file_path, line) - Gitlab::Diff::LineCode.generate(file_path, line.new_pos, line.old_pos) - end - - def parallel_diff(diff_file, index) - lines = [] - skip_next = false - - # Building array of lines - # - # [ - # left_type, left_line_number, left_line_content, left_line_code, - # right_line_type, right_line_number, right_line_content, right_line_code - # ] - # - diff_file.diff_lines.each do |line| - - full_line = line.text - type = line.type - line_code = generate_line_code(diff_file.file_path, line) - line_new = line.new_pos - line_old = line.old_pos - - next_line = diff_file.next_line(line.index) - - if next_line - next_line_code = generate_line_code(diff_file.file_path, next_line) - next_type = next_line.type - next_line = next_line.text - end - - if type == 'match' || type.nil? - # line in the right panel is the same as in the left one - line = [type, line_old, full_line, line_code, type, line_new, full_line, line_code] - lines.push(line) - elsif type == 'old' - if next_type == 'new' - # Left side has text removed, right side has text added - line = [type, line_old, full_line, line_code, next_type, line_new, next_line, next_line_code] - lines.push(line) - skip_next = true - elsif next_type == 'old' || next_type.nil? - # Left side has text removed, right side doesn't have any change - # No next line code, no new line number, no new line text - line = [type, line_old, full_line, line_code, next_type, nil, " ", nil] - lines.push(line) - end - elsif type == 'new' - if skip_next - # Change has been already included in previous line so no need to do it again - skip_next = false - next - else - # Change is only on the right side, left side has no change - line = [nil, nil, " ", line_code, type, line_new, full_line, line_code] - lines.push(line) - end - end - end - lines - end - - def unfold_bottom_class(bottom) - (bottom) ? 'js-unfold-bottom' : '' - end - - def diff_line_content(line) - if line.blank? - " " - else - line - end - end - - def line_comments - @line_comments ||= @line_notes.select(&:active?).group_by(&:line_code) - end - - def organize_comments(type_left, type_right, line_code_left, line_code_right) - comments_left = comments_right = nil - - unless type_left.nil? && type_right == 'new' - comments_left = line_comments[line_code_left] - end - - unless type_left.nil? && type_right.nil? - comments_right = line_comments[line_code_right] - end - - [comments_left, comments_right] - end - - def inline_diff_btn - params_copy = params.dup - params_copy[:view] = 'inline' - # Always use HTML to handle case where JSON diff rendered this button - params_copy.delete(:format) - - link_to url_for(params_copy), id: "commit-diff-viewtype", class: (params[:view] != 'parallel' ? 'btn btn-sm active' : 'btn btn-sm') do - 'Inline' - end - end - - def parallel_diff_btn - params_copy = params.dup - params_copy[:view] = 'parallel' - # Always use HTML to handle case where JSON diff rendered this button - params_copy.delete(:format) - - link_to url_for(params_copy), id: "commit-diff-viewtype", class: (params[:view] == 'parallel' ? 'btn active btn-sm' : 'btn btn-sm') do - 'Side-by-side' - end - end - - def submodule_link(blob, ref) - tree, commit = submodule_links(blob, ref) - commit_id = if commit.nil? - blob.id[0..10] - else - link_to "#{blob.id[0..10]}", commit - end - - [ - content_tag(:span, link_to(truncate(blob.name, length: 40), tree)), - '@', - content_tag(:span, commit_id, class: 'monospace'), - ].join(' ').html_safe - end -end diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb deleted file mode 100644 index 0df3ecc90b7..00000000000 --- a/app/helpers/emails_helper.rb +++ /dev/null @@ -1,38 +0,0 @@ -module EmailsHelper - - # Google Actions - # https://developers.google.com/gmail/markup/reference/go-to-action - def email_action(url) - name = action_title(url) - if name - data = { - "@context" => "http://schema.org", - "@type" => "EmailMessage", - "action" => { - "@type" => "ViewAction", - "name" => name, - "url" => url, - } - } - - content_tag :script, type: 'application/ld+json' do - data.to_json.html_safe - end - end - end - - def action_title(url) - return unless url - ["merge_requests", "issues", "commit"].each do |action| - if url.split("/").include?(action) - return "View #{action.humanize.singularize}" - end - end - end - - def color_email_diff(diffcontent) - formatter = Rugments::Formatters::HTML.new(cssclass: "highlight", inline_theme: :github) - lexer = Rugments::Lexers::Diff.new - raw formatter.format(lexer.lex(diffcontent)) - end -end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb deleted file mode 100644 index c9fd0f0362b..00000000000 --- a/app/helpers/events_helper.rb +++ /dev/null @@ -1,199 +0,0 @@ -module EventsHelper - def link_to_author(event) - author = event.author - - if author - link_to author.name, user_path(author.username) - else - event.author_name - end - end - - def event_action_name(event) - target = if event.target_type - if event.note? - event.note_target_type - else - event.target_type.titleize.downcase - end - else - 'project' - end - - [event.action_name, target].join(" ") - end - - def event_filter_link(key, tooltip) - key = key.to_s - active = if @event_filter.active? key - 'active' - end - - content_tag :li, class: "filter_icon #{active}" do - link_to request.path, class: 'has_tooltip event_filter_link', id: "#{key}_event_filter", 'data-original-title' => 'Filter by ' + tooltip.downcase do - icon(icon_for_event[key]) + content_tag(:span, ' ' + tooltip) - end - end - end - - def icon_for_event - { - EventFilter.push => 'upload', - EventFilter.merged => 'check-square-o', - EventFilter.comments => 'comments', - EventFilter.team => 'user', - } - end - - def event_feed_title(event) - words = [] - words << event.author_name - words << event_action_name(event) - - if event.push? - words << event.ref_type - words << event.ref_name - words << "at" - elsif event.commented? - if event.note_commit? - words << event.note_short_commit_id - else - words << "##{truncate event.note_target_iid}" - end - words << "at" - elsif event.target - words << "##{event.target_iid}:" - words << event.target.title if event.target.respond_to?(:title) - words << "at" - end - - words << event.project_name - - words.join(" ") - end - - def event_feed_url(event) - if event.issue? - namespace_project_issue_url(event.project.namespace, event.project, - event.issue) - elsif event.merge_request? - namespace_project_merge_request_url(event.project.namespace, - event.project, event.merge_request) - elsif event.note? && event.note_commit? - namespace_project_commit_url(event.project.namespace, event.project, - event.note_target) - elsif event.note? - if event.note_target - if event.note_commit? - namespace_project_commit_path(event.project.namespace, event.project, - event.note_commit_id, - anchor: dom_id(event.target)) - elsif event.note_project_snippet? - namespace_project_snippet_path(event.project.namespace, - event.project, event.note_target) - else - event_note_target_path(event) - end - end - elsif event.push? - if event.push_with_commits? && event.md_ref? - if event.commits_count > 1 - namespace_project_compare_url(event.project.namespace, event.project, - from: event.commit_from, to: - event.commit_to) - else - namespace_project_commit_url(event.project.namespace, event.project, - id: event.commit_to) - end - else - namespace_project_commits_url(event.project.namespace, event.project, - event.ref_name) - end - end - end - - def event_feed_summary(event) - if event.issue? - render "events/event_issue", issue: event.issue - elsif event.push? - render "events/event_push", event: event - elsif event.merge_request? - render "events/event_merge_request", merge_request: event.merge_request - elsif event.note? - render "events/event_note", note: event.note - end - end - - def event_note_target_path(event) - if event.note? && event.note_commit? - namespace_project_commit_path(event.project.namespace, event.project, - event.note_target) - else - polymorphic_path([event.project.namespace.becomes(Namespace), - event.project, event.note_target], - anchor: dom_id(event.target)) - end - end - - def event_note_title_html(event) - if event.note_target - if event.note_commit? - link_to( - namespace_project_commit_path(event.project.namespace, event.project, - event.note_commit_id, - anchor: dom_id(event.target)), - class: "commit_short_id" - ) do - "#{event.note_target_type} #{event.note_short_commit_id}" - end - elsif event.note_project_snippet? - link_to(namespace_project_snippet_path(event.project.namespace, - event.project, - event.note_target)) do - "#{event.note_target_type} ##{truncate event.note_target_id}" - end - else - link_to event_note_target_path(event) do - "#{event.note_target_type} ##{truncate event.note_target_iid}" - end - end - else - content_tag :strong do - "(deleted)" - end - end - end - - def event_note(text) - text = first_line_in_markdown(text, 150) - sanitize(text, tags: %w(a img b pre code p span)) - end - - def event_commit_title(message) - escape_once(truncate(message.split("\n").first, length: 70)) - rescue - "--broken encoding" - end - - def event_to_atom(xml, event) - if event.proper? - xml.entry do - event_link = event_feed_url(event) - event_title = event_feed_title(event) - event_summary = event_feed_summary(event) - - xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}" - xml.link href: event_link - xml.title truncate(event_title, length: 80) - xml.updated event.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") - xml.media :thumbnail, width: "40", height: "40", url: avatar_icon(event.author_email) - xml.author do |author| - xml.name event.author_name - xml.email event.author_email - end - - xml.summary(type: "xhtml") { |x| x << event_summary unless event_summary.nil? } - end - end - end -end diff --git a/app/helpers/explore_helper.rb b/app/helpers/explore_helper.rb deleted file mode 100644 index 7616fe6bad8..00000000000 --- a/app/helpers/explore_helper.rb +++ /dev/null @@ -1,17 +0,0 @@ -module ExploreHelper - def explore_projects_filter_path(options={}) - exist_opts = { - sort: params[:sort], - scope: params[:scope], - group: params[:group], - tag: params[:tag], - visibility_level: params[:visibility_level], - } - - options = exist_opts.merge(options) - - path = request.path - path << "?#{options.to_param}" - path - end -end diff --git a/app/helpers/external_wiki_helper.rb b/app/helpers/external_wiki_helper.rb deleted file mode 100644 index 838b85afdfe..00000000000 --- a/app/helpers/external_wiki_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -module ExternalWikiHelper - def get_project_wiki_path(project) - external_wiki_service = project.services. - select { |service| service.to_param == 'external_wiki' }.first - if external_wiki_service.present? && external_wiki_service.active? - external_wiki_service.properties['external_wiki_url'] - else - namespace_project_wiki_path(project.namespace, project, :home) - end - end -end diff --git a/app/helpers/git_helper.rb b/app/helpers/git_helper.rb deleted file mode 100644 index 09684955233..00000000000 --- a/app/helpers/git_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module GitHelper - def strip_gpg_signature(text) - text.gsub(/-----BEGIN PGP SIGNATURE-----(.*)-----END PGP SIGNATURE-----/m, "") - end -end diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb deleted file mode 100644 index aa1de2f50ef..00000000000 --- a/app/helpers/gitlab_markdown_helper.rb +++ /dev/null @@ -1,275 +0,0 @@ -module GitlabMarkdownHelper - include Gitlab::Markdown - - # Use this in places where you would normally use link_to(gfm(...), ...). - # - # It solves a problem occurring with nested links (i.e. - # "<a>outer text <a>gfm ref</a> more outer text</a>"). This will not be - # interpreted as intended. Browsers will parse something like - # "<a>outer text </a><a>gfm ref</a> more outer text" (notice the last part is - # not linked any more). link_to_gfm corrects that. It wraps all parts to - # explicitly produce the correct linking behavior (i.e. - # "<a>outer text </a><a>gfm ref</a><a> more outer text</a>"). - def link_to_gfm(body, url, html_options = {}) - return "" if body.blank? - - escaped_body = if body =~ /\A\<img/ - body - else - escape_once(body) - end - - gfm_body = gfm(escaped_body, @project, html_options) - - gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match| - "</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1 - end - - link_to(gfm_body.html_safe, url, html_options) - end - - def markdown(text, options={}) - unless @markdown && options == @options - @options = options - - # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch - rend = Redcarpet::Render::GitlabHTML.new(self, user_color_scheme_class, { - with_toc_data: true, - safe_links_only: true, - # Handled further down the line by HTML::Pipeline::SanitizationFilter - escape_html: false - }.merge(options)) - - # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use - @markdown = Redcarpet::Markdown.new(rend, - no_intra_emphasis: true, - tables: true, - fenced_code_blocks: true, - autolink: true, - strikethrough: true, - lax_spacing: true, - space_after_headers: true, - superscript: true - ) - end - - @markdown.render(text).html_safe - end - - # Return the first line of +text+, up to +max_chars+, after parsing the line - # as Markdown. HTML tags in the parsed output are not counted toward the - # +max_chars+ limit. If the length limit falls within a tag's contents, then - # the tag contents are truncated without removing the closing tag. - def first_line_in_markdown(text, max_chars = nil) - md = markdown(text).strip - - truncate_visible(md, max_chars || md.length) if md.present? - end - - def render_wiki_content(wiki_page) - if wiki_page.format == :markdown - markdown(wiki_page.content) - else - wiki_page.formatted_content.html_safe - end - end - - def create_relative_links(text) - paths = extract_paths(text) - - paths.uniq.each do |file_path| - # If project does not have repository - # its nothing to rebuild - # - # TODO: pass project variable to markdown helper instead of using - # instance variable. Right now it generates invalid path for pages out - # of project scope. Example: search results where can be rendered markdown - # from different projects - if @repository && @repository.exists? && !@repository.empty? - new_path = rebuild_path(file_path) - # Finds quoted path so we don't replace other mentions of the string - # eg. "doc/api" will be replaced and "/home/doc/api/text" won't - text.gsub!("\"#{file_path}\"", "\"/#{new_path}\"") - end - end - - text - end - - def extract_paths(text) - links = substitute_links(text) - image_links = substitute_image_links(text) - links + image_links - end - - def substitute_links(text) - links = text.scan(/<a href=\"([^"]*)\">/) - relative_links = links.flatten.reject{ |link| link_to_ignore? link } - relative_links - end - - def substitute_image_links(text) - links = text.scan(/<img src=\"([^"]*)\"/) - relative_links = links.flatten.reject{ |link| link_to_ignore? link } - relative_links - end - - def link_to_ignore?(link) - if link =~ /\A\#\w+/ - # ignore anchors like <a href="#my-header"> - true - else - ignored_protocols.map{ |protocol| link.include?(protocol) }.any? - end - end - - def ignored_protocols - ["http://","https://", "ftp://", "mailto:", "smb://"] - end - - def rebuild_path(file_path) - file_path = file_path.dup - file_path.gsub!(/(#.*)/, "") - id = $1 || "" - file_path = relative_file_path(file_path) - file_path = sanitize_slashes(file_path) - - [ - Gitlab.config.gitlab.relative_url_root, - @project.path_with_namespace, - path_with_ref(file_path), - file_path - ].compact.join("/").gsub(/\A\/*|\/*\z/, '') + id - end - - def sanitize_slashes(path) - path[0] = "" if path.start_with?("/") - path.chop if path.end_with?("/") - path - end - - def relative_file_path(path) - requested_path = @path - nested_path = build_nested_path(path, requested_path) - return nested_path if file_exists?(nested_path) - path - end - - # Covering a special case, when the link is referencing file in the same directory eg: - # If we are at doc/api/README.md and the README.md contains relative links like [Users](users.md) - # this takes the request path(doc/api/README.md), and replaces the README.md with users.md so the path looks like doc/api/users.md - # If we are at doc/api and the README.md shown in below the tree view - # this takes the request path(doc/api) and adds users.md so the path looks like doc/api/users.md - def build_nested_path(path, request_path) - return request_path if path == "" - return path unless request_path - if local_path(request_path) == "tree" - base = request_path.split("/").push(path) - base.join("/") - else - base = request_path.split("/") - base.pop - base.push(path).join("/") - end - end - - # Checks if the path exists in the repo - # eg. checks if doc/README.md exists, if not then link to blob - def path_with_ref(path) - if file_exists?(path) - "#{local_path(path)}/#{correct_ref}" - else - "blob/#{correct_ref}" - end - end - - def file_exists?(path) - return false if path.nil? - @repository.blob_at(current_sha, path).present? || @repository.tree(current_sha, path).entries.any? - end - - # Check if the path is pointing to a directory(tree) or a file(blob) - # eg. doc/api is directory and doc/README.md is file - def local_path(path) - return "tree" if @repository.tree(current_sha, path).entries.any? - return "raw" if @repository.blob_at(current_sha, path).image? - "blob" - end - - def current_sha - if @commit - @commit.id - elsif @repository && !@repository.empty? - if @ref - @repository.commit(@ref).try(:sha) - else - @repository.head_commit.sha - end - end - end - - # We will assume that if no ref exists we can point to master - def correct_ref - @ref ? @ref : "master" - end - - private - - # Return +text+, truncated to +max_chars+ characters, excluding any HTML - # tags. - def truncate_visible(text, max_chars) - doc = Nokogiri::HTML.fragment(text) - content_length = 0 - truncated = false - - doc.traverse do |node| - if node.text? || node.content.empty? - if truncated - node.remove - next - end - - # Handle line breaks within a node - if node.content.strip.lines.length > 1 - node.content = "#{node.content.lines.first.chomp}..." - truncated = true - end - - num_remaining = max_chars - content_length - if node.content.length > num_remaining - node.content = node.content.truncate(num_remaining) - truncated = true - end - content_length += node.content.length - end - - truncated = truncate_if_block(node, truncated) - end - - doc.to_html - end - - # Used by #truncate_visible. If +node+ is the first block element, and the - # text hasn't already been truncated, then append "..." to the node contents - # and return true. Otherwise return false. - def truncate_if_block(node, truncated) - if node.element? && node.description.block? && !truncated - node.content = "#{node.content}..." if node.next_sibling - true - else - truncated - end - end - - def cross_project_reference(project, entity) - path = project.path_with_namespace - - if entity.kind_of?(Issue) - [path, entity.iid].join('#') - elsif entity.kind_of?(MergeRequest) - [path, entity.iid].join('!') - else - raise 'Not supported type' - end - end -end diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb deleted file mode 100644 index 9703c8d9e9c..00000000000 --- a/app/helpers/gitlab_routing_helper.rb +++ /dev/null @@ -1,55 +0,0 @@ -# Shorter routing method for project and project items -# Since update to rails 4.1.9 we are now allowed to use `/` in project routing -# so we use nested routing for project resources which include project and -# project namespace. To avoid writing long methods every time we define shortcuts for -# some of routing. -# -# For example instead of this: -# -# namespace_project_merge_request_path(merge_request.project.namespace, merge_request.projects, merge_request) -# -# We can simply use shortcut: -# -# merge_request_path(merge_request) -# -module GitlabRoutingHelper - def project_path(project, *args) - namespace_project_path(project.namespace, project, *args) - end - - def edit_project_path(project, *args) - edit_namespace_project_path(project.namespace, project, *args) - end - - def issue_path(entity, *args) - namespace_project_issue_path(entity.project.namespace, entity.project, entity, *args) - end - - def merge_request_path(entity, *args) - namespace_project_merge_request_path(entity.project.namespace, entity.project, entity, *args) - end - - def milestone_path(entity, *args) - namespace_project_milestone_path(entity.project.namespace, entity.project, entity, *args) - end - - def project_url(project, *args) - namespace_project_url(project.namespace, project, *args) - end - - def edit_project_url(project, *args) - edit_namespace_project_url(project.namespace, project, *args) - end - - def issue_url(entity, *args) - namespace_project_issue_url(entity.project.namespace, entity.project, entity, *args) - end - - def merge_request_url(entity, *args) - namespace_project_merge_request_url(entity.project.namespace, entity.project, entity, *args) - end - - def project_snippet_url(entity, *args) - namespace_project_snippet_url(entity.project.namespace, entity.project, entity, *args) - end -end diff --git a/app/helpers/graph_helper.rb b/app/helpers/graph_helper.rb deleted file mode 100644 index e1dda20de85..00000000000 --- a/app/helpers/graph_helper.rb +++ /dev/null @@ -1,16 +0,0 @@ -module GraphHelper - def get_refs(repo, commit) - refs = "" - refs << commit.ref_names(repo).join(' ') - - # append note count - refs << "[#{@graph.notes[commit.id]}]" if @graph.notes[commit.id] > 0 - - refs - end - - def parents_zip_spaces(parents, parent_spaces) - ids = parents.map { |p| p.id } - ids.zip(parent_spaces) - end -end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb deleted file mode 100644 index add0a776a63..00000000000 --- a/app/helpers/groups_helper.rb +++ /dev/null @@ -1,59 +0,0 @@ -module GroupsHelper - def remove_user_from_group_message(group, member) - if member.user - "Are you sure you want to remove \"#{member.user.name}\" from \"#{group.name}\"?" - else - "Are you sure you want to revoke the invitation for \"#{member.invite_email}\" to join \"#{group.name}\"?" - end - end - - def leave_group_message(group) - "Are you sure you want to leave \"#{group}\" group?" - end - - def should_user_see_group_roles?(user, group) - if user - user.is_admin? || group.members.exists?(user_id: user.id) - else - false - end - end - - def group_head_title - title = @group.name - - title = if current_action?(:issues) - "Issues - " + title - elsif current_action?(:merge_requests) - "Merge requests - " + title - elsif current_action?(:members) - "Members - " + title - elsif current_action?(:edit) - "Settings - " + title - else - title - end - - title - end - - def group_settings_page? - if current_controller?('groups') - current_action?('edit') || current_action?('projects') - else - false - end - end - - def group_icon(group) - if group.is_a?(String) - group = Group.find_by(path: group) - end - - if group && group.avatar.present? - group.avatar.url - else - image_path('no_group_avatar.png') - end - end -end diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb deleted file mode 100644 index a9030729b48..00000000000 --- a/app/helpers/icons_helper.rb +++ /dev/null @@ -1,83 +0,0 @@ -module IconsHelper - # Creates an icon tag given icon name(s) and possible icon modifiers. - # - # Right now this method simply delegates directly to `fa_icon` from the - # font-awesome-rails gem, but should we ever use a different icon pack in the - # future we won't have to change hundreds of method calls. - def icon(names, options = {}) - fa_icon(names, options) - end - - def spinner(text = nil, visible = false) - css_class = 'loading' - css_class << ' hide' unless visible - - content_tag :div, class: css_class do - icon('spinner spin') + text - end - end - - def boolean_to_icon(value) - if value.to_s == "true" - icon('circle', class: 'cgreen') - else - icon('power-off', class: 'clgray') - end - end - - def public_icon - icon('globe') - end - - def internal_icon - icon('shield') - end - - def private_icon - icon('lock') - end - - def file_type_icon_class(type, mode, name) - if type == 'folder' - icon_class = 'folder' - elsif mode == '120000' - icon_class = 'share' - else - # Guess which icon to choose based on file extension. - # If you think a file extension is missing, feel free to add it on PR - - case File.extname(name).downcase - when '.pdf' - icon_class = 'file-pdf-o' - when '.jpg', '.jpeg', '.jif', '.jfif', - '.jp2', '.jpx', '.j2k', '.j2c', - '.png', '.gif', '.tif', '.tiff', - '.svg', '.ico', '.bmp' - icon_class = 'file-image-o' - when '.zip', '.zipx', '.tar', '.gz', '.bz', '.bzip', - '.xz', '.rar', '.7z' - icon_class = 'file-archive-o' - when '.mp3', '.wma', '.ogg', '.oga', '.wav', '.flac', '.aac' - icon_class = 'file-audio-o' - when '.mp4', '.m4p', '.m4v', - '.mpg', '.mp2', '.mpeg', '.mpe', '.mpv', - '.mpg', '.mpeg', '.m2v', - '.avi', '.mkv', '.flv', '.ogv', '.mov', - '.3gp', '.3g2' - icon_class = 'file-video-o' - when '.doc', '.dot', '.docx', '.docm', '.dotx', '.dotm', '.docb' - icon_class = 'file-word-o' - when '.xls', '.xlt', '.xlm', '.xlsx', '.xlsm', '.xltx', '.xltm', - '.xlsb', '.xla', '.xlam', '.xll', '.xlw' - icon_class = 'file-excel-o' - when '.ppt', '.pot', '.pps', '.pptx', '.pptm', '.potx', '.potm', - '.ppam', '.ppsx', '.ppsm', '.sldx', '.sldm' - icon_class = 'file-powerpoint-o' - else - icon_class = 'file-text-o' - end - end - - icon_class - end -end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb deleted file mode 100644 index ad4a7612724..00000000000 --- a/app/helpers/issues_helper.rb +++ /dev/null @@ -1,111 +0,0 @@ -module IssuesHelper - def issue_css_classes(issue) - classes = "issue" - classes << " closed" if issue.closed? - classes << " today" if issue.today? - classes - end - - # Returns an OpenStruct object suitable for use by <tt>options_from_collection_for_select</tt> - # to allow filtering issues by an unassigned User or Milestone - def unassigned_filter - # Milestone uses :title, Issue uses :name - OpenStruct.new(id: 0, title: 'None (backlog)', name: 'Unassigned') - end - - def url_for_project_issues(project = @project, options = {}) - return '' if project.nil? - - if options[:only_path] - project.issues_tracker.project_path - else - project.issues_tracker.project_url - end - end - - def url_for_new_issue(project = @project, options = {}) - return '' if project.nil? - - if options[:only_path] - project.issues_tracker.new_issue_path - else - project.issues_tracker.new_issue_url - end - end - - def url_for_issue(issue_iid, project = @project, options = {}) - return '' if project.nil? - - if options[:only_path] - project.issues_tracker.issue_path(issue_iid) - else - project.issues_tracker.issue_url(issue_iid) - end - end - - def title_for_issue(issue_iid, project = @project) - return '' if project.nil? - - if project.default_issues_tracker? - issue = project.issues.where(iid: issue_iid).first - return issue.title if issue - end - - '' - end - - def issue_timestamp(issue) - # Shows the created at time and the updated at time if different - ts = "#{time_ago_with_tooltip(issue.created_at, 'bottom', 'note_created_ago')}" - if issue.updated_at != issue.created_at - ts << capture_haml do - haml_tag :span do - haml_concat '·' - haml_concat icon('edit', title: 'edited') - haml_concat time_ago_with_tooltip(issue.updated_at, 'bottom', 'issue_edited_ago') - end - end - end - ts.html_safe - end - - def bulk_update_milestone_options - options_for_select([['None (backlog)', -1]]) + - options_from_collection_for_select(project_active_milestones, 'id', - 'title', params[:milestone_id]) - end - - def milestone_options(object) - options_from_collection_for_select(object.project.milestones.active, - 'id', 'title', object.milestone_id) - end - - def issue_box_class(item) - if item.respond_to?(:expired?) && item.expired? - 'issue-box-expired' - elsif item.respond_to?(:merged?) && item.merged? - 'issue-box-merged' - elsif item.closed? - 'issue-box-closed' - else - 'issue-box-open' - end - end - - def issue_to_atom(xml, issue) - xml.entry do - xml.id namespace_project_issue_url(issue.project.namespace, - issue.project, issue) - xml.link href: namespace_project_issue_url(issue.project.namespace, - issue.project, issue) - xml.title truncate(issue.title, length: 80) - xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") - xml.media :thumbnail, width: "40", height: "40", url: avatar_icon(issue.author_email) - xml.author do |author| - xml.name issue.author_name - xml.email issue.author_email - end - xml.summary issue.title - end - end -end diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb deleted file mode 100644 index 32ef2e7ca84..00000000000 --- a/app/helpers/labels_helper.rb +++ /dev/null @@ -1,54 +0,0 @@ -module LabelsHelper - def project_label_names - @project.labels.pluck(:title) - end - - def render_colored_label(label) - label_color = label.color || Label::DEFAULT_COLOR - text_color = text_color_for_bg(label_color) - - content_tag :span, class: 'label color-label', style: "background-color:#{label_color};color:#{text_color}" do - label.name - end - end - - def suggested_colors - [ - '#0033CC', - '#428BCA', - '#44AD8E', - '#A8D695', - '#5CB85C', - '#69D100', - '#004E00', - '#34495E', - '#7F8C8D', - '#A295D6', - '#5843AD', - '#8E44AD', - '#FFECDB', - '#AD4363', - '#D10069', - '#CC0033', - '#FF0000', - '#D9534F', - '#D1D100', - '#F0AD4E', - '#AD8D43' - ] - end - - def text_color_for_bg(bg_color) - r, g, b = bg_color.slice(1,7).scan(/.{2}/).map(&:hex) - - if (r + g + b) > 500 - "#333" - else - "#FFF" - end - end - - def project_labels_options(project) - options_from_collection_for_select(project.labels, 'name', 'name', params[:label_name]) - end -end diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb deleted file mode 100644 index 54462fd00e3..00000000000 --- a/app/helpers/merge_requests_helper.rb +++ /dev/null @@ -1,52 +0,0 @@ -module MergeRequestsHelper - def new_mr_path_from_push_event(event) - target_project = event.project.forked_from_project || event.project - new_namespace_project_merge_request_path( - event.project.namespace, - event.project, - new_mr_from_push_event(event, target_project) - ) - end - - def new_mr_path_for_fork_from_push_event(event) - new_namespace_project_merge_request_path( - event.project.namespace, - event.project, - new_mr_from_push_event(event, event.project.forked_from_project) - ) - end - - def new_mr_from_push_event(event, target_project) - { - merge_request: { - source_project_id: event.project.id, - target_project_id: target_project.id, - source_branch: event.branch_name, - target_branch: target_project.repository.root_ref - } - } - end - - def mr_css_classes(mr) - classes = "merge-request" - classes << " closed" if mr.closed? - classes << " merged" if mr.merged? - classes - end - - def ci_build_details_path(merge_request) - merge_request.source_project.ci_service.build_page(merge_request.last_commit.sha, merge_request.source_branch) - end - - def merge_path_description(merge_request, separator) - if merge_request.for_fork? - "Project:Branches: #{@merge_request.source_project_path}:#{@merge_request.source_branch} #{separator} #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}" - else - "Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}" - end - end - - def issues_sentence(issues) - issues.map { |i| "##{i.iid}" }.to_sentence - end -end diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb deleted file mode 100644 index 282bdf744d2..00000000000 --- a/app/helpers/milestones_helper.rb +++ /dev/null @@ -1,33 +0,0 @@ -module MilestonesHelper - def milestones_filter_path(opts = {}) - if @project - namespace_project_milestones_path(@project.namespace, @project, opts) - elsif @group - group_milestones_path(@group, opts) - else - dashboard_milestones_path(opts) - end - end - - def milestone_progress_bar(milestone) - options = { - class: 'progress-bar progress-bar-success', - style: "width: #{milestone.percent_complete}%;" - } - - content_tag :div, class: 'progress' do - content_tag :div, nil, options - end - end - - def projects_milestones_options - milestones = - if @project - @project.milestones - else - Milestone.where(project_id: @projects) - end.active - - options_from_collection_for_select(milestones, 'id', 'title', params[:milestone_id]) - end -end diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb deleted file mode 100644 index b3132a1f3ba..00000000000 --- a/app/helpers/namespaces_helper.rb +++ /dev/null @@ -1,36 +0,0 @@ -module NamespacesHelper - def namespaces_options(selected = :current_user, scope = :default) - groups = current_user.owned_groups + current_user.masters_groups - users = [current_user.namespace] - - group_opts = ["Groups", groups.sort_by(&:human_name).map {|g| [g.human_name, g.id]} ] - users_opts = [ "Users", users.sort_by(&:human_name).map {|u| [u.human_name, u.id]} ] - - options = [] - options << group_opts - options << users_opts - - if selected == :current_user && current_user.namespace - selected = current_user.namespace.id - end - - grouped_options_for_select(options, selected) - end - - def namespace_select_tag(id, opts = {}) - css_class = "ajax-namespace-select " - css_class << "multiselect " if opts[:multiple] - css_class << (opts[:class] || '') - value = opts[:selected] || '' - - hidden_field_tag(id, value, class: css_class) - end - - def namespace_icon(namespace, size = 40) - if namespace.kind_of?(Group) - group_icon(namespace) - else - avatar_icon(namespace.owner.email, size) - end - end -end diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb deleted file mode 100644 index 2b03269800e..00000000000 --- a/app/helpers/nav_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module NavHelper - def nav_menu_collapsed? - cookies[:collapsed_nav] == 'true' - end -end diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb deleted file mode 100644 index ab44fa6ee43..00000000000 --- a/app/helpers/notes_helper.rb +++ /dev/null @@ -1,85 +0,0 @@ -module NotesHelper - # Helps to distinguish e.g. commit notes in mr notes list - def note_for_main_target?(note) - (@noteable.class.name == note.noteable_type && !note.for_diff_line?) - end - - def note_target_fields(note) - hidden_field_tag(:target_type, note.noteable.class.name.underscore) + - hidden_field_tag(:target_id, note.noteable.id) - end - - def link_to_commit_diff_line_note(note) - if note.for_commit_diff_line? - link_to( - "#{note.diff_file_name}:L#{note.diff_new_line}", - namespace_project_commit_path(@project.namespace, @project, - note.noteable, anchor: note.line_code) - ) - end - end - - def note_timestamp(note) - # Shows the created at time and the updated at time if different - ts = "#{time_ago_with_tooltip(note.created_at, 'bottom', 'note_created_ago')}" - if note.updated_at != note.created_at - ts << capture_haml do - haml_tag :span do - haml_concat '·' - haml_concat icon('edit', title: 'edited') - haml_concat time_ago_with_tooltip(note.updated_at, 'bottom', 'note_edited_ago') - end - end - end - ts.html_safe - end - - def noteable_json(noteable) - { - id: noteable.id, - class: noteable.class.name, - resources: noteable.class.table_name, - project_id: noteable.project.id, - }.to_json - end - - def link_to_new_diff_note(line_code) - discussion_id = Note.build_discussion_id( - @comments_target[:noteable_type], - @comments_target[:noteable_id] || @comments_target[:commit_id], - line_code - ) - - data = { - noteable_type: @comments_target[:noteable_type], - noteable_id: @comments_target[:noteable_id], - commit_id: @comments_target[:commit_id], - line_code: line_code, - discussion_id: discussion_id - } - - button_tag(class: 'btn add-diff-note js-add-diff-note-button', - data: data, - title: 'Add a comment to this line') do - icon('comment-o') - end - end - - def link_to_reply_diff(note) - return unless current_user - - data = { - noteable_type: note.noteable_type, - noteable_id: note.noteable_id, - commit_id: note.commit_id, - line_code: note.line_code, - discussion_id: note.discussion_id - } - - button_tag class: 'btn reply-btn js-discussion-reply-button', - data: data, title: 'Add a reply' do - link_text = icon('comment') - link_text << ' Reply' - end - end -end diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb deleted file mode 100644 index f771fe761ef..00000000000 --- a/app/helpers/notifications_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -module NotificationsHelper - def notification_icon(notification) - if notification.disabled? - icon('volume-off', class: 'ns-mute') - elsif notification.participating? - icon('volume-down', class: 'ns-part') - elsif notification.watch? - icon('volume-up', class: 'ns-watch') - else - icon('circle-o', class: 'ns-default') - end - end -end diff --git a/app/helpers/oauth_helper.rb b/app/helpers/oauth_helper.rb deleted file mode 100644 index 997b91de077..00000000000 --- a/app/helpers/oauth_helper.rb +++ /dev/null @@ -1,34 +0,0 @@ -module OauthHelper - def ldap_enabled? - Gitlab.config.ldap.enabled - end - - def default_providers - [:twitter, :github, :gitlab, :bitbucket, :google_oauth2, :ldap] - end - - def enabled_oauth_providers - Devise.omniauth_providers - end - - def enabled_social_providers - enabled_oauth_providers.select do |name| - [:twitter, :gitlab, :github, :bitbucket, :google_oauth2].include?(name.to_sym) - end - end - - def additional_providers - enabled_oauth_providers.reject{|provider| provider.to_s.starts_with?('ldap')} - end - - def oauth_image_tag(provider, size = 64) - file_name = "#{provider.to_s.split('_').first}_#{size}.png" - image_tag(image_path("authbuttons/#{file_name}"), alt: "Sign in with #{provider.to_s.titleize}") - end - - def oauth_active?(provider) - current_user.identities.exists?(provider: provider.to_s) - end - - extend self -end diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb deleted file mode 100644 index 780c7cd5133..00000000000 --- a/app/helpers/profile_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -module ProfileHelper - def show_profile_username_tab? - current_user.can_change_username? - end - - def show_profile_social_tab? - enabled_social_providers.any? - end - - def show_profile_remove_tab? - signup_enabled? - end -end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb deleted file mode 100644 index c2a7732e6f0..00000000000 --- a/app/helpers/projects_helper.rb +++ /dev/null @@ -1,329 +0,0 @@ -module ProjectsHelper - def remove_from_project_team_message(project, member) - if member.user - "You are going to remove #{member.user.name} from #{project.name} project team. Are you sure?" - else - "You are going to revoke the invitation for #{member.invite_email} to join #{project.name} project team. Are you sure?" - end - end - - def link_to_project(project) - link_to [project.namespace.becomes(Namespace), project] do - title = content_tag(:span, project.name, class: 'project-name') - - if project.namespace - namespace = content_tag(:span, "#{project.namespace.human_name} / ", class: 'namespace-name') - title = namespace + title - end - - title - end - end - - def link_to_member(project, author, opts = {}) - default_opts = { avatar: true, name: true, size: 16 } - opts = default_opts.merge(opts) - - return "(deleted)" unless author - - author_html = "" - - # Build avatar image tag - author_html << image_tag(avatar_icon(author.try(:email), opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt:'') if opts[:avatar] - - # Build name span tag - author_html << content_tag(:span, sanitize(author.name), class: 'author') if opts[:name] - - author_html = author_html.html_safe - - if opts[:name] - link_to(author_html, user_path(author), class: "author_link").html_safe - else - link_to(author_html, user_path(author), class: "author_link has_tooltip", data: { :'original-title' => sanitize(author.name) } ).html_safe - end - end - - def project_title(project) - if project.group - content_tag :span do - link_to( - simple_sanitize(project.group.name), group_path(project.group) - ) + ' / ' + - link_to(simple_sanitize(project.name), - project_path(project)) - end - else - owner = project.namespace.owner - content_tag :span do - link_to( - simple_sanitize(owner.name), user_path(owner) - ) + ' / ' + - link_to(simple_sanitize(project.name), - project_path(project)) - end - end - end - - def remove_project_message(project) - "You are going to remove #{project.name_with_namespace}.\n Removed project CANNOT be restored!\n Are you ABSOLUTELY sure?" - end - - def transfer_project_message(project) - "You are going to transfer #{project.name_with_namespace} to another owner. Are you ABSOLUTELY sure?" - end - - def project_nav_tabs - @nav_tabs ||= get_project_nav_tabs(@project, current_user) - end - - def project_nav_tab?(name) - project_nav_tabs.include? name - end - - def project_active_milestones - @project.milestones.active.order("due_date, title ASC") - end - - def link_to_toggle_star(title, starred) - cls = 'star-btn btn btn-sm btn-default' - - toggle_text = - if starred - ' Unstar' - else - ' Star' - end - - toggle_html = content_tag('span', class: 'toggle') do - icon('star') + toggle_text - end - - count_html = content_tag('span', class: 'count') do - @project.star_count.to_s - end - - link_opts = { - title: title, - class: cls, - method: :post, - remote: true, - data: { type: 'json' } - } - - path = toggle_star_namespace_project_path(@project.namespace, @project) - - content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do - link_to(path, link_opts) do - toggle_html + ' ' + count_html - end - end - end - - def link_to_toggle_fork - html = content_tag('span') do - icon('code-fork') + ' Fork' - end - - count_html = content_tag(:span, class: 'count') do - @project.forks_count.to_s - end - - html + count_html - end - - def project_for_deploy_key(deploy_key) - if deploy_key.projects.include?(@project) - @project - else - deploy_key.projects.find { |project| can?(current_user, :read_project, project) } - end - end - - private - - def get_project_nav_tabs(project, current_user) - nav_tabs = [:home] - - if !project.empty_repo? && can?(current_user, :download_code, project) - nav_tabs << [:files, :commits, :network, :graphs] - end - - if project.repo_exists? && project.merge_requests_enabled - nav_tabs << :merge_requests - end - - if can?(current_user, :admin_project, project) - nav_tabs << :settings - end - - [:issues, :wiki, :snippets].each do |feature| - nav_tabs << feature if project.send :"#{feature}_enabled" - end - - if project.issues_enabled || project.merge_requests_enabled - nav_tabs << [:milestones, :labels] - end - - nav_tabs.flatten - end - - def git_user_name - if current_user - current_user.name - else - "Your name" - end - end - - def git_user_email - if current_user - current_user.email - else - "your@email.com" - end - end - - def repository_size(project = nil) - "#{(project || @project).repository_size} MB" - rescue - # In order to prevent 500 error - # when application cannot allocate memory - # to calculate repo size - just show 'Unknown' - 'unknown' - end - - def project_head_title - title = @project.name_with_namespace - - title = if current_controller?(:tree) - "#{@project.path}\/#{@path} at #{@ref} - " + title - elsif current_controller?(:issues) - if current_action?(:show) - "Issue ##{@issue.iid} - #{@issue.title} - " + title - else - "Issues - " + title - end - elsif current_controller?(:blob) - if current_action?(:new) || current_action?(:create) - "New file at #{@ref}" - elsif current_action?(:show) - "#{@blob.path} at #{@ref}" - elsif @blob - "Edit file #{@blob.path} at #{@ref}" - end - elsif current_controller?(:commits) - "Commits at #{@ref} - " + title - elsif current_controller?(:merge_requests) - if current_action?(:show) - "Merge request ##{@merge_request.iid} - " + title - else - "Merge requests - " + title - end - elsif current_controller?(:wikis) - "Wiki - " + title - elsif current_controller?(:network) - "Network graph - " + title - elsif current_controller?(:graphs) - "Graphs - " + title - else - title - end - - title - end - - def default_url_to_repo(project = nil) - project = project || @project - current_user ? project.url_to_repo : project.http_url_to_repo - end - - def default_clone_protocol - current_user ? "ssh" : "http" - end - - def project_last_activity(project) - if project.last_activity_at - time_ago_with_tooltip(project.last_activity_at, 'bottom', 'last_activity_time_ago') - else - "Never" - end - end - - def contribution_guide_url(project) - if project && contribution_guide = project.repository.contribution_guide - namespace_project_blob_path( - project.namespace, - project, - tree_join(project.default_branch, - contribution_guide.name) - ) - end - end - - def changelog_url(project) - if project && changelog = project.repository.changelog - namespace_project_blob_path( - project.namespace, - project, - tree_join(project.default_branch, - changelog.name) - ) - end - end - - def license_url(project) - if project && license = project.repository.license - namespace_project_blob_path( - project.namespace, - project, - tree_join(project.default_branch, - license.name) - ) - end - end - - def version_url(project) - if project && version = project.repository.version - namespace_project_blob_path( - project.namespace, - project, - tree_join(project.default_branch, - version.name) - ) - end - end - - def hidden_pass_url(original_url) - result = URI(original_url) - result.password = '*****' unless result.password.nil? - result - rescue - original_url - end - - def project_wiki_path_with_version(proj, page, version, is_newest) - url_params = is_newest ? {} : { version_id: version } - namespace_project_wiki_path(proj.namespace, proj, page, url_params) - end - - def project_status_css_class(status) - case status - when "started" - "active" - when "failed" - "danger" - when "finished" - "success" - end - end - - def service_field_value(type, value) - return value unless type == 'password' - - if value.present? - "***********" - else - nil - end - end -end diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb deleted file mode 100644 index c31a556ff7b..00000000000 --- a/app/helpers/search_helper.rb +++ /dev/null @@ -1,112 +0,0 @@ -module SearchHelper - def search_autocomplete_opts(term) - return unless current_user - - resources_results = [ - groups_autocomplete(term), - projects_autocomplete(term) - ].flatten - - generic_results = project_autocomplete + default_autocomplete + help_autocomplete - generic_results.select! { |result| result[:label] =~ Regexp.new(term, "i") } - - [ - resources_results, - generic_results - ].flatten.uniq do |item| - item[:label] - end - end - - private - - # Autocomplete results for various settings pages - def default_autocomplete - [ - { label: "Profile settings", url: profile_path }, - { label: "SSH Keys", url: profile_keys_path }, - { label: "Dashboard", url: root_path }, - { label: "Admin Section", url: admin_root_path }, - ] - end - - # Autocomplete results for internal help pages - def help_autocomplete - [ - { label: "help: API Help", url: help_page_path("api", "README") }, - { label: "help: Markdown Help", url: help_page_path("markdown", "markdown") }, - { label: "help: Permissions Help", url: help_page_path("permissions", "permissions") }, - { label: "help: Public Access Help", url: help_page_path("public_access", "public_access") }, - { label: "help: Rake Tasks Help", url: help_page_path("raketasks", "README") }, - { label: "help: SSH Keys Help", url: help_page_path("ssh", "README") }, - { label: "help: System Hooks Help", url: help_page_path("system_hooks", "system_hooks") }, - { label: "help: Web Hooks Help", url: help_page_path("web_hooks", "web_hooks") }, - { label: "help: Workflow Help", url: help_page_path("workflow", "README") }, - ] - end - - # Autocomplete results for the current project, if it's defined - def project_autocomplete - if @project && @project.repository.exists? && @project.repository.root_ref - prefix = search_result_sanitize(@project.name_with_namespace) - ref = @ref || @project.repository.root_ref - - [ - { label: "#{prefix} - Files", url: namespace_project_tree_path(@project.namespace, @project, ref) }, - { label: "#{prefix} - Commits", url: namespace_project_commits_path(@project.namespace, @project, ref) }, - { label: "#{prefix} - Network", url: namespace_project_network_path(@project.namespace, @project, ref) }, - { label: "#{prefix} - Graph", url: namespace_project_graph_path(@project.namespace, @project, ref) }, - { label: "#{prefix} - Issues", url: namespace_project_issues_path(@project.namespace, @project) }, - { label: "#{prefix} - Merge Requests", url: namespace_project_merge_requests_path(@project.namespace, @project) }, - { label: "#{prefix} - Milestones", url: namespace_project_milestones_path(@project.namespace, @project) }, - { label: "#{prefix} - Snippets", url: namespace_project_snippets_path(@project.namespace, @project) }, - { label: "#{prefix} - Members", url: namespace_project_project_members_path(@project.namespace, @project) }, - { label: "#{prefix} - Wiki", url: namespace_project_wikis_path(@project.namespace, @project) }, - ] - else - [] - end - end - - # Autocomplete results for the current user's groups - def groups_autocomplete(term, limit = 5) - current_user.authorized_groups.search(term).limit(limit).map do |group| - { - label: "group: #{search_result_sanitize(group.name)}", - url: group_path(group) - } - end - end - - # Autocomplete results for the current user's projects - def projects_autocomplete(term, limit = 5) - ProjectsFinder.new.execute(current_user).search_by_title(term). - sorted_by_stars.non_archived.limit(limit).map do |p| - { - label: "project: #{search_result_sanitize(p.name_with_namespace)}", - url: namespace_project_path(p.namespace, p) - } - end - end - - def search_result_sanitize(str) - Sanitize.clean(str) - end - - def search_filter_path(options={}) - exist_opts = { - search: params[:search], - project_id: params[:project_id], - group_id: params[:group_id], - scope: params[:scope] - } - - options = exist_opts.merge(options) - search_path(options) - end - - # Sanitize html generated after parsing markdown from issue description or comment - def search_md_sanitize(html) - sanitize(html, tags: %w(a p ol ul li pre code)) - end -end diff --git a/app/helpers/selects_helper.rb b/app/helpers/selects_helper.rb deleted file mode 100644 index bec8f2f1aa7..00000000000 --- a/app/helpers/selects_helper.rb +++ /dev/null @@ -1,42 +0,0 @@ -module SelectsHelper - def users_select_tag(id, opts = {}) - css_class = "ajax-users-select " - css_class << "multiselect " if opts[:multiple] - css_class << (opts[:class] || '') - value = opts[:selected] || '' - placeholder = opts[:placeholder] || 'Search for a user' - - null_user = opts[:null_user] || false - any_user = opts[:any_user] || false - email_user = opts[:email_user] || false - first_user = opts[:first_user] && current_user ? current_user.username : false - - html = { - class: css_class, - 'data-placeholder' => placeholder, - 'data-null-user' => null_user, - 'data-any-user' => any_user, - 'data-email-user' => email_user, - 'data-first-user' => first_user - } - - unless opts[:scope] == :all - if @project - html['data-project-id'] = @project.id - elsif @group - html['data-group-id'] = @group.id - end - end - - hidden_field_tag(id, value, html) - end - - def groups_select_tag(id, opts = {}) - css_class = "ajax-groups-select " - css_class << "multiselect " if opts[:multiple] - css_class << (opts[:class] || '') - value = opts[:selected] || '' - - hidden_field_tag(id, value, class: css_class) - end -end diff --git a/app/helpers/snippets_helper.rb b/app/helpers/snippets_helper.rb deleted file mode 100644 index 906cb12cd48..00000000000 --- a/app/helpers/snippets_helper.rb +++ /dev/null @@ -1,20 +0,0 @@ -module SnippetsHelper - def lifetime_select_options - options = [ - ['forever', nil], - ['1 day', "#{Date.current + 1.day}"], - ['1 week', "#{Date.current + 1.week}"], - ['1 month', "#{Date.current + 1.month}"] - ] - options_for_select(options) - end - - def reliable_snippet_path(snippet) - if snippet.project_id? - namespace_project_snippet_path(snippet.project.namespace, - snippet.project, snippet) - else - snippet_path(snippet) - end - end -end diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb deleted file mode 100644 index bb12d43f397..00000000000 --- a/app/helpers/sorting_helper.rb +++ /dev/null @@ -1,96 +0,0 @@ -module SortingHelper - def sort_options_hash - { - sort_value_name => sort_title_name, - sort_value_recently_updated => sort_title_recently_updated, - sort_value_oldest_updated => sort_title_oldest_updated, - sort_value_recently_created => sort_title_recently_created, - sort_value_oldest_created => sort_title_oldest_created, - sort_value_milestone_soon => sort_title_milestone_soon, - sort_value_milestone_later => sort_title_milestone_later, - sort_value_largest_repo => sort_title_largest_repo, - sort_value_recently_signin => sort_title_recently_signin, - sort_value_oldest_signin => sort_title_oldest_signin, - } - end - - def sort_title_oldest_updated - 'Oldest updated' - end - - def sort_title_recently_updated - 'Recently updated' - end - - def sort_title_oldest_created - 'Oldest created' - end - - def sort_title_recently_created - 'Recently created' - end - - def sort_title_milestone_soon - 'Milestone due soon' - end - - def sort_title_milestone_later - 'Milestone due later' - end - - def sort_title_name - 'Name' - end - - def sort_title_largest_repo - 'Largest repository' - end - - def sort_title_recently_signin - 'Recent sign in' - end - - def sort_title_oldest_signin - 'Oldest sign in' - end - - def sort_value_oldest_updated - 'updated_asc' - end - - def sort_value_recently_updated - 'updated_desc' - end - - def sort_value_oldest_created - 'created_asc' - end - - def sort_value_recently_created - 'created_desc' - end - - def sort_value_milestone_soon - 'milestone_due_asc' - end - - def sort_value_milestone_later - 'milestone_due_desc' - end - - def sort_value_name - 'name_asc' - end - - def sort_value_largest_repo - 'repository_size_desc' - end - - def sort_value_recently_signin - 'recent_sign_in' - end - - def sort_value_oldest_signin - 'oldest_sign_in' - end -end diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb deleted file mode 100644 index 9954617c762..00000000000 --- a/app/helpers/submodule_helper.rb +++ /dev/null @@ -1,74 +0,0 @@ -module SubmoduleHelper - include Gitlab::ShellAdapter - - # links to files listing for submodule if submodule is a project on this server - def submodule_links(submodule_item, ref = nil) - url = @repository.submodule_url_for(ref, submodule_item.path) - - return url, nil unless url =~ /([^\/:]+)\/([^\/]+\.git)\Z/ - - namespace = $1 - project = $2 - project.chomp!('.git') - - if self_url?(url, namespace, project) - return namespace_project_path(namespace, project), - namespace_project_tree_path(namespace, project, - submodule_item.id) - elsif relative_self_url?(url) - relative_self_links(url, submodule_item.id) - elsif github_dot_com_url?(url) - standard_links('github.com', namespace, project, submodule_item.id) - elsif gitlab_dot_com_url?(url) - standard_links('gitlab.com', namespace, project, submodule_item.id) - else - return url, nil - end - end - - protected - - def github_dot_com_url?(url) - url =~ /github\.com[\/:][^\/]+\/[^\/]+\Z/ - end - - def gitlab_dot_com_url?(url) - url =~ /gitlab\.com[\/:][^\/]+\/[^\/]+\Z/ - end - - def self_url?(url, namespace, project) - return true if url == [ Gitlab.config.gitlab.url, '/', namespace, '/', - project, '.git' ].join('') - url == gitlab_shell.url_to_repo([namespace, '/', project].join('')) - end - - def relative_self_url?(url) - # (./)?(../repo.git) || (./)?(../../project/repo.git) ) - url =~ /\A((\.\/)?(\.\.\/))(?!(\.\.)|(.*\/)).*\.git\z/ || url =~ /\A((\.\/)?(\.\.\/){2})(?!(\.\.))([^\/]*)\/(?!(\.\.)|(.*\/)).*\.git\z/ - end - - def standard_links(host, namespace, project, commit) - base = [ 'https://', host, '/', namespace, '/', project ].join('') - [base, [ base, '/tree/', commit ].join('')] - end - - def relative_self_links(url, commit) - # Map relative links to a namespace and project - # For example: - # ../bar.git -> same namespace, repo bar - # ../foo/bar.git -> namespace foo, repo bar - # ../../foo/bar/baz.git -> namespace bar, repo baz - components = url.split('/') - base = components.pop.gsub(/.git$/, '') - namespace = components.pop.gsub(/^\.\.$/, '') - - if namespace.empty? - namespace = @project.group.path - end - - [ - namespace_project_path(namespace, base), - namespace_project_tree_path(namespace, base, commit) - ] - end -end diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb deleted file mode 100644 index a1d263d9d3a..00000000000 --- a/app/helpers/tab_helper.rb +++ /dev/null @@ -1,123 +0,0 @@ -module TabHelper - # Navigation link helper - # - # Returns an `li` element with an 'active' class if the supplied - # controller(s) and/or action(s) are currently active. The content of the - # element is the value passed to the block. - # - # options - The options hash used to determine if the element is "active" (default: {}) - # :controller - One or more controller names to check (optional). - # :action - One or more action names to check (optional). - # :path - A shorthand path, such as 'dashboard#index', to check (optional). - # :html_options - Extra options to be passed to the list element (optional). - # block - An optional block that will become the contents of the returned - # `li` element. - # - # When both :controller and :action are specified, BOTH must match in order - # to be marked as active. When only one is given, either can match. - # - # Examples - # - # # Assuming we're on TreeController#show - # - # # Controller matches, but action doesn't - # nav_link(controller: [:tree, :refs], action: :edit) { "Hello" } - # # => '<li>Hello</li>' - # - # # Controller matches - # nav_link(controller: [:tree, :refs]) { "Hello" } - # # => '<li class="active">Hello</li>' - # - # # Several paths - # nav_link(path: ['tree#show', 'profile#show']) { "Hello" } - # # => '<li class="active">Hello</li>' - # - # # Shorthand path - # nav_link(path: 'tree#show') { "Hello" } - # # => '<li class="active">Hello</li>' - # - # # Supplying custom options for the list element - # nav_link(controller: :tree, html_options: {class: 'home'}) { "Hello" } - # # => '<li class="home active">Hello</li>' - # - # Returns a list item element String - def nav_link(options = {}, &block) - klass = active_nav_link?(options) ? 'active' : '' - - # Add our custom class into the html_options, which may or may not exist - # and which may or may not already have a :class key - o = options.delete(:html_options) || {} - o[:class] ||= '' - o[:class] += ' ' + klass - o[:class].strip! - - if block_given? - content_tag(:li, capture(&block), o) - else - content_tag(:li, nil, o) - end - end - - def active_nav_link?(options) - if path = options.delete(:path) - unless path.respond_to?(:each) - path = [path] - end - - path.any? do |single_path| - current_path?(single_path) - end - else - c = options.delete(:controller) - a = options.delete(:action) - - if c && a - # When given both options, make sure BOTH are true - current_controller?(*c) && current_action?(*a) - else - # Otherwise check EITHER option - current_controller?(*c) || current_action?(*a) - end - end - end - - def current_path?(path) - c, a, _ = path.split('#') - current_controller?(c) && current_action?(a) - end - - def project_tab_class - return "active" if current_page?(controller: "/projects", action: :edit, id: @project) - - if ['services', 'hooks', 'deploy_keys', 'project_members', 'protected_branches'].include? controller.controller_name - "active" - end - end - - def branches_tab_class - if current_controller?(:protected_branches) || - current_controller?(:branches) || - current_page?(namespace_project_repository_path(@project.namespace, - @project)) - 'active' - end - end - - # Use nav_tab for save controller/action but different params - def nav_tab(key, value, &block) - o = {} - o[:class] = "" - - if value.nil? - o[:class] << " active" if params[key].blank? - else - o[:class] << " active" if params[key] == value - end - - if block_given? - content_tag(:li, capture(&block), o) - else - content_tag(:li, nil, o) - end - end -end diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb deleted file mode 100644 index fb85544df2d..00000000000 --- a/app/helpers/tags_helper.rb +++ /dev/null @@ -1,14 +0,0 @@ -module TagsHelper - def tag_path(tag) - "/tags/#{tag}" - end - - def tag_list(project) - html = '' - project.tag_list.each do |tag| - html << link_to(tag, tag_path(tag)) - end - - html.html_safe - end -end diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb deleted file mode 100644 index 6dd9b6f017c..00000000000 --- a/app/helpers/tree_helper.rb +++ /dev/null @@ -1,94 +0,0 @@ -module TreeHelper - # Sorts a repository's tree so that folders are before files and renders - # their corresponding partials - # - # contents - A Grit::Tree object for the current tree - def render_tree(tree) - # Render Folders before Files/Submodules - folders, files, submodules = tree.trees, tree.blobs, tree.submodules - - tree = "" - - # Render folders if we have any - tree << render(partial: 'projects/tree/tree_item', collection: folders, - locals: { type: 'folder' }) if folders.present? - - # Render files if we have any - tree << render(partial: 'projects/tree/blob_item', collection: files, - locals: { type: 'file' }) if files.present? - - # Render submodules if we have any - tree << render(partial: 'projects/tree/submodule_item', - collection: submodules) if submodules.present? - - tree.html_safe - end - - def render_readme(readme) - if gitlab_markdown?(readme.name) - preserve(markdown(readme.data)) - elsif markup?(readme.name) - render_markup(readme.name, readme.data) - else - simple_format(readme.data) - end - end - - # Return an image icon depending on the file type and mode - # - # type - String type of the tree item; either 'folder' or 'file' - # mode - File unix mode - # name - File name - def tree_icon(type, mode, name) - icon("#{file_type_icon_class(type, mode, name)} fw") - end - - def tree_hex_class(content) - "file_#{hexdigest(content.name)}" - end - - # Simple shortcut to File.join - def tree_join(*args) - File.join(*args) - end - - def allowed_tree_edit?(project = nil, ref = nil) - project ||= @project - ref ||= @ref - return false unless project.repository.branch_names.include?(ref) - - ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref) - end - - def tree_breadcrumbs(tree, max_links = 2) - if @path.present? - part_path = "" - parts = @path.split('/') - - yield('..', nil) if parts.count > max_links - - parts.each do |part| - part_path = File.join(part_path, part) unless part_path.empty? - part_path = part if part_path.empty? - - next unless parts.last(2).include?(part) if parts.count > max_links - yield(part, tree_join(@ref, part_path)) - end - end - end - - def up_dir_path - file = File.join(@path, "..") - tree_join(@ref, file) - end - - # returns the relative path of the first subdir that doesn't have only one directory descendant - def flatten_tree(tree) - subtree = Gitlab::Git::Tree.where(@repository, @commit.id, tree.path) - if subtree.count == 1 && subtree.first.dir? - return tree_join(tree.name, flatten_tree(subtree.first)) - else - return tree.name - end - end -end diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb deleted file mode 100644 index 0d573e72a80..00000000000 --- a/app/helpers/visibility_level_helper.rb +++ /dev/null @@ -1,67 +0,0 @@ -module VisibilityLevelHelper - def visibility_level_color(level) - case level - when Gitlab::VisibilityLevel::PRIVATE - 'vs-private' - when Gitlab::VisibilityLevel::INTERNAL - 'vs-internal' - when Gitlab::VisibilityLevel::PUBLIC - 'vs-public' - end - end - - def visibility_level_description(level) - capture_haml do - haml_tag :span do - case level - when Gitlab::VisibilityLevel::PRIVATE - haml_concat "Project access must be granted explicitly for each user." - when Gitlab::VisibilityLevel::INTERNAL - haml_concat "The project can be cloned by" - haml_concat "any logged in user." - when Gitlab::VisibilityLevel::PUBLIC - haml_concat "The project can be cloned" - haml_concat "without any" - haml_concat "authentication." - end - end - end - end - - def snippet_visibility_level_description(level) - capture_haml do - haml_tag :span do - case level - when Gitlab::VisibilityLevel::PRIVATE - haml_concat "The snippet is visible only for me" - when Gitlab::VisibilityLevel::INTERNAL - haml_concat "The snippet is visible for any logged in user." - when Gitlab::VisibilityLevel::PUBLIC - haml_concat "The snippet can be accessed" - haml_concat "without any" - haml_concat "authentication." - end - end - end - end - - def visibility_level_icon(level) - case level - when Gitlab::VisibilityLevel::PRIVATE - private_icon - when Gitlab::VisibilityLevel::INTERNAL - internal_icon - when Gitlab::VisibilityLevel::PUBLIC - public_icon - end - end - - def visibility_level_label(level) - Project.visibility_levels.key(level) - end - - def restricted_visibility_levels(show_all = false) - return [] if current_user.is_admin? && !show_all - current_application_settings.restricted_visibility_levels || [] - end -end diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb deleted file mode 100644 index a3bc64c010e..00000000000 --- a/app/helpers/wiki_helper.rb +++ /dev/null @@ -1,22 +0,0 @@ -module WikiHelper - # Rails v4.1.9+ escapes all model IDs, converting slashes into %2F. The - # only way around this is to implement our own path generators. - def namespace_project_wiki_path(namespace, project, wiki_page, *args) - slug = - case wiki_page - when Symbol - wiki_page - else - wiki_page.slug - end - namespace_project_path(namespace, project) + "/wikis/#{slug}" - end - - def edit_namespace_project_wiki_path(namespace, project, wiki_page, *args) - namespace_project_wiki_path(namespace, project, wiki_page) + '/edit' - end - - def history_namespace_project_wiki_path(namespace, project, wiki_page, *args) - namespace_project_wiki_path(namespace, project, wiki_page) + '/history' - end -end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 --- a/app/mailers/.gitkeep +++ /dev/null diff --git a/app/mailers/emails/groups.rb b/app/mailers/emails/groups.rb deleted file mode 100644 index 1c43f95dc8c..00000000000 --- a/app/mailers/emails/groups.rb +++ /dev/null @@ -1,52 +0,0 @@ -module Emails - module Groups - def group_access_granted_email(group_member_id) - @group_member = GroupMember.find(group_member_id) - @group = @group_member.group - - @target_url = group_url(@group) - @current_user = @group_member.user - - mail(to: @group_member.user.notification_email, - subject: subject("Access to group was granted")) - end - - def group_member_invited_email(group_member_id, token) - @group_member = GroupMember.find group_member_id - @group = @group_member.group - @token = token - - @target_url = group_url(@group) - @current_user = @group_member.user - - mail(to: @group_member.invite_email, - subject: "Invitation to join group #{@group.name}") - end - - def group_invite_accepted_email(group_member_id) - @group_member = GroupMember.find group_member_id - return if @group_member.created_by.nil? - - @group = @group_member.group - - @target_url = group_url(@group) - @current_user = @group_member.created_by - - mail(to: @group_member.created_by.notification_email, - subject: subject("Invitation accepted")) - end - - def group_invite_declined_email(group_id, invite_email, access_level, created_by_id) - return if created_by_id.nil? - - @group = Group.find(group_id) - @current_user = @created_by = User.find(created_by_id) - @access_level = access_level - @invite_email = invite_email - - @target_url = group_url(@group) - mail(to: @created_by.notification_email, - subject: subject("Invitation declined")) - end - end -end diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb deleted file mode 100644 index 687bac3aa31..00000000000 --- a/app/mailers/emails/issues.rb +++ /dev/null @@ -1,47 +0,0 @@ -module Emails - module Issues - def new_issue_email(recipient_id, issue_id) - @issue = Issue.find(issue_id) - @project = @issue.project - @target_url = namespace_project_issue_url(@project.namespace, @project, @issue) - mail_new_thread(@issue, - from: sender(@issue.author_id), - to: recipient(recipient_id), - subject: subject("#{@issue.title} (##{@issue.iid})")) - end - - def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id, updated_by_user_id) - @issue = Issue.find(issue_id) - @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id - @project = @issue.project - @target_url = namespace_project_issue_url(@project.namespace, @project, @issue) - mail_answer_thread(@issue, - from: sender(updated_by_user_id), - to: recipient(recipient_id), - subject: subject("#{@issue.title} (##{@issue.iid})")) - end - - def closed_issue_email(recipient_id, issue_id, updated_by_user_id) - @issue = Issue.find issue_id - @project = @issue.project - @updated_by = User.find updated_by_user_id - @target_url = namespace_project_issue_url(@project.namespace, @project, @issue) - mail_answer_thread(@issue, - from: sender(updated_by_user_id), - to: recipient(recipient_id), - subject: subject("#{@issue.title} (##{@issue.iid})")) - end - - def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id) - @issue = Issue.find issue_id - @issue_status = status - @project = @issue.project - @updated_by = User.find updated_by_user_id - @target_url = namespace_project_issue_url(@project.namespace, @project, @issue) - mail_answer_thread(@issue, - from: sender(updated_by_user_id), - to: recipient(recipient_id), - subject: subject("#{@issue.title} (##{@issue.iid})")) - end - end -end diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb deleted file mode 100644 index 512a8f7ea6b..00000000000 --- a/app/mailers/emails/merge_requests.rb +++ /dev/null @@ -1,109 +0,0 @@ -module Emails - module MergeRequests - def new_merge_request_email(recipient_id, merge_request_id) - @merge_request = MergeRequest.find(merge_request_id) - @project = @merge_request.project - @target_url = namespace_project_merge_request_url(@project.namespace, - @project, - @merge_request) - mail_new_thread(@merge_request, - from: sender(@merge_request.author_id), - to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - end - - def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id, updated_by_user_id) - @merge_request = MergeRequest.find(merge_request_id) - @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id - @project = @merge_request.project - @target_url = namespace_project_merge_request_url(@project.namespace, - @project, - @merge_request) - mail_answer_thread(@merge_request, - from: sender(updated_by_user_id), - to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - end - - def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id) - @merge_request = MergeRequest.find(merge_request_id) - @updated_by = User.find updated_by_user_id - @project = @merge_request.project - @target_url = namespace_project_merge_request_url(@project.namespace, - @project, - @merge_request) - mail_answer_thread(@merge_request, - from: sender(updated_by_user_id), - to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - end - - def merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id) - @merge_request = MergeRequest.find(merge_request_id) - @project = @merge_request.project - @target_url = namespace_project_merge_request_url(@project.namespace, - @project, - @merge_request) - mail_answer_thread(@merge_request, - from: sender(updated_by_user_id), - to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - end - - def merge_request_status_email(recipient_id, merge_request_id, status, updated_by_user_id) - @merge_request = MergeRequest.find(merge_request_id) - @mr_status = status - @project = @merge_request.project - @updated_by = User.find updated_by_user_id - @target_url = namespace_project_merge_request_url(@project.namespace, - @project, - @merge_request) - set_reference("merge_request_#{merge_request_id}") - mail_answer_thread(@merge_request, - from: sender(updated_by_user_id), - to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (##{@merge_request.iid}) #{@mr_status}")) - end - end - - # Over rides default behaviour to show source/target - # Formats arguments into a String suitable for use as an email subject - # - # extra - Extra Strings to be inserted into the subject - # - # Examples - # - # >> subject('Lorem ipsum') - # => "GitLab Merge Request | Lorem ipsum" - # - # # Automatically inserts Project name: - # Forked MR - # => source project => <Project id: 1, name: "Ruby on Rails", path: "ruby_on_rails", ...> - # => target project => <Project id: 2, name: "My Ror", path: "ruby_on_rails", ...> - # => source branch => source - # => target branch => target - # >> subject('Lorem ipsum') - # => "GitLab Merge Request | Ruby on Rails:source >> My Ror:target | Lorem ipsum " - # - # Non Forked MR - # => source project => <Project id: 1, name: "Ruby on Rails", path: "ruby_on_rails", ...> - # => target project => <Project id: 1, name: "Ruby on Rails", path: "ruby_on_rails", ...> - # => source branch => source - # => target branch => target - # >> subject('Lorem ipsum') - # => "GitLab Merge Request | Ruby on Rails | source >> target | Lorem ipsum " - # # Accepts multiple arguments - # >> subject('Lorem ipsum', 'Dolor sit amet') - # => "GitLab Merge Request | Lorem ipsum | Dolor sit amet" - def subject(*extra) - subject = "Merge Request | " - if @merge_request.for_fork? - subject << "#{@merge_request.source_project.name_with_namespace}:#{merge_request.source_branch} >> #{@merge_request.target_project.name_with_namespace}:#{merge_request.target_branch}" - else - subject << "#{@merge_request.source_project.name_with_namespace} | #{merge_request.source_branch} >> #{merge_request.target_branch}" - end - subject << " | " + extra.join(' | ') if extra.present? - subject - end - -end diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb deleted file mode 100644 index ff251209e01..00000000000 --- a/app/mailers/emails/notes.rb +++ /dev/null @@ -1,43 +0,0 @@ -module Emails - module Notes - def note_commit_email(recipient_id, note_id) - @note = Note.find(note_id) - @commit = @note.noteable - @project = @note.project - @target_url = namespace_project_commit_url(@project.namespace, @project, - @commit, anchor: - "note_#{@note.id}") - mail_answer_thread(@commit, - from: sender(@note.author_id), - to: recipient(recipient_id), - subject: subject("#{@commit.title} (#{@commit.short_id})")) - end - - def note_issue_email(recipient_id, note_id) - @note = Note.find(note_id) - @issue = @note.noteable - @project = @note.project - @target_url = namespace_project_issue_url(@project.namespace, @project, - @issue, anchor: - "note_#{@note.id}") - mail_answer_thread(@issue, - from: sender(@note.author_id), - to: recipient(recipient_id), - subject: subject("#{@issue.title} (##{@issue.iid})")) - end - - def note_merge_request_email(recipient_id, note_id) - @note = Note.find(note_id) - @merge_request = @note.noteable - @project = @note.project - @target_url = namespace_project_merge_request_url(@project.namespace, - @project, - @merge_request, anchor: - "note_#{@note.id}") - mail_answer_thread(@merge_request, - from: sender(@note.author_id), - to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - end - end -end diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb deleted file mode 100644 index 3a83b083109..00000000000 --- a/app/mailers/emails/profile.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Emails - module Profile - def new_user_email(user_id, token = nil) - @current_user = @user = User.find(user_id) - @target_url = user_url(@user) - @token = token - mail(to: @user.notification_email, subject: subject("Account was created for you")) - end - - def new_email_email(email_id) - @email = Email.find(email_id) - @current_user = @user = @email.user - mail(to: @user.notification_email, subject: subject("Email was added to your account")) - end - - def new_ssh_key_email(key_id) - @key = Key.find(key_id) - @current_user = @user = @key.user - @target_url = user_url(@user) - mail(to: @user.notification_email, subject: subject("SSH key was added to your account")) - end - end -end diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb deleted file mode 100644 index 0dbb2939bb3..00000000000 --- a/app/mailers/emails/projects.rb +++ /dev/null @@ -1,141 +0,0 @@ -module Emails - module Projects - def project_access_granted_email(project_member_id) - @project_member = ProjectMember.find project_member_id - @project = @project_member.project - - @target_url = namespace_project_url(@project.namespace, @project) - @current_user = @project_member.user - - mail(to: @project_member.user.notification_email, - subject: subject("Access to project was granted")) - end - - def project_member_invited_email(project_member_id, token) - @project_member = ProjectMember.find project_member_id - @project = @project_member.project - @token = token - - @target_url = namespace_project_url(@project.namespace, @project) - @current_user = @project_member.user - - mail(to: @project_member.invite_email, - subject: "Invitation to join project #{@project.name_with_namespace}") - end - - def project_invite_accepted_email(project_member_id) - @project_member = ProjectMember.find project_member_id - return if @project_member.created_by.nil? - - @project = @project_member.project - - @target_url = namespace_project_url(@project.namespace, @project) - @current_user = @project_member.created_by - - mail(to: @project_member.created_by.notification_email, - subject: subject("Invitation accepted")) - end - - def project_invite_declined_email(project_id, invite_email, access_level, created_by_id) - return if created_by_id.nil? - - @project = Project.find(project_id) - @current_user = @created_by = User.find(created_by_id) - @access_level = access_level - @invite_email = invite_email - - @target_url = namespace_project_url(@project.namespace, @project) - - mail(to: @created_by.notification_email, - subject: subject("Invitation declined")) - end - - def project_was_moved_email(project_id, user_id) - @current_user = @user = User.find user_id - @project = Project.find project_id - @target_url = namespace_project_url(@project.namespace, @project) - mail(to: @user.notification_email, - subject: subject("Project was moved")) - end - - def repository_push_email(project_id, recipient, author_id: nil, - ref: nil, - action: nil, - compare: nil, - reverse_compare: false, - send_from_committer_email: false, - disable_diffs: false) - unless author_id && ref && action - raise ArgumentError, "missing keywords: author_id, ref, action" - end - - @project = Project.find(project_id) - @current_user = @author = User.find(author_id) - @reverse_compare = reverse_compare - @compare = compare - @ref_name = Gitlab::Git.ref_name(ref) - @ref_type = Gitlab::Git.tag_ref?(ref) ? "tag" : "branch" - @action = action - @disable_diffs = disable_diffs - - if @compare - @commits = Commit.decorate(compare.commits) - @diffs = compare.diffs - end - - @action_name = - case action - when :create - "pushed new" - when :delete - "deleted" - else - "pushed to" - end - - @subject = "[#{@project.path_with_namespace}]" - @subject << "[#{@ref_name}]" if action == :push - @subject << " " - - if action == :push - if @commits.length > 1 - @target_url = namespace_project_compare_url(@project.namespace, - @project, - from: Commit.new(@compare.base), - to: Commit.new(@compare.head)) - @subject << "Deleted " if @reverse_compare - @subject << "#{@commits.length} commits: #{@commits.first.title}" - else - @target_url = namespace_project_commit_url(@project.namespace, - @project, @commits.first) - - @subject << "Deleted 1 commit: " if @reverse_compare - @subject << @commits.first.title - end - else - unless action == :delete - @target_url = namespace_project_tree_url(@project.namespace, - @project, @ref_name) - end - - subject_action = @action_name.dup - subject_action[0] = subject_action[0].capitalize - @subject << "#{subject_action} #{@ref_type} #{@ref_name}" - end - - @disable_footer = true - - reply_to = - if send_from_committer_email && can_send_from_user_email?(@author) - @author.email - else - Gitlab.config.gitlab.email_reply_to - end - - mail(from: sender(author_id, send_from_committer_email), - reply_to: reply_to, - to: recipient, - subject: @subject) - end - end -end diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb deleted file mode 100644 index 2c0d451511f..00000000000 --- a/app/mailers/notify.rb +++ /dev/null @@ -1,167 +0,0 @@ -class Notify < ActionMailer::Base - include ActionDispatch::Routing::PolymorphicRoutes - - include Emails::Issues - include Emails::MergeRequests - include Emails::Notes - include Emails::Projects - include Emails::Profile - include Emails::Groups - - add_template_helper ApplicationHelper - add_template_helper GitlabMarkdownHelper - add_template_helper MergeRequestsHelper - add_template_helper EmailsHelper - - attr_accessor :current_user - helper_method :current_user, :can? - - default_url_options[:host] = Gitlab.config.gitlab.host - default_url_options[:protocol] = Gitlab.config.gitlab.protocol - default_url_options[:port] = Gitlab.config.gitlab.port unless Gitlab.config.gitlab_on_standard_port? - default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root - - default from: Proc.new { default_sender_address.format } - default reply_to: Gitlab.config.gitlab.email_reply_to - - # Just send email with 2 seconds delay - def self.delay - delay_for(2.seconds) - end - - def test_email(recipient_email, subject, body) - mail(to: recipient_email, - subject: subject, - body: body.html_safe, - content_type: 'text/html' - ) - end - - # Splits "gitlab.corp.company.com" up into "gitlab.corp.company.com", - # "corp.company.com" and "company.com". - # Respects set tld length so "company.co.uk" won't match "somethingelse.uk" - def self.allowed_email_domains - domain_parts = Gitlab.config.gitlab.host.split(".") - allowed_domains = [] - begin - allowed_domains << domain_parts.join(".") - domain_parts.shift - end while domain_parts.length > ActionDispatch::Http::URL.tld_length - - allowed_domains - end - - private - - # The default email address to send emails from - def default_sender_address - address = Mail::Address.new(Gitlab.config.gitlab.email_from) - address.display_name = Gitlab.config.gitlab.email_display_name - address - end - - def can_send_from_user_email?(sender) - sender_domain = sender.email.split("@").last - self.class.allowed_email_domains.include?(sender_domain) - end - - # Return an email address that displays the name of the sender. - # Only the displayed name changes; the actual email address is always the same. - def sender(sender_id, send_from_user_email = false) - return unless sender = User.find(sender_id) - - address = default_sender_address - address.display_name = sender.name - - if send_from_user_email && can_send_from_user_email?(sender) - address.address = sender.email - end - - address.format - end - - # Look up a User by their ID and return their email address - # - # recipient_id - User ID - # - # Returns a String containing the User's email address. - def recipient(recipient_id) - @current_user = User.find(recipient_id) - @current_user.notification_email - end - - # Set the References header field - # - # local_part - The local part of the referenced message ID - # - def set_reference(local_part) - headers["References"] = "<#{local_part}@#{Gitlab.config.gitlab.host}>" - end - - # Formats arguments into a String suitable for use as an email subject - # - # extra - Extra Strings to be inserted into the subject - # - # Examples - # - # >> subject('Lorem ipsum') - # => "Lorem ipsum" - # - # # Automatically inserts Project name when @project is set - # >> @project = Project.last - # => #<Project id: 1, name: "Ruby on Rails", path: "ruby_on_rails", ...> - # >> subject('Lorem ipsum') - # => "Ruby on Rails | Lorem ipsum " - # - # # Accepts multiple arguments - # >> subject('Lorem ipsum', 'Dolor sit amet') - # => "Lorem ipsum | Dolor sit amet" - def subject(*extra) - subject = "" - subject << "#{@project.name} | " if @project - subject << extra.join(' | ') if extra.present? - subject - end - - # Return a string suitable for inclusion in the 'Message-Id' mail header. - # - # The message-id is generated from the unique URL to a model object. - def message_id(model) - model_name = model.class.model_name.singular_route_key - "<#{model_name}_#{model.id}@#{Gitlab.config.gitlab.host}>" - end - - # Send an email that starts a new conversation thread, - # with headers suitable for grouping by thread in email clients. - # - # See: mail_answer_thread - def mail_new_thread(model, headers = {}, &block) - headers['Message-ID'] = message_id(model) - headers['X-GitLab-Project'] = "#{@project.name} | " if @project - mail(headers, &block) - end - - # Send an email that responds to an existing conversation thread, - # with headers suitable for grouping by thread in email clients. - # - # For grouping emails by thread, email clients heuristics require the answers to: - # - # * have a subject that begin by 'Re: ' - # * have a 'In-Reply-To' or 'References' header that references the original 'Message-ID' - # - def mail_answer_thread(model, headers = {}, &block) - headers['In-Reply-To'] = message_id(model) - headers['References'] = message_id(model) - headers['X-GitLab-Project'] = "#{@project.name} | " if @project - - if headers[:subject] - headers[:subject].prepend('Re: ') - end - - mail(headers, &block) - end - - def can? - Ability.abilities.allowed?(user, action, subject) - end -end diff --git a/app/models/.gitkeep b/app/models/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 --- a/app/models/.gitkeep +++ /dev/null diff --git a/app/models/ability.rb b/app/models/ability.rb deleted file mode 100644 index 85a15596f8d..00000000000 --- a/app/models/ability.rb +++ /dev/null @@ -1,276 +0,0 @@ -class Ability - class << self - def allowed(user, subject) - return not_auth_abilities(user, subject) if user.nil? - return [] unless user.kind_of?(User) - return [] if user.blocked? - - case subject.class.name - when "Project" then project_abilities(user, subject) - when "Issue" then issue_abilities(user, subject) - when "Note" then note_abilities(user, subject) - when "ProjectSnippet" then project_snippet_abilities(user, subject) - when "PersonalSnippet" then personal_snippet_abilities(user, subject) - when "MergeRequest" then merge_request_abilities(user, subject) - when "Group" then group_abilities(user, subject) - when "Namespace" then namespace_abilities(user, subject) - when "GroupMember" then group_member_abilities(user, subject) - else [] - end.concat(global_abilities(user)) - end - - # List of possible abilities - # for non-authenticated user - def not_auth_abilities(user, subject) - project = if subject.kind_of?(Project) - subject - elsif subject.respond_to?(:project) - subject.project - else - nil - end - - if project && project.public? - [ - :read_project, - :read_wiki, - :read_issue, - :read_milestone, - :read_project_snippet, - :read_project_member, - :read_merge_request, - :read_note, - :download_code - ] - else - group = if subject.kind_of?(Group) - subject - elsif subject.respond_to?(:group) - subject.group - else - nil - end - - if group && group.public_profile? - [:read_group] - else - [] - end - end - end - - def global_abilities(user) - rules = [] - rules << :create_group if user.can_create_group - rules - end - - def project_abilities(user, project) - rules = [] - key = "/user/#{user.id}/project/#{project.id}" - RequestStore.store[key] ||= begin - team = project.team - - # Rules based on role in project - if team.master?(user) - rules.push(*project_master_rules) - - elsif team.developer?(user) - rules.push(*project_dev_rules) - - elsif team.reporter?(user) - rules.push(*project_report_rules) - - elsif team.guest?(user) - rules.push(*project_guest_rules) - end - - if project.public? || project.internal? - rules.push(*public_project_rules) - end - - if project.owner == user || user.admin? - rules.push(*project_admin_rules) - end - - if project.group && project.group.has_owner?(user) - rules.push(*project_admin_rules) - end - - if project.archived? - rules -= project_archived_rules - end - - rules - end - end - - def public_project_rules - project_guest_rules + [ - :download_code, - :fork_project - ] - end - - def project_guest_rules - [ - :read_project, - :read_wiki, - :read_issue, - :read_milestone, - :read_project_snippet, - :read_project_member, - :read_merge_request, - :read_note, - :write_project, - :write_issue, - :write_note - ] - end - - def project_report_rules - project_guest_rules + [ - :download_code, - :fork_project, - :write_project_snippet - ] - end - - def project_dev_rules - project_report_rules + [ - :write_merge_request, - :write_wiki, - :modify_issue, - :admin_issue, - :admin_label, - :push_code - ] - end - - def project_archived_rules - [ - :write_merge_request, - :push_code, - :push_code_to_protected_branches, - :modify_merge_request, - :admin_merge_request - ] - end - - def project_master_rules - project_dev_rules + [ - :push_code_to_protected_branches, - :modify_issue, - :modify_project_snippet, - :modify_merge_request, - :admin_issue, - :admin_milestone, - :admin_project_snippet, - :admin_project_member, - :admin_merge_request, - :admin_note, - :admin_wiki, - :admin_project - ] - end - - def project_admin_rules - project_master_rules + [ - :change_namespace, - :change_visibility_level, - :rename_project, - :remove_project, - :archive_project - ] - end - - def group_abilities(user, group) - rules = [] - - if user.admin? || group.users.include?(user) || ProjectsFinder.new.execute(user, group: group).any? - rules << :read_group - end - - # Only group masters and group owners can create new projects in group - if group.has_master?(user) || group.has_owner?(user) || user.admin? - rules.push(*[ - :create_projects, - ]) - end - - # Only group owner and administrators can admin group - if group.has_owner?(user) || user.admin? - rules.push(*[ - :admin_group, - :admin_namespace - ]) - end - - rules.flatten - end - - def namespace_abilities(user, namespace) - rules = [] - - # Only namespace owner and administrators can admin it - if namespace.owner == user || user.admin? - rules.push(*[ - :create_projects, - :admin_namespace - ]) - end - - rules.flatten - end - - [:issue, :note, :project_snippet, :personal_snippet, :merge_request].each do |name| - define_method "#{name}_abilities" do |user, subject| - if subject.author == user || user.is_admin? - rules = [ - :"read_#{name}", - :"write_#{name}", - :"modify_#{name}", - :"admin_#{name}" - ] - rules.push(:change_visibility_level) if subject.is_a?(Snippet) - rules - elsif subject.respond_to?(:assignee) && subject.assignee == user - [ - :"read_#{name}", - :"write_#{name}", - :"modify_#{name}", - ] - else - if subject.respond_to?(:project) - project_abilities(user, subject.project) - else - [] - end - end - end - end - - def group_member_abilities(user, subject) - rules = [] - target_user = subject.user - group = subject.group - can_manage = group_abilities(user, group).include?(:admin_group) - if can_manage && (user != target_user) - rules << :modify_group_member - rules << :destroy_group_member - end - if !group.last_owner?(user) && (can_manage || (user == target_user)) - rules << :destroy_group_member - end - rules - end - - def abilities - @abilities ||= begin - abilities = Six.new - abilities << self - abilities - end - end - end -end diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb deleted file mode 100644 index 0d8365c4ff2..00000000000 --- a/app/models/application_setting.rb +++ /dev/null @@ -1,61 +0,0 @@ -# == Schema Information -# -# Table name: application_settings -# -# id :integer not null, primary key -# default_projects_limit :integer -# default_branch_protection :integer -# signup_enabled :boolean -# signin_enabled :boolean -# gravatar_enabled :boolean -# twitter_sharing_enabled :boolean -# sign_in_text :text -# created_at :datetime -# updated_at :datetime -# home_page_url :string(255) -# default_branch_protection :integer default(2) -# twitter_sharing_enabled :boolean default(TRUE) -# restricted_visibility_levels :text -# max_attachment_size :integer default(10) -# - -class ApplicationSetting < ActiveRecord::Base - serialize :restricted_visibility_levels - - validates :home_page_url, - allow_blank: true, - format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" }, - if: :home_page_url_column_exist - - validates_each :restricted_visibility_levels do |record, attr, value| - unless value.nil? - value.each do |level| - unless Gitlab::VisibilityLevel.options.has_value?(level) - record.errors.add(attr, "'#{level}' is not a valid visibility level") - end - end - end - end - - def self.current - ApplicationSetting.last - end - - def self.create_from_defaults - create( - default_projects_limit: Settings.gitlab['default_projects_limit'], - default_branch_protection: Settings.gitlab['default_branch_protection'], - signup_enabled: Settings.gitlab['signup_enabled'], - signin_enabled: Settings.gitlab['signin_enabled'], - twitter_sharing_enabled: Settings.gitlab['twitter_sharing_enabled'], - gravatar_enabled: Settings.gravatar['enabled'], - sign_in_text: Settings.extra['sign_in_text'], - restricted_visibility_levels: Settings.gitlab['restricted_visibility_levels'], - max_attachment_size: Settings.gitlab['max_attachment_size'] - ) - end - - def home_page_url_column_exist - ActiveRecord::Base.connection.column_exists?(:application_settings, :home_page_url) - end -end diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb deleted file mode 100644 index 05f5e979695..00000000000 --- a/app/models/broadcast_message.rb +++ /dev/null @@ -1,29 +0,0 @@ -# == Schema Information -# -# Table name: broadcast_messages -# -# id :integer not null, primary key -# message :text not null -# starts_at :datetime -# ends_at :datetime -# alert_type :integer -# created_at :datetime -# updated_at :datetime -# color :string(255) -# font :string(255) -# - -class BroadcastMessage < ActiveRecord::Base - include Sortable - - validates :message, presence: true - validates :starts_at, presence: true - validates :ends_at, presence: true - - validates :color, format: { with: /\A\#[0-9A-Fa-f]{3}{1,2}+\Z/ }, allow_blank: true - validates :font, format: { with: /\A\#[0-9A-Fa-f]{3}{1,2}+\Z/ }, allow_blank: true - - def self.current - where("ends_at > :now AND starts_at < :now", now: Time.zone.now).last - end -end diff --git a/app/models/commit.rb b/app/models/commit.rb deleted file mode 100644 index 006fa62c8f9..00000000000 --- a/app/models/commit.rb +++ /dev/null @@ -1,155 +0,0 @@ -class Commit - include ActiveModel::Conversion - include StaticModel - extend ActiveModel::Naming - include Mentionable - - attr_mentionable :safe_message - - # Safe amount of changes (files and lines) in one commit to render - # Used to prevent 500 error on huge commits by suppressing diff - # - # User can force display of diff above this size - DIFF_SAFE_FILES = 100 unless defined?(DIFF_SAFE_FILES) - DIFF_SAFE_LINES = 5000 unless defined?(DIFF_SAFE_LINES) - - # Commits above this size will not be rendered in HTML - DIFF_HARD_LIMIT_FILES = 1000 unless defined?(DIFF_HARD_LIMIT_FILES) - DIFF_HARD_LIMIT_LINES = 50000 unless defined?(DIFF_HARD_LIMIT_LINES) - - class << self - def decorate(commits) - commits.map do |commit| - if commit.kind_of?(Commit) - commit - else - self.new(commit) - end - end - end - - # Calculate number of lines to render for diffs - def diff_line_count(diffs) - diffs.reduce(0) { |sum, d| sum + d.diff.lines.count } - end - - # Truncate sha to 8 characters - def truncate_sha(sha) - sha[0..7] - end - end - - attr_accessor :raw - - def initialize(raw_commit) - raise "Nil as raw commit passed" unless raw_commit - - @raw = raw_commit - end - - def id - @raw.id - end - - def diff_line_count - @diff_line_count ||= Commit::diff_line_count(self.diffs) - @diff_line_count - end - - # Returns a string describing the commit for use in a link title - # - # Example - # - # "Commit: Alex Denisov - Project git clone panel" - def link_title - "Commit: #{author_name} - #{title}" - end - - # Returns the commits title. - # - # Usually, the commit title is the first line of the commit message. - # In case this first line is longer than 100 characters, it is cut off - # after 80 characters and ellipses (`&hellp;`) are appended. - def title - title = safe_message - - return no_commit_message if title.blank? - - title_end = title.index("\n") - if (!title_end && title.length > 100) || (title_end && title_end > 100) - title[0..79] << "…" - else - title.split("\n", 2).first - end - end - - # Returns the commits description - # - # cut off, ellipses (`&hellp;`) are prepended to the commit message. - def description - title_end = safe_message.index("\n") - @description ||= - if (!title_end && safe_message.length > 100) || (title_end && title_end > 100) - "…" << safe_message[80..-1] - else - safe_message.split("\n", 2)[1].try(:chomp) - end - end - - def description? - description.present? - end - - def hook_attrs(project) - path_with_namespace = project.path_with_namespace - - { - id: id, - message: safe_message, - timestamp: committed_date.xmlschema, - url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{id}", - author: { - name: author_name, - email: author_email - } - } - end - - # Discover issues should be closed when this commit is pushed to a project's - # default branch. - def closes_issues(project, current_user = self.committer) - Gitlab::ClosingIssueExtractor.new(project, current_user).closed_by_message(safe_message) - end - - # Mentionable override. - def gfm_reference - "commit #{id}" - end - - def author - User.find_for_commit(author_email, author_name) - end - - def committer - User.find_for_commit(committer_email, committer_name) - end - - def method_missing(m, *args, &block) - @raw.send(m, *args, &block) - end - - def respond_to?(method) - return true if @raw.respond_to?(method) - - super - end - - # Truncate sha to 8 characters - def short_id - @raw.short_id(7) - end - - def parents - @parents ||= Commit.decorate(super) - end -end diff --git a/app/models/concerns/internal_id.rb b/app/models/concerns/internal_id.rb deleted file mode 100644 index 821ed54fb98..00000000000 --- a/app/models/concerns/internal_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -module InternalId - extend ActiveSupport::Concern - - included do - validate :set_iid, on: :create - validates :iid, presence: true, numericality: true - end - - def set_iid - max_iid = project.send(self.class.name.tableize).maximum(:iid) - self.iid = max_iid.to_i + 1 - end - - def to_param - iid.to_s - end -end diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb deleted file mode 100644 index 478134dff68..00000000000 --- a/app/models/concerns/issuable.rb +++ /dev/null @@ -1,189 +0,0 @@ -# == Issuable concern -# -# Contains common functionality shared between Issues and MergeRequests -# -# Used by Issue, MergeRequest -# -module Issuable - extend ActiveSupport::Concern - include Mentionable - - included do - belongs_to :author, class_name: "User" - belongs_to :assignee, class_name: "User" - belongs_to :milestone - has_many :notes, as: :noteable, dependent: :destroy - has_many :label_links, as: :target, dependent: :destroy - has_many :labels, through: :label_links - has_many :subscriptions, dependent: :destroy, as: :subscribable - - validates :author, presence: true - validates :title, presence: true, length: { within: 0..255 } - - scope :authored, ->(user) { where(author_id: user) } - scope :assigned_to, ->(u) { where(assignee_id: u.id)} - scope :recent, -> { order("created_at DESC") } - scope :assigned, -> { where("assignee_id IS NOT NULL") } - scope :unassigned, -> { where("assignee_id IS NULL") } - scope :of_projects, ->(ids) { where(project_id: ids) } - scope :opened, -> { with_state(:opened, :reopened) } - scope :only_opened, -> { with_state(:opened) } - scope :only_reopened, -> { with_state(:reopened) } - scope :closed, -> { with_state(:closed) } - scope :order_milestone_due_desc, -> { joins(:milestone).reorder('milestones.due_date DESC, milestones.id DESC') } - scope :order_milestone_due_asc, -> { joins(:milestone).reorder('milestones.due_date ASC, milestones.id ASC') } - - delegate :name, - :email, - to: :author, - prefix: true - - delegate :name, - :email, - to: :assignee, - allow_nil: true, - prefix: true - - attr_mentionable :title, :description - end - - module ClassMethods - def search(query) - where("LOWER(title) like :query", query: "%#{query.downcase}%") - end - - def full_search(query) - where("LOWER(title) like :query OR LOWER(description) like :query", query: "%#{query.downcase}%") - end - - def sort(method) - case method.to_s - when 'milestone_due_asc' then order_milestone_due_asc - when 'milestone_due_desc' then order_milestone_due_desc - else - order_by(method) - end - end - end - - def today? - Date.today == created_at.to_date - end - - def new? - today? && created_at == updated_at - end - - def is_assigned? - !!assignee_id - end - - def is_being_reassigned? - assignee_id_changed? - end - - # - # Votes - # - - # Return the number of -1 comments (downvotes) - def downvotes - filter_superceded_votes(notes.select(&:downvote?), notes).size - end - - def downvotes_in_percent - if votes_count.zero? - 0 - else - 100.0 - upvotes_in_percent - end - end - - # Return the number of +1 comments (upvotes) - def upvotes - filter_superceded_votes(notes.select(&:upvote?), notes).size - end - - def upvotes_in_percent - if votes_count.zero? - 0 - else - 100.0 / votes_count * upvotes - end - end - - # Return the total number of votes - def votes_count - upvotes + downvotes - end - - # Return all users participating on the discussion - def participants(current_user = self.author) - users = [] - users << author - users << assignee if is_assigned? - mentions = [] - mentions << self.mentioned_users(current_user) - - notes.each do |note| - users << note.author - mentions << note.mentioned_users(current_user) - end - - users.concat(mentions.reduce([], :|)).uniq - end - - def subscribed?(user) - subscription = subscriptions.find_by_user_id(user.id) - - if subscription - return subscription.subscribed - end - - participants(user).include?(user) - end - - def toggle_subscription(user) - subscriptions. - find_or_initialize_by(user_id: user.id). - update(subscribed: !subscribed?(user)) - end - - def to_hook_data(user) - { - object_kind: self.class.name.underscore, - user: user.hook_attrs, - object_attributes: hook_attrs - } - end - - def label_names - labels.order('title ASC').pluck(:title) - end - - def remove_labels - labels.delete_all - end - - def add_labels_by_names(label_names) - label_names.each do |label_name| - label = project.labels.create_with(color: Label::DEFAULT_COLOR). - find_or_create_by(title: label_name.strip) - self.labels << label - end - end - - private - - def filter_superceded_votes(votes, notes) - filteredvotes = [] + votes - - votes.each do |vote| - if vote.superceded?(notes) - filteredvotes.delete(vote) - end - end - - filteredvotes - end -end diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb deleted file mode 100644 index b7882a2bb16..00000000000 --- a/app/models/concerns/mentionable.rb +++ /dev/null @@ -1,89 +0,0 @@ -# == Mentionable concern -# -# Contains functionality related to objects that can mention Users, Issues, MergeRequests, or Commits by -# GFM references. -# -# Used by Issue, Note, MergeRequest, and Commit. -# -module Mentionable - extend ActiveSupport::Concern - - module ClassMethods - # Indicate which attributes of the Mentionable to search for GFM references. - def attr_mentionable(*attrs) - mentionable_attrs.concat(attrs.map(&:to_s)) - end - - # Accessor for attributes marked mentionable. - def mentionable_attrs - @mentionable_attrs ||= [] - end - end - - # Generate a GFM back-reference that will construct a link back to this Mentionable when rendered. Must - # be overridden if this model object can be referenced directly by GFM notation. - def gfm_reference - raise NotImplementedError.new("#{self.class} does not implement #gfm_reference") - end - - # Construct a String that contains possible GFM references. - def mentionable_text - self.class.mentionable_attrs.map { |attr| send(attr) || '' }.join - end - - # The GFM reference to this Mentionable, which shouldn't be included in its #references. - def local_reference - self - end - - # Determine whether or not a cross-reference Note has already been created between this Mentionable and - # the specified target. - def has_mentioned?(target) - Note.cross_reference_exists?(target, local_reference) - end - - def mentioned_users(current_user = nil) - return [] if mentionable_text.blank? - - ext = Gitlab::ReferenceExtractor.new(self.project, current_user) - ext.analyze(mentionable_text) - ext.users.uniq - end - - # Extract GFM references to other Mentionables from this Mentionable. Always excludes its #local_reference. - def references(p = project, current_user = self.author, text = mentionable_text) - return [] if text.blank? - - ext = Gitlab::ReferenceExtractor.new(p, current_user) - ext.analyze(text) - - (ext.issues + ext.merge_requests + ext.commits).uniq - [local_reference] - end - - # Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+. - def create_cross_references!(p = project, a = author, without = []) - refs = references(p) - without - refs.each do |ref| - Note.create_cross_reference_note(ref, local_reference, a, p) - end - end - - # If the mentionable_text field is about to change, locate any *added* references and create cross references for - # them. Invoke from an observer's #before_save implementation. - def notice_added_references(p = project, a = author) - ch = changed_attributes - original, mentionable_changed = "", false - self.class.mentionable_attrs.each do |attr| - if ch[attr] - original << ch[attr] - mentionable_changed = true - end - end - - # Only proceed if the saved changes actually include a chance to an attr_mentionable field. - return unless mentionable_changed - - preexisting = references(p, self.author, original) - create_cross_references!(p, a, preexisting) - end -end diff --git a/app/models/concerns/notifiable.rb b/app/models/concerns/notifiable.rb deleted file mode 100644 index d7dcd97911d..00000000000 --- a/app/models/concerns/notifiable.rb +++ /dev/null @@ -1,15 +0,0 @@ -# == Notifiable concern -# -# Contains notification functionality -# -module Notifiable - extend ActiveSupport::Concern - - included do - validates :notification_level, inclusion: { in: Notification.project_notification_levels }, presence: true - end - - def notification - @notification ||= Notification.new(self) - end -end diff --git a/app/models/concerns/sortable.rb b/app/models/concerns/sortable.rb deleted file mode 100644 index 0ad2654867d..00000000000 --- a/app/models/concerns/sortable.rb +++ /dev/null @@ -1,35 +0,0 @@ -# == Sortable concern -# -# Set default scope for ordering objects -# -module Sortable - extend ActiveSupport::Concern - - included do - # By default all models should be ordered - # by created_at field starting from newest - default_scope { order(created_at: :desc, id: :desc) } - - scope :order_created_desc, -> { reorder(created_at: :desc, id: :desc) } - scope :order_created_asc, -> { reorder(created_at: :asc, id: :asc) } - scope :order_updated_desc, -> { reorder(updated_at: :desc, id: :desc) } - scope :order_updated_asc, -> { reorder(updated_at: :asc, id: :asc) } - scope :order_name_asc, -> { reorder(name: :asc) } - scope :order_name_desc, -> { reorder(name: :desc) } - end - - module ClassMethods - def order_by(method) - case method.to_s - when 'name_asc' then order_name_asc - when 'name_desc' then order_name_desc - when 'updated_asc' then order_updated_asc - when 'updated_desc' then order_updated_desc - when 'created_asc' then order_created_asc - when 'created_desc' then order_created_desc - else - all - end - end - end -end diff --git a/app/models/concerns/taskable.rb b/app/models/concerns/taskable.rb deleted file mode 100644 index bbb3b301a9f..00000000000 --- a/app/models/concerns/taskable.rb +++ /dev/null @@ -1,51 +0,0 @@ -# Contains functionality for objects that can have task lists in their -# descriptions. Task list items can be added with Markdown like "* [x] Fix -# bugs". -# -# Used by MergeRequest and Issue -module Taskable - TASK_PATTERN_MD = /^(?<bullet> *[*-] *)\[(?<checked>[ xX])\]/.freeze - TASK_PATTERN_HTML = /^<li>(?<p_tag>\s*<p>)?\[(?<checked>[ xX])\]/.freeze - - # Change the state of a task list item for this Taskable. Edit the object's - # description by finding the nth task item and changing its checkbox - # placeholder to "[x]" if +checked+ is true, or "[ ]" if it's false. - # Note: task numbering starts with 1 - def update_nth_task(n, checked) - index = 0 - check_char = checked ? 'x' : ' ' - - # Do this instead of using #gsub! so that ActiveRecord detects that a field - # has changed. - self.description = self.description.gsub(TASK_PATTERN_MD) do |match| - index += 1 - case index - when n then "#{$LAST_MATCH_INFO[:bullet]}[#{check_char}]" - else match - end - end - - save - end - - # Return true if this object's description has any task list items. - def tasks? - description && description.match(TASK_PATTERN_MD) - end - - # Return a string that describes the current state of this Taskable's task - # list items, e.g. "20 tasks (12 done, 8 unfinished)" - def task_status - return nil unless description - - num_tasks = 0 - num_done = 0 - - description.scan(TASK_PATTERN_MD) do - num_tasks += 1 - num_done += 1 unless $LAST_MATCH_INFO[:checked] == ' ' - end - - "#{num_tasks} tasks (#{num_done} done, #{num_tasks - num_done} unfinished)" - end -end diff --git a/app/models/concerns/token_authenticatable.rb b/app/models/concerns/token_authenticatable.rb deleted file mode 100644 index 9b88ec1cc38..00000000000 --- a/app/models/concerns/token_authenticatable.rb +++ /dev/null @@ -1,31 +0,0 @@ -module TokenAuthenticatable - extend ActiveSupport::Concern - - module ClassMethods - def find_by_authentication_token(authentication_token = nil) - if authentication_token - where(authentication_token: authentication_token).first - end - end - end - - def ensure_authentication_token - if authentication_token.blank? - self.authentication_token = generate_authentication_token - end - end - - def reset_authentication_token! - self.authentication_token = generate_authentication_token - save - end - - private - - def generate_authentication_token - loop do - token = Devise.friendly_token - break token unless self.class.unscoped.where(authentication_token: token).first - end - end -end diff --git a/app/models/deploy_key.rb b/app/models/deploy_key.rb deleted file mode 100644 index 85d52d558cd..00000000000 --- a/app/models/deploy_key.rb +++ /dev/null @@ -1,38 +0,0 @@ -# == Schema Information -# -# Table name: keys -# -# id :integer not null, primary key -# user_id :integer -# created_at :datetime -# updated_at :datetime -# key :text -# public :boolean default(FALSE) -# title :string(255) -# type :string(255) -# fingerprint :string(255) -# - -class DeployKey < Key - has_many :deploy_keys_projects, dependent: :destroy - has_many :projects, through: :deploy_keys_projects - - scope :in_projects, ->(projects) { joins(:deploy_keys_projects).where('deploy_keys_projects.project_id in (?)', projects) } - scope :are_public, -> { where(public: true) } - - def private? - !public? - end - - def orphaned? - self.deploy_keys_projects.length == 0 - end - - def almost_orphaned? - self.deploy_keys_projects.length == 1 - end - - def destroyed_when_orphaned? - self.private? - end -end diff --git a/app/models/deploy_keys_project.rb b/app/models/deploy_keys_project.rb deleted file mode 100644 index 18db521741f..00000000000 --- a/app/models/deploy_keys_project.rb +++ /dev/null @@ -1,29 +0,0 @@ -# == Schema Information -# -# Table name: deploy_keys_projects -# -# id :integer not null, primary key -# deploy_key_id :integer not null -# project_id :integer not null -# created_at :datetime -# updated_at :datetime -# - -class DeployKeysProject < ActiveRecord::Base - belongs_to :project - belongs_to :deploy_key - - validates :deploy_key_id, presence: true - validates :deploy_key_id, uniqueness: { scope: [:project_id], message: "already exists in project" } - validates :project_id, presence: true - - after_destroy :destroy_orphaned_deploy_key - - private - - def destroy_orphaned_deploy_key - return unless self.deploy_key.destroyed_when_orphaned? && self.deploy_key.orphaned? - - self.deploy_key.destroy - end -end diff --git a/app/models/diff_line.rb b/app/models/diff_line.rb deleted file mode 100644 index ad37945874a..00000000000 --- a/app/models/diff_line.rb +++ /dev/null @@ -1,3 +0,0 @@ -class DiffLine - attr_accessor :type, :content, :num, :code -end diff --git a/app/models/email.rb b/app/models/email.rb deleted file mode 100644 index 556b0e9586e..00000000000 --- a/app/models/email.rb +++ /dev/null @@ -1,35 +0,0 @@ -# == Schema Information -# -# Table name: emails -# -# id :integer not null, primary key -# user_id :integer not null -# email :string(255) not null -# created_at :datetime -# updated_at :datetime -# - -class Email < ActiveRecord::Base - include Sortable - - belongs_to :user - - validates :user_id, presence: true - validates :email, presence: true, email: { strict_mode: true }, uniqueness: true - validate :unique_email, if: ->(email) { email.email_changed? } - - after_create :notify - before_validation :cleanup_email - - def cleanup_email - self.email = self.email.downcase.strip - end - - def unique_email - self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email) - end - - def notify - NotificationService.new.new_email(self) - end -end diff --git a/app/models/event.rb b/app/models/event.rb deleted file mode 100644 index c9a88ffa8e0..00000000000 --- a/app/models/event.rb +++ /dev/null @@ -1,330 +0,0 @@ -# == Schema Information -# -# Table name: events -# -# id :integer not null, primary key -# target_type :string(255) -# target_id :integer -# title :string(255) -# data :text -# project_id :integer -# created_at :datetime -# updated_at :datetime -# action :integer -# author_id :integer -# - -class Event < ActiveRecord::Base - include Sortable - default_scope { where.not(author_id: nil) } - - CREATED = 1 - UPDATED = 2 - CLOSED = 3 - REOPENED = 4 - PUSHED = 5 - COMMENTED = 6 - MERGED = 7 - JOINED = 8 # User joined project - LEFT = 9 # User left project - - delegate :name, :email, to: :author, prefix: true, allow_nil: true - delegate :title, to: :issue, prefix: true, allow_nil: true - delegate :title, to: :merge_request, prefix: true, allow_nil: true - delegate :title, to: :note, prefix: true, allow_nil: true - - belongs_to :author, class_name: "User" - belongs_to :project - belongs_to :target, polymorphic: true - - # For Hash only - serialize :data - - # Callbacks - after_create :reset_project_activity - - # Scopes - scope :recent, -> { order("created_at DESC") } - scope :code_push, -> { where(action: PUSHED) } - scope :in_projects, ->(project_ids) { where(project_id: project_ids).recent } - scope :with_associations, -> { includes(project: :namespace) } - - class << self - def reset_event_cache_for(target) - Event.where(target_id: target.id, target_type: target.class.to_s). - order('id DESC').limit(100). - update_all(updated_at: Time.now) - end - - def contributions - where("action = ? OR (target_type in (?) AND action in (?))", - Event::PUSHED, ["MergeRequest", "Issue"], - [Event::CREATED, Event::CLOSED, Event::MERGED]) - end - end - - def proper? - if push? - true - elsif membership_changed? - true - elsif created_project? - true - else - (issue? || merge_request? || note? || milestone?) && target - end - end - - def project_name - if project - project.name_with_namespace - else - "(deleted project)" - end - end - - def target_title - target.title if target && target.respond_to?(:title) - end - - def created? - action == CREATED - end - - def push? - action == PUSHED && valid_push? - end - - def merged? - action == MERGED - end - - def closed? - action == CLOSED - end - - def reopened? - action == REOPENED - end - - def joined? - action == JOINED - end - - def left? - action == LEFT - end - - def commented? - action == COMMENTED - end - - def membership_changed? - joined? || left? - end - - def created_project? - created? && !target - end - - def created_target? - created? && target - end - - def milestone? - target_type == "Milestone" - end - - def note? - target_type == "Note" - end - - def issue? - target_type == "Issue" - end - - def merge_request? - target_type == "MergeRequest" - end - - def milestone - target if milestone? - end - - def issue - target if issue? - end - - def merge_request - target if merge_request? - end - - def note - target if note? - end - - def action_name - if push? - if new_ref? - "pushed new" - elsif rm_ref? - "deleted" - else - "pushed to" - end - elsif closed? - "closed" - elsif merged? - "accepted" - elsif joined? - 'joined' - elsif left? - 'left' - elsif commented? - "commented on" - elsif created_project? - if project.import? - "imported" - else - "created" - end - else - "opened" - end - end - - def valid_push? - data[:ref] && ref_name.present? - rescue - false - end - - def tag? - Gitlab::Git.tag_ref?(data[:ref]) - end - - def branch? - Gitlab::Git.branch_ref?(data[:ref]) - end - - def new_ref? - Gitlab::Git.blank_ref?(commit_from) - end - - def rm_ref? - Gitlab::Git.blank_ref?(commit_to) - end - - def md_ref? - !(rm_ref? || new_ref?) - end - - def commit_from - data[:before] - end - - def commit_to - data[:after] - end - - def ref_name - if tag? - tag_name - else - branch_name - end - end - - def branch_name - @branch_name ||= Gitlab::Git.ref_name(data[:ref]) - end - - def tag_name - @tag_name ||= Gitlab::Git.ref_name(data[:ref]) - end - - # Max 20 commits from push DESC - def commits - @commits ||= (data[:commits] || []).reverse - end - - def commits_count - data[:total_commits_count] || commits.count || 0 - end - - def ref_type - tag? ? "tag" : "branch" - end - - def push_with_commits? - !commits.empty? && commit_from && commit_to - end - - def last_push_to_non_root? - branch? && project.default_branch != branch_name - end - - def note_commit_id - target.commit_id - end - - def target_iid - target.respond_to?(:iid) ? target.iid : target_id - end - - def note_short_commit_id - Commit.truncate_sha(note_commit_id) - end - - def note_commit? - target.noteable_type == "Commit" - end - - def note_project_snippet? - target.noteable_type == "Snippet" - end - - def note_target - target.noteable - end - - def note_target_id - if note_commit? - target.commit_id - else - target.noteable_id.to_s - end - end - - def note_target_iid - if note_target.respond_to?(:iid) - note_target.iid - else - note_target_id - end.to_s - end - - def note_target_type - if target.noteable_type.present? - target.noteable_type.titleize - else - "Wall" - end.downcase - end - - def body? - if push? - push_with_commits? - elsif note? - true - else - target.respond_to? :title - end - end - - def reset_project_activity - if project - project.update_column(:last_activity_at, self.created_at) - end - end -end diff --git a/app/models/external_issue.rb b/app/models/external_issue.rb deleted file mode 100644 index 50efcb32f1b..00000000000 --- a/app/models/external_issue.rb +++ /dev/null @@ -1,25 +0,0 @@ -class ExternalIssue - def initialize(issue_identifier, project) - @issue_identifier, @project = issue_identifier, project - end - - def to_s - @issue_identifier.to_s - end - - def id - @issue_identifier.to_s - end - - def iid - @issue_identifier.to_s - end - - def ==(other) - other.is_a?(self.class) && (to_s == other.to_s) - end - - def project - @project - end -end diff --git a/app/models/forked_project_link.rb b/app/models/forked_project_link.rb deleted file mode 100644 index 9b0c6263a96..00000000000 --- a/app/models/forked_project_link.rb +++ /dev/null @@ -1,15 +0,0 @@ -# == Schema Information -# -# Table name: forked_project_links -# -# id :integer not null, primary key -# forked_to_project_id :integer not null -# forked_from_project_id :integer not null -# created_at :datetime -# updated_at :datetime -# - -class ForkedProjectLink < ActiveRecord::Base - belongs_to :forked_to_project, class_name: Project - belongs_to :forked_from_project, class_name: Project -end diff --git a/app/models/group.rb b/app/models/group.rb deleted file mode 100644 index 1386a9eccc9..00000000000 --- a/app/models/group.rb +++ /dev/null @@ -1,100 +0,0 @@ -# == Schema Information -# -# Table name: namespaces -# -# id :integer not null, primary key -# name :string(255) not null -# path :string(255) not null -# owner_id :integer -# created_at :datetime -# updated_at :datetime -# type :string(255) -# description :string(255) default(""), not null -# avatar :string(255) -# - -require 'carrierwave/orm/activerecord' -require 'file_size_validator' - -class Group < Namespace - has_many :group_members, dependent: :destroy, as: :source, class_name: 'GroupMember' - has_many :users, through: :group_members - - validate :avatar_type, if: ->(user) { user.avatar_changed? } - validates :avatar, file_size: { maximum: 200.kilobytes.to_i } - - mount_uploader :avatar, AvatarUploader - - after_create :post_create_hook - after_destroy :post_destroy_hook - - class << self - def search(query) - where("LOWER(namespaces.name) LIKE :query or LOWER(namespaces.path) LIKE :query", query: "%#{query.downcase}%") - end - - def sort(method) - order_by(method) - end - end - - def human_name - name - end - - def owners - @owners ||= group_members.owners.map(&:user) - end - - def add_users(user_ids, access_level, current_user = nil) - user_ids.each do |user_id| - Member.add_user(self.group_members, user_id, access_level, current_user) - end - end - - def add_user(user, access_level, current_user = nil) - add_users([user], access_level, current_user) - end - - def add_owner(user, current_user = nil) - self.add_user(user, Gitlab::Access::OWNER, current_user) - end - - def has_owner?(user) - owners.include?(user) - end - - def has_master?(user) - members.masters.where(user_id: user).any? - end - - def last_owner?(user) - has_owner?(user) && owners.size == 1 - end - - def members - group_members - end - - def avatar_type - unless self.avatar.image? - self.errors.add :avatar, "only images allowed" - end - end - - def public_profile? - projects.public_only.any? - end - - def post_create_hook - system_hook_service.execute_hooks_for(self, :create) - end - - def post_destroy_hook - system_hook_service.execute_hooks_for(self, :destroy) - end - - def system_hook_service - SystemHooksService.new - end -end diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb deleted file mode 100644 index 7e4f16ebf16..00000000000 --- a/app/models/group_milestone.rb +++ /dev/null @@ -1,95 +0,0 @@ -class GroupMilestone - - def initialize(title, milestones) - @title = title - @milestones = milestones - end - - def title - @title - end - - def safe_title - @title.parameterize - end - - def milestones - @milestones - end - - def projects - milestones.map { |milestone| milestone.project } - end - - def issue_count - milestones.map { |milestone| milestone.issues.count }.sum - end - - def merge_requests_count - milestones.map { |milestone| milestone.merge_requests.count }.sum - end - - def open_items_count - milestones.map { |milestone| milestone.open_items_count }.sum - end - - def closed_items_count - milestones.map { |milestone| milestone.closed_items_count }.sum - end - - def total_items_count - milestones.map { |milestone| milestone.total_items_count }.sum - end - - def percent_complete - ((closed_items_count * 100) / total_items_count).abs - rescue ZeroDivisionError - 100 - end - - def state - state = milestones.map { |milestone| milestone.state } - - if state.count('closed') == state.size - 'closed' - else - 'active' - end - end - - def active? - state == 'active' - end - - def closed? - state == 'closed' - end - - def issues - @group_issues ||= milestones.map(&:issues).flatten.group_by(&:state) - end - - def merge_requests - @group_merge_requests ||= milestones.map(&:merge_requests).flatten.group_by(&:state) - end - - def participants - @group_participants ||= milestones.map(&:participants).flatten.compact.uniq - end - - def opened_issues - issues.values_at("opened", "reopened").compact.flatten - end - - def closed_issues - issues['closed'] - end - - def opened_merge_requests - merge_requests.values_at("opened", "reopened").compact.flatten - end - - def closed_merge_requests - merge_requests.values_at("closed", "merged", "locked").compact.flatten - end -end diff --git a/app/models/hooks/project_hook.rb b/app/models/hooks/project_hook.rb deleted file mode 100644 index 21867a9316c..00000000000 --- a/app/models/hooks/project_hook.rb +++ /dev/null @@ -1,25 +0,0 @@ -# == Schema Information -# -# Table name: web_hooks -# -# id :integer not null, primary key -# url :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# type :string(255) default("ProjectHook") -# service_id :integer -# push_events :boolean default(TRUE), not null -# issues_events :boolean default(FALSE), not null -# merge_requests_events :boolean default(FALSE), not null -# tag_push_events :boolean default(FALSE) -# - -class ProjectHook < WebHook - belongs_to :project - - scope :push_hooks, -> { where(push_events: true) } - scope :tag_push_hooks, -> { where(tag_push_events: true) } - scope :issue_hooks, -> { where(issues_events: true) } - scope :merge_request_hooks, -> { where(merge_requests_events: true) } -end diff --git a/app/models/hooks/service_hook.rb b/app/models/hooks/service_hook.rb deleted file mode 100644 index 2e11239c40b..00000000000 --- a/app/models/hooks/service_hook.rb +++ /dev/null @@ -1,20 +0,0 @@ -# == Schema Information -# -# Table name: web_hooks -# -# id :integer not null, primary key -# url :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# type :string(255) default("ProjectHook") -# service_id :integer -# push_events :boolean default(TRUE), not null -# issues_events :boolean default(FALSE), not null -# merge_requests_events :boolean default(FALSE), not null -# tag_push_events :boolean default(FALSE) -# - -class ServiceHook < WebHook - belongs_to :service -end diff --git a/app/models/hooks/system_hook.rb b/app/models/hooks/system_hook.rb deleted file mode 100644 index ee32b49bc66..00000000000 --- a/app/models/hooks/system_hook.rb +++ /dev/null @@ -1,19 +0,0 @@ -# == Schema Information -# -# Table name: web_hooks -# -# id :integer not null, primary key -# url :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# type :string(255) default("ProjectHook") -# service_id :integer -# push_events :boolean default(TRUE), not null -# issues_events :boolean default(FALSE), not null -# merge_requests_events :boolean default(FALSE), not null -# tag_push_events :boolean default(FALSE) -# - -class SystemHook < WebHook -end diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb deleted file mode 100644 index 315d96af1b9..00000000000 --- a/app/models/hooks/web_hook.rb +++ /dev/null @@ -1,60 +0,0 @@ -# == Schema Information -# -# Table name: web_hooks -# -# id :integer not null, primary key -# url :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# type :string(255) default("ProjectHook") -# service_id :integer -# push_events :boolean default(TRUE), not null -# issues_events :boolean default(FALSE), not null -# merge_requests_events :boolean default(FALSE), not null -# tag_push_events :boolean default(FALSE) -# - -class WebHook < ActiveRecord::Base - include Sortable - include HTTParty - - default_value_for :push_events, true - default_value_for :issues_events, false - default_value_for :merge_requests_events, false - default_value_for :tag_push_events, false - - # HTTParty timeout - default_timeout Gitlab.config.gitlab.webhook_timeout - - validates :url, presence: true, - format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" } - - def execute(data) - parsed_url = URI.parse(url) - if parsed_url.userinfo.blank? - WebHook.post(url, - body: data.to_json, - headers: { "Content-Type" => "application/json" }, - verify: false) - else - post_url = url.gsub("#{parsed_url.userinfo}@", "") - auth = { - username: URI.decode(parsed_url.user), - password: URI.decode(parsed_url.password), - } - WebHook.post(post_url, - body: data.to_json, - headers: { "Content-Type" => "application/json" }, - verify: false, - basic_auth: auth) - end - rescue SocketError, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::OpenTimeout => e - logger.error("WebHook Error => #{e}") - false - end - - def async_execute(data) - Sidekiq::Client.enqueue(ProjectWebHookWorker, id, data) - end -end diff --git a/app/models/identity.rb b/app/models/identity.rb deleted file mode 100644 index 756d19adec7..00000000000 --- a/app/models/identity.rb +++ /dev/null @@ -1,19 +0,0 @@ -# == Schema Information -# -# Table name: identities -# -# id :integer not null, primary key -# extern_uid :string(255) -# provider :string(255) -# user_id :integer -# created_at :datetime -# updated_at :datetime -# - -class Identity < ActiveRecord::Base - include Sortable - belongs_to :user - - validates :extern_uid, allow_blank: true, uniqueness: { scope: :provider } - validates :user_id, uniqueness: { scope: :provider } -end diff --git a/app/models/issue.rb b/app/models/issue.rb deleted file mode 100644 index 6e102051387..00000000000 --- a/app/models/issue.rb +++ /dev/null @@ -1,78 +0,0 @@ -# == Schema Information -# -# Table name: issues -# -# id :integer not null, primary key -# title :string(255) -# assignee_id :integer -# author_id :integer -# project_id :integer -# created_at :datetime -# updated_at :datetime -# position :integer default(0) -# branch_name :string(255) -# description :text -# milestone_id :integer -# state :string(255) -# iid :integer -# - -require 'carrierwave/orm/activerecord' -require 'file_size_validator' - -class Issue < ActiveRecord::Base - include Issuable - include InternalId - include Taskable - include Sortable - - ActsAsTaggableOn.strict_case_match = true - - belongs_to :project - validates :project, presence: true - - scope :of_group, ->(group) { where(project_id: group.project_ids) } - scope :cared, ->(user) { where(assignee_id: user) } - scope :open_for, ->(user) { opened.assigned_to(user) } - - state_machine :state, initial: :opened do - event :close do - transition [:reopened, :opened] => :closed - end - - event :reopen do - transition closed: :reopened - end - - state :opened - state :reopened - state :closed - end - - def hook_attrs - attributes - end - - # Mentionable overrides. - - def gfm_reference - "issue ##{iid}" - end - - # Reset issue events cache - # - # Since we do cache @event we need to reset cache in special cases: - # * when an issue is updated - # Events cache stored like events/23-20130109142513. - # The cache key includes updated_at timestamp. - # Thus it will automatically generate a new fragment - # when the event is updated because the key changes. - def reset_events_cache - Event.reset_event_cache_for(self) - end - - # To allow polymorphism with MergeRequest. - def source_project - project - end -end diff --git a/app/models/key.rb b/app/models/key.rb deleted file mode 100644 index 016eee86992..00000000000 --- a/app/models/key.rb +++ /dev/null @@ -1,86 +0,0 @@ -# == Schema Information -# -# Table name: keys -# -# id :integer not null, primary key -# user_id :integer -# created_at :datetime -# updated_at :datetime -# key :text -# title :string(255) -# type :string(255) -# fingerprint :string(255) -# - -require 'digest/md5' - -class Key < ActiveRecord::Base - include Sortable - - belongs_to :user - - before_validation :strip_white_space, :generate_fingerprint - - validates :title, presence: true, length: { within: 0..255 } - validates :key, presence: true, length: { within: 0..5000 }, format: { with: /\A(ssh|ecdsa)-.*\Z/ }, uniqueness: true - validates :fingerprint, uniqueness: true, presence: { message: 'cannot be generated' } - - delegate :name, :email, to: :user, prefix: true - - after_create :add_to_shell - after_create :notify_user - after_create :post_create_hook - after_destroy :remove_from_shell - after_destroy :post_destroy_hook - - def strip_white_space - self.key = key.strip unless key.blank? - end - - # projects that has this key - def projects - user.authorized_projects - end - - def shell_id - "key-#{id}" - end - - def add_to_shell - GitlabShellWorker.perform_async( - :add_key, - shell_id, - key - ) - end - - def notify_user - NotificationService.new.new_key(self) - end - - def post_create_hook - SystemHooksService.new.execute_hooks_for(self, :create) - end - - def remove_from_shell - GitlabShellWorker.perform_async( - :remove_key, - shell_id, - key, - ) - end - - def post_destroy_hook - SystemHooksService.new.execute_hooks_for(self, :destroy) - end - - private - - def generate_fingerprint - self.fingerprint = nil - - return unless self.key.present? - - self.fingerprint = Gitlab::KeyFingerprint.new(self.key).fingerprint - end -end diff --git a/app/models/label_link.rb b/app/models/label_link.rb deleted file mode 100644 index b94c9c777af..00000000000 --- a/app/models/label_link.rb +++ /dev/null @@ -1,19 +0,0 @@ -# == Schema Information -# -# Table name: label_links -# -# id :integer not null, primary key -# label_id :integer -# target_id :integer -# target_type :string(255) -# created_at :datetime -# updated_at :datetime -# - -class LabelLink < ActiveRecord::Base - belongs_to :target, polymorphic: true - belongs_to :label - - validates :target, presence: true - validates :label, presence: true -end diff --git a/app/models/member.rb b/app/models/member.rb deleted file mode 100644 index d151c7b2390..00000000000 --- a/app/models/member.rb +++ /dev/null @@ -1,172 +0,0 @@ -# == Schema Information -# -# Table name: members -# -# id :integer not null, primary key -# access_level :integer not null -# source_id :integer not null -# source_type :string(255) not null -# user_id :integer not null -# notification_level :integer not null -# type :string(255) -# created_at :datetime -# updated_at :datetime -# created_by_id :integer -# invite_email :string -# invite_token :string -# invite_accepted_at :datetime -# - -class Member < ActiveRecord::Base - include Sortable - include Notifiable - include Gitlab::Access - - attr_accessor :raw_invite_token - - belongs_to :created_by, class_name: "User" - belongs_to :user - belongs_to :source, polymorphic: true - - validates :user, presence: true, unless: :invite? - validates :source, presence: true - validates :user_id, uniqueness: { scope: [:source_type, :source_id], - message: "already exists in source", - allow_nil: true } - validates :access_level, inclusion: { in: Gitlab::Access.all_values }, presence: true - validates :invite_email, presence: { if: :invite? }, - email: { strict_mode: true, allow_nil: true }, - uniqueness: { scope: [:source_type, :source_id], allow_nil: true } - - scope :invite, -> { where(user_id: nil) } - scope :non_invite, -> { where("user_id IS NOT NULL") } - scope :guests, -> { where(access_level: GUEST) } - scope :reporters, -> { where(access_level: REPORTER) } - scope :developers, -> { where(access_level: DEVELOPER) } - scope :masters, -> { where(access_level: MASTER) } - scope :owners, -> { where(access_level: OWNER) } - - before_validation :generate_invite_token, on: :create, if: -> (member) { member.invite_email.present? } - after_create :send_invite, if: :invite? - after_create :post_create_hook, unless: :invite? - after_update :post_update_hook, unless: :invite? - after_destroy :post_destroy_hook, unless: :invite? - - delegate :name, :username, :email, to: :user, prefix: true - - class << self - def find_by_invite_token(invite_token) - invite_token = Devise.token_generator.digest(self, :invite_token, invite_token) - find_by(invite_token: invite_token) - end - - # This method is used to find users that have been entered into the "Add members" field. - # These can be the User objects directly, their IDs, their emails, or new emails to be invited. - def user_for_id(user_id) - return user_id if user_id.is_a?(User) - - user = User.find_by(id: user_id) - user ||= User.find_by(email: user_id) - user ||= user_id - user - end - - def add_user(members, user_id, access_level, current_user = nil) - user = user_for_id(user_id) - - # `user` can be either a User object or an email to be invited - if user.is_a?(User) - member = members.find_or_initialize_by(user_id: user.id) - else - member = members.build - member.invite_email = user - end - - member.created_by ||= current_user - member.access_level = access_level - - member.save - end - end - - def invite? - self.invite_token.present? - end - - def accept_invite!(new_user) - return false unless invite? - - self.invite_token = nil - self.invite_accepted_at = Time.now.utc - - self.user = new_user - - saved = self.save - - after_accept_invite if saved - - saved - end - - def decline_invite! - return false unless invite? - - destroyed = self.destroy - - after_decline_invite if destroyed - - destroyed - end - - def generate_invite_token - raw, enc = Devise.token_generator.generate(self.class, :invite_token) - @raw_invite_token = raw - self.invite_token = enc - end - - def generate_invite_token! - generate_invite_token && save(validate: false) - end - - def resend_invite - return unless invite? - - generate_invite_token! unless @raw_invite_token - - send_invite - end - - private - - def send_invite - # override in subclass - end - - def post_create_hook - system_hook_service.execute_hooks_for(self, :create) - end - - def post_update_hook - # override in subclass - end - - def post_destroy_hook - system_hook_service.execute_hooks_for(self, :destroy) - end - - def after_accept_invite - post_create_hook - end - - def after_decline_invite - # override in subclass - end - - def system_hook_service - SystemHooksService.new - end - - def notification_service - NotificationService.new - end -end diff --git a/app/models/members/group_member.rb b/app/models/members/group_member.rb deleted file mode 100644 index 84c91372b3f..00000000000 --- a/app/models/members/group_member.rb +++ /dev/null @@ -1,75 +0,0 @@ -# == Schema Information -# -# Table name: members -# -# id :integer not null, primary key -# access_level :integer not null -# source_id :integer not null -# source_type :string(255) not null -# user_id :integer not null -# notification_level :integer not null -# type :string(255) -# created_at :datetime -# updated_at :datetime -# - -class GroupMember < Member - SOURCE_TYPE = 'Namespace' - - belongs_to :group, class_name: 'Group', foreign_key: 'source_id' - - # Make sure group member points only to group as it source - default_value_for :source_type, SOURCE_TYPE - default_value_for :notification_level, Notification::N_GLOBAL - validates_format_of :source_type, with: /\ANamespace\z/ - default_scope { where(source_type: SOURCE_TYPE) } - - scope :with_group, ->(group) { where(source_id: group.id) } - scope :with_user, ->(user) { where(user_id: user.id) } - - def self.access_level_roles - Gitlab::Access.options_with_owner - end - - def group - source - end - - def access_field - access_level - end - - private - - def send_invite - notification_service.invite_group_member(self, @raw_invite_token) - - super - end - - def post_create_hook - notification_service.new_group_member(self) - - super - end - - def post_update_hook - if access_level_changed? - notification_service.update_group_member(self) - end - - super - end - - def after_accept_invite - notification_service.accept_group_invite(self) - - super - end - - def after_decline_invite - notification_service.decline_group_invite(self) - - super - end -end diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb deleted file mode 100644 index 0a3b4d2182b..00000000000 --- a/app/models/members/project_member.rb +++ /dev/null @@ -1,165 +0,0 @@ -# == Schema Information -# -# Table name: members -# -# id :integer not null, primary key -# access_level :integer not null -# source_id :integer not null -# source_type :string(255) not null -# user_id :integer not null -# notification_level :integer not null -# type :string(255) -# created_at :datetime -# updated_at :datetime -# - -class ProjectMember < Member - SOURCE_TYPE = 'Project' - - include Gitlab::ShellAdapter - - belongs_to :project, class_name: 'Project', foreign_key: 'source_id' - - - # Make sure project member points only to project as it source - default_value_for :source_type, SOURCE_TYPE - default_value_for :notification_level, Notification::N_GLOBAL - validates_format_of :source_type, with: /\AProject\z/ - default_scope { where(source_type: SOURCE_TYPE) } - - scope :in_project, ->(project) { where(source_id: project.id) } - scope :in_projects, ->(projects) { where(source_id: projects.pluck(:id)) } - scope :with_user, ->(user) { where(user_id: user.id) } - - class << self - - # Add users to project teams with passed access option - # - # access can be an integer representing a access code - # or symbol like :master representing role - # - # Ex. - # add_users_into_projects( - # project_ids, - # user_ids, - # ProjectMember::MASTER - # ) - # - # add_users_into_projects( - # project_ids, - # user_ids, - # :master - # ) - # - def add_users_into_projects(project_ids, user_ids, access, current_user = nil) - access_level = if roles_hash.has_key?(access) - roles_hash[access] - elsif roles_hash.values.include?(access.to_i) - access - else - raise "Non valid access" - end - - users = user_ids.map { |user_id| Member.user_for_id(user_id) } - - ProjectMember.transaction do - project_ids.each do |project_id| - project = Project.find(project_id) - - users.each do |user| - Member.add_user(project.project_members, user, access_level, current_user) - end - end - end - - true - rescue - false - end - - def truncate_teams(project_ids) - ProjectMember.transaction do - members = ProjectMember.where(source_id: project_ids) - - members.each do |member| - member.destroy - end - end - - true - rescue - false - end - - def truncate_team(project) - truncate_teams [project.id] - end - - def roles_hash - Gitlab::Access.sym_options - end - - def access_roles - Gitlab::Access.options - end - end - - def access_field - access_level - end - - def project - source - end - - def owner? - project.owner == user - end - - private - - def send_invite - notification_service.invite_project_member(self, @raw_invite_token) - - super - end - - def post_create_hook - unless owner? - event_service.join_project(self.project, self.user) - notification_service.new_project_member(self) - end - - super - end - - def post_update_hook - if access_level_changed? - notification_service.update_project_member(self) - end - - super - end - - def post_destroy_hook - event_service.leave_project(self.project, self.user) - - super - end - - def after_accept_invite - notification_service.accept_project_invite(self) - - super - end - - def after_decline_invite - notification_service.decline_project_invite(self) - - super - end - - def event_service - EventCreateService.new - end -end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb deleted file mode 100644 index 9c9e2762507..00000000000 --- a/app/models/merge_request.rb +++ /dev/null @@ -1,368 +0,0 @@ -# == Schema Information -# -# Table name: merge_requests -# -# id :integer not null, primary key -# target_branch :string(255) not null -# source_branch :string(255) not null -# source_project_id :integer not null -# author_id :integer -# assignee_id :integer -# title :string(255) -# created_at :datetime -# updated_at :datetime -# milestone_id :integer -# state :string(255) -# merge_status :string(255) -# target_project_id :integer not null -# iid :integer -# description :text -# position :integer default(0) -# locked_at :datetime -# - -require Rails.root.join("app/models/commit") -require Rails.root.join("lib/static_model") - -class MergeRequest < ActiveRecord::Base - include Issuable - include Taskable - include InternalId - include Sortable - - belongs_to :target_project, foreign_key: :target_project_id, class_name: "Project" - belongs_to :source_project, foreign_key: :source_project_id, class_name: "Project" - - has_one :merge_request_diff, dependent: :destroy - - after_create :create_merge_request_diff - after_update :update_merge_request_diff - - delegate :commits, :diffs, :last_commit, :last_commit_short_sha, to: :merge_request_diff, prefix: nil - - attr_accessor :should_remove_source_branch - - # When this attribute is true some MR validation is ignored - # It allows us to close or modify broken merge requests - attr_accessor :allow_broken - - # Temporary fields to store compare vars - # when creating new merge request - attr_accessor :can_be_created, :compare_failed, - :compare_commits, :compare_diffs - - state_machine :state, initial: :opened do - event :close do - transition [:reopened, :opened] => :closed - end - - event :merge do - transition [:reopened, :opened, :locked] => :merged - end - - event :reopen do - transition closed: :reopened - end - - event :lock_mr do - transition [:reopened, :opened] => :locked - end - - event :unlock_mr do - transition locked: :reopened - end - - after_transition any => :locked do |merge_request, transition| - merge_request.locked_at = Time.now - merge_request.save - end - - after_transition locked: (any - :locked) do |merge_request, transition| - merge_request.locked_at = nil - merge_request.save - end - - state :opened - state :reopened - state :closed - state :merged - state :locked - end - - state_machine :merge_status, initial: :unchecked do - event :mark_as_unchecked do - transition [:can_be_merged, :cannot_be_merged] => :unchecked - end - - event :mark_as_mergeable do - transition [:unchecked, :cannot_be_merged] => :can_be_merged - end - - event :mark_as_unmergeable do - transition [:unchecked, :can_be_merged] => :cannot_be_merged - end - - state :unchecked - state :can_be_merged - state :cannot_be_merged - - around_transition do |merge_request, transition, block| - merge_request.record_timestamps = false - begin - block.call - ensure - merge_request.record_timestamps = true - end - end - end - - validates :source_project, presence: true, unless: :allow_broken - validates :source_branch, presence: true - validates :target_project, presence: true - validates :target_branch, presence: true - validate :validate_branches - validate :validate_fork - - scope :of_group, ->(group) { where("source_project_id in (:group_project_ids) OR target_project_id in (:group_project_ids)", group_project_ids: group.project_ids) } - scope :merged, -> { with_state(:merged) } - scope :by_branch, ->(branch_name) { where("(source_branch LIKE :branch) OR (target_branch LIKE :branch)", branch: branch_name) } - scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) } - scope :by_milestone, ->(milestone) { where(milestone_id: milestone) } - scope :in_projects, ->(project_ids) { where("source_project_id in (:project_ids) OR target_project_id in (:project_ids)", project_ids: project_ids) } - scope :of_projects, ->(ids) { where(target_project_id: ids) } - # Closed scope for merge request should return - # both merged and closed mr's - scope :closed, -> { with_states(:closed, :merged) } - scope :declined, -> { with_states(:closed) } - - def validate_branches - if target_project == source_project && target_branch == source_branch - errors.add :branch_conflict, "You can not use same project/branch for source and target" - end - - if opened? || reopened? - similar_mrs = self.target_project.merge_requests.where(source_branch: source_branch, target_branch: target_branch, source_project_id: source_project.id).opened - similar_mrs = similar_mrs.where('id not in (?)', self.id) if self.id - if similar_mrs.any? - errors.add :validate_branches, - "Cannot Create: This merge request already exists: #{ - similar_mrs.pluck(:title) - }" - end - end - end - - def validate_fork - return true unless target_project && source_project - - if target_project == source_project - true - else - # If source and target projects are different - # we should check if source project is actually a fork of target project - if source_project.forked_from?(target_project) - true - else - errors.add :validate_fork, - 'Source project is not a fork of target project' - end - end - end - - def update_merge_request_diff - if source_branch_changed? || target_branch_changed? - reload_code - mark_as_unchecked - end - end - - def reload_code - if merge_request_diff && open? - merge_request_diff.reload_content - end - end - - def check_if_can_be_merged - if Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged? - mark_as_mergeable - else - mark_as_unmergeable - end - end - - def merge_event - self.target_project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::MERGED).last - end - - def closed_event - self.target_project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::CLOSED).last - end - - def automerge!(current_user, commit_message = nil) - MergeRequests::AutoMergeService. - new(target_project, current_user). - execute(self, commit_message) - end - - def open? - opened? || reopened? - end - - def mr_and_commit_notes - # Fetch comments only from last 100 commits - commits_for_notes_limit = 100 - commit_ids = commits.last(commits_for_notes_limit).map(&:id) - - project.notes.where( - "(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND commit_id IN (:commit_ids))", - mr_id: id, - commit_ids: commit_ids - ) - end - - # Returns the raw diff for this merge request - # - # see "git diff" - def to_diff(current_user) - Gitlab::Satellite::MergeAction.new(current_user, self).diff_in_satellite - end - - # Returns the commit as a series of email patches. - # - # see "git format-patch" - def to_patch(current_user) - Gitlab::Satellite::MergeAction.new(current_user, self).format_patch - end - - def hook_attrs - attrs = { - source: source_project.hook_attrs, - target: target_project.hook_attrs, - last_commit: nil - } - - unless last_commit.nil? - attrs.merge!(last_commit: last_commit.hook_attrs(source_project)) - end - - attributes.merge!(attrs) - end - - def for_fork? - target_project != source_project - end - - def project - target_project - end - - # Return the set of issues that will be closed if this merge request is accepted. - def closes_issues(current_user = self.author) - if target_branch == project.default_branch - issues = commits.flat_map { |c| c.closes_issues(project, current_user) } - issues.push(*Gitlab::ClosingIssueExtractor.new(project, current_user). - closed_by_message(description)) - issues.uniq.sort_by(&:id) - else - [] - end - end - - # Mentionable override. - def gfm_reference - "merge request !#{iid}" - end - - def target_project_path - if target_project - target_project.path_with_namespace - else - "(removed)" - end - end - - def source_project_path - if source_project - source_project.path_with_namespace - else - "(removed)" - end - end - - def source_project_namespace - if source_project && source_project.namespace - source_project.namespace.path - else - "(removed)" - end - end - - def target_project_namespace - if target_project && target_project.namespace - target_project.namespace.path - else - "(removed)" - end - end - - def source_branch_exists? - return false unless self.source_project - - self.source_project.repository.branch_names.include?(self.source_branch) - end - - def target_branch_exists? - return false unless self.target_project - - self.target_project.repository.branch_names.include?(self.target_branch) - end - - # Reset merge request events cache - # - # Since we do cache @event we need to reset cache in special cases: - # * when a merge request is updated - # Events cache stored like events/23-20130109142513. - # The cache key includes updated_at timestamp. - # Thus it will automatically generate a new fragment - # when the event is updated because the key changes. - def reset_events_cache - Event.reset_event_cache_for(self) - end - - def merge_commit_message - message = "Merge branch '#{source_branch}' into '#{target_branch}'" - message << "\n\n" - message << title.to_s - message << "\n\n" - message << description.to_s - message << "\n\n" - message << "See merge request !#{iid}" - message - end - - # Return array of possible target branches - # depends on target project of MR - def target_branches - if target_project.nil? - [] - else - target_project.repository.branch_names - end - end - - # Return array of possible source branches - # depends on source project of MR - def source_branches - if source_project.nil? - [] - else - source_project.repository.branch_names - end - end - - def locked_long_ago? - return false unless locked? - - locked_at.nil? || locked_at < (Time.now - 1.day) - end -end diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb deleted file mode 100644 index acac1ca4cf7..00000000000 --- a/app/models/merge_request_diff.rb +++ /dev/null @@ -1,171 +0,0 @@ -# == Schema Information -# -# Table name: merge_request_diffs -# -# id :integer not null, primary key -# state :string(255) -# st_commits :text -# st_diffs :text -# merge_request_id :integer not null -# created_at :datetime -# updated_at :datetime -# - -require Rails.root.join("app/models/commit") - -class MergeRequestDiff < ActiveRecord::Base - include Sortable - - # Prevent store of diff - # if commits amount more then 200 - COMMITS_SAFE_SIZE = 200 - - attr_reader :commits, :diffs - - belongs_to :merge_request - - delegate :target_branch, :source_branch, to: :merge_request, prefix: nil - - state_machine :state, initial: :empty do - state :collected - state :timeout - state :overflow_commits_safe_size - state :overflow_diff_files_limit - state :overflow_diff_lines_limit - end - - serialize :st_commits - serialize :st_diffs - - after_create :reload_content - - def reload_content - reload_commits - reload_diffs - end - - def diffs - @diffs ||= (load_diffs(st_diffs) || []) - end - - def commits - @commits ||= load_commits(st_commits || []) - end - - def last_commit - commits.first - end - - def last_commit_short_sha - @last_commit_short_sha ||= last_commit.short_id - end - - private - - def dump_commits(commits) - commits.map(&:to_hash) - end - - def load_commits(array) - array.map { |hash| Commit.new(Gitlab::Git::Commit.new(hash)) } - end - - def dump_diffs(diffs) - if diffs.respond_to?(:map) - diffs.map(&:to_hash) - end - end - - def load_diffs(raw) - if raw.respond_to?(:map) - raw.map { |hash| Gitlab::Git::Diff.new(hash) } - end - end - - # Collect array of Git::Commit objects - # between target and source branches - def unmerged_commits - commits = compare_result.commits - - if commits.present? - commits = Commit.decorate(commits). - sort_by(&:created_at). - reverse - end - - commits - end - - # Reload all commits related to current merge request from repo - # and save it as array of hashes in st_commits db field - def reload_commits - commit_objects = unmerged_commits - - if commit_objects.present? - self.st_commits = dump_commits(commit_objects) - end - - save - end - - # Reload diffs between branches related to current merge request from repo - # and save it as array of hashes in st_diffs db field - def reload_diffs - new_diffs = [] - - if commits.size.zero? - self.state = :empty - elsif commits.size > COMMITS_SAFE_SIZE - self.state = :overflow_commits_safe_size - else - new_diffs = unmerged_diffs - end - - if new_diffs.any? - if new_diffs.size > Commit::DIFF_HARD_LIMIT_FILES - self.state = :overflow_diff_files_limit - new_diffs = [] - end - - if new_diffs.sum { |diff| diff.diff.lines.count } > Commit::DIFF_HARD_LIMIT_LINES - self.state = :overflow_diff_lines_limit - new_diffs = [] - end - end - - if new_diffs.present? - new_diffs = dump_commits(new_diffs) - self.state = :collected - end - - self.st_diffs = new_diffs - self.save - end - - # Collect array of Git::Diff objects - # between target and source branches - def unmerged_diffs - diffs = compare_result.diffs - diffs ||= [] - diffs - rescue Gitlab::Git::Diff::TimeoutError => ex - self.state = :timeout - diffs = [] - end - - def repository - merge_request.target_project.repository - end - - private - - def compare_result - @compare_result ||= CompareService.new.execute( - merge_request.author, - merge_request.source_project, - merge_request.source_branch, - merge_request.target_project, - merge_request.target_branch, - ) - end -end diff --git a/app/models/milestone.rb b/app/models/milestone.rb deleted file mode 100644 index 9bbb2bafb98..00000000000 --- a/app/models/milestone.rb +++ /dev/null @@ -1,93 +0,0 @@ -# == Schema Information -# -# Table name: milestones -# -# id :integer not null, primary key -# title :string(255) not null -# project_id :integer not null -# description :text -# due_date :date -# created_at :datetime -# updated_at :datetime -# state :string(255) -# iid :integer -# - -class Milestone < ActiveRecord::Base - include InternalId - include Sortable - - belongs_to :project - has_many :issues - has_many :merge_requests - has_many :participants, through: :issues, source: :assignee - - scope :active, -> { with_state(:active) } - scope :closed, -> { with_state(:closed) } - scope :of_projects, ->(ids) { where(project_id: ids) } - - validates :title, presence: true - validates :project, presence: true - - state_machine :state, initial: :active do - event :close do - transition active: :closed - end - - event :activate do - transition closed: :active - end - - state :closed - - state :active - end - - def expired? - if due_date - due_date.past? - else - false - end - end - - def open_items_count - self.issues.opened.count + self.merge_requests.opened.count - end - - def closed_items_count - self.issues.closed.count + self.merge_requests.closed.count - end - - def total_items_count - self.issues.count + self.merge_requests.count - end - - def percent_complete - ((closed_items_count * 100) / total_items_count).abs - rescue ZeroDivisionError - 100 - end - - def expires_at - if due_date - if due_date.past? - "expired at #{due_date.stamp("Aug 21, 2011")}" - else - "expires at #{due_date.stamp("Aug 21, 2011")}" - end - end - end - - def can_be_closed? - active? && issues.opened.count.zero? - end - - def is_empty? - total_items_count.zero? - end - - def author_id - nil - end -end diff --git a/app/models/network/commit.rb b/app/models/network/commit.rb deleted file mode 100644 index 8417f200e36..00000000000 --- a/app/models/network/commit.rb +++ /dev/null @@ -1,35 +0,0 @@ -module Network - class Commit - include ActionView::Helpers::TagHelper - - attr_accessor :time, :spaces, :parent_spaces - - def initialize(raw_commit) - @commit = raw_commit - @time = -1 - @spaces = [] - @parent_spaces = [] - end - - def method_missing(m, *args, &block) - @commit.send(m, *args, &block) - end - - def space - if @spaces.size > 0 - @spaces.first - else - 0 - end - end - - def parents(map) - @commit.parents.map do |p| - if map.include?(p.id) - map[p.id] - end - end - .compact - end - end -end diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb deleted file mode 100644 index f4e90125373..00000000000 --- a/app/models/network/graph.rb +++ /dev/null @@ -1,267 +0,0 @@ -module Network - class Graph - attr_reader :days, :commits, :map, :notes, :repo - - def self.max_count - @max_count ||= 650 - end - - def initialize(project, ref, commit, filter_ref) - @project = project - @ref = ref - @commit = commit - @filter_ref = filter_ref - @repo = project.repository - - @commits = collect_commits - @days = index_commits - @notes = collect_notes - end - - protected - - def collect_notes - h = Hash.new(0) - @project.notes.where('noteable_type = ?' ,"Commit").group('notes.commit_id').select('notes.commit_id, count(notes.id) as note_count').each do |item| - h[item.commit_id] = item.note_count.to_i - end - h - end - - # Get commits from repository - # - def collect_commits - find_commits(count_to_display_commit_in_center).map do |commit| - # Decorate with app/model/network/commit.rb - Network::Commit.new(commit) - end - end - - # Method is adding time and space on the - # list of commits. As well as returns date list - # correlated with time set on commits. - # - # @return [Array<TimeDate>] list of commit dates correlated with time on commits - def index_commits - days = [] - @map = {} - @reserved = {} - - @commits.each_with_index do |c,i| - c.time = i - days[i] = c.committed_date - @map[c.id] = c - @reserved[i] = [] - end - - commits_sort_by_ref.each do |commit| - place_chain(commit) - end - - # find parent spaces for not overlap lines - @commits.each do |c| - c.parent_spaces.concat(find_free_parent_spaces(c)) - end - - days - end - - # Skip count that the target commit is displayed in center. - def count_to_display_commit_in_center - offset = -1 - skip = 0 - while offset == -1 - tmp_commits = find_commits(skip) - if tmp_commits.size > 0 - index = tmp_commits.index do |c| - c.id == @commit.id - end - - if index - # Find the target commit - offset = index + skip - else - skip += self.class.max_count - end - else - # Can't find the target commit in the repo. - offset = 0 - end - end - - if self.class.max_count / 2 < offset then - # get max index that commit is displayed in the center. - offset - self.class.max_count / 2 - else - 0 - end - end - - def find_commits(skip = 0) - opts = { - max_count: self.class.max_count, - skip: skip - } - - opts[:ref] = @commit.id if @filter_ref - - @repo.find_commits(opts) - end - - def commits_sort_by_ref - @commits.sort do |a,b| - if include_ref?(a) - -1 - elsif include_ref?(b) - 1 - else - b.committed_date <=> a.committed_date - end - end - end - - def include_ref?(commit) - commit.ref_names(@repo).include?(@ref) - end - - def find_free_parent_spaces(commit) - spaces = [] - - commit.parents(@map).each do |parent| - range = commit.time..parent.time - - space = if commit.space >= parent.space then - find_free_parent_space(range, parent.space, -1, commit.space) - else - find_free_parent_space(range, commit.space, -1, parent.space) - end - - mark_reserved(range, space) - spaces << space - end - - spaces - end - - def find_free_parent_space(range, space_base, space_step, space_default) - if is_overlap?(range, space_default) then - find_free_space(range, space_step, space_base, space_default) - else - space_default - end - end - - def is_overlap?(range, overlap_space) - range.each do |i| - if i != range.first && - i != range.last && - @commits[i].spaces.include?(overlap_space) then - - return true; - end - end - - false - end - - # Add space mark on commit and its parents - # - # @param [::Commit] the commit object. - def place_chain(commit, parent_time = nil) - leaves = take_left_leaves(commit) - if leaves.empty? - return - end - - time_range = leaves.first.time..leaves.last.time - space_base = get_space_base(leaves) - space = find_free_space(time_range, 2, space_base) - leaves.each do |l| - l.spaces << space - end - - # and mark it as reserved - if parent_time.nil? - min_time = leaves.first.time - else - min_time = parent_time + 1 - end - - max_time = leaves.last.time - leaves.last.parents(@map).each do |parent| - if max_time < parent.time - max_time = parent.time - end - end - mark_reserved(min_time..max_time, space) - - # Visit branching chains - leaves.each do |l| - parents = l.parents(@map).select{|p| p.space.zero?} - for p in parents - place_chain(p, l.time) - end - end - end - - def get_space_base(leaves) - space_base = 1 - parents = leaves.last.parents(@map) - if parents.size > 0 - if parents.first.space > 0 - space_base = parents.first.space - end - end - space_base - end - - def mark_reserved(time_range, space) - for day in time_range - @reserved[day].push(space) - end - end - - def find_free_space(time_range, space_step, space_base = 1, space_default = nil) - space_default ||= space_base - - reserved = [] - for day in time_range - reserved.push(*@reserved[day]) - end - reserved.uniq! - - space = space_default - while reserved.include?(space) do - space += space_step - if space < space_base then - space_step *= -1 - space = space_base + space_step - end - end - - space - end - - # Takes most left subtree branch of commits - # which don't have space mark yet. - # - # @param [::Commit] the commit object. - # - # @return [Array<Network::Commit>] list of branch commits - def take_left_leaves(raw_commit) - commit = @map[raw_commit.id] - leaves = [] - leaves.push(commit) if commit.space.zero? - - while true - return leaves if commit.parents(@map).count.zero? - - commit = commit.parents(@map).first - - return leaves unless commit.space.zero? - - leaves.push(commit) - end - end - end -end diff --git a/app/models/note.rb b/app/models/note.rb deleted file mode 100644 index 2cf3fac2def..00000000000 --- a/app/models/note.rb +++ /dev/null @@ -1,609 +0,0 @@ -# == Schema Information -# -# Table name: notes -# -# id :integer not null, primary key -# note :text -# noteable_type :string(255) -# author_id :integer -# created_at :datetime -# updated_at :datetime -# project_id :integer -# attachment :string(255) -# line_code :string(255) -# commit_id :string(255) -# noteable_id :integer -# system :boolean default(FALSE), not null -# st_diff :text -# - -require 'carrierwave/orm/activerecord' -require 'file_size_validator' - -class Note < ActiveRecord::Base - include Mentionable - include Gitlab::CurrentSettings - - default_value_for :system, false - - attr_mentionable :note - - belongs_to :project - belongs_to :noteable, polymorphic: true - belongs_to :author, class_name: "User" - - delegate :name, to: :project, prefix: true - delegate :name, :email, to: :author, prefix: true - - validates :note, :project, presence: true - validates :line_code, format: { with: /\A[a-z0-9]+_\d+_\d+\Z/ }, allow_blank: true - # Attachments are deprecated and are handled by Markdown uploader - validates :attachment, file_size: { maximum: :max_attachment_size } - - validates :noteable_id, presence: true, if: ->(n) { n.noteable_type.present? && n.noteable_type != 'Commit' } - validates :commit_id, presence: true, if: ->(n) { n.noteable_type == 'Commit' } - - mount_uploader :attachment, AttachmentUploader - - # Scopes - scope :for_commit_id, ->(commit_id) { where(noteable_type: "Commit", commit_id: commit_id) } - scope :inline, ->{ where("line_code IS NOT NULL") } - scope :not_inline, ->{ where(line_code: [nil, '']) } - scope :system, ->{ where(system: true) } - scope :user, ->{ where(system: false) } - scope :common, ->{ where(noteable_type: ["", nil]) } - scope :fresh, ->{ order(created_at: :asc, id: :asc) } - scope :inc_author_project, ->{ includes(:project, :author) } - scope :inc_author, ->{ includes(:author) } - - serialize :st_diff - before_create :set_diff, if: ->(n) { n.line_code.present? } - after_update :set_references - - class << self - def create_status_change_note(noteable, project, author, status, source) - body = "Status changed to #{status}#{' by ' + source.gfm_reference if source}" - - create( - noteable: noteable, - project: project, - author: author, - note: body, - system: true - ) - end - - # +noteable+ was referenced from +mentioner+, by including GFM in either - # +mentioner+'s description or an associated Note. - # Create a system Note associated with +noteable+ with a GFM back-reference - # to +mentioner+. - def create_cross_reference_note(noteable, mentioner, author, project) - gfm_reference = mentioner_gfm_ref(noteable, mentioner, project) - - note_options = { - project: project, - author: author, - note: cross_reference_note_content(gfm_reference), - system: true - } - - if noteable.kind_of?(Commit) - note_options.merge!(noteable_type: 'Commit', commit_id: noteable.id) - else - note_options.merge!(noteable: noteable) - end - - create(note_options) unless cross_reference_disallowed?(noteable, mentioner) - end - - def create_milestone_change_note(noteable, project, author, milestone) - body = if milestone.nil? - 'Milestone removed' - else - "Milestone changed to #{milestone.title}" - end - - create( - noteable: noteable, - project: project, - author: author, - note: body, - system: true - ) - end - - def create_assignee_change_note(noteable, project, author, assignee) - body = assignee.nil? ? 'Assignee removed' : "Reassigned to @#{assignee.username}" - - create({ - noteable: noteable, - project: project, - author: author, - note: body, - system: true - }) - end - - def create_labels_change_note(noteable, project, author, added_labels, removed_labels) - labels_count = added_labels.count + removed_labels.count - added_labels = added_labels.map{ |label| "~#{label.id}" }.join(' ') - removed_labels = removed_labels.map{ |label| "~#{label.id}" }.join(' ') - message = '' - - if added_labels.present? - message << "added #{added_labels}" - end - - if added_labels.present? && removed_labels.present? - message << ' and ' - end - - if removed_labels.present? - message << "removed #{removed_labels}" - end - - message << ' ' << 'label'.pluralize(labels_count) - body = "#{message.capitalize}" - - create( - noteable: noteable, - project: project, - author: author, - note: body, - system: true - ) - end - - def create_new_commits_note(merge_request, project, author, new_commits, existing_commits = [], oldrev = nil) - total_count = new_commits.length + existing_commits.length - commits_text = ActionController::Base.helpers.pluralize(total_count, 'commit') - body = "Added #{commits_text}:\n\n" - - if existing_commits.length > 0 - commit_ids = - if existing_commits.length == 1 - existing_commits.first.short_id - else - if oldrev - "#{Commit.truncate_sha(oldrev)}...#{existing_commits.last.short_id}" - else - "#{existing_commits.first.short_id}..#{existing_commits.last.short_id}" - end - end - - commits_text = ActionController::Base.helpers.pluralize(existing_commits.length, 'commit') - - branch = - if merge_request.for_fork? - "#{merge_request.target_project_namespace}:#{merge_request.target_branch}" - else - merge_request.target_branch - end - - message = "* #{commit_ids} - #{commits_text} from branch `#{branch}`" - body << message - body << "\n" - end - - new_commits.each do |commit| - message = "* #{commit.short_id} - #{commit.title}" - body << message - body << "\n" - end - - create( - noteable: merge_request, - project: project, - author: author, - note: body, - system: true - ) - end - - def discussions_from_notes(notes) - discussion_ids = [] - discussions = [] - - notes.each do |note| - next if discussion_ids.include?(note.discussion_id) - - # don't group notes for the main target - if !note.for_diff_line? && note.noteable_type == "MergeRequest" - discussions << [note] - else - discussions << notes.select do |other_note| - note.discussion_id == other_note.discussion_id - end - discussion_ids << note.discussion_id - end - end - - discussions - end - - def build_discussion_id(type, id, line_code) - [:discussion, type.try(:underscore), id, line_code].join("-").to_sym - end - - # Determine if cross reference note should be created. - # eg. mentioning a commit in MR comments which exists inside a MR - # should not create "mentioned in" note. - def cross_reference_disallowed?(noteable, mentioner) - if mentioner.kind_of?(MergeRequest) - mentioner.commits.map(&:id).include? noteable.id - end - end - - # Determine whether or not a cross-reference note already exists. - def cross_reference_exists?(noteable, mentioner) - gfm_reference = mentioner_gfm_ref(noteable, mentioner) - notes = if noteable.is_a?(Commit) - where(commit_id: noteable.id) - else - where(noteable_id: noteable.id) - end - - notes.where('note like ?', cross_reference_note_pattern(gfm_reference)). - system.any? - end - - def search(query) - where("note like :query", query: "%#{query}%") - end - - def cross_reference_note_prefix - 'mentioned in ' - end - - private - - def cross_reference_note_content(gfm_reference) - cross_reference_note_prefix + "#{gfm_reference}" - end - - def cross_reference_note_pattern(gfm_reference) - # Older cross reference notes contained underscores for emphasis - "%" + cross_reference_note_content(gfm_reference) + "%" - end - - # Prepend the mentioner's namespaced project path to the GFM reference for - # cross-project references. For same-project references, return the - # unmodified GFM reference. - def mentioner_gfm_ref(noteable, mentioner, project = nil) - if mentioner.is_a?(Commit) - if project.nil? - return mentioner.gfm_reference.sub('commit ', 'commit %') - else - mentioning_project = project - end - else - mentioning_project = mentioner.project - end - - noteable_project_id = noteable_project_id(noteable, mentioning_project) - - full_gfm_reference(mentioning_project, noteable_project_id, mentioner) - end - - # Return the ID of the project that +noteable+ belongs to, or nil if - # +noteable+ is a commit and is not part of the project that owns - # +mentioner+. - def noteable_project_id(noteable, mentioning_project) - if noteable.is_a?(Commit) - if mentioning_project.repository.commit(noteable.id) - # The noteable commit belongs to the mentioner's project - mentioning_project.id - else - nil - end - else - noteable.project.id - end - end - - # Return the +mentioner+ GFM reference. If the mentioner and noteable - # projects are not the same, add the mentioning project's path to the - # returned value. - def full_gfm_reference(mentioning_project, noteable_project_id, mentioner) - if mentioning_project.id == noteable_project_id - mentioner.gfm_reference - else - if mentioner.is_a?(Commit) - mentioner.gfm_reference.sub( - /(commit )/, - "\\1#{mentioning_project.path_with_namespace}@" - ) - else - mentioner.gfm_reference.sub( - /(issue |merge request )/, - "\\1#{mentioning_project.path_with_namespace}" - ) - end - end - end - end - - def max_attachment_size - current_application_settings.max_attachment_size.megabytes.to_i - end - - def commit_author - @commit_author ||= - project.team.users.find_by(email: noteable.author_email) || - project.team.users.find_by(name: noteable.author_name) - rescue - nil - end - - def cross_reference? - note.start_with?(self.class.cross_reference_note_prefix) - end - - def find_diff - return nil unless noteable && noteable.diffs.present? - - @diff ||= noteable.diffs.find do |d| - Digest::SHA1.hexdigest(d.new_path) == diff_file_index if d.new_path - end - end - - def hook_attrs - attributes - end - - def set_diff - # First lets find notes with same diff - # before iterating over all mr diffs - diff = diff_for_line_code unless for_merge_request? - diff ||= find_diff - - self.st_diff = diff.to_hash if diff - end - - def diff - @diff ||= Gitlab::Git::Diff.new(st_diff) if st_diff.respond_to?(:map) - end - - def diff_for_line_code - Note.where(noteable_id: noteable_id, noteable_type: noteable_type, line_code: line_code).last.try(:diff) - end - - # Check if such line of code exists in merge request diff - # If exists - its active discussion - # If not - its outdated diff - def active? - return true unless self.diff - return false unless noteable - - noteable.diffs.each do |mr_diff| - next unless mr_diff.new_path == self.diff.new_path - - lines = Gitlab::Diff::Parser.new.parse(mr_diff.diff.lines.to_a) - - lines.each do |line| - if line.text == diff_line - return true - end - end - end - - false - end - - def outdated? - !active? - end - - def diff_file_index - line_code.split('_')[0] if line_code - end - - def diff_file_name - diff.new_path if diff - end - - def file_path - if diff.new_path.present? - diff.new_path - elsif diff.old_path.present? - diff.old_path - end - end - - def diff_old_line - line_code.split('_')[1].to_i if line_code - end - - def diff_new_line - line_code.split('_')[2].to_i if line_code - end - - def generate_line_code(line) - Gitlab::Diff::LineCode.generate(file_path, line.new_pos, line.old_pos) - end - - def diff_line - return @diff_line if @diff_line - - if diff - diff_lines.each do |line| - if generate_line_code(line) == self.line_code - @diff_line = line.text - end - end - end - - @diff_line - end - - def diff_line_type - return @diff_line_type if @diff_line_type - - if diff - diff_lines.each do |line| - if generate_line_code(line) == self.line_code - @diff_line_type = line.type - end - end - end - - @diff_line_type - end - - def truncated_diff_lines - max_number_of_lines = 16 - prev_match_line = nil - prev_lines = [] - - diff_lines.each do |line| - if line.type == "match" - prev_lines.clear - prev_match_line = line - else - prev_lines << line - - break if generate_line_code(line) == self.line_code - - prev_lines.shift if prev_lines.length >= max_number_of_lines - end - end - - prev_lines - end - - def diff_lines - @diff_lines ||= Gitlab::Diff::Parser.new.parse(diff.diff.lines.to_a) - end - - def discussion_id - @discussion_id ||= Note.build_discussion_id(noteable_type, noteable_id || commit_id, line_code) - end - - # Returns true if this is a downvote note, - # otherwise false is returned - def downvote? - votable? && (note.start_with?('-1') || - note.start_with?(':-1:') || - note.start_with?(':thumbsdown:') || - note.start_with?(':thumbs_down_sign:') - ) - end - - def for_commit? - noteable_type == "Commit" - end - - def for_commit_diff_line? - for_commit? && for_diff_line? - end - - def for_diff_line? - line_code.present? - end - - def for_issue? - noteable_type == "Issue" - end - - def for_merge_request? - noteable_type == "MergeRequest" - end - - def for_merge_request_diff_line? - for_merge_request? && for_diff_line? - end - - def for_project_snippet? - noteable_type == "Snippet" - end - - # override to return commits, which are not active record - def noteable - if for_commit? - project.repository.commit(commit_id) - else - super - end - # Temp fix to prevent app crash - # if note commit id doesn't exist - rescue - nil - end - - # Returns true if this is an upvote note, - # otherwise false is returned - def upvote? - votable? && (note.start_with?('+1') || - note.start_with?(':+1:') || - note.start_with?(':thumbsup:') || - note.start_with?(':thumbs_up_sign:') - ) - end - - def superceded?(notes) - return false unless vote? - - notes.each do |note| - next if note == self - - if note.vote? && - self[:author_id] == note[:author_id] && - self[:created_at] <= note[:created_at] - return true - end - end - - false - end - - def vote? - upvote? || downvote? - end - - def votable? - for_issue? || (for_merge_request? && !for_diff_line?) - end - - # Mentionable override. - def gfm_reference - noteable.gfm_reference - end - - # Mentionable override. - def local_reference - noteable - end - - def noteable_type_name - if noteable_type.present? - noteable_type.downcase - end - end - - # FIXME: Hack for polymorphic associations with STI - # For more information visit http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#label-Polymorphic+Associations - def noteable_type=(sType) - super(sType.to_s.classify.constantize.base_class.to_s) - end - - # Reset notes events cache - # - # Since we do cache @event we need to reset cache in special cases: - # * when a note is updated - # * when a note is removed - # Events cache stored like events/23-20130109142513. - # The cache key includes updated_at timestamp. - # Thus it will automatically generate a new fragment - # when the event is updated because the key changes. - def reset_events_cache - Event.reset_event_cache_for(self) - end - - def set_references - notice_added_references(project, author) - end - - def editable? - !read_attribute(:system) - end -end diff --git a/app/models/notification.rb b/app/models/notification.rb deleted file mode 100644 index 1395274173d..00000000000 --- a/app/models/notification.rb +++ /dev/null @@ -1,60 +0,0 @@ -class Notification - # - # Notification levels - # - N_DISABLED = 0 - N_PARTICIPATING = 1 - N_WATCH = 2 - N_GLOBAL = 3 - N_MENTION = 4 - - attr_accessor :target - - class << self - def notification_levels - [N_DISABLED, N_PARTICIPATING, N_WATCH, N_MENTION] - end - - def options_with_labels - { - disabled: N_DISABLED, - participating: N_PARTICIPATING, - watch: N_WATCH, - mention: N_MENTION, - global: N_GLOBAL - } - end - - def project_notification_levels - [N_DISABLED, N_PARTICIPATING, N_WATCH, N_GLOBAL, N_MENTION] - end - end - - def initialize(target) - @target = target - end - - def disabled? - target.notification_level == N_DISABLED - end - - def participating? - target.notification_level == N_PARTICIPATING - end - - def watch? - target.notification_level == N_WATCH - end - - def global? - target.notification_level == N_GLOBAL - end - - def mention? - target.notification_level == N_MENTION - end - - def level - target.notification_level - end -end diff --git a/app/models/personal_snippet.rb b/app/models/personal_snippet.rb deleted file mode 100644 index 9cee3b70cb3..00000000000 --- a/app/models/personal_snippet.rb +++ /dev/null @@ -1,19 +0,0 @@ -# == Schema Information -# -# Table name: snippets -# -# id :integer not null, primary key -# title :string(255) -# content :text -# author_id :integer not null -# project_id :integer -# created_at :datetime -# updated_at :datetime -# file_name :string(255) -# expires_at :datetime -# type :string(255) -# visibility_level :integer default(0), not null -# - -class PersonalSnippet < Snippet -end diff --git a/app/models/project_services/asana_service.rb b/app/models/project_services/asana_service.rb deleted file mode 100644 index e6e16058d41..00000000000 --- a/app/models/project_services/asana_service.rb +++ /dev/null @@ -1,127 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# -require 'asana' - -class AsanaService < Service - prop_accessor :api_key, :restrict_to_branch - validates :api_key, presence: true, if: :activated? - - def title - 'Asana' - end - - def description - 'Asana - Teamwork without email' - end - - def help - 'This service adds commit messages as comments to Asana tasks. -Once enabled, commit messages are checked for Asana task URLs -(for example, `https://app.asana.com/0/123456/987654`) or task IDs -starting with # (for example, `#987654`). Every task ID found will -get the commit comment added to it. - -You can also close a task with a message containing: `fix #123456`. - -You can find your Api Keys here: -http://developer.asana.com/documentation/#api_keys' - end - - def to_param - 'asana' - end - - def fields - [ - { - type: 'text', - name: 'api_key', - placeholder: 'User API token. User must have access to task, -all comments will be attributed to this user.' - }, - { - type: 'text', - name: 'restrict_to_branch', - placeholder: 'Comma-separated list of branches which will be -automatically inspected. Leave blank to include all branches.' - } - ] - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - Asana.configure do |client| - client.api_key = api_key - end - - user = data[:user_name] - branch = Gitlab::Git.ref_name(data[:ref]) - - branch_restriction = restrict_to_branch.to_s - - # check the branch restriction is poplulated and branch is not included - if branch_restriction.length > 0 && branch_restriction.index(branch).nil? - return - end - - project_name = project.name_with_namespace - push_msg = user + ' pushed to branch ' + branch + ' of ' + project_name - - data[:commits].each do |commit| - check_commit(' ( ' + commit[:url] + ' ): ' + commit[:message], push_msg) - end - end - - def check_commit(message, push_msg) - task_list = [] - close_list = [] - - message.split("\n").each do |line| - # look for a task ID or a full Asana url - task_list.concat(line.scan(/#(\d+)/)) - task_list.concat(line.scan(/https:\/\/app\.asana\.com\/\d+\/\d+\/(\d+)/)) - # look for a word starting with 'fix' followed by a task ID - close_list.concat(line.scan(/(fix\w*)\W*#(\d+)/i)) - end - - # post commit to every taskid found - task_list.each do |taskid| - task = Asana::Task.find(taskid[0]) - - if task - task.create_story(text: push_msg + ' ' + message) - end - end - - # close all tasks that had 'fix(ed/es/ing) #:id' in them - close_list.each do |taskid| - task = Asana::Task.find(taskid.last) - - if task - task.modify(completed: true) - end - end - end -end diff --git a/app/models/project_services/assembla_service.rb b/app/models/project_services/assembla_service.rb deleted file mode 100644 index fb7e0c0fb0d..00000000000 --- a/app/models/project_services/assembla_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class AssemblaService < Service - include HTTParty - - prop_accessor :token, :subdomain - validates :token, presence: true, if: :activated? - - def title - 'Assembla' - end - - def description - 'Project Management Software (Source Commits Endpoint)' - end - - def to_param - 'assembla' - end - - def fields - [ - { type: 'text', name: 'token', placeholder: '' }, - { type: 'text', name: 'subdomain', placeholder: '' } - ] - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - url = "https://atlas.assembla.com/spaces/#{subdomain}/github_tool?secret_key=#{token}" - AssemblaService.post(url, body: { payload: data }.to_json, headers: { 'Content-Type' => 'application/json' }) - end -end diff --git a/app/models/project_services/bamboo_service.rb b/app/models/project_services/bamboo_service.rb deleted file mode 100644 index d8aedbd2ab4..00000000000 --- a/app/models/project_services/bamboo_service.rb +++ /dev/null @@ -1,137 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class BambooService < CiService - include HTTParty - - prop_accessor :bamboo_url, :build_key, :username, :password - - validates :bamboo_url, - presence: true, - format: { with: /\A#{URI.regexp}\z/ }, - if: :activated? - validates :build_key, presence: true, if: :activated? - validates :username, - presence: true, - if: ->(service) { service.password? }, - if: :activated? - validates :password, - presence: true, - if: ->(service) { service.username? }, - if: :activated? - - attr_accessor :response - - after_save :compose_service_hook, if: :activated? - - def compose_service_hook - hook = service_hook || build_service_hook - hook.save - end - - def title - 'Atlassian Bamboo CI' - end - - def description - 'A continuous integration and build server' - end - - def help - 'You must set up automatic revision labeling and a repository trigger in Bamboo.' - end - - def to_param - 'bamboo' - end - - def fields - [ - { type: 'text', name: 'bamboo_url', - placeholder: 'Bamboo root URL like https://bamboo.example.com' }, - { type: 'text', name: 'build_key', - placeholder: 'Bamboo build plan key like KEY' }, - { type: 'text', name: 'username', - placeholder: 'A user with API access, if applicable' }, - { type: 'password', name: 'password' }, - ] - end - - def supported_events - %w(push) - end - - def build_info(sha) - url = URI.parse("#{bamboo_url}/rest/api/latest/result?label=#{sha}") - - if username.blank? && password.blank? - @response = HTTParty.get(parsed_url.to_s, verify: false) - else - get_url = "#{url}&os_authType=basic" - auth = { - username: username, - password: password, - } - @response = HTTParty.get(get_url, verify: false, basic_auth: auth) - end - end - - def build_page(sha, ref) - build_info(sha) if @response.nil? || !@response.code - - if @response.code != 200 || @response['results']['results']['size'] == '0' - # If actual build link can't be determined, send user to build summary page. - "#{bamboo_url}/browse/#{build_key}" - else - # If actual build link is available, go to build result page. - result_key = @response['results']['results']['result']['planResultKey']['key'] - "#{bamboo_url}/browse/#{result_key}" - end - end - - def commit_status(sha, ref) - build_info(sha) if @response.nil? || !@response.code - return :error unless @response.code == 200 || @response.code == 404 - - status = if @response.code == 404 || @response['results']['results']['size'] == '0' - 'Pending' - else - @response['results']['results']['result']['buildState'] - end - - if status.include?('Success') - 'success' - elsif status.include?('Failed') - 'failed' - elsif status.include?('Pending') - 'pending' - else - :error - end - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - # Bamboo requires a GET and does not take any data. - self.class.get("#{bamboo_url}/updateAndBuild.action?buildKey=#{build_key}", - verify: false) - end -end diff --git a/app/models/project_services/buildkite_service.rb b/app/models/project_services/buildkite_service.rb deleted file mode 100644 index a714bc82246..00000000000 --- a/app/models/project_services/buildkite_service.rb +++ /dev/null @@ -1,135 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -require "addressable/uri" - -class BuildkiteService < CiService - ENDPOINT = "https://buildkite.com" - - prop_accessor :project_url, :token - - validates :project_url, presence: true, if: :activated? - validates :token, presence: true, if: :activated? - - after_save :compose_service_hook, if: :activated? - - def webhook_url - "#{buildkite_endpoint('webhook')}/deliver/#{webhook_token}" - end - - def compose_service_hook - hook = service_hook || build_service_hook - hook.url = webhook_url - hook.save - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - service_hook.execute(data) - end - - def commit_status(sha, ref) - response = HTTParty.get(commit_status_path(sha), verify: false) - - if response.code == 200 && response['status'] - response['status'] - else - :error - end - end - - def commit_status_path(sha) - "#{buildkite_endpoint('gitlab')}/status/#{status_token}.json?commit=#{sha}" - end - - def build_page(sha, ref) - "#{project_url}/builds?commit=#{sha}" - end - - def builds_path - "#{project_url}/builds?branch=#{project.default_branch}" - end - - def status_img_path - "#{buildkite_endpoint('badge')}/#{status_token}.svg" - end - - def title - 'Buildkite' - end - - def description - 'Continuous integration and deployments' - end - - def to_param - 'buildkite' - end - - def fields - [ - { type: 'text', - name: 'token', - placeholder: 'Buildkite project GitLab token' }, - - { type: 'text', - name: 'project_url', - placeholder: "#{ENDPOINT}/example/project" } - ] - end - - private - - def webhook_token - token_parts.first - end - - def status_token - token_parts.second - end - - def token_parts - if token.present? - token.split(':') - else - [] - end - end - - def buildkite_endpoint(subdomain = nil) - if subdomain.present? - uri = Addressable::URI.parse(ENDPOINT) - new_endpoint = "#{uri.scheme || 'http'}://#{subdomain}.#{uri.host}" - - if uri.port.present? - "#{new_endpoint}:#{uri.port}" - else - new_endpoint - end - else - ENDPOINT - end - end -end diff --git a/app/models/project_services/campfire_service.rb b/app/models/project_services/campfire_service.rb deleted file mode 100644 index e591afdda64..00000000000 --- a/app/models/project_services/campfire_service.rb +++ /dev/null @@ -1,86 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class CampfireService < Service - prop_accessor :token, :subdomain, :room - validates :token, presence: true, if: :activated? - - def title - 'Campfire' - end - - def description - 'Simple web-based real-time group chat' - end - - def to_param - 'campfire' - end - - def fields - [ - { type: 'text', name: 'token', placeholder: '' }, - { type: 'text', name: 'subdomain', placeholder: '' }, - { type: 'text', name: 'room', placeholder: '' } - ] - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - room = gate.find_room_by_name(self.room) - return true unless room - - message = build_message(data) - - room.speak(message) - end - - private - - def gate - @gate ||= Tinder::Campfire.new(subdomain, token: token) - end - - def build_message(push) - ref = Gitlab::Git.ref_name(push[:ref]) - before = push[:before] - after = push[:after] - - message = "" - message << "[#{project.name_with_namespace}] " - message << "#{push[:user_name]} " - - if Gitlab::Git.blank_ref?(before) - message << "pushed new branch #{ref} \n" - elsif Gitlab::Git.blank_ref?(after) - message << "removed branch #{ref} \n" - else - message << "pushed #{push[:total_commits_count]} commits to #{ref}. " - message << "#{project.web_url}/compare/#{before}...#{after}" - end - - message - end -end diff --git a/app/models/project_services/ci_service.rb b/app/models/project_services/ci_service.rb deleted file mode 100644 index 1a36e439245..00000000000 --- a/app/models/project_services/ci_service.rb +++ /dev/null @@ -1,57 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -# Base class for CI services -# List methods you need to implement to get your CI service -# working with GitLab Merge Requests -class CiService < Service - def category - :ci - end - - def supported_events - %w(push) - end - - # Return complete url to build page - # - # Ex. - # http://jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c - # - def build_page(sha, ref) - # implement inside child - end - - # Return string with build status or :error symbol - # - # Allowed states: 'success', 'failed', 'running', 'pending' - # - # - # Ex. - # @service.commit_status('13be4ac') - # # => 'success' - # - # @service.commit_status('2abe4ac') - # # => 'running' - # - # - def commit_status(sha, ref) - # implement inside child - end -end diff --git a/app/models/project_services/custom_issue_tracker_service.rb b/app/models/project_services/custom_issue_tracker_service.rb deleted file mode 100644 index 8d25f627870..00000000000 --- a/app/models/project_services/custom_issue_tracker_service.rb +++ /dev/null @@ -1,57 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -class CustomIssueTrackerService < IssueTrackerService - - prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url - - def title - if self.properties && self.properties['title'].present? - self.properties['title'] - else - 'Custom Issue Tracker' - end - end - - def description - if self.properties && self.properties['description'].present? - self.properties['description'] - else - 'Custom issue tracker' - end - end - - def to_param - 'custom_issue_tracker' - end - - def fields - [ - { type: 'text', name: 'title', placeholder: title }, - { type: 'text', name: 'description', placeholder: description }, - { type: 'text', name: 'project_url', placeholder: 'Project url' }, - { type: 'text', name: 'issues_url', placeholder: 'Issue url' }, - { type: 'text', name: 'new_issue_url', placeholder: 'New Issue url' } - ] - end - - def initialize_properties - self.properties = {} if properties.nil? - end -end diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb deleted file mode 100644 index 6f6e5950aab..00000000000 --- a/app/models/project_services/emails_on_push_service.rb +++ /dev/null @@ -1,72 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -class EmailsOnPushService < Service - prop_accessor :send_from_committer_email - prop_accessor :disable_diffs - prop_accessor :recipients - validates :recipients, presence: true, if: :activated? - - def title - 'Emails on push' - end - - def description - 'Email the commits and diff of each push to a list of recipients.' - end - - def to_param - 'emails_on_push' - end - - def supported_events - %w(push tag_push) - end - - def execute(push_data) - return unless supported_events.include?(push_data[:object_kind]) - - EmailsOnPushWorker.perform_async( - project_id, - recipients, - push_data, - send_from_committer_email: send_from_committer_email?, - disable_diffs: disable_diffs? - ) - end - - def send_from_committer_email? - self.send_from_committer_email == "1" - end - - def disable_diffs? - self.disable_diffs == "1" - end - - def fields - domains = Notify.allowed_email_domains.map { |domain| "user@#{domain}" }.join(", ") - [ - { type: 'checkbox', name: 'send_from_committer_email', title: "Send from committer", - help: "Send notifications from the committer's email address if the domain is part of the domain GitLab is running on (e.g. #{domains})." }, - { type: 'checkbox', name: 'disable_diffs', title: "Disable code diffs", - help: "Don't include possibly sensitive code diffs in notification body." }, - { type: 'textarea', name: 'recipients', placeholder: 'Emails separated by whitespace' }, - ] - end -end diff --git a/app/models/project_services/external_wiki_service.rb b/app/models/project_services/external_wiki_service.rb deleted file mode 100644 index a199d0e86f2..00000000000 --- a/app/models/project_services/external_wiki_service.rb +++ /dev/null @@ -1,48 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer not null -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# - -class ExternalWikiService < Service - include HTTParty - - prop_accessor :external_wiki_url - validates :external_wiki_url, - presence: true, - format: { with: /\A#{URI.regexp}\z/ }, - if: :activated? - - def title - 'External Wiki' - end - - def description - 'Replaces the link to the internal wiki with a link to an external wiki.' - end - - def to_param - 'external_wiki' - end - - def fields - [ - { type: 'text', name: 'external_wiki_url', placeholder: 'The URL of the external Wiki' }, - ] - end - - def execute(_data) - @response = HTTParty.get(properties['external_wiki_url'], verify: true) rescue nil - if @response !=200 - nil - end - end -end diff --git a/app/models/project_services/flowdock_service.rb b/app/models/project_services/flowdock_service.rb deleted file mode 100644 index 99e361dd6ed..00000000000 --- a/app/models/project_services/flowdock_service.rb +++ /dev/null @@ -1,62 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -require "flowdock-git-hook" - -class FlowdockService < Service - prop_accessor :token - validates :token, presence: true, if: :activated? - - def title - 'Flowdock' - end - - def description - 'Flowdock is a collaboration web app for technical teams.' - end - - def to_param - 'flowdock' - end - - def fields - [ - { type: 'text', name: 'token', placeholder: '' } - ] - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - Flowdock::Git.post( - data[:ref], - data[:before], - data[:after], - token: token, - repo: project.repository.path_to_repo, - repo_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}", - commit_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/%s", - diff_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/compare/%s...%s", - ) - end -end diff --git a/app/models/project_services/gemnasium_service.rb b/app/models/project_services/gemnasium_service.rb deleted file mode 100644 index 4e75bdfc953..00000000000 --- a/app/models/project_services/gemnasium_service.rb +++ /dev/null @@ -1,61 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -require "gemnasium/gitlab_service" - -class GemnasiumService < Service - prop_accessor :token, :api_key - validates :token, :api_key, presence: true, if: :activated? - - def title - 'Gemnasium' - end - - def description - 'Gemnasium monitors your project dependencies and alerts you about updates and security vulnerabilities.' - end - - def to_param - 'gemnasium' - end - - def fields - [ - { type: 'text', name: 'api_key', placeholder: 'Your personal API KEY on gemnasium.com ' }, - { type: 'text', name: 'token', placeholder: 'The project\'s slug on gemnasium.com' } - ] - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - Gemnasium::GitlabService.execute( - ref: data[:ref], - before: data[:before], - after: data[:after], - token: token, - api_key: api_key, - repo: project.repository.path_to_repo - ) - end -end diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb deleted file mode 100644 index 0f9838a575d..00000000000 --- a/app/models/project_services/gitlab_ci_service.rb +++ /dev/null @@ -1,128 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -class GitlabCiService < CiService - API_PREFIX = "api/v1" - - prop_accessor :project_url, :token - validates :project_url, presence: true, if: :activated? - validates :token, presence: true, if: :activated? - - after_save :compose_service_hook, if: :activated? - - def compose_service_hook - hook = service_hook || build_service_hook - hook.url = [project_url, "/build", "?token=#{token}"].join("") - hook.save - end - - def supported_events - %w(push tag_push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - service_hook.execute(data) - end - - def commit_status_path(sha, ref) - project_url + "/refs/#{ref}/commits/#{sha}/status.json?token=#{token}" - end - - def get_ci_build(sha, ref) - @ci_builds ||= {} - @ci_builds[sha] ||= HTTParty.get(commit_status_path(sha, ref), verify: false) - end - - def commit_status(sha, ref) - response = get_ci_build(sha, ref) - - if response.code == 200 and response["status"] - response["status"] - else - :error - end - end - - def fork_registration(new_project, private_token) - params = { - id: new_project.id, - name_with_namespace: new_project.name_with_namespace, - web_url: new_project.web_url, - default_branch: new_project.default_branch, - ssh_url_to_repo: new_project.ssh_url_to_repo - } - - HTTParty.post( - fork_registration_path, - body: { - project_id: project.id, - project_token: token, - private_token: private_token, - data: params }, - verify: false - ) - end - - def commit_coverage(sha, ref) - response = get_ci_build(sha, ref) - - if response.code == 200 and response["coverage"] - response["coverage"] - end - end - - def build_page(sha, ref) - project_url + "/refs/#{ref}/commits/#{sha}" - end - - def builds_path - project_url + "?ref=" + project.default_branch - end - - def status_img_path - project_url + "/status.png?ref=" + project.default_branch - end - - def title - 'GitLab CI' - end - - def description - 'Continuous integration server from GitLab' - end - - def to_param - 'gitlab_ci' - end - - def fields - [ - { type: 'text', name: 'token', placeholder: 'GitLab CI project specific token' }, - { type: 'text', name: 'project_url', placeholder: 'http://ci.gitlabhq.com/projects/3' } - ] - end - - private - - def fork_registration_path - project_url.sub(/projects\/\d*/, "#{API_PREFIX}/forks") - end -end diff --git a/app/models/project_services/gitlab_issue_tracker_service.rb b/app/models/project_services/gitlab_issue_tracker_service.rb deleted file mode 100644 index 5f0553f3b0b..00000000000 --- a/app/models/project_services/gitlab_issue_tracker_service.rb +++ /dev/null @@ -1,62 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class GitlabIssueTrackerService < IssueTrackerService - include Rails.application.routes.url_helpers - - default_url_options[:host] = Gitlab.config.gitlab.host - default_url_options[:protocol] = Gitlab.config.gitlab.protocol - default_url_options[:port] = Gitlab.config.gitlab.port unless Gitlab.config.gitlab_on_standard_port? - default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root - - prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url - - def default? - true - end - - def to_param - 'gitlab' - end - - def project_url - namespace_project_issues_url(project.namespace, project) - end - - def new_issue_url - new_namespace_project_issue_url(namespace_id: project.namespace, project_id: project) - end - - def issue_url(iid) - namespace_project_issue_url(namespace_id: project.namespace, project_id: project, id: iid) - end - - def project_path - namespace_project_issues_path(project.namespace, project) - end - - def new_issue_path - new_namespace_project_issue_path(namespace_id: project.namespace, project_id: project) - end - - def issue_path(iid) - namespace_project_issue_path(namespace_id: project.namespace, project_id: project, id: iid) - end -end diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb deleted file mode 100644 index d264a56ebdf..00000000000 --- a/app/models/project_services/hipchat_service.rb +++ /dev/null @@ -1,238 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -class HipchatService < Service - MAX_COMMITS = 3 - - prop_accessor :token, :room, :server - validates :token, presence: true, if: :activated? - - def title - 'HipChat' - end - - def description - 'Private group chat and IM' - end - - def to_param - 'hipchat' - end - - def fields - [ - { type: 'text', name: 'token', placeholder: 'Room token' }, - { type: 'text', name: 'room', placeholder: 'Room name or ID' }, - { type: 'text', name: 'server', - placeholder: 'Leave blank for default. https://hipchat.example.com' } - ] - end - - def supported_events - %w(push issue merge_request note tag_push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - gate[room].send('GitLab', create_message(data)) - end - - private - - def gate - options = { api_version: 'v2' } - options[:server_url] = server unless server.blank? - @gate ||= HipChat::Client.new(token, options) - end - - def create_message(data) - object_kind = data[:object_kind] - - message = \ - case object_kind - when "push", "tag_push" - create_push_message(data) - when "issue" - create_issue_message(data) unless is_update?(data) - when "merge_request" - create_merge_request_message(data) unless is_update?(data) - when "note" - create_note_message(data) - end - end - - def create_push_message(push) - ref_type = Gitlab::Git.tag_ref?(push[:ref]) ? 'tag' : 'branch' - ref = Gitlab::Git.ref_name(push[:ref]) - - before = push[:before] - after = push[:after] - - message = "" - message << "#{push[:user_name]} " - if Gitlab::Git.blank_ref?(before) - message << "pushed new #{ref_type} <a href=\""\ - "#{project_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\ - " to #{project_link}\n" - elsif Gitlab::Git.blank_ref?(after) - message << "removed #{ref_type} <b>#{ref}</b> from <a href=\"#{project.web_url}\">#{project_name}</a> \n" - else - message << "pushed to #{ref_type} <a href=\""\ - "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a> " - message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> " - message << "(<a href=\"#{project.web_url}/compare/#{before}...#{after}\">Compare changes</a>)" - - push[:commits].take(MAX_COMMITS).each do |commit| - message << "<br /> - #{commit[:message].lines.first} (<a href=\"#{commit[:url]}\">#{commit[:id][0..5]}</a>)" - end - - if push[:commits].count > MAX_COMMITS - message << "<br />... #{push[:commits].count - MAX_COMMITS} more commits" - end - end - - message - end - - def format_body(body) - if body - body = body.truncate(200, separator: ' ', omission: '...') - end - - "<pre>#{body}</pre>" - end - - def create_issue_message(data) - user_name = data[:user][:name] - - obj_attr = data[:object_attributes] - obj_attr = HashWithIndifferentAccess.new(obj_attr) - title = obj_attr[:title] - state = obj_attr[:state] - issue_iid = obj_attr[:iid] - issue_url = obj_attr[:url] - description = obj_attr[:description] - - issue_link = "<a href=\"#{issue_url}\">issue ##{issue_iid}</a>" - message = "#{user_name} #{state} #{issue_link} in #{project_link}: <b>#{title}</b>" - - if description - description = format_body(description) - message << description - end - - message - end - - def create_merge_request_message(data) - user_name = data[:user][:name] - - obj_attr = data[:object_attributes] - obj_attr = HashWithIndifferentAccess.new(obj_attr) - merge_request_id = obj_attr[:iid] - source_branch = obj_attr[:source_branch] - target_branch = obj_attr[:target_branch] - state = obj_attr[:state] - description = obj_attr[:description] - title = obj_attr[:title] - - merge_request_url = "#{project_url}/merge_requests/#{merge_request_id}" - merge_request_link = "<a href=\"#{merge_request_url}\">merge request ##{merge_request_id}</a>" - message = "#{user_name} #{state} #{merge_request_link} in " \ - "#{project_link}: <b>#{title}</b>" - - if description - description = format_body(description) - message << description - end - - message - end - - def format_title(title) - "<b>" + title.lines.first.chomp + "</b>" - end - - def create_note_message(data) - data = HashWithIndifferentAccess.new(data) - user_name = data[:user][:name] - - repo_attr = HashWithIndifferentAccess.new(data[:repository]) - - obj_attr = HashWithIndifferentAccess.new(data[:object_attributes]) - note = obj_attr[:note] - note_url = obj_attr[:url] - noteable_type = obj_attr[:noteable_type] - - case noteable_type - when "Commit" - commit_attr = HashWithIndifferentAccess.new(data[:commit]) - subject_desc = commit_attr[:id] - subject_desc = Commit.truncate_sha(subject_desc) - subject_type = "commit" - title = format_title(commit_attr[:message]) - when "Issue" - subj_attr = HashWithIndifferentAccess.new(data[:issue]) - subject_id = subj_attr[:iid] - subject_desc = "##{subject_id}" - subject_type = "issue" - title = format_title(subj_attr[:title]) - when "MergeRequest" - subj_attr = HashWithIndifferentAccess.new(data[:merge_request]) - subject_id = subj_attr[:iid] - subject_desc = "##{subject_id}" - subject_type = "merge request" - title = format_title(subj_attr[:title]) - when "Snippet" - subj_attr = HashWithIndifferentAccess.new(data[:snippet]) - subject_id = subj_attr[:id] - subject_desc = "##{subject_id}" - subject_type = "snippet" - title = format_title(subj_attr[:title]) - end - - subject_html = "<a href=\"#{note_url}\">#{subject_type} #{subject_desc}</a>" - message = "#{user_name} commented on #{subject_html} in #{project_link}: " - message << title - - if note - note = format_body(note) - message << note - end - - message - end - - def project_name - project.name_with_namespace.gsub(/\s/, '') - end - - def project_url - project.web_url - end - - def project_link - "<a href=\"#{project_url}\">#{project_name}</a>" - end - - def is_update?(data) - data[:object_attributes][:action] == 'update' - end -end diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb deleted file mode 100644 index e9e1e276e7d..00000000000 --- a/app/models/project_services/irker_service.rb +++ /dev/null @@ -1,163 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -require 'uri' - -class IrkerService < Service - prop_accessor :colorize_messages, :recipients, :channels - validates :recipients, presence: true, if: :activated? - validate :check_recipients_count, if: :activated? - - before_validation :get_channels - after_initialize :initialize_settings - - # Writer for RSpec tests - attr_writer :settings - - def initialize_settings - # See the documentation (doc/project_services/irker.md) for possible values - # here - @settings ||= { - server_ip: 'localhost', - server_port: 6659, - max_channels: 3, - default_irc_uri: nil - } - end - - def title - 'Irker (IRC gateway)' - end - - def description - 'Send IRC messages, on update, to a list of recipients through an Irker '\ - 'gateway.' - end - - def help - msg = 'Recipients have to be specified with a full URI: '\ - 'irc[s]://irc.network.net[:port]/#channel. Special cases: if you want '\ - 'the channel to be a nickname instead, append ",isnick" to the channel '\ - 'name; if the channel is protected by a secret password, append '\ - '"?key=secretpassword" to the URI.' - - unless @settings[:default_irc].nil? - msg += ' Note that a default IRC URI is provided by this service\'s '\ - "administrator: #{default_irc}. You can thus just give a channel name." - end - msg - end - - def to_param - 'irker' - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - IrkerWorker.perform_async(project_id, channels, - colorize_messages, data, @settings) - end - - def fields - [ - { type: 'textarea', name: 'recipients', - placeholder: 'Recipients/channels separated by whitespaces' }, - { type: 'checkbox', name: 'colorize_messages' }, - ] - end - - private - - def check_recipients_count - return true if recipients.nil? || recipients.empty? - - if recipients.split(/\s+/).count > max_chans - errors.add(:recipients, "are limited to #{max_chans}") - end - end - - def max_chans - @settings[:max_channels] - end - - def get_channels - return true unless :activated? - return true if recipients.nil? || recipients.empty? - - map_recipients - - errors.add(:recipients, 'are all invalid') if channels.empty? - true - end - - def map_recipients - self.channels = recipients.split(/\s+/).map do |recipient| - format_channel default_irc_uri, recipient - end - channels.reject! &:nil? - end - - def default_irc_uri - default_irc = @settings[:default_irc_uri] - if !(default_irc.nil? || default_irc[-1] == '/') - default_irc += '/' - end - default_irc - end - - def format_channel(default_irc, recipient) - cnt = 0 - url = nil - - # Try to parse the chan as a full URI - begin - uri = URI.parse(recipient) - raise URI::InvalidURIError if uri.scheme.nil? && cnt == 0 - rescue URI::InvalidURIError - unless default_irc.nil? - cnt += 1 - recipient = "#{default_irc}#{recipient}" - retry if cnt == 1 - end - else - url = consider_uri uri - end - url - end - - def consider_uri(uri) - # Authorize both irc://domain.com/#chan and irc://domain.com/chan - if uri.is_a?(URI) && uri.scheme[/^ircs?\z/] && !uri.path.nil? - # Do not authorize irc://domain.com/ - if uri.fragment.nil? && uri.path.length > 1 - uri.to_s - else - # Authorize irc://domain.com/smthg#chan - # The irker daemon will deal with it by concatenating smthg and - # chan, thus sending messages on #smthgchan - uri.to_s - end - end - end -end diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb deleted file mode 100644 index c8ab9d63b74..00000000000 --- a/app/models/project_services/issue_tracker_service.rb +++ /dev/null @@ -1,125 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class IssueTrackerService < Service - - validates :project_url, :issues_url, :new_issue_url, presence: true, if: :activated? - - def category - :issue_tracker - end - - def default? - false - end - - def issue_url(iid) - self.issues_url.gsub(':id', iid.to_s) - end - - def project_path - project_url - end - - def new_issue_path - new_issue_url - end - - def issue_path(iid) - issue_url(iid) - end - - def fields - [ - { type: 'text', name: 'description', placeholder: description }, - { type: 'text', name: 'project_url', placeholder: 'Project url' }, - { type: 'text', name: 'issues_url', placeholder: 'Issue url' }, - { type: 'text', name: 'new_issue_url', placeholder: 'New Issue url' } - ] - end - - def initialize_properties - if properties.nil? - if enabled_in_gitlab_config - self.properties = { - title: issues_tracker['title'], - project_url: add_issues_tracker_id(issues_tracker['project_url']), - issues_url: add_issues_tracker_id(issues_tracker['issues_url']), - new_issue_url: add_issues_tracker_id(issues_tracker['new_issue_url']) - } - else - self.properties = {} - end - end - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - message = "#{self.type} was unable to reach #{self.project_url}. Check the url and try again." - result = false - - begin - url = URI.parse(self.project_url) - - if url.host && url.port - http = Net::HTTP.start(url.host, url.port, { open_timeout: 5, read_timeout: 5 }) - response = http.head("/") - - if response - message = "#{self.type} received response #{response.code} when attempting to connect to #{self.project_url}" - result = true - end - end - rescue Timeout::Error, SocketError, Errno::ECONNRESET, Errno::ECONNREFUSED => error - message = "#{self.type} had an error when trying to connect to #{self.project_url}: #{error.message}" - end - Rails.logger.info(message) - result - end - - private - - def enabled_in_gitlab_config - Gitlab.config.issues_tracker && - Gitlab.config.issues_tracker.values.any? && - issues_tracker - end - - def issues_tracker - Gitlab.config.issues_tracker[to_param] - end - - def add_issues_tracker_id(url) - if self.project - id = self.project.issues_tracker_id - - if id - url = url.gsub(":issues_tracker_id", id) - end - end - - url - end -end diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb deleted file mode 100644 index fcd9dc2f336..00000000000 --- a/app/models/project_services/jira_service.rb +++ /dev/null @@ -1,58 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class JiraService < IssueTrackerService - include Rails.application.routes.url_helpers - - prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url - - def help - issue_tracker_link = help_page_path("integration", "external-issue-tracker") - - line1 = "Setting `project_url`, `issues_url` and `new_issue_url` will "\ - "allow a user to easily navigate to the Jira issue tracker. "\ - "See the [integration doc](#{issue_tracker_link}) for details." - - line2 = 'Support for referencing commits and automatic closing of Jira issues directly ' \ - 'from GitLab is [available in GitLab EE.](http://doc.gitlab.com/ee/integration/jira.html)' - - [line1, line2].join("\n\n") - end - - def title - if self.properties && self.properties['title'].present? - self.properties['title'] - else - 'JIRA' - end - end - - def description - if self.properties && self.properties['description'].present? - self.properties['description'] - else - 'Jira issue tracker' - end - end - - def to_param - 'jira' - end -end diff --git a/app/models/project_services/pivotaltracker_service.rb b/app/models/project_services/pivotaltracker_service.rb deleted file mode 100644 index ade9ee97873..00000000000 --- a/app/models/project_services/pivotaltracker_service.rb +++ /dev/null @@ -1,72 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class PivotaltrackerService < Service - include HTTParty - - prop_accessor :token - validates :token, presence: true, if: :activated? - - def title - 'PivotalTracker' - end - - def description - 'Project Management Software (Source Commits Endpoint)' - end - - def to_param - 'pivotaltracker' - end - - def fields - [ - { type: 'text', name: 'token', placeholder: '' } - ] - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - url = 'https://www.pivotaltracker.com/services/v5/source_commits' - data[:commits].each do |commit| - message = { - 'source_commit' => { - 'commit_id' => commit[:id], - 'author' => commit[:author][:name], - 'url' => commit[:url], - 'message' => commit[:message] - } - } - PivotaltrackerService.post( - url, - body: message.to_json, - headers: { - 'Content-Type' => 'application/json', - 'X-TrackerToken' => token - } - ) - end - end -end diff --git a/app/models/project_services/pushover_service.rb b/app/models/project_services/pushover_service.rb deleted file mode 100644 index 53edf522e9a..00000000000 --- a/app/models/project_services/pushover_service.rb +++ /dev/null @@ -1,125 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class PushoverService < Service - include HTTParty - base_uri 'https://api.pushover.net/1' - - prop_accessor :api_key, :user_key, :device, :priority, :sound - validates :api_key, :user_key, :priority, presence: true, if: :activated? - - def title - 'Pushover' - end - - def description - 'Pushover makes it easy to get real-time notifications on your Android device, iPhone, iPad, and Desktop.' - end - - def to_param - 'pushover' - end - - def fields - [ - { type: 'text', name: 'api_key', placeholder: 'Your application key' }, - { type: 'text', name: 'user_key', placeholder: 'Your user key' }, - { type: 'text', name: 'device', placeholder: 'Leave blank for all active devices' }, - { type: 'select', name: 'priority', choices: - [ - ['Lowest Priority', -2], - ['Low Priority', -1], - ['Normal Priority', 0], - ['High Priority', 1] - ], - default_choice: 0 - }, - { type: 'select', name: 'sound', choices: - [ - ['Device default sound', nil], - ['Pushover (default)', 'pushover'], - ['Bike', 'bike'], - ['Bugle', 'bugle'], - ['Cash Register', 'cashregister'], - ['Classical', 'classical'], - ['Cosmic', 'cosmic'], - ['Falling', 'falling'], - ['Gamelan', 'gamelan'], - ['Incoming', 'incoming'], - ['Intermission', 'intermission'], - ['Magic', 'magic'], - ['Mechanical', 'mechanical'], - ['Piano Bar', 'pianobar'], - ['Siren', 'siren'], - ['Space Alarm', 'spacealarm'], - ['Tug Boat', 'tugboat'], - ['Alien Alarm (long)', 'alien'], - ['Climb (long)', 'climb'], - ['Persistent (long)', 'persistent'], - ['Pushover Echo (long)', 'echo'], - ['Up Down (long)', 'updown'], - ['None (silent)', 'none'] - ] - }, - ] - end - - def supported_events - %w(push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - ref = Gitlab::Git.ref_name(data[:ref]) - before = data[:before] - after = data[:after] - - if Gitlab::Git.blank_ref?(before) - message = "#{data[:user_name]} pushed new branch \"#{ref}\"." - elsif Gitlab::Git.blank_ref?(after) - message = "#{data[:user_name]} deleted branch \"#{ref}\"." - else - message = "#{data[:user_name]} push to branch \"#{ref}\"." - end - - if data[:total_commits_count] > 0 - message << "\nTotal commits count: #{data[:total_commits_count]}" - end - - pushover_data = { - token: api_key, - user: user_key, - device: device, - priority: priority, - title: "#{project.name_with_namespace}", - message: message, - url: data[:repository][:homepage], - url_title: "See project #{project.name_with_namespace}" - } - - # Sound parameter MUST NOT be sent to API if not selected - if sound - pushover_data.merge!(sound: sound) - end - - PushoverService.post('/messages.json', body: pushover_data) - end -end diff --git a/app/models/project_services/redmine_service.rb b/app/models/project_services/redmine_service.rb deleted file mode 100644 index dd9ba97ee1f..00000000000 --- a/app/models/project_services/redmine_service.rb +++ /dev/null @@ -1,44 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class RedmineService < IssueTrackerService - - prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url - - def title - if self.properties && self.properties['title'].present? - self.properties['title'] - else - 'Redmine' - end - end - - def description - if self.properties && self.properties['description'].present? - self.properties['description'] - else - 'Redmine issue tracker' - end - end - - def to_param - 'redmine' - end -end diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb deleted file mode 100644 index 36d9874edd3..00000000000 --- a/app/models/project_services/slack_service.rb +++ /dev/null @@ -1,105 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class SlackService < Service - prop_accessor :webhook, :username, :channel - validates :webhook, presence: true, if: :activated? - - def title - 'Slack' - end - - def description - 'A team communication tool for the 21st century' - end - - def to_param - 'slack' - end - - def fields - [ - { type: 'text', name: 'webhook', - placeholder: 'https://hooks.slack.com/services/...' }, - { type: 'text', name: 'username', placeholder: 'username' }, - { type: 'text', name: 'channel', placeholder: '#channel' } - ] - end - - def supported_events - %w(push issue merge_request note tag_push) - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - return unless webhook.present? - - object_kind = data[:object_kind] - - data = data.merge( - project_url: project_url, - project_name: project_name - ) - - # WebHook events often have an 'update' event that follows a 'open' or - # 'close' action. Ignore update events for now to prevent duplicate - # messages from arriving. - - message = \ - case object_kind - when "push", "tag_push" - PushMessage.new(data) - when "issue" - IssueMessage.new(data) unless is_update?(data) - when "merge_request" - MergeMessage.new(data) unless is_update?(data) - when "note" - NoteMessage.new(data) - end - - opt = {} - opt[:channel] = channel if channel - opt[:username] = username if username - - if message - notifier = Slack::Notifier.new(webhook, opt) - notifier.ping(message.pretext, attachments: message.attachments) - end - end - - private - - def project_name - project.name_with_namespace.gsub(/\s/, '') - end - - def project_url - project.web_url - end - - def is_update?(data) - data[:object_attributes][:action] == 'update' - end -end - -require "slack_service/issue_message" -require "slack_service/push_message" -require "slack_service/merge_message" -require "slack_service/note_message" diff --git a/app/models/project_services/slack_service/base_message.rb b/app/models/project_services/slack_service/base_message.rb deleted file mode 100644 index aa00d6061a1..00000000000 --- a/app/models/project_services/slack_service/base_message.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'slack-notifier' - -class SlackService - class BaseMessage - def initialize(params) - raise NotImplementedError - end - - def pretext - format(message) - end - - def attachments - raise NotImplementedError - end - - private - - def message - raise NotImplementedError - end - - def format(string) - Slack::Notifier::LinkFormatter.format(string) - end - - def attachment_color - '#345' - end - end -end diff --git a/app/models/project_services/slack_service/issue_message.rb b/app/models/project_services/slack_service/issue_message.rb deleted file mode 100644 index 5af24a80609..00000000000 --- a/app/models/project_services/slack_service/issue_message.rb +++ /dev/null @@ -1,56 +0,0 @@ -class SlackService - class IssueMessage < BaseMessage - attr_reader :user_name - attr_reader :title - attr_reader :project_name - attr_reader :project_url - attr_reader :issue_iid - attr_reader :issue_url - attr_reader :action - attr_reader :state - attr_reader :description - - def initialize(params) - @user_name = params[:user][:name] - @project_name = params[:project_name] - @project_url = params[:project_url] - - obj_attr = params[:object_attributes] - obj_attr = HashWithIndifferentAccess.new(obj_attr) - @title = obj_attr[:title] - @issue_iid = obj_attr[:iid] - @issue_url = obj_attr[:url] - @action = obj_attr[:action] - @state = obj_attr[:state] - @description = obj_attr[:description] - end - - def attachments - return [] unless opened_issue? - - description_message - end - - private - - def message - "#{user_name} #{state} #{issue_link} in #{project_link}: *#{title}*" - end - - def opened_issue? - action == "open" - end - - def description_message - [{ text: format(description), color: attachment_color }] - end - - def project_link - "[#{project_name}](#{project_url})" - end - - def issue_link - "[issue ##{issue_iid}](#{issue_url})" - end - end -end diff --git a/app/models/project_services/slack_service/merge_message.rb b/app/models/project_services/slack_service/merge_message.rb deleted file mode 100644 index e792c258f73..00000000000 --- a/app/models/project_services/slack_service/merge_message.rb +++ /dev/null @@ -1,60 +0,0 @@ -class SlackService - class MergeMessage < BaseMessage - attr_reader :user_name - attr_reader :project_name - attr_reader :project_url - attr_reader :merge_request_id - attr_reader :source_branch - attr_reader :target_branch - attr_reader :state - attr_reader :title - - def initialize(params) - @user_name = params[:user][:name] - @project_name = params[:project_name] - @project_url = params[:project_url] - - obj_attr = params[:object_attributes] - obj_attr = HashWithIndifferentAccess.new(obj_attr) - @merge_request_id = obj_attr[:iid] - @source_branch = obj_attr[:source_branch] - @target_branch = obj_attr[:target_branch] - @state = obj_attr[:state] - @title = format_title(obj_attr[:title]) - end - - def pretext - format(message) - end - - def attachments - [] - end - - private - - def format_title(title) - '*' + title.lines.first.chomp + '*' - end - - def message - merge_request_message - end - - def project_link - "[#{project_name}](#{project_url})" - end - - def merge_request_message - "#{user_name} #{state} #{merge_request_link} in #{project_link}: #{title}" - end - - def merge_request_link - "[merge request ##{merge_request_id}](#{merge_request_url})" - end - - def merge_request_url - "#{project_url}/merge_requests/#{merge_request_id}" - end - end -end diff --git a/app/models/project_services/slack_service/note_message.rb b/app/models/project_services/slack_service/note_message.rb deleted file mode 100644 index 074478b292d..00000000000 --- a/app/models/project_services/slack_service/note_message.rb +++ /dev/null @@ -1,82 +0,0 @@ -class SlackService - class NoteMessage < BaseMessage - attr_reader :message - attr_reader :user_name - attr_reader :project_name - attr_reader :project_link - attr_reader :note - attr_reader :note_url - attr_reader :title - - def initialize(params) - params = HashWithIndifferentAccess.new(params) - @user_name = params[:user][:name] - @project_name = params[:project_name] - @project_url = params[:project_url] - - obj_attr = params[:object_attributes] - obj_attr = HashWithIndifferentAccess.new(obj_attr) - @note = obj_attr[:note] - @note_url = obj_attr[:url] - noteable_type = obj_attr[:noteable_type] - - case noteable_type - when "Commit" - create_commit_note(HashWithIndifferentAccess.new(params[:commit])) - when "Issue" - create_issue_note(HashWithIndifferentAccess.new(params[:issue])) - when "MergeRequest" - create_merge_note(HashWithIndifferentAccess.new(params[:merge_request])) - when "Snippet" - create_snippet_note(HashWithIndifferentAccess.new(params[:snippet])) - end - end - - def attachments - description_message - end - - private - - def format_title(title) - title.lines.first.chomp - end - - def create_commit_note(commit) - commit_sha = commit[:id] - commit_sha = Commit.truncate_sha(commit_sha) - commit_link = "[commit #{commit_sha}](#{@note_url})" - title = format_title(commit[:message]) - @message = "#{@user_name} commented on #{commit_link} in #{project_link}: *#{title}*" - end - - def create_issue_note(issue) - issue_iid = issue[:iid] - note_link = "[issue ##{issue_iid}](#{@note_url})" - title = format_title(issue[:title]) - @message = "#{@user_name} commented on #{note_link} in #{project_link}: *#{title}*" - end - - def create_merge_note(merge_request) - merge_request_id = merge_request[:iid] - merge_request_link = "[merge request ##{merge_request_id}](#{@note_url})" - title = format_title(merge_request[:title]) - @message = "#{@user_name} commented on #{merge_request_link} in #{project_link}: *#{title}*" - end - - def create_snippet_note(snippet) - snippet_id = snippet[:id] - snippet_link = "[snippet ##{snippet_id}](#{@note_url})" - title = format_title(snippet[:title]) - @message = "#{@user_name} commented on #{snippet_link} in #{project_link}: *#{title}*" - end - - def description_message - [{ text: format(@note), color: attachment_color }] - end - - def project_link - "[#{@project_name}](#{@project_url})" - end - end -end diff --git a/app/models/project_services/slack_service/push_message.rb b/app/models/project_services/slack_service/push_message.rb deleted file mode 100644 index b26f3e9ddce..00000000000 --- a/app/models/project_services/slack_service/push_message.rb +++ /dev/null @@ -1,110 +0,0 @@ -class SlackService - class PushMessage < BaseMessage - attr_reader :after - attr_reader :before - attr_reader :commits - attr_reader :project_name - attr_reader :project_url - attr_reader :ref - attr_reader :ref_type - attr_reader :user_name - - def initialize(params) - @after = params[:after] - @before = params[:before] - @commits = params.fetch(:commits, []) - @project_name = params[:project_name] - @project_url = params[:project_url] - @ref_type = Gitlab::Git.tag_ref?(params[:ref]) ? 'tag' : 'branch' - @ref = Gitlab::Git.ref_name(params[:ref]) - @user_name = params[:user_name] - end - - def pretext - format(message) - end - - def attachments - return [] if new_branch? || removed_branch? - - commit_message_attachments - end - - private - - def message - if new_branch? - new_branch_message - elsif removed_branch? - removed_branch_message - else - push_message - end - end - - def format(string) - Slack::Notifier::LinkFormatter.format(string) - end - - def new_branch_message - "#{user_name} pushed new #{ref_type} #{branch_link} to #{project_link}" - end - - def removed_branch_message - "#{user_name} removed #{ref_type} #{ref} from #{project_link}" - end - - def push_message - "#{user_name} pushed to #{ref_type} #{branch_link} of #{project_link} (#{compare_link})" - end - - def commit_messages - commits.map { |commit| compose_commit_message(commit) }.join("\n") - end - - def commit_message_attachments - [{ text: format(commit_messages), color: attachment_color }] - end - - def compose_commit_message(commit) - author = commit[:author][:name] - id = Commit.truncate_sha(commit[:id]) - message = commit[:message] - url = commit[:url] - - "[#{id}](#{url}): #{message} - #{author}" - end - - def new_branch? - Gitlab::Git.blank_ref?(before) - end - - def removed_branch? - Gitlab::Git.blank_ref?(after) - end - - def branch_url - "#{project_url}/commits/#{ref}" - end - - def compare_url - "#{project_url}/compare/#{before}...#{after}" - end - - def branch_link - "[#{ref}](#{branch_url})" - end - - def project_link - "[#{project_name}](#{project_url})" - end - - def compare_link - "[Compare changes](#{compare_url})" - end - - def attachment_color - '#345' - end - end -end diff --git a/app/models/project_services/teamcity_service.rb b/app/models/project_services/teamcity_service.rb deleted file mode 100644 index 3c002a1634b..00000000000 --- a/app/models/project_services/teamcity_service.rb +++ /dev/null @@ -1,145 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# note_events :boolean default(TRUE), not null -# - -class TeamcityService < CiService - include HTTParty - - prop_accessor :teamcity_url, :build_type, :username, :password - - validates :teamcity_url, - presence: true, - format: { with: /\A#{URI.regexp}\z/ }, if: :activated? - validates :build_type, presence: true, if: :activated? - validates :username, - presence: true, - if: ->(service) { service.password? }, if: :activated? - validates :password, - presence: true, - if: ->(service) { service.username? }, if: :activated? - - attr_accessor :response - - after_save :compose_service_hook, if: :activated? - - def compose_service_hook - hook = service_hook || build_service_hook - hook.save - end - - def title - 'JetBrains TeamCity CI' - end - - def description - 'A continuous integration and build server' - end - - def help - 'The build configuration in Teamcity must use the build format '\ - 'number %build.vcs.number% '\ - 'you will also want to configure monitoring of all branches so merge '\ - 'requests build, that setting is in the vsc root advanced settings.' - end - - def to_param - 'teamcity' - end - - def supported_events - %w(push) - end - - def fields - [ - { type: 'text', name: 'teamcity_url', - placeholder: 'TeamCity root URL like https://teamcity.example.com' }, - { type: 'text', name: 'build_type', - placeholder: 'Build configuration ID' }, - { type: 'text', name: 'username', - placeholder: 'A user with permissions to trigger a manual build' }, - { type: 'password', name: 'password' }, - ] - end - - def build_info(sha) - url = URI.parse("#{teamcity_url}/httpAuth/app/rest/builds/"\ - "branch:unspecified:any,number:#{sha}") - auth = { - username: username, - password: password, - } - @response = HTTParty.get("#{url}", verify: false, basic_auth: auth) - end - - def build_page(sha, ref) - build_info(sha) if @response.nil? || !@response.code - - if @response.code != 200 - # If actual build link can't be determined, - # send user to build summary page. - "#{teamcity_url}/viewLog.html?buildTypeId=#{build_type}" - else - # If actual build link is available, go to build result page. - built_id = @response['build']['id'] - "#{teamcity_url}/viewLog.html?buildId=#{built_id}"\ - "&buildTypeId=#{build_type}" - end - end - - def commit_status(sha, ref) - build_info(sha) if @response.nil? || !@response.code - return :error unless @response.code == 200 || @response.code == 404 - - status = if @response.code == 404 - 'Pending' - else - @response['build']['status'] - end - - if status.include?('SUCCESS') - 'success' - elsif status.include?('FAILURE') - 'failed' - elsif status.include?('Pending') - 'pending' - else - :error - end - end - - def execute(data) - return unless supported_events.include?(data[:object_kind]) - - auth = { - username: username, - password: password, - } - - branch = Gitlab::Git.ref_name(data[:ref]) - - self.class.post("#{teamcity_url}/httpAuth/app/rest/buildQueue", - body: "<build branchName=\"#{branch}\">"\ - "<buildType id=\"#{build_type}\"/>"\ - '</build>', - headers: { 'Content-type' => 'application/xml' }, - basic_auth: auth - ) - end -end diff --git a/app/models/project_snippet.rb b/app/models/project_snippet.rb deleted file mode 100644 index 9e2c1b0e18e..00000000000 --- a/app/models/project_snippet.rb +++ /dev/null @@ -1,28 +0,0 @@ -# == Schema Information -# -# Table name: snippets -# -# id :integer not null, primary key -# title :string(255) -# content :text -# author_id :integer not null -# project_id :integer -# created_at :datetime -# updated_at :datetime -# file_name :string(255) -# expires_at :datetime -# type :string(255) -# visibility_level :integer default(0), not null -# - -class ProjectSnippet < Snippet - belongs_to :project - belongs_to :author, class_name: "User" - - validates :project, presence: true - - # Scopes - scope :fresh, -> { order("created_at DESC") } - scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) } - scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) } -end diff --git a/app/models/project_team.rb b/app/models/project_team.rb deleted file mode 100644 index 56e49af2324..00000000000 --- a/app/models/project_team.rb +++ /dev/null @@ -1,169 +0,0 @@ -class ProjectTeam - attr_accessor :project - - def initialize(project) - @project = project - end - - # Shortcut to add users - # - # Use: - # @team << [@user, :master] - # @team << [@users, :master] - # - def <<(args) - users, access, current_user = *args - - if users.respond_to?(:each) - add_users(users, access, current_user) - else - add_user(users, access, current_user) - end - end - - def find(user_id) - user = project.users.find_by(id: user_id) - - if group - user ||= group.users.find_by(id: user_id) - end - - user - end - - def find_member(user_id) - member = project.project_members.find_by(user_id: user_id) - - # If user is not in project members - # we should check for group membership - if group && !member - member = group.group_members.find_by(user_id: user_id) - end - - member - end - - def add_users(users, access, current_user = nil) - ProjectMember.add_users_into_projects( - [project.id], - users, - access, - current_user - ) - end - - def add_user(user, access, current_user = nil) - add_users([user], access, current_user) - end - - # Remove all users from project team - def truncate - ProjectMember.truncate_team(project) - end - - def users - members - end - - def members - @members ||= fetch_members - end - - def guests - @guests ||= fetch_members(:guests) - end - - def reporters - @reporters ||= fetch_members(:reporters) - end - - def developers - @developers ||= fetch_members(:developers) - end - - def masters - @masters ||= fetch_members(:masters) - end - - def import(source_project, current_user = nil) - target_project = project - - source_members = source_project.project_members.to_a - target_user_ids = target_project.project_members.pluck(:user_id) - - source_members.reject! do |member| - # Skip if user already present in team - !member.invite? && target_user_ids.include?(member.user_id) - end - - source_members.map! do |member| - new_member = member.dup - new_member.id = nil - new_member.source = target_project - new_member.created_by = current_user - new_member - end - - ProjectMember.transaction do - source_members.each do |member| - member.save - end - end - - true - rescue - false - end - - def guest?(user) - max_member_access(user.id) == Gitlab::Access::GUEST - end - - def reporter?(user) - max_member_access(user.id) == Gitlab::Access::REPORTER - end - - def developer?(user) - max_member_access(user.id) == Gitlab::Access::DEVELOPER - end - - def master?(user) - max_member_access(user.id) == Gitlab::Access::MASTER - end - - def member?(user_id) - !!find_member(user_id) - end - - def max_member_access(user_id) - access = [] - access << project.project_members.find_by(user_id: user_id).try(:access_field) - - if group - access << group.group_members.find_by(user_id: user_id).try(:access_field) - end - - access.compact.max - end - - private - - def fetch_members(level = nil) - project_members = project.project_members - group_members = group ? group.group_members : [] - - if level - project_members = project_members.send(level) - group_members = group_members.send(level) if group - end - - user_ids = project_members.pluck(:user_id) - user_ids.push(*group_members.pluck(:user_id)) if group - - User.where(id: user_ids) - end - - def group - project.group - end -end diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb deleted file mode 100644 index 772c868d9cd..00000000000 --- a/app/models/project_wiki.rb +++ /dev/null @@ -1,149 +0,0 @@ -class ProjectWiki - include Gitlab::ShellAdapter - - MARKUPS = { - 'Markdown' => :markdown, - 'RDoc' => :rdoc, - 'AsciiDoc' => :asciidoc - } unless defined?(MARKUPS) - - class CouldNotCreateWikiError < StandardError; end - - # Returns a string describing what went wrong after - # an operation fails. - attr_reader :error_message - - def initialize(project, user = nil) - @project = project - @user = user - end - - def path - @project.path + '.wiki' - end - - def path_with_namespace - @project.path_with_namespace + ".wiki" - end - - def url_to_repo - gitlab_shell.url_to_repo(path_with_namespace) - end - - def ssh_url_to_repo - url_to_repo - end - - def http_url_to_repo - [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('') - end - - # Returns the Gollum::Wiki object. - def wiki - @wiki ||= begin - Gollum::Wiki.new(path_to_repo) - rescue Gollum::NoSuchPathError - create_repo! - end - end - - def empty? - pages.empty? - end - - # Returns an Array of Gitlab WikiPage instances or an - # empty Array if this Wiki has no pages. - def pages - wiki.pages.map { |page| WikiPage.new(self, page, true) } - end - - # Finds a page within the repository based on a tile - # or slug. - # - # title - The human readable or parameterized title of - # the page. - # - # Returns an initialized WikiPage instance or nil - def find_page(title, version = nil) - page_title, page_dir = page_title_and_dir(title) - if page = wiki.page(page_title, version, page_dir) - WikiPage.new(self, page, true) - else - nil - end - end - - def find_file(name, version = nil, try_on_disk = true) - version = wiki.ref if version.nil? # Gollum::Wiki#file ? - if wiki_file = wiki.file(name, version, try_on_disk) - wiki_file - else - nil - end - end - - def create_page(title, content, format = :markdown, message = nil) - commit = commit_details(:created, message, title) - - wiki.write_page(title, format, content, commit) - rescue Gollum::DuplicatePageError => e - @error_message = "Duplicate page: #{e.message}" - return false - end - - def update_page(page, content, format = :markdown, message = nil) - commit = commit_details(:updated, message, page.title) - - wiki.update_page(page, page.name, format, content, commit) - end - - def delete_page(page, message = nil) - wiki.delete_page(page, commit_details(:deleted, message, page.title)) - end - - def page_title_and_dir(title) - title_array = title.split("/") - title = title_array.pop - [title, title_array.join("/")] - end - - def search_files(query) - repository.search_files(query, default_branch) - end - - def repository - Repository.new(path_with_namespace, default_branch) - end - - def default_branch - wiki.class.default_ref - end - - private - - def create_repo! - if init_repo(path_with_namespace) - Gollum::Wiki.new(path_to_repo) - else - raise CouldNotCreateWikiError - end - end - - def init_repo(path_with_namespace) - gitlab_shell.add_repository(path_with_namespace) - end - - def commit_details(action, message = nil, title = nil) - commit_message = message || default_message(action, title) - - { email: @user.email, name: @user.name, message: commit_message } - end - - def default_message(action, title) - "#{@user.username} #{action} page: #{title}" - end - - def path_to_repo - @path_to_repo ||= File.join(Gitlab.config.gitlab_shell.repos_path, "#{path_with_namespace}.git") - end -end diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb deleted file mode 100644 index 97207ba1272..00000000000 --- a/app/models/protected_branch.rb +++ /dev/null @@ -1,23 +0,0 @@ -# == Schema Information -# -# Table name: protected_branches -# -# id :integer not null, primary key -# project_id :integer not null -# name :string(255) not null -# created_at :datetime -# updated_at :datetime -# developers_can_push :boolean default(FALSE), not null -# - -class ProtectedBranch < ActiveRecord::Base - include Gitlab::ShellAdapter - - belongs_to :project - validates :name, presence: true - validates :project, presence: true - - def commit - project.repository.commit(self.name) - end -end diff --git a/app/models/repository.rb b/app/models/repository.rb deleted file mode 100644 index 263a436d521..00000000000 --- a/app/models/repository.rb +++ /dev/null @@ -1,377 +0,0 @@ -class Repository - include Gitlab::ShellAdapter - - attr_accessor :raw_repository, :path_with_namespace - - def initialize(path_with_namespace, default_branch = nil) - @path_with_namespace = path_with_namespace - @raw_repository = Gitlab::Git::Repository.new(path_to_repo) if path_with_namespace - rescue Gitlab::Git::Repository::NoRepository - nil - end - - # Return absolute path to repository - def path_to_repo - @path_to_repo ||= File.expand_path( - File.join(Gitlab.config.gitlab_shell.repos_path, path_with_namespace + ".git") - ) - end - - def exists? - raw_repository - end - - def empty? - raw_repository.empty? - end - - def commit(id = 'HEAD') - return nil unless raw_repository - commit = Gitlab::Git::Commit.find(raw_repository, id) - commit = Commit.new(commit) if commit - commit - rescue Rugged::OdbError - nil - end - - def commits(ref, path = nil, limit = nil, offset = nil, skip_merges = false) - commits = Gitlab::Git::Commit.where( - repo: raw_repository, - ref: ref, - path: path, - limit: limit, - offset: offset, - ) - commits = Commit.decorate(commits) if commits.present? - commits - end - - def commits_between(from, to) - commits = Gitlab::Git::Commit.between(raw_repository, from, to) - commits = Commit.decorate(commits) if commits.present? - commits - end - - def find_branch(name) - branches.find { |branch| branch.name == name } - end - - def find_tag(name) - tags.find { |tag| tag.name == name } - end - - def add_branch(branch_name, ref) - cache.expire(:branch_names) - @branches = nil - - gitlab_shell.add_branch(path_with_namespace, branch_name, ref) - end - - def add_tag(tag_name, ref, message = nil) - cache.expire(:tag_names) - @tags = nil - - gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message) - end - - def rm_branch(branch_name) - cache.expire(:branch_names) - @branches = nil - - gitlab_shell.rm_branch(path_with_namespace, branch_name) - end - - def rm_tag(tag_name) - cache.expire(:tag_names) - @tags = nil - - gitlab_shell.rm_tag(path_with_namespace, tag_name) - end - - def round_commit_count - if commit_count > 10000 - '10000+' - elsif commit_count > 5000 - '5000+' - elsif commit_count > 1000 - '1000+' - else - commit_count - end - end - - def branch_names - cache.fetch(:branch_names) { raw_repository.branch_names } - end - - def tag_names - cache.fetch(:tag_names) { raw_repository.tag_names } - end - - def commit_count - cache.fetch(:commit_count) do - begin - raw_repository.commit_count(self.root_ref) - rescue - 0 - end - end - end - - # Return repo size in megabytes - # Cached in redis - def size - cache.fetch(:size) { raw_repository.size } - end - - def expire_cache - %i(size branch_names tag_names commit_count graph_log - readme version contribution_guide changelog license).each do |key| - cache.expire(key) - end - end - - def graph_log - cache.fetch(:graph_log) do - commits = raw_repository.log(limit: 6000, skip_merges: true, - ref: root_ref) - - commits.map do |rugged_commit| - commit = Gitlab::Git::Commit.new(rugged_commit) - - { - author_name: commit.author_name, - author_email: commit.author_email, - additions: commit.stats.additions, - deletions: commit.stats.deletions, - } - end - end - end - - def lookup_cache - @lookup_cache ||= {} - end - - def method_missing(m, *args, &block) - if m == :lookup && !block_given? - lookup_cache[m] ||= {} - lookup_cache[m][args.join(":")] ||= raw_repository.send(m, *args, &block) - else - raw_repository.send(m, *args, &block) - end - end - - def respond_to?(method) - return true if raw_repository.respond_to?(method) - - super - end - - def blob_at(sha, path) - Gitlab::Git::Blob.find(self, sha, path) - end - - def blob_by_oid(oid) - Gitlab::Git::Blob.raw(self, oid) - end - - def readme - cache.fetch(:readme) { tree(:head).readme } - end - - def version - cache.fetch(:version) do - tree(:head).blobs.find do |file| - file.name.downcase == 'version' - end - end - end - - def contribution_guide - cache.fetch(:contribution_guide) do - tree(:head).blobs.find do |file| - file.contributing? - end - end - end - - def changelog - cache.fetch(:changelog) do - tree(:head).blobs.find do |file| - file.name =~ /\A(changelog|history)/i - end - end - end - - def license - cache.fetch(:license) do - tree(:head).blobs.find do |file| - file.name =~ /\Alicense/i - end - end - end - - def head_commit - @head_commit ||= commit(self.root_ref) - end - - def head_tree - @head_tree ||= Tree.new(self, head_commit.sha, nil) - end - - def tree(sha = :head, path = nil) - if sha == :head - if path.nil? - return head_tree - else - sha = head_commit.sha - end - end - - Tree.new(self, sha, path) - end - - def blob_at_branch(branch_name, path) - last_commit = commit(branch_name) - - if last_commit - blob_at(last_commit.sha, path) - else - nil - end - end - - # Returns url for submodule - # - # Ex. - # @repository.submodule_url_for('master', 'rack') - # # => git@localhost:rack.git - # - def submodule_url_for(ref, path) - if submodules(ref).any? - submodule = submodules(ref)[path] - - if submodule - submodule['url'] - end - end - end - - def last_commit_for_path(sha, path) - args = %W(git rev-list --max-count=1 #{sha} -- #{path}) - sha = Gitlab::Popen.popen(args, path_to_repo).first.strip - commit(sha) - end - - # Remove archives older than 2 hours - def clean_old_archives - repository_downloads_path = Gitlab.config.gitlab.repository_downloads_path - - return unless File.directory?(repository_downloads_path) - - Gitlab::Popen.popen(%W(find #{repository_downloads_path} -not -path #{repository_downloads_path} -mmin +120 -delete)) - end - - def branches_sorted_by(value) - case value - when 'recently_updated' - branches.sort do |a, b| - commit(b.target).committed_date <=> commit(a.target).committed_date - end - when 'last_updated' - branches.sort do |a, b| - commit(a.target).committed_date <=> commit(b.target).committed_date - end - else - branches - end - end - - def contributors - commits = self.commits(nil, nil, 2000, 0, true) - - commits.group_by(&:author_email).map do |email, commits| - contributor = Gitlab::Contributor.new - contributor.email = email - - commits.each do |commit| - if contributor.name.blank? - contributor.name = commit.author_name - end - - contributor.commits += 1 - end - - contributor - end - end - - def blob_for_diff(commit, diff) - file = blob_at(commit.id, diff.new_path) - - unless file - file = prev_blob_for_diff(commit, diff) - end - - file - end - - def prev_blob_for_diff(commit, diff) - if commit.parent_id - blob_at(commit.parent_id, diff.old_path) - end - end - - def branch_names_contains(sha) - args = %W(git branch --contains #{sha}) - names = Gitlab::Popen.popen(args, path_to_repo).first - - if names.respond_to?(:split) - names = names.split("\n").map(&:strip) - - names.each do |name| - name.slice! '* ' - end - - names - else - [] - end - end - - def tag_names_contains(sha) - args = %W(git tag --contains #{sha}) - names = Gitlab::Popen.popen(args, path_to_repo).first - - if names.respond_to?(:split) - names = names.split("\n").map(&:strip) - - names.each do |name| - name.slice! '* ' - end - - names - else - [] - end - end - - def branches - @branches ||= raw_repository.branches - end - - def tags - @tags ||= raw_repository.tags - end - - def root_ref - @root_ref ||= raw_repository.root_ref - end - - private - - def cache - @cache ||= RepositoryCache.new(path_with_namespace) - end -end diff --git a/app/models/service.rb b/app/models/service.rb deleted file mode 100644 index 393cf55a69f..00000000000 --- a/app/models/service.rb +++ /dev/null @@ -1,153 +0,0 @@ -# == Schema Information -# -# Table name: services -# -# id :integer not null, primary key -# type :string(255) -# title :string(255) -# project_id :integer -# created_at :datetime -# updated_at :datetime -# active :boolean default(FALSE), not null -# properties :text -# template :boolean default(FALSE) -# push_events :boolean default(TRUE) -# issues_events :boolean default(TRUE) -# merge_requests_events :boolean default(TRUE) -# tag_push_events :boolean default(TRUE) -# - -# To add new service you should build a class inherited from Service -# and implement a set of methods -class Service < ActiveRecord::Base - include Sortable - serialize :properties, JSON - - default_value_for :active, false - default_value_for :push_events, true - default_value_for :issues_events, true - default_value_for :merge_requests_events, true - default_value_for :tag_push_events, true - default_value_for :note_events, true - - after_initialize :initialize_properties - - belongs_to :project - has_one :service_hook - - validates :project_id, presence: true, unless: Proc.new { |service| service.template? } - - scope :visible, -> { where.not(type: 'GitlabIssueTrackerService') } - - scope :push_hooks, -> { where(push_events: true, active: true) } - scope :tag_push_hooks, -> { where(tag_push_events: true, active: true) } - scope :issue_hooks, -> { where(issues_events: true, active: true) } - scope :merge_request_hooks, -> { where(merge_requests_events: true, active: true) } - scope :note_hooks, -> { where(note_events: true, active: true) } - - def activated? - active - end - - def template? - template - end - - def category - :common - end - - def initialize_properties - self.properties = {} if properties.nil? - end - - def title - # implement inside child - end - - def description - # implement inside child - end - - def help - # implement inside child - end - - def to_param - # implement inside child - end - - def fields - # implement inside child - [] - end - - def supported_events - %w(push tag_push issue merge_request) - end - - def execute - # implement inside child - end - - def can_test? - !project.empty_repo? - end - - # Provide convenient accessor methods - # for each serialized property. - def self.prop_accessor(*args) - args.each do |arg| - class_eval %{ - def #{arg} - properties['#{arg}'] - end - - def #{arg}=(value) - self.properties['#{arg}'] = value - end - } - end - end - - def async_execute(data) - return unless supported_events.include?(data[:object_kind]) - - Sidekiq::Client.enqueue(ProjectServiceWorker, id, data) - end - - def issue_tracker? - self.category == :issue_tracker - end - - def self.available_services_names - %w( - asana - assembla - bamboo - buildkite - campfire - custom_issue_tracker - emails_on_push - external_wiki - flowdock - gemnasium - gitlab_ci - hipchat - irker - jira - pivotaltracker - pushover - redmine - slack - teamcity - ) - end - - def self.create_from_template(project_id, template) - service = template.dup - service.template = false - service.project_id = project_id - service if service.save - end -end diff --git a/app/models/snippet.rb b/app/models/snippet.rb deleted file mode 100644 index b35e72c4bdb..00000000000 --- a/app/models/snippet.rb +++ /dev/null @@ -1,103 +0,0 @@ -# == Schema Information -# -# Table name: snippets -# -# id :integer not null, primary key -# title :string(255) -# content :text -# author_id :integer not null -# project_id :integer -# created_at :datetime -# updated_at :datetime -# file_name :string(255) -# expires_at :datetime -# type :string(255) -# visibility_level :integer default(0), not null -# - -class Snippet < ActiveRecord::Base - include Sortable - include Linguist::BlobHelper - include Gitlab::VisibilityLevel - - default_value_for :visibility_level, Snippet::PRIVATE - - belongs_to :author, class_name: "User" - - has_many :notes, as: :noteable, dependent: :destroy - - delegate :name, :email, to: :author, prefix: true, allow_nil: true - - validates :author, presence: true - validates :title, presence: true, length: { within: 0..255 } - validates :file_name, - presence: true, - length: { within: 0..255 }, - format: { with: Gitlab::Regex.file_name_regex, - message: Gitlab::Regex.file_name_regex_message } - validates :content, presence: true - validates :visibility_level, inclusion: { in: Gitlab::VisibilityLevel.values } - - # Scopes - scope :are_internal, -> { where(visibility_level: Snippet::INTERNAL) } - scope :are_private, -> { where(visibility_level: Snippet::PRIVATE) } - scope :are_public, -> { where(visibility_level: Snippet::PUBLIC) } - scope :public_and_internal, -> { where(visibility_level: [Snippet::PUBLIC, Snippet::INTERNAL]) } - scope :fresh, -> { order("created_at DESC") } - scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) } - scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) } - - def self.content_types - [ - ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java", - ".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb", - ".js", ".sh", ".coffee", ".yml", ".md" - ] - end - - def data - content - end - - def hook_attrs - attributes - end - - def size - 0 - end - - def name - file_name - end - - def sanitized_file_name - file_name.gsub(/[^a-zA-Z0-9_\-\.]+/, '') - end - - def mode - nil - end - - def expired? - expires_at && expires_at < Time.current - end - - def visibility_level_field - visibility_level - end - - class << self - def search(query) - where('(title LIKE :query OR file_name LIKE :query)', query: "%#{query}%") - end - - def search_code(query) - where('(content LIKE :query)', query: "%#{query}%") - end - - def accessible_to(user) - where('visibility_level IN (?) OR author_id = ?', [Snippet::INTERNAL, Snippet::PUBLIC], user) - end - end -end diff --git a/app/models/subscription.rb b/app/models/subscription.rb deleted file mode 100644 index dd75d3ab8ba..00000000000 --- a/app/models/subscription.rb +++ /dev/null @@ -1,21 +0,0 @@ -# == Schema Information -# -# Table name: subscriptions -# -# id :integer not null, primary key -# user_id :integer -# subscribable_id :integer -# subscribable_type :string(255) -# subscribed :boolean -# created_at :datetime -# updated_at :datetime -# - -class Subscription < ActiveRecord::Base - belongs_to :user - belongs_to :subscribable, polymorphic: true - - validates :user_id, - uniqueness: { scope: [:subscribable_id, :subscribable_type] }, - presence: true -end diff --git a/app/models/tree.rb b/app/models/tree.rb deleted file mode 100644 index f279e896cda..00000000000 --- a/app/models/tree.rb +++ /dev/null @@ -1,53 +0,0 @@ -class Tree - include Gitlab::MarkdownHelper - - attr_accessor :repository, :sha, :path, :entries - - def initialize(repository, sha, path = '/') - path = '/' if path.blank? - - @repository = repository - @sha = sha - @path = path - - git_repo = @repository.raw_repository - @entries = Gitlab::Git::Tree.where(git_repo, @sha, @path) - end - - def readme - return @readme if defined?(@readme) - - available_readmes = blobs.select(&:readme?) - - if available_readmes.count == 0 - return @readme = nil - end - - # Take the first previewable readme, or the first available readme, if we - # can't preview any of them - readme_tree = available_readmes.find do |readme| - previewable?(readme.name) - end || available_readmes.first - - readme_path = path == '/' ? readme_tree.name : File.join(path, readme_tree.name) - - git_repo = repository.raw_repository - @readme = Gitlab::Git::Blob.find(git_repo, sha, readme_path) - end - - def trees - @entries.select(&:dir?) - end - - def blobs - @entries.select(&:file?) - end - - def submodules - @entries.select(&:submodule?) - end - - def sorted_entries - trees + blobs + submodules - end -end diff --git a/app/models/user.rb b/app/models/user.rb deleted file mode 100644 index d6b93afe739..00000000000 --- a/app/models/user.rb +++ /dev/null @@ -1,614 +0,0 @@ -# == Schema Information -# -# Table name: users -# -# id :integer not null, primary key -# email :string(255) default(""), not null -# encrypted_password :string(255) default(""), not null -# reset_password_token :string(255) -# reset_password_sent_at :datetime -# remember_created_at :datetime -# sign_in_count :integer default(0) -# current_sign_in_at :datetime -# last_sign_in_at :datetime -# current_sign_in_ip :string(255) -# last_sign_in_ip :string(255) -# created_at :datetime -# updated_at :datetime -# name :string(255) -# admin :boolean default(FALSE), not null -# projects_limit :integer default(10) -# skype :string(255) default(""), not null -# linkedin :string(255) default(""), not null -# twitter :string(255) default(""), not null -# authentication_token :string(255) -# theme_id :integer default(1), not null -# bio :string(255) -# failed_attempts :integer default(0) -# locked_at :datetime -# username :string(255) -# can_create_group :boolean default(TRUE), not null -# can_create_team :boolean default(TRUE), not null -# state :string(255) -# color_scheme_id :integer default(1), not null -# notification_level :integer default(1), not null -# password_expires_at :datetime -# created_by_id :integer -# last_credential_check_at :datetime -# avatar :string(255) -# confirmation_token :string(255) -# confirmed_at :datetime -# confirmation_sent_at :datetime -# unconfirmed_email :string(255) -# hide_no_ssh_key :boolean default(FALSE) -# website_url :string(255) default(""), not null -# github_access_token :string(255) -# gitlab_access_token :string(255) -# notification_email :string(255) -# hide_no_password :boolean default(FALSE) -# password_automatically_set :boolean default(FALSE) -# bitbucket_access_token :string(255) -# bitbucket_access_token_secret :string(255) -# public_email :string(255) default(""), not null -# - -require 'carrierwave/orm/activerecord' -require 'file_size_validator' - -class User < ActiveRecord::Base - include Sortable - include Gitlab::ConfigHelper - include TokenAuthenticatable - extend Gitlab::ConfigHelper - include Gitlab::CurrentSettings - - default_value_for :admin, false - default_value_for :can_create_group, gitlab_config.default_can_create_group - default_value_for :can_create_team, false - default_value_for :hide_no_ssh_key, false - default_value_for :hide_no_password, false - default_value_for :theme_id, gitlab_config.default_theme - - devise :database_authenticatable, :lockable, :async, - :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable, :registerable - - attr_accessor :force_random_password - - # Virtual attribute for authenticating by either username or email - attr_accessor :login - - # - # Relations - # - - # Namespace for personal projects - has_one :namespace, -> { where type: nil }, dependent: :destroy, foreign_key: :owner_id, class_name: "Namespace" - - # Profile - has_many :keys, dependent: :destroy - has_many :emails, dependent: :destroy - has_many :identities, dependent: :destroy - - # Groups - has_many :members, dependent: :destroy - has_many :project_members, source: 'ProjectMember' - has_many :group_members, source: 'GroupMember' - has_many :groups, through: :group_members - has_many :owned_groups, -> { where members: { access_level: Gitlab::Access::OWNER } }, through: :group_members, source: :group - has_many :masters_groups, -> { where members: { access_level: Gitlab::Access::MASTER } }, through: :group_members, source: :group - - # Projects - has_many :groups_projects, through: :groups, source: :projects - has_many :personal_projects, through: :namespace, source: :projects - has_many :projects, through: :project_members - has_many :created_projects, foreign_key: :creator_id, class_name: 'Project' - has_many :users_star_projects, dependent: :destroy - has_many :starred_projects, through: :users_star_projects, source: :project - - has_many :snippets, dependent: :destroy, foreign_key: :author_id, class_name: "Snippet" - has_many :project_members, dependent: :destroy, class_name: 'ProjectMember' - has_many :issues, dependent: :destroy, foreign_key: :author_id - has_many :notes, dependent: :destroy, foreign_key: :author_id - has_many :merge_requests, dependent: :destroy, foreign_key: :author_id - has_many :events, dependent: :destroy, foreign_key: :author_id, class_name: "Event" - has_many :subscriptions, dependent: :destroy - has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event" - has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue" - has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest" - has_many :oauth_applications, class_name: 'Doorkeeper::Application', as: :owner, dependent: :destroy - - - # - # Validations - # - validates :name, presence: true - validates :email, presence: true, email: { strict_mode: true }, uniqueness: true - validates :notification_email, presence: true, email: { strict_mode: true } - validates :public_email, presence: true, email: { strict_mode: true }, allow_blank: true, uniqueness: true - validates :bio, length: { maximum: 255 }, allow_blank: true - validates :projects_limit, presence: true, numericality: { greater_than_or_equal_to: 0 } - validates :username, - presence: true, - uniqueness: { case_sensitive: false }, - exclusion: { in: Gitlab::Blacklist.path }, - format: { with: Gitlab::Regex.namespace_regex, - message: Gitlab::Regex.namespace_regex_message } - - validates :notification_level, inclusion: { in: Notification.notification_levels }, presence: true - validate :namespace_uniq, if: ->(user) { user.username_changed? } - validate :avatar_type, if: ->(user) { user.avatar_changed? } - validate :unique_email, if: ->(user) { user.email_changed? } - validate :owns_notification_email, if: ->(user) { user.notification_email_changed? } - validates :avatar, file_size: { maximum: 200.kilobytes.to_i } - - before_validation :generate_password, on: :create - before_validation :sanitize_attrs - before_validation :set_notification_email, if: ->(user) { user.email_changed? } - before_validation :set_public_email, if: ->(user) { user.public_email_changed? } - - before_save :ensure_authentication_token - after_save :ensure_namespace_correct - after_initialize :set_projects_limit - after_create :post_create_hook - after_destroy :post_destroy_hook - - - alias_attribute :private_token, :authentication_token - - delegate :path, to: :namespace, allow_nil: true, prefix: true - - state_machine :state, initial: :active do - event :block do - transition active: :blocked - end - - event :activate do - transition blocked: :active - end - end - - mount_uploader :avatar, AvatarUploader - - # Scopes - scope :admins, -> { where(admin: true) } - scope :blocked, -> { with_state(:blocked) } - scope :active, -> { with_state(:active) } - scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : all } - scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM members)') } - - # - # Class methods - # - class << self - # Devise method overridden to allow sign in with email or username - def find_for_database_authentication(warden_conditions) - conditions = warden_conditions.dup - if login = conditions.delete(:login) - where(conditions).where(["lower(username) = :value OR lower(email) = :value", { value: login.downcase }]).first - else - where(conditions).first - end - end - - def sort(method) - case method.to_s - when 'recent_sign_in' then reorder(last_sign_in_at: :desc) - when 'oldest_sign_in' then reorder(last_sign_in_at: :asc) - else - order_by(method) - end - end - - def find_for_commit(email, name) - # Prefer email match over name match - User.where(email: email).first || - User.joins(:emails).where(emails: { email: email }).first || - User.where(name: name).first - end - - def filter(filter_name) - case filter_name - when "admins"; self.admins - when "blocked"; self.blocked - when "wop"; self.without_projects - else - self.active - end - end - - def search(query) - where("lower(name) LIKE :query OR lower(email) LIKE :query OR lower(username) LIKE :query", query: "%#{query.downcase}%") - end - - def by_login(login) - where('lower(username) = :value OR lower(email) = :value', - value: login.to_s.downcase).first - end - - def by_username_or_id(name_or_id) - where('users.username = ? OR users.id = ?', name_or_id.to_s, name_or_id.to_i).first - end - - def build_user(attrs = {}) - User.new(attrs) - end - end - - # - # Instance methods - # - - def to_param - username - end - - def notification - @notification ||= Notification.new(self) - end - - def generate_password - if self.force_random_password - self.password = self.password_confirmation = Devise.friendly_token.first(8) - end - end - - def generate_reset_token - @reset_token, enc = Devise.token_generator.generate(self.class, :reset_password_token) - - self.reset_password_token = enc - self.reset_password_sent_at = Time.now.utc - - @reset_token - end - - def namespace_uniq - namespace_name = self.username - existing_namespace = Namespace.by_path(namespace_name) - if existing_namespace && existing_namespace != self.namespace - self.errors.add :username, "already exists" - end - end - - def avatar_type - unless self.avatar.image? - self.errors.add :avatar, "only images allowed" - end - end - - def unique_email - self.errors.add(:email, 'has already been taken') if Email.exists?(email: self.email) - end - - def owns_notification_email - self.errors.add(:notification_email, "is not an email you own") unless self.all_emails.include?(self.notification_email) - end - - # Groups user has access to - def authorized_groups - @authorized_groups ||= begin - group_ids = (groups.pluck(:id) + authorized_projects.pluck(:namespace_id)) - Group.where(id: group_ids) - end - end - - - # Projects user has access to - def authorized_projects - @authorized_projects ||= begin - project_ids = personal_projects.pluck(:id) - project_ids.push(*groups_projects.pluck(:id)) - project_ids.push(*projects.pluck(:id).uniq) - Project.where(id: project_ids) - end - end - - def owned_projects - @owned_projects ||= begin - Project.where(namespace_id: owned_groups.pluck(:id).push(namespace.id)).joins(:namespace) - end - end - - # Team membership in authorized projects - def tm_in_authorized_projects - ProjectMember.where(source_id: authorized_projects.map(&:id), user_id: self.id) - end - - def is_admin? - admin - end - - def require_ssh_key? - keys.count == 0 - end - - def require_password? - password_automatically_set? && !ldap_user? - end - - def can_change_username? - gitlab_config.username_changing_enabled - end - - def can_create_project? - projects_limit_left > 0 - end - - def can_create_group? - can?(:create_group, nil) - end - - def abilities - Ability.abilities - end - - def can_select_namespace? - several_namespaces? || admin - end - - def can?(action, subject) - abilities.allowed?(self, action, subject) - end - - def first_name - name.split.first unless name.blank? - end - - def cared_merge_requests - MergeRequest.cared(self) - end - - def projects_limit_left - projects_limit - personal_projects.count - end - - def projects_limit_percent - return 100 if projects_limit.zero? - (personal_projects.count.to_f / projects_limit) * 100 - end - - def recent_push(project_id = nil) - # Get push events not earlier than 2 hours ago - events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours) - events = events.where(project_id: project_id) if project_id - - # Take only latest one - events = events.recent.limit(1).first - end - - def projects_sorted_by_activity - authorized_projects.sorted_by_activity - end - - def several_namespaces? - owned_groups.any? || masters_groups.any? - end - - def namespace_id - namespace.try :id - end - - def name_with_username - "#{name} (#{username})" - end - - def tm_of(project) - project.project_member_by_id(self.id) - end - - def already_forked?(project) - !!fork_of(project) - end - - def fork_of(project) - links = ForkedProjectLink.where(forked_from_project_id: project, forked_to_project_id: personal_projects) - - if links.any? - links.first.forked_to_project - else - nil - end - end - - def ldap_user? - identities.exists?(["provider LIKE ? AND extern_uid IS NOT NULL", "ldap%"]) - end - - def ldap_identity - @ldap_identity ||= identities.find_by(["provider LIKE ?", "ldap%"]) - end - - def project_deploy_keys - DeployKey.in_projects(self.authorized_projects.pluck(:id)) - end - - def accessible_deploy_keys - @accessible_deploy_keys ||= begin - key_ids = project_deploy_keys.pluck(:id) - key_ids.push(*DeployKey.are_public.pluck(:id)) - DeployKey.where(id: key_ids) - end - end - - def created_by - User.find_by(id: created_by_id) if created_by_id - end - - def sanitize_attrs - %w(name username skype linkedin twitter bio).each do |attr| - value = self.send(attr) - self.send("#{attr}=", Sanitize.clean(value)) if value.present? - end - end - - def set_notification_email - if self.notification_email.blank? || !self.all_emails.include?(self.notification_email) - self.notification_email = self.email - end - end - - def set_public_email - if self.public_email.blank? || !self.all_emails.include?(self.public_email) - self.public_email = '' - end - end - - def set_projects_limit - connection_default_value_defined = new_record? && !projects_limit_changed? - return unless self.projects_limit.nil? || connection_default_value_defined - - self.projects_limit = current_application_settings.default_projects_limit - end - - def requires_ldap_check? - if !Gitlab.config.ldap.enabled - false - elsif ldap_user? - !last_credential_check_at || (last_credential_check_at + 1.hour) < Time.now - else - false - end - end - - def solo_owned_groups - @solo_owned_groups ||= owned_groups.select do |group| - group.owners == [self] - end - end - - def with_defaults - User.defaults.each do |k, v| - self.send("#{k}=", v) - end - - self - end - - def can_leave_project?(project) - project.namespace != namespace && - project.project_member(self) - end - - # Reset project events cache related to this user - # - # Since we do cache @event we need to reset cache in special cases: - # * when the user changes their avatar - # Events cache stored like events/23-20130109142513. - # The cache key includes updated_at timestamp. - # Thus it will automatically generate a new fragment - # when the event is updated because the key changes. - def reset_events_cache - Event.where(author_id: self.id). - order('id DESC').limit(1000). - update_all(updated_at: Time.now) - end - - def full_website_url - return "http://#{website_url}" if website_url !~ /\Ahttps?:\/\// - - website_url - end - - def short_website_url - website_url.sub(/\Ahttps?:\/\//, '') - end - - def all_ssh_keys - keys.map(&:key) - end - - def temp_oauth_email? - email.start_with?('temp-email-for-oauth') - end - - def public_profile? - authorized_projects.public_only.any? - end - - def avatar_url(size = nil) - if avatar.present? - [gitlab_config.url, avatar.url].join - else - GravatarService.new.execute(email, size) - end - end - - def all_emails - [self.email, *self.emails.map(&:email)] - end - - def hook_attrs - { - name: name, - username: username, - avatar_url: avatar_url - } - end - - def ensure_namespace_correct - # Ensure user has namespace - self.create_namespace!(path: self.username, name: self.username) unless self.namespace - - if self.username_changed? - self.namespace.update_attributes(path: self.username, name: self.username) - end - end - - def post_create_hook - log_info("User \"#{self.name}\" (#{self.email}) was created") - notification_service.new_user(self, @reset_token) if self.created_by_id - system_hook_service.execute_hooks_for(self, :create) - end - - def post_destroy_hook - log_info("User \"#{self.name}\" (#{self.email}) was removed") - system_hook_service.execute_hooks_for(self, :destroy) - end - - def notification_service - NotificationService.new - end - - def log_info(message) - Gitlab::AppLogger.info message - end - - def system_hook_service - SystemHooksService.new - end - - def starred?(project) - starred_projects.exists?(project) - end - - def toggle_star(project) - user_star_project = users_star_projects. - where(project: project, user: self).take - if user_star_project - user_star_project.destroy - else - UsersStarProject.create!(project: project, user: self) - end - end - - def manageable_namespaces - @manageable_namespaces ||= - begin - namespaces = [] - namespaces << namespace - namespaces += owned_groups - namespaces += masters_groups - end - end - - def oauth_authorized_tokens - Doorkeeper::AccessToken.where(resource_owner_id: self.id, revoked_at: nil) - end - - def contributed_projects_ids - Event.contributions.where(author_id: self). - where("created_at > ?", Time.now - 1.year). - reorder(project_id: :desc). - select(:project_id). - uniq.map(&:project_id) - end -end diff --git a/app/models/users_star_project.rb b/app/models/users_star_project.rb deleted file mode 100644 index 3d49cb05949..00000000000 --- a/app/models/users_star_project.rb +++ /dev/null @@ -1,19 +0,0 @@ -# == Schema Information -# -# Table name: users_star_projects -# -# id :integer not null, primary key -# project_id :integer not null -# user_id :integer not null -# created_at :datetime -# updated_at :datetime -# - -class UsersStarProject < ActiveRecord::Base - belongs_to :project, counter_cache: :star_count - belongs_to :user - - validates :user, presence: true - validates :user_id, uniqueness: { scope: [:project_id] } - validates :project, presence: true -end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb deleted file mode 100644 index e9413c34bae..00000000000 --- a/app/models/wiki_page.rb +++ /dev/null @@ -1,201 +0,0 @@ -class WikiPage - include ActiveModel::Validations - include ActiveModel::Conversion - include StaticModel - extend ActiveModel::Naming - - def self.primary_key - 'slug' - end - - def self.model_name - ActiveModel::Name.new(self, nil, 'wiki') - end - - def to_key - [:slug] - end - - validates :title, presence: true - validates :content, presence: true - - # The Gitlab ProjectWiki instance. - attr_reader :wiki - - # The raw Gollum::Page instance. - attr_reader :page - - # The attributes Hash used for storing and validating - # new Page values before writing to the Gollum repository. - attr_accessor :attributes - - def initialize(wiki, page = nil, persisted = false) - @wiki = wiki - @page = page - @persisted = persisted - @attributes = {}.with_indifferent_access - - set_attributes if persisted? - end - - # The escaped URL path of this page. - def slug - @attributes[:slug] - end - - alias_method :to_param, :slug - - # The formatted title of this page. - def title - if @attributes[:title] - @attributes[:title].gsub(/-+/, ' ') - else - "" - end - end - - # Sets the title of this page. - def title=(new_title) - @attributes[:title] = new_title - end - - # The raw content of this page. - def content - @attributes[:content] ||= if @page - @page.raw_data - end - end - - # The processed/formatted content of this page. - def formatted_content - @attributes[:formatted_content] ||= if @page - @page.formatted_data - end - end - - # The markup format for the page. - def format - @attributes[:format] || :markdown - end - - # The commit message for this page version. - def message - version.try(:message) - end - - # The Gitlab Commit instance for this page. - def version - return nil unless persisted? - - @version ||= @page.version - end - - # Returns an array of Gitlab Commit instances. - def versions - return [] unless persisted? - - @page.versions - end - - def commit - versions.first - end - - # Returns the Date that this latest version was - # created on. - def created_at - @page.version.date - end - - # Returns boolean True or False if this instance - # is an old version of the page. - def historical? - @page.historical? - end - - # Returns boolean True or False if this instance - # has been fully saved to disk or not. - def persisted? - @persisted == true - end - - # Creates a new Wiki Page. - # - # attr - Hash of attributes to set on the new page. - # :title - The title for the new page. - # :content - The raw markup content. - # :format - Optional symbol representing the - # content format. Can be any type - # listed in the ProjectWiki::MARKUPS - # Hash. - # :message - Optional commit message to set on - # the new page. - # - # Returns the String SHA1 of the newly created page - # or False if the save was unsuccessful. - def create(attr = {}) - @attributes.merge!(attr) - - save :create_page, title, content, format, message - end - - # Updates an existing Wiki Page, creating a new version. - # - # new_content - The raw markup content to replace the existing. - # format - Optional symbol representing the content format. - # See ProjectWiki::MARKUPS Hash for available formats. - # message - Optional commit message to set on the new version. - # - # Returns the String SHA1 of the newly created page - # or False if the save was unsuccessful. - def update(new_content = "", format = :markdown, message = nil) - @attributes[:content] = new_content - @attributes[:format] = format - - save :update_page, @page, content, format, message - end - - # Destroys the Wiki Page. - # - # Returns boolean True or False. - def delete - if wiki.delete_page(@page) - true - else - false - end - end - - private - - def set_attributes - attributes[:slug] = @page.escaped_url_path - attributes[:title] = @page.title - attributes[:format] = @page.format - end - - def save(method, *args) - project_wiki = wiki - if valid? && project_wiki.send(method, *args) - - page_details = if method == :update_page - # Use url_path instead of path to omit format extension - @page.url_path - else - title - end - - page_title, page_dir = project_wiki.page_title_and_dir(page_details) - gollum_wiki = project_wiki.wiki - @page = gollum_wiki.paged(page_title, page_dir) - - set_attributes - - @persisted = true - else - errors.add(:base, project_wiki.error_message) if project_wiki.error_message - @persisted = false - end - @persisted - end -end diff --git a/app/services/archive_repository_service.rb b/app/services/archive_repository_service.rb deleted file mode 100644 index e1b41527d8d..00000000000 --- a/app/services/archive_repository_service.rb +++ /dev/null @@ -1,62 +0,0 @@ -class ArchiveRepositoryService - attr_reader :project, :ref, :format - - def initialize(project, ref, format) - format ||= 'tar.gz' - @project, @ref, @format = project, ref, format.downcase - end - - def execute(options = {}) - project.repository.clean_old_archives - - raise "No archive file path" unless file_path - - return file_path if archived? - - unless archiving? - RepositoryArchiveWorker.perform_async(project.id, ref, format) - end - - archived = wait_until_archived(options[:timeout] || 5.0) - - file_path if archived - end - - private - - def storage_path - Gitlab.config.gitlab.repository_downloads_path - end - - def file_path - @file_path ||= project.repository.archive_file_path(ref, storage_path, format) - end - - def pid_file_path - @pid_file_path ||= project.repository.archive_pid_file_path(ref, storage_path, format) - end - - def archived? - File.exist?(file_path) - end - - def archiving? - File.exist?(pid_file_path) - end - - def wait_until_archived(timeout = 5.0) - return archived? if timeout == 0.0 - - t1 = Time.now - - begin - sleep 0.1 - - success = archived? - - t2 = Time.now - end until success || t2 - t1 >= timeout - - success - end -end diff --git a/app/services/base_service.rb b/app/services/base_service.rb deleted file mode 100644 index 6d9ed345914..00000000000 --- a/app/services/base_service.rb +++ /dev/null @@ -1,66 +0,0 @@ -class BaseService - include Gitlab::CurrentSettings - - attr_accessor :project, :current_user, :params - - def initialize(project, user, params = {}) - @project, @current_user, @params = project, user, params.dup - end - - def abilities - Ability.abilities - end - - def can?(object, action, subject) - abilities.allowed?(object, action, subject) - end - - def notification_service - NotificationService.new - end - - def event_service - EventCreateService.new - end - - def log_info(message) - Gitlab::AppLogger.info message - end - - def system_hook_service - SystemHooksService.new - end - - # Add an error to the specified model for restricted visibility levels - def deny_visibility_level(model, denied_visibility_level = nil) - denied_visibility_level ||= model.visibility_level - - level_name = 'Unknown' - Gitlab::VisibilityLevel.options.each do |name, level| - level_name = name if level == denied_visibility_level - end - - model.errors.add( - :visibility_level, - "#{level_name} visibility has been restricted by your GitLab administrator" - ) - end - - private - - def error(message, http_status = nil) - result = { - message: message, - status: :error - } - - result[:http_status] = http_status if http_status - result - end - - def success - { - status: :success - } - end -end diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb deleted file mode 100644 index 6aa9df4b194..00000000000 --- a/app/services/compare_service.rb +++ /dev/null @@ -1,27 +0,0 @@ -# Compare 2 branches for one repo or between repositories -# and return Gitlab::CompareResult object that responds to commits and diffs -class CompareService - def execute(current_user, source_project, source_branch, target_project, target_branch) - # Try to compare branches to get commits list and diffs - # - # Note: Use satellite only when need to compare between two repos - # because satellites are slower than operations on bare repo - if target_project == source_project - Gitlab::CompareResult.new( - Gitlab::Git::Compare.new( - target_project.repository.raw_repository, - target_branch, - source_branch, - ) - ) - else - Gitlab::Satellite::CompareAction.new( - current_user, - target_project, - target_branch, - source_project, - source_branch - ).result - end - end -end diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb deleted file mode 100644 index cf7ae4345f3..00000000000 --- a/app/services/create_branch_service.rb +++ /dev/null @@ -1,42 +0,0 @@ -require_relative 'base_service' - -class CreateBranchService < BaseService - def execute(branch_name, ref) - valid_branch = Gitlab::GitRefValidator.validate(branch_name) - if valid_branch == false - return error('Branch name invalid') - end - - repository = project.repository - existing_branch = repository.find_branch(branch_name) - if existing_branch - return error('Branch already exists') - end - - repository.add_branch(branch_name, ref) - new_branch = repository.find_branch(branch_name) - - if new_branch - push_data = build_push_data(project, current_user, new_branch) - - EventCreateService.new.push(project, current_user, push_data) - project.execute_hooks(push_data.dup, :push_hooks) - project.execute_services(push_data.dup, :push_hooks) - - success(new_branch) - else - error('Invalid reference name') - end - end - - def success(branch) - out = super() - out[:branch] = branch - out - end - - def build_push_data(project, user, branch) - Gitlab::PushDataBuilder. - build(project, user, Gitlab::Git::BLANK_SHA, branch.target, "#{Gitlab::Git::BRANCH_REF_PREFIX}#{branch.name}", []) - end -end diff --git a/app/services/create_snippet_service.rb b/app/services/create_snippet_service.rb deleted file mode 100644 index 101a3df5eee..00000000000 --- a/app/services/create_snippet_service.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CreateSnippetService < BaseService - def execute - if project.nil? - snippet = PersonalSnippet.new(params) - else - snippet = project.snippets.build(params) - end - - unless Gitlab::VisibilityLevel.allowed_for?(current_user, - params[:visibility_level]) - deny_visibility_level(snippet) - return snippet - end - - snippet.author = current_user - - snippet.save - snippet - end -end diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb deleted file mode 100644 index 25f9e203246..00000000000 --- a/app/services/create_tag_service.rb +++ /dev/null @@ -1,45 +0,0 @@ -require_relative 'base_service' - -class CreateTagService < BaseService - def execute(tag_name, ref, message) - valid_tag = Gitlab::GitRefValidator.validate(tag_name) - if valid_tag == false - return error('Tag name invalid') - end - - repository = project.repository - existing_tag = repository.find_tag(tag_name) - if existing_tag - return error('Tag already exists') - end - - message.strip! if message - - repository.add_tag(tag_name, ref, message) - new_tag = repository.find_tag(tag_name) - - if new_tag - push_data = create_push_data(project, current_user, new_tag) - - EventCreateService.new.push(project, current_user, push_data) - project.execute_hooks(push_data.dup, :tag_push_hooks) - project.execute_services(push_data.dup, :tag_push_hooks) - - success(new_tag) - else - error('Invalid reference name') - end - end - - def success(branch) - out = super() - out[:tag] = branch - out - end - - def create_push_data(project, user, tag) - commits = [project.repository.commit(tag.target)].compact - Gitlab::PushDataBuilder. - build(project, user, Gitlab::Git::BLANK_SHA, tag.target, "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}", commits, tag.message) - end -end diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb deleted file mode 100644 index b19b112a0c4..00000000000 --- a/app/services/delete_branch_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -require_relative 'base_service' - -class DeleteBranchService < BaseService - def execute(branch_name) - repository = project.repository - branch = repository.find_branch(branch_name) - - # No such branch - unless branch - return error('No such branch', 404) - end - - if branch_name == repository.root_ref - return error('Cannot remove HEAD branch', 405) - end - - # Dont allow remove of protected branch - if project.protected_branch?(branch_name) - return error('Protected branch cant be removed', 405) - end - - # Dont allow user to remove branch if he is not allowed to push - unless current_user.can?(:push_code, project) - return error('You dont have push access to repo', 405) - end - - if repository.rm_branch(branch_name) - push_data = build_push_data(branch) - - EventCreateService.new.push(project, current_user, push_data) - project.execute_hooks(push_data.dup, :push_hooks) - project.execute_services(push_data.dup, :push_hooks) - - success('Branch was removed') - else - error('Failed to remove branch') - end - end - - def error(message, return_code = 400) - out = super(message) - out[:return_code] = return_code - out - end - - def success(message) - out = super() - out[:message] = message - out - end - - def build_push_data(branch) - Gitlab::PushDataBuilder - .build(project, current_user, branch.target, Gitlab::Git::BLANK_SHA, "#{Gitlab::Git::BRANCH_REF_PREFIX}#{branch.name}", []) - end -end diff --git a/app/services/delete_tag_service.rb b/app/services/delete_tag_service.rb deleted file mode 100644 index 0c836401136..00000000000 --- a/app/services/delete_tag_service.rb +++ /dev/null @@ -1,42 +0,0 @@ -require_relative 'base_service' - -class DeleteTagService < BaseService - def execute(tag_name) - repository = project.repository - tag = repository.find_tag(tag_name) - - # No such tag - unless tag - return error('No such tag', 404) - end - - if repository.rm_tag(tag_name) - push_data = build_push_data(tag) - - EventCreateService.new.push(project, current_user, push_data) - project.execute_hooks(push_data.dup, :tag_push_hooks) - project.execute_services(push_data.dup, :tag_push_hooks) - - success('Tag was removed') - else - error('Failed to remove tag') - end - end - - def error(message, return_code = 400) - out = super(message) - out[:return_code] = return_code - out - end - - def success(message) - out = super() - out[:message] = message - out - end - - def build_push_data(tag) - Gitlab::PushDataBuilder - .build(project, current_user, tag.target, Gitlab::Git::BLANK_SHA, "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}", []) - end -end diff --git a/app/services/event_create_service.rb b/app/services/event_create_service.rb deleted file mode 100644 index 103d6b0a08b..00000000000 --- a/app/services/event_create_service.rb +++ /dev/null @@ -1,84 +0,0 @@ -# EventCreateService class -# -# Used for creating events feed on dashboard after certain user action -# -# Ex. -# EventCreateService.new.new_issue(issue, current_user) -# -class EventCreateService - def open_issue(issue, current_user) - create_record_event(issue, current_user, Event::CREATED) - end - - def close_issue(issue, current_user) - create_record_event(issue, current_user, Event::CLOSED) - end - - def reopen_issue(issue, current_user) - create_record_event(issue, current_user, Event::REOPENED) - end - - def open_mr(merge_request, current_user) - create_record_event(merge_request, current_user, Event::CREATED) - end - - def close_mr(merge_request, current_user) - create_record_event(merge_request, current_user, Event::CLOSED) - end - - def reopen_mr(merge_request, current_user) - create_record_event(merge_request, current_user, Event::REOPENED) - end - - def merge_mr(merge_request, current_user) - create_record_event(merge_request, current_user, Event::MERGED) - end - - def open_milestone(milestone, current_user) - create_record_event(milestone, current_user, Event::CREATED) - end - - def close_milestone(milestone, current_user) - create_record_event(milestone, current_user, Event::CLOSED) - end - - def reopen_milestone(milestone, current_user) - create_record_event(milestone, current_user, Event::REOPENED) - end - - def leave_note(note, current_user) - create_record_event(note, current_user, Event::COMMENTED) - end - - def join_project(project, current_user) - create_event(project, current_user, Event::JOINED) - end - - def leave_project(project, current_user) - create_event(project, current_user, Event::LEFT) - end - - def create_project(project, current_user) - create_event(project, current_user, Event::CREATED) - end - - def push(project, current_user, push_data) - create_event(project, current_user, Event::PUSHED, data: push_data) - end - - private - - def create_record_event(record, current_user, status) - create_event(record.project, current_user, status, target_id: record.id, target_type: record.class.name) - end - - def create_event(project, current_user, status, attributes = {}) - attributes.reverse_merge!( - project: project, - action: status, - author_id: current_user.id - ) - - Event.create(attributes) - end -end diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb deleted file mode 100644 index bd245100955..00000000000 --- a/app/services/files/base_service.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Files - class BaseService < ::BaseService - attr_reader :ref, :path - - def initialize(project, user, params, ref, path = nil) - @project, @current_user, @params = project, user, params.dup - @ref = ref - @path = path - end - - private - - def repository - project.repository - end - end -end diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb deleted file mode 100644 index 23833aa78ec..00000000000 --- a/app/services/files/create_service.rb +++ /dev/null @@ -1,52 +0,0 @@ -require_relative "base_service" - -module Files - class CreateService < BaseService - def execute - allowed = Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref) - - unless allowed - return error("You are not allowed to create file in this branch") - end - - file_name = File.basename(path) - file_path = path - - unless file_name =~ Gitlab::Regex.file_name_regex - return error( - 'Your changes could not be committed, because the file name ' + - Gitlab::Regex.file_name_regex_message - ) - end - - if project.empty_repo? - # everything is ok because repo does not have a commits yet - else - unless repository.branch_names.include?(ref) - return error("You can only create files if you are on top of a branch") - end - - blob = repository.blob_at_branch(ref, file_path) - - if blob - return error("Your changes could not be committed, because file with such name exists") - end - end - - - new_file_action = Gitlab::Satellite::NewFileAction.new(current_user, project, ref, file_path) - created_successfully = new_file_action.commit!( - params[:content], - params[:commit_message], - params[:encoding], - params[:new_branch] - ) - - if created_successfully - success - else - error("Your changes could not be committed, because the file has been changed") - end - end - end -end diff --git a/app/services/files/delete_service.rb b/app/services/files/delete_service.rb deleted file mode 100644 index 1497a0f883b..00000000000 --- a/app/services/files/delete_service.rb +++ /dev/null @@ -1,36 +0,0 @@ -require_relative "base_service" - -module Files - class DeleteService < BaseService - def execute - allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref) - - unless allowed - return error("You are not allowed to push into this branch") - end - - unless repository.branch_names.include?(ref) - return error("You can only create files if you are on top of a branch") - end - - blob = repository.blob_at_branch(ref, path) - - unless blob - return error("You can only edit text files") - end - - delete_file_action = Gitlab::Satellite::DeleteFileAction.new(current_user, project, ref, path) - - deleted_successfully = delete_file_action.commit!( - nil, - params[:commit_message] - ) - - if deleted_successfully - success - else - error("Your changes could not be committed, because the file has been changed") - end - end - end -end diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb deleted file mode 100644 index 0724d3ae634..00000000000 --- a/app/services/files/update_service.rb +++ /dev/null @@ -1,39 +0,0 @@ -require_relative "base_service" - -module Files - class UpdateService < BaseService - def execute - allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref) - - unless allowed - return error("You are not allowed to push into this branch") - end - - unless repository.branch_names.include?(ref) - return error("You can only create files if you are on top of a branch") - end - - blob = repository.blob_at_branch(ref, path) - - unless blob - return error("You can only edit text files") - end - - edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, project, ref, path) - edit_file_action.commit!( - params[:content], - params[:commit_message], - params[:encoding], - params[:new_branch] - ) - - success - rescue Gitlab::Satellite::CheckoutFailed => ex - error("Your changes could not be committed because ref '#{ref}' could not be checked out", 400) - rescue Gitlab::Satellite::CommitFailed => ex - error("Your changes could not be committed. Maybe there was nothing to commit?", 409) - rescue Gitlab::Satellite::PushFailed => ex - error("Your changes could not be committed. Maybe the file was changed by another process?", 409) - end - end -end diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb deleted file mode 100644 index 31e0167d247..00000000000 --- a/app/services/git_push_service.rb +++ /dev/null @@ -1,132 +0,0 @@ -class GitPushService - attr_accessor :project, :user, :push_data, :push_commits - include Gitlab::CurrentSettings - include Gitlab::Access - - # This method will be called after each git update - # and only if the provided user and project is present in GitLab. - # - # All callbacks for post receive action should be placed here. - # - # Next, this method: - # 1. Creates the push event - # 2. Ensures that the project satellite exists - # 3. Updates merge requests - # 4. Recognizes cross-references from commit messages - # 5. Executes the project's web hooks - # 6. Executes the project's services - # - def execute(project, user, oldrev, newrev, ref) - @project, @user = project, user - - project.ensure_satellite_exists - project.repository.expire_cache - project.update_repository_size - - if push_remove_branch?(ref, newrev) - @push_commits = [] - elsif push_to_new_branch?(ref, oldrev) - # Re-find the pushed commits. - if is_default_branch?(ref) - # Initial push to the default branch. Take the full history of that branch as "newly pushed". - @push_commits = project.repository.commits(newrev) - - # Set protection on the default branch if configured - if (current_application_settings.default_branch_protection != PROTECTION_NONE) - developers_can_push = current_application_settings.default_branch_protection == PROTECTION_DEV_CAN_PUSH ? true : false - project.protected_branches.create({ name: project.default_branch, developers_can_push: developers_can_push }) - end - else - # Use the pushed commits that aren't reachable by the default branch - # as a heuristic. This may include more commits than are actually pushed, but - # that shouldn't matter because we check for existing cross-references later. - @push_commits = project.repository.commits_between(project.default_branch, newrev) - - # don't process commits for the initial push to the default branch - process_commit_messages(ref) - end - elsif push_to_existing_branch?(ref, oldrev) - # Collect data for this git push - @push_commits = project.repository.commits_between(oldrev, newrev) - project.update_merge_requests(oldrev, newrev, ref, @user) - process_commit_messages(ref) - end - - @push_data = build_push_data(oldrev, newrev, ref) - - EventCreateService.new.push(project, user, @push_data) - project.execute_hooks(@push_data.dup, :push_hooks) - project.execute_services(@push_data.dup, :push_hooks) - end - - protected - - # Extract any GFM references from the pushed commit messages. If the configured issue-closing regex is matched, - # close the referenced Issue. Create cross-reference Notes corresponding to any other referenced Mentionables. - def process_commit_messages(ref) - is_default_branch = is_default_branch?(ref) - - @push_commits.each do |commit| - # Close issues if these commits were pushed to the project's default branch and the commit message matches the - # closing regex. Exclude any mentioned Issues from cross-referencing even if the commits are being pushed to - # a different branch. - issues_to_close = commit.closes_issues(project, user) - - # Load commit author only if needed. - # For push with 1k commits it prevents 900+ requests in database - author = nil - - if issues_to_close.present? && is_default_branch - author ||= commit_user(commit) - - issues_to_close.each do |issue| - Issues::CloseService.new(project, author, {}).execute(issue, commit) - end - end - - # Create cross-reference notes for any other references. Omit any issues that were referenced in an - # issue-closing phrase, or have already been mentioned from this commit (probably from this commit - # being pushed to a different branch). - refs = commit.references(project, user) - issues_to_close - refs.reject! { |r| commit.has_mentioned?(r) } - - if refs.present? - author ||= commit_user(commit) - - refs.each do |r| - Note.create_cross_reference_note(r, commit, author, project) - end - end - end - end - - def build_push_data(oldrev, newrev, ref) - Gitlab::PushDataBuilder. - build(project, user, oldrev, newrev, ref, push_commits) - end - - def push_to_existing_branch?(ref, oldrev) - # Return if this is not a push to a branch (e.g. new commits) - Gitlab::Git.branch_ref?(ref) && !Gitlab::Git.blank_ref?(oldrev) - end - - def push_to_new_branch?(ref, oldrev) - Gitlab::Git.branch_ref?(ref) && Gitlab::Git.blank_ref?(oldrev) - end - - def push_remove_branch?(ref, newrev) - Gitlab::Git.branch_ref?(ref) && Gitlab::Git.blank_ref?(newrev) - end - - def push_to_branch?(ref) - Gitlab::Git.branch_ref?(ref) - end - - def is_default_branch?(ref) - Gitlab::Git.branch_ref?(ref) && Gitlab::Git.ref_name(ref) == project.default_branch - end - - def commit_user(commit) - commit.author || user - end -end diff --git a/app/services/git_tag_push_service.rb b/app/services/git_tag_push_service.rb deleted file mode 100644 index bf203bbd692..00000000000 --- a/app/services/git_tag_push_service.rb +++ /dev/null @@ -1,37 +0,0 @@ -class GitTagPushService - attr_accessor :project, :user, :push_data - - def execute(project, user, oldrev, newrev, ref) - @project, @user = project, user - - @push_data = build_push_data(oldrev, newrev, ref) - - EventCreateService.new.push(project, user, @push_data) - project.execute_hooks(@push_data.dup, :tag_push_hooks) - project.execute_services(@push_data.dup, :tag_push_hooks) - - project.repository.expire_cache - - true - end - - private - - def build_push_data(oldrev, newrev, ref) - commits = [] - message = nil - - if !Gitlab::Git.blank_ref?(newrev) - tag_name = Gitlab::Git.ref_name(ref) - tag = project.repository.find_tag(tag_name) - if tag && tag.target == newrev - commit = project.repository.commit(tag.target) - commits = [commit].compact - message = tag.message - end - end - - Gitlab::PushDataBuilder. - build(project, user, oldrev, newrev, ref, commits, message) - end -end diff --git a/app/services/gravatar_service.rb b/app/services/gravatar_service.rb deleted file mode 100644 index 4bee0c26a68..00000000000 --- a/app/services/gravatar_service.rb +++ /dev/null @@ -1,30 +0,0 @@ -class GravatarService - include Gitlab::CurrentSettings - - def execute(email, size = nil) - if current_application_settings.gravatar_enabled? && email.present? - size = 40 if size.nil? || size <= 0 - - sprintf gravatar_url, - hash: Digest::MD5.hexdigest(email.strip.downcase), - size: size, - email: email.strip - end - end - - def gitlab_config - Gitlab.config.gitlab - end - - def gravatar_config - Gitlab.config.gravatar - end - - def gravatar_url - if gitlab_config.https - gravatar_config.ssl_url - else - gravatar_config.plain_url - end - end -end diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb deleted file mode 100644 index 5e1906ad2ae..00000000000 --- a/app/services/issuable_base_service.rb +++ /dev/null @@ -1,18 +0,0 @@ -class IssuableBaseService < BaseService - private - - def create_assignee_note(issuable) - Note.create_assignee_change_note( - issuable, issuable.project, current_user, issuable.assignee) - end - - def create_milestone_note(issuable) - Note.create_milestone_change_note( - issuable, issuable.project, current_user, issuable.milestone) - end - - def create_labels_note(issuable, added_labels, removed_labels) - Note.create_labels_change_note( - issuable, issuable.project, current_user, added_labels, removed_labels) - end -end diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb deleted file mode 100644 index c3ca04a4343..00000000000 --- a/app/services/issues/base_service.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Issues - class BaseService < ::IssuableBaseService - - def hook_data(issue, action) - issue_data = issue.to_hook_data(current_user) - issue_url = Gitlab::UrlBuilder.new(:issue).build(issue.id) - issue_data[:object_attributes].merge!(url: issue_url, action: action) - issue_data - end - - private - - def execute_hooks(issue, action = 'open') - issue_data = hook_data(issue, action) - issue.project.execute_hooks(issue_data, :issue_hooks) - issue.project.execute_services(issue_data, :issue_hooks) - end - end -end diff --git a/app/services/issues/bulk_update_service.rb b/app/services/issues/bulk_update_service.rb deleted file mode 100644 index eb07413ee94..00000000000 --- a/app/services/issues/bulk_update_service.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Issues - class BulkUpdateService < BaseService - def execute - issues_ids = params.delete(:issues_ids).split(",") - issue_params = params - - issue_params.delete(:state_event) unless issue_params[:state_event].present? - issue_params.delete(:milestone_id) unless issue_params[:milestone_id].present? - issue_params.delete(:assignee_id) unless issue_params[:assignee_id].present? - - issues = Issue.where(id: issues_ids) - issues.each do |issue| - next unless can?(current_user, :modify_issue, issue) - - Issues::UpdateService.new(issue.project, current_user, issue_params).execute(issue) - end - - { - count: issues.count, - success: !issues.count.zero? - } - end - end -end diff --git a/app/services/issues/close_service.rb b/app/services/issues/close_service.rb deleted file mode 100644 index f670019cc63..00000000000 --- a/app/services/issues/close_service.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Issues - class CloseService < Issues::BaseService - def execute(issue, commit = nil) - if issue.close - event_service.close_issue(issue, current_user) - create_note(issue, commit) - notification_service.close_issue(issue, current_user) - execute_hooks(issue, 'close') - end - - issue - end - - private - - def create_note(issue, current_commit) - Note.create_status_change_note(issue, issue.project, current_user, issue.state, current_commit) - end - end -end diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb deleted file mode 100644 index d5c17906a55..00000000000 --- a/app/services/issues/create_service.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Issues - class CreateService < Issues::BaseService - def execute - label_params = params[:label_ids] - issue = project.issues.new(params.except(:label_ids)) - issue.author = current_user - - if issue.save - issue.update_attributes(label_ids: label_params) - notification_service.new_issue(issue, current_user) - event_service.open_issue(issue, current_user) - issue.create_cross_references!(issue.project, current_user) - execute_hooks(issue, 'open') - end - - issue - end - end -end diff --git a/app/services/issues/reopen_service.rb b/app/services/issues/reopen_service.rb deleted file mode 100644 index 1e5c398516d..00000000000 --- a/app/services/issues/reopen_service.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Issues - class ReopenService < Issues::BaseService - def execute(issue) - if issue.reopen - event_service.reopen_issue(issue, current_user) - create_note(issue) - notification_service.reopen_issue(issue, current_user) - execute_hooks(issue, 'reopen') - end - - issue - end - - private - - def create_note(issue) - Note.create_status_change_note(issue, issue.project, current_user, issue.state, nil) - end - end -end diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb deleted file mode 100644 index 8f04a69287a..00000000000 --- a/app/services/issues/update_service.rb +++ /dev/null @@ -1,47 +0,0 @@ -module Issues - class UpdateService < Issues::BaseService - def execute(issue) - state = params[:state_event] - - case state - when 'reopen' - Issues::ReopenService.new(project, current_user, {}).execute(issue) - when 'close' - Issues::CloseService.new(project, current_user, {}).execute(issue) - when 'task_check' - issue.update_nth_task(params[:task_num].to_i, true) - when 'task_uncheck' - issue.update_nth_task(params[:task_num].to_i, false) - end - - params[:assignee_id] = "" if params[:assignee_id] == IssuableFinder::NONE - params[:milestone_id] = "" if params[:milestone_id] == IssuableFinder::NONE - - old_labels = issue.labels.to_a - - if params.present? && issue.update_attributes(params.except(:state_event, - :task_num)) - issue.reset_events_cache - - if issue.labels != old_labels - create_labels_note( - issue, issue.labels - old_labels, old_labels - issue.labels) - end - - if issue.previous_changes.include?('milestone_id') - create_milestone_note(issue) - end - - if issue.previous_changes.include?('assignee_id') - create_assignee_note(issue) - notification_service.reassigned_issue(issue, current_user) - end - - issue.notice_added_references(issue.project, current_user) - execute_hooks(issue, 'update') - end - - issue - end - end -end diff --git a/app/services/merge_requests/auto_merge_service.rb b/app/services/merge_requests/auto_merge_service.rb deleted file mode 100644 index 378b39bb9d6..00000000000 --- a/app/services/merge_requests/auto_merge_service.rb +++ /dev/null @@ -1,30 +0,0 @@ -module MergeRequests - # AutoMergeService class - # - # Do git merge in satellite and in case of success - # mark merge request as merged and execute all hooks and notifications - # Called when you do merge via GitLab UI - class AutoMergeService < BaseMergeService - def execute(merge_request, commit_message) - merge_request.lock_mr - - if Gitlab::Satellite::MergeAction.new(current_user, merge_request).merge!(commit_message) - merge_request.merge - - create_merge_event(merge_request, current_user) - create_note(merge_request) - notification_service.merge_mr(merge_request, current_user) - execute_hooks(merge_request) - - true - else - merge_request.unlock_mr - false - end - rescue - merge_request.unlock_mr if merge_request.locked? - merge_request.mark_as_unmergeable - false - end - end -end diff --git a/app/services/merge_requests/base_merge_service.rb b/app/services/merge_requests/base_merge_service.rb deleted file mode 100644 index 9579573adf9..00000000000 --- a/app/services/merge_requests/base_merge_service.rb +++ /dev/null @@ -1,10 +0,0 @@ -module MergeRequests - class BaseMergeService < MergeRequests::BaseService - - private - - def create_merge_event(merge_request, current_user) - EventCreateService.new.merge_mr(merge_request, current_user) - end - end -end diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb deleted file mode 100644 index f6e1ae6f283..00000000000 --- a/app/services/merge_requests/base_service.rb +++ /dev/null @@ -1,24 +0,0 @@ -module MergeRequests - class BaseService < ::IssuableBaseService - - def create_note(merge_request) - Note.create_status_change_note(merge_request, merge_request.target_project, current_user, merge_request.state, nil) - end - - def hook_data(merge_request, action) - hook_data = merge_request.to_hook_data(current_user) - merge_request_url = Gitlab::UrlBuilder.new(:merge_request).build(merge_request.id) - hook_data[:object_attributes][:url] = merge_request_url - hook_data[:object_attributes][:action] = action - hook_data - end - - def execute_hooks(merge_request, action = 'open') - if merge_request.project - merge_data = hook_data(merge_request, action) - merge_request.project.execute_hooks(merge_data, :merge_request_hooks) - merge_request.project.execute_services(merge_data, :merge_request_hooks) - end - end - end -end diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb deleted file mode 100644 index a44b91166e8..00000000000 --- a/app/services/merge_requests/build_service.rb +++ /dev/null @@ -1,74 +0,0 @@ -module MergeRequests - class BuildService < MergeRequests::BaseService - def execute - merge_request = MergeRequest.new(params) - - # Set MR attributes - merge_request.can_be_created = false - merge_request.compare_failed = false - merge_request.compare_commits = [] - merge_request.compare_diffs = [] - merge_request.source_project = project unless merge_request.source_project - merge_request.target_project ||= (project.forked_from_project || project) - merge_request.target_branch ||= merge_request.target_project.default_branch - - unless merge_request.target_branch && merge_request.source_branch - return build_failed(merge_request, nil) - end - - compare_result = CompareService.new.execute( - current_user, - merge_request.source_project, - merge_request.source_branch, - merge_request.target_project, - merge_request.target_branch, - ) - - commits = compare_result.commits - - # At this point we decide if merge request can be created - # If we have at least one commit to merge -> creation allowed - if commits.present? - merge_request.compare_commits = Commit.decorate(commits) - merge_request.can_be_created = true - merge_request.compare_failed = false - - # Try to collect diff for merge request. - diffs = compare_result.diffs - - if diffs.present? - merge_request.compare_diffs = diffs - - elsif diffs == false - # satellite timeout return false - merge_request.can_be_created = false - merge_request.compare_failed = true - end - else - merge_request.can_be_created = false - merge_request.compare_failed = false - end - - commits = merge_request.compare_commits - if commits && commits.count == 1 - commit = commits.first - merge_request.title = commit.title - merge_request.description = commit.description.try(:strip) - else - merge_request.title = merge_request.source_branch.titleize.humanize - end - - merge_request - - rescue Gitlab::Satellite::BranchesWithoutParent - return build_failed(merge_request, "Selected branches have no common commit so they cannot be merged.") - end - - def build_failed(merge_request, message) - merge_request.errors.add(:base, message) unless message.nil? - merge_request.compare_commits = [] - merge_request.can_be_created = false - merge_request - end - end -end diff --git a/app/services/merge_requests/close_service.rb b/app/services/merge_requests/close_service.rb deleted file mode 100644 index 47454f9f0c2..00000000000 --- a/app/services/merge_requests/close_service.rb +++ /dev/null @@ -1,18 +0,0 @@ -module MergeRequests - class CloseService < MergeRequests::BaseService - def execute(merge_request, commit = nil) - # If we close MergeRequest we want to ignore validation - # so we can close broken one (Ex. fork project removed) - merge_request.allow_broken = true - - if merge_request.close - event_service.close_mr(merge_request, current_user) - create_note(merge_request) - notification_service.close_mr(merge_request, current_user) - execute_hooks(merge_request, 'close') - end - - merge_request - end - end -end diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb deleted file mode 100644 index ca8d80f6c0c..00000000000 --- a/app/services/merge_requests/create_service.rb +++ /dev/null @@ -1,21 +0,0 @@ -module MergeRequests - class CreateService < MergeRequests::BaseService - def execute - label_params = params[:label_ids] - merge_request = MergeRequest.new(params.except(:label_ids)) - merge_request.source_project = project - merge_request.target_project ||= project - merge_request.author = current_user - - if merge_request.save - merge_request.update_attributes(label_ids: label_params) - event_service.open_mr(merge_request, current_user) - notification_service.new_merge_request(merge_request, current_user) - merge_request.create_cross_references!(merge_request.project, current_user) - execute_hooks(merge_request) - end - - merge_request - end - end -end diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb deleted file mode 100644 index 327ead4ff3f..00000000000 --- a/app/services/merge_requests/merge_service.rb +++ /dev/null @@ -1,22 +0,0 @@ -module MergeRequests - # MergeService class - # - # Mark existing merge request as merged - # and execute all hooks and notifications - # Called when you do merge via command line and push code - # to target branch - class MergeService < BaseMergeService - def execute(merge_request, commit_message) - merge_request.merge - - create_merge_event(merge_request, current_user) - create_note(merge_request) - notification_service.merge_mr(merge_request, current_user) - execute_hooks(merge_request, 'merge') - - true - rescue - false - end - end -end diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb deleted file mode 100644 index e9b526d1fb7..00000000000 --- a/app/services/merge_requests/refresh_service.rb +++ /dev/null @@ -1,94 +0,0 @@ -module MergeRequests - class RefreshService < MergeRequests::BaseService - def execute(oldrev, newrev, ref) - return true unless Gitlab::Git.branch_ref?(ref) - - @oldrev, @newrev = oldrev, newrev - @branch_name = Gitlab::Git.ref_name(ref) - @fork_merge_requests = @project.fork_merge_requests.opened - @commits = @project.repository.commits_between(oldrev, newrev) - - close_merge_requests - reload_merge_requests - comment_mr_with_commits - - true - end - - private - - # Collect open merge requests that target same branch we push into - # and close if push to master include last commit from merge request - # We need this to close(as merged) merge requests that were merged into - # target branch manually - def close_merge_requests - commit_ids = @commits.map(&:id) - merge_requests = @project.merge_requests.opened.where(target_branch: @branch_name).to_a - merge_requests = merge_requests.select(&:last_commit) - - merge_requests = merge_requests.select do |merge_request| - commit_ids.include?(merge_request.last_commit.id) - end - - - merge_requests.uniq.select(&:source_project).each do |merge_request| - MergeRequests::MergeService. - new(merge_request.target_project, @current_user). - execute(merge_request, nil) - end - end - - def force_push? - Gitlab::ForcePushCheck.force_push?(@project, @oldrev, @newrev) - end - - # Refresh merge request diff if we push to source or target branch of merge request - # Note: we should update merge requests from forks too - def reload_merge_requests - merge_requests = @project.merge_requests.opened.by_branch(@branch_name).to_a - merge_requests += @fork_merge_requests.by_branch(@branch_name).to_a - merge_requests = filter_merge_requests(merge_requests) - - merge_requests.each do |merge_request| - - if merge_request.source_branch == @branch_name || force_push? - merge_request.reload_code - merge_request.mark_as_unchecked - else - mr_commit_ids = merge_request.commits.map(&:id) - push_commit_ids = @commits.map(&:id) - matches = mr_commit_ids & push_commit_ids - - if matches.any? - merge_request.reload_code - merge_request.mark_as_unchecked - else - merge_request.mark_as_unchecked - end - end - end - end - - # Add comment about pushing new commits to merge requests - def comment_mr_with_commits - merge_requests = @project.origin_merge_requests.opened.where(source_branch: @branch_name).to_a - merge_requests += @fork_merge_requests.where(source_branch: @branch_name).to_a - merge_requests = filter_merge_requests(merge_requests) - - merge_requests.each do |merge_request| - mr_commit_ids = Set.new(merge_request.commits.map(&:id)) - - new_commits, existing_commits = @commits.partition do |commit| - mr_commit_ids.include?(commit.id) - end - - Note.create_new_commits_note(merge_request, merge_request.project, - @current_user, new_commits, existing_commits, @oldrev) - end - end - - def filter_merge_requests(merge_requests) - merge_requests.uniq.select(&:source_project) - end - end -end diff --git a/app/services/merge_requests/reopen_service.rb b/app/services/merge_requests/reopen_service.rb deleted file mode 100644 index 8279ad2001b..00000000000 --- a/app/services/merge_requests/reopen_service.rb +++ /dev/null @@ -1,16 +0,0 @@ -module MergeRequests - class ReopenService < MergeRequests::BaseService - def execute(merge_request) - if merge_request.reopen - event_service.reopen_mr(merge_request, current_user) - create_note(merge_request) - notification_service.reopen_mr(merge_request, current_user) - execute_hooks(merge_request, 'reopen') - merge_request.reload_code - merge_request.mark_as_unchecked - end - - merge_request - end - end -end diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb deleted file mode 100644 index 23af2656c37..00000000000 --- a/app/services/merge_requests/update_service.rb +++ /dev/null @@ -1,60 +0,0 @@ -require_relative 'base_service' -require_relative 'reopen_service' -require_relative 'close_service' - -module MergeRequests - class UpdateService < MergeRequests::BaseService - def execute(merge_request) - # We dont allow change of source/target projects - # after merge request was created - params.except!(:source_project_id) - params.except!(:target_project_id) - - state = params[:state_event] - - case state - when 'reopen' - MergeRequests::ReopenService.new(project, current_user, {}).execute(merge_request) - when 'close' - MergeRequests::CloseService.new(project, current_user, {}).execute(merge_request) - when 'task_check' - merge_request.update_nth_task(params[:task_num].to_i, true) - when 'task_uncheck' - merge_request.update_nth_task(params[:task_num].to_i, false) - end - - params[:assignee_id] = "" if params[:assignee_id] == IssuableFinder::NONE - params[:milestone_id] = "" if params[:milestone_id] == IssuableFinder::NONE - - old_labels = merge_request.labels.to_a - - if params.present? && merge_request.update_attributes( - params.except(:state_event, :task_num) - ) - merge_request.reset_events_cache - - if merge_request.labels != old_labels - create_labels_note( - merge_request, - merge_request.labels - old_labels, - old_labels - merge_request.labels - ) - end - - if merge_request.previous_changes.include?('milestone_id') - create_milestone_note(merge_request) - end - - if merge_request.previous_changes.include?('assignee_id') - create_assignee_note(merge_request) - notification_service.reassigned_merge_request(merge_request, current_user) - end - - merge_request.notice_added_references(merge_request.project, current_user) - execute_hooks(merge_request, 'update') - end - - merge_request - end - end -end diff --git a/app/services/milestones/base_service.rb b/app/services/milestones/base_service.rb deleted file mode 100644 index 176ab9f1ab5..00000000000 --- a/app/services/milestones/base_service.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Milestones - class BaseService < ::BaseService - end -end diff --git a/app/services/milestones/close_service.rb b/app/services/milestones/close_service.rb deleted file mode 100644 index 608fc49d766..00000000000 --- a/app/services/milestones/close_service.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Milestones - class CloseService < Milestones::BaseService - def execute(milestone) - if milestone.close - event_service.close_milestone(milestone, current_user) - end - - milestone - end - end -end diff --git a/app/services/milestones/create_service.rb b/app/services/milestones/create_service.rb deleted file mode 100644 index b8e08c9f1eb..00000000000 --- a/app/services/milestones/create_service.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Milestones - class CreateService < Milestones::BaseService - def execute - milestone = project.milestones.new(params) - - if milestone.save - event_service.open_milestone(milestone, current_user) - end - - milestone - end - end -end diff --git a/app/services/milestones/group_service.rb b/app/services/milestones/group_service.rb deleted file mode 100644 index 11d702f1e7b..00000000000 --- a/app/services/milestones/group_service.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Milestones - class GroupService < Milestones::BaseService - def initialize(project_milestones) - @project_milestones = project_milestones.group_by(&:title) - end - - def execute - build(@project_milestones) - end - - def milestone(title) - if title - group_milestone = @project_milestones[title].group_by(&:title) - build(group_milestone).first - else - nil - end - end - - private - - def build(milestone) - milestone.map{ |title, milestones| GroupMilestone.new(title, milestones) } - end - end -end diff --git a/app/services/milestones/reopen_service.rb b/app/services/milestones/reopen_service.rb deleted file mode 100644 index 573f9ee5c21..00000000000 --- a/app/services/milestones/reopen_service.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Milestones - class ReopenService < Milestones::BaseService - def execute(milestone) - if milestone.activate - event_service.reopen_milestone(milestone, current_user) - end - - milestone - end - end -end diff --git a/app/services/milestones/update_service.rb b/app/services/milestones/update_service.rb deleted file mode 100644 index ed64847f429..00000000000 --- a/app/services/milestones/update_service.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Milestones - class UpdateService < Milestones::BaseService - def execute(milestone) - state = params[:state_event] - - case state - when 'activate' - Milestones::ReopenService.new(project, current_user, {}).execute(milestone) - when 'close' - Milestones::CloseService.new(project, current_user, {}).execute(milestone) - end - - if params.present? - milestone.update_attributes(params.except(:state_event)) - end - - milestone - end - end -end diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb deleted file mode 100644 index e969061f229..00000000000 --- a/app/services/notes/create_service.rb +++ /dev/null @@ -1,38 +0,0 @@ -module Notes - class CreateService < BaseService - def execute - note = project.notes.new(params) - note.author = current_user - note.system = false - - if note.save - notification_service.new_note(note) - - # Skip system notes, like status changes and cross-references. - unless note.system - event_service.leave_note(note, note.author) - - # Create a cross-reference note if this Note contains GFM that names an - # issue, merge request, or commit. - note.references.each do |mentioned| - Note.create_cross_reference_note(mentioned, note.noteable, note.author, note.project) - end - - execute_hooks(note) - end - end - - note - end - - def hook_data(note) - Gitlab::NoteDataBuilder.build(note, current_user) - end - - def execute_hooks(note) - note_data = hook_data(note) - # TODO: Support Webhooks - note.project.execute_services(note_data, :note_hooks) - end - end -end diff --git a/app/services/notes/update_service.rb b/app/services/notes/update_service.rb deleted file mode 100644 index 63431b82471..00000000000 --- a/app/services/notes/update_service.rb +++ /dev/null @@ -1,25 +0,0 @@ -module Notes - class UpdateService < BaseService - def execute - note = project.notes.find(params[:note_id]) - note.note = params[:note] - if note.save - notification_service.new_note(note) - - # Skip system notes, like status changes and cross-references. - unless note.system - event_service.leave_note(note, note.author) - - # Create a cross-reference note if this Note contains GFM that - # names an issue, merge request, or commit. - note.references.each do |mentioned| - Note.create_cross_reference_note(mentioned, note.noteable, - note.author, note.project) - end - end - end - - note - end - end -end diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb deleted file mode 100644 index cfed7964c37..00000000000 --- a/app/services/notification_service.rb +++ /dev/null @@ -1,432 +0,0 @@ -# NotificationService class -# -# Used for notifying users with emails about different events -# -# Ex. -# NotificationService.new.new_issue(issue, current_user) -# -class NotificationService - # Always notify user about ssh key added - # only if ssh key is not deploy key - # - # This is security email so it will be sent - # even if user disabled notifications - def new_key(key) - if key.user - mailer.new_ssh_key_email(key.id) - end - end - - # Always notify user about email added to profile - def new_email(email) - if email.user - mailer.new_email_email(email.id) - end - end - - # When create an issue we should send next emails: - # - # * issue assignee if their notification level is not Disabled - # * project team members with notification level higher then Participating - # - def new_issue(issue, current_user) - new_resource_email(issue, issue.project, 'new_issue_email') - end - - # When we close an issue we should send next emails: - # - # * issue author if their notification level is not Disabled - # * issue assignee if their notification level is not Disabled - # * project team members with notification level higher then Participating - # - def close_issue(issue, current_user) - close_resource_email(issue, issue.project, current_user, 'closed_issue_email') - end - - # When we reassign an issue we should send next emails: - # - # * issue old assignee if their notification level is not Disabled - # * issue new assignee if their notification level is not Disabled - # - def reassigned_issue(issue, current_user) - reassign_resource_email(issue, issue.project, current_user, 'reassigned_issue_email') - end - - - # When create a merge request we should send next emails: - # - # * mr assignee if their notification level is not Disabled - # - def new_merge_request(merge_request, current_user) - new_resource_email(merge_request, merge_request.target_project, 'new_merge_request_email') - end - - # When we reassign a merge_request we should send next emails: - # - # * merge_request old assignee if their notification level is not Disabled - # * merge_request assignee if their notification level is not Disabled - # - def reassigned_merge_request(merge_request, current_user) - reassign_resource_email(merge_request, merge_request.target_project, current_user, 'reassigned_merge_request_email') - end - - # When we close a merge request we should send next emails: - # - # * merge_request author if their notification level is not Disabled - # * merge_request assignee if their notification level is not Disabled - # * project team members with notification level higher then Participating - # - def close_mr(merge_request, current_user) - close_resource_email(merge_request, merge_request.target_project, current_user, 'closed_merge_request_email') - end - - def reopen_issue(issue, current_user) - reopen_resource_email(issue, issue.project, current_user, 'issue_status_changed_email', 'reopened') - end - - # When we merge a merge request we should send next emails: - # - # * merge_request author if their notification level is not Disabled - # * merge_request assignee if their notification level is not Disabled - # * project team members with notification level higher then Participating - # - def merge_mr(merge_request, current_user) - recipients = reject_muted_users([merge_request.author, merge_request.assignee], merge_request.target_project) - recipients = add_subscribed_users(recipients, merge_request) - recipients = reject_unsubscribed_users(recipients, merge_request) - recipients = recipients.concat(project_watchers(merge_request.target_project)).uniq - recipients.delete(current_user) - - recipients.each do |recipient| - mailer.merged_merge_request_email(recipient.id, merge_request.id, current_user.id) - end - end - - def reopen_mr(merge_request, current_user) - reopen_resource_email(merge_request, merge_request.target_project, current_user, 'merge_request_status_email', 'reopened') - end - - # Notify new user with email after creation - def new_user(user, token = nil) - # Don't email omniauth created users - mailer.new_user_email(user.id, token) unless user.identities.any? - end - - # Notify users on new note in system - # - # TODO: split on methods and refactor - # - def new_note(note) - return true unless note.noteable_type.present? - - # ignore gitlab service messages - return true if note.note.start_with?('Status changed to closed') - return true if note.cross_reference? && note.system == true - - target = note.noteable - - recipients = [] - - if note.commit_id.present? - recipients << note.commit_author - end - - # Add all users participating in the thread (author, assignee, comment authors) - participants = - if target.respond_to?(:participants) - target.participants - elsif target.is_a?(Commit) - author_ids = Note.for_commit_id(target.id).pluck(:author_id).uniq - User.where(id: author_ids) - else - note.mentioned_users - end - recipients = recipients.concat(participants) - - # Merge project watchers - recipients = recipients.concat(project_watchers(note.project)).compact.uniq - - # Reject users with Mention notification level, except those mentioned in _this_ note. - recipients = reject_mention_users(recipients - note.mentioned_users, note.project) - recipients = recipients + note.mentioned_users - - # Reject mutes users - recipients = reject_muted_users(recipients, note.project) - - recipients = add_subscribed_users(recipients, note.noteable) - - recipients = reject_unsubscribed_users(recipients, note.noteable) - - # Reject author - recipients.delete(note.author) - - # build notify method like 'note_commit_email' - notify_method = "note_#{note.noteable_type.underscore}_email".to_sym - - recipients.each do |recipient| - mailer.send(notify_method, recipient.id, note.id) - end - end - - def invite_project_member(project_member, token) - mailer.project_member_invited_email(project_member.id, token) - end - - def accept_project_invite(project_member) - mailer.project_invite_accepted_email(project_member.id) - end - - def decline_project_invite(project_member) - mailer.project_invite_declined_email(project_member.project.id, project_member.invite_email, project_member.access_level, project_member.created_by_id) - end - - def new_project_member(project_member) - mailer.project_access_granted_email(project_member.id) - end - - def update_project_member(project_member) - mailer.project_access_granted_email(project_member.id) - end - - def invite_group_member(group_member, token) - mailer.group_member_invited_email(group_member.id, token) - end - - def accept_group_invite(group_member) - mailer.group_invite_accepted_email(group_member.id) - end - - def decline_group_invite(group_member) - mailer.group_invite_declined_email(group_member.group.id, group_member.invite_email, group_member.access_level, group_member.created_by_id) - end - - def new_group_member(group_member) - mailer.group_access_granted_email(group_member.id) - end - - def update_group_member(group_member) - mailer.group_access_granted_email(group_member.id) - end - - def project_was_moved(project) - recipients = project.team.members - recipients = reject_muted_users(recipients, project) - - recipients.each do |recipient| - mailer.project_was_moved_email(project.id, recipient.id) - end - end - - protected - - # Get project users with WATCH notification level - def project_watchers(project) - project_members = project_member_notification(project) - - users_with_project_level_global = project_member_notification(project, Notification::N_GLOBAL) - users_with_group_level_global = group_member_notification(project, Notification::N_GLOBAL) - users = users_with_global_level_watch([users_with_project_level_global, users_with_group_level_global].flatten.uniq) - - users_with_project_setting = select_project_member_setting(project, users_with_project_level_global, users) - users_with_group_setting = select_group_member_setting(project, project_members, users_with_group_level_global, users) - - User.where(id: users_with_project_setting.concat(users_with_group_setting).uniq).to_a - end - - def project_member_notification(project, notification_level=nil) - project_members = project.project_members - - if notification_level - project_members.where(notification_level: notification_level).pluck(:user_id) - else - project_members.pluck(:user_id) - end - end - - def group_member_notification(project, notification_level) - if project.group - project.group.group_members.where(notification_level: notification_level).pluck(:user_id) - else - [] - end - end - - def users_with_global_level_watch(ids) - User.where( - id: ids, - notification_level: Notification::N_WATCH - ).pluck(:id) - end - - # Build a list of users based on project notifcation settings - def select_project_member_setting(project, global_setting, users_global_level_watch) - users = project_member_notification(project, Notification::N_WATCH) - - # If project setting is global, add to watch list if global setting is watch - global_setting.each do |user_id| - if users_global_level_watch.include?(user_id) - users << user_id - end - end - - users - end - - # Build a list of users based on group notification settings - def select_group_member_setting(project, project_members, global_setting, users_global_level_watch) - uids = group_member_notification(project, Notification::N_WATCH) - - # Group setting is watch, add to users list if user is not project member - users = [] - uids.each do |user_id| - if project_members.exclude?(user_id) - users << user_id - end - end - - # Group setting is global, add to users list if global setting is watch - global_setting.each do |user_id| - if project_members.exclude?(user_id) && users_global_level_watch.include?(user_id) - users << user_id - end - end - - users - end - - # Remove users with disabled notifications from array - # Also remove duplications and nil recipients - def reject_muted_users(users, project = nil) - users = users.to_a.compact.uniq - users = users.reject(&:blocked?) - - users.reject do |user| - next user.notification.disabled? unless project - - member = project.project_members.find_by(user_id: user.id) - - if !member && project.group - member = project.group.group_members.find_by(user_id: user.id) - end - - # reject users who globally disabled notification and has no membership - next user.notification.disabled? unless member - - # reject users who disabled notification in project - next true if member.notification.disabled? - - # reject users who have N_GLOBAL in project and disabled in global settings - member.notification.global? && user.notification.disabled? - end - end - - # Remove users with notification level 'Mentioned' - def reject_mention_users(users, project = nil) - users = users.to_a.compact.uniq - - users.reject do |user| - next user.notification.mention? unless project - - member = project.project_members.find_by(user_id: user.id) - - if !member && project.group - member = project.group.group_members.find_by(user_id: user.id) - end - - # reject users who globally set mention notification and has no membership - next user.notification.mention? unless member - - # reject users who set mention notification in project - next true if member.notification.mention? - - # reject users who have N_MENTION in project and disabled in global settings - member.notification.global? && user.notification.mention? - end - end - - def reject_unsubscribed_users(recipients, target) - return recipients unless target.respond_to? :subscriptions - - recipients.reject do |user| - subscription = target.subscriptions.find_by_user_id(user.id) - subscription && !subscription.subscribed - end - end - - def add_subscribed_users(recipients, target) - return recipients unless target.respond_to? :subscriptions - - subscriptions = target.subscriptions - - if subscriptions.any? - recipients + subscriptions.where(subscribed: true).map(&:user) - else - recipients - end - end - - def new_resource_email(target, project, method) - recipients = build_recipients(target, project) - recipients.delete(target.author) - - recipients.each do |recipient| - mailer.send(method, recipient.id, target.id) - end - end - - def close_resource_email(target, project, current_user, method) - recipients = build_recipients(target, project) - recipients.delete(current_user) - - recipients.each do |recipient| - mailer.send(method, recipient.id, target.id, current_user.id) - end - end - - def reassign_resource_email(target, project, current_user, method) - assignee_id_was = previous_record(target, "assignee_id") - recipients = build_recipients(target, project) - recipients.delete(current_user) - - recipients.each do |recipient| - mailer.send(method, recipient.id, target.id, assignee_id_was, current_user.id) - end - end - - def reopen_resource_email(target, project, current_user, method, status) - recipients = build_recipients(target, project) - recipients.delete(current_user) - - recipients.each do |recipient| - mailer.send(method, recipient.id, target.id, status, current_user.id) - end - end - - def build_recipients(target, project) - recipients = - if target.respond_to?(:participants) - target.participants - else - [target.author, target.assignee] - end - - recipients = reject_muted_users(recipients, project) - recipients = reject_mention_users(recipients, project) - recipients = add_subscribed_users(recipients, target) - recipients = recipients.concat(project_watchers(project)).uniq - recipients = reject_unsubscribed_users(recipients, target) - recipients - end - - def mailer - Notify.delay - end - - def previous_record(object, attribute) - if object && attribute - if object.previous_changes.include?(attribute) - object.previous_changes[attribute].first - end - end - end -end diff --git a/app/services/oauth2/access_token_validation_service.rb b/app/services/oauth2/access_token_validation_service.rb deleted file mode 100644 index 6194f6ce91e..00000000000 --- a/app/services/oauth2/access_token_validation_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -module Oauth2::AccessTokenValidationService - # Results: - VALID = :valid - EXPIRED = :expired - REVOKED = :revoked - INSUFFICIENT_SCOPE = :insufficient_scope - - class << self - def validate(token, scopes: []) - if token.expired? - return EXPIRED - - elsif token.revoked? - return REVOKED - - elsif !self.sufficient_scope?(token, scopes) - return INSUFFICIENT_SCOPE - - else - return VALID - end - end - - protected - # True if the token's scope is a superset of required scopes, - # or the required scopes is empty. - def sufficient_scope?(token, scopes) - if scopes.blank? - # if no any scopes required, the scopes of token is sufficient. - return true - else - # If there are scopes required, then check whether - # the set of authorized scopes is a superset of the set of required scopes - required_scopes = Set.new(scopes) - authorized_scopes = Set.new(token.scopes) - - return authorized_scopes >= required_scopes - end - end - end -end diff --git a/app/services/projects/autocomplete_service.rb b/app/services/projects/autocomplete_service.rb deleted file mode 100644 index 7408e09ed1e..00000000000 --- a/app/services/projects/autocomplete_service.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Projects - class AutocompleteService < BaseService - def initialize(project) - @project = project - end - - def issues - @project.issues.opened.select([:iid, :title]) - end - - def merge_requests - @project.merge_requests.opened.select([:iid, :title]) - end - end -end diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb deleted file mode 100644 index a7afcf8f64b..00000000000 --- a/app/services/projects/create_service.rb +++ /dev/null @@ -1,96 +0,0 @@ -module Projects - class CreateService < BaseService - def initialize(user, params) - @current_user, @params = user, params.dup - end - - def execute - @project = Project.new(params) - - # Make sure that the user is allowed to use the specified visibility - # level - unless Gitlab::VisibilityLevel.allowed_for?(current_user, - params[:visibility_level]) - deny_visibility_level(@project) - return @project - end - - # Set project name from path - if @project.name.present? && @project.path.present? - # if both name and path set - everything is ok - elsif @project.path.present? - # Set project name from path - @project.name = @project.path.dup - elsif @project.name.present? - # For compatibility - set path from name - # TODO: remove this in 8.0 - @project.path = @project.name.dup.parameterize - end - - # get namespace id - namespace_id = params[:namespace_id] - - if namespace_id - # Find matching namespace and check if it allowed - # for current user if namespace_id passed. - unless allowed_namespace?(current_user, namespace_id) - @project.namespace_id = nil - deny_namespace - return @project - end - else - # Set current user namespace if namespace_id is nil - @project.namespace_id = current_user.namespace_id - end - - @project.creator = current_user - - Project.transaction do - @project.save - - unless @project.import? - unless @project.create_repository - raise 'Failed to create repository' - end - end - end - - after_create_actions if @project.persisted? - - @project - rescue => ex - @project.errors.add(:base, "Can't save project. Please try again later") - @project - end - - protected - - def deny_namespace - @project.errors.add(:namespace, "is not valid") - end - - def allowed_namespace?(user, namespace_id) - namespace = Namespace.find_by(id: namespace_id) - current_user.can?(:create_projects, namespace) - end - - def after_create_actions - log_info("#{@project.owner.name} created a new project \"#{@project.name_with_namespace}\"") - - @project.create_wiki if @project.wiki_enabled? - - event_service.create_project(@project, current_user) - system_hook_service.execute_hooks_for(@project, :create) - - unless @project.group - @project.team << [current_user, :master, current_user] - end - - @project.update_column(:last_activity_at, @project.created_at) - - if @project.import? - @project.import_start - end - end - end -end diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb deleted file mode 100644 index 7e1d753b021..00000000000 --- a/app/services/projects/destroy_service.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Projects - class DestroyService < BaseService - def execute - return false unless can?(current_user, :remove_project, project) - - project.team.truncate - project.repository.expire_cache unless project.empty_repo? - - if project.destroy - GitlabShellWorker.perform_async( - :remove_repository, - project.path_with_namespace - ) - - GitlabShellWorker.perform_async( - :remove_repository, - project.path_with_namespace + ".wiki" - ) - - project.satellite.destroy - - log_info("Project \"#{project.name}\" was removed") - system_hook_service.execute_hooks_for(project, :destroy) - true - end - end - end -end diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb deleted file mode 100644 index 1e4deb6ed39..00000000000 --- a/app/services/projects/fork_service.rb +++ /dev/null @@ -1,66 +0,0 @@ -module Projects - class ForkService < BaseService - include Gitlab::ShellAdapter - - def execute - @from_project = @project - - project_params = { - visibility_level: @from_project.visibility_level, - description: @from_project.description, - } - - project = Project.new(project_params) - project.name = @from_project.name - project.path = @from_project.path - project.creator = @current_user - if @from_project.avatar.present? && @from_project.avatar.image? - project.avatar = @from_project.avatar - end - - if namespace = @params[:namespace] - project.namespace = namespace - else - project.namespace = @current_user.namespace - end - - unless @current_user.can?(:create_projects, project.namespace) - project.errors.add(:namespace, 'insufficient access rights') - return project - end - - # If the project cannot save, we do not want to trigger the project destroy - # as this can have the side effect of deleting a repo attached to an existing - # project with the same name and namespace - if project.valid? - begin - Project.transaction do - #First save the DB entries as they can be rolled back if the repo fork fails - project.build_forked_project_link(forked_to_project_id: project.id, forked_from_project_id: @from_project.id) - if project.save - project.team << [@current_user, :master, @current_user] - end - - #Now fork the repo - unless gitlab_shell.fork_repository(@from_project.path_with_namespace, project.namespace.path) - raise 'forking failed in gitlab-shell' - end - - project.ensure_satellite_exists - end - - if @from_project.gitlab_ci? - ForkRegistrationWorker.perform_async(@from_project.id, project.id, @current_user.private_token) - end - rescue => ex - project.errors.add(:base, 'Fork transaction failed.') - project.destroy - end - else - project.errors.add(:base, 'Invalid fork destination') - end - - project - end - end -end diff --git a/app/services/projects/participants_service.rb b/app/services/projects/participants_service.rb deleted file mode 100644 index ae6260bcdab..00000000000 --- a/app/services/projects/participants_service.rb +++ /dev/null @@ -1,50 +0,0 @@ -module Projects - class ParticipantsService < BaseService - def execute(note_type, note_id) - participating = - if note_type && note_id - participants_in(note_type, note_id) - else - [] - end - project_members = sorted(project.team.members) - participants = all_members + groups + project_members + participating - participants.uniq - end - - def participants_in(type, id) - users = case type - when "Issue" - issue = project.issues.find_by_iid(id) - issue ? issue.participants(current_user) : [] - when "MergeRequest" - merge_request = project.merge_requests.find_by_iid(id) - merge_request ? merge_request.participants(current_user) : [] - when "Commit" - author_ids = Note.for_commit_id(id).pluck(:author_id).uniq - User.where(id: author_ids) - else - [] - end - sorted(users) - end - - def sorted(users) - users.uniq.to_a.compact.sort_by(&:username).map do |user| - { username: user.username, name: user.name } - end - end - - def groups - current_user.authorized_groups.sort_by(&:path).map do |group| - count = group.users.count - { username: group.path, name: "#{group.name} (#{count})" } - end - end - - def all_members - count = project.team.members.flatten.count - [{ username: "all", name: "All Project and Group Members (#{count})" }] - end - end -end diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb deleted file mode 100644 index 489e03bd5ef..00000000000 --- a/app/services/projects/transfer_service.rb +++ /dev/null @@ -1,74 +0,0 @@ -# Projects::TransferService class -# -# Used for transfer project to another namespace -# -# Ex. -# # Move projects to namespace with ID 17 by user -# Projects::TransferService.new(project, user, namespace_id: 17).execute -# -module Projects - class TransferService < BaseService - include Gitlab::ShellAdapter - class TransferError < StandardError; end - - def execute - namespace_id = params[:new_namespace_id] - namespace = Namespace.find_by(id: namespace_id) - - if allowed_transfer?(current_user, project, namespace) - transfer(project, namespace) - else - project.errors.add(:namespace, 'is invalid') - false - end - rescue Projects::TransferService::TransferError => ex - project.reload - project.errors.add(:namespace_id, ex.message) - false - end - - def transfer(project, new_namespace) - Project.transaction do - old_path = project.path_with_namespace - new_path = File.join(new_namespace.try(:path) || '', project.path) - - if Project.where(path: project.path, namespace_id: new_namespace.try(:id)).present? - raise TransferError.new("Project with same path in target namespace already exists") - end - - # Remove old satellite - project.satellite.destroy - - # Apply new namespace id - project.namespace = new_namespace - project.save! - - # Notifications - project.send_move_instructions - - # Move main repository - unless gitlab_shell.mv_repository(old_path, new_path) - raise TransferError.new('Cannot move project') - end - - # Move wiki repo also if present - gitlab_shell.mv_repository("#{old_path}.wiki", "#{new_path}.wiki") - - # Create a new satellite (reload project from DB) - Project.find(project.id).ensure_satellite_exists - - # clear project cached events - project.reset_events_cache - - true - end - end - - def allowed_transfer?(current_user, project, namespace) - namespace && - can?(current_user, :change_namespace, project) && - namespace.id != project.namespace_id && - current_user.can?(:create_projects, namespace) - end - end -end diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb deleted file mode 100644 index 69bdd045ddf..00000000000 --- a/app/services/projects/update_service.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Projects - class UpdateService < BaseService - def execute - # check that user is allowed to set specified visibility_level - new_visibility = params[:visibility_level] - if new_visibility && new_visibility.to_i != project.visibility_level - unless can?(current_user, :change_visibility_level, project) && - Gitlab::VisibilityLevel.allowed_for?(current_user, new_visibility) - deny_visibility_level(project, new_visibility) - return project - end - end - - new_branch = params[:default_branch] - - if project.repository.exists? && new_branch && new_branch != project.default_branch - project.change_head(new_branch) - end - - if project.update_attributes(params.except(:default_branch)) - if project.previous_changes.include?('path') - project.rename_repo - end - end - end - end -end diff --git a/app/services/projects/upload_service.rb b/app/services/projects/upload_service.rb deleted file mode 100644 index 992a7a7a1dc..00000000000 --- a/app/services/projects/upload_service.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Projects - class UploadService < BaseService - def initialize(project, file) - @project, @file = project, file - end - - def execute - return nil unless @file and @file.size <= max_attachment_size - - uploader = FileUploader.new(@project) - uploader.store!(@file) - - filename = uploader.image? ? uploader.file.basename : uploader.file.filename - - { - 'alt' => filename, - 'url' => uploader.secure_url, - 'is_image' => uploader.image? - } - end - - private - - def max_attachment_size - current_application_settings.max_attachment_size.megabytes.to_i - end - end -end diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb deleted file mode 100644 index 0bcc50c81a7..00000000000 --- a/app/services/search/global_service.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Search - class GlobalService - attr_accessor :current_user, :params - - def initialize(user, params) - @current_user, @params = user, params.dup - end - - def execute - group = Group.find_by(id: params[:group_id]) if params[:group_id].present? - projects = ProjectsFinder.new.execute(current_user) - projects = projects.where(namespace_id: group.id) if group - project_ids = projects.pluck(:id) - - Gitlab::SearchResults.new(project_ids, params[:search]) - end - end -end diff --git a/app/services/search/project_service.rb b/app/services/search/project_service.rb deleted file mode 100644 index f630c0a3790..00000000000 --- a/app/services/search/project_service.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Search - class ProjectService - attr_accessor :project, :current_user, :params - - def initialize(project, user, params) - @project, @current_user, @params = project, user, params.dup - end - - def execute - Gitlab::ProjectSearchResults.new(project.id, - params[:search], - params[:repository_ref]) - end - end -end diff --git a/app/services/search/snippet_service.rb b/app/services/search/snippet_service.rb deleted file mode 100644 index 8ca0877321d..00000000000 --- a/app/services/search/snippet_service.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Search - class SnippetService - attr_accessor :current_user, :params - - def initialize(user, params) - @current_user, @params = user, params.dup - end - - def execute - snippet_ids = Snippet.accessible_to(current_user).pluck(:id) - Gitlab::SnippetSearchResults.new(snippet_ids, params[:search]) - end - end -end diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb deleted file mode 100644 index c5d0b08845b..00000000000 --- a/app/services/system_hooks_service.rb +++ /dev/null @@ -1,98 +0,0 @@ -class SystemHooksService - def execute_hooks_for(model, event) - execute_hooks(build_event_data(model, event)) - end - - private - - def execute_hooks(data) - SystemHook.all.each do |sh| - async_execute_hook sh, data - end - end - - def async_execute_hook(hook, data) - Sidekiq::Client.enqueue(SystemHookWorker, hook.id, data) - end - - def build_event_data(model, event) - data = { - event_name: build_event_name(model, event), - created_at: model.created_at.xmlschema - } - - case model - when Key - data.merge!( - key: model.key, - id: model.id - ) - if model.user - data.merge!( - username: model.user.username - ) - end - when Project - owner = model.owner - - data.merge!({ - name: model.name, - path: model.path, - path_with_namespace: model.path_with_namespace, - project_id: model.id, - owner_name: owner.name, - owner_email: owner.respond_to?(:email) ? owner.email : "", - project_visibility: Project.visibility_levels.key(model.visibility_level_field).downcase - }) - when User - data.merge!({ - name: model.name, - email: model.email, - user_id: model.id - }) - when ProjectMember - data.merge!({ - project_name: model.project.name, - project_path: model.project.path, - project_id: model.project.id, - user_name: model.user.name, - user_email: model.user.email, - access_level: model.human_access, - project_visibility: Project.visibility_levels.key(model.project.visibility_level_field).downcase - }) - when Group - owner = model.owner - - data.merge!( - name: model.name, - path: model.path, - group_id: model.id, - owner_name: owner.respond_to?(:name) ? owner.name : nil, - owner_email: owner.respond_to?(:email) ? owner.email : nil, - ) - when GroupMember - data.merge!( - group_name: model.group.name, - group_path: model.group.path, - group_id: model.group.id, - user_name: model.user.name, - user_email: model.user.email, - user_id: model.user.id, - group_access: model.human_access, - ) - end - end - - def build_event_name(model, event) - case model - when ProjectMember - return "user_add_to_team" if event == :create - return "user_remove_from_team" if event == :destroy - when GroupMember - return 'user_add_to_group' if event == :create - return 'user_remove_from_group' if event == :destroy - else - "#{model.class.name.downcase}_#{event.to_s}" - end - end -end diff --git a/app/services/test_hook_service.rb b/app/services/test_hook_service.rb deleted file mode 100644 index 21ec2c01cb8..00000000000 --- a/app/services/test_hook_service.rb +++ /dev/null @@ -1,6 +0,0 @@ -class TestHookService - def execute(hook, current_user) - data = Gitlab::PushDataBuilder.build_sample(hook.project, current_user) - hook.execute(data) - end -end diff --git a/app/services/update_snippet_service.rb b/app/services/update_snippet_service.rb deleted file mode 100644 index 9d181c2d2ab..00000000000 --- a/app/services/update_snippet_service.rb +++ /dev/null @@ -1,22 +0,0 @@ -class UpdateSnippetService < BaseService - attr_accessor :snippet - - def initialize(project, user, snippet, params) - super(project, user, params) - @snippet = snippet - end - - def execute - # check that user is allowed to set specified visibility_level - new_visibility = params[:visibility_level] - if new_visibility && new_visibility.to_i != snippet.visibility_level - unless can?(current_user, :change_visibility_level, snippet) && - Gitlab::VisibilityLevel.allowed_for?(current_user, new_visibility) - deny_visibility_level(snippet, new_visibility) - return snippet - end - end - - snippet.update_attributes(params) - end -end diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb deleted file mode 100644 index a9691bee46e..00000000000 --- a/app/uploaders/attachment_uploader.rb +++ /dev/null @@ -1,26 +0,0 @@ -# encoding: utf-8 - -class AttachmentUploader < CarrierWave::Uploader::Base - storage :file - - def store_dir - "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" - end - - def image? - img_ext = %w(png jpg jpeg gif bmp tiff) - if file.respond_to?(:extension) - img_ext.include?(file.extension.downcase) - else - # Not all CarrierWave storages respond to :extension - ext = file.path.split('.').last.downcase - img_ext.include?(ext) - end - rescue - false - end - - def file_storage? - self.class.storage == CarrierWave::Storage::File - end -end diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb deleted file mode 100644 index 7cad044555b..00000000000 --- a/app/uploaders/avatar_uploader.rb +++ /dev/null @@ -1,32 +0,0 @@ -# encoding: utf-8 - -class AvatarUploader < CarrierWave::Uploader::Base - storage :file - - after :store, :reset_events_cache - - def store_dir - "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" - end - - def image? - img_ext = %w(png jpg jpeg gif bmp tiff) - if file.respond_to?(:extension) - img_ext.include?(file.extension.downcase) - else - # Not all CarrierWave storages respond to :extension - ext = file.path.split('.').last.downcase - img_ext.include?(ext) - end - rescue - false - end - - def file_storage? - self.class.storage == CarrierWave::Storage::File - end - - def reset_events_cache(file) - model.reset_events_cache if model.is_a?(User) - end -end diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb deleted file mode 100644 index f9673abbfe8..00000000000 --- a/app/uploaders/file_uploader.rb +++ /dev/null @@ -1,48 +0,0 @@ -# encoding: utf-8 -class FileUploader < CarrierWave::Uploader::Base - storage :file - - attr_accessor :project, :secret - - def initialize(project, secret = self.class.generate_secret) - @project = project - @secret = secret - end - - def base_dir - "uploads" - end - - def store_dir - File.join(base_dir, @project.path_with_namespace, @secret) - end - - def cache_dir - File.join(base_dir, 'tmp', @project.path_with_namespace, @secret) - end - - def self.generate_secret - SecureRandom.hex - end - - def secure_url - File.join(Gitlab.config.gitlab.url, @project.path_with_namespace, "uploads", @secret, file.filename) - end - - def file_storage? - self.class.storage == CarrierWave::Storage::File - end - - def image? - img_ext = %w(png jpg jpeg gif bmp tiff) - if file.respond_to?(:extension) - img_ext.include?(file.extension.downcase) - else - # Not all CarrierWave storages respond to :extension - ext = file.path.split('.').last.downcase - img_ext.include?(ext) - end - rescue - false - end -end diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml deleted file mode 100644 index 4f3565c67eb..00000000000 --- a/app/views/admin/application_settings/_form.html.haml +++ /dev/null @@ -1,69 +0,0 @@ -= form_for @application_setting, url: admin_application_settings_path, html: { class: 'form-horizontal fieldset-form' } do |f| - - if @application_setting.errors.any? - #error_explanation - .alert.alert-danger - - @application_setting.errors.full_messages.each do |msg| - %p= msg - - %fieldset - %legend Features - .form-group - .col-sm-offset-2.col-sm-10 - .checkbox - = f.label :signup_enabled do - = f.check_box :signup_enabled - Signup enabled - .form-group - .col-sm-offset-2.col-sm-10 - .checkbox - = f.label :signin_enabled do - = f.check_box :signin_enabled - Signin enabled - .form-group - .col-sm-offset-2.col-sm-10 - .checkbox - = f.label :gravatar_enabled do - = f.check_box :gravatar_enabled - Gravatar enabled - .form-group - .col-sm-offset-2.col-sm-10 - .checkbox - = f.label :twitter_sharing_enabled do - = f.check_box :twitter_sharing_enabled, :'aria-describedby' => 'twitter_help_block' - %strong Twitter enabled - %span.help-block#twitter_help_block Show users a button to share their newly created public or internal projects on twitter - %fieldset - %legend Misc - .form-group - = f.label :default_projects_limit, class: 'control-label col-sm-2' - .col-sm-10 - = f.number_field :default_projects_limit, class: 'form-control' - .form-group - = f.label :default_branch_protection, class: 'control-label col-sm-2' - .col-sm-10 - = f.select :default_branch_protection, options_for_select(Gitlab::Access.protection_options, @application_setting.default_branch_protection), {}, class: 'form-control' - .form-group - = f.label :restricted_visibility_levels, class: 'control-label col-sm-2' - .col-sm-10 - - data_attrs = { toggle: 'buttons' } - .btn-group{ data: data_attrs } - - restricted_level_checkboxes('restricted-visibility-help').each do |level| - = level - %span.help-block#restricted-visibility-help Selected levels cannot be used by non-admin users for projects or snippets - .form-group - = f.label :home_page_url, class: 'control-label col-sm-2' - .col-sm-10 - = f.text_field :home_page_url, class: 'form-control', placeholder: 'http://company.example.com', :'aria-describedby' => 'home_help_block' - %span.help-block#home_help_block We will redirect non-logged in users to this page - .form-group - = f.label :sign_in_text, class: 'control-label col-sm-2' - .col-sm-10 - = f.text_area :sign_in_text, class: 'form-control', rows: 4 - .help-block Markdown enabled - .form-group - = f.label :max_attachment_size, 'Maximum attachment size (MB)', class: 'control-label col-sm-2' - .col-sm-10 - = f.number_field :max_attachment_size, class: 'form-control' - - .form-actions - = f.submit 'Save', class: 'btn btn-primary' diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml deleted file mode 100644 index 39b66647a5a..00000000000 --- a/app/views/admin/application_settings/show.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h3.page-title Application settings -%hr -= render 'form' diff --git a/app/views/admin/applications/_delete_form.html.haml b/app/views/admin/applications/_delete_form.html.haml deleted file mode 100644 index 3147cbd659f..00000000000 --- a/app/views/admin/applications/_delete_form.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- submit_btn_css ||= 'btn btn-link btn-remove btn-sm' -= form_tag admin_application_path(application) do - %input{:name => "_method", :type => "hidden", :value => "delete"}/ - = submit_tag 'Destroy', onclick: "return confirm('Are you sure?')", class: submit_btn_css
\ No newline at end of file diff --git a/app/views/admin/applications/_form.html.haml b/app/views/admin/applications/_form.html.haml deleted file mode 100644 index fa4e6335c73..00000000000 --- a/app/views/admin/applications/_form.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -= form_for [:admin, @application], url: @url, html: {class: 'form-horizontal', role: 'form'} do |f| - - if application.errors.any? - .alert.alert-danger - %button{ type: "button", class: "close", "data-dismiss" => "alert"} × - - application.errors.full_messages.each do |msg| - %p= msg - = content_tag :div, class: 'form-group' do - = f.label :name, class: 'col-sm-2 control-label' - .col-sm-10 - = f.text_field :name, class: 'form-control' - = doorkeeper_errors_for application, :name - = content_tag :div, class: 'form-group' do - = f.label :redirect_uri, class: 'col-sm-2 control-label' - .col-sm-10 - = f.text_area :redirect_uri, class: 'form-control' - = doorkeeper_errors_for application, :redirect_uri - %span.help-block - Use one line per URI - - if Doorkeeper.configuration.native_redirect_uri - %span.help-block - Use - %code= Doorkeeper.configuration.native_redirect_uri - for local tests - .form-actions - = f.submit 'Submit', class: "btn btn-primary wide" - = link_to "Cancel", admin_applications_path, class: "btn btn-default" diff --git a/app/views/admin/applications/edit.html.haml b/app/views/admin/applications/edit.html.haml deleted file mode 100644 index e408ae2f29d..00000000000 --- a/app/views/admin/applications/edit.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h3.page-title Edit application -- @url = admin_application_path(@application) -= render 'form', application: @application
\ No newline at end of file diff --git a/app/views/admin/applications/index.html.haml b/app/views/admin/applications/index.html.haml deleted file mode 100644 index d550278710e..00000000000 --- a/app/views/admin/applications/index.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%h3.page-title - System OAuth applications -%p.light - System OAuth application does not belong to certain user and can be managed only by admins -%hr -%p= link_to 'New Application', new_admin_application_path, class: 'btn btn-success' -%table.table.table-striped - %thead - %tr - %th Name - %th Callback URL - %th Clients - %th - %th - %tbody.oauth-applications - - @applications.each do |application| - %tr{:id => "application_#{application.id}"} - %td= link_to application.name, admin_application_path(application) - %td= application.redirect_uri - %td= application.access_tokens.map(&:resource_owner_id).uniq.count - %td= link_to 'Edit', edit_admin_application_path(application), class: 'btn btn-link' - %td= render 'delete_form', application: application diff --git a/app/views/admin/applications/new.html.haml b/app/views/admin/applications/new.html.haml deleted file mode 100644 index 7c62425f19c..00000000000 --- a/app/views/admin/applications/new.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h3.page-title New application -- @url = admin_applications_path -= render 'form', application: @application
\ No newline at end of file diff --git a/app/views/admin/applications/show.html.haml b/app/views/admin/applications/show.html.haml deleted file mode 100644 index 2abe390ce13..00000000000 --- a/app/views/admin/applications/show.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -%h3.page-title - Application: #{@application.name} - - -%table.table - %tr - %td - Application Id - %td - %code#application_id= @application.uid - %tr - %td - Secret: - %td - %code#secret= @application.secret - - %tr - %td - Callback url - %td - - @application.redirect_uri.split.each do |uri| - %div - %span.monospace= uri -.form-actions - = link_to 'Edit', edit_admin_application_path(@application), class: 'btn btn-primary wide pull-left' - = render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger prepend-left-10' diff --git a/app/views/admin/background_jobs/show.html.haml b/app/views/admin/background_jobs/show.html.haml deleted file mode 100644 index 4ef8e878a7f..00000000000 --- a/app/views/admin/background_jobs/show.html.haml +++ /dev/null @@ -1,44 +0,0 @@ -%h3.page-title Background Jobs -%p.light GitLab uses #{link_to "sidekiq", "http://sidekiq.org/"} library for async job processing - -%hr - -.panel.panel-default - .panel-heading Sidekiq running processes - .panel-body - - if @sidekiq_processes.empty? - %h4.cred - %i.fa.fa-exclamation-triangle - There are no running sidekiq processes. Please restart GitLab - - else - %table.table - %thead - %th USER - %th PID - %th CPU - %th MEM - %th STATE - %th START - %th COMMAND - %tbody - - @sidekiq_processes.each do |process| - - next unless process.match(/(sidekiq \d+\.\d+\.\d+.+$)/) - - data = process.strip.split(' ') - %tr - %td= gitlab_config.user - - 5.times do - %td= data.shift - %td= data.join(' ') - - .clearfix - %p - %i.fa.fa-exclamation-circle - If '[25 of 25 busy]' is shown, restart GitLab with 'sudo service gitlab reload'. - %p - %i.fa.fa-exclamation-circle - If more than one sidekiq process is listed, stop GitLab, kill the remaining sidekiq processes (sudo pkill -u #{gitlab_config.user} -f sidekiq) and restart GitLab. - - - -.panel.panel-default - %iframe{src: sidekiq_path, width: '100%', height: 970, style: "border: none"} diff --git a/app/views/admin/broadcast_messages/index.html.haml b/app/views/admin/broadcast_messages/index.html.haml deleted file mode 100644 index 7e29311bf42..00000000000 --- a/app/views/admin/broadcast_messages/index.html.haml +++ /dev/null @@ -1,59 +0,0 @@ -%h3.page-title - Broadcast Messages -%p.light - Broadcast messages are displayed for every user and can be used to notify users about scheduled maintenance, recent upgrades and more. -.broadcast-message-preview - %i.fa.fa-bullhorn - %span Your message here - -= form_for [:admin, @broadcast_message], html: { class: 'broadcast-message-form form-horizontal'} do |f| - -if @broadcast_message.errors.any? - .alert.alert-danger - - @broadcast_message.errors.full_messages.each do |msg| - %p= msg - .form-group - = f.label :message, class: 'control-label' - .col-sm-10 - = f.text_area :message, class: "form-control", rows: 2, required: true - %div - = link_to '#', class: 'js-toggle-colors-link' do - Customize colors - .form-group.js-toggle-colors-container.hide - = f.label :color, "Background Color", class: 'control-label' - .col-sm-10 - = f.color_field :color, value: "#AA33EE", class: "form-control" - .form-group.js-toggle-colors-container.hide - = f.label :font, "Font Color", class: 'control-label' - .col-sm-10 - = f.color_field :font, value: "#224466", class: "form-control" - .form-group - = f.label :starts_at, class: 'control-label' - .col-sm-10.datetime-controls - = f.datetime_select :starts_at - .form-group - = f.label :ends_at, class: 'control-label' - .col-sm-10.datetime-controls - = f.datetime_select :ends_at - .form-actions - = f.submit "Add broadcast message", class: "btn btn-create" - --if @broadcast_messages.any? - %ul.bordered-list.broadcast-messages - - @broadcast_messages.each do |broadcast_message| - %li - .pull-right - - if broadcast_message.starts_at - %strong - #{broadcast_message.starts_at.to_s(:short)} - \... - - if broadcast_message.ends_at - %strong - #{broadcast_message.ends_at.to_s(:short)} - - = link_to [:admin, broadcast_message], method: :delete, remote: true, class: 'remove-row btn btn-xs' do - %i.fa.fa-times.cred - - .message= broadcast_message.message - - - = paginate @broadcast_messages diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml deleted file mode 100644 index d1c586328a2..00000000000 --- a/app/views/admin/dashboard/index.html.haml +++ /dev/null @@ -1,137 +0,0 @@ -.admin-dashboard - .row - .col-md-4 - %h4 Statistics - %hr - %p - Forks - %span.light.pull-right - = ForkedProjectLink.count - %p - Issues - %span.light.pull-right - = Issue.count - %p - Merge Requests - %span.light.pull-right - = MergeRequest.count - %p - Notes - %span.light.pull-right - = Note.count - %p - Snippets - %span.light.pull-right - = Snippet.count - %p - SSH Keys - %span.light.pull-right - = Key.count - %p - Milestones - %span.light.pull-right - = Milestone.count - %p - Active Users - %span.light.pull-right - = User.active.count - .col-md-4 - %h4 - Features - %hr - %p - Sign up - %span.light.pull-right - = boolean_to_icon signup_enabled? - %p - LDAP - %span.light.pull-right - = boolean_to_icon Gitlab.config.ldap.enabled - %p - Gravatar - %span.light.pull-right - = boolean_to_icon gravatar_enabled? - %p - OmniAuth - %span.light.pull-right - = boolean_to_icon Gitlab.config.omniauth.enabled - .col-md-4 - %h4 Components - %hr - %p - GitLab - %span.pull-right - = Gitlab::VERSION - %p - GitLab Shell - %span.pull-right - = Gitlab::Shell.new.version - %p - GitLab API - %span.pull-right - = API::API::version - %p - Ruby - %span.pull-right - #{RUBY_VERSION}p#{RUBY_PATCHLEVEL} - - %p - Rails - %span.pull-right - #{Rails::VERSION::STRING} - %hr - .row - .col-sm-4 - .light-well - %h4 Projects - .data - = link_to admin_namespaces_projects_path do - %h1= Project.count - %hr - = link_to('New Project', new_project_path, class: "btn btn-new") - .col-sm-4 - .light-well - %h4 Users - .data - = link_to admin_users_path do - %h1= User.count - %hr - = link_to 'New User', new_admin_user_path, class: "btn btn-new" - .col-sm-4 - .light-well - %h4 Groups - .data - = link_to admin_groups_path do - %h1= Group.count - %hr - = link_to 'New Group', new_admin_group_path, class: "btn btn-new" - - .row.prepend-top-10 - .col-md-4 - %h4 Latest projects - %hr - - @projects.each do |project| - %p - = link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project], class: 'str-truncated' - %span.light.pull-right - #{time_ago_with_tooltip(project.created_at)} - - .col-md-4 - %h4 Latest users - %hr - - @users.each do |user| - %p - = link_to [:admin, user], class: 'str-truncated' do - = user.name - %span.light.pull-right - #{time_ago_with_tooltip(user.created_at)} - - .col-md-4 - %h4 Latest groups - %hr - - @groups.each do |group| - %p - = link_to [:admin, group], class: 'str-truncated' do - = group.name - %span.light.pull-right - #{time_ago_with_tooltip(group.created_at)} diff --git a/app/views/admin/deploy_keys/index.html.haml b/app/views/admin/deploy_keys/index.html.haml deleted file mode 100644 index 2ae83ab95f7..00000000000 --- a/app/views/admin/deploy_keys/index.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -.panel.panel-default - .panel-heading - Public deploy keys (#{@deploy_keys.count}) - .panel-head-actions - = link_to 'New Deploy Key', new_admin_deploy_key_path, class: "btn btn-new btn-sm" - - if @deploy_keys.any? - %table.table - %thead.panel-heading - %tr - %th Title - %th Fingerprint - %th Added at - %th - %tbody - - @deploy_keys.each do |deploy_key| - %tr - %td - = link_to admin_deploy_key_path(deploy_key) do - %strong= deploy_key.title - %td - %span - (#{deploy_key.fingerprint}) - %td - %span.cgray - added #{time_ago_with_tooltip(deploy_key.created_at)} - %td - = link_to 'Remove', admin_deploy_key_path(deploy_key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-sm btn-remove delete-key pull-right" diff --git a/app/views/admin/deploy_keys/new.html.haml b/app/views/admin/deploy_keys/new.html.haml deleted file mode 100644 index c00049424c5..00000000000 --- a/app/views/admin/deploy_keys/new.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -%h3.page-title New public deploy key -%hr - -%div - = form_for [:admin, @deploy_key], html: { class: 'deploy-key-form form-horizontal' } do |f| - -if @deploy_key.errors.any? - .alert.alert-danger - %ul - - @deploy_key.errors.full_messages.each do |msg| - %li= msg - - .form-group - = f.label :title, class: "control-label" - .col-sm-10= f.text_field :title, class: 'form-control' - .form-group - = f.label :key, class: "control-label" - .col-sm-10 - %p.light - Paste a machine public key here. Read more about how to generate it - = link_to "here", help_page_path("ssh", "README") - = f.text_area :key, class: "form-control thin_area", rows: 5 - - .form-actions - = f.submit 'Create', class: "btn-create btn" - = link_to "Cancel", admin_deploy_keys_path, class: "btn btn-cancel" - diff --git a/app/views/admin/deploy_keys/show.html.haml b/app/views/admin/deploy_keys/show.html.haml deleted file mode 100644 index cfa2adf92ee..00000000000 --- a/app/views/admin/deploy_keys/show.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -.row - .col-md-4 - .panel.panel-default - .panel-heading - Deploy Key - %ul.well-list - %li - %span.light Title: - %strong= @deploy_key.title - %li - %span.light Created on: - %strong= @deploy_key.created_at.stamp("Aug 21, 2011") - - .panel.panel-default - .panel-heading Projects (#{@deploy_key.deploy_keys_projects.count}) - - if @deploy_key.deploy_keys_projects.any? - %ul.well-list - - @deploy_key.projects.each do |project| - %li - %span - %strong - = link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project] - .pull-right - = link_to disable_namespace_project_deploy_key_path(project.namespace, project, @deploy_key), data: { confirm: "Are you sure?" }, method: :put, class: "btn-xs btn btn-remove", title: 'Remove deploy key from project' do - %i.fa.fa-times.fa-inverse - - .col-md-8 - %p - %span.light Fingerprint: - %strong= @deploy_key.fingerprint - %pre.well-pre - = @deploy_key.key - .pull-right - = link_to 'Remove', admin_deploy_key_path(@deploy_key), data: {confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove delete-key" diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml deleted file mode 100644 index 9e7751830a4..00000000000 --- a/app/views/admin/groups/_form.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -= form_for [:admin, @group], html: { class: "form-horizontal" } do |f| - - if @group.errors.any? - .alert.alert-danger - %span= @group.errors.full_messages.first - - = render 'shared/group_form', f: f - - .form-group.group-description-holder - = f.label :avatar, "Group avatar", class: 'control-label' - .col-sm-10 - = render 'shared/choose_group_avatar_button', f: f - - - if @group.new_record? - .form-group - .col-sm-2 - .col-sm-10 - .alert.alert-info - = render 'shared/group_tips' - .form-actions - = f.submit 'Create group', class: "btn btn-create" - = link_to 'Cancel', admin_groups_path, class: "btn btn-cancel" - - - else - .form-actions - = f.submit 'Save changes', class: "btn btn-primary" - = link_to 'Cancel', admin_group_path(@group), class: "btn btn-cancel" - diff --git a/app/views/admin/groups/edit.html.haml b/app/views/admin/groups/edit.html.haml deleted file mode 100644 index 824e51c1cf1..00000000000 --- a/app/views/admin/groups/edit.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h3.page-title Edit group: #{@group.name} -%hr -= render 'form' diff --git a/app/views/admin/groups/index.html.haml b/app/views/admin/groups/index.html.haml deleted file mode 100644 index 4c53ff55708..00000000000 --- a/app/views/admin/groups/index.html.haml +++ /dev/null @@ -1,62 +0,0 @@ -%h3.page-title - Groups (#{@groups.total_count}) - = link_to 'New Group', new_admin_group_path, class: "btn btn-new pull-right" - -%p.light - Group allows you to keep projects organized. - Use groups for uniting related projects. - -%hr -= form_tag admin_groups_path, method: :get, class: 'form-inline' do - = hidden_field_tag :sort, @sort - .form-group - = text_field_tag :name, params[:name], class: "form-control input-mn-300" - = button_tag "Search", class: "btn submit btn-primary" - - .pull-right - .dropdown.inline - %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} - %span.light sort: - - if @sort.present? - = sort_options_hash[@sort] - - else - = sort_title_recently_created - %b.caret - %ul.dropdown-menu - %li - = link_to admin_groups_path(sort: sort_value_recently_created) do - = sort_title_recently_created - = link_to admin_groups_path(sort: sort_value_oldest_created) do - = sort_title_oldest_created - = link_to admin_groups_path(sort: sort_value_recently_updated) do - = sort_title_recently_updated - = link_to admin_groups_path(sort: sort_value_oldest_updated) do - = sort_title_oldest_updated - -%hr - -%ul.bordered-list - - @groups.each do |group| - %li - .clearfix - .pull-right.prepend-top-10 - = link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-sm" - = link_to 'Destroy', [:admin, group], data: {confirm: "REMOVE #{group.name}? Are you sure?"}, method: :delete, class: "btn btn-sm btn-remove" - - %h4 - = link_to [:admin, group] do - %i.fa.fa-folder - = group.name - - → - %span.monospace - %strong #{group.path}/ - .clearfix - %p - = truncate group.description, length: 150 - .clearfix - %p.light - #{pluralize(group.members.size, 'member')}, #{pluralize(group.projects.count, 'project')} - - -= paginate @groups, theme: "gitlab" diff --git a/app/views/admin/groups/new.html.haml b/app/views/admin/groups/new.html.haml deleted file mode 100644 index f46f45c5514..00000000000 --- a/app/views/admin/groups/new.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h3.page-title New group -%hr -= render 'form' diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml deleted file mode 100644 index 14996dcd6a2..00000000000 --- a/app/views/admin/groups/show.html.haml +++ /dev/null @@ -1,91 +0,0 @@ -%h3.page-title - Group: #{@group.name} - - = link_to edit_admin_group_path(@group), class: "btn pull-right" do - %i.fa.fa-pencil-square-o - Edit -%hr -.row - .col-md-6 - .panel.panel-default - .panel-heading - Group info: - %ul.well-list - %li - = image_tag group_icon(@group), class: "avatar s60" - %li - %span.light Name: - %strong= @group.name - %li - %span.light Path: - %strong - = @group.path - - %li - %span.light Description: - %strong - = @group.description - - %li - %span.light Created on: - %strong - = @group.created_at.stamp("March 1, 1999") - - .panel.panel-default - .panel-heading - %h3.panel-title - Projects - %span.badge - #{@group.projects.count} - %ul.well-list - - @projects.each do |project| - %li - %strong - = link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project] - %span.label.label-gray - = repository_size(project) - %span.pull-right.light - %span.monospace= project.path_with_namespace + ".git" - .panel-footer - = paginate @projects, param_name: 'projects_page', theme: 'gitlab' - - .col-md-6 - .panel.panel-default - .panel-heading - Add user(s) to the group: - .panel-body.form-holder - %p.light - Read more about project permissions - %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink" - - = form_tag members_update_admin_group_path(@group), id: "new_project_member", class: "bulk_import", method: :put do - %div - = users_select_tag(:user_ids, multiple: true, email_user: true) - %div.prepend-top-10 - = select_tag :access_level, options_for_select(GroupMember.access_level_roles), class: "project-access-select select2" - %hr - = button_tag 'Add users to group', class: "btn btn-create" - .panel.panel-default - .panel-heading - %h3.panel-title - Members - %span.badge - #{@group.group_members.count} - %ul.well-list.group-users-list - - @members.each do |member| - - user = member.user - %li{class: dom_class(member), id: (dom_id(user) if user)} - .list-item-name - - if user - %strong - = link_to user.name, admin_user_path(user) - - else - %strong - = member.invite_email - (invited) - %span.pull-right.light - = member.human_access - = link_to group_group_member_path(@group, member), data: { confirm: remove_user_from_group_message(@group, member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do - %i.fa.fa-minus.fa-inverse - .panel-footer - = paginate @members, param_name: 'members_page', theme: 'gitlab' diff --git a/app/views/admin/hooks/index.html.haml b/app/views/admin/hooks/index.html.haml deleted file mode 100644 index 7a9dc113f2a..00000000000 --- a/app/views/admin/hooks/index.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -%h3.page-title - System hooks - -%p.light - #{link_to "System hooks ", help_page_path("system_hooks", "system_hooks"), class: "vlink"} can be - used for binding events when GitLab creates a User or Project. - -%hr - - -= form_for @hook, as: :hook, url: admin_hooks_path, html: { class: 'form-horizontal' } do |f| - -if @hook.errors.any? - .alert.alert-danger - - @hook.errors.full_messages.each do |msg| - %p= msg - .form-group - = f.label :url, "URL:", class: 'control-label' - .col-sm-10 - = f.text_field :url, class: "form-control" - .form-actions - = f.submit "Add System Hook", class: "btn btn-create" -%hr - --if @hooks.any? - .panel.panel-default - .panel-heading - System hooks (#{@hooks.count}) - %ul.well-list - - @hooks.each do |hook| - %li - .list-item-name - = link_to admin_hook_path(hook) do - %strong= hook.url - - .pull-right - = link_to 'Test Hook', admin_hook_test_path(hook), class: "btn btn-sm" - = link_to 'Remove', admin_hook_path(hook), data: { confirm: 'Are you sure?' }, method: :delete, class: "btn btn-remove btn-sm" diff --git a/app/views/admin/keys/show.html.haml b/app/views/admin/keys/show.html.haml deleted file mode 100644 index 5b23027b3ab..00000000000 --- a/app/views/admin/keys/show.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "profiles/keys/key_details", admin: true diff --git a/app/views/admin/logs/show.html.haml b/app/views/admin/logs/show.html.haml deleted file mode 100644 index 384c6ee9af5..00000000000 --- a/app/views/admin/logs/show.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -- loggers = [Gitlab::GitLogger, Gitlab::AppLogger, - Gitlab::ProductionLogger, Gitlab::SidekiqLogger] -%ul.nav.nav-tabs.log-tabs - - loggers.each do |klass| - %li{ class: (klass == Gitlab::GitLogger ? 'active' : '') } - = link_to klass::file_name, "##{klass::file_name_noext}", - 'data-toggle' => 'tab' -%p.light To prevent performance issues admin logs output the last 2000 lines -.tab-content - - loggers.each do |klass| - .tab-pane{ class: (klass == Gitlab::GitLogger ? 'active' : ''), - id: klass::file_name_noext } - .file-holder#README - .file-title - %i.fa.fa-file - = klass::file_name - .pull-right - = link_to '#', class: 'log-bottom' do - %i.fa.fa-arrow-down - Scroll down - .file-content.logs - %ol - - klass.read_latest.each do |line| - %li - %p= line diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml deleted file mode 100644 index 3bbe10bc270..00000000000 --- a/app/views/admin/projects/index.html.haml +++ /dev/null @@ -1,81 +0,0 @@ -.row - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left - %aside.col-md-3 - .admin-filter - = form_tag admin_namespaces_projects_path, method: :get, class: '' do - .form-group - = label_tag :name, 'Name:' - = text_field_tag :name, params[:name], class: "form-control" - - .form-group - = label_tag :namespace_id, "Namespace" - = namespace_select_tag :namespace_id, selected: params[:namespace_id], class: 'input-large' - - .form-group - %strong Activity - .checkbox - = label_tag :with_push do - = check_box_tag :with_push, 1, params[:with_push] - %span Projects with push events - .checkbox - = label_tag :abandoned do - = check_box_tag :abandoned, 1, params[:abandoned] - %span No activity over 6 month - - %fieldset - %strong Visibility level: - .visibility-levels - - Project.visibility_levels.each do |label, level| - .checkbox - %label - = check_box_tag 'visibility_levels[]', level, params[:visibility_levels].present? && params[:visibility_levels].include?(level.to_s) - %span.descr - = visibility_level_icon(level) - = label - %hr - = hidden_field_tag :sort, params[:sort] - = button_tag "Search", class: "btn submit btn-primary" - = link_to "Reset", admin_namespaces_projects_path, class: "btn btn-cancel" - - %section.col-md-9 - .panel.panel-default - .panel-heading - Projects (#{@projects.total_count}) - .panel-head-actions - .dropdown.inline - %button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'} - %span.light sort: - - if @sort.present? - = sort_options_hash[@sort] - - else - = sort_title_recently_created - %b.caret - %ul.dropdown-menu - %li - = link_to admin_namespaces_projects_path(sort: sort_value_recently_created) do - = sort_title_recently_created - = link_to admin_namespaces_projects_path(sort: sort_value_oldest_created) do - = sort_title_oldest_created - = link_to admin_namespaces_projects_path(sort: sort_value_recently_updated) do - = sort_title_recently_updated - = link_to admin_namespaces_projects_path(sort: sort_value_oldest_updated) do - = sort_title_oldest_updated - = link_to admin_namespaces_projects_path(sort: sort_value_largest_repo) do - = sort_title_largest_repo - = link_to 'New Project', new_project_path, class: "btn btn-sm btn-success" - %ul.well-list - - @projects.each do |project| - %li - .list-item-name - %span{ class: visibility_level_color(project.visibility_level) } - = visibility_level_icon(project.visibility_level) - = link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project] - .pull-right - %span.label.label-gray - = repository_size(project) - = link_to 'Edit', edit_namespace_project_path(project.namespace, project), id: "edit_#{dom_id(project)}", class: "btn btn-sm" - = link_to 'Destroy', [project.namespace.becomes(Namespace), project], data: { confirm: remove_project_message(project) }, method: :delete, class: "btn btn-sm btn-remove" - - if @projects.blank? - .nothing-here-block 0 projects matches - = paginate @projects, theme: "gitlab" diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml deleted file mode 100644 index 78684c692c7..00000000000 --- a/app/views/admin/projects/show.html.haml +++ /dev/null @@ -1,142 +0,0 @@ -%h3.page-title - Project: #{@project.name_with_namespace} - = link_to edit_project_path(@project), class: "btn pull-right" do - %i.fa.fa-pencil-square-o - Edit -%hr -.row - .col-md-6 - .panel.panel-default - .panel-heading - Project info: - %ul.well-list - %li - %span.light Name: - %strong - = link_to @project.name, project_path(@project) - %li - %span.light Namespace: - %strong - - if @project.namespace - = link_to @project.namespace.human_name, [:admin, @project.group || @project.owner] - - else - Global - %li - %span.light Owned by: - %strong - - if @project.owner - = link_to @project.owner_name, [:admin, @project.owner] - - else - (deleted) - - %li - %span.light Created by: - %strong - = @project.creator.try(:name) || '(deleted)' - - %li - %span.light Created on: - %strong - = @project.created_at.stamp("March 1, 1999") - - %li - %span.light http: - %strong - = link_to @project.http_url_to_repo, project_path(@project) - %li - %span.light ssh: - %strong - = link_to @project.ssh_url_to_repo, project_path(@project) - - if @project.repository.exists? - %li - %span.light fs: - %strong - = @repository.path_to_repo - - %li - %span.light Size - %strong - = repository_size(@project) - - %li - %span.light last commit: - %strong - = last_commit(@project) - - else - %li - %span.light repository: - %strong.cred - does not exist - - - if @project.archived? - %li - %span.light archived: - %strong repository is read-only - - %li - %span.light access: - %strong - %span{ class: visibility_level_color(@project.visibility_level) } - = visibility_level_icon(@project.visibility_level) - = visibility_level_label(@project.visibility_level) - - .panel.panel-default - .panel-heading - Transfer project - .panel-body - = form_for @project, url: transfer_admin_namespace_project_path(@project.namespace, @project), method: :put, html: { class: 'form-horizontal' } do |f| - .form-group - = f.label :new_namespace_id, "Namespace", class: 'control-label' - .col-sm-10 - = namespace_select_tag :new_namespace_id, selected: params[:namespace_id], class: 'input-large' - - .form-group - .col-sm-2 - .col-sm-10 - = f.submit 'Transfer', class: 'btn btn-primary' - - .col-md-6 - - if @group - .panel.panel-default - .panel-heading - %strong #{@group.name} - group members (#{@group.group_members.count}) - .pull-right - = link_to admin_group_path(@group), class: 'btn btn-xs' do - %i.fa.fa-pencil-square-o - %ul.well-list - - @group_members.each do |member| - = render 'groups/group_members/group_member', member: member, show_controls: false - .panel-footer - = paginate @group_members, param_name: 'group_members_page', theme: 'gitlab' - - .panel.panel-default - .panel-heading - Project members - %small - (#{@project.users.count}) - .pull-right - = link_to namespace_project_project_members_path(@project.namespace, @project), class: "btn btn-xs" do - %i.fa.fa-pencil-square-o - Manage Access - %ul.well-list.project_members - - @project_members.each do |project_member| - - user = project_member.user - %li.project_member - .list-item-name - - if user - %strong - = link_to user.name, admin_user_path(user) - - else - %strong - = project_member.invite_email - (invited) - .pull-right - - if project_member.owner? - %span.light Owner - - else - %span.light= project_member.human_access - = link_to namespace_project_project_member_path(@project.namespace, @project, project_member), data: { confirm: remove_from_project_team_message(@project, project_member)}, method: :delete, remote: true, class: "btn btn-sm btn-remove" do - %i.fa.fa-times - .panel-footer - = paginate @project_members, param_name: 'project_members_page', theme: 'gitlab' diff --git a/app/views/admin/services/_form.html.haml b/app/views/admin/services/_form.html.haml deleted file mode 100644 index eb7a099bfe2..00000000000 --- a/app/views/admin/services/_form.html.haml +++ /dev/null @@ -1,94 +0,0 @@ -%h3.page-title - = @service.title - -%p #{@service.description} template - -= form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'form-horizontal fieldset-form' } do |f| - - if @service.errors.any? - #error_explanation - .alert.alert-danger - - @service.errors.full_messages.each do |msg| - %p= msg - - if @service.help.present? - .well - = preserve do - = markdown @service.help - - .form-group - = f.label :active, "Active", class: "control-label" - .col-sm-10 - = f.check_box :active - - - if @service.supported_events.length > 1 - .form-group - = f.label :url, "Trigger", class: 'control-label' - .col-sm-10 - - if @service.supported_events.include?("push") - %div - = f.check_box :push_events, class: 'pull-left' - .prepend-left-20 - = f.label :push_events, class: 'list-label' do - %strong Push events - %p.light - This url will be triggered by a push to the repository - - if @service.supported_events.include?("tag_push") - %div - = f.check_box :tag_push_events, class: 'pull-left' - .prepend-left-20 - = f.label :tag_push_events, class: 'list-label' do - %strong Tag push events - %p.light - This url will be triggered when a new tag is pushed to the repository - - if @service.supported_events.include?("note") - %div - = f.check_box :note_events, class: 'pull-left' - .prepend-left-20 - = f.label :note_events, class: 'list-label' do - %strong Comments - %p.light - This url will be triggered when someone adds a comment - - if @service.supported_events.include?("issue") - %div - = f.check_box :issues_events, class: 'pull-left' - .prepend-left-20 - = f.label :issues_events, class: 'list-label' do - %strong Issues events - %p.light - This url will be triggered when an issue is created - - if @service.supported_events.include?("merge_request") - %div - = f.check_box :merge_requests_events, class: 'pull-left' - .prepend-left-20 - = f.label :merge_requests_events, class: 'list-label' do - %strong Merge Request events - %p.light - This url will be triggered when a merge request is created - - - @service.fields.each do |field| - - name = field[:name] - - title = field[:title] || name.humanize - - value = @service.send(name) unless field[:type] == 'password' - - type = field[:type] - - placeholder = field[:placeholder] - - choices = field[:choices] - - default_choice = field[:default_choice] - - help = field[:help] - - .form-group - = f.label name, title, class: "control-label" - .col-sm-10 - - if type == 'text' - = f.text_field name, class: "form-control", placeholder: placeholder - - elsif type == 'textarea' - = f.text_area name, rows: 5, class: "form-control", placeholder: placeholder - - elsif type == 'checkbox' - = f.check_box name - - elsif type == 'select' - = f.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" } - - elsif type == 'password' - = f.password_field name, class: 'form-control' - - if help - %span.help-block= help - - .form-actions - = f.submit 'Save', class: 'btn btn-save' diff --git a/app/views/admin/services/edit.html.haml b/app/views/admin/services/edit.html.haml deleted file mode 100644 index bcc5832792f..00000000000 --- a/app/views/admin/services/edit.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render 'form' diff --git a/app/views/admin/services/index.html.haml b/app/views/admin/services/index.html.haml deleted file mode 100644 index 0093fb97765..00000000000 --- a/app/views/admin/services/index.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%h3.page-title Service templates -%p.light Service template allows you to set default values for project services - -%table.table - %thead - %tr - %th - %th Service - %th Description - %th Last edit - - @services.sort_by(&:title).each do |service| - %tr - %td - = icon("copy", class: 'clgray') - %td - = link_to edit_admin_application_settings_service_path(service.id) do - %strong= service.title - %td - = service.description - %td.light - = time_ago_in_words service.updated_at - ago diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml deleted file mode 100644 index e18dd9bc905..00000000000 --- a/app/views/admin/users/_form.html.haml +++ /dev/null @@ -1,90 +0,0 @@ -.user_new - = form_for [:admin, @user], html: { class: 'form-horizontal fieldset-form' } do |f| - -if @user.errors.any? - #error_explanation - .alert.alert-danger - - @user.errors.full_messages.each do |msg| - %p= msg - - %fieldset - %legend Account - .form-group - = f.label :name, class: 'control-label' - .col-sm-10 - = f.text_field :name, required: true, autocomplete: "off", class: 'form-control' - %span.help-inline * required - .form-group - = f.label :username, class: 'control-label' - .col-sm-10 - = f.text_field :username, required: true, autocomplete: "off", class: 'form-control' - %span.help-inline * required - .form-group - = f.label :email, class: 'control-label' - .col-sm-10 - = f.text_field :email, required: true, autocomplete: "off", class: 'form-control' - %span.help-inline * required - - - if @user.new_record? - %fieldset - %legend Password - .form-group - = f.label :password, class: 'control-label' - .col-sm-10 - %strong - Reset link will be generated and sent to the user. - %br - User will be forced to set the password on first sign in. - - else - %fieldset - %legend Password - .form-group - = f.label :password, class: 'control-label' - .col-sm-10= f.password_field :password, disabled: f.object.force_random_password, class: 'form-control' - .form-group - = f.label :password_confirmation, class: 'control-label' - .col-sm-10= f.password_field :password_confirmation, disabled: f.object.force_random_password, class: 'form-control' - - %fieldset - %legend Access - .form-group - = f.label :projects_limit, class: 'control-label' - .col-sm-10= f.number_field :projects_limit, class: 'form-control' - - .form-group - = f.label :can_create_group, class: 'control-label' - .col-sm-10= f.check_box :can_create_group - - .form-group - = f.label :admin, class: 'control-label' - - if current_user == @user - .col-sm-10= f.check_box :admin, disabled: true - .col-sm-10 You cannot remove your own admin rights - - else - .col-sm-10= f.check_box :admin - %fieldset - %legend Profile - .form-group - = f.label :avatar, class: 'control-label' - .col-sm-10 - = f.file_field :avatar - - .form-group - = f.label :skype, class: 'control-label' - .col-sm-10= f.text_field :skype, class: 'form-control' - .form-group - = f.label :linkedin, class: 'control-label' - .col-sm-10= f.text_field :linkedin, class: 'form-control' - .form-group - = f.label :twitter, class: 'control-label' - .col-sm-10= f.text_field :twitter, class: 'form-control' - .form-group - = f.label :website_url, 'Website', class: 'control-label' - .col-sm-10= f.text_field :website_url, class: 'form-control' - - .form-actions - - if @user.new_record? - = f.submit 'Create user', class: "btn btn-create" - = link_to 'Cancel', admin_users_path, class: "btn btn-cancel" - - else - = f.submit 'Save changes', class: "btn btn-save" - = link_to 'Cancel', admin_user_path(@user), class: "btn btn-cancel" diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml deleted file mode 100644 index d71d8189c51..00000000000 --- a/app/views/admin/users/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h3.page-title - Edit user: #{@user.name} -.back-link - = link_to admin_user_path(@user) do - ← Back to user page -%hr -= render 'form' diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml deleted file mode 100644 index 25c1730ef70..00000000000 --- a/app/views/admin/users/index.html.haml +++ /dev/null @@ -1,88 +0,0 @@ -.row - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left - %aside.col-md-3 - .admin-filter - %ul.nav.nav-pills.nav-stacked - %li{class: "#{'active' unless params[:filter]}"} - = link_to admin_users_path do - Active - %small.pull-right= User.active.count - %li{class: "#{'active' if params[:filter] == "admins"}"} - = link_to admin_users_path(filter: "admins") do - Admins - %small.pull-right= User.admins.count - %li{class: "#{'active' if params[:filter] == "blocked"}"} - = link_to admin_users_path(filter: "blocked") do - Blocked - %small.pull-right= User.blocked.count - %li{class: "#{'active' if params[:filter] == "wop"}"} - = link_to admin_users_path(filter: "wop") do - Without projects - %small.pull-right= User.without_projects.count - %hr - = form_tag admin_users_path, method: :get, class: 'form-inline' do - .form-group - = search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'form-control' - = button_tag class: 'btn btn-primary' do - %i.fa.fa-search - %hr - = link_to 'Reset', admin_users_path, class: "btn btn-cancel" - - %section.col-md-9 - .panel.panel-default - .panel-heading - Users (#{@users.total_count}) - .panel-head-actions - .dropdown.inline - %a.dropdown-toggle.btn.btn-sm{href: '#', "data-toggle" => "dropdown"} - %span.light sort: - - if @sort.present? - = sort_options_hash[@sort] - - else - = sort_title_name - %b.caret - %ul.dropdown-menu - %li - = link_to admin_users_path(sort: sort_value_name) do - = sort_title_name - = link_to admin_users_path(sort: sort_value_recently_signin) do - = sort_title_recently_signin - = link_to admin_users_path(sort: sort_value_oldest_signin) do - = sort_title_oldest_signin - = link_to admin_users_path(sort: sort_value_recently_created) do - = sort_title_recently_created - = link_to admin_users_path(sort: sort_value_oldest_created) do - = sort_title_oldest_created - = link_to admin_users_path(sort: sort_value_recently_updated) do - = sort_title_recently_updated - = link_to admin_users_path(sort: sort_value_oldest_updated) do - = sort_title_oldest_updated - - = link_to 'New User', new_admin_user_path, class: "btn btn-new btn-sm" - %ul.well-list - - @users.each do |user| - %li - .list-item-name - - if user.blocked? - %i.fa.fa-lock.cred - - else - %i.fa.fa-user.cgreen - = link_to user.name, [:admin, user] - - if user.admin? - %strong.cred (Admin) - - if user == current_user - %span.cred It's you! - .pull-right - %span.light - %i.fa.fa-envelope - = mail_to user.email, user.email, class: 'light' - - = link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn btn-sm" - - unless user == current_user - - if user.blocked? - = link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: "btn btn-sm success" - - else - = link_to 'Block', block_admin_user_path(user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: "btn btn-sm btn-remove" - = link_to 'Destroy', [:admin, user], data: { confirm: "USER #{user.name} WILL BE REMOVED! All tickets linked to this user will also be removed! Maybe block the user instead? Are you sure?" }, method: :delete, class: "btn btn-sm btn-remove" - = paginate @users, theme: "gitlab" diff --git a/app/views/admin/users/new.html.haml b/app/views/admin/users/new.html.haml deleted file mode 100644 index 8fbb757f424..00000000000 --- a/app/views/admin/users/new.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3.page-title - New user -%hr -= render 'form' diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml deleted file mode 100644 index 3524f04c5ed..00000000000 --- a/app/views/admin/users/show.html.haml +++ /dev/null @@ -1,227 +0,0 @@ -%h3.page-title - User: - = @user.name - - if @user.blocked? - %span.cred (Blocked) - - if @user.admin - %span.cred (Admin) - - .pull-right - = link_to edit_admin_user_path(@user), class: "btn btn-grouped" do - %i.fa.fa-pencil-square-o - Edit -%hr -%ul.nav.nav-tabs - %li.active - %a{"data-toggle" => "tab", href: "#account"} Account - %li - %a{"data-toggle" => "tab", href: "#profile"} Profile - %li - %a{"data-toggle" => "tab", href: "#groups"} Groups - %li - %a{"data-toggle" => "tab", href: "#projects"} Projects - %li - %a{"data-toggle" => "tab", href: "#ssh-keys"} SSH keys - -.tab-content - #account.tab-pane.active - .row - .col-md-6 - .panel.panel-default - .panel-heading - Account: - %ul.well-list - %li - %span.light Name: - %strong= @user.name - %li - %span.light Username: - %strong - = @user.username - %li - %span.light Email: - %strong - = mail_to @user.email - - @user.emails.each do |email| - %li - %span.light Secondary email: - %strong= email.email - = link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-xs btn btn-remove pull-right", title: 'Remove secondary email', id: "remove_email_#{email.id}" do - %i.fa.fa-times - - %li - %span.light Can create groups: - %strong - = @user.can_create_group ? "Yes" : "No" - %li - %span.light Personal projects limit: - %strong - = @user.projects_limit - %li - %span.light Member since: - %strong - = @user.created_at.stamp("Nov 12, 2031") - - if @user.confirmed_at - %li - %span.light Confirmed at: - %strong - = @user.confirmed_at.stamp("Nov 12, 2031") - - else - %li - %span.light Confirmed: - %strong.cred - No - - %li - %span.light Current sign-in at: - %strong - - if @user.current_sign_in_at - = @user.current_sign_in_at.stamp("Nov 12, 2031") - - else - never - - %li - %span.light Last sign-in at: - %strong - - if @user.last_sign_in_at - = @user.last_sign_in_at.stamp("Nov 12, 2031") - - else - never - - %li - %span.light Sign-in count: - %strong - = @user.sign_in_count - - - if @user.ldap_user? - %li - %span.light LDAP uid: - %strong - = @user.ldap_identity.extern_uid - - - if @user.created_by - %li - %span.light Created by: - %strong - = link_to @user.created_by.name, [:admin, @user.created_by] - - .col-md-6 - - unless @user == current_user - - if @user.blocked? - .panel.panel-info - .panel-heading - This user is blocked - .panel-body - %p Blocking user has the following effects: - %ul - %li User will not be able to login - %li User will not be able to access git repositories - %li Personal projects will be left - %li Owned groups will be left - %br - = link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: 'Are you sure?' } - - else - .panel.panel-warning - .panel-heading - Block this user - .panel-body - %p Blocking user has the following effects: - %ul - %li User will not be able to login - %li User will not be able to access git repositories - %li User will be removed from joined projects and groups - %li Personal projects will be left - %li Owned groups will be left - %br - = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-warning" - - .panel.panel-danger - .panel-heading - Remove user - .panel-body - %p Deleting a user has the following effects: - %ul - %li All user content like authored issues, snippets, comments will be removed - - rp = @user.personal_projects.count - - unless rp.zero? - %li #{pluralize rp, 'personal project'} will be removed and cannot be restored - - if @user.solo_owned_groups.present? - %li - Next groups with all content will be removed: - %strong #{@user.solo_owned_groups.map(&:name).join(', ')} - %br - = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove" - - #profile.tab-pane - .row - .col-md-6 - .panel.panel-default - .panel-heading - = @user.name - %ul.well-list - %li - = image_tag avatar_icon(@user.email, 60), class: "avatar s60" - %li - %span.light Profile page: - %strong - = link_to user_path(@user) do - = @user.username - .col-md-6 - = render 'users/profile', user: @user - - #groups.tab-pane - - if @user.group_members.present? - .panel.panel-default - .panel-heading Groups: - %ul.well-list - - @user.group_members.each do |group_member| - - group = group_member.group - %li.group_member - %span{class: ("list-item-name" unless group_member.owner?)} - %strong= link_to group.name, admin_group_path(group) - .pull-right - %span.light= group_member.human_access - - unless group_member.owner? - = link_to group_group_member_path(group, group_member), data: { confirm: remove_user_from_group_message(group, group_member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do - %i.fa.fa-times.fa-inverse - - else - .nothing-here-block This user has no groups. - - #projects.tab-pane - - if @user.groups.any? - .panel.panel-default - .panel-heading Group projects - %ul.well-list - - @user.groups.each do |group| - %li - %strong= group.name - – access to - #{pluralize(group.projects.count, 'project')} - - .row - .col-md-6 - = render 'users/projects', projects: @personal_projects - - .col-md-6 - .panel.panel-default - .panel-heading Joined projects (#{@joined_projects.count}) - %ul.well-list - - @joined_projects.sort_by(&:name_with_namespace).each do |project| - - member = project.team.find_member(@user.id) - %li.project_member - .list-item-name - = link_to admin_namespace_project_path(project.namespace, project), class: dom_class(project) do - = project.name_with_namespace - - - if member - .pull-right - - if member.owner? - %span.light Owner - - else - %span.light= member.human_access - - - if member.respond_to? :project - = link_to namespace_project_project_member_path(project.namespace, project, member), data: { confirm: remove_from_project_team_message(project, member) }, remote: true, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove user from project' do - %i.fa.fa-times - #ssh-keys.tab-pane - = render 'profiles/keys/key_table', admin: true diff --git a/app/views/dashboard/_activities.html.haml b/app/views/dashboard/_activities.html.haml deleted file mode 100644 index c1fc1602d0a..00000000000 --- a/app/views/dashboard/_activities.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -= render "events/event_last_push", event: @last_push -= render 'shared/event_filter' -.content_list -= spinner diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml deleted file mode 100644 index d676576067c..00000000000 --- a/app/views/dashboard/_projects.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - .input-group - = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control' - - if current_user.can_create_project? - %span.input-group-btn - = link_to new_project_path, class: 'btn btn-success' do - New project - - = render 'shared/projects_list', projects: @projects, projects_limit: 20 diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml deleted file mode 100644 index 78f695be916..00000000000 --- a/app/views/dashboard/_sidebar.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= render "dashboard/projects", projects: @projects -.prepend-top-20 - = render 'shared/promo' diff --git a/app/views/dashboard/_zero_authorized_projects.html.haml b/app/views/dashboard/_zero_authorized_projects.html.haml deleted file mode 100644 index 4e7d6639727..00000000000 --- a/app/views/dashboard/_zero_authorized_projects.html.haml +++ /dev/null @@ -1,53 +0,0 @@ -- publicish_project_count = Project.publicish(current_user).count -%h3.page-title Welcome to GitLab! -%p.light Self hosted Git management application. -%hr -%div - .dashboard-intro-icon - %i.fa.fa-bookmark-o - .dashboard-intro-text - %p.slead - You don't have access to any projects right now. - %br - - if current_user.can_create_project? - You can create up to - %strong= pluralize(current_user.projects_limit, "project") + "." - - else - If you are added to a project, it will be displayed here. - - - if current_user.can_create_project? - .link_holder - = link_to new_project_path, class: "btn btn-new" do - %i.fa.fa-plus - New Project - -- if current_user.can_create_group? - %hr - %div - .dashboard-intro-icon - %i.fa.fa-users - .dashboard-intro-text - %p.slead - You can create a group for several dependent projects. - %br - Groups are the best way to manage projects and members. - .link_holder - = link_to new_group_path, class: "btn btn-new" do - %i.fa.fa-plus - New Group - --if publicish_project_count > 0 - %hr - %div - .dashboard-intro-icon - %i.fa.fa-globe - .dashboard-intro-text - %p.slead - There are - %strong= publicish_project_count - public projects on this server. - %br - Public projects are an easy way to allow everyone to have read-only access. - .link_holder - = link_to trending_explore_projects_path, class: "btn btn-new" do - Browse public projects diff --git a/app/views/dashboard/groups/index.html.haml b/app/views/dashboard/groups/index.html.haml deleted file mode 100644 index 0cb7f764fab..00000000000 --- a/app/views/dashboard/groups/index.html.haml +++ /dev/null @@ -1,40 +0,0 @@ -%h3.page-title - Group Membership - - if current_user.can_create_group? - %span.pull-right - = link_to new_group_path, class: "btn btn-new" do - %i.fa.fa-plus - New Group -%p.light - Group members have access to all group projects. -%hr -.panel.panel-default - .panel-heading - %strong Groups - (#{@group_members.count}) - %ul.well-list - - @group_members.each do |group_member| - - group = group_member.group - %li - .pull-right - - if can?(current_user, :admin_group, group) - = link_to edit_group_path(group), class: "btn-sm btn btn-grouped" do - %i.fa.fa-cogs - Settings - - - if can?(current_user, :destroy_group_member, group_member) - = link_to leave_group_group_members_path(group), data: { confirm: leave_group_message(group.name) }, method: :delete, class: "btn-sm btn btn-grouped", title: 'Remove user from group' do - %i.fa.fa-sign-out - Leave - - = image_tag group_icon(group), class: "avatar s40 avatar-tile" - = link_to group, class: 'group-name' do - %strong= group.name - - as - %strong #{group_member.human_access} - - %div.light - #{pluralize(group.projects.count, "project")}, #{pluralize(group.users.count, "user")} - -= paginate @group_members diff --git a/app/views/dashboard/issues.atom.builder b/app/views/dashboard/issues.atom.builder deleted file mode 100644 index 72e9e361dc3..00000000000 --- a/app/views/dashboard/issues.atom.builder +++ /dev/null @@ -1,13 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{current_user.name} issues" - xml.link href: issues_dashboard_url(:atom, private_token: current_user.private_token), rel: "self", type: "application/atom+xml" - xml.link href: issues_dashboard_url(private_token: current_user.private_token), rel: "alternate", type: "text/html" - xml.id issues_dashboard_url(private_token: current_user.private_token) - xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? - - @issues.each do |issue| - issue_to_atom(xml, issue) - end -end - diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml deleted file mode 100644 index db19a46cb26..00000000000 --- a/app/views/dashboard/issues.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%h3.page-title - Issues - -%p.light - List all issues from all projects you have access to. -%hr - -.append-bottom-20 - = render 'shared/issuable_filter' -= render 'shared/issues' diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml deleted file mode 100644 index 97a42461b4e..00000000000 --- a/app/views/dashboard/merge_requests.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%h3.page-title - Merge Requests - - -%p.light - List all merge requests from all projects you have access to. -%hr -.append-bottom-20 - = render 'shared/issuable_filter' -= render 'shared/merge_requests' diff --git a/app/views/dashboard/milestones/_issue.html.haml b/app/views/dashboard/milestones/_issue.html.haml deleted file mode 100644 index f689b9698eb..00000000000 --- a/app/views/dashboard/milestones/_issue.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%li{ id: dom_id(issue, 'sortable'), class: 'issue-row', 'data-iid' => issue.iid } - %span.milestone-row - - project = issue.project - %strong #{project.name_with_namespace} · - = link_to [project.namespace.becomes(Namespace), project, issue] do - %span.cgray ##{issue.iid} - = link_to_gfm issue.title, [project.namespace.becomes(Namespace), project, issue], title: issue.title - .pull-right.assignee-icon - - if issue.assignee - = image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16" diff --git a/app/views/dashboard/milestones/_issues.html.haml b/app/views/dashboard/milestones/_issues.html.haml deleted file mode 100644 index 9f350b772bd..00000000000 --- a/app/views/dashboard/milestones/_issues.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.panel.panel-default - .panel-heading= title - %ul{ class: "well-list issues-sortable-list" } - - if issues - - issues.each do |issue| - = render 'issue', issue: issue diff --git a/app/views/dashboard/milestones/_merge_request.html.haml b/app/views/dashboard/milestones/_merge_request.html.haml deleted file mode 100644 index 8f5c4cce529..00000000000 --- a/app/views/dashboard/milestones/_merge_request.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%li{ id: dom_id(merge_request, 'sortable'), class: 'mr-row', 'data-iid' => merge_request.iid } - %span.milestone-row - - project = merge_request.project - %strong #{project.name_with_namespace} · - = link_to [project.namespace.becomes(Namespace), project, merge_request] do - %span.cgray ##{merge_request.iid} - = link_to_gfm merge_request.title, [project.namespace.becomes(Namespace), project, merge_request], title: merge_request.title - .pull-right.assignee-icon - - if merge_request.assignee - = image_tag avatar_icon(merge_request.assignee.email, 16), class: "avatar s16" diff --git a/app/views/dashboard/milestones/_merge_requests.html.haml b/app/views/dashboard/milestones/_merge_requests.html.haml deleted file mode 100644 index 50057e2c636..00000000000 --- a/app/views/dashboard/milestones/_merge_requests.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.panel.panel-default - .panel-heading= title - %ul{ class: "well-list merge_requests-sortable-list" } - - if merge_requests - - merge_requests.each do |merge_request| - = render 'merge_request', merge_request: merge_request diff --git a/app/views/dashboard/milestones/_milestone.html.haml b/app/views/dashboard/milestones/_milestone.html.haml deleted file mode 100644 index 21e730bb7ff..00000000000 --- a/app/views/dashboard/milestones/_milestone.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -%li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone.milestones.first) } - %h4 - = link_to_gfm truncate(milestone.title, length: 100), dashboard_milestone_path(milestone.safe_title, title: milestone.title) - .row - .col-sm-6 - = link_to dashboard_milestone_path(milestone.safe_title, title: milestone.title) do - = pluralize milestone.issue_count, 'Issue' - - = link_to dashboard_milestone_path(milestone.safe_title, title: milestone.title) do - = pluralize milestone.merge_requests_count, 'Merge Request' - - %span.light #{milestone.percent_complete}% complete - - .col-sm-6 - = milestone_progress_bar(milestone) - %div - - milestone.milestones.each do |milestone| - = link_to milestone_path(milestone) do - %span.label.label-gray - = milestone.project.name_with_namespace diff --git a/app/views/dashboard/milestones/index.html.haml b/app/views/dashboard/milestones/index.html.haml deleted file mode 100644 index 9944c0df815..00000000000 --- a/app/views/dashboard/milestones/index.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -%h3.page-title - Milestones - %span.pull-right #{@dashboard_milestones.count} milestones - -%p.light - List all milestones from all projects you have access to. - -%hr - -= render 'shared/milestones_filter' -.milestones - .panel.panel-default - %ul.well-list - - if @dashboard_milestones.blank? - %li - .nothing-here-block No milestones to show - - else - - @dashboard_milestones.each do |milestone| - = render 'milestone', milestone: milestone - = paginate @dashboard_milestones, theme: "gitlab" diff --git a/app/views/dashboard/milestones/show.html.haml b/app/views/dashboard/milestones/show.html.haml deleted file mode 100644 index 57cce9ab749..00000000000 --- a/app/views/dashboard/milestones/show.html.haml +++ /dev/null @@ -1,81 +0,0 @@ -%h4.page-title - .issue-box{ class: "issue-box-#{@dashboard_milestone.closed? ? 'closed' : 'open'}" } - - if @dashboard_milestone.closed? - Closed - - else - Open - Milestone #{@dashboard_milestone.title} - -%hr -- if (@dashboard_milestone.total_items_count == @dashboard_milestone.closed_items_count) && @dashboard_milestone.active? - .alert.alert-success - %span All issues for this milestone are closed. You may close the milestone now. - -.description -%table.table - %thead - %tr - %th Project - %th Open issues - %th State - %th Due date - - @dashboard_milestone.milestones.each do |milestone| - %tr - %td - = link_to "#{milestone.project.name_with_namespace}", namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone) - %td - = milestone.issues.opened.count - %td - - if milestone.closed? - Closed - - else - Open - %td - = milestone.expires_at - -.context - %p.lead - Progress: - #{@dashboard_milestone.closed_items_count} closed - – - #{@dashboard_milestone.open_items_count} open - = milestone_progress_bar(@dashboard_milestone) - -%ul.nav.nav-tabs - %li.active - = link_to '#tab-issues', 'data-toggle' => 'tab' do - Issues - %span.badge= @dashboard_milestone.issue_count - %li - = link_to '#tab-merge-requests', 'data-toggle' => 'tab' do - Merge Requests - %span.badge= @dashboard_milestone.merge_requests_count - %li - = link_to '#tab-participants', 'data-toggle' => 'tab' do - Participants - %span.badge= @dashboard_milestone.participants.count - -.tab-content - .tab-pane.active#tab-issues - .row - .col-md-6 - = render 'issues', title: "Open", issues: @dashboard_milestone.opened_issues - .col-md-6 - = render 'issues', title: "Closed", issues: @dashboard_milestone.closed_issues - - .tab-pane#tab-merge-requests - .row - .col-md-6 - = render 'merge_requests', title: "Open", merge_requests: @dashboard_milestone.opened_merge_requests - .col-md-6 - = render 'merge_requests', title: "Closed", merge_requests: @dashboard_milestone.closed_merge_requests - - .tab-pane#tab-participants - %ul.bordered-list - - @dashboard_milestone.participants.each do |user| - %li - = link_to user, title: user.name, class: "darken" do - = image_tag avatar_icon(user.email, 32), class: "avatar s32" - %strong= truncate(user.name, lenght: 40) - %br - %small.cgray= user.username diff --git a/app/views/dashboard/projects/starred.html.haml b/app/views/dashboard/projects/starred.html.haml deleted file mode 100644 index f4ad2b294b3..00000000000 --- a/app/views/dashboard/projects/starred.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- if @projects.any? - .dashboard.row - %section.activities.col-md-8 - = render 'dashboard/activities' - %aside.col-md-4 - .panel.panel-default - .panel-heading.clearfix - .input-group - = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control' - - if current_user.can_create_project? - %span.input-group-btn - = link_to new_project_path, class: 'btn btn-success' do - New project - - = render 'shared/projects_list', projects: @projects, - projects_limit: 20, stars: true, avatar: false - - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left - -- else - %h3 You don't have starred projects yet - %p.slead Visit project page and press on star icon and it will appear on this page. diff --git a/app/views/dashboard/show.atom.builder b/app/views/dashboard/show.atom.builder deleted file mode 100644 index da631ecb33e..00000000000 --- a/app/views/dashboard/show.atom.builder +++ /dev/null @@ -1,12 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "Dashboard feed#{" - #{current_user.name}" if current_user.name.present?}" - xml.link href: dashboard_url(:atom), rel: "self", type: "application/atom+xml" - xml.link href: dashboard_url, rel: "alternate", type: "text/html" - xml.id projects_url - xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? - - @events.each do |event| - event_to_atom(xml, event) - end -end diff --git a/app/views/dashboard/show.html.haml b/app/views/dashboard/show.html.haml deleted file mode 100644 index fa8946011b7..00000000000 --- a/app/views/dashboard/show.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -- if @projects.any? - .dashboard.row - %section.activities.col-md-8 - = render 'activities' - %aside.col-md-4 - = render 'sidebar' - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left - -- else - = render "zero_authorized_projects" diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml deleted file mode 100644 index 970ba147111..00000000000 --- a/app/views/devise/confirmations/new.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.login-box - .login-heading - %h3 Resend confirmation instructions - .login-body - = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| - .devise-errors - = devise_error_messages! - .clearfix.append-bottom-20 - = f.email_field :email, placeholder: 'Email', class: "form-control", required: true - .clearfix - = f.submit "Resend confirmation instructions", class: 'btn btn-success' - -.clearfix.prepend-top-20 - = render 'devise/shared/sign_in_link' diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb deleted file mode 100644 index c6fa8f0ee36..00000000000 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<p>Welcome <%= @resource.name %>!</p> - -<% if @resource.unconfirmed_email.present? %> - <p>You can confirm your email (<%= @resource.unconfirmed_email %>) through the link below:</p> -<% else %> - <p>You can confirm your account through the link below:</p> -<% end %> - -<p><%= link_to 'Confirm your account', confirmation_url(@resource, confirmation_token: @token) %></p> diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb deleted file mode 100644 index 23b31da92d8..00000000000 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<p>Hello <%= @resource.email %>!</p> - -<p>Someone has requested a link to change your password, and you can do this through the link below.</p> - -<p><%= link_to 'Change your password', edit_password_url(@resource, reset_password_token: @token) %></p> - -<p>If you didn't request this, please ignore this email.</p> -<p>Your password won't change until you access the link above and create a new one.</p> diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb deleted file mode 100644 index 79d6c761d8f..00000000000 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<p>Hello <%= @resource.email %>!</p> - -<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p> - -<p>Click the link below to unlock your account:</p> - -<p><%= link_to 'Unlock your account', unlock_url(@resource, unlock_token: @token) %></p> diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml deleted file mode 100644 index 56048e99c17..00000000000 --- a/app/views/devise/passwords/edit.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -.login-box - .login-heading - %h3 Change your password - .login-body - = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| - .devise-errors - = devise_error_messages! - = f.hidden_field :reset_password_token - %div - = f.password_field :password, class: "form-control top", placeholder: "New password", required: true - %div - = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true - .clearfix - = f.submit "Change your password", class: "btn btn-primary" - -.clearfix.prepend-top-20 - %p - = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) - = render 'devise/shared/sign_in_link' diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml deleted file mode 100644 index e8820daf58f..00000000000 --- a/app/views/devise/passwords/new.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.login-box - .login-heading - %h3 Reset password - .login-body - = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| - .devise-errors - = devise_error_messages! - .clearfix.append-bottom-20 - = f.email_field :email, placeholder: "Email", class: "form-control", required: true - .clearfix - = f.submit "Reset password", class: "btn-primary btn" - -.clearfix.prepend-top-20 - = render 'devise/shared/sign_in_link' diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb deleted file mode 100644 index f379e71ae5b..00000000000 --- a/app/views/devise/registrations/edit.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -<h2>Edit <%= resource_name.to_s.humanize %></h2> - -<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> - - <div><%= f.label :email %><br /> - <%= f.email_field :email %></div> - - <div><%= f.label :name %><br /> - <%= f.text_field :name %></div> - - <div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br /> - <%= f.password_field :password %></div> - - <div><%= f.label :password_confirmation %><br /> - <%= f.password_field :password_confirmation %></div> - - <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br /> - <%= f.password_field :current_password %></div> - -<div><%= f.submit "Update", class: "input_button" %></div> -<% end %> - -<h3>Cancel your account</h3> - -<p>Unhappy? <%= link_to "Cancel your account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>.</p> - -<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml deleted file mode 100644 index d3e37f7494c..00000000000 --- a/app/views/devise/registrations/new.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= render 'devise/shared/signup_box' - -= render 'devise/shared/sign_in_link'
\ No newline at end of file diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml deleted file mode 100644 index 54a39726771..00000000000 --- a/app/views/devise/sessions/_new_base.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| - = f.text_field :login, class: "form-control top", placeholder: "Username or Email", autofocus: "autofocus" - = f.password_field :password, class: "form-control bottom", placeholder: "Password" - - if devise_mapping.rememberable? - .remember-me.checkbox - %label{for: "user_remember_me"} - = f.check_box :remember_me - %span Remember me - .pull-right - = link_to "Forgot your password?", new_password_path(resource_name) - %div - = f.submit "Sign in", class: "btn btn-save" diff --git a/app/views/devise/sessions/_new_ldap.html.haml b/app/views/devise/sessions/_new_ldap.html.haml deleted file mode 100644 index 812e22373a7..00000000000 --- a/app/views/devise/sessions/_new_ldap.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -= form_tag(user_omniauth_callback_path(server['provider_name']), id: 'new_ldap_user' ) do - = text_field_tag :username, nil, {class: "form-control top", placeholder: "#{server['label']} Login", autofocus: "autofocus"} - = password_field_tag :password, nil, {class: "form-control bottom", placeholder: "Password"} - = button_tag "#{server['label']} Sign in", class: "btn-save btn" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml deleted file mode 100644 index 89e4e229ac0..00000000000 --- a/app/views/devise/sessions/new.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -%div - - if signin_enabled? || ldap_enabled? - = render 'devise/shared/signin_box' - - -# Omniauth fits between signin/ldap signin and signup and does not have a surrounding box - - if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable? - .clearfix.prepend-top-20 - = render 'devise/shared/omniauth_box' - - -# Signup only makes sense if you can also sign-in - - if signin_enabled? && signup_enabled? - .prepend-top-20 - = render 'devise/shared/signup_box' - - -# Show a message if none of the mechanisms above are enabled - - if !signin_enabled? && !ldap_enabled? && !(Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?) - %div - No authentication methods configured. diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb deleted file mode 100644 index 49e99e25c1d..00000000000 --- a/app/views/devise/shared/_links.erb +++ /dev/null @@ -1,19 +0,0 @@ -<%- if controller_name != 'sessions' %> - <%= link_to "Sign in", new_session_path(resource_name), class: "btn" %><br /> -<% end -%> - -<%- if devise_mapping.registerable? && controller_name != 'registrations' && gitlab_config.signup_enabled %> - <%= link_to "Sign up", new_registration_path(resource_name) %><br /> -<% end -%> - -<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> -<%= link_to "Forgot your password?", new_password_path(resource_name), class: "btn" %><br /> -<% end -%> - -<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> - <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br /> -<% end -%> - -<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> - <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br /> -<% end -%> diff --git a/app/views/devise/shared/_omniauth_box.html.haml b/app/views/devise/shared/_omniauth_box.html.haml deleted file mode 100644 index b647b906b71..00000000000 --- a/app/views/devise/shared/_omniauth_box.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%p - %span.light - Sign in with - - providers = additional_providers - - providers.each do |provider| - %span.light - - if default_providers.include?(provider) - = link_to oauth_image_tag(provider), omniauth_authorize_path(resource_name, provider), class: 'oauth-image-link' - - else - = link_to provider.to_s.titleize, omniauth_authorize_path(resource_name, provider), class: "btn" diff --git a/app/views/devise/shared/_sign_in_link.html.haml b/app/views/devise/shared/_sign_in_link.html.haml deleted file mode 100644 index fafc4b82f53..00000000000 --- a/app/views/devise/shared/_sign_in_link.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%p - %span.light - Already have login and password? - %strong - = link_to "Sign in", new_session_path(resource_name) diff --git a/app/views/devise/shared/_signin_box.html.haml b/app/views/devise/shared/_signin_box.html.haml deleted file mode 100644 index c76574db457..00000000000 --- a/app/views/devise/shared/_signin_box.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -.login-box - - if signup_enabled? - .login-heading - %h3 Existing user? Sign in - - else - .login-heading - %h3 Sign in - .login-body - - if ldap_enabled? - %ul.nav.nav-tabs - - @ldap_servers.each_with_index do |server, i| - %li{class: (:active if i.zero?)} - = link_to server['label'], "#tab-#{server['provider_name']}", 'data-toggle' => 'tab' - - if signin_enabled? - %li - = link_to 'Standard', '#tab-signin', 'data-toggle' => 'tab' - .tab-content - - @ldap_servers.each_with_index do |server, i| - %div.tab-pane{id: "tab-#{server['provider_name']}", class: (:active if i.zero?)} - = render 'devise/sessions/new_ldap', server: server - - if signin_enabled? - %div#tab-signin.tab-pane - = render 'devise/sessions/new_base' - - - elsif signin_enabled? - = render 'devise/sessions/new_base' diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml deleted file mode 100644 index 9dc6aeffd59..00000000000 --- a/app/views/devise/shared/_signup_box.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -.login-box - - if signin_enabled? - .login-heading - %h3 New user? Create an account - - else - .login-heading - %h3 Create an account - .login-body - = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| - .devise-errors - = devise_error_messages! - %div - = f.text_field :name, class: "form-control top", placeholder: "Name", required: true - %div - = f.text_field :username, class: "form-control middle", placeholder: "Username", required: true - %div - = f.email_field :email, class: "form-control middle", placeholder: "Email", required: true - .form-group.append-bottom-20#password-strength - = f.password_field :password, class: "form-control bottom", id: "user_password_sign_up", placeholder: "Password", required: true - %div - = f.submit "Sign up", class: "btn-create btn" - -.clearfix.prepend-top-20 - %p - %span.light Didn't receive a confirmation email? - = succeed '.' do - = link_to "Request a new one", new_confirmation_path(resource_name) diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb deleted file mode 100644 index f9277d1673f..00000000000 --- a/app/views/devise/unlocks/new.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<h2>Resend unlock instructions</h2> - -<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - - <div><%= f.label :email %><br /> - <%= f.email_field :email %></div> - - <div><%= f.submit "Resend unlock instructions" %></div> -<% end %> - -<%= render partial: "devise/shared/links" %> diff --git a/app/views/doorkeeper/applications/_delete_form.html.haml b/app/views/doorkeeper/applications/_delete_form.html.haml deleted file mode 100644 index 6a5c917049d..00000000000 --- a/app/views/doorkeeper/applications/_delete_form.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- submit_btn_css ||= 'btn btn-link btn-remove btn-sm' -= form_tag oauth_application_path(application) do - %input{:name => "_method", :type => "hidden", :value => "delete"}/ - = submit_tag 'Destroy', onclick: "return confirm('Are you sure?')", class: submit_btn_css
\ No newline at end of file diff --git a/app/views/doorkeeper/applications/_form.html.haml b/app/views/doorkeeper/applications/_form.html.haml deleted file mode 100644 index a5fec2fabdb..00000000000 --- a/app/views/doorkeeper/applications/_form.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -= form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f| - - if application.errors.any? - .alert.alert-danger{"data-alert" => ""} - %p Whoops! Check your form for possible errors - = content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do - = f.label :name, class: 'col-sm-2 control-label' - .col-sm-10 - = f.text_field :name, class: 'form-control' - = doorkeeper_errors_for application, :name - = content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do - = f.label :redirect_uri, class: 'col-sm-2 control-label' - .col-sm-10 - = f.text_area :redirect_uri, class: 'form-control' - = doorkeeper_errors_for application, :redirect_uri - %span.help-block - Use one line per URI - - if Doorkeeper.configuration.native_redirect_uri - %span.help-block - Use - %code= Doorkeeper.configuration.native_redirect_uri - for local tests - .form-actions - = f.submit 'Submit', class: "btn btn-primary wide" - = link_to "Cancel", applications_profile_path, class: "btn btn-default" diff --git a/app/views/doorkeeper/applications/edit.html.haml b/app/views/doorkeeper/applications/edit.html.haml deleted file mode 100644 index 61584eb9c49..00000000000 --- a/app/views/doorkeeper/applications/edit.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h3.page-title Edit application -= render 'form', application: @application
\ No newline at end of file diff --git a/app/views/doorkeeper/applications/index.html.haml b/app/views/doorkeeper/applications/index.html.haml deleted file mode 100644 index e5be4b4bcac..00000000000 --- a/app/views/doorkeeper/applications/index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3.page-title Your applications -%p= link_to 'New Application', new_oauth_application_path, class: 'btn btn-success' -%table.table.table-striped - %thead - %tr - %th Name - %th Callback URL - %th - %th - %tbody - - @applications.each do |application| - %tr{:id => "application_#{application.id}"} - %td= link_to application.name, oauth_application_path(application) - %td= application.redirect_uri - %td= link_to 'Edit', edit_oauth_application_path(application), class: 'btn btn-link' - %td= render 'delete_form', application: application
\ No newline at end of file diff --git a/app/views/doorkeeper/applications/new.html.haml b/app/views/doorkeeper/applications/new.html.haml deleted file mode 100644 index 655845e4af5..00000000000 --- a/app/views/doorkeeper/applications/new.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h3.page-title New application -= render 'form', application: @application
\ No newline at end of file diff --git a/app/views/doorkeeper/applications/show.html.haml b/app/views/doorkeeper/applications/show.html.haml deleted file mode 100644 index 82e78b4af13..00000000000 --- a/app/views/doorkeeper/applications/show.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -%h3.page-title - Application: #{@application.name} - - -%table.table - %tr - %td - Application Id - %td - %code#application_id= @application.uid - %tr - %td - Secret: - %td - %code#secret= @application.secret - - %tr - %td - Callback url - %td - - @application.redirect_uri.split.each do |uri| - %div - %span.monospace= uri -.form-actions - = link_to 'Edit', edit_oauth_application_path(@application), class: 'btn btn-primary wide pull-left' - = render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger prepend-left-10' diff --git a/app/views/doorkeeper/authorizations/error.html.haml b/app/views/doorkeeper/authorizations/error.html.haml deleted file mode 100644 index 7561ec85ed9..00000000000 --- a/app/views/doorkeeper/authorizations/error.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h3.page-title An error has occurred -%main{:role => "main"} - %pre= @pre_auth.error_response.body[:error_description]
\ No newline at end of file diff --git a/app/views/doorkeeper/authorizations/new.html.haml b/app/views/doorkeeper/authorizations/new.html.haml deleted file mode 100644 index 15f9ee266c1..00000000000 --- a/app/views/doorkeeper/authorizations/new.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -%h3.page-title Authorize required -%main{:role => "main"} - %p.h4 - Authorize - %strong.text-info= @pre_auth.client.name - to use your account? - - if @pre_auth.scopes - #oauth-permissions - %p This application will be able to: - %ul.text-info - - @pre_auth.scopes.each do |scope| - %li= t scope, scope: [:doorkeeper, :scopes] - %hr/ - .actions - = form_tag oauth_authorization_path, method: :post do - = hidden_field_tag :client_id, @pre_auth.client.uid - = hidden_field_tag :redirect_uri, @pre_auth.redirect_uri - = hidden_field_tag :state, @pre_auth.state - = hidden_field_tag :response_type, @pre_auth.response_type - = hidden_field_tag :scope, @pre_auth.scope - = submit_tag "Authorize", class: "btn btn-success wide pull-left" - = form_tag oauth_authorization_path, method: :delete do - = hidden_field_tag :client_id, @pre_auth.client.uid - = hidden_field_tag :redirect_uri, @pre_auth.redirect_uri - = hidden_field_tag :state, @pre_auth.state - = hidden_field_tag :response_type, @pre_auth.response_type - = hidden_field_tag :scope, @pre_auth.scope - = submit_tag "Deny", class: "btn btn-danger prepend-left-10"
\ No newline at end of file diff --git a/app/views/doorkeeper/authorizations/show.html.haml b/app/views/doorkeeper/authorizations/show.html.haml deleted file mode 100644 index 9a402007194..00000000000 --- a/app/views/doorkeeper/authorizations/show.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h3.page-title Authorization code: -%main{:role => "main"} - %code#authorization_code= params[:code]
\ No newline at end of file diff --git a/app/views/doorkeeper/authorized_applications/_delete_form.html.haml b/app/views/doorkeeper/authorized_applications/_delete_form.html.haml deleted file mode 100644 index 4bba72167e3..00000000000 --- a/app/views/doorkeeper/authorized_applications/_delete_form.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- submit_btn_css ||= 'btn btn-link btn-remove' -= form_tag oauth_authorized_application_path(application) do - %input{:name => "_method", :type => "hidden", :value => "delete"}/ - = submit_tag 'Revoke', onclick: "return confirm('Are you sure?')", class: 'btn btn-link btn-remove btn-sm'
\ No newline at end of file diff --git a/app/views/doorkeeper/authorized_applications/index.html.haml b/app/views/doorkeeper/authorized_applications/index.html.haml deleted file mode 100644 index 814cdc987ef..00000000000 --- a/app/views/doorkeeper/authorized_applications/index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%header.page-header - %h1 Your authorized applications -%main{:role => "main"} - %table.table.table-striped - %thead - %tr - %th Application - %th Created At - %th - %th - %tbody - - @applications.each do |application| - %tr - %td= application.name - %td= application.created_at.strftime('%Y-%m-%d %H:%M:%S') - %td= render 'delete_form', application: application
\ No newline at end of file diff --git a/app/views/errors/access_denied.html.haml b/app/views/errors/access_denied.html.haml deleted file mode 100644 index a1d8664c4ce..00000000000 --- a/app/views/errors/access_denied.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%h1 403 -%h3 Access Denied -%hr -%p You are not allowed to access this page. -%p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "vlink"} diff --git a/app/views/errors/encoding.html.haml b/app/views/errors/encoding.html.haml deleted file mode 100644 index 64c7451a8da..00000000000 --- a/app/views/errors/encoding.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h1 500 -%h3 Encoding Error -%hr -%p Page can't be loaded because of an encoding error. diff --git a/app/views/errors/git_not_found.html.haml b/app/views/errors/git_not_found.html.haml deleted file mode 100644 index 189e53bca55..00000000000 --- a/app/views/errors/git_not_found.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h1 404 -%h3 Git Resource Not found -%hr -%p - Application can't get access to some branch or commit in your repository. It - may have been moved. diff --git a/app/views/errors/not_found.html.haml b/app/views/errors/not_found.html.haml deleted file mode 100644 index 7bf88f592cf..00000000000 --- a/app/views/errors/not_found.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h1 404 -%h3 The resource you were looking for doesn't exist. -%hr -%p You may have mistyped the address or the page may have moved. diff --git a/app/views/errors/omniauth_error.html.haml b/app/views/errors/omniauth_error.html.haml deleted file mode 100644 index f3c8221a9d9..00000000000 --- a/app/views/errors/omniauth_error.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -%h1 422 -%h3 Sign-in using #{@provider} auth failed -%hr -%p Sign-in failed because #{@error}. -%p There are couple of steps you can take: - -%ul - %li Try logging in using your email - %li Try logging in using your username - %li If you have forgotten your password, try recovering it using #{ link_to "Password recovery", new_password_path(resource_name) } - -%p If none of the options work, try contacting the GitLab administrator. diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml deleted file mode 100644 index c86ce9ae651..00000000000 --- a/app/views/events/_commit.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%li.commit - .commit-row-title - = link_to truncate_sha(commit[:id]), namespace_project_commit_path(project.namespace, project, commit[:id]), class: "commit_short_id", alt: '' - - = gfm event_commit_title(commit[:message]), project diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml deleted file mode 100644 index 02b1dec753c..00000000000 --- a/app/views/events/_event.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -- if event.proper? - .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"} - .event-item-timestamp - #{time_ago_with_tooltip(event.created_at)} - - = cache [event, current_user] do - = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:'' - - - if event.push? - = render "events/event/push", event: event - - elsif event.commented? - = render "events/event/note", event: event - - elsif event.created_project? - = render "events/event/created_project", event: event - - else - = render "events/event/common", event: event
\ No newline at end of file diff --git a/app/views/events/_event_issue.atom.haml b/app/views/events/_event_issue.atom.haml deleted file mode 100644 index 0edb61ea246..00000000000 --- a/app/views/events/_event_issue.atom.haml +++ /dev/null @@ -1,3 +0,0 @@ -%div{xmlns: "http://www.w3.org/1999/xhtml"} - - if issue.description.present? - = markdown(issue.description, xhtml: true) diff --git a/app/views/events/_event_last_push.html.haml b/app/views/events/_event_last_push.html.haml deleted file mode 100644 index d2f0005142a..00000000000 --- a/app/views/events/_event_last_push.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -- if show_last_push_widget?(event) - .event-last-push - .event-last-push-text - %span You pushed to - = link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do - %strong= event.ref_name - at - %strong= link_to_project event.project - #{time_ago_with_tooltip(event.created_at)} - - .pull-right - = link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-create btn-sm" do - Create Merge Request - %hr diff --git a/app/views/events/_event_merge_request.atom.haml b/app/views/events/_event_merge_request.atom.haml deleted file mode 100644 index 1a8b62abeab..00000000000 --- a/app/views/events/_event_merge_request.atom.haml +++ /dev/null @@ -1,3 +0,0 @@ -%div{xmlns: "http://www.w3.org/1999/xhtml"} - - if merge_request.description.present? - = markdown(merge_request.description, xhtml: true) diff --git a/app/views/events/_event_note.atom.haml b/app/views/events/_event_note.atom.haml deleted file mode 100644 index b49c331ccf2..00000000000 --- a/app/views/events/_event_note.atom.haml +++ /dev/null @@ -1,2 +0,0 @@ -%div{xmlns: "http://www.w3.org/1999/xhtml"} - = markdown(note.note, xhtml: true) diff --git a/app/views/events/_event_push.atom.haml b/app/views/events/_event_push.atom.haml deleted file mode 100644 index 5d14def8f75..00000000000 --- a/app/views/events/_event_push.atom.haml +++ /dev/null @@ -1,14 +0,0 @@ -%div{xmlns: "http://www.w3.org/1999/xhtml"} - - event.commits.first(15).each do |commit| - %p - %strong= commit[:author][:name] - = link_to "(##{truncate_sha(commit[:id])})", namespace_project_commit_path(event.project.namespace, event.project, id: commit[:id]) - %i - at - = commit[:timestamp].to_time.to_s(:short) - %blockquote= markdown(escape_once(commit[:message]), xhtml: true) - - if event.commits_count > 15 - %p - %i - \... and - = pluralize(event.commits_count - 15, "more commit") diff --git a/app/views/events/_events.html.haml b/app/views/events/_events.html.haml deleted file mode 100644 index 68c19df092d..00000000000 --- a/app/views/events/_events.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render partial: 'events/event', collection: @events diff --git a/app/views/events/event/_common.html.haml b/app/views/events/event/_common.html.haml deleted file mode 100644 index a39e62e9dac..00000000000 --- a/app/views/events/event/_common.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -.event-title - %span.author_name= link_to_author event - %span.event_label{class: event.action_name} - = event_action_name(event) - - - if event.target - %strong= link_to "##{event.target_iid}", [event.project.namespace.becomes(Namespace), event.project, event.target] - at - - - if event.project - = link_to_project event.project - - else - = event.project_name - -- if event.target.respond_to?(:title) - .event-body - .event-note - = event.target.title diff --git a/app/views/events/event/_created_project.html.haml b/app/views/events/event/_created_project.html.haml deleted file mode 100644 index 552525f4a07..00000000000 --- a/app/views/events/event/_created_project.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -.event-title - %span.author_name= link_to_author event - %span.event_label{class: event.action_name} - = event_action_name(event) - - - if event.project - = link_to_project event.project - - else - = event.project_name - -- if current_user == event.author && !event.project.private? && twitter_sharing_enabled? - .event-body - .event-note - .md - %p - Congratulations! Why not share your accomplishment with the world? - - %a.twitter-share-button{ | - href: "https://twitter.com/share", | - "data-url" => event.project.web_url, | - "data-text" => "I just #{event.project.imported? ? "imported" : "created"} a new project in GitLab! GitLab is version control on your server.", | - "data-size" => "medium", | - "data-related" => "gitlab", | - "data-hashtags" => "gitlab", | - "data-count" => "none"} - Tweet - %script{src: "//platform.twitter.com/widgets.js"} diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml deleted file mode 100644 index 4ef18c09060..00000000000 --- a/app/views/events/event/_note.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -.event-title - %span.author_name= link_to_author event - %span.event_label - = event.action_name - = event_note_title_html(event) - at - - - if event.project - = link_to_project event.project - - else - = event.project_name - -.event-body - .event-note - .md - %i.fa.fa-comment-o.event-note-icon - = event_note(event.target.note) - - note = event.target - - if note.attachment.url - - if note.attachment.image? - = link_to note.attachment.url, target: '_blank' do - = image_tag note.attachment.url, class: 'note-image-attach' - - else - = link_to note.attachment.url, target: "_blank", class: 'note-file-attach' do - %i.fa.fa-paperclip - = note.attachment_identifier diff --git a/app/views/events/event/_push.html.haml b/app/views/events/event/_push.html.haml deleted file mode 100644 index 60d7978b13f..00000000000 --- a/app/views/events/event/_push.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -.event-title - %span.author_name= link_to_author event - %span.event_label.pushed #{event.action_name} #{event.ref_type} - - if event.rm_ref? - %strong= event.ref_name - - else - = link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do - %strong= event.ref_name - at - = link_to_project event.project - -- if event.push_with_commits? - - project = event.project - .event-body - %ul.well-list.event_commits - - few_commits = event.commits[0...2] - - few_commits.each do |commit| - = render "events/commit", commit: commit, project: project - - - if event.commits_count > 1 - %li.commits-stat - - if event.commits_count > 2 - %span ... and #{event.commits_count - 2} more commits. - - if event.md_ref? - - from = event.commit_from - - from_label = truncate_sha(from) - - else - - from = event.project.default_branch - - from_label = from - = link_to namespace_project_compare_path(event.project.namespace, event.project, from: from, to: event.commit_to) do - %strong Compare → #{from_label}...#{truncate_sha(event.commit_to)} diff --git a/app/views/explore/groups/index.html.haml b/app/views/explore/groups/index.html.haml deleted file mode 100644 index 2ea6cb18655..00000000000 --- a/app/views/explore/groups/index.html.haml +++ /dev/null @@ -1,50 +0,0 @@ -.clearfix - .pull-left - = form_tag explore_groups_path, method: :get, class: 'form-inline form-tiny' do |f| - = hidden_field_tag :sort, @sort - .form-group - = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input input-mn-300", id: "groups_search" - .form-group - = button_tag 'Search', class: "btn btn-primary wide" - - .pull-right - .dropdown.inline - %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'} - %span.light sort: - - if @sort.present? - = sort_options_hash[@sort] - - else - = sort_title_recently_created - %b.caret - %ul.dropdown-menu - %li - = link_to explore_groups_path(sort: sort_value_recently_created) do - = sort_title_recently_created - = link_to explore_groups_path(sort: sort_value_oldest_created) do - = sort_title_oldest_created - = link_to explore_groups_path(sort: sort_value_recently_updated) do - = sort_title_recently_updated - = link_to explore_groups_path(sort: sort_value_oldest_updated) do - = sort_title_oldest_updated - -%hr - -%ul.bordered-list - - @groups.each do |group| - %li - .clearfix - %h4 - = link_to group_path(id: group.path) do - %i.fa.fa-users - = group.name - .clearfix - %p - = truncate group.description, length: 150 - .clearfix - %p.light - #{pluralize(group.members.size, 'member')}, #{pluralize(group.projects.count, 'project')} - - unless @groups.present? - .nothing-here-block No public groups - - -= paginate @groups, theme: "gitlab" diff --git a/app/views/explore/projects/_filter.html.haml b/app/views/explore/projects/_filter.html.haml deleted file mode 100644 index b3963a9d901..00000000000 --- a/app/views/explore/projects/_filter.html.haml +++ /dev/null @@ -1,67 +0,0 @@ -.pull-left - = form_tag explore_projects_filter_path, method: :get, class: 'form-inline form-tiny' do |f| - .form-group - = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input input-mn-300", id: "projects_search" - .form-group - = button_tag 'Search', class: "btn btn-primary wide" - -.pull-right.hidden-sm.hidden-xs - - if current_user - .dropdown.inline.append-right-10 - %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} - %i.fa.fa-globe - %span.light Visibility: - - if params[:visibility_level].present? - = visibility_level_label(params[:visibility_level].to_i) - - else - Any - %b.caret - %ul.dropdown-menu - %li - = link_to explore_projects_filter_path(visibility_level: nil) do - Any - - Gitlab::VisibilityLevel.values.each do |level| - %li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' } - = link_to explore_projects_filter_path(visibility_level: level) do - = visibility_level_icon(level) - = visibility_level_label(level) - - - if @tags.present? - .dropdown.inline.append-right-10 - %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} - %i.fa.fa-tags - %span.light Tags: - - if params[:tag].present? - = params[:tag] - - else - Any - %b.caret - %ul.dropdown-menu - %li - = link_to explore_projects_filter_path(tag: nil) do - Any - - - @tags.each do |tag| - %li{ class: (tag.name == params[:tag]) ? 'active' : 'light' } - = link_to explore_projects_filter_path(tag: tag.name) do - %i.fa.fa-tag - = tag.name - - .dropdown.inline - %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'} - %span.light sort: - - if @sort.present? - = sort_options_hash[@sort] - - else - = sort_title_recently_created - %b.caret - %ul.dropdown-menu - %li - = link_to explore_projects_filter_path(sort: sort_value_recently_created) do - = sort_title_recently_created - = link_to explore_projects_filter_path(sort: sort_value_oldest_created) do - = sort_title_oldest_created - = link_to explore_projects_filter_path(sort: sort_value_recently_updated) do - = sort_title_recently_updated - = link_to explore_projects_filter_path(sort: sort_value_oldest_updated) do - = sort_title_oldest_updated diff --git a/app/views/explore/projects/_project.html.haml b/app/views/explore/projects/_project.html.haml deleted file mode 100644 index d65fb529373..00000000000 --- a/app/views/explore/projects/_project.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -%li - %h4.project-title - .project-access-icon - = visibility_level_icon(project.visibility_level) - = link_to project.name_with_namespace, [project.namespace.becomes(Namespace), project] - %span.pull-right - %i.fa.fa-star - = project.star_count - - .project-info - - if project.description.present? - %p.project-description.str-truncated - = project.description - - .repo-info - - unless project.empty_repo? - = link_to pluralize(project.repository.round_commit_count, 'commit'), namespace_project_commits_path(project.namespace, project, project.default_branch) - · - = link_to pluralize(project.repository.branch_names.count, 'branch'), namespace_project_branches_path(project.namespace, project) - · - = link_to pluralize(project.repository.tag_names.count, 'tag'), namespace_project_tags_path(project.namespace, project) - - else - %i.fa.fa-exclamation-triangle - Empty repository diff --git a/app/views/explore/projects/index.html.haml b/app/views/explore/projects/index.html.haml deleted file mode 100644 index 5086b58cd03..00000000000 --- a/app/views/explore/projects/index.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.clearfix - = render 'filter' - -%hr -.public-projects - %ul.bordered-list.top-list - = render @projects - - unless @projects.present? - .nothing-here-block No public projects - - = paginate @projects, theme: "gitlab" diff --git a/app/views/explore/projects/starred.html.haml b/app/views/explore/projects/starred.html.haml deleted file mode 100644 index 420f0693756..00000000000 --- a/app/views/explore/projects/starred.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -.explore-trending-block - %p.lead - %i.fa.fa-star - See most starred projects - %hr - .public-projects - %ul.bordered-list - = render @starred_projects - - = paginate @starred_projects, theme: 'gitlab' diff --git a/app/views/explore/projects/trending.html.haml b/app/views/explore/projects/trending.html.haml deleted file mode 100644 index 9cad9238933..00000000000 --- a/app/views/explore/projects/trending.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.explore-trending-block - %p.lead - %i.fa.fa-comments-o - See most discussed projects for last month - %hr - .public-projects - %ul.bordered-list - = render @trending_projects - - .center - = link_to 'Show all projects', explore_projects_path, class: 'btn btn-primary' diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml deleted file mode 100644 index 4f8aec1c67e..00000000000 --- a/app/views/groups/_projects.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - .input-group - = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control' - - if can? current_user, :create_projects, @group - %span.input-group-btn - = link_to new_project_path(namespace_id: @group.id), class: 'btn btn-success' do - New project - - = render 'shared/projects_list', projects: @projects, projects_limit: 20 diff --git a/app/views/groups/_settings_nav.html.haml b/app/views/groups/_settings_nav.html.haml deleted file mode 100644 index e6aee22e529..00000000000 --- a/app/views/groups/_settings_nav.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%ul.sidebar-subnav - = nav_link(path: 'groups#edit') do - = link_to edit_group_path(@group), title: 'Group' do - %i.fa.fa-pencil-square-o - %span - Group - = nav_link(path: 'groups#projects') do - = link_to projects_group_path(@group), title: 'Projects' do - %i.fa.fa-folder - %span - Projects diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml deleted file mode 100644 index 49e7180bf98..00000000000 --- a/app/views/groups/edit.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -.panel.panel-default - .panel-heading - %strong= @group.name - group settings: - .panel-body - = form_for @group, html: { multipart: true, class: "form-horizontal" }, authenticity_token: true do |f| - - if @group.errors.any? - .alert.alert-danger - %span= @group.errors.full_messages.first - = render 'shared/group_form', f: f - - .form-group - .col-sm-2 - .col-sm-10 - = image_tag group_icon(@group), alt: '', class: 'avatar group-avatar s160' - %p.light - - if @group.avatar? - You can change your group avatar here - - else - You can upload a group avatar here - = render 'shared/choose_group_avatar_button', f: f - - if @group.avatar? - %hr - = link_to 'Remove avatar', group_avatar_path(@group.to_param), data: { confirm: "Group avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-sm remove-avatar" - - .form-actions - = f.submit 'Save group', class: "btn btn-save" - -.panel.panel-danger - .panel-heading Remove group - .panel-body - %p - Removing group will cause all child projects and resources to be removed. - %br - %strong Removed group can not be restored! - - = link_to 'Remove Group', @group, data: {confirm: 'Removed group can not be restored! Are you sure?'}, method: :delete, class: "btn btn-remove" diff --git a/app/views/groups/group_members/_group_member.html.haml b/app/views/groups/group_members/_group_member.html.haml deleted file mode 100644 index 56b1948a474..00000000000 --- a/app/views/groups/group_members/_group_member.html.haml +++ /dev/null @@ -1,54 +0,0 @@ -- user = member.user -- return unless user || member.invite? -- show_roles = true if show_roles.nil? - -%li{class: "#{dom_class(member)} js-toggle-container", id: dom_id(member)} - %span{class: ("list-item-name" if show_controls)} - - if member.user - = image_tag avatar_icon(user.email, 16), class: "avatar s16", alt: '' - %strong= user.name - %span.cgray= user.username - - if user == current_user - %span.label.label-success It's you - - if user.blocked? - %label.label.label-danger - %strong Blocked - - else - = image_tag avatar_icon(member.invite_email, 16), class: "avatar s16", alt: '' - %strong - = member.invite_email - %span.cgray - invited - - if member.created_by - by - = link_to member.created_by.name, user_path(member.created_by) - = time_ago_with_tooltip(member.created_at) - - - if show_controls && can?(current_user, :admin_group, @group) - = link_to resend_invite_group_group_member_path(@group, member), method: :post, class: "btn-xs btn", title: 'Resend invite' do - Resend invite - - - if show_roles - %span.pull-right - %strong= member.human_access - - if show_controls - - if can?(current_user, :modify_group_member, member) - = button_tag class: "btn-xs btn js-toggle-button", - title: 'Edit access level', type: 'button' do - %i.fa.fa-pencil-square-o - - if can?(current_user, :destroy_group_member, member) - - - if current_user == user - = link_to leave_group_group_members_path(@group), data: { confirm: leave_group_message(@group.name)}, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove user from group' do - %i.fa.fa-minus.fa-inverse - - else - = link_to group_group_member_path(@group, member), data: { confirm: remove_user_from_group_message(@group, member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do - %i.fa.fa-minus.fa-inverse - - .edit-member.hide.js-toggle-content - %br - = form_for [@group, member], remote: true do |f| - .prepend-top-10 - = f.select :access_level, options_for_select(GroupMember.access_level_roles, member.access_level), {}, class: 'form-control' - .prepend-top-10 - = f.submit 'Save', class: 'btn btn-save btn-sm' diff --git a/app/views/groups/group_members/_new_group_member.html.haml b/app/views/groups/group_members/_new_group_member.html.haml deleted file mode 100644 index 3361d7e2a8d..00000000000 --- a/app/views/groups/group_members/_new_group_member.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -= form_for @group_member, url: group_group_members_path(@group), html: { class: 'form-horizontal users-group-form' } do |f| - .form-group - = f.label :user_ids, "People", class: 'control-label' - .col-sm-10 - = users_select_tag(:user_ids, multiple: true, class: 'input-large', scope: :all, email_user: true) - .help-block - Search for existing users or invite new ones using their email address. - - .form-group - = f.label :access_level, "Group Access", class: 'control-label' - .col-sm-10 - = select_tag :access_level, options_for_select(GroupMember.access_level_roles, @group_member.access_level), class: "project-access-select select2" - .help-block - Read more about role permissions - %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink" - - .form-actions - = f.submit 'Add users to group', class: "btn btn-create" diff --git a/app/views/groups/group_members/index.html.haml b/app/views/groups/group_members/index.html.haml deleted file mode 100644 index c0c9cd170ad..00000000000 --- a/app/views/groups/group_members/index.html.haml +++ /dev/null @@ -1,43 +0,0 @@ -- show_roles = should_user_see_group_roles?(current_user, @group) - -%h3.page-title - Group members -- if show_roles - %p.light - Members of group have access to all group projects. - Read more about permissions - %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink" - -%hr - -.clearfix.js-toggle-container - = form_tag group_group_members_path(@group), method: :get, class: 'form-inline member-search-form' do - .form-group - = search_field_tag :search, params[:search], { placeholder: 'Find existing member by name', class: 'form-control search-text-input input-mn-300' } - = button_tag 'Search', class: 'btn' - - - if current_user && current_user.can?(:admin_group, @group) - .pull-right - = button_tag class: 'btn btn-new js-toggle-button', type: 'button' do - Add members - %i.fa.fa-chevron-down - - .js-toggle-content.hide.new-group-member-holder - = render "new_group_member" - -.panel.panel-default.prepend-top-20 - .panel-heading - %strong #{@group.name} - group members - %small - (#{@members.total_count}) - %ul.well-list - - @members.each do |member| - = render 'groups/group_members/group_member', member: member, show_roles: show_roles, show_controls: true - -= paginate @members, theme: 'gitlab' - -:coffeescript - $('form.member-search-form').on 'submit', (event) -> - event.preventDefault() - Turbolinks.visit @.action + '?' + $(@).serialize() diff --git a/app/views/groups/group_members/update.js.haml b/app/views/groups/group_members/update.js.haml deleted file mode 100644 index 5bad48abafd..00000000000 --- a/app/views/groups/group_members/update.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -:plain - $("##{dom_id(@member)}").replaceWith('#{escape_javascript(render(@member, member: @member, show_controls: true))}'); diff --git a/app/views/groups/issues.atom.builder b/app/views/groups/issues.atom.builder deleted file mode 100644 index 240001967f3..00000000000 --- a/app/views/groups/issues.atom.builder +++ /dev/null @@ -1,13 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{@user.name} issues" - xml.link :href => issues_dashboard_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml" - xml.link :href => issues_dashboard_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html" - xml.id issues_dashboard_url(:private_token => @user.private_token) - xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? - - @issues.each do |issue| - issue_to_atom(xml, issue) - end -end - diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml deleted file mode 100644 index 6c0d89c4e7c..00000000000 --- a/app/views/groups/issues.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h3.page-title - Issues - -%p.light - Only issues from - %strong #{@group.name} - group are listed here. - - if current_user - To see all issues you should visit #{link_to 'dashboard', issues_dashboard_path} page. -%hr - -.append-bottom-20 - = render 'shared/issuable_filter' -= render 'shared/issues' diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml deleted file mode 100644 index 1ad74905636..00000000000 --- a/app/views/groups/merge_requests.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%h3.page-title - Merge Requests - -%p.light - Only merge requests from - %strong #{@group.name} - group are listed here. - - if current_user - To see all merge requests you should visit #{link_to 'dashboard', merge_requests_dashboard_path} page. -%hr -.append-bottom-20 - = render 'shared/issuable_filter' -= render 'shared/merge_requests' diff --git a/app/views/groups/milestones/_issue.html.haml b/app/views/groups/milestones/_issue.html.haml deleted file mode 100644 index 09f9b4b8969..00000000000 --- a/app/views/groups/milestones/_issue.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%li{ id: dom_id(issue, 'sortable'), class: 'issue-row', 'data-iid' => issue.iid } - %span.milestone-row - - project = issue.project - %strong #{project.name} · - = link_to [project.namespace.becomes(Namespace), project, issue] do - %span.cgray ##{issue.iid} - = link_to_gfm issue.title, [project.namespace.becomes(Namespace), project, issue], title: issue.title - .pull-right.assignee-icon - - if issue.assignee - = image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16", alt: '' diff --git a/app/views/groups/milestones/_issues.html.haml b/app/views/groups/milestones/_issues.html.haml deleted file mode 100644 index 9f350b772bd..00000000000 --- a/app/views/groups/milestones/_issues.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.panel.panel-default - .panel-heading= title - %ul{ class: "well-list issues-sortable-list" } - - if issues - - issues.each do |issue| - = render 'issue', issue: issue diff --git a/app/views/groups/milestones/_merge_request.html.haml b/app/views/groups/milestones/_merge_request.html.haml deleted file mode 100644 index d0d1426762b..00000000000 --- a/app/views/groups/milestones/_merge_request.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%li{ id: dom_id(merge_request, 'sortable'), class: 'mr-row', 'data-iid' => merge_request.iid } - %span.milestone-row - - project = merge_request.project - %strong #{project.name} · - = link_to [project.namespace.becomes(Namespace), project, merge_request] do - %span.cgray ##{merge_request.iid} - = link_to_gfm merge_request.title, [project.namespace.becomes(Namespace), project, merge_request], title: merge_request.title - .pull-right.assignee-icon - - if merge_request.assignee - = image_tag avatar_icon(merge_request.assignee.email, 16), class: "avatar s16", alt: '' diff --git a/app/views/groups/milestones/_merge_requests.html.haml b/app/views/groups/milestones/_merge_requests.html.haml deleted file mode 100644 index 50057e2c636..00000000000 --- a/app/views/groups/milestones/_merge_requests.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.panel.panel-default - .panel-heading= title - %ul{ class: "well-list merge_requests-sortable-list" } - - if merge_requests - - merge_requests.each do |merge_request| - = render 'merge_request', merge_request: merge_request diff --git a/app/views/groups/milestones/_milestone.html.haml b/app/views/groups/milestones/_milestone.html.haml deleted file mode 100644 index 30093d2d05d..00000000000 --- a/app/views/groups/milestones/_milestone.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -%li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone.milestones.first) } - .pull-right - - if can?(current_user, :admin_group, @group) - - if milestone.closed? - = link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-sm btn-grouped btn-reopen" - - else - = link_to 'Close Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-sm btn-close" - %h4 - = link_to_gfm truncate(milestone.title, length: 100), group_milestone_path(@group, milestone.safe_title, title: milestone.title) - .row - .col-sm-6 - = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do - = pluralize milestone.issue_count, 'Issue' - - = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do - = pluralize milestone.merge_requests_count, 'Merge Request' - - %span.light #{milestone.percent_complete}% complete - .col-sm-6 - = milestone_progress_bar(milestone) - %div - - milestone.milestones.each do |milestone| - = link_to milestone_path(milestone) do - %span.label.label-gray - = milestone.project.name diff --git a/app/views/groups/milestones/index.html.haml b/app/views/groups/milestones/index.html.haml deleted file mode 100644 index 008d5a6bd22..00000000000 --- a/app/views/groups/milestones/index.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%h3.page-title - Milestones - %span.pull-right #{@group_milestones.count} milestones - -%p.light - Only milestones from - %strong #{@group.name} - group are listed here. - -%hr - -= render 'shared/milestones_filter' -.milestones - .panel.panel-default - %ul.well-list - - if @group_milestones.blank? - %li - .nothing-here-block No milestones to show - - else - - @group_milestones.each do |milestone| - = render 'milestone', milestone: milestone - = paginate @group_milestones, theme: "gitlab" diff --git a/app/views/groups/milestones/show.html.haml b/app/views/groups/milestones/show.html.haml deleted file mode 100644 index fb32f2caa4c..00000000000 --- a/app/views/groups/milestones/show.html.haml +++ /dev/null @@ -1,87 +0,0 @@ -%h4.page-title - .issue-box{ class: "issue-box-#{@group_milestone.closed? ? 'closed' : 'open'}" } - - if @group_milestone.closed? - Closed - - else - Open - Milestone #{@group_milestone.title} - .pull-right - - if can?(current_user, :admin_group, @group) - - if @group_milestone.active? - = link_to 'Close Milestone', group_milestone_path(@group, @group_milestone.safe_title, title: @group_milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-sm btn-close" - - else - = link_to 'Reopen Milestone', group_milestone_path(@group, @group_milestone.safe_title, title: @group_milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-sm btn-grouped btn-reopen" - -%hr -- if (@group_milestone.total_items_count == @group_milestone.closed_items_count) && @group_milestone.active? - .alert.alert-success - %span All issues for this milestone are closed. You may close the milestone now. - -.description -%table.table - %thead - %tr - %th Project - %th Open issues - %th State - %th Due date - - @group_milestone.milestones.each do |milestone| - %tr - %td - = link_to "#{milestone.project.name}", namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone) - %td - = milestone.issues.opened.count - %td - - if milestone.closed? - Closed - - else - Open - %td - = milestone.expires_at - -.context - %p.lead - Progress: - #{@group_milestone.closed_items_count} closed - – - #{@group_milestone.open_items_count} open - = milestone_progress_bar(@group_milestone) - -%ul.nav.nav-tabs - %li.active - = link_to '#tab-issues', 'data-toggle' => 'tab' do - Issues - %span.badge= @group_milestone.issue_count - %li - = link_to '#tab-merge-requests', 'data-toggle' => 'tab' do - Merge Requests - %span.badge= @group_milestone.merge_requests_count - %li - = link_to '#tab-participants', 'data-toggle' => 'tab' do - Participants - %span.badge= @group_milestone.participants.count - -.tab-content - .tab-pane.active#tab-issues - .row - .col-md-6 - = render 'issues', title: "Open", issues: @group_milestone.opened_issues - .col-md-6 - = render 'issues', title: "Closed", issues: @group_milestone.closed_issues - - .tab-pane#tab-merge-requests - .row - .col-md-6 - = render 'merge_requests', title: "Open", merge_requests: @group_milestone.opened_merge_requests - .col-md-6 - = render 'merge_requests', title: "Closed", merge_requests: @group_milestone.closed_merge_requests - - .tab-pane#tab-participants - %ul.bordered-list - - @group_milestone.participants.each do |user| - %li - = link_to user, title: user.name, class: "darken" do - = image_tag avatar_icon(user.email, 32), class: "avatar s32" - %strong= truncate(user.name, lenght: 40) - %br - %small.cgray= user.username diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml deleted file mode 100644 index 6e17cdaef6f..00000000000 --- a/app/views/groups/new.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -= form_for @group, html: { class: 'group-form form-horizontal' } do |f| - - if @group.errors.any? - .alert.alert-danger - %span= @group.errors.full_messages.first - - = render 'shared/group_form', f: f, autofocus: true - - .form-group.group-description-holder - = f.label :avatar, "Group avatar", class: 'control-label' - .col-sm-10 - = render 'shared/choose_group_avatar_button', f: f - - .form-group - .col-sm-2 - .col-sm-10 - = render 'shared/group_tips' - - .form-actions - = f.submit 'Create group', class: "btn btn-create", tabindex: 3 diff --git a/app/views/groups/projects.html.haml b/app/views/groups/projects.html.haml deleted file mode 100644 index 0d547984cc9..00000000000 --- a/app/views/groups/projects.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -.panel.panel-default - .panel-heading - %strong= @group.name - projects: - - if can? current_user, :admin_group, @group - .panel-head-actions - = link_to new_project_path(namespace_id: @group.id), class: "btn btn-sm btn-success" do - %i.fa.fa-plus - New Project - %ul.well-list - - @projects.each do |project| - %li - .list-item-name - = visibility_level_icon(project.visibility_level) - %strong= link_to project.name_with_namespace, project - %span.label.label-gray - = repository_size(project) - .pull-right - = link_to 'Members', namespace_project_project_members_path(project.namespace, project), id: "edit_#{dom_id(project)}", class: "btn btn-sm" - = link_to 'Edit', edit_namespace_project_path(project.namespace, project), id: "edit_#{dom_id(project)}", class: "btn btn-sm" - = link_to 'Remove', project, data: { confirm: remove_project_message(project)}, method: :delete, class: "btn btn-sm btn-remove" - - if @projects.blank? - .nothing-here-block This group has no projects yet - -= paginate @projects, theme: "gitlab" diff --git a/app/views/groups/show.atom.builder b/app/views/groups/show.atom.builder deleted file mode 100644 index c78bd1bd263..00000000000 --- a/app/views/groups/show.atom.builder +++ /dev/null @@ -1,12 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "Group feed - #{@group.name}" - xml.link href: group_path(@group, :atom), rel: "self", type: "application/atom+xml" - xml.link href: group_path(@group), rel: "alternate", type: "text/html" - xml.id projects_url - xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? - - @events.each do |event| - event_to_atom(xml, event) - end -end diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml deleted file mode 100644 index 8df9366ecbe..00000000000 --- a/app/views/groups/show.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -.dashboard - .header-with-avatar.clearfix - = image_tag group_icon(@group), class: "avatar group-avatar s90" - %h3 - = @group.name - .username - @#{@group.path} - - if @group.description.present? - .description - = escaped_autolink(@group.description) - %hr - .row - %section.activities.col-md-8 - - if current_user - = render "events/event_last_push", event: @last_push - = render 'shared/event_filter' - .content_list - = spinner - %aside.side.col-md-4 - = render "projects", projects: @projects - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml deleted file mode 100644 index 7b21ca30d8c..00000000000 --- a/app/views/help/_shortcuts.html.haml +++ /dev/null @@ -1,209 +0,0 @@ -#modal-shortcuts.modal.hide{tabindex: -1} - .modal-dialog - .modal-content - .modal-header - %a.close{href: "#", "data-dismiss" => "modal"} × - %h4 - Keyboard Shortcuts - %small - = link_to '(Show all)', '#', class: 'js-more-help-button' - .modal-body.shortcuts-cheatsheet - .col-lg-4 - %table.shortcut-mappings - %tbody - %tr - %th - %th Global Shortcuts - %tr - %td.shortcut - .key s - %td Focus Search - %tr - %td.shortcut - .key ? - %td Show this dialog - %tbody - %tr - %th - %th Project Files browsing - %tr - %td.shortcut - .key - %i.fa.fa-arrow-up - %td Move selection up - %tr - %td.shortcut - .key - %i.fa.fa-arrow-down - %td Move selection down - %tr - %td.shortcut - .key enter - %td Open Selection - - .col-lg-4 - %table.shortcut-mappings - %tbody{ class: 'hidden-shortcut project', style: 'display:none' } - %tr - %th - %th Global Dashboard - %tr - %td.shortcut - .key g - .key a - %td - Go to the activity feed - %tr - %td.shortcut - .key g - .key p - %td - Go to projects - %tr - %td.shortcut - .key g - .key i - %td - Go to issues - %tr - %td.shortcut - .key g - .key m - %td - Go to merge requests - %tbody - %tr - %th - %th Project - %tr - %td.shortcut - .key g - .key p - %td - Go to the project's activity feed - %tr - %td.shortcut - .key g - .key f - %td - Go to files - %tr - %td.shortcut - .key g - .key c - %td - Go to commits - %tr - %td.shortcut - .key g - .key n - %td - Go to network graph - %tr - %td.shortcut - .key g - .key g - %td - Go to graphs - %tr - %td.shortcut - .key g - .key i - %td - Go to issues - %tr - %td.shortcut - .key g - .key m - %td - Go to merge requests - %tr - %td.shortcut - .key g - .key s - %td - Go to snippets - .col-lg-4 - %table.shortcut-mappings - %tbody{ class: 'hidden-shortcut network', style: 'display:none' } - %tr - %th - %th Network Graph - %tr - %td.shortcut - .key - %i.fa.fa-arrow-left - \/ - .key h - %td Scroll left - %tr - %td.shortcut - .key - %i.fa.fa-arrow-right - \/ - .key l - %td Scroll right - %tr - %td.shortcut - .key - %i.fa.fa-arrow-up - \/ - .key k - %td Scroll up - %tr - %td.shortcut - .key - %i.fa.fa-arrow-down - \/ - .key j - %td Scroll down - %tr - %td.shortcut - .key - shift - %i.fa.fa-arrow-up - \/ - .key - shift k - %td Scroll to top - %tr - %td.shortcut - .key - shift - %i.fa.fa-arrow-down - \/ - .key - shift j - %td Scroll to bottom - %tbody{ class: 'hidden-shortcut issues', style: 'display:none' } - %tr - %th - %th Issues - %tr - %td.shortcut - .key a - %td Change assignee - %tr - %td.shortcut - .key m - %td Change milestone - %tbody{ class: 'hidden-shortcut merge_reuests', style: 'display:none' } - %tr - %th - %th Merge Requests - %tr - %td.shortcut - .key a - %td Change assignee - %tr - %td.shortcut - .key m - %td Change milestone - - -:javascript - $('.js-more-help-button').click(function(e){ - $(this).remove() - $('.hidden-shortcut').show() - e.preventDefault() - }); diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml deleted file mode 100644 index af39dfeac5b..00000000000 --- a/app/views/help/index.html.haml +++ /dev/null @@ -1,50 +0,0 @@ -%div - %h1 - GitLab - %span= Gitlab::VERSION - %small= Gitlab::REVISION - %p.slead - GitLab is open source software to collaborate on code. - %br - Manage git repositories with fine grained access controls that keep your code secure. - %br - Perform code reviews and enhance collaboration with merge requests. - %br - Each project can also have an issue tracker and a wiki. - %br - Used by more than 100,000 organizations, GitLab is the most popular solution to manage git repositories on-premises. - %br - Read more about GitLab at #{link_to promo_host, promo_url, target: '_blank'}. - -%hr - -.row - .col-md-8 - .documentation-index - = preserve do - - readme_text = File.read(Rails.root.join("doc", "README.md")) - - text = readme_text.dup - - readme_text.scan(/\]\(([^(]+)\)/) { |match| text.gsub!(match.first, "help/#{match.first}") } - = markdown text - - .col-md-4 - .panel.panel-default - .panel-heading - Quick help - %ul.well-list - %li - See our website for - = link_to 'getting help', promo_url + '/getting-help/' - %li - Use the - = link_to 'search bar', '#', onclick: 'Shortcuts.focusSearch(event)' - on the top of this page - %li - Use - = link_to 'shortcuts', '#', onclick: 'Shortcuts.showHelp(event)' - %li - Get a support - = link_to 'subscription', 'https://about.gitlab.com/pricing/' - %li - = link_to 'Compare', 'https://about.gitlab.com/features/#compare' - GitLab editions diff --git a/app/views/help/shortcuts.js.haml b/app/views/help/shortcuts.js.haml deleted file mode 100644 index 99ed042ea3b..00000000000 --- a/app/views/help/shortcuts.js.haml +++ /dev/null @@ -1,3 +0,0 @@ -:plain - $("body").append("#{escape_javascript(render('shortcuts'))}"); - $("#modal-shortcuts").modal(); diff --git a/app/views/help/ui.html.haml b/app/views/help/ui.html.haml deleted file mode 100644 index 246a6c1bdfd..00000000000 --- a/app/views/help/ui.html.haml +++ /dev/null @@ -1,227 +0,0 @@ -- lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed fermentum nisi sapien, non consequat lectus aliquam ultrices. Suspendisse sodales est euismod nunc condimentum, a consectetur diam ornare." - -.gitlab-ui-dev-kit - %h1 GitLab UI development kit - %p.light - Use page inspector in your browser to check element classes and structure - of examples below. - %hr - %ul - %li - = link_to 'Blocks', '#blocks' - %li - = link_to 'Lists', '#lists' - %li - = link_to 'Tables', '#tables' - %li - = link_to 'Buttons', '#buttons' - %li - = link_to 'Panels', '#panels' - %li - = link_to 'Alerts', '#alerts' - %li - = link_to 'Forms', '#forms' - %li - = link_to 'Files', '#file' - %li - = link_to 'Markdown', '#markdown' - - %h2#blocks Blocks - - %h3 - %code .well - - - .well - %h4 Something - = lorem - - - %h2#lists Lists - - %h3 - %code .well-list - %ul.well-list - %li - One item - %li - One item - %li - One item - - %h3 - %code .panel .well-list - - .panel.panel-default - .panel-heading Your list - %ul.well-list - %li - One item - %li - One item - %li - One item - - %h3 - %code .bordered-list - %ul.bordered-list - %li - One item - %li - One item - %li - One item - - - - %h2#tables Tables - - .example - %table.table - %thead - %tr - %th # - %th First Name - %th Last Name - %th Username - %tbody - %tr - %td 1 - %td Mark - %td Otto - %td @mdo - %tr - %td 2 - %td Jacob - %td Thornton - %td @fat - %tr - %td 3 - %td Larry - %td the Bird - %td @twitter - - - %h2#buttons Buttons - - .example - %button.btn.btn-default{:type => "button"} Default - %button.btn.btn-primary{:type => "button"} Primary - %button.btn.btn-success{:type => "button"} Success - %button.btn.btn-info{:type => "button"} Info - %button.btn.btn-warning{:type => "button"} Warning - %button.btn.btn-danger{:type => "button"} Danger - %button.btn.btn-link{:type => "button"} Link - - %h2#panels Panels - - .row - .col-md-6 - .panel.panel-success - .panel-heading Success - .panel-body - = lorem - .panel.panel-primary - .panel-heading Primary - .panel-body - = lorem - .panel.panel-info - .panel-heading Info - .panel-body - = lorem - .col-md-6 - .panel.panel-warning - .panel-heading Warning - .panel-body - = lorem - .panel.panel-danger - .panel-heading Danger - .panel-body - = lorem - - %h2#alert Alerts - - .row - .col-md-6 - .alert.alert-success - = lorem - .alert.alert-primary - = lorem - .alert.alert-info - = lorem - .col-md-6 - .alert.alert-warning - = lorem - .alert.alert-danger - = lorem - - %h2#forms Forms - - %h3 - %code form.horizontal-form - - %form.form-horizontal - .form-group - %label.col-sm-2.control-label{:for => "inputEmail3"} Email - .col-sm-10 - %input#inputEmail3.form-control{:placeholder => "Email", :type => "email"}/ - .form-group - %label.col-sm-2.control-label{:for => "inputPassword3"} Password - .col-sm-10 - %input#inputPassword3.form-control{:placeholder => "Password", :type => "password"}/ - .form-group - .col-sm-offset-2.col-sm-10 - .checkbox - %label - %input{:type => "checkbox"}/ - Remember me - .form-group - .col-sm-offset-2.col-sm-10 - %button.btn.btn-default{:type => "submit"} Sign in - - %h3 - %code form - - %form - .form-group - %label{:for => "exampleInputEmail1"} Email address - %input#exampleInputEmail1.form-control{:placeholder => "Enter email", :type => "email"}/ - .form-group - %label{:for => "exampleInputPassword1"} Password - %input#exampleInputPassword1.form-control{:placeholder => "Password", :type => "password"}/ - .checkbox - %label - %input{:type => "checkbox"}/ - Remember me - %button.btn.btn-default{:type => "submit"} Sign in - - %h2#file File - %h3 - %code .file-holder - - - blob = Snippet.new(content: "Wow\nSuch\nFile") - .example - .file-holder - .file-title - Awesome file - .file-actions - .btn-group - %a.btn Edit - %a.btn Remove - .file-contenta.code - = render 'shared/file_highlight', blob: blob - - - %h2#markdown Markdown - %h3 - %code .md or .wiki and others - - Markdown rendering has a bit different css and presented in next UI elements: - - %ul - %li comment - %li issue, merge request description - %li wiki page - %li help page - - You can check how markdown rendered at #{link_to 'Markdown help page', help_page_path("markdown", "markdown")}. diff --git a/app/views/import/base/create.js.haml b/app/views/import/base/create.js.haml deleted file mode 100644 index 90a6f5f9d2d..00000000000 --- a/app/views/import/base/create.js.haml +++ /dev/null @@ -1,25 +0,0 @@ -- if @already_been_taken - :plain - target_field = $("tr#repo_#{@repo_id} .import-target") - origin_target = target_field.text() - project_name = "#{@project_name}" - origin_namespace = "#{@target_namespace}" - target_field.empty() - target_field.append("<p class='alert alert-danger'>This namespace already been taken! Please choose another one</p>") - target_field.append("<input type='text' name='target_namespace' />") - target_field.append("/" + project_name) - target_field.data("project_name", project_name) - target_field.find('input').prop("value", origin_namespace) -- elsif @access_denied - :plain - job = $("tr#repo_#{@repo_id}") - job.find(".import-actions").html("<p class='alert alert-danger'>Access denied! Please verify you can add deploy keys to this repository.</p>") -- else - :plain - job = $("tr#repo_#{@repo_id}") - job.attr("id", "project_#{@project.id}") - target_field = job.find(".import-target") - target_field.empty() - target_field.append('<strong>#{link_to @project.path_with_namespace, [@project.namespace.becomes(Namespace), @project]}</strong>') - $("table.import-jobs tbody").prepend(job) - job.addClass("active").find(".import-actions").html("<i class='fa fa-spinner fa-spin'></i> started") diff --git a/app/views/import/bitbucket/status.html.haml b/app/views/import/bitbucket/status.html.haml deleted file mode 100644 index 4e49bbbc7fa..00000000000 --- a/app/views/import/bitbucket/status.html.haml +++ /dev/null @@ -1,45 +0,0 @@ -%h3.page-title - %i.fa.fa-bitbucket - Import projects from Bitbucket - -%p.light - Select projects you want to import. -%hr -%p - = button_tag 'Import all projects', class: "btn btn-success js-import-all" - -%table.table.import-jobs - %thead - %tr - %th From Bitbucket - %th To GitLab - %th Status - %tbody - - @already_added_projects.each do |project| - %tr{id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}"} - %td - = link_to project.import_source, "https://bitbucket.org/#{project.import_source}", target: "_blank" - %td - %strong= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] - %td.job-status - - if project.import_status == 'finished' - %span - %i.fa.fa-check - done - - elsif project.import_status == 'started' - %i.fa.fa-spinner.fa-spin - started - - else - = project.human_import_status_name - - - @repos.each do |repo| - %tr{id: "repo_#{repo["owner"]}___#{repo["slug"]}"} - %td - = link_to "#{repo["owner"]}/#{repo["slug"]}", "https://bitbucket.org/#{repo["owner"]}/#{repo["slug"]}", target: "_blank" - %td.import-target - = "#{repo["owner"]}/#{repo["slug"]}" - %td.import-actions.job-status - = button_tag "Import", class: "btn js-add-to-import" - -:coffeescript - new ImporterStatus("#{jobs_import_bitbucket_path}", "#{import_bitbucket_path}") diff --git a/app/views/import/github/status.html.haml b/app/views/import/github/status.html.haml deleted file mode 100644 index f0bc3e6b1ac..00000000000 --- a/app/views/import/github/status.html.haml +++ /dev/null @@ -1,45 +0,0 @@ -%h3.page-title - %i.fa.fa-github - Import projects from GitHub - -%p.light - Select projects you want to import. -%hr -%p - = button_tag 'Import all projects', class: "btn btn-success js-import-all" - -%table.table.import-jobs - %thead - %tr - %th From GitHub - %th To GitLab - %th Status - %tbody - - @already_added_projects.each do |project| - %tr{id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}"} - %td - = link_to project.import_source, "https://github.com/#{project.import_source}", target: "_blank" - %td - %strong= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] - %td.job-status - - if project.import_status == 'finished' - %span - %i.fa.fa-check - done - - elsif project.import_status == 'started' - %i.fa.fa-spinner.fa-spin - started - - else - = project.human_import_status_name - - - @repos.each do |repo| - %tr{id: "repo_#{repo.id}"} - %td - = link_to repo.full_name, "https://github.com/#{repo.full_name}", target: "_blank" - %td.import-target - = repo.full_name - %td.import-actions.job-status - = button_tag "Import", class: "btn js-add-to-import" - -:coffeescript - new ImporterStatus("#{jobs_import_github_path}", "#{import_github_path}") diff --git a/app/views/import/gitlab/status.html.haml b/app/views/import/gitlab/status.html.haml deleted file mode 100644 index 33b0a21acf3..00000000000 --- a/app/views/import/gitlab/status.html.haml +++ /dev/null @@ -1,45 +0,0 @@ -%h3.page-title - %i.fa.fa-heart - Import projects from GitLab.com - -%p.light - Select projects you want to import. -%hr -%p - = button_tag 'Import all projects', class: "btn btn-success js-import-all" - -%table.table.import-jobs - %thead - %tr - %th From GitLab.com - %th To this GitLab instance - %th Status - %tbody - - @already_added_projects.each do |project| - %tr{id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}"} - %td - = link_to project.import_source, "https://gitlab.com/#{project.import_source}", target: "_blank" - %td - %strong= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] - %td.job-status - - if project.import_status == 'finished' - %span - %i.fa.fa-check - done - - elsif project.import_status == 'started' - %i.fa.fa-spinner.fa-spin - started - - else - = project.human_import_status_name - - - @repos.each do |repo| - %tr{id: "repo_#{repo["id"]}"} - %td - = link_to repo["path_with_namespace"], "https://gitlab.com/#{repo["path_with_namespace"]}", target: "_blank" - %td.import-target - = repo["path_with_namespace"] - %td.import-actions.job-status - = button_tag "Import", class: "btn js-add-to-import" - -:coffeescript - new ImporterStatus("#{jobs_import_gitlab_path}", "#{import_gitlab_path}") diff --git a/app/views/import/gitorious/status.html.haml b/app/views/import/gitorious/status.html.haml deleted file mode 100644 index 78c5e957be0..00000000000 --- a/app/views/import/gitorious/status.html.haml +++ /dev/null @@ -1,45 +0,0 @@ -%h3.page-title - %i.icon-gitorious.icon-gitorious-big - Import projects from Gitorious.org - -%p.light - Select projects you want to import. -%hr -%p - = button_tag 'Import all projects', class: "btn btn-success js-import-all" - -%table.table.import-jobs - %thead - %tr - %th From Gitorious.org - %th To GitLab - %th Status - %tbody - - @already_added_projects.each do |project| - %tr{id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}"} - %td - = link_to project.import_source, "https://gitorious.org/#{project.import_source}", target: "_blank" - %td - %strong= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] - %td.job-status - - if project.import_status == 'finished' - %span - %i.fa.fa-check - done - - elsif project.import_status == 'started' - %i.fa.fa-spinner.fa-spin - started - - else - = project.human_import_status_name - - - @repos.each do |repo| - %tr{id: "repo_#{repo.id}"} - %td - = link_to repo.full_name, "https://gitorious.org/#{repo.full_name}", target: "_blank" - %td.import-target - = repo.full_name - %td.import-actions.job-status - = button_tag "Import", class: "btn js-add-to-import" - -:coffeescript - new ImporterStatus("#{jobs_import_gitorious_path}", "#{import_gitorious_path}") diff --git a/app/views/import/google_code/new.html.haml b/app/views/import/google_code/new.html.haml deleted file mode 100644 index ce78fec205f..00000000000 --- a/app/views/import/google_code/new.html.haml +++ /dev/null @@ -1,60 +0,0 @@ -%h3.page-title - %i.fa.fa-google - Import projects from Google Code -%hr - -= form_tag callback_import_google_code_path, class: 'form-horizontal', multipart: true do - %p - Follow the steps below to export your Google Code project data. - In the next step, you'll be able to select the projects you want to import. - %ol - %li - %p - Go to - #{link_to "Google Takeout", "https://www.google.com/settings/takeout", target: "_blank"}. - %li - %p - Make sure you're logged into the account that owns the projects you'd like to import. - %li - %p - Click the <strong>Select none</strong> button on the right, since we only need "Google Code Project Hosting". - %li - %p - Scroll down to <strong>Google Code Project Hosting</strong> and enable the switch on the right. - %li - %p - Choose <strong>Next</strong> at the bottom of the page. - %li - %p - Leave the "File type" and "Delivery method" options on their default values. - %li - %p - Choose <strong>Create archive</strong> and wait for archiving to complete. - %li - %p - Click the <strong>Download</strong> button and wait for downloading to complete. - %li - %p - Find the downloaded ZIP file and decompress it. - %li - %p - Find the newly extracted <code>Takeout/Google Code Project Hosting/GoogleCodeProjectHosting.json</code> file. - %li - %p - Upload <code>GoogleCodeProjectHosting.json</code> here: - %p - %input{type: "file", name: "dump_file", id: "dump_file"} - %li - %p - Do you want to customize how Google Code email addresses and usernames are imported into GitLab? - %p - = label_tag :create_user_map_0 do - = radio_button_tag :create_user_map, 0, true - No, directly import the existing email addresses and usernames. - %p - = label_tag :create_user_map_1 do - = radio_button_tag :create_user_map, 1, false - Yes, let me map Google Code users to full names or GitLab users. - %li - %p - = submit_tag 'Continue to the next step', class: "btn btn-create" diff --git a/app/views/import/google_code/status.html.haml b/app/views/import/google_code/status.html.haml deleted file mode 100644 index 2013b8c03c6..00000000000 --- a/app/views/import/google_code/status.html.haml +++ /dev/null @@ -1,49 +0,0 @@ -%h3.page-title - %i.fa.fa-google - Import projects from Google Code - -%p.light - Select projects you want to import. -%p.light - Optionally, you can - = link_to "customize", new_user_map_import_google_code_path - how Google Code email addresses and usernames are imported into GitLab. -%hr -%p - = button_tag 'Import all projects', class: "btn btn-success js-import-all" - -%table.table.import-jobs - %thead - %tr - %th From Google Code - %th To GitLab - %th Status - %tbody - - @already_added_projects.each do |project| - %tr{id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}"} - %td - = link_to project.import_source, "https://code.google.com/p/#{project.import_source}", target: "_blank" - %td - %strong= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] - %td.job-status - - if project.import_status == 'finished' - %span - %i.fa.fa-check - done - - elsif project.import_status == 'started' - %i.fa.fa-spinner.fa-spin - started - - else - = project.human_import_status_name - - - @repos.each do |repo| - %tr{id: "repo_#{repo.id}"} - %td - = link_to repo.name, "https://code.google.com/p/#{repo.name}", target: "_blank" - %td.import-target - = "#{current_user.username}/#{repo.name}" - %td.import-actions.job-status - = button_tag "Import", class: "btn js-add-to-import" - -:coffeescript - new ImporterStatus("#{jobs_import_google_code_path}", "#{import_google_code_path}") diff --git a/app/views/invites/show.html.haml b/app/views/invites/show.html.haml deleted file mode 100644 index ab0ecffe4d2..00000000000 --- a/app/views/invites/show.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -%h3.page-title Invitation - -%p - You have been invited - - if inviter = @member.created_by - by - = link_to inviter.name, user_url(inviter) - to join - - case @member.source - - when Project - - project = @member.source - project - %strong - = link_to project.name_with_namespace, namespace_project_url(project.namespace, project) - - when Group - - group = @member.source - group - %strong - = link_to group.name, group_url(group) - as #{@member.human_access}. - -- if @member.source.users.include?(current_user) - %p - However, you are already a member of this #{@member.source.is_a?(Group) ? "group" : "project"}. - Sign in using a different account to accept the invitation. -- else - .actions - = link_to "Accept invitation", accept_invite_url(@token), method: :post, class: "btn btn-success" - = link_to "Decline", decline_invite_url(@token), method: :post, class: "btn btn-danger prepend-left-10" diff --git a/app/views/kaminari/gitlab/_first_page.html.haml b/app/views/kaminari/gitlab/_first_page.html.haml deleted file mode 100644 index 41c9c0b3af6..00000000000 --- a/app/views/kaminari/gitlab/_first_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "First" page --# available local variables --# url: url to the first page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%span.first - = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote diff --git a/app/views/kaminari/gitlab/_gap.html.haml b/app/views/kaminari/gitlab/_gap.html.haml deleted file mode 100644 index 3ffd12f8587..00000000000 --- a/app/views/kaminari/gitlab/_gap.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Non-link tag that stands for skipped pages... --# available local variables --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li{class: "page"} - %span.page.gap - = raw(t 'views.pagination.truncate') diff --git a/app/views/kaminari/gitlab/_last_page.html.haml b/app/views/kaminari/gitlab/_last_page.html.haml deleted file mode 100644 index b03a206224c..00000000000 --- a/app/views/kaminari/gitlab/_last_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "Last" page --# available local variables --# url: url to the last page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%span.last - = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {remote: remote} diff --git a/app/views/kaminari/gitlab/_next_page.html.haml b/app/views/kaminari/gitlab/_next_page.html.haml deleted file mode 100644 index 00c5f0b6f4e..00000000000 --- a/app/views/kaminari/gitlab/_next_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "Next" page --# available local variables --# url: url to the next page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li.next - = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote diff --git a/app/views/kaminari/gitlab/_page.html.haml b/app/views/kaminari/gitlab/_page.html.haml deleted file mode 100644 index a52d883b9a8..00000000000 --- a/app/views/kaminari/gitlab/_page.html.haml +++ /dev/null @@ -1,10 +0,0 @@ --# Link showing page number --# available local variables --# page: a page object for "this" page --# url: url to this page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li{class: "page#{' active' if page.current?}"} - = link_to page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil} diff --git a/app/views/kaminari/gitlab/_paginator.html.haml b/app/views/kaminari/gitlab/_paginator.html.haml deleted file mode 100644 index 4f7996e4996..00000000000 --- a/app/views/kaminari/gitlab/_paginator.html.haml +++ /dev/null @@ -1,17 +0,0 @@ --# The container tag --# available local variables --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote --# paginator: the paginator that renders the pagination tags inside -= paginator.render do - %div.gl-pagination - %ul.pagination - = prev_page_tag unless current_page.first? - - each_page do |page| - - if page.left_outer? || page.right_outer? || page.inside_window? - = page_tag page - - elsif !page.was_truncated? - = gap_tag - = next_page_tag unless current_page.last? diff --git a/app/views/kaminari/gitlab/_prev_page.html.haml b/app/views/kaminari/gitlab/_prev_page.html.haml deleted file mode 100644 index f673abdb3ae..00000000000 --- a/app/views/kaminari/gitlab/_prev_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "Previous" page --# available local variables --# url: url to the previous page --# current_page: a page object for the currently displayed page --# num_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li{class: "prev" } - = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote diff --git a/app/views/layouts/_broadcast.html.haml b/app/views/layouts/_broadcast.html.haml deleted file mode 100644 index e7d477c225e..00000000000 --- a/app/views/layouts/_broadcast.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- if broadcast_message.present? - .broadcast-message{ style: broadcast_styling(broadcast_message) } - %i.fa.fa-bullhorn - = broadcast_message.message diff --git a/app/views/layouts/_collapse_button.html.haml b/app/views/layouts/_collapse_button.html.haml deleted file mode 100644 index 2ed51d87ca1..00000000000 --- a/app/views/layouts/_collapse_button.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- if nav_menu_collapsed? - = link_to icon('angle-right'), '#', class: 'toggle-nav-collapse', title: "Open/Close" -- else - = link_to icon('angle-left'), '#', class: 'toggle-nav-collapse', title: "Open/Close" diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml deleted file mode 100644 index cc8ea066cb9..00000000000 --- a/app/views/layouts/_flash.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -.flash-container - - if alert - .flash-alert - = alert - - - elsif notice - .flash-notice - = notice diff --git a/app/views/layouts/_google_analytics.html.haml b/app/views/layouts/_google_analytics.html.haml deleted file mode 100644 index 81e03c7eff2..00000000000 --- a/app/views/layouts/_google_analytics.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -:javascript - var _gaq = _gaq || []; - _gaq.push(['_setAccount', '#{extra_config.google_analytics_id}']); - _gaq.push(['_trackPageview']); - - (function() { - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); - })(); diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml deleted file mode 100644 index d12145651af..00000000000 --- a/app/views/layouts/_head.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -%head - %meta{charset: "utf-8"} - %meta{content: "GitLab Community Edition", name: "description"} - - %title - = "#{title} | " if defined?(title) - GitLab - = favicon_link_tag 'favicon.ico' - = stylesheet_link_tag "application", :media => "all" - = stylesheet_link_tag "print", :media => "print" - = javascript_include_tag "application" - = csrf_meta_tags - = include_gon - %meta{name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1'} - %meta{name: 'theme-color', content: '#474D57'} - - = render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id') - = render 'layouts/piwik' if extra_config.has_key?('piwik_url') && extra_config.has_key?('piwik_site_id') - - -# Atom feed - - if current_user - - if controller_name == 'projects' && action_name == 'index' - = auto_discovery_link_tag :atom, projects_url(:atom, private_token: current_user.private_token), title: "Dashboard feed" - - if @project && !@project.new_record? - - if current_controller?(:tree, :commits) - = auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}") - - if current_controller?(:issues) - = auto_discovery_link_tag(:atom, namespace_project_issues_url(@project.namespace, @project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml deleted file mode 100644 index d58582c107a..00000000000 --- a/app/views/layouts/_head_panel.html.haml +++ /dev/null @@ -1,48 +0,0 @@ -%header.navbar.navbar-fixed-top.navbar-gitlab - .navbar-inner - .container - %div.app_logo - = link_to root_path, class: "home has_bottom_tooltip", title: "Dashboard" do - = brand_header_logo - %h1.title= title - - %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"} - %span.sr-only Toggle navigation - %i.fa.fa-bars - - .navbar-collapse.collapse - %ul.nav.navbar-nav - %li.hidden-sm.hidden-xs - = render "layouts/search" - %li.visible-sm.visible-xs - = link_to search_path, title: "Search", class: 'has_bottom_tooltip', 'data-original-title' => 'Search area' do - %i.fa.fa-search - %li - = link_to help_path, title: 'Help', class: 'has_bottom_tooltip', - 'data-original-title' => 'Help' do - %i.fa.fa-question-circle - %li - = link_to explore_root_path, title: "Explore", class: 'has_bottom_tooltip', 'data-original-title' => 'Public area' do - %i.fa.fa-globe - %li - = link_to user_snippets_path(current_user), title: "Your snippets", class: 'has_bottom_tooltip', 'data-original-title' => 'Your snippets' do - %i.fa.fa-clipboard - - if current_user.is_admin? - %li - = link_to admin_root_path, title: "Admin area", class: 'has_bottom_tooltip', 'data-original-title' => 'Admin area' do - %i.fa.fa-cogs - - if current_user.can_create_project? - %li - = link_to new_project_path, title: "New project", class: 'has_bottom_tooltip', 'data-original-title' => 'New project' do - %i.fa.fa-plus - %li - = link_to profile_path, title: "Profile settings", class: 'has_bottom_tooltip', 'data-original-title' => 'Profile settings"' do - %i.fa.fa-user - %li - = link_to destroy_user_session_path, class: "logout", method: :delete, title: "Sign out", class: 'has_bottom_tooltip', 'data-original-title' => 'Sign out' do - %i.fa.fa-sign-out - %li.hidden-xs - = link_to current_user, class: "profile-pic has_bottom_tooltip", id: 'profile-pic', 'data-original-title' => 'Your profile' do - = image_tag avatar_icon(current_user.email, 60), alt: 'User activity' - -= render 'shared/outdated_browser' diff --git a/app/views/layouts/_init_auto_complete.html.haml b/app/views/layouts/_init_auto_complete.html.haml deleted file mode 100644 index 3c58f10e759..00000000000 --- a/app/views/layouts/_init_auto_complete.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -:javascript - GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_namespace_project_path(@project.namespace, @project, type: @noteable.class, type_id: params[:id])}" - GitLab.GfmAutoComplete.setup(); diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml deleted file mode 100644 index 422966cdc55..00000000000 --- a/app/views/layouts/_page.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- if defined?(sidebar) - .page-with-sidebar{ class: nav_sidebar_class } - = render "layouts/broadcast" - .sidebar-wrapper - = render(sidebar) - .collapse-nav - = render partial: 'layouts/collapse_button' - .content-wrapper - .container-fluid - .content - = render "layouts/flash" - .clearfix - = yield -- else - .container.navless-container - .content - = yield - -= yield :embedded_scripts - -:coffeescript - $('.page-sidebar-collapsed .nav-sidebar a').tooltip placement: "right" - diff --git a/app/views/layouts/_page_title.html.haml b/app/views/layouts/_page_title.html.haml deleted file mode 100644 index 54da5074763..00000000000 --- a/app/views/layouts/_page_title.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -- if content_for?(:page-title) - = yield :page-title diff --git a/app/views/layouts/_piwik.html.haml b/app/views/layouts/_piwik.html.haml deleted file mode 100644 index 135e8daca26..00000000000 --- a/app/views/layouts/_piwik.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -:javascript - var _paq = _paq || []; - _paq.push(["trackPageView"]); - _paq.push(["enableLinkTracking"]); - - (function() { - var u=(("https:" == document.location.protocol) ? "https" : "http") + "://#{extra_config.piwik_url}/"; - _paq.push(["setTrackerUrl", u+"piwik.php"]); - _paq.push(["setSiteId", "#{extra_config.piwik_site_id}"]); - var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript"; - g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s); - })(); diff --git a/app/views/layouts/_public_head_panel.html.haml b/app/views/layouts/_public_head_panel.html.haml deleted file mode 100644 index 3d6d2bfc00a..00000000000 --- a/app/views/layouts/_public_head_panel.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%header.navbar.navbar-fixed-top.navbar-gitlab - .navbar-inner - .container - %div.app_logo - = link_to explore_root_path, class: "home" do - = brand_header_logo - %h1.title= title - - %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"} - %span.sr-only Toggle navigation - %i.fa.fa-bars - - - unless current_controller?('sessions') - .pull-right.hidden-xs - = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-new append-right-10' - - .navbar-collapse.collapse - %ul.nav.navbar-nav - %li.visible-xs - = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes') - -= render 'shared/outdated_browser' diff --git a/app/views/layouts/_search.html.haml b/app/views/layouts/_search.html.haml deleted file mode 100644 index 04f79846858..00000000000 --- a/app/views/layouts/_search.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -.search - = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f| - = search_field_tag "search", nil, placeholder: search_placeholder, class: "search-input" - = hidden_field_tag :group_id, @group.try(:id) - - if @project && @project.persisted? - = hidden_field_tag :project_id, @project.id - - - if current_controller?(:issues) - = hidden_field_tag :scope, 'issues' - - elsif current_controller?(:merge_requests) - = hidden_field_tag :scope, 'merge_requests' - - elsif current_controller?(:wikis) - = hidden_field_tag :scope, 'wiki_blobs' - - else - = hidden_field_tag :search_code, true - - - if @snippet || @snippets - = hidden_field_tag :snippets, true - = hidden_field_tag :repository_ref, @ref - = button_tag 'Go' if ENV['RAILS_ENV'] == 'test' - .search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref } - -:javascript - $('.search-input').on('keyup', function(e) { - if (e.keyCode == 27) { - $('.search-input').blur() - } - }) diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml deleted file mode 100644 index ab84e87c300..00000000000 --- a/app/views/layouts/admin.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: "Admin area" - %body{class: "#{app_theme} admin", :'data-page' => body_data_page} - = render "layouts/head_panel", title: link_to("Admin area", admin_root_path) - = render 'layouts/page', sidebar: 'layouts/nav/admin' diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml deleted file mode 100644 index 6bd8ac4adb8..00000000000 --- a/app/views/layouts/application.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: "Dashboard" - %body{class: "#{app_theme} application", :'data-page' => body_data_page } - = render "layouts/head_panel", title: link_to("Dashboard", root_path) - = render 'layouts/page', sidebar: 'layouts/nav/dashboard' diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml deleted file mode 100644 index 6f805f1c9d1..00000000000 --- a/app/views/layouts/devise.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head" - %body.ui_mars.login-page.application - = render "layouts/broadcast" - = render "layouts/public_head_panel", title: '' - .container.navless-container - .content - = render "layouts/flash" - .row.prepend-top-20 - .col-sm-5.pull-right - = yield - .col-sm-7.brand-holder.pull-left - %h1 - = brand_title - - if brand_item - = brand_image - = brand_text - - else - %h3 Open source software to collaborate on code - - %p - Manage git repositories with fine grained access controls that keep your code secure. - Perform code reviews and enhance collaboration with merge requests. - Each project can also have an issue tracker and a wiki. - - - if extra_sign_in_text.present? - = markdown(extra_sign_in_text) - - %hr - .container - .footer-links - = link_to "Explore", explore_root_path - = link_to "Documentation", "http://doc.gitlab.com/" - = link_to "About GitLab", "https://about.gitlab.com/" diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml deleted file mode 100644 index e51fd4cb820..00000000000 --- a/app/views/layouts/errors.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: "Error" - %body{class: "#{app_theme} application"} - = render "layouts/head_panel", title: "" if current_user - .container.navless-container - = render "layouts/flash" - .error-page - = yield diff --git a/app/views/layouts/explore.html.haml b/app/views/layouts/explore.html.haml deleted file mode 100644 index 2bd0b8d85c9..00000000000 --- a/app/views/layouts/explore.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -- page_title = 'Explore' -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: page_title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} - = render "layouts/broadcast" - - if current_user - = render "layouts/head_panel", title: link_to(page_title, explore_root_path) - - else - = render "layouts/public_head_panel", title: link_to(page_title, explore_root_path) - .container.navless-container - .content - .explore-title - %h3 - Explore GitLab - %p.lead - Discover projects and groups. Share your projects with others - - - %ul.nav.nav-tabs - = nav_link(path: 'projects#trending') do - = link_to 'Trending Projects', explore_root_path - = nav_link(path: 'projects#starred') do - = link_to 'Most Starred Projects', starred_explore_projects_path - = nav_link(path: 'projects#index') do - = link_to 'All Projects', explore_projects_path - = nav_link(controller: :groups) do - = link_to 'All Groups', explore_groups_path - - = yield diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml deleted file mode 100644 index f4a6bee15f6..00000000000 --- a/app/views/layouts/group.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: group_head_title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} - = render "layouts/head_panel", title: link_to(@group.name, group_path(@group)) - = render 'layouts/page', sidebar: 'layouts/nav/group' diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml deleted file mode 100644 index 34efceb37d1..00000000000 --- a/app/views/layouts/nav/_admin.html.haml +++ /dev/null @@ -1,65 +0,0 @@ -%ul.nav.nav-sidebar - = nav_link(controller: :dashboard, html_options: {class: 'home'}) do - = link_to admin_root_path, title: "Stats" do - %i.fa.fa-dashboard - %span - Overview - = nav_link(controller: :projects) do - = link_to admin_namespaces_projects_path, title: 'Projects' do - %i.fa.fa-cube - %span - Projects - = nav_link(controller: :users) do - = link_to admin_users_path, title: 'Users' do - %i.fa.fa-user - %span - Users - = nav_link(controller: :groups) do - = link_to admin_groups_path, title: 'Groups' do - %i.fa.fa-group - %span - Groups - = nav_link(controller: :deploy_keys) do - = link_to admin_deploy_keys_path, title: 'Deploy Keys' do - %i.fa.fa-key - %span - Deploy Keys - = nav_link(controller: :logs) do - = link_to admin_logs_path, title: 'Logs' do - %i.fa.fa-file-text - %span - Logs - = nav_link(controller: :broadcast_messages) do - = link_to admin_broadcast_messages_path, title: 'Broadcast Messages' do - %i.fa.fa-bullhorn - %span - Messages - = nav_link(controller: :hooks) do - = link_to admin_hooks_path, title: 'Hooks' do - %i.fa.fa-external-link - %span - Hooks - = nav_link(controller: :background_jobs) do - = link_to admin_background_jobs_path, title: 'Background Jobs' do - %i.fa.fa-cog - %span - Background Jobs - - = nav_link(controller: :applications) do - = link_to admin_applications_path, title: 'Applications' do - %i.fa.fa-cloud - %span - Applications - - = nav_link(controller: :services) do - = link_to admin_application_settings_services_path, title: 'Service Templates' do - %i.fa.fa-copy - %span - Service Templates - - = nav_link(controller: :application_settings, html_options: { class: 'separate-item'}) do - = link_to admin_application_settings_path, title: 'Settings' do - %i.fa.fa-cogs - %span - Settings - diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml deleted file mode 100644 index e4f630c6a18..00000000000 --- a/app/views/layouts/nav/_dashboard.html.haml +++ /dev/null @@ -1,38 +0,0 @@ -%ul.nav.nav-sidebar - = nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do - = link_to root_path, title: 'Home', class: 'shortcuts-activity' do - %i.fa.fa-dashboard - %span - Your Projects - = nav_link(path: 'projects#starred') do - = link_to starred_dashboard_projects_path, title: 'Starred Projects' do - %i.fa.fa-star - %span - Starred Projects - = nav_link(controller: :groups) do - = link_to dashboard_groups_path, title: 'Groups' do - %i.fa.fa-group - %span - Groups - = nav_link(controller: :milestones) do - = link_to dashboard_milestones_path, title: 'Milestones' do - %i.fa.fa-clock-o - %span - Milestones - = nav_link(path: 'dashboard#issues') do - = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'shortcuts-issues' do - %i.fa.fa-exclamation-circle - %span - Issues - %span.count= current_user.assigned_issues.opened.count - = nav_link(path: 'dashboard#merge_requests') do - = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'shortcuts-merge_requests' do - %i.fa.fa-tasks - %span - Merge Requests - %span.count= current_user.assigned_merge_requests.opened.count - = nav_link(controller: :help) do - = link_to help_path, title: 'Help' do - %i.fa.fa-question-circle - %span - Help diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml deleted file mode 100644 index f0d92b7a12c..00000000000 --- a/app/views/layouts/nav/_group.html.haml +++ /dev/null @@ -1,42 +0,0 @@ -%ul.nav.nav-sidebar - = nav_link(path: 'groups#show', html_options: {class: 'home'}) do - = link_to group_path(@group), title: "Home" do - %i.fa.fa-dashboard - %span - Activity - - if current_user - = nav_link(controller: [:group, :milestones]) do - = link_to group_milestones_path(@group), title: 'Milestones' do - %i.fa.fa-clock-o - %span - Milestones - = nav_link(path: 'groups#issues') do - = link_to issues_group_path(@group), title: 'Issues' do - %i.fa.fa-exclamation-circle - %span - Issues - - if current_user - %span.count= Issue.opened.of_group(@group).count - = nav_link(path: 'groups#merge_requests') do - = link_to merge_requests_group_path(@group), title: 'Merge Requests' do - %i.fa.fa-tasks - %span - Merge Requests - - if current_user - %span.count= MergeRequest.opened.of_group(@group).count - = nav_link(controller: [:group_members]) do - = link_to group_group_members_path(@group), title: 'Members' do - %i.fa.fa-users - %span - Members - - - if can?(current_user, :admin_group, @group) - = nav_link(html_options: { class: "#{"active" if group_settings_page?} separate-item" }) do - = link_to edit_group_path(@group), title: 'Settings', class: "tab no-highlight" do - %i.fa.fa-cogs - %span - Settings - %i.fa.fa-angle-down - - - if group_settings_page? - = render 'groups/settings_nav' diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml deleted file mode 100644 index d88e862829d..00000000000 --- a/app/views/layouts/nav/_profile.html.haml +++ /dev/null @@ -1,50 +0,0 @@ -%ul.nav.nav-sidebar - = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do - = link_to profile_path, title: "Profile" do - %i.fa.fa-user - %span - Profile - = nav_link(controller: :accounts) do - = link_to profile_account_path, title: 'Account' do - %i.fa.fa-gear - %span - Account - = nav_link(path: ['profiles#applications', 'applications#edit', 'applications#show', 'applications#new']) do - = link_to applications_profile_path, title: 'Applications' do - %i.fa.fa-cloud - %span - Applications - = nav_link(controller: :emails) do - = link_to profile_emails_path, title: 'Emails' do - %i.fa.fa-envelope-o - %span - Emails - %span.count= current_user.emails.count + 1 - - unless current_user.ldap_user? - = nav_link(controller: :passwords) do - = link_to edit_profile_password_path, title: 'Password' do - %i.fa.fa-lock - %span - Password - = nav_link(controller: :notifications) do - = link_to profile_notifications_path, title: 'Notifications' do - %i.fa.fa-inbox - %span - Notifications - - = nav_link(controller: :keys) do - = link_to profile_keys_path, title: 'SSH Keys' do - %i.fa.fa-key - %span - SSH Keys - %span.count= current_user.keys.count - = nav_link(path: 'profiles#design') do - = link_to design_profile_path, title: 'Design' do - %i.fa.fa-image - %span - Design - = nav_link(path: 'profiles#history') do - = link_to history_profile_path, title: 'History' do - %i.fa.fa-history - %span - History diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml deleted file mode 100644 index 6c13f30f627..00000000000 --- a/app/views/layouts/nav/_project.html.haml +++ /dev/null @@ -1,97 +0,0 @@ -%ul.project-navigation.nav.nav-sidebar - - if @project_settings_nav - = nav_link do - = link_to project_path(@project), title: 'Back to project', class: "" do - %i.fa.fa-caret-square-o-left - %span - Back to project - - %li.separate-item - - = render 'projects/settings_nav' - - - else - = nav_link(path: 'projects#show', html_options: {class: "home"}) do - = link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do - %i.fa.fa-dashboard - %span - Project - - if project_nav_tab? :files - = nav_link(controller: %w(tree blob blame edit_tree new_tree)) do - = link_to namespace_project_tree_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Files', class: 'shortcuts-tree' do - %i.fa.fa-files-o - %span - Files - - - if project_nav_tab? :commits - = nav_link(controller: %w(commit commits compare repositories tags branches)) do - = link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Commits', class: 'shortcuts-commits' do - %i.fa.fa-history - %span - Commits - - - if project_nav_tab? :network - = nav_link(controller: %w(network)) do - = link_to namespace_project_network_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Network', class: 'shortcuts-network' do - %i.fa.fa-code-fork - %span - Network - - - if project_nav_tab? :graphs - = nav_link(controller: %w(graphs)) do - = link_to namespace_project_graph_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Graphs', class: 'shortcuts-graphs' do - %i.fa.fa-area-chart - %span - Graphs - - - if project_nav_tab? :milestones - = nav_link(controller: :milestones) do - = link_to namespace_project_milestones_path(@project.namespace, @project), title: 'Milestones' do - %i.fa.fa-clock-o - %span - Milestones - - - if project_nav_tab? :issues - = nav_link(controller: :issues) do - = link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do - %i.fa.fa-exclamation-circle - %span - Issues - - if @project.default_issues_tracker? - %span.count.issue_counter= @project.issues.opened.count - - - if project_nav_tab? :merge_requests - = nav_link(controller: :merge_requests) do - = link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests', class: 'shortcuts-merge_requests' do - %i.fa.fa-tasks - %span - Merge Requests - %span.count.merge_counter= @project.merge_requests.opened.count - - - if project_nav_tab? :labels - = nav_link(controller: :labels) do - = link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels' do - %i.fa.fa-tags - %span - Labels - - - if project_nav_tab? :wiki - = nav_link(controller: :wikis) do - = link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do - %i.fa.fa-book - %span - Wiki - - - if project_nav_tab? :snippets - = nav_link(controller: :snippets) do - = link_to namespace_project_snippets_path(@project.namespace, @project), title: 'Snippets', class: 'shortcuts-snippets' do - %i.fa.fa-file-text-o - %span - Snippets - - - if project_nav_tab? :settings - = nav_link(html_options: {class: "#{project_tab_class} separate-item"}) do - = link_to edit_project_path(@project), title: 'Settings', class: "stat-tab tab no-highlight" do - %i.fa.fa-cogs - %span - Settings diff --git a/app/views/layouts/navless.html.haml b/app/views/layouts/navless.html.haml deleted file mode 100644 index 4d0278251a6..00000000000 --- a/app/views/layouts/navless.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: @title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} - = render "layouts/broadcast" - = render "layouts/head_panel", title: defined?(@title_url) ? link_to(@title, @title_url) : @title - .container.navless-container - .content - = render "layouts/flash" - = yield diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml deleted file mode 100644 index 00c7cedce40..00000000000 --- a/app/views/layouts/notify.html.haml +++ /dev/null @@ -1,42 +0,0 @@ -%html{lang: "en"} - %head - %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"} - %title - GitLab - :css - img { - max-width: 100%; - height: auto; - } - p.details { - font-style:italic; - color:#777 - } - .footer p { - font-size:small; - color:#777 - } - pre.commit-message { - white-space: pre-wrap; - } - .file-stats a { - text-decoration: none; - } - .file-stats .new-file { - color: #090; - } - .file-stats .deleted-file { - color: #B00; - }} - %body - %div.content - = yield - %div.footer{style: "margin-top: 10px;"} - %p - \— - %br - - if @target_url - #{link_to "View it on GitLab", @target_url} - = email_action @target_url - - if @project && !@disable_footer - You're receiving this notification because you are a member of the #{link_to_unless @target_url, @project.name_with_namespace, namespace_project_url(@project.namespace, @project)} project team. diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml deleted file mode 100644 index 2b5be7fc372..00000000000 --- a/app/views/layouts/profile.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: "Profile" - %body{class: "#{app_theme} profile", :'data-page' => body_data_page} - = render "layouts/head_panel", title: link_to("Profile", profile_path) - = render 'layouts/page', sidebar: 'layouts/nav/profile' diff --git a/app/views/layouts/project_settings.html.haml b/app/views/layouts/project_settings.html.haml deleted file mode 100644 index 0a0039dec16..00000000000 --- a/app/views/layouts/project_settings.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: @project.name_with_namespace - %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } - = render "layouts/head_panel", title: project_title(@project) - = render "layouts/init_auto_complete" - - @project_settings_nav = true - = render 'layouts/page', sidebar: 'layouts/nav/project' diff --git a/app/views/layouts/projects.html.haml b/app/views/layouts/projects.html.haml deleted file mode 100644 index dde0964f47f..00000000000 --- a/app/views/layouts/projects.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: project_head_title - %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } - = render "layouts/head_panel", title: project_title(@project) - = render "layouts/init_auto_complete" - = render 'layouts/page', sidebar: 'layouts/nav/project' diff --git a/app/views/layouts/public_group.html.haml b/app/views/layouts/public_group.html.haml deleted file mode 100644 index b9b1d03e08e..00000000000 --- a/app/views/layouts/public_group.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: group_head_title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} - = render "layouts/public_head_panel", title: link_to(@group.name, group_path(@group)) - = render 'layouts/page', sidebar: 'layouts/nav/group' diff --git a/app/views/layouts/public_projects.html.haml b/app/views/layouts/public_projects.html.haml deleted file mode 100644 index 04fa7c84e73..00000000000 --- a/app/views/layouts/public_projects.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: @project.name_with_namespace - %body{class: "#{app_theme} application", :'data-page' => body_data_page} - = render "layouts/public_head_panel", title: project_title(@project) - = render 'layouts/page', sidebar: 'layouts/nav/project' diff --git a/app/views/layouts/public_users.html.haml b/app/views/layouts/public_users.html.haml deleted file mode 100644 index 71c16bd1684..00000000000 --- a/app/views/layouts/public_users.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: @title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} - = render "layouts/public_head_panel", title: defined?(@title_url) ? link_to(@title, @title_url) : @title - = render 'layouts/page' diff --git a/app/views/layouts/search.html.haml b/app/views/layouts/search.html.haml deleted file mode 100644 index f9d8db06e10..00000000000 --- a/app/views/layouts/search.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: "Search" - %body{class: "#{app_theme} application", :'data-page' => body_data_page} - = render "layouts/broadcast" - = render "layouts/head_panel", title: link_to("Search", search_path) - .container.navless-container - .content - = render "layouts/flash" - = yield diff --git a/app/views/notify/_note_message.html.haml b/app/views/notify/_note_message.html.haml deleted file mode 100644 index 3fd4b04ac84..00000000000 --- a/app/views/notify/_note_message.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%div - = markdown(@note.note, reference_only_path: false) diff --git a/app/views/notify/_reassigned_issuable_email.html.haml b/app/views/notify/_reassigned_issuable_email.html.haml deleted file mode 100644 index 56d81b2ed2e..00000000000 --- a/app/views/notify/_reassigned_issuable_email.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%p - Assignee changed - - if @previous_assignee - from - %strong #{@previous_assignee.name} - to - - if issuable.assignee_id - %strong #{issuable.assignee_name} - - else - %strong Unassigned diff --git a/app/views/notify/_reassigned_issuable_email.text.erb b/app/views/notify/_reassigned_issuable_email.text.erb deleted file mode 100644 index 855d37429d9..00000000000 --- a/app/views/notify/_reassigned_issuable_email.text.erb +++ /dev/null @@ -1,6 +0,0 @@ -Reassigned <%= issuable.class.model_name.human.titleize %> <%= issuable.iid %> - -<%= url_for([issuable.project.namespace.becomes(Namespace), issuable.project, issuable, {only_path: false}]) %> - -Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee -%> - to <%= "#{issuable.assignee_id ? issuable.assignee_name : 'Unassigned'}" %> diff --git a/app/views/notify/closed_issue_email.html.haml b/app/views/notify/closed_issue_email.html.haml deleted file mode 100644 index 56c18cd83cd..00000000000 --- a/app/views/notify/closed_issue_email.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%p - = "Issue was closed by #{@updated_by.name}" diff --git a/app/views/notify/closed_issue_email.text.haml b/app/views/notify/closed_issue_email.text.haml deleted file mode 100644 index ac703b31edd..00000000000 --- a/app/views/notify/closed_issue_email.text.haml +++ /dev/null @@ -1,3 +0,0 @@ -= "Issue was closed by #{@updated_by.name}" - -Issue ##{@issue.iid}: #{namespace_project_issue_url(@issue.project.namespace, @issue.project, @issue)} diff --git a/app/views/notify/closed_merge_request_email.html.haml b/app/views/notify/closed_merge_request_email.html.haml deleted file mode 100644 index 574e8bfef24..00000000000 --- a/app/views/notify/closed_merge_request_email.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%p - = "Merge Request ##{@merge_request.iid} was closed by #{@updated_by.name}" diff --git a/app/views/notify/closed_merge_request_email.text.haml b/app/views/notify/closed_merge_request_email.text.haml deleted file mode 100644 index 59db86b08bc..00000000000 --- a/app/views/notify/closed_merge_request_email.text.haml +++ /dev/null @@ -1,8 +0,0 @@ -= "Merge Request ##{@merge_request.iid} was closed by #{@updated_by.name}" - -Merge Request url: #{namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request)} - -= merge_path_description(@merge_request, 'to') - -Author: #{@merge_request.author_name} -Assignee: #{@merge_request.assignee_name} diff --git a/app/views/notify/group_access_granted_email.html.haml b/app/views/notify/group_access_granted_email.html.haml deleted file mode 100644 index f1916d624b6..00000000000 --- a/app/views/notify/group_access_granted_email.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%p - = "You have been granted #{@group_member.human_access} access to group" - = link_to group_url(@group) do - = @group.name diff --git a/app/views/notify/group_access_granted_email.text.erb b/app/views/notify/group_access_granted_email.text.erb deleted file mode 100644 index ef9617bfc16..00000000000 --- a/app/views/notify/group_access_granted_email.text.erb +++ /dev/null @@ -1,4 +0,0 @@ - -You have been granted <%= @group_member.human_access %> access to group <%= @group.name %> - -<%= url_for(group_url(@group)) %> diff --git a/app/views/notify/group_invite_accepted_email.html.haml b/app/views/notify/group_invite_accepted_email.html.haml deleted file mode 100644 index 55efad384a7..00000000000 --- a/app/views/notify/group_invite_accepted_email.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%p - #{@group_member.invite_email}, now known as - #{link_to @group_member.user.name, user_url(@group_member.user)}, - has accepted your invitation to join group - #{link_to @group.name, group_url(@group)}. - diff --git a/app/views/notify/group_invite_accepted_email.text.erb b/app/views/notify/group_invite_accepted_email.text.erb deleted file mode 100644 index f8b70f7a5a6..00000000000 --- a/app/views/notify/group_invite_accepted_email.text.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= @group_member.invite_email %>, now known as <%= @group_member.user.name %>, has accepted your invitation to join group <%= @group.name %>. - -<%= group_url(@group) %> diff --git a/app/views/notify/group_invite_declined_email.html.haml b/app/views/notify/group_invite_declined_email.html.haml deleted file mode 100644 index f9525d84fac..00000000000 --- a/app/views/notify/group_invite_declined_email.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%p - #{@invite_email} - has declined your invitation to join group - #{link_to @group.name, group_url(@group)}. - diff --git a/app/views/notify/group_invite_declined_email.text.erb b/app/views/notify/group_invite_declined_email.text.erb deleted file mode 100644 index 6c19a288d15..00000000000 --- a/app/views/notify/group_invite_declined_email.text.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= @invite_email %> has declined your invitation to join group <%= @group.name %>. - -<%= group_url(@group) %> diff --git a/app/views/notify/group_member_invited_email.html.haml b/app/views/notify/group_member_invited_email.html.haml deleted file mode 100644 index 163e88bfea3..00000000000 --- a/app/views/notify/group_member_invited_email.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%p - You have been invited - - if inviter = @group_member.created_by - by - = link_to inviter.name, user_url(inviter) - to join group - = link_to @group.name, group_url(@group) - as #{@group_member.human_access}. - -%p - = link_to 'Accept invitation', invite_url(@token) - or - = link_to 'decline', decline_invite_url(@token) - diff --git a/app/views/notify/group_member_invited_email.text.erb b/app/views/notify/group_member_invited_email.text.erb deleted file mode 100644 index 28ce4819b14..00000000000 --- a/app/views/notify/group_member_invited_email.text.erb +++ /dev/null @@ -1,4 +0,0 @@ -You have been invited <%= "by #{@group_member.created_by.name} " if @group_member.created_by %>to join group <%= @group.name %> as <%= @group_member.human_access %>. - -Accept invitation: <%= invite_url(@token) %> -Decline invitation: <%= decline_invite_url(@token) %> diff --git a/app/views/notify/issue_status_changed_email.html.haml b/app/views/notify/issue_status_changed_email.html.haml deleted file mode 100644 index 482c884a9db..00000000000 --- a/app/views/notify/issue_status_changed_email.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%p - = "Issue was #{@issue_status} by #{@updated_by.name}" diff --git a/app/views/notify/issue_status_changed_email.text.erb b/app/views/notify/issue_status_changed_email.text.erb deleted file mode 100644 index e6ab3fcde77..00000000000 --- a/app/views/notify/issue_status_changed_email.text.erb +++ /dev/null @@ -1,4 +0,0 @@ -Issue was <%= @issue_status %> by <%= @updated_by.name %> - -Issue <%= @issue.iid %>: <%= url_for(namespace_project_issue_url(@issue.project.namespace, @issue.project, @issue)) %> - diff --git a/app/views/notify/merge_request_status_email.html.haml b/app/views/notify/merge_request_status_email.html.haml deleted file mode 100644 index c9bf04f514e..00000000000 --- a/app/views/notify/merge_request_status_email.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%p - = "Merge Request ##{@merge_request.iid} was #{@mr_status} by #{@updated_by.name}" diff --git a/app/views/notify/merge_request_status_email.text.haml b/app/views/notify/merge_request_status_email.text.haml deleted file mode 100644 index b96dd0fd8ab..00000000000 --- a/app/views/notify/merge_request_status_email.text.haml +++ /dev/null @@ -1,8 +0,0 @@ -= "Merge Request ##{@merge_request.iid} was #{@mr_status} by #{@updated_by.name}" - -Merge Request url: #{namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request)} - -= merge_path_description(@merge_request, 'to') - -Author: #{@merge_request.author_name} -Assignee: #{@merge_request.assignee_name} diff --git a/app/views/notify/merged_merge_request_email.html.haml b/app/views/notify/merged_merge_request_email.html.haml deleted file mode 100644 index 6762fae7f64..00000000000 --- a/app/views/notify/merged_merge_request_email.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%p - = "Merge Request ##{@merge_request.iid} was merged" diff --git a/app/views/notify/merged_merge_request_email.text.haml b/app/views/notify/merged_merge_request_email.text.haml deleted file mode 100644 index 9db75bdb19e..00000000000 --- a/app/views/notify/merged_merge_request_email.text.haml +++ /dev/null @@ -1,8 +0,0 @@ -= "Merge Request ##{@merge_request.iid} was merged" - -Merge Request Url: #{namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request)} - -= merge_path_description(@merge_request, 'to') - -Author: #{@merge_request.author_name} -Assignee: #{@merge_request.assignee_name} diff --git a/app/views/notify/new_email_email.html.haml b/app/views/notify/new_email_email.html.haml deleted file mode 100644 index 4a0448a573c..00000000000 --- a/app/views/notify/new_email_email.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%p - Hi #{@user.name}! -%p - A new email was added to your account: -%p - email: - %code= @email.email -%p - If this email was added in error, you can remove it here: - = link_to "Emails", profile_emails_url diff --git a/app/views/notify/new_email_email.text.erb b/app/views/notify/new_email_email.text.erb deleted file mode 100644 index 51cba99ad0d..00000000000 --- a/app/views/notify/new_email_email.text.erb +++ /dev/null @@ -1,7 +0,0 @@ -Hi <%= @user.name %>! - -A new email was added to your account: - -email.................. <%= @email.email %> - -If this email was added in error, you can remove it here: <%= profile_emails_url %> diff --git a/app/views/notify/new_issue_email.html.haml b/app/views/notify/new_issue_email.html.haml deleted file mode 100644 index 53a068be52e..00000000000 --- a/app/views/notify/new_issue_email.html.haml +++ /dev/null @@ -1,6 +0,0 @@ --if @issue.description - = markdown(@issue.description, reference_only_path: false) - -- if @issue.assignee_id.present? - %p - Assignee: #{@issue.assignee_name} diff --git a/app/views/notify/new_issue_email.text.erb b/app/views/notify/new_issue_email.text.erb deleted file mode 100644 index 0cc62935498..00000000000 --- a/app/views/notify/new_issue_email.text.erb +++ /dev/null @@ -1,5 +0,0 @@ -New Issue was created. - -Issue <%= @issue.iid %>: <%= url_for(namespace_project_issue_url(@issue.project.namespace, @issue.project, @issue)) %> -Author: <%= @issue.author_name %> -Asignee: <%= @issue.assignee_name %> diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml deleted file mode 100644 index 5b7dd117c16..00000000000 --- a/app/views/notify/new_merge_request_email.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%p.details - != merge_path_description(@merge_request, '→') - -- if @merge_request.assignee_id.present? - %p - Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} - --if @merge_request.description - = markdown(@merge_request.description, reference_only_path: false) diff --git a/app/views/notify/new_merge_request_email.text.erb b/app/views/notify/new_merge_request_email.text.erb deleted file mode 100644 index f08039ad045..00000000000 --- a/app/views/notify/new_merge_request_email.text.erb +++ /dev/null @@ -1,8 +0,0 @@ -New Merge Request #<%= @merge_request.iid %> - -<%= url_for(namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request)) %> - -<%= merge_path_description(@merge_request, 'to') %> -Author: <%= @merge_request.author_name %> -Asignee: <%= @merge_request.assignee_name %> - diff --git a/app/views/notify/new_ssh_key_email.html.haml b/app/views/notify/new_ssh_key_email.html.haml deleted file mode 100644 index 63b0cbbd205..00000000000 --- a/app/views/notify/new_ssh_key_email.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%p - Hi #{@user.name}! -%p - A new public key was added to your account: -%p - title: - %code= @key.title -%p - If this key was added in error, you can remove it under - = link_to "SSH Keys", profile_keys_url diff --git a/app/views/notify/new_ssh_key_email.text.erb b/app/views/notify/new_ssh_key_email.text.erb deleted file mode 100644 index 05b551c89a0..00000000000 --- a/app/views/notify/new_ssh_key_email.text.erb +++ /dev/null @@ -1,7 +0,0 @@ -Hi <%= @user.name %>! - -A new public key was added to your account: - -Title: <%= @key.title %> - -If this key was added in error, you can remove it at <%= profile_keys_url %> diff --git a/app/views/notify/new_user_email.html.haml b/app/views/notify/new_user_email.html.haml deleted file mode 100644 index ebbe98dd472..00000000000 --- a/app/views/notify/new_user_email.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%p - Hi #{@user['name']}! -%p - - if Gitlab.config.gitlab.signup_enabled - Your account has been created successfully. - - else - The Administrator created an account for you. Now you are a member of the company GitLab application. -%p - login.......................................... - %code= @user['email'] - -- if @user.created_by_id - %p - = link_to "Click here to set your password", edit_password_url(@user, :reset_password_token => @token) diff --git a/app/views/notify/new_user_email.text.erb b/app/views/notify/new_user_email.text.erb deleted file mode 100644 index 96b26879a77..00000000000 --- a/app/views/notify/new_user_email.text.erb +++ /dev/null @@ -1,8 +0,0 @@ -Hi <%= @user.name %>! - -The Administrator created an account for you. Now you are a member of the company GitLab application. - -login.................. <%= @user.email %> -<% if @user.created_by_id %> - <%= link_to "Click here to set your password", edit_password_url(@user, :reset_password_token => @token) %> -<% end %> diff --git a/app/views/notify/note_commit_email.html.haml b/app/views/notify/note_commit_email.html.haml deleted file mode 100644 index 1d961e4424c..00000000000 --- a/app/views/notify/note_commit_email.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -= render 'note_message' - diff --git a/app/views/notify/note_commit_email.text.erb b/app/views/notify/note_commit_email.text.erb deleted file mode 100644 index aaeaf5fdf73..00000000000 --- a/app/views/notify/note_commit_email.text.erb +++ /dev/null @@ -1,9 +0,0 @@ -New comment for Commit <%= @commit.short_id %> - -<%= url_for(namespace_project_commit_url(@note.project.namespace, @note.project, id: @commit.id, anchor: "note_#{@note.id}")) %> - - -Author: <%= @note.author_name %> - -<%= @note.note %> - diff --git a/app/views/notify/note_issue_email.html.haml b/app/views/notify/note_issue_email.html.haml deleted file mode 100644 index 2fa2f784661..00000000000 --- a/app/views/notify/note_issue_email.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render 'note_message' diff --git a/app/views/notify/note_issue_email.text.erb b/app/views/notify/note_issue_email.text.erb deleted file mode 100644 index e33cbcd70f2..00000000000 --- a/app/views/notify/note_issue_email.text.erb +++ /dev/null @@ -1,9 +0,0 @@ -New comment for Issue <%= @issue.iid %> - -<%= url_for(namespace_project_issue_url(@issue.project.namespace, @issue.project, @issue, anchor: "note_#{@note.id}")) %> - - -Author: <%= @note.author_name %> - -<%= @note.note %> - diff --git a/app/views/notify/note_merge_request_email.html.haml b/app/views/notify/note_merge_request_email.html.haml deleted file mode 100644 index 65f0e4c4068..00000000000 --- a/app/views/notify/note_merge_request_email.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -- if @note.diff_file_name - %p.details - New comment on diff for - = link_to @note.diff_file_name, @target_url - \: - -= render 'note_message' diff --git a/app/views/notify/note_merge_request_email.text.erb b/app/views/notify/note_merge_request_email.text.erb deleted file mode 100644 index 1d1411992a6..00000000000 --- a/app/views/notify/note_merge_request_email.text.erb +++ /dev/null @@ -1,9 +0,0 @@ -New comment for Merge Request <%= @merge_request.iid %> - -<%= url_for(namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request, anchor: "note_#{@note.id}")) %> - - -<%= @note.author_name %> - -<%= @note.note %> - diff --git a/app/views/notify/project_access_granted_email.html.haml b/app/views/notify/project_access_granted_email.html.haml deleted file mode 100644 index dfc30a2d360..00000000000 --- a/app/views/notify/project_access_granted_email.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%p - = "You have been granted #{@project_member.human_access} access to project" -%p - = link_to namespace_project_url(@project.namespace, @project) do - = @project.name_with_namespace diff --git a/app/views/notify/project_access_granted_email.text.erb b/app/views/notify/project_access_granted_email.text.erb deleted file mode 100644 index 68eb1611ba7..00000000000 --- a/app/views/notify/project_access_granted_email.text.erb +++ /dev/null @@ -1,4 +0,0 @@ - -You have been granted <%= @project_member.human_access %> access to project <%= @project.name_with_namespace %> - -<%= url_for(namespace_project_url(@project.namespace, @project)) %> diff --git a/app/views/notify/project_invite_accepted_email.html.haml b/app/views/notify/project_invite_accepted_email.html.haml deleted file mode 100644 index 7e58d30b10a..00000000000 --- a/app/views/notify/project_invite_accepted_email.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%p - #{@project_member.invite_email}, now known as - #{link_to @project_member.user.name, user_url(@project_member.user)}, - has accepted your invitation to join project - #{link_to @project.name_with_namespace, namespace_project_url(@project.namespace, @project)}. - diff --git a/app/views/notify/project_invite_accepted_email.text.erb b/app/views/notify/project_invite_accepted_email.text.erb deleted file mode 100644 index fcbe752114d..00000000000 --- a/app/views/notify/project_invite_accepted_email.text.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= @project_member.invite_email %>, now known as <%= @project_member.user.name %>, has accepted your invitation to join project <%= @project.name_with_namespace %>. - -<%= namespace_project_url(@project.namespace, @project) %> diff --git a/app/views/notify/project_invite_declined_email.html.haml b/app/views/notify/project_invite_declined_email.html.haml deleted file mode 100644 index c2d7e6f6e3a..00000000000 --- a/app/views/notify/project_invite_declined_email.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%p - #{@invite_email} - has declined your invitation to join project - #{link_to @project.name_with_namespace, namespace_project_url(@project.namespace, @project)}. - diff --git a/app/views/notify/project_invite_declined_email.text.erb b/app/views/notify/project_invite_declined_email.text.erb deleted file mode 100644 index 484687fa51c..00000000000 --- a/app/views/notify/project_invite_declined_email.text.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= @invite_email %> has declined your invitation to join project <%= @project.name_with_namespace %>. - -<%= namespace_project_url(@project.namespace, @project) %> diff --git a/app/views/notify/project_member_invited_email.html.haml b/app/views/notify/project_member_invited_email.html.haml deleted file mode 100644 index 79eb89616de..00000000000 --- a/app/views/notify/project_member_invited_email.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%p - You have been invited - - if inviter = @project_member.created_by - by - = link_to inviter.name, user_url(inviter) - to join project - = link_to @project.name_with_namespace, namespace_project_url(@project.namespace, @project) - as #{@project_member.human_access}. - -%p - = link_to 'Accept invitation', invite_url(@token) - or - = link_to 'decline', decline_invite_url(@token) diff --git a/app/views/notify/project_member_invited_email.text.erb b/app/views/notify/project_member_invited_email.text.erb deleted file mode 100644 index e0706272115..00000000000 --- a/app/views/notify/project_member_invited_email.text.erb +++ /dev/null @@ -1,4 +0,0 @@ -You have been invited <%= "by #{@project_member.created_by.name} " if @project_member.created_by %>to join project <%= @project.name_with_namespace %> as <%= @project_member.human_access %>. - -Accept invitation: <%= invite_url(@token) %> -Decline invitation: <%= decline_invite_url(@token) %> diff --git a/app/views/notify/project_was_moved_email.html.haml b/app/views/notify/project_was_moved_email.html.haml deleted file mode 100644 index 3cd759f1f57..00000000000 --- a/app/views/notify/project_was_moved_email.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -%p - Project was moved to another location -%p - The project is now located under - = link_to namespace_project_url(@project.namespace, @project) do - = @project.name_with_namespace -%p - To update the remote url in your local repository run (for ssh): -%p{ style: "background: #f5f5f5; padding:10px; border:1px solid #ddd" } - git remote set-url origin #{@project.ssh_url_to_repo} -%p - or for http(s): -%p{ style: "background: #f5f5f5; padding:10px; border:1px solid #ddd" } - git remote set-url origin #{@project.http_url_to_repo} -%br diff --git a/app/views/notify/project_was_moved_email.text.erb b/app/views/notify/project_was_moved_email.text.erb deleted file mode 100644 index b3f18b35a4d..00000000000 --- a/app/views/notify/project_was_moved_email.text.erb +++ /dev/null @@ -1,10 +0,0 @@ -Project was moved to another location - -The project is now located under -<%= namespace_project_url(@project.namespace, @project) %> - - -To update the remote url in your local repository run (for ssh): - git remote set-url origin <%= @project.ssh_url_to_repo %> -or for http(s): - git remote set-url origin <%= @project.http_url_to_repo %> diff --git a/app/views/notify/reassigned_issue_email.html.haml b/app/views/notify/reassigned_issue_email.html.haml deleted file mode 100644 index 498ba8b8365..00000000000 --- a/app/views/notify/reassigned_issue_email.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render 'reassigned_issuable_email', issuable: @issue diff --git a/app/views/notify/reassigned_issue_email.text.erb b/app/views/notify/reassigned_issue_email.text.erb deleted file mode 100644 index 710253be984..00000000000 --- a/app/views/notify/reassigned_issue_email.text.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'reassigned_issuable_email', issuable: @issue %> diff --git a/app/views/notify/reassigned_merge_request_email.html.haml b/app/views/notify/reassigned_merge_request_email.html.haml deleted file mode 100644 index 2a650130f59..00000000000 --- a/app/views/notify/reassigned_merge_request_email.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render 'reassigned_issuable_email', issuable: @merge_request diff --git a/app/views/notify/reassigned_merge_request_email.text.erb b/app/views/notify/reassigned_merge_request_email.text.erb deleted file mode 100644 index b5b4f1ff99a..00000000000 --- a/app/views/notify/reassigned_merge_request_email.text.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'reassigned_issuable_email', issuable: @merge_request %> diff --git a/app/views/notify/repository_push_email.html.haml b/app/views/notify/repository_push_email.html.haml deleted file mode 100644 index a374a662333..00000000000 --- a/app/views/notify/repository_push_email.html.haml +++ /dev/null @@ -1,66 +0,0 @@ -%h3 #{@author.name} #{@action_name} #{@ref_type} #{@ref_name} at #{link_to @project.name_with_namespace, namespace_project_url(@project.namespace, @project)} - -- if @compare - - if @reverse_compare - %p - %strong WARNING: - The push did not contain any new commits, but force pushed to delete the commits and changes below. - - %h4 - = @reverse_compare ? "Deleted commits:" : "Commits:" - - %ul - - @commits.each do |commit| - %li - %strong #{link_to commit.short_id, namespace_project_commit_url(@project.namespace, @project, commit)} - %div - %span by #{commit.author_name} - %i at #{commit.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ")} - %pre.commit-message - = commit.safe_message - - %h4 #{pluralize @diffs.count, "changed file"}: - - %ul - - @diffs.each_with_index do |diff, i| - %li.file-stats - %a{href: "#{@target_url if @disable_diffs}#diff-#{i}" } - - if diff.deleted_file - %span.deleted-file - − - = diff.old_path - - elsif diff.renamed_file - = diff.old_path - → - = diff.new_path - - elsif diff.new_file - %span.new-file - + - = diff.new_path - - else - = diff.new_path - - - unless @disable_diffs - %h4 Changes: - - @diffs.each_with_index do |diff, i| - %li{id: "diff-#{i}"} - %a{href: @target_url + "#diff-#{i}"} - - if diff.deleted_file - %strong - = diff.old_path - deleted - - elsif diff.renamed_file - %strong - = diff.old_path - → - %strong - = diff.new_path - - else - %strong - = diff.new_path - %hr - = color_email_diff(diff.diff) - %br - - - if @compare.timeout - %h5 Huge diff. To prevent performance issues changes are hidden diff --git a/app/views/notify/repository_push_email.text.haml b/app/views/notify/repository_push_email.text.haml deleted file mode 100644 index 97a176ed2a3..00000000000 --- a/app/views/notify/repository_push_email.text.haml +++ /dev/null @@ -1,49 +0,0 @@ -#{@author.name} #{@action_name} #{@ref_type} #{@ref_name} at #{@project.name_with_namespace} -- if @compare - \ - \ - - if @reverse_compare - WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below. - \ - \ - = @reverse_compare ? "Deleted commits:" : "Commits:" - - @commits.each do |commit| - #{commit.short_id} by #{commit.author_name} at #{commit.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ")} - #{commit.safe_message} - \- - - - - - \ - \ - #{pluralize @diffs.count, "changed file"}: - \ - - @diffs.each do |diff| - - if diff.deleted_file - \- − #{diff.old_path} - - elsif diff.renamed_file - \- #{diff.old_path} → #{diff.new_path} - - elsif diff.new_file - \- + #{diff.new_path} - - else - \- #{diff.new_path} - - unless @disable_diffs - \ - \ - Changes: - - @diffs.each do |diff| - \ - \===================================== - - if diff.deleted_file - #{diff.old_path} deleted - - elsif diff.renamed_file - #{diff.old_path} → #{diff.new_path} - - else - = diff.new_path - \===================================== - != diff.diff - - if @compare.timeout - \ - \ - Huge diff. To prevent performance issues it was hidden - - if @target_url - \ - \ - View it on GitLab: #{@target_url} diff --git a/app/views/profiles/accounts/show.html.haml b/app/views/profiles/accounts/show.html.haml deleted file mode 100644 index 5bffb4acc1d..00000000000 --- a/app/views/profiles/accounts/show.html.haml +++ /dev/null @@ -1,77 +0,0 @@ -- if current_user.ldap_user? - .alert.alert-info - Some options are unavailable for LDAP accounts - -.account-page - %fieldset.update-token - %legend - Reset Private token - %div - = form_for @user, url: reset_private_token_profile_path, method: :put do |f| - .data - %p - Your private token is used to access application resources without authentication. - %br - It can be used for atom feeds or the API. - %span.cred - Keep it secret! - - %p.cgray - - if current_user.private_token - = text_field_tag "token", current_user.private_token, class: "form-control" - %div - = f.submit 'Reset private token', data: { confirm: "Are you sure?" }, class: "btn btn-primary btn-build-token" - - else - %span You don`t have one yet. Click generate to fix it. - = f.submit 'Generate', class: "btn success btn-build-token" - - - - if show_profile_social_tab? - %fieldset - %legend Connected Accounts - .oauth-buttons.append-bottom-10 - %p Click on icon to activate signin with one of the following services - - enabled_social_providers.each do |provider| - .btn-group - = link_to oauth_image_tag(provider), omniauth_authorize_path(User, provider), - class: "btn btn-lg #{'active' if oauth_active?(provider)}" - - if oauth_active?(provider) - = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do - %i.fa.fa-close - - - if show_profile_username_tab? - %fieldset.update-username - %legend - Change Username - = form_for @user, url: update_username_profile_path, method: :put, remote: true do |f| - %p - Changing your username will change path to all personal projects! - %div - = f.text_field :username, required: true, class: 'form-control' - - .loading-gif.hide - %p - %i.fa.fa-spinner.fa-spin - Saving new username - %p.light - = user_url(@user) - %div - = f.submit 'Save username', class: "btn btn-warning" - - - if show_profile_remove_tab? - %fieldset.remove-account - %legend - Remove account - %div - %p Deleting an account has the following effects: - %ul - %li All user content like authored issues, snippets, comments will be removed - - rp = current_user.personal_projects.count - - unless rp.zero? - %li #{pluralize rp, 'personal project'} will be removed and cannot be restored - - if current_user.solo_owned_groups.present? - %li - The following groups will be abandoned. You should transfer or remove them: - %strong #{current_user.solo_owned_groups.map(&:name).join(', ')} - = link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove" - diff --git a/app/views/profiles/applications.html.haml b/app/views/profiles/applications.html.haml deleted file mode 100644 index 97e98948f36..00000000000 --- a/app/views/profiles/applications.html.haml +++ /dev/null @@ -1,49 +0,0 @@ -%h3.page-title - Application Settings -%p.light - OAuth2 protocol settings below. - -%fieldset.oauth-applications - %legend Your applications - %p= link_to 'New Application', new_oauth_application_path, class: 'btn btn-success' - - if @applications.any? - %table.table.table-striped - %thead - %tr - %th Name - %th Callback URL - %th Clients - %th - %th - %tbody - - @applications.each do |application| - %tr{:id => "application_#{application.id}"} - %td= link_to application.name, oauth_application_path(application) - %td - - application.redirect_uri.split.each do |uri| - %div= uri - %td= application.access_tokens.count - %td= link_to 'Edit', edit_oauth_application_path(application), class: 'btn btn-link btn-sm' - %td= render 'doorkeeper/applications/delete_form', application: application - -%fieldset.oauth-authorized-applications.prepend-top-20 - %legend Authorized applications - - - if @authorized_tokens.any? - %table.table.table-striped - %thead - %tr - %th Name - %th Authorized At - %th Scope - %th - %tbody - - @authorized_apps.each do |app| - - token = app.authorized_tokens.order('created_at desc').first - %tr{:id => "application_#{app.id}"} - %td= app.name - %td= token.created_at - %td= token.scopes - %td= render 'doorkeeper/authorized_applications/delete_form', application: app - - else - %p.light You dont have any authorized applications diff --git a/app/views/profiles/design.html.haml b/app/views/profiles/design.html.haml deleted file mode 100644 index cc00d08d03b..00000000000 --- a/app/views/profiles/design.html.haml +++ /dev/null @@ -1,53 +0,0 @@ -%h3.page-title - Design Settings -%p.light - Appearance settings will be saved to your profile and made available across all devices. -%hr - -= form_for @user, url: profile_path, remote: true, method: :put do |f| - %fieldset.application-theme - %legend - Application theme - .themes_opts - = label_tag do - .prev.default - = f.radio_button :theme_id, 1 - Default - - = label_tag do - .prev.classic - = f.radio_button :theme_id, 2 - Classic - - = label_tag do - .prev.modern - = f.radio_button :theme_id, 3 - Modern - - = label_tag do - .prev.gray - = f.radio_button :theme_id, 4 - Gray - - = label_tag do - .prev.violet - = f.radio_button :theme_id, 5 - Violet - - = label_tag do - .prev.blue - = f.radio_button :theme_id, 6 - Blue - %br - .clearfix - - %fieldset.code-preview-theme - %legend - Code preview theme - .code_highlight_opts - - color_schemes.each do |color_scheme_id, color_scheme| - = label_tag do - .prev - = image_tag "#{color_scheme}-scheme-preview.png" - = f.radio_button :color_scheme_id, color_scheme_id - = color_scheme.gsub(/[-_]+/, ' ').humanize diff --git a/app/views/profiles/emails/index.html.haml b/app/views/profiles/emails/index.html.haml deleted file mode 100644 index 09f290429ea..00000000000 --- a/app/views/profiles/emails/index.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -%h3.page-title - Email Settings -%p.light - Your - %b Primary Email - will be used for avatar detection and web based operations, such as edits and merges. - %br - Your - %b Notification Email - will be used for account notifications. - %br - All email addresses will be used to identify your commits. - -%hr - -.panel.panel-default - .panel-heading - Emails (#{@emails.count + 1}) - %ul.well-list#emails-table - %li - %strong= @primary - %span.label.label-success Primary Email - - if @primary === @public_email - %span.label.label-info Public Email - - @emails.each do |email| - %li - %strong= email.email - - if email.email === @public_email - %span.label.label-info Public Email - %span.cgray - added #{time_ago_with_tooltip(email.created_at)} - = link_to 'Remove', profile_email_path(email), data: { confirm: 'Are you sure?'}, method: :delete, class: 'btn btn-sm btn-remove pull-right' - -%h4 Add email address -= form_for 'email', url: profile_emails_path, html: { class: 'form-horizontal' } do |f| - .form-group - = f.label :email, class: 'control-label' - .col-sm-10 - = f.text_field :email, class: 'form-control' - .form-actions - = f.submit 'Add email address', class: 'btn btn-create' diff --git a/app/views/profiles/history.html.haml b/app/views/profiles/history.html.haml deleted file mode 100644 index b1ab433f48f..00000000000 --- a/app/views/profiles/history.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%h3.page-title - Your Account History -%p.light - All events created by your account are listed below. -%hr -.profile_history - = render @events -%hr -= paginate @events, theme: "gitlab" - diff --git a/app/views/profiles/keys/_form.html.haml b/app/views/profiles/keys/_form.html.haml deleted file mode 100644 index f905417f0e2..00000000000 --- a/app/views/profiles/keys/_form.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -%div - = form_for [:profile, @key], html: { class: 'form-horizontal' } do |f| - - if @key.errors.any? - .alert.alert-danger - %ul - - @key.errors.full_messages.each do |msg| - %li= msg - - .form-group - = f.label :title, class: 'control-label' - .col-sm-10= f.text_field :title, class: "form-control" - .form-group - = f.label :key, class: 'control-label' - .col-sm-10 - = f.text_area :key, class: "form-control", rows: 8 - - - .form-actions - = f.submit 'Add key', class: "btn btn-create" - = link_to "Cancel", profile_keys_path, class: "btn btn-cancel" - diff --git a/app/views/profiles/keys/_key.html.haml b/app/views/profiles/keys/_key.html.haml deleted file mode 100644 index fe5770f45c3..00000000000 --- a/app/views/profiles/keys/_key.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -%tr - %td - = link_to path_to_key(key, is_admin) do - %strong= key.title - %td - %span - (#{key.fingerprint}) - %td - %span.cgray - added #{time_ago_with_tooltip(key.created_at)} - %td - = link_to 'Remove', path_to_key(key, is_admin), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-sm btn-remove delete-key pull-right" diff --git a/app/views/profiles/keys/_key_details.html.haml b/app/views/profiles/keys/_key_details.html.haml deleted file mode 100644 index 8bac22a2e1a..00000000000 --- a/app/views/profiles/keys/_key_details.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -- is_admin = defined?(admin) ? true : false -.row - .col-md-4 - .panel.panel-default - .panel-heading - SSH Key - %ul.well-list - %li - %span.light Title: - %strong= @key.title - %li - %span.light Created on: - %strong= @key.created_at.stamp("Aug 21, 2011") - - .col-md-8 - %p - %span.light Fingerprint: - %strong= @key.fingerprint - %pre.well-pre - = @key.key - .pull-right - = link_to 'Remove', path_to_key(@key, is_admin), data: {confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove delete-key" diff --git a/app/views/profiles/keys/_key_table.html.haml b/app/views/profiles/keys/_key_table.html.haml deleted file mode 100644 index ef0075aad3b..00000000000 --- a/app/views/profiles/keys/_key_table.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -- is_admin = defined?(admin) ? true : false -.panel.panel-default - - if @keys.any? - %table.table - %thead.panel-heading - %tr - %th Title - %th Fingerprint - %th Added at - %th - %tbody - - @keys.each do |key| - = render 'profiles/keys/key', key: key, is_admin: is_admin - - else - .nothing-here-block - - if is_admin - User has no ssh keys - - else - There are no SSH keys with access to your account. diff --git a/app/views/profiles/keys/index.html.haml b/app/views/profiles/keys/index.html.haml deleted file mode 100644 index 0904c50c88b..00000000000 --- a/app/views/profiles/keys/index.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%h3.page-title - SSH Keys Settings - .pull-right - = link_to "Add SSH Key", new_profile_key_path, class: "btn btn-new" -%p.light - Before you can add an SSH key you need to - = link_to "generate it.", help_page_path("ssh", "README") -%hr - -= render 'key_table' diff --git a/app/views/profiles/keys/new.html.haml b/app/views/profiles/keys/new.html.haml deleted file mode 100644 index ccec716d0c6..00000000000 --- a/app/views/profiles/keys/new.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3.page-title Add an SSH Key -%p.light - Paste your public key here. Read more about how to generate a key on #{link_to "the SSH help page", help_page_path("ssh", "README")}. -%hr -= render 'form' - -:javascript - $('#key_key').on('focusout', function(){ - var title = $('#key_title'), - val = $('#key_key').val(), - comment = val.match(/^\S+ \S+ (.+)$/); - - if( comment && comment.length > 1 && title.val() == '' ){ - $('#key_title').val( comment[1] ); - } - }); diff --git a/app/views/profiles/keys/show.html.haml b/app/views/profiles/keys/show.html.haml deleted file mode 100644 index cfd53298962..00000000000 --- a/app/views/profiles/keys/show.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "key_details" diff --git a/app/views/profiles/notifications/_settings.html.haml b/app/views/profiles/notifications/_settings.html.haml deleted file mode 100644 index 2c85d2a9b2b..00000000000 --- a/app/views/profiles/notifications/_settings.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -%li - %span.notification.fa.fa-holder - - if notification.global? - = notification_icon(@notification) - - else - = notification_icon(notification) - - %span.str-truncated - - if membership.kind_of? GroupMember - = link_to membership.group.name, membership.group - - else - = link_to_project(membership.project) - .pull-right - = form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do - = hidden_field_tag :notification_type, type, id: dom_id(membership, 'notification_type') - = hidden_field_tag :notification_id, membership.id, id: dom_id(membership, 'notification_id') - = select_tag :notification_level, options_for_select(Notification.options_with_labels, notification.level), class: 'trigger-submit' diff --git a/app/views/profiles/notifications/show.html.haml b/app/views/profiles/notifications/show.html.haml deleted file mode 100644 index 273e72f8a4d..00000000000 --- a/app/views/profiles/notifications/show.html.haml +++ /dev/null @@ -1,78 +0,0 @@ -%h3.page-title - Notifications Settings -%p.light - These are your global notification settings. -%hr - -= form_for @user, url: profile_notifications_path, method: :put, html: { class: 'update-notifications form-horizontal global-notifications-form' } do |f| - -if @user.errors.any? - %div.alert.alert-danger - %ul - - @user.errors.full_messages.each do |msg| - %li= msg - - = hidden_field_tag :notification_type, 'global' - - .form-group - = f.label :notification_email, class: "control-label" - .col-sm-10 - = f.select :notification_email, @user.all_emails, { include_blank: false }, class: "form-control" - - .form-group - = f.label :notification_level, class: 'control-label' - .col-sm-10 - .radio - = f.label :notification_level, value: Notification::N_DISABLED do - = f.radio_button :notification_level, Notification::N_DISABLED - .level-title - Disabled - %p You will not get any notifications via email - - .radio - = f.label :notification_level, value: Notification::N_MENTION do - = f.radio_button :notification_level, Notification::N_MENTION - .level-title - Mention - %p You will receive notifications only for comments in which you were @mentioned - - .radio - = f.label :notification_level, value: Notification::N_PARTICIPATING do - = f.radio_button :notification_level, Notification::N_PARTICIPATING - .level-title - Participating - %p You will only receive notifications from related resources (e.g. from your commits or assigned issues) - - .radio - = f.label :notification_level, value: Notification::N_WATCH do - = f.radio_button :notification_level, Notification::N_WATCH - .level-title - Watch - %p You will receive all notifications from projects in which you participate - - .form-actions - = f.submit 'Save changes', class: "btn btn-create" - -.clearfix - %hr -.row.all-notifications - .col-md-6 - %p - You can also specify notification level per group or per project. - %br - By default, all projects and groups will use the notification level set above. - %h4 Groups: - %ul.bordered-list - - @group_members.each do |group_member| - - notification = Notification.new(group_member) - = render 'settings', type: 'group', membership: group_member, notification: notification - - .col-md-6 - %p - To specify the notification level per project of a group you belong to, - %br - you need to be a member of the project itself, not only its group. - %h4 Projects: - %ul.bordered-list - - @project_members.each do |project_member| - - notification = Notification.new(project_member) - = render 'settings', type: 'project', membership: project_member, notification: notification diff --git a/app/views/profiles/notifications/update.js.haml b/app/views/profiles/notifications/update.js.haml deleted file mode 100644 index 84c6ab25599..00000000000 --- a/app/views/profiles/notifications/update.js.haml +++ /dev/null @@ -1,6 +0,0 @@ -- if @saved - :plain - new Flash("Notification settings saved", "notice") -- else - :plain - new Flash("Failed to save new settings", "alert") diff --git a/app/views/profiles/passwords/edit.html.haml b/app/views/profiles/passwords/edit.html.haml deleted file mode 100644 index 4b04b113e89..00000000000 --- a/app/views/profiles/passwords/edit.html.haml +++ /dev/null @@ -1,38 +0,0 @@ -%h3.page-title Password Settings -%p.light - - if @user.password_automatically_set? - Set your password. - - else - Change your password or recover your current one. -%hr -.update-password - = form_for @user, url: profile_password_path, method: :put, html: { class: 'form-horizontal' } do |f| - %div - %p.slead - - unless @user.password_automatically_set? - You must provide current password in order to change it. - %br - After a successful password update, you will be redirected to the login page where you can log in with your new password. - -if @user.errors.any? - .alert.alert-danger - %ul - - @user.errors.full_messages.each do |msg| - %li= msg - - unless @user.password_automatically_set? - .form-group - = f.label :current_password, class: 'control-label' - .col-sm-10 - = f.password_field :current_password, required: true, class: 'form-control' - %div - = link_to "Forgot your password?", reset_profile_password_path, method: :put - - .form-group - = f.label :password, 'New password', class: 'control-label' - .col-sm-10 - = f.password_field :password, required: true, class: 'form-control' - .form-group - = f.label :password_confirmation, class: 'control-label' - .col-sm-10 - = f.password_field :password_confirmation, required: true, class: 'form-control' - .form-actions - = f.submit 'Save password', class: "btn btn-create" diff --git a/app/views/profiles/passwords/new.html.haml b/app/views/profiles/passwords/new.html.haml deleted file mode 100644 index 8bed6e0dbee..00000000000 --- a/app/views/profiles/passwords/new.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -%h3.page-title Setup new password -%hr -= form_for @user, url: profile_password_path, method: :post, html: { class: 'form-horizontal '} do |f| - %p.slead - Please set a new password before proceeding. - %br - After a successful password update you will be redirected to login screen. - -if @user.errors.any? - .alert.alert-danger - %ul - - @user.errors.full_messages.each do |msg| - %li= msg - - - unless @user.password_automatically_set? - .form-group - = f.label :current_password, class: 'control-label' - .col-sm-10= f.password_field :current_password, required: true, class: 'form-control' - .form-group - = f.label :password, class: 'control-label' - .col-sm-10= f.password_field :password, required: true, class: 'form-control' - .form-group - = f.label :password_confirmation, class: 'control-label' - .col-sm-10 - = f.password_field :password_confirmation, required: true, class: 'form-control' - .form-actions - = f.submit 'Set new password', class: "btn btn-create" diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml deleted file mode 100644 index 6c745e69e40..00000000000 --- a/app/views/profiles/show.html.haml +++ /dev/null @@ -1,110 +0,0 @@ -%h3.page-title - Profile Settings -%p.light - This information will appear on your profile. - - if current_user.ldap_user? - Some options are unavailable for LDAP accounts -%hr - - - -= form_for @user, url: profile_path, method: :put, html: { multipart: true, class: "edit_user form-horizontal" }, authenticity_token: true do |f| - -if @user.errors.any? - %div.alert.alert-danger - %ul - - @user.errors.full_messages.each do |msg| - %li= msg - .row - .col-md-7 - .form-group - = f.label :name, class: "control-label" - .col-sm-10 - = f.text_field :name, class: "form-control", required: true - %span.help-block Enter your name, so people you know can recognize you. - - .form-group - = f.label :email, class: "control-label" - .col-sm-10 - - if @user.ldap_user? - = f.text_field :email, class: "form-control", required: true, readonly: true - %span.help-block.light - Email is read-only for LDAP user - - else - - if @user.temp_oauth_email? - = f.text_field :email, class: "form-control", required: true, value: nil - - else - = f.text_field :email, class: "form-control", required: true - - if @user.unconfirmed_email.present? - %span.help-block - Please click the link in the confirmation email before continuing, it was sent to - %strong #{@user.unconfirmed_email} - - - else - %span.help-block We also use email for avatar detection if no avatar is uploaded. - .form-group - = f.label :public_email, class: "control-label" - .col-sm-10 - = f.select :public_email, options_for_select(@user.all_emails, selected: @user.public_email), {include_blank: 'Do not show in profile'}, class: "form-control" - %span.help-block This email will be displayed on your public profile. - .form-group - = f.label :skype, class: "control-label" - .col-sm-10= f.text_field :skype, class: "form-control" - .form-group - = f.label :linkedin, class: "control-label" - .col-sm-10= f.text_field :linkedin, class: "form-control" - .form-group - = f.label :twitter, class: "control-label" - .col-sm-10= f.text_field :twitter, class: "form-control" - .form-group - = f.label :website_url, 'Website', class: "control-label" - .col-sm-10= f.text_field :website_url, class: "form-control" - .form-group - = f.label :location, 'Location', class: "control-label" - .col-sm-10= f.text_field :location, class: "form-control" - .form-group - = f.label :bio, class: "control-label" - .col-sm-10 - = f.text_area :bio, rows: 4, class: "form-control", maxlength: 250 - %span.help-block Tell us about yourself in fewer than 250 characters. - - .col-md-5 - .light-well - = image_tag avatar_icon(@user.email, 160), alt: '', class: 'avatar s160' - - .clearfix - .profile-avatar-form-option - %p.light - - if @user.avatar? - You can change your avatar here - - if Gitlab.config.gravatar.enabled - %br - or remove the current avatar to revert to #{link_to "gravatar.com", "http://gravatar.com"} - - else - You can upload an avatar here - - if Gitlab.config.gravatar.enabled - %br - or change it at #{link_to "gravatar.com", "http://gravatar.com"} - %hr - %a.choose-btn.btn.btn-sm.js-choose-user-avatar-button - %i.fa.fa-paperclip - %span Choose File ... - - %span.file_name.js-avatar-filename File name... - = f.file_field :avatar, class: "js-user-avatar-input hidden" - .light The maximum file size allowed is 200KB. - - if @user.avatar? - %hr - = link_to 'Remove avatar', profile_avatar_path, data: { confirm: "Avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-sm remove-avatar" - - - if @user.public_profile? - .alert.alert-info - %h4 Public profile - %p Your profile is publicly visible because you joined public project(s) - - - .row - .col-md-7 - .form-group - .col-sm-2 - .col-sm-10 - = f.submit 'Save changes', class: "btn btn-success" diff --git a/app/views/profiles/update.js.erb b/app/views/profiles/update.js.erb deleted file mode 100644 index e664ac2a52a..00000000000 --- a/app/views/profiles/update.js.erb +++ /dev/null @@ -1,9 +0,0 @@ -// Remove body class for any previous theme, re-add current one -$('body').removeClass('ui_basic ui_mars ui_modern ui_gray ui_color light_theme dark_theme') -$('body').addClass('<%= app_theme %> <%= theme_type %>') - -// Re-render the header to reflect the new theme -$('header').html('<%= escape_javascript(render("layouts/head_panel", title: "Profile")) %>') - -// Re-initialize header tooltips -$('.has_bottom_tooltip').tooltip({placement: 'bottom'}) diff --git a/app/views/profiles/update_username.js.haml b/app/views/profiles/update_username.js.haml deleted file mode 100644 index 249680bcab6..00000000000 --- a/app/views/profiles/update_username.js.haml +++ /dev/null @@ -1,6 +0,0 @@ -- if @user.valid? - :plain - new Flash("Username sucessfully changed", "notice") -- else - :plain - new Flash("Username change failed - #{@user.errors.full_messages.first}", "alert") diff --git a/app/views/projects/_bitbucket_import_modal.html.haml b/app/views/projects/_bitbucket_import_modal.html.haml deleted file mode 100644 index 07d4d602769..00000000000 --- a/app/views/projects/_bitbucket_import_modal.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%div#bitbucket_import_modal.modal.hide - .modal-dialog - .modal-content - .modal-header - %a.close{href: "#", "data-dismiss" => "modal"} × - %h3 Import projects from Bitbucket - .modal-body - To enable importing projects from Bitbucket, - - if current_user.admin? - you need to - - else - your GitLab administrator needs to - == #{link_to 'setup OAuth integration', 'https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/integration/bitbucket.md'}. diff --git a/app/views/projects/_commit_button.html.haml b/app/views/projects/_commit_button.html.haml deleted file mode 100644 index 35f7e7bb34b..00000000000 --- a/app/views/projects/_commit_button.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.form-actions - .commit-button-annotation - = button_tag 'Commit Changes', - class: 'btn commit-btn js-commit-button btn-create' - = link_to 'Cancel', cancel_path, - class: 'btn btn-cancel', data: {confirm: leave_edit_message} diff --git a/app/views/projects/_dropdown.html.haml b/app/views/projects/_dropdown.html.haml deleted file mode 100644 index 3036f11bb2d..00000000000 --- a/app/views/projects/_dropdown.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -- if current_user - .dropdown.pull-right - %a.dropdown-toggle.btn.btn-new{href: '#', "data-toggle" => "dropdown"} - %i.fa.fa-bars - %ul.dropdown-menu - - if @project.issues_enabled && can?(current_user, :write_issue, @project) - %li - = link_to url_for_new_issue(@project, only_path: true), title: "New Issue" do - %i.fa.fa-fw.fa-exclamation-circle - New issue - - if @project.merge_requests_enabled && can?(current_user, :write_merge_request, @project) - %li - = link_to new_namespace_project_merge_request_path(@project.namespace, @project), title: "New Merge Request" do - %i.fa.fa-fw.fa-tasks - New merge request - - if @project.snippets_enabled && can?(current_user, :write_snippet, @project) - %li - = link_to new_namespace_project_snippet_path(@project.namespace, @project), title: "New Snippet" do - %i.fa.fa-fw.fa-file-text-o - New snippet - - if can?(current_user, :admin_project_member, @project) - %li - = link_to namespace_project_project_members_path(@project.namespace, @project), title: "New project member" do - %i.fa.fa-fw.fa-users - New project member - - if can? current_user, :push_code, @project - %li.divider - %li - = link_to new_namespace_project_branch_path(@project.namespace, @project) do - %i.fa.fa-fw.fa-code-fork - New branch - %li - = link_to new_namespace_project_tag_path(@project.namespace, @project) do - %i.fa.fa-fw.fa-tag - New tag - - diff --git a/app/views/projects/_errors.html.haml b/app/views/projects/_errors.html.haml deleted file mode 100644 index 7c8bb33ed7e..00000000000 --- a/app/views/projects/_errors.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- if @project.errors.any? - .alert.alert-danger - %button{ type: "button", class: "close", "data-dismiss" => "alert"} × - = @project.errors.full_messages.first diff --git a/app/views/projects/_github_import_modal.html.haml b/app/views/projects/_github_import_modal.html.haml deleted file mode 100644 index e88a0f7d689..00000000000 --- a/app/views/projects/_github_import_modal.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%div#github_import_modal.modal.hide - .modal-dialog - .modal-content - .modal-header - %a.close{href: "#", "data-dismiss" => "modal"} × - %h3 Import projects from GitHub - .modal-body - To enable importing projects from GitHub, - - if current_user.admin? - you need to - - else - your GitLab administrator needs to - == #{link_to 'setup OAuth integration', 'https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/integration/github.md'}.
\ No newline at end of file diff --git a/app/views/projects/_gitlab_import_modal.html.haml b/app/views/projects/_gitlab_import_modal.html.haml deleted file mode 100644 index 52212b6ae02..00000000000 --- a/app/views/projects/_gitlab_import_modal.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%div#gitlab_import_modal.modal.hide - .modal-dialog - .modal-content - .modal-header - %a.close{href: "#", "data-dismiss" => "modal"} × - %h3 Import projects from GitLab.com - .modal-body - To enable importing projects from GitLab.com, - - if current_user.admin? - you need to - - else - your GitLab administrator needs to - == #{link_to 'setup OAuth integration', 'https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/integration/gitlab.md'}.
\ No newline at end of file diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml deleted file mode 100644 index 5689bdee1c6..00000000000 --- a/app/views/projects/_home_panel.html.haml +++ /dev/null @@ -1,43 +0,0 @@ -- empty_repo = @project.empty_repo? -.project-home-panel{:class => ("empty-project" if empty_repo)} - .project-identicon-holder - = project_icon(@project, alt: '', class: 'avatar project-avatar') - .project-home-row.project-home-row-top - .project-home-desc - - if @project.description.present? - = escaped_autolink(@project.description) - - if can?(current_user, :admin_project, @project) - – - = link_to 'Edit', edit_namespace_project_path - - elsif !@project.empty_repo? && @repository.readme - - readme = @repository.readme - – - = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)) do - = readme.name - .project-repo-buttons - .inline.star.js-toggler-container{class: @show_star ? 'on' : ''} - - if current_user - = link_to_toggle_star('Star this project.', false) - = link_to_toggle_star('Unstar this project.', true) - - else - = link_to new_user_session_path, class: 'btn star-btn has_tooltip', title: 'You must sign in to star a project' do - %span - = icon('star') - Star - %span.count - = @project.star_count - - unless @project.empty_repo? - - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace - .inline.fork-buttons.prepend-left-10 - - if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2 - = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn btn-sm btn-default' do - = link_to_toggle_fork - - else - = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn btn-sm btn-default' do - = link_to_toggle_fork - - .project-home-row.hidden-xs - - if current_user && !empty_repo - .project-home-dropdown - = render "dropdown" - = render "shared/clone_panel" diff --git a/app/views/projects/_issuable_form.html.haml b/app/views/projects/_issuable_form.html.haml deleted file mode 100644 index e321a84974e..00000000000 --- a/app/views/projects/_issuable_form.html.haml +++ /dev/null @@ -1,87 +0,0 @@ -- if issuable.errors.any? - .row - .col-sm-10.col-sm-offset-2 - .alert.alert-danger - - issuable.errors.full_messages.each do |msg| - %span= msg - %br -.form-group - = f.label :title, class: 'control-label' do - %strong= 'Title *' - .col-sm-10 - = f.text_field :title, maxlength: 255, autofocus: true, - class: 'form-control pad js-gfm-input', required: true -.form-group.issuable-description - = f.label :description, 'Description', class: 'control-label' - .col-sm-10 - - = render layout: 'projects/md_preview', locals: { preview_class: "wiki" } do - = render 'projects/zen', f: f, attr: :description, - classes: 'description form-control' - .col-sm-12.hint - .pull-left - Parsed with - #{link_to 'GitLab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}. - .pull-right - Attach files by dragging & dropping - or #{link_to 'selecting them', '#', class: 'markdown-selector' }. - - .clearfix - .error-alert -%hr -.form-group - .issue-assignee - = f.label :assignee_id, class: 'control-label' do - %i.fa.fa-user - Assign to - .col-sm-10 - = users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]", - placeholder: 'Select a user', class: 'custom-form-control', null_user: true, - selected: issuable.assignee_id) - - = link_to 'Assign to me', '#', class: 'btn assign-to-me-link' -.form-group - .issue-milestone - = f.label :milestone_id, class: 'control-label' do - %i.fa.fa-clock-o - Milestone - .col-sm-10 - - if milestone_options(issuable).present? - = f.select(:milestone_id, milestone_options(issuable), - { include_blank: 'Select milestone' }, { class: 'select2' }) - - else - .prepend-top-10 - %span.light No open milestones available. - - - if can? current_user, :admin_milestone, issuable.project - = link_to 'Create new milestone', new_namespace_project_milestone_path(issuable.project.namespace, issuable.project), target: :blank -.form-group - = f.label :label_ids, class: 'control-label' do - %i.fa.fa-tag - Labels - .col-sm-10 - - if issuable.project.labels.any? - = f.collection_select :label_ids, issuable.project.labels.all, :id, :name, - { selected: issuable.label_ids }, multiple: true, class: 'select2' - - else - .prepend-top-10 - %span.light No labels yet. - - - if can? current_user, :admin_label, issuable.project - = link_to 'Create new label', new_namespace_project_label_path(issuable.project.namespace, issuable.project), target: :blank - -.form-actions - - if !issuable.project.empty_repo? && (guide_url = contribution_guide_url(issuable.project)) && !issuable.persisted? - %p - Please review the - %strong #{link_to 'guidelines for contribution', guide_url} - to this repository. - - if issuable.new_record? - = f.submit "Submit new #{issuable.class.model_name.human.downcase}", class: 'btn btn-create' - - else - = f.submit 'Save changes', class: 'btn btn-save' - - if issuable.new_record? - - cancel_project = issuable.source_project - - else - - cancel_project = issuable.project - = link_to 'Cancel', [cancel_project.namespace.becomes(Namespace), cancel_project, issuable], class: 'btn btn-cancel' diff --git a/app/views/projects/_md_preview.html.haml b/app/views/projects/_md_preview.html.haml deleted file mode 100644 index f356a25dbfa..00000000000 --- a/app/views/projects/_md_preview.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%ul.nav.nav-tabs - %li.active - = link_to '#md-write-holder', class: 'js-md-write-button' do - Write - %li - = link_to '#md-preview-holder', class: 'js-md-preview-button', - data: { url: markdown_preview_namespace_project_path(@project.namespace, @project) } do - Preview -%div - .md-write-holder - = yield - .md-preview-holder.hide - .js-md-preview{class: (preview_class if defined?(preview_class))} diff --git a/app/views/projects/_settings_nav.html.haml b/app/views/projects/_settings_nav.html.haml deleted file mode 100644 index 281a84a3d3c..00000000000 --- a/app/views/projects/_settings_nav.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -%ul.project-settings-nav.sidebar-subnav - = nav_link(path: 'projects#edit') do - = link_to edit_project_path(@project), title: 'Project', class: "stat-tab tab " do - %i.fa.fa-pencil-square-o - %span - Project - = nav_link(controller: [:project_members, :teams]) do - = link_to namespace_project_project_members_path(@project.namespace, @project), title: 'Members', class: "team-tab tab" do - %i.fa.fa-users - %span - Members - = nav_link(controller: :deploy_keys) do - = link_to namespace_project_deploy_keys_path(@project.namespace, @project), title: 'Deploy Keys' do - %i.fa.fa-key - %span - Deploy Keys - = nav_link(controller: :hooks) do - = link_to namespace_project_hooks_path(@project.namespace, @project), title: 'Web Hooks' do - %i.fa.fa-link - %span - Web Hooks - = nav_link(controller: :services) do - = link_to namespace_project_services_path(@project.namespace, @project), title: 'Services' do - %i.fa.fa-cogs - %span - Services - = nav_link(controller: :protected_branches) do - = link_to namespace_project_protected_branches_path(@project.namespace, @project), title: 'Protected Branches' do - %i.fa.fa-lock - %span - Protected branches diff --git a/app/views/projects/_visibility_level.html.haml b/app/views/projects/_visibility_level.html.haml deleted file mode 100644 index 42c8e685224..00000000000 --- a/app/views/projects/_visibility_level.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -.form-group.project-visibility-level-holder - = f.label :visibility_level, class: 'control-label' do - Visibility Level - = link_to "(?)", help_page_path("public_access", "public_access") - .col-sm-10 - - if can_change_visibility_level - - Gitlab::VisibilityLevel.values.each do |level| - .radio - - restricted = restricted_visibility_levels.include?(level) - = label :project_visibility_level, level do - = f.radio_button :visibility_level, level, checked: (visibility_level == level), disabled: restricted - = visibility_level_icon(level) - .option-title - = visibility_level_label(level) - .option-descr - = visibility_level_description(level) - - unless restricted_visibility_levels.empty? - .col-sm-10 - %span.info - Some visibility level settings have been restricted by the administrator. - - else - .col-sm-10 - %span.info - = visibility_level_icon(visibility_level) - %strong - = visibility_level_label(visibility_level) - .light= visibility_level_description(visibility_level) diff --git a/app/views/projects/_zen.html.haml b/app/views/projects/_zen.html.haml deleted file mode 100644 index cf1c55ecca6..00000000000 --- a/app/views/projects/_zen.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -.zennable - %input#zen-toggle-comment.zen-toggle-comment{ tabindex: '-1', type: 'checkbox' } - .zen-backdrop - - classes << ' js-gfm-input markdown-area' - = f.text_area attr, class: classes, placeholder: 'Leave a comment' - = link_to nil, class: 'zen-enter-link', tabindex: '-1' do - %i.fa.fa-expand - Edit in fullscreen - = link_to nil, class: 'zen-leave-link' do - %i.fa.fa-compress diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml deleted file mode 100644 index e6a859fea8f..00000000000 --- a/app/views/projects/blame/show.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -%h3.page-title Blame view - -#tree-holder.tree-holder - .file-holder - .file-title - %i.fa.fa-file - %strong - = @path - %small= number_to_human_size @blob.size - .file-actions - = render "projects/blob/actions" - .file-content.blame.highlight - %table - - @blame.each do |commit, lines, since| - - commit = Commit.new(commit) - %tr - %td.blame-commit - %span.commit - = link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "commit_short_id" - - = commit_author_link(commit, avatar: true, size: 16) - - = link_to_gfm truncate(commit.title, length: 20), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "row_title" - %td.lines.blame-numbers - %pre - - (since...(since + lines.count)).each do |i| - = i - \ - %td.lines - %pre{class: 'code highlight white'} - %code - :erb - <% lines.each do |line| %> - <%= highlight(@blob.name, line, true).html_safe %> - <% end %> diff --git a/app/views/projects/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml deleted file mode 100644 index 13f8271b979..00000000000 --- a/app/views/projects/blob/_actions.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -.btn-group.tree-btn-group - = edit_blob_link(@project, @ref, @path) - = link_to 'Raw', namespace_project_raw_path(@project.namespace, @project, @id), - class: 'btn btn-sm', target: '_blank' - -# only show normal/blame view links for text files - - if @blob.text? - - if current_page? namespace_project_blame_path(@project.namespace, @project, @id) - = link_to 'Normal View', namespace_project_blob_path(@project.namespace, @project, @id), - class: 'btn btn-sm' - - else - = link_to 'Blame', namespace_project_blame_path(@project.namespace, @project, @id), - class: 'btn btn-sm' unless @blob.empty? - = link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id), - class: 'btn btn-sm' - - if @ref != @commit.sha - = link_to 'Permalink', namespace_project_blob_path(@project.namespace, @project, - tree_join(@commit.sha, @path)), class: 'btn btn-sm' - -- if allowed_tree_edit? - = button_tag class: 'remove-blob btn btn-sm btn-remove', - 'data-toggle' => 'modal', 'data-target' => '#modal-remove-blob' do - Remove diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml deleted file mode 100644 index 65c3ab10e02..00000000000 --- a/app/views/projects/blob/_blob.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -%ul.breadcrumb.repo-breadcrumb - %li - %i.fa.fa-angle-right - = link_to namespace_project_tree_path(@project.namespace, @project, @ref) do - = @project.path - - tree_breadcrumbs(@tree, 6) do |title, path| - %li - - if path - - if path.end_with?(@path) - = link_to namespace_project_blob_path(@project.namespace, @project, path) do - %strong - = truncate(title, length: 40) - - else - = link_to truncate(title, length: 40), namespace_project_tree_path(@project.namespace, @project, path) - - else - = link_to title, '#' - -%ul.blob-commit-info.well.hidden-xs - - blob_commit = @repository.last_commit_for_path(@commit.id, blob.path) - = render blob_commit, project: @project - -%div#tree-content-holder.tree-content-holder - %article.file-holder - .file-title - = blob_icon blob.mode, blob.name - %strong - = blob.name - %small - = number_to_human_size(blob.size) - .file-actions.hidden-xs - = render "actions" - - if blob.text? - = render "text", blob: blob - - elsif blob.image? - = render "image", blob: blob - - else - = render "download", blob: blob diff --git a/app/views/projects/blob/_download.html.haml b/app/views/projects/blob/_download.html.haml deleted file mode 100644 index f2c5e95ecf4..00000000000 --- a/app/views/projects/blob/_download.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -.file-content.blob_file.blob-no-preview - .center - = link_to namespace_project_raw_path(@project.namespace, @project, @id) do - %h1.light - %i.fa.fa-download - %h4 - Download (#{number_to_human_size blob.size}) diff --git a/app/views/projects/blob/_editor.html.haml b/app/views/projects/blob/_editor.html.haml deleted file mode 100644 index 96f188e4aa7..00000000000 --- a/app/views/projects/blob/_editor.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -.file-holder.file - .file-title - .editor-ref - %i.fa.fa-code-fork - = ref - %span.editor-file-name - - if @path - %span.monospace - = @path - - - if current_action?(:new) || current_action?(:create) - \/ - = text_field_tag 'file_name', params[:file_name], placeholder: "File name", - required: true, class: 'form-control new-file-name' - .pull-right - = select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control' - - .file-content.code - %pre.js-edit-mode-pane#editor - = params[:content] || local_assigns[:blob_data] - - if local_assigns[:path] - .js-edit-mode-pane#preview.hide - .center - %h2 - %i.icon-spinner.icon-spin diff --git a/app/views/projects/blob/_image.html.haml b/app/views/projects/blob/_image.html.haml deleted file mode 100644 index c090f690d1d..00000000000 --- a/app/views/projects/blob/_image.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -.file-content.image_file - %img{ src: "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}"} diff --git a/app/views/projects/blob/_remove.html.haml b/app/views/projects/blob/_remove.html.haml deleted file mode 100644 index 09559a4967b..00000000000 --- a/app/views/projects/blob/_remove.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -#modal-remove-blob.modal.hide - .modal-dialog - .modal-content - .modal-header - %a.close{href: "#", "data-dismiss" => "modal"} × - %h3.page-title Remove #{@blob.name} - %p.light - From branch - %strong= @ref - - .modal-body - = form_tag namespace_project_blob_path(@project.namespace, @project, @id), method: :delete, class: 'form-horizontal' do - = render 'shared/commit_message_container', params: params, - placeholder: 'Removed this file because...' - .form-group - .col-sm-2 - .col-sm-10 - = button_tag 'Remove file', class: 'btn btn-remove btn-remove-file' - = link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal" - -:javascript - disableButtonIfEmptyField('#commit_message', '.btn-remove-file') diff --git a/app/views/projects/blob/_text.html.haml b/app/views/projects/blob/_text.html.haml deleted file mode 100644 index f6bd62f239b..00000000000 --- a/app/views/projects/blob/_text.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- if gitlab_markdown?(blob.name) - .file-content.wiki - = preserve do - = markdown(blob.data) -- elsif markup?(blob.name) - .file-content.wiki - = render_markup(blob.name, blob.data) -- else - .file-content.code - - unless blob.empty? - = render 'shared/file_highlight', blob: blob - - else - .nothing-here-block Empty file diff --git a/app/views/projects/blob/diff.html.haml b/app/views/projects/blob/diff.html.haml deleted file mode 100644 index 5c79d0ef11f..00000000000 --- a/app/views/projects/blob/diff.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -- if @lines.present? - - if @form.unfold? && @form.since != 1 && !@form.bottom? - %tr.line_holder{ id: @form.since } - = render "projects/diffs/match_line", {line: @match_line, - line_old: @form.since, line_new: @form.since, bottom: false} - - - @lines.each_with_index do |line, index| - - line_new = index + @form.since - - line_old = line_new - @form.offset - %tr.line_holder - %td.old_line.diff-line-num{data: {linenumber: line_old}} - = link_to raw(line_old), "#" - %td.new_line= link_to raw(line_new) , "#" - %td.line_content.noteable_line= line - - - if @form.unfold? && @form.bottom? && @form.to < @blob.loc - %tr.line_holder{ id: @form.to } - = render "projects/diffs/match_line", {line: @match_line, - line_old: @form.to, line_new: @form.to, bottom: true} diff --git a/app/views/projects/blob/edit.html.haml b/app/views/projects/blob/edit.html.haml deleted file mode 100644 index 1f61a0b940c..00000000000 --- a/app/views/projects/blob/edit.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -.file-editor - %ul.nav.nav-tabs.js-edit-mode - %li.active - = link_to '#editor' do - %i.fa.fa-edit - Edit file - - %li - = link_to '#preview', 'data-preview-url' => namespace_project_preview_blob_path(@project.namespace, @project, @id) do - %i.fa.fa-eye - = editing_preview_title(@blob.name) - - = form_tag(namespace_project_update_blob_path(@project.namespace, @project, @id), method: :put, class: "form-horizontal") do - = render 'projects/blob/editor', ref: @ref, path: @path, blob_data: @blob.data - = render 'shared/commit_message_container', params: params, - placeholder: "Update #{@blob.name}" - - .form-group.branch - = label_tag 'branch', class: 'control-label' do - Branch - .col-sm-10 - = text_field_tag 'new_branch', @ref, class: "form-control" - - = hidden_field_tag 'last_commit', @last_commit - = hidden_field_tag 'content', '', id: "file-content" - = hidden_field_tag 'from_merge_request_id', params[:from_merge_request_id] - = render 'projects/commit_button', ref: @ref, - cancel_path: @after_edit_path - -:javascript - blob = new EditBlob(gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}", "#{@blob.language.try(:ace_mode)}") diff --git a/app/views/projects/blob/new.html.haml b/app/views/projects/blob/new.html.haml deleted file mode 100644 index d78a01f6422..00000000000 --- a/app/views/projects/blob/new.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -%h3.page-title New file -.file-editor - = form_tag(namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'form-horizontal form-new-file') do - = render 'projects/blob/editor', ref: @ref - = render 'shared/commit_message_container', params: params, - placeholder: 'Add new file' - - .form-group.branch - = label_tag 'branch', class: 'control-label' do - Branch - .col-sm-10 - = text_field_tag 'new_branch', @ref, class: "form-control" - - = hidden_field_tag 'content', '', id: 'file-content' - = render 'projects/commit_button', ref: @ref, - cancel_path: namespace_project_tree_path(@project.namespace, @project, @id) - -:javascript - blob = new NewBlob(gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}", null) diff --git a/app/views/projects/blob/preview.html.haml b/app/views/projects/blob/preview.html.haml deleted file mode 100644 index e7c3460ad78..00000000000 --- a/app/views/projects/blob/preview.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -.diff-file - .diff-content - - if gitlab_markdown?(@blob.name) - .file-content.wiki - = preserve do - = markdown(@content) - - elsif markup?(@blob.name) - .file-content.wiki - = raw render_markup(@blob.name, @content) - - else - .file-content.code - - unless @diff_lines.empty? - %table.text-file - - @diff_lines.each do |line| - %tr.line_holder{ class: "#{line.type}" } - - if line.type == "match" - %td.old_line= "..." - %td.new_line= "..." - %td.line_content.matched= line.text - - else - %td.old_line - %td.new_line - %td.line_content{class: "#{line.type}"}= raw diff_line_content(line.text) - - else - .nothing-here-block No changes. diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml deleted file mode 100644 index 69167654c39..00000000000 --- a/app/views/projects/blob/show.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%div.tree-ref-holder - = render 'shared/ref_switcher', destination: 'blob', path: @path - -%div#tree-holder.tree-holder - = render 'blob', blob: @blob - -- if allowed_tree_edit? - = render 'projects/blob/remove' diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml deleted file mode 100644 index 4e7415be4aa..00000000000 --- a/app/views/projects/branches/_branch.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -- commit = @repository.commit(branch.target) -%li(class="js-branch-#{branch.name}") - %h4 - = link_to namespace_project_tree_path(@project.namespace, @project, branch.name) do - %strong.str-truncated= branch.name - - if branch.name == @repository.root_ref - %span.label.label-info default - - if @project.protected_branch? branch.name - %span.label.label-success - %i.fa.fa-lock - protected - .pull-right - - if can?(current_user, :download_code, @project) - = render 'projects/repositories/download_archive', ref: branch.name, btn_class: 'btn-grouped btn-group-xs' - - if branch.name != @repository.root_ref - = link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: branch.name), class: 'btn btn-grouped btn-xs', method: :post, title: "Compare" do - %i.fa.fa-files-o - Compare - - - if can_remove_branch?(@project, branch.name) - = link_to namespace_project_branch_path(@project.namespace, @project, branch.name), class: 'btn btn-grouped btn-xs btn-remove remove-row', method: :delete, data: { confirm: 'Removed branch cannot be restored. Are you sure?'}, remote: true do - %i.fa.fa-trash-o - - - if commit - %ul.list-unstyled - = render 'projects/commits/inline_commit', commit: commit, project: @project - - else - %p - Cant find HEAD commit for this branch diff --git a/app/views/projects/branches/destroy.js.haml b/app/views/projects/branches/destroy.js.haml deleted file mode 100644 index 882a4d0c5e2..00000000000 --- a/app/views/projects/branches/destroy.js.haml +++ /dev/null @@ -1 +0,0 @@ -$('.js-totalbranch-count').html("#{@repository.branches.size}") diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml deleted file mode 100644 index a313ffcf272..00000000000 --- a/app/views/projects/branches/index.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -= render "projects/commits/head" -%h3.page-title - Branches - .pull-right - - if can? current_user, :push_code, @project - = link_to new_namespace_project_branch_path(@project.namespace, @project), class: 'btn btn-create' do - %i.fa.fa-add-sign - New branch - - .dropdown.inline - %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'} - %span.light sort: - - if @sort.present? - = @sort.humanize - - else - Name - %b.caret - %ul.dropdown-menu - %li - = link_to namespace_project_branches_path(sort: nil) do - Name - = link_to namespace_project_branches_path(sort: 'recently_updated') do - = sort_title_recently_updated - = link_to namespace_project_branches_path(sort: 'last_updated') do - = sort_title_oldest_updated -%hr -- unless @branches.empty? - %ul.bordered-list.top-list.all-branches - - @branches.each do |branch| - = render "projects/branches/branch", branch: branch - = paginate @branches, theme: 'gitlab' diff --git a/app/views/projects/branches/new.html.haml b/app/views/projects/branches/new.html.haml deleted file mode 100644 index e5fcb98c68c..00000000000 --- a/app/views/projects/branches/new.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -- if @error - .alert.alert-danger - %button{ type: "button", class: "close", "data-dismiss" => "alert"} × - = @error -%h3.page-title - %i.fa.fa-code-fork - New branch -= form_tag namespace_project_branches_path, method: :post, id: "new-branch-form", class: "form-horizontal" do - .form-group - = label_tag :branch_name, 'Name for new branch', class: 'control-label' - .col-sm-10 - = text_field_tag :branch_name, params[:branch_name], placeholder: 'enter new branch name', required: true, tabindex: 1, class: 'form-control' - .form-group - = label_tag :ref, 'Create from', class: 'control-label' - .col-sm-10 - = text_field_tag :ref, params[:ref], placeholder: 'existing branch name, tag or commit SHA', required: true, tabindex: 2, class: 'form-control' - .form-actions - = button_tag 'Create branch', class: 'btn btn-create', tabindex: 3 - = link_to 'Cancel', namespace_project_branches_path(@project.namespace, @project), class: 'btn btn-cancel' - -:javascript - disableButtonIfAnyEmptyField($("#new-branch-form"), ".form-control", ".btn-create"); - var availableTags = #{@project.repository.ref_names.to_json}; - - $("#ref").autocomplete({ - source: availableTags, - minLength: 1 - }); diff --git a/app/views/projects/commit/_commit_box.html.haml b/app/views/projects/commit/_commit_box.html.haml deleted file mode 100644 index 3f645b81397..00000000000 --- a/app/views/projects/commit/_commit_box.html.haml +++ /dev/null @@ -1,52 +0,0 @@ -.pull-right - %div - - if @notes_count > 0 - %span.btn.disabled.btn-grouped - %i.fa.fa-comment - = @notes_count - .pull-left.btn-group - %a.btn.btn-grouped.dropdown-toggle{ data: {toggle: :dropdown} } - %i.fa.fa-download - Download as - %span.caret - %ul.dropdown-menu - - unless @commit.parents.length > 1 - %li= link_to "Email Patches", namespace_project_commit_path(@project.namespace, @project, @commit, format: :patch) - %li= link_to "Plain Diff", namespace_project_commit_path(@project.namespace, @project, @commit, format: :diff) - = link_to namespace_project_tree_path(@project.namespace, @project, @commit), class: "btn btn-primary btn-grouped" do - %span Browse Code » - %div - -%p - %span.light Commit - = link_to @commit.id, namespace_project_commit_path(@project.namespace, @project, @commit) -.commit-info-row - %span.light Authored by - %strong - = commit_author_link(@commit, avatar: true, size: 24) - #{time_ago_with_tooltip(@commit.authored_date)} - -- if @commit.different_committer? - .commit-info-row - %span.light Committed by - %strong - = commit_committer_link(@commit, avatar: true, size: 24) - #{time_ago_with_tooltip(@commit.committed_date)} - -.commit-info-row - %span.cgray= pluralize(@commit.parents.count, "parent") - - @commit.parents.each do |parent| - = link_to parent.short_id, namespace_project_commit_path(@project.namespace, @project, parent) - -.commit-info-row.branches - %i.fa.fa-spinner.fa-spin - -.commit-box - %h3.commit-title - = gfm escape_once(@commit.title) - - if @commit.description.present? - %pre.commit-description - = preserve(gfm(escape_once(@commit.description))) - -:coffeescript - $(".commit-info-row.branches").load("#{branches_namespace_project_commit_path(@project.namespace, @project, @commit.id)}") diff --git a/app/views/projects/commit/branches.html.haml b/app/views/projects/commit/branches.html.haml deleted file mode 100644 index 82aac1fbd15..00000000000 --- a/app/views/projects/commit/branches.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -- if @branches.any? - %span - - branch = commit_default_branch(@project, @branches) - = link_to(namespace_project_tree_path(@project.namespace, @project, branch)) do - %span.label.label-gray - %i.fa.fa-code-fork - = branch - - if @branches.any? || @tags.any? - = link_to("#", class: "js-details-expand") do - %span.label.label-gray - \... - %span.js-details-content.hide - - if @branches.any? - = commit_branches_links(@project, @branches) - - if @tags.any? - = commit_tags_links(@project, @tags) diff --git a/app/views/projects/commit/show.html.haml b/app/views/projects/commit/show.html.haml deleted file mode 100644 index fc721067ed4..00000000000 --- a/app/views/projects/commit/show.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= render "commit_box" -= render "projects/diffs/diffs", diffs: @diffs, project: @project -= render "projects/notes/notes_with_form" diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml deleted file mode 100644 index c6026f96804..00000000000 --- a/app/views/projects/commits/_commit.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -%li.commit.js-toggle-container - .commit-row-title - %strong.str-truncated - = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" - - if commit.description? - %a.text-expander.js-toggle-button ... - - .pull-right - = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id" - - .notes_count - - if @note_counts - - note_count = @note_counts.fetch(commit.id, 0) - - else - - notes = project.notes.for_commit_id(commit.id) - - note_count = notes.user.count - - - if note_count > 0 - %span.light - %i.fa.fa-comments - = note_count - - - if commit.description? - .commit-row-description.js-toggle-content - %pre - = preserve(gfm(escape_once(commit.description))) - - .commit-row-info - = commit_author_link(commit, avatar: true, size: 24) - authored - .committed_ago - #{time_ago_with_tooltip(commit.committed_date)} - = link_to_browse_code(project, commit) diff --git a/app/views/projects/commits/_commit_list.html.haml b/app/views/projects/commits/_commit_list.html.haml deleted file mode 100644 index 2ee7d73bd20..00000000000 --- a/app/views/projects/commits/_commit_list.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%div.panel.panel-default - .panel-heading - Commits (#{@commits.count}) - - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE - %ul.well-list - - Commit.decorate(@commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE)).each do |commit| - = render "projects/commits/inline_commit", commit: commit, project: @project - %li.warning-row.unstyled - other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues. - - else - %ul.well-list= render Commit.decorate(@commits), project: @project diff --git a/app/views/projects/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml deleted file mode 100644 index 0cd9ce1f371..00000000000 --- a/app/views/projects/commits/_commits.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- unless defined?(project) - - project = @project - -- @commits.group_by { |c| c.committed_date.to_date }.sort.reverse.each do |day, commits| - .row.commits-row - .col-md-2.hidden-xs.hidden-sm - %h5.commits-row-date - %i.fa.fa-calendar - %span= day.stamp("28 Aug, 2010") - .light - = pluralize(commits.count, 'commit') - .col-md-10.col-sm-12 - %ul.bordered-list - = render commits, project: project - %hr.lists-separator diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml deleted file mode 100644 index a714f5f79e0..00000000000 --- a/app/views/projects/commits/_head.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -%ul.nav.nav-tabs - = nav_link(controller: [:commit, :commits]) do - = link_to namespace_project_commits_path(@project.namespace, @project, @repository.root_ref) do - Commits - %span.badge= number_with_precision(@repository.commit_count, precision: 0, delimiter: ',') - = nav_link(controller: :compare) do - = link_to 'Compare', namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: @ref || @repository.root_ref) - - = nav_link(html_options: {class: branches_tab_class}) do - = link_to namespace_project_branches_path(@project.namespace, @project) do - Branches - %span.badge.js-totalbranch-count= @repository.branches.size - - = nav_link(controller: :tags) do - = link_to namespace_project_tags_path(@project.namespace, @project) do - Tags - %span.badge.js-totaltags-count= @repository.tags.length diff --git a/app/views/projects/commits/_inline_commit.html.haml b/app/views/projects/commits/_inline_commit.html.haml deleted file mode 100644 index c03bc3f9df9..00000000000 --- a/app/views/projects/commits/_inline_commit.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%li.commit.inline-commit - .commit-row-title - = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id" - - %span.str-truncated - = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" - .pull-right - #{time_ago_with_tooltip(commit.committed_date)} diff --git a/app/views/projects/commits/show.atom.builder b/app/views/projects/commits/show.atom.builder deleted file mode 100644 index 9211de72b1b..00000000000 --- a/app/views/projects/commits/show.atom.builder +++ /dev/null @@ -1,23 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "Recent commits to #{@project.name}:#{@ref}" - xml.link :href => namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom), :rel => "self", :type => "application/atom+xml" - xml.link :href => namespace_project_commits_url(@project.namespace, @project, @ref), :rel => "alternate", :type => "text/html" - xml.id namespace_project_commits_url(@project.namespace, @project, @ref) - xml.updated @commits.first.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ") if @commits.any? - - @commits.each do |commit| - xml.entry do - xml.id namespace_project_commit_url(@project.namespace, @project, :id => commit.id) - xml.link :href => namespace_project_commit_url(@project.namespace, @project, :id => commit.id) - xml.title truncate(commit.title, :length => 80) - xml.updated commit.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ") - xml.media :thumbnail, :width => "40", :height => "40", :url => avatar_icon(commit.author_email) - xml.author do |author| - xml.name commit.author_name - xml.email commit.author_email - end - xml.summary gfm(commit.description) - end - end -end diff --git a/app/views/projects/commits/show.html.haml b/app/views/projects/commits/show.html.haml deleted file mode 100644 index 7ea855e1a4e..00000000000 --- a/app/views/projects/commits/show.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -= render "head" - -.tree-ref-holder - = render 'shared/ref_switcher', destination: 'commits' - -- if current_user && current_user.private_token - .commits-feed-holder.hidden-xs.hidden-sm - = link_to namespace_project_commits_path(@project.namespace, @project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed", class: 'btn' do - %i.fa.fa-rss - Commits feed - -%ul.breadcrumb.repo-breadcrumb - = commits_breadcrumbs - -%div{id: dom_id(@project)} - #commits-list= render "commits", project: @project -.clear -= spinner - -- if @commits.count == @limit - :javascript - CommitsList.init("#{@ref}", #{@limit}); - diff --git a/app/views/projects/compare/_form.html.haml b/app/views/projects/compare/_form.html.haml deleted file mode 100644 index dfb1dded9ea..00000000000 --- a/app/views/projects/compare/_form.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -= form_tag namespace_project_compare_index_path(@project.namespace, @project), method: :post, class: 'form-inline' do - .clearfix.append-bottom-20 - - if params[:to] && params[:from] - = link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has_tooltip', title: 'Switch base of comparison'} - .form-group - .input-group.inline-input-group - %span.input-group-addon from - = text_field_tag :from, params[:from], class: "form-control" - = "..." - .form-group - .input-group.inline-input-group - %span.input-group-addon to - = text_field_tag :to, params[:to], class: "form-control" - - = button_tag "Compare", class: "btn btn-create commits-compare-btn" - - if compare_to_mr_button? - = link_to compare_mr_path, class: 'prepend-left-10 btn' do - %strong Make a merge request - - -:javascript - var availableTags = #{@project.repository.ref_names.to_json}; - - $("#from, #to").autocomplete({ - source: availableTags, - minLength: 1 - }); - - disableButtonIfEmptyField('#to', '.commits-compare-btn'); diff --git a/app/views/projects/compare/index.html.haml b/app/views/projects/compare/index.html.haml deleted file mode 100644 index 4745bfbeaaf..00000000000 --- a/app/views/projects/compare/index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= render "projects/commits/head" - -%h3.page-title - Compare View -%p.slead - Compare branches, tags or commit ranges. - %br - Fill input field with commit id like - %code.label-branch 4eedf23 - or branch/tag name like - %code.label-branch master - and press compare button for the commits list and a code diff. - %br - Changes are shown <b>from</b> the version in the first field <b>to</b> the version in the second field. - -= render "form" diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml deleted file mode 100644 index 214b5bd337b..00000000000 --- a/app/views/projects/compare/show.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -= render "projects/commits/head" - -%h3.page-title - Compare View - -= render "form" - -- if @commits.present? - = render "projects/commits/commit_list" - = render "projects/diffs/diffs", diffs: @diffs, project: @project -- else - .light-well - .center - %h4 - There isn't anything to compare. - %p.slead - - if params[:to] == params[:from] - %span.label-branch #{params[:from]} - and - %span.label-branch #{params[:to]} - are the same. - - else - You'll need to use different branch names to get a valid comparison. diff --git a/app/views/projects/deploy_keys/_deploy_key.html.haml b/app/views/projects/deploy_keys/_deploy_key.html.haml deleted file mode 100644 index c577dfa8d55..00000000000 --- a/app/views/projects/deploy_keys/_deploy_key.html.haml +++ /dev/null @@ -1,36 +0,0 @@ -%li - .pull-right - - if @available_keys.include?(deploy_key) - = link_to enable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), class: 'btn btn-sm', method: :put do - %i.fa.fa-plus - Enable - - else - - if deploy_key.destroyed_when_orphaned? && deploy_key.almost_orphaned? - = link_to 'Remove', disable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), data: { confirm: 'You are going to remove deploy key. Are you sure?'}, method: :put, class: "btn btn-remove delete-key btn-sm pull-right" - - else - = link_to disable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), class: 'btn btn-sm', method: :put do - %i.fa.fa-power-off - Disable - - - if project = project_for_deploy_key(deploy_key) - = link_to namespace_project_deploy_key_path(project.namespace, project, deploy_key) do - %i.fa.fa-key - %strong= deploy_key.title - - else - %i.fa.fa-key - %strong= deploy_key.title - - - %p.light.prepend-top-10 - - if deploy_key.public? - %span.label.label-info.deploy-project-label - Public deploy key - - - deploy_key.projects.each do |project| - - if can?(current_user, :read_project, project) - %span.label.label-gray.deploy-project-label - = link_to namespace_project_path(project.namespace, project) do - = project.name_with_namespace - - %small.pull-right - Created #{time_ago_with_tooltip(deploy_key.created_at)} diff --git a/app/views/projects/deploy_keys/_form.html.haml b/app/views/projects/deploy_keys/_form.html.haml deleted file mode 100644 index 91675b3738e..00000000000 --- a/app/views/projects/deploy_keys/_form.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%div - = form_for [@project.namespace.becomes(Namespace), @project, @key], url: namespace_project_deploy_keys_path, html: { class: 'deploy-key-form form-horizontal' } do |f| - -if @key.errors.any? - .alert.alert-danger - %ul - - @key.errors.full_messages.each do |msg| - %li= msg - - .form-group - = f.label :title, class: "control-label" - .col-sm-10= f.text_field :title, class: 'form-control' - .form-group - = f.label :key, class: "control-label" - .col-sm-10 - %p.light - Paste a machine public key here. Read more about how to generate it - = link_to "here", help_page_path("ssh", "README") - = f.text_area :key, class: "form-control thin_area", rows: 5 - - .form-actions - = f.submit 'Create', class: "btn-create btn" - = link_to "Cancel", namespace_project_deploy_keys_path(@project.namespace, @project), class: "btn btn-cancel" - diff --git a/app/views/projects/deploy_keys/index.html.haml b/app/views/projects/deploy_keys/index.html.haml deleted file mode 100644 index 472a13a8524..00000000000 --- a/app/views/projects/deploy_keys/index.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -%h3.page-title - Deploy keys allow read-only access to the repository - - = link_to new_namespace_project_deploy_key_path(@project.namespace, @project), class: "btn btn-new pull-right", title: "New Deploy Key" do - %i.fa.fa-plus - New Deploy Key - -%p.light - Deploy keys can be used for CI, staging or production servers. - You can create a deploy key or add an existing one - -%hr.clearfix - -.row - .col-md-6.enabled-keys - %h5 - %strong.cgreen Enabled deploy keys - for this project - %ul.bordered-list - = render @enabled_keys - - if @enabled_keys.blank? - .light-well - .nothing-here-block Create a #{link_to 'new deploy key', new_namespace_project_deploy_key_path(@project.namespace, @project)} or add an existing one - .col-md-6.available-keys - - # If there are available public deploy keys but no available project deploy keys, only public deploy keys are shown. - - if @available_project_keys.any? || @available_public_keys.blank? - %h5 - %strong Deploy keys - from projects you have access to - %ul.bordered-list - = render @available_project_keys - - if @available_project_keys.blank? - .light-well - .nothing-here-block Deploy keys from projects you have access to will be displayed here - - - if @available_public_keys.any? - %h5 - %strong Public deploy keys - available to any project - %ul.bordered-list - = render @available_public_keys diff --git a/app/views/projects/deploy_keys/new.html.haml b/app/views/projects/deploy_keys/new.html.haml deleted file mode 100644 index 186d6b58972..00000000000 --- a/app/views/projects/deploy_keys/new.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3.page-title New Deploy key -%hr - -= render 'form' diff --git a/app/views/projects/deploy_keys/show.html.haml b/app/views/projects/deploy_keys/show.html.haml deleted file mode 100644 index 405b5bcd0d3..00000000000 --- a/app/views/projects/deploy_keys/show.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%h3.page-title - Deploy key: - = @key.title - %small - created on - = @key.created_at.stamp("Aug 21, 2011") -.back-link - = link_to namespace_project_deploy_keys_path(@project.namespace, @project) do - ← To keys list -%hr -%pre= @key.key -.pull-right - = link_to 'Remove', namespace_project_deploy_key_path(@project.namespace, @project, @key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn-remove btn delete-key" diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml deleted file mode 100644 index b49aee504fe..00000000000 --- a/app/views/projects/diffs/_diffs.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -.prepend-top-20.append-bottom-20 - .pull-right - .btn-group - = inline_diff_btn - = parallel_diff_btn - = render 'projects/diffs/stats', diffs: diffs - -- if show_diff_size_warning?(diffs) - = render 'projects/diffs/warning', diffs: diffs - -.files - - safe_diff_files(diffs).each_with_index do |diff_file, index| - = render 'projects/diffs/file', diff_file: diff_file, i: index, project: project - -- if @diff_timeout - .alert.alert-danger - %h4 - Failed to collect changes - %p - Maybe diff is really big and operation failed with timeout. Try to get diff locally - -:coffeescript - $('.files .diff-header').stick_in_parent(offset_top: $('.navbar').height()) diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml deleted file mode 100644 index 672a6635321..00000000000 --- a/app/views/projects/diffs/_file.html.haml +++ /dev/null @@ -1,50 +0,0 @@ -- blob = project.repository.blob_for_diff(@commit, diff_file.diff) -- return unless blob -- blob_diff_path = namespace_project_blob_diff_path(project.namespace, project, tree_join(@commit.id, diff_file.file_path)) -.diff-file{id: "diff-#{i}", data: {blob_diff_path: blob_diff_path }} - .diff-header{id: "file-path-#{hexdigest(diff_file.new_path || diff_file.old_path)}"} - - if diff_file.deleted_file - %span="#{diff_file.old_path} deleted" - - .diff-btn-group - - if @commit.parent_ids.present? - = view_file_btn(@commit.parent_id, diff_file, project) - - elsif diff_file.diff.submodule? - - submodule_item = project.repository.blob_at(@commit.id, diff_file.file_path) - = submodule_link(submodule_item, @commit.id) - - else - %span - - if diff_file.renamed_file - = "#{diff_file.old_path} renamed to #{diff_file.new_path}" - - else - = diff_file.new_path - - if diff_file.mode_changed? - %span.file-mode= "#{diff_file.diff.a_mode} → #{diff_file.diff.b_mode}" - - .diff-btn-group - - if blob.text? - = link_to '#', class: 'js-toggle-diff-comments btn btn-sm active has_tooltip', title: "Toggle comments for this file" do - %i.fa.fa-comments - - - - if @merge_request && @merge_request.source_project - = edit_blob_link(@merge_request.source_project, - @merge_request.source_branch, diff_file.new_path, - after: ' ', from_merge_request_id: @merge_request.id) - - = view_file_btn(@commit.id, diff_file, project) - - .diff-content.diff-wrap-lines - -# Skipp all non non-supported blobs - - return unless blob.respond_to?('text?') - - if blob.text? - - if params[:view] == 'parallel' - = render "projects/diffs/parallel_view", diff_file: diff_file, project: project, blob: blob, index: i - - else - = render "projects/diffs/text_file", diff_file: diff_file, index: i - - elsif blob.image? - - old_file = project.repository.prev_blob_for_diff(@commit, diff_file) - = render "projects/diffs/image", diff_file: diff_file, old_file: old_file, file: blob, index: i - - else - .nothing-here-block No preview for this file type - diff --git a/app/views/projects/diffs/_image.html.haml b/app/views/projects/diffs/_image.html.haml deleted file mode 100644 index 058b71b21f5..00000000000 --- a/app/views/projects/diffs/_image.html.haml +++ /dev/null @@ -1,64 +0,0 @@ -- diff = diff_file.diff -- if diff.renamed_file || diff.new_file || diff.deleted_file - .image - %span.wrap - .frame{class: image_diff_class(diff)} - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - %p.image-info= "#{number_to_human_size file.size}" -- else - .image - %div.two-up.view - %span.wrap - .frame.deleted - %a{href: namespace_project_blob_path(@project.namespace, @project, tree_join(@commit.parent_id, diff.old_path))} - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} - %p.image-info.hide - %span.meta-filesize= "#{number_to_human_size old_file.size}" - | - %b W: - %span.meta-width - | - %b H: - %span.meta-height - %span.wrap - .frame.added - %a{href: namespace_project_blob_path(@project.namespace, @project, tree_join(@commit.id, diff.new_path))} - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - %p.image-info.hide - %span.meta-filesize= "#{number_to_human_size file.size}" - | - %b W: - %span.meta-width - | - %b H: - %span.meta-height - - %div.swipe.view.hide - .swipe-frame - .frame.deleted - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} - .swipe-wrap - .frame.added - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - %span.swipe-bar - %span.top-handle - %span.bottom-handle - - %div.onion-skin.view.hide - .onion-skin-frame - .frame.deleted - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} - .frame.added - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - .controls - .transparent - .drag-track - .dragger{:style => "left: 0px;"} - .opaque - - - .view-modes.hide - %ul.view-modes-menu - %li.two-up{data: {mode: 'two-up'}} 2-up - %li.swipe{data: {mode: 'swipe'}} Swipe - %li.onion-skin{data: {mode: 'onion-skin'}} Onion skin diff --git a/app/views/projects/diffs/_match_line.html.haml b/app/views/projects/diffs/_match_line.html.haml deleted file mode 100644 index 4ebe3379733..00000000000 --- a/app/views/projects/diffs/_match_line.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%td.old_line.diff-line-num.unfold.js-unfold{data: {linenumber: line_old}, - class: unfold_bottom_class(bottom)} - \... -%td.new_line.diff-line-num.unfold.js-unfold{data: {linenumber: line_new}, - class: unfold_bottom_class(bottom)} - \... -%td.line_content.matched= line diff --git a/app/views/projects/diffs/_match_line_parallel.html.haml b/app/views/projects/diffs/_match_line_parallel.html.haml deleted file mode 100644 index 815df16aa4a..00000000000 --- a/app/views/projects/diffs/_match_line_parallel.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%td.old_line - %td.line_content.parallel.matched= line -%td.new_line - %td.line_content.parallel.matched= line diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml deleted file mode 100644 index 75f3a80f0d7..00000000000 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -/ Side-by-side diff view -%div.text-file.diff-wrap-lines - %table - - parallel_diff(diff_file, index).each do |line| - - type_left = line[0] - - line_number_left = line[1] - - line_content_left = line[2] - - line_code_left = line[3] - - type_right = line[4] - - line_number_right = line[5] - - line_content_right = line[6] - - line_code_right = line[7] - - %tr.line_holder.parallel - - if type_left == 'match' - = render "projects/diffs/match_line_parallel", { line: line_content_left, - line_old: line_number_left, line_new: line_number_right } - - elsif type_left == 'old' || type_left.nil? - %td.old_line{id: line_code_left, class: "#{type_left}"} - = link_to raw(line_number_left), "##{line_code_left}", id: line_code_left - %td.line_content{class: "parallel noteable_line #{type_left} #{line_code_left}", "line_code" => line_code_left }= raw line_content_left - - - if type_right == 'new' - - new_line_class = 'new' - - new_line_code = line_code_right - - else - - new_line_class = nil - - new_line_code = line_code_left - - %td.new_line{id: new_line_code, class: "#{new_line_class}", data: { linenumber: line_number_right }} - = link_to raw(line_number_right), "##{new_line_code}", id: new_line_code - %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", "line_code" => new_line_code}= raw line_content_right - - - if @reply_allowed - - comments_left, comments_right = organize_comments(type_left, type_right, line_code_left, line_code_right) - - if comments_left.present? || comments_right.present? - = render "projects/notes/diff_notes_with_reply_parallel", notes1: comments_left, notes2: comments_right - -- if diff_file.diff.diff.blank? && diff_file.mode_changed? - .file-mode-changed - File mode changed diff --git a/app/views/projects/diffs/_stats.html.haml b/app/views/projects/diffs/_stats.html.haml deleted file mode 100644 index 1625930615a..00000000000 --- a/app/views/projects/diffs/_stats.html.haml +++ /dev/null @@ -1,38 +0,0 @@ -.js-toggle-container - .commit-stat-summary - Showing - = link_to '#', class: 'js-toggle-button' do - %strong #{pluralize(diffs.count, "changed file")} - - if current_controller?(:commit) - - unless @commit.has_zero_stats? - with - %strong.cgreen #{@commit.stats.additions} additions - and - %strong.cred #{@commit.stats.deletions} deletions - .file-stats.js-toggle-content.hide - %ul.bordered-list - - diffs.each_with_index do |diff, i| - %li - - if diff.deleted_file - %span.deleted-file - %a{href: "#diff-#{i}"} - %i.fa.fa-minus - = diff.old_path - - elsif diff.renamed_file - %span.renamed-file - %a{href: "#diff-#{i}"} - %i.fa.fa-minus - = diff.old_path - → - = diff.new_path - - elsif diff.new_file - %span.new-file - %a{href: "#diff-#{i}"} - %i.fa.fa-plus - = diff.new_path - - else - %span.edit-file - %a{href: "#diff-#{i}"} - %i.fa.fa-adjust - = diff.new_path - diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml deleted file mode 100644 index e6dfbfd6511..00000000000 --- a/app/views/projects/diffs/_text_file.html.haml +++ /dev/null @@ -1,36 +0,0 @@ -- too_big = diff_file.diff_lines.count > Commit::DIFF_SAFE_LINES -- if too_big - %a.supp_diff_link Changes suppressed. Click to show - -%table.text-file{class: "#{'hide' if too_big}"} - - last_line = 0 - - diff_file.diff_lines.each_with_index do |line, index| - - type = line.type - - last_line = line.new_pos - - line_code = generate_line_code(diff_file.file_path, line) - - line_old = line.old_pos - %tr.line_holder{ id: line_code, class: "#{type}" } - - if type == "match" - = render "projects/diffs/match_line", {line: line.text, - line_old: line_old, line_new: line.new_pos, bottom: false} - - else - %td.old_line - = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code - - if @comments_allowed && can?(current_user, :write_note, @project) - = link_to_new_diff_note(line_code) - %td.new_line{data: {linenumber: line.new_pos}} - = link_to raw(type == "old" ? " " : line.new_pos) , "##{line_code}", id: line_code - %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line.text) - - - if @reply_allowed - - comments = @line_notes.select { |n| n.line_code == line_code && n.active? }.sort_by(&:created_at) - - unless comments.empty? - = render "projects/notes/diff_notes_with_reply", notes: comments, line: line.text - - - if last_line > 0 - = render "projects/diffs/match_line", {line: "", - line_old: last_line, line_new: last_line, bottom: true} - -- if diff_file.diff.blank? && diff_file.mode_changed? - .file-mode-changed - File mode changed diff --git a/app/views/projects/diffs/_warning.html.haml b/app/views/projects/diffs/_warning.html.haml deleted file mode 100644 index 47abbba2eb2..00000000000 --- a/app/views/projects/diffs/_warning.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -.alert.alert-warning - %h4 - Too many changes. - .pull-right - - unless diff_hard_limit_enabled? - = link_to "Reload with full diff", url_for(params.merge(force_show_diff: true)), class: "btn btn-sm btn-warning" - - - if current_controller?(:commit) or current_controller?(:merge_requests) - - if current_controller?(:commit) - = link_to "Plain diff", namespace_project_commit_path(@project.namespace, @project, @commit, format: :diff), class: "btn btn-warning btn-sm" - = link_to "Email patch", namespace_project_commit_path(@project.namespace, @project, @commit, format: :patch), class: "btn btn-warning btn-sm" - - elsif @merge_request && @merge_request.persisted? - = link_to "Plain diff", merge_request_path(@merge_request, format: :diff), class: "btn btn-warning btn-sm" - = link_to "Email patch", merge_request_path(@merge_request, format: :patch), class: "btn btn-warning btn-sm" - %p - To preserve performance only - %strong #{allowed_diff_size} of #{diffs.size} - files are displayed. - diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml deleted file mode 100644 index fbf04847e48..00000000000 --- a/app/views/projects/edit.html.haml +++ /dev/null @@ -1,206 +0,0 @@ -.project-edit-container - .project-edit-errors - .project-edit-content - %div - %h3.page-title - Project settings - %hr - .panel-body - = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit_project form-horizontal" }, authenticity_token: true do |f| - - %fieldset - .form-group.project_name_holder - = f.label :name, class: 'control-label' do - Project name - .col-sm-10 - = f.text_field :name, placeholder: "Example Project", class: "form-control", id: "project_name_edit" - - - .form-group - = f.label :description, class: 'control-label' do - Project description - %span.light (optional) - .col-sm-10 - = f.text_area :description, placeholder: "Awesome project", class: "form-control", rows: 3, maxlength: 250 - - - if @project.repository.exists? && @project.repository.branch_names.any? - .form-group - = f.label :default_branch, "Default Branch", class: 'control-label' - .col-sm-10= f.select(:default_branch, @repository.branch_names, {}, {class: 'select2 select-wide'}) - - - = render "visibility_level", f: f, visibility_level: @project.visibility_level, can_change_visibility_level: can?(current_user, :change_visibility_level, @project) - - .form-group - = f.label :tag_list, "Tags", class: 'control-label' - .col-sm-10 - = f.text_field :tag_list, maxlength: 2000, class: "form-control" - %p.help-block Separate tags with commas. - - %fieldset.features - %legend - Features: - .form-group - = f.label :issues_enabled, "Issues", class: 'control-label' - .col-sm-10 - .checkbox - = f.check_box :issues_enabled - %span.descr Lightweight issue tracking system for this project - - .form-group - = f.label :merge_requests_enabled, "Merge Requests", class: 'control-label' - .col-sm-10 - .checkbox - = f.check_box :merge_requests_enabled - %span.descr Submit changes to be merged upstream. - - .form-group - = f.label :wiki_enabled, "Wiki", class: 'control-label' - .col-sm-10 - .checkbox - = f.check_box :wiki_enabled - %span.descr Pages for project documentation - - .form-group - = f.label :snippets_enabled, "Snippets", class: 'control-label' - .col-sm-10 - .checkbox - = f.check_box :snippets_enabled - %span.descr Share code pastes with others out of git repository - - %fieldset.features - %legend - Project avatar: - .form-group - .col-sm-2 - .col-sm-10 - - if @project.avatar? - = project_icon("#{@project.namespace.to_param}/#{@project.to_param}", alt: '', class: 'avatar project-avatar s160') - %p.light - - if @project.avatar_in_git - Project avatar in repository: #{ @project.avatar_in_git } - %p.light - - if @project.avatar? - You can change your project avatar here - - else - You can upload a project avatar here - %a.choose-btn.btn.btn-sm.js-choose-project-avatar-button - %i.icon-paper-clip - %span Choose File ... - - %span.file_name.js-avatar-filename File name... - = f.file_field :avatar, class: "js-project-avatar-input hidden" - .light The maximum file size allowed is 200KB. - - if @project.avatar? - %hr - = link_to 'Remove avatar', namespace_project_avatar_path(@project.namespace, @project), data: { confirm: "Project avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-sm remove-avatar" - - .form-actions - = f.submit 'Save changes', class: "btn btn-save" - - - - .danger-settings - - if can? current_user, :archive_project, @project - - if @project.archived? - .panel.panel-success - .panel-heading - Unarchive project - .panel-body - %p - Unarchiving the project will mark its repository as active. - %br - The project can be committed to. - %br - %strong Once active this project shows up in the search and on the dashboard. - = link_to 'Unarchive', unarchive_namespace_project_path(@project.namespace, @project), - data: { confirm: "Are you sure that you want to unarchive this project?\nWhen this project is unarchived it is active and can be committed to again." }, - method: :post, class: "btn btn-success" - - else - .panel.panel-warning - .panel-heading - Archive project - .panel-body - %p - Archiving the project will mark its repository as read-only. - %br - It is hidden from the dashboard and doesn't show up in searches. - %br - %strong Archived projects cannot be committed to! - = link_to 'Archive', archive_namespace_project_path(@project.namespace, @project), - data: { confirm: "Are you sure that you want to archive this project?\nAn archived project cannot be committed to." }, - method: :post, class: "btn btn-warning" - - else - .nothing-here-block Only the project owner can archive a project - - .panel.panel-default.panel.panel-warning - .panel-heading Rename repository - .errors-holder - .panel-body - = form_for([@project.namespace.becomes(Namespace), @project], html: { class: 'form-horizontal' }) do |f| - .form-group.project_name_holder - = f.label :name, class: 'control-label' do - Project name - .col-sm-9 - .form-group - = f.text_field :name, placeholder: "Example Project", class: "form-control" - .form-group - = f.label :path, class: 'control-label' do - %span Path - .col-sm-9 - .form-group - .input-group - .input-group-addon - #{URI.join(root_url, @project.namespace.path)}/ - = f.text_field :path, class: 'form-control' - %span.input-group-addon .git - %ul - %li Be careful. Renaming a project's repository can have unintended side effects. - %li You will need to update your local repositories to point to the new location. - .form-actions - = f.submit 'Rename', class: "btn btn-warning" - - - if can?(current_user, :change_namespace, @project) - .panel.panel-default.panel.panel-danger - .panel-heading Transfer project - .errors-holder - .panel-body - = form_for([@project.namespace.becomes(Namespace), @project], url: transfer_namespace_project_path(@project.namespace, @project), method: :put, remote: true, html: { class: 'transfer-project form-horizontal' }) do |f| - .form-group - = label_tag :new_namespace_id, nil, class: 'control-label' do - %span Namespace - .col-sm-10 - .form-group - = select_tag :new_namespace_id, namespaces_options(@project.namespace_id), { prompt: 'Choose a project namespace', class: 'select2' } - %ul - %li Be careful. Changing the project's namespace can have unintended side effects. - %li You can only transfer the project to namespaces you manage. - %li You will need to update your local repositories to point to the new location. - .form-actions - = f.submit 'Transfer', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => transfer_project_message(@project) } - - else - .nothing-here-block Only the project owner can transfer a project - - - if can?(current_user, :remove_project, @project) - .panel.panel-default.panel.panel-danger - .panel-heading Remove project - .panel-body - = form_tag(namespace_project_path(@project.namespace, @project), method: :delete, html: { class: 'form-horizontal'}) do - %p - Removing the project will delete its repository and all related resources including issues, merge requests etc. - %br - %strong Removed projects cannot be restored! - - = link_to 'Remove project', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_project_message(@project) } - - else - .nothing-here-block Only project owner can remove a project - -.save-project-loader.hide - .center - %h2 - %i.fa.fa-spinner.fa-spin - Saving project. - %p Please wait a moment, this page will automatically refresh when ready. - - -= render 'shared/confirm_modal', phrase: @project.path diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml deleted file mode 100644 index 49806ceaa96..00000000000 --- a/app/views/projects/empty.html.haml +++ /dev/null @@ -1,49 +0,0 @@ -- if current_user && can?(current_user, :download_code, @project) - = render 'shared/no_ssh' - = render 'shared/no_password' - -= render "home_panel" - -.center.well - %h3 - The repository for this project is empty - %h4 - You can - = link_to namespace_project_new_blob_path(@project.namespace, @project, 'master'), class: 'btn btn-new btn-lg' do - add a file - or do a push via the command line. - -%h4 - %strong Command line instructions -%div.git-empty - %fieldset - %legend Git global setup - %pre.dark - :preserve - git config --global user.name "#{git_user_name}" - git config --global user.email "#{git_user_email}" - - %fieldset - %legend Create a new repository - %pre.dark - :preserve - mkdir #{@project.path} - cd #{@project.path} - git init - touch README.md - git add README.md - git commit -m "first commit" - git remote add origin #{ content_tag(:span, default_url_to_repo, class: 'clone')} - git push -u origin master - - %fieldset - %legend Push an existing Git repository - %pre.dark - :preserve - cd existing_git_repo - git remote add origin #{ content_tag(:span, default_url_to_repo, class: 'clone')} - git push -u origin master - -- if can? current_user, :remove_project, @project - .prepend-top-20 - = link_to 'Remove project', [@project.namespace.becomes(Namespace), @project], data: { confirm: remove_project_message(@project)}, method: :delete, class: "btn btn-remove pull-right" diff --git a/app/views/projects/forks/error.html.haml b/app/views/projects/forks/error.html.haml deleted file mode 100644 index 8eb4f795971..00000000000 --- a/app/views/projects/forks/error.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -- if @forked_project && !@forked_project.saved? - .alert.alert-danger.alert-block - %h4 - %i.fa.fa-code-fork - Fork Error! - %p - You tried to fork - = link_to_project @project - but it failed for the following reason: - - - - if @forked_project && @forked_project.errors.any? - %p - – - = @forked_project.errors.full_messages.first - - %p - = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork", class: "btn" do - %i.fa.fa-code-fork - Try to Fork again diff --git a/app/views/projects/forks/new.html.haml b/app/views/projects/forks/new.html.haml deleted file mode 100644 index 5a6c46f3208..00000000000 --- a/app/views/projects/forks/new.html.haml +++ /dev/null @@ -1,39 +0,0 @@ -%h3.page-title Fork project -%p.lead - Click to fork the project to a user or group -%hr - -.fork-namespaces - - @namespaces.in_groups_of(6, false) do |group| - .row - - group.each do |namespace| - .col-md-2.col-sm-3 - - if fork = namespace.find_fork_of(@project) - .thumbnail.fork-exists-thumbnail - = link_to project_path(fork), title: "Visit project fork", class: 'has_tooltip' do - = image_tag namespace_icon(namespace, 200) - .caption - %h4=namespace.human_name - %p - = namespace.path - - else - .thumbnail.fork-thumbnail - = link_to namespace_project_fork_path(@project.namespace, @project, namespace_key: namespace.id), title: "Fork here", method: "POST", class: 'has_tooltip' do - = image_tag namespace_icon(namespace, 200) - .caption - %h4=namespace.human_name - %p - = namespace.path - - %p.light - Fork is a copy of a project repository. - %br - Forking a repository allows you to do changes without affecting the original project. - -.save-project-loader.hide - .center - %h2 - %i.fa.fa-spinner.fa-spin - Forking repository - %p Please wait a moment, this page will automatically refresh when ready. - diff --git a/app/views/projects/go_import.html.haml b/app/views/projects/go_import.html.haml deleted file mode 100644 index 87ac75a350f..00000000000 --- a/app/views/projects/go_import.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -!!! 5 -%html - %head - - web_url = [Gitlab.config.gitlab.url, @namespace, @id].join('/') - %meta{name: "go-import", content: "#{web_url.split('://')[1]} git #{web_url}.git"} diff --git a/app/views/projects/graphs/_head.html.haml b/app/views/projects/graphs/_head.html.haml deleted file mode 100644 index 9383df13305..00000000000 --- a/app/views/projects/graphs/_head.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%ul.nav.nav-tabs - = nav_link(action: :show) do - = link_to 'Contributors', namespace_project_graph_path - = nav_link(action: :commits) do - = link_to 'Commits', commits_namespace_project_graph_path diff --git a/app/views/projects/graphs/commits.html.haml b/app/views/projects/graphs/commits.html.haml deleted file mode 100644 index 78b4c1923dd..00000000000 --- a/app/views/projects/graphs/commits.html.haml +++ /dev/null @@ -1,85 +0,0 @@ -= render 'head' - -%p.lead - Commit statistics for - %strong #{@repository.root_ref} - #{@commits_graph.start_date.strftime('%b %d')} - #{@commits_graph.end_date.strftime('%b %d')} - -.row - .col-md-6 - %ul - %li - %p.lead - %strong #{@commits_graph.commits.size} - commits during - %strong #{@commits_graph.duration} - days - %li - %p.lead - Average - %strong #{@commits_graph.commit_per_day} - commits per day - %li - %p.lead - Contributed by - %strong #{@commits_graph.authors} - authors - .col-md-6 - %div - %p.slead - Commits per day of month - %canvas#month-chart{width: 800, height: 400} -.row - .col-md-6 - %div - %p.slead - Commits per day hour (UTC) - %canvas#hour-chart{width: 800, height: 400} - .col-md-6 - %div - %p.slead - Commits per weekday - %canvas#weekday-chart{width: 800, height: 400} - -:coffeescript - data = { - labels : #{@commits_per_time.keys.to_json}, - datasets : [{ - fillColor : "rgba(220,220,220,0.5)", - strokeColor : "rgba(220,220,220,1)", - pointColor : "rgba(220,220,220,1)", - pointStrokeColor : "#EEE", - data : #{@commits_per_time.values.to_json} - }] - } - - ctx = $("#hour-chart").get(0).getContext("2d"); - new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true, pointHitDetectionRadius: 2}) - - data = { - labels : #{@commits_per_week_days.keys.to_json}, - datasets : [{ - fillColor : "rgba(220,220,220,0.5)", - strokeColor : "rgba(220,220,220,1)", - pointColor : "rgba(220,220,220,1)", - pointStrokeColor : "#EEE", - data : #{@commits_per_week_days.values.to_json} - }] - } - - ctx = $("#weekday-chart").get(0).getContext("2d"); - new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true, pointHitDetectionRadius: 2}) - - data = { - labels : #{@commits_per_month.keys.to_json}, - datasets : [{ - fillColor : "rgba(220,220,220,0.5)", - strokeColor : "rgba(220,220,220,1)", - pointColor : "rgba(220,220,220,1)", - pointStrokeColor : "#EEE", - data : #{@commits_per_month.values.to_json} - }] - } - - ctx = $("#month-chart").get(0).getContext("2d"); - new Chart(ctx).Line(data, {"scaleOverlay": true, responsive: true, pointHitDetectionRadius: 2}) diff --git a/app/views/projects/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml deleted file mode 100644 index e3d5094ddc5..00000000000 --- a/app/views/projects/graphs/show.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -= render 'head' -.loading-graph - .center - %h3.page-title - %i.fa.fa-spinner.fa-spin - Building repository graph. - %p.slead Please wait a moment, this page will automatically refresh when ready. - -.stat-graph.hide - .header.clearfix - %h3#date_header.page-title - %p.light - Commits to #{@project.default_branch}, excluding merge commits. Limited by 6,000 commits - %input#brush_change{:type => "hidden"} - .graphs - #contributors-master - #contributors.clearfix - %ol.contributors-list.clearfix - - - -:coffeescript - $.ajax - type: "GET", - url: location.href, - success: (data) -> - graph = new ContributorsStatGraph() - graph.init(data) - - $("#brush_change").change -> - graph.change_date_header() - graph.redraw_authors() - - $(".stat-graph").fadeIn(); - $(".loading-graph").hide(); - dataType: "json" - diff --git a/app/views/projects/hooks/index.html.haml b/app/views/projects/hooks/index.html.haml deleted file mode 100644 index bbaddba31b9..00000000000 --- a/app/views/projects/hooks/index.html.haml +++ /dev/null @@ -1,68 +0,0 @@ -%h3.page-title - Web hooks - -%p.light - #{link_to "Web hooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be - used for binding events when something is happening within the project. - -%hr.clearfix - -= form_for [@project.namespace.becomes(Namespace), @project, @hook], as: :hook, url: namespace_project_hooks_path(@project.namespace, @project), html: { class: 'form-horizontal' } do |f| - -if @hook.errors.any? - .alert.alert-danger - - @hook.errors.full_messages.each do |msg| - %p= msg - .form-group - = f.label :url, "URL", class: 'control-label' - .col-sm-10 - = f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json' - .form-group - = f.label :url, "Trigger", class: 'control-label' - .col-sm-10 - %div - = f.check_box :push_events, class: 'pull-left' - .prepend-left-20 - = f.label :push_events, class: 'list-label' do - %strong Push events - %p.light - This url will be triggered by a push to the repository - %div - = f.check_box :tag_push_events, class: 'pull-left' - .prepend-left-20 - = f.label :tag_push_events, class: 'list-label' do - %strong Tag push events - %p.light - This url will be triggered when a new tag is pushed to the repository - %div - = f.check_box :issues_events, class: 'pull-left' - .prepend-left-20 - = f.label :issues_events, class: 'list-label' do - %strong Issues events - %p.light - This url will be triggered when an issue is created - %div - = f.check_box :merge_requests_events, class: 'pull-left' - .prepend-left-20 - = f.label :merge_requests_events, class: 'list-label' do - %strong Merge Request events - %p.light - This url will be triggered when a merge request is created - .form-actions - = f.submit "Add Web Hook", class: "btn btn-create" - --if @hooks.any? - .panel.panel-default - .panel-heading - Web hooks (#{@hooks.count}) - %ul.well-list - - @hooks.each do |hook| - %li - .pull-right - = link_to 'Test Hook', test_namespace_project_hook_path(@project.namespace, @project, hook), class: "btn btn-sm btn-grouped" - = link_to 'Remove', namespace_project_hook_path(@project.namespace, @project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped" - .clearfix - %span.monospace= hook.url - %p - - %w(push_events tag_push_events issues_events merge_requests_events).each do |trigger| - - if hook.send(trigger) - %span.label.label-gray= trigger.titleize diff --git a/app/views/projects/imports/new.html.haml b/app/views/projects/imports/new.html.haml deleted file mode 100644 index 934b6b8c017..00000000000 --- a/app/views/projects/imports/new.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -%h3.page-title - - if @project.import_failed? - Import failed. Retry? - - else - Import repository - -%hr - -= form_for @project, url: namespace_project_import_path(@project.namespace, @project), method: :post, html: { class: 'form-horizontal' } do |f| - .form-group.import-url-data - = f.label :import_url, class: 'control-label' do - %span Import existing git repo - .col-sm-10 - = f.text_field :import_url, class: 'form-control', placeholder: 'https://github.com/randx/six.git' - .well.prepend-top-20 - This URL must be publicly accessible or you can add a username and password like this: https://username:password@gitlab.com/company/project.git. - %br - The import will time out after 4 minutes. For big repositories, use a clone/push combination. - For SVN repositories, check #{link_to "this migrating from SVN doc.", "http://doc.gitlab.com/ce/workflow/migrating_from_svn.html"} - .form-actions - = f.submit 'Start import', class: "btn btn-create", tabindex: 4 diff --git a/app/views/projects/imports/show.html.haml b/app/views/projects/imports/show.html.haml deleted file mode 100644 index 2d1fdafed24..00000000000 --- a/app/views/projects/imports/show.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -.save-project-loader - .center - %h2 - %i.fa.fa-spinner.fa-spin - Import in progress. - %p.monospace git clone --bare #{hidden_pass_url(@project.import_url)} - %p Please wait while we import the repository for you. Refresh at will. - :javascript - new ProjectImport(); diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml deleted file mode 100644 index 288b48f4583..00000000000 --- a/app/views/projects/issues/_discussion.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -- content_for :note_actions do - - if can?(current_user, :modify_issue, @issue) - - if @issue.closed? - = link_to 'Reopen Issue', issue_path(@issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen js-note-target-reopen", title: 'Reopen Issue' - - else - = link_to 'Close Issue', issue_path(@issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue" -.row - %section.col-md-9 - .votes-holder.pull-right - #votes= render 'votes/votes_block', votable: @issue - .participants - %span= pluralize(@issue.participants(current_user).count, 'participant') - - @issue.participants(current_user).each do |participant| - = link_to_member(@project, participant, name: false, size: 24) - .voting_notes#notes= render "projects/notes/notes_with_form" - %aside.col-md-3 - .issuable-affix - .clearfix - %span.slead.has_tooltip{:"data-original-title" => 'Cross-project reference'} - = cross_project_reference(@project, @issue) - %hr - .context - = render partial: 'issue_context', locals: { issue: @issue } - - - if @issue.labels.any? - .issuable-context-title - %label Labels - .issue-show-labels - - @issue.labels.each do |label| - = link_to namespace_project_issues_path(@project.namespace, @project, label_name: label.name) do - = render_colored_label(label) - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml deleted file mode 100644 index 7d7217eb2a8..00000000000 --- a/app/views/projects/issues/_form.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%div.issue-form-holder - %h3.page-title= @issue.new_record? ? "Create Issue" : "Edit Issue ##{@issue.iid}" - %hr - - = form_for [@project.namespace.becomes(Namespace), @project, @issue], html: { class: 'form-horizontal issue-form gfm-form' } do |f| - = render 'projects/issuable_form', f: f, issuable: @issue - -:javascript - $('.assign-to-me-link').on('click', function(e){ - $('#issue_assignee_id').val("#{current_user.id}").trigger("change"); - e.preventDefault(); - }); - - window.project_uploads_path = "#{namespace_project_uploads_path @project.namespace, @project}"; diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml deleted file mode 100644 index 998e74d12cf..00000000000 --- a/app/views/projects/issues/_issue.html.haml +++ /dev/null @@ -1,52 +0,0 @@ -%li{ id: dom_id(issue), class: issue_css_classes(issue), url: issue_path(issue) } - - if controller.controller_name == 'issues' - .issue-check - = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, class: "selected_issue", disabled: !can?(current_user, :modify_issue, issue) - - .issue-title - %span.str-truncated - = link_to_gfm issue.title, issue_path(issue), class: "row_title" - .pull-right.light - - if issue.closed? - %span - CLOSED - - note_count = issue.notes.user.count - - if note_count > 0 - - %span - %i.fa.fa-comments - = note_count - - .issue-info - = link_to "##{issue.iid}", issue_path(issue), class: "light" - - if issue.assignee - assigned to #{link_to_member(@project, issue.assignee)} - - if issue.votes_count > 0 - = render 'votes/votes_inline', votable: issue - - if issue.milestone - %span - %i.fa.fa-clock-o - = issue.milestone.title - - if issue.tasks? - %span.task-status - = issue.task_status - - .pull-right.issue-updated-at - %small updated #{time_ago_with_tooltip(issue.updated_at, 'bottom', 'issue_update_ago')} - - .issue-labels - - issue.labels.each do |label| - = link_to namespace_project_issues_path(issue.project.namespace, issue.project, label_name: label.name) do - = render_colored_label(label) - - .issue-actions - - if can? current_user, :modify_issue, issue - - if issue.closed? - = link_to 'Reopen', issue_path(issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-sm btn-grouped reopen_issue btn-reopen", remote: true - - else - = link_to 'Close', issue_path(issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-sm btn-grouped close_issue btn-close", remote: true - = link_to edit_namespace_project_issue_path(issue.project.namespace, issue.project, issue), class: "btn btn-sm edit-issue-link btn-grouped" do - %i.fa.fa-pencil-square-o - Edit - - diff --git a/app/views/projects/issues/_issue_context.html.haml b/app/views/projects/issues/_issue_context.html.haml deleted file mode 100644 index 9228074d833..00000000000 --- a/app/views/projects/issues/_issue_context.html.haml +++ /dev/null @@ -1,46 +0,0 @@ -= form_for [@project.namespace.becomes(Namespace), @project, @issue], remote: true, html: {class: 'edit-issue inline-update'} do |f| - %div.prepend-top-20 - .issuable-context-title - %label - Assignee: - - if issue.assignee - %strong= link_to_member(@project, @issue.assignee, size: 24) - - else - none - - if can?(current_user, :modify_issue, @issue) - = users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @issue.assignee_id, null_user: true, first_user: true) - - %div.prepend-top-20.clearfix - .issuable-context-title - %label - Milestone: - - if issue.milestone - %span.back-to-milestone - = link_to namespace_project_milestone_path(@project.namespace, @project, @issue.milestone) do - %strong - %i.fa.fa-clock-o - = @issue.milestone.title - - else - none - - if can?(current_user, :modify_issue, @issue) - = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'}) - = hidden_field_tag :issue_context - = f.submit class: 'btn' - - - if current_user - %div.prepend-top-20.clearfix - .issuable-context-title - %label - Subscription: - %button.btn.btn-block.subscribe-button - %i.fa.fa-eye - %span= @issue.subscribed?(current_user) ? "Unsubscribe" : "Subscribe" - - subscribtion_status = @issue.subscribed?(current_user) ? "subscribed" : "unsubscribed" - .subscription-status{"data-status" => subscribtion_status} - .description-block.unsubscribed{class: ( "hidden" if @issue.subscribed?(current_user) )} - You're not receiving notifications from this thread. - .description-block.subscribed{class: ( "hidden" unless @issue.subscribed?(current_user) )} - You're receiving notifications because you're subscribed to this thread. - -:coffeescript - new Subscription("#{toggle_subscription_namespace_project_issue_path(@issue.project.namespace, @project, @issue)}") diff --git a/app/views/projects/issues/_issues.html.haml b/app/views/projects/issues/_issues.html.haml deleted file mode 100644 index 5d243adb5fe..00000000000 --- a/app/views/projects/issues/_issues.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -.panel.panel-default - %ul.well-list.issues-list - = render @issues - - if @issues.blank? - %li - .nothing-here-block No issues to show - -- if @issues.present? - .pull-right - %span.issue_counter #{@issues.total_count} - issues for this filter - - = paginate @issues, theme: "gitlab" diff --git a/app/views/projects/issues/edit.html.haml b/app/views/projects/issues/edit.html.haml deleted file mode 100644 index b1bc3ba0eba..00000000000 --- a/app/views/projects/issues/edit.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "form" diff --git a/app/views/projects/issues/index.atom.builder b/app/views/projects/issues/index.atom.builder deleted file mode 100644 index 126f2c07faa..00000000000 --- a/app/views/projects/issues/index.atom.builder +++ /dev/null @@ -1,12 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{@project.name} issues" - xml.link :href => namespace_project_issues_url(@project.namespace, @project, :atom), :rel => "self", :type => "application/atom+xml" - xml.link :href => namespace_project_issues_url(@project.namespace, @project), :rel => "alternate", :type => "text/html" - xml.id namespace_project_issues_url(@project.namespace, @project) - xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? - - @issues.each do |issue| - issue_to_atom(xml, issue) - end -end diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml deleted file mode 100644 index d3c7ae24a75..00000000000 --- a/app/views/projects/issues/index.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -.append-bottom-10 - .pull-right - .pull-left - - if current_user - .hidden-xs.pull-left - = link_to namespace_project_issues_path(@project.namespace, @project, :atom, { private_token: current_user.private_token }), class: 'btn append-right-10' do - %i.fa.fa-rss - - = render 'shared/issuable_search_form', path: namespace_project_issues_path(@project.namespace, @project) - - - if can? current_user, :write_issue, @project - = link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { assignee_id: params[:assignee_id], milestone_id: params[:milestone_id]}), class: "btn btn-new pull-left", title: "New Issue", id: "new_issue_link" do - %i.fa.fa-plus - New Issue - - = render 'shared/issuable_filter' - -.issues-holder - = render "issues" diff --git a/app/views/projects/issues/new.html.haml b/app/views/projects/issues/new.html.haml deleted file mode 100644 index b1bc3ba0eba..00000000000 --- a/app/views/projects/issues/new.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "form" diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml deleted file mode 100644 index bd28d8a1db2..00000000000 --- a/app/views/projects/issues/show.html.haml +++ /dev/null @@ -1,40 +0,0 @@ -.issue - .issue-details - %h4.page-title - .issue-box{ class: issue_box_class(@issue) } - - if @issue.closed? - Closed - - else - Open - Issue ##{@issue.iid} - %small.creator - · created by #{link_to_member(@project, @issue.author)} #{issue_timestamp(@issue)} - - .pull-right - - if can?(current_user, :write_issue, @project) - = link_to new_namespace_project_issue_path(@project.namespace, @project), class: "btn btn-grouped new-issue-link", title: "New Issue", id: "new_issue_link" do - %i.fa.fa-plus - New Issue - - if can?(current_user, :modify_issue, @issue) - - if @issue.closed? - = link_to 'Reopen', issue_path(@issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen" - - else - = link_to 'Close', issue_path(@issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close", title: "Close Issue" - - = link_to edit_namespace_project_issue_path(@project.namespace, @project, @issue), class: "btn btn-grouped issuable-edit" do - %i.fa.fa-pencil-square-o - Edit - - %hr - %h2.issue-title - = gfm escape_once(@issue.title) - %div - - if @issue.description.present? - .description - .wiki - = preserve do - = markdown(@issue.description, parse_tasks: true) - - %hr - .issue-discussion - = render "projects/issues/discussion" diff --git a/app/views/projects/issues/update.js.haml b/app/views/projects/issues/update.js.haml deleted file mode 100644 index 1d38662bff8..00000000000 --- a/app/views/projects/issues/update.js.haml +++ /dev/null @@ -1,17 +0,0 @@ -- if params[:status_only] - - if @issue.valid? - :plain - $("##{dom_id(@issue)}").fadeOut(); -- elsif params[:issue_context] - $('.context').html("#{escape_javascript(render partial: 'issue_context', locals: { issue: @issue })}"); - $('.context').effect('highlight'); - - if @issue.milestone - $('.milestone-nav-link').replaceWith("<span class='milestone-nav-link'>| <span class='light'>Milestone</span> #{escape_javascript(link_to @issue.milestone.title, namespace_project_milestone_path(@issue.project.namespace, @issue.project, @issue.milestone))}</span>") - - else - $('.milestone-nav-link').html('') - - -$('select.select2').select2({width: 'resolve', dropdownAutoWidth: true}) -$('.edit-issue.inline-update input[type="submit"]').hide(); -new UsersSelect() -new Issue(); diff --git a/app/views/projects/labels/_label.html.haml b/app/views/projects/labels/_label.html.haml deleted file mode 100644 index 82829452862..00000000000 --- a/app/views/projects/labels/_label.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%li{id: dom_id(label)} - = render_colored_label(label) - .pull-right - %strong.append-right-20 - = link_to namespace_project_issues_path(@project.namespace, @project, label_name: label.name) do - = pluralize label.open_issues_count, 'open issue' - - - if can? current_user, :admin_label, @project - = link_to 'Edit', edit_namespace_project_label_path(@project.namespace, @project, label), class: 'btn' - = link_to 'Remove', namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"} diff --git a/app/views/projects/labels/destroy.js.haml b/app/views/projects/labels/destroy.js.haml deleted file mode 100644 index 1b4c83ab097..00000000000 --- a/app/views/projects/labels/destroy.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -- if @project.labels.size == 0 - $('.labels').load(document.URL + ' .light-well').hide().fadeIn(1000) diff --git a/app/views/projects/labels/edit.html.haml b/app/views/projects/labels/edit.html.haml deleted file mode 100644 index e003d1dfe7f..00000000000 --- a/app/views/projects/labels/edit.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%h3 - Edit label - %span.light #{@label.name} -.back-link - = link_to namespace_project_labels_path(@project.namespace, @project) do - ← To labels list -%hr -= render 'form' diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml deleted file mode 100644 index 0700e72d39c..00000000000 --- a/app/views/projects/labels/index.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- if can? current_user, :admin_label, @project - = link_to new_namespace_project_label_path(@project.namespace, @project), class: "pull-right btn btn-new" do - New label -%h3.page-title - Labels -%hr - -.labels - - if @labels.present? - %ul.bordered-list.manage-labels-list - = render @labels - = paginate @labels, theme: 'gitlab' - - else - .light-well - .nothing-here-block Create first label or #{link_to 'generate', generate_namespace_project_labels_path(@project.namespace, @project), method: :post} default set of labels diff --git a/app/views/projects/labels/new.html.haml b/app/views/projects/labels/new.html.haml deleted file mode 100644 index 0683ed5d4fb..00000000000 --- a/app/views/projects/labels/new.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h3 New label -.back-link - = link_to namespace_project_labels_path(@project.namespace, @project) do - ← To labels list -%hr -= render 'form' diff --git a/app/views/projects/merge_requests/_discussion.html.haml b/app/views/projects/merge_requests/_discussion.html.haml deleted file mode 100644 index eb72eaabd8b..00000000000 --- a/app/views/projects/merge_requests/_discussion.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -- content_for :note_actions do - - if can?(current_user, :modify_merge_request, @merge_request) - - if @merge_request.open? - = link_to 'Close', merge_request_path(@merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-grouped btn-close close-mr-link js-note-target-close", title: "Close merge request" - - if @merge_request.closed? - = link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link js-note-target-reopen", title: "Reopen merge request" - -.row - %section.col-md-9 - .votes-holder.pull-right - #votes= render 'votes/votes_block', votable: @merge_request - = render "projects/merge_requests/show/participants" - = render "projects/notes/notes_with_form" - %aside.col-md-3 - .issuable-affix - .clearfix - %span.slead.has_tooltip{:"data-original-title" => 'Cross-project reference'} - = cross_project_reference(@project, @merge_request) - %hr - .context - = render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request } - - - if @merge_request.labels.any? - .issuable-context-title - %label Labels - .merge-request-show-labels - - @merge_request.labels.each do |label| - = link_to namespace_project_merge_requests_path(@project.namespace, @project, label_name: label.name) do - = render_colored_label(label) - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml deleted file mode 100644 index 1c7160bce5f..00000000000 --- a/app/views/projects/merge_requests/_form.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], html: { class: 'merge-request-form form-horizontal gfm-form' } do |f| - .merge-request-form-info - = render 'projects/issuable_form', f: f, issuable: @merge_request - -:javascript - disableButtonIfEmptyField("#merge_request_title", ".btn-save"); - $('.assign-to-me-link').on('click', function(e){ - $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); - e.preventDefault(); - }); - - window.project_uploads_path = "#{namespace_project_uploads_path @project.namespace, @project}"; diff --git a/app/views/projects/merge_requests/_head.html.haml b/app/views/projects/merge_requests/_head.html.haml deleted file mode 100644 index 19e4dab874b..00000000000 --- a/app/views/projects/merge_requests/_head.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.top-tabs - = link_to namespace_project_merge_requests_path(@project.namespace, @project), class: "tab #{'active' if current_page?(namespace_project_merge_requests_path(@project.namespace, @project)) }" do - %span - Merge Requests - diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml deleted file mode 100644 index 4f30d1e69f7..00000000000 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ /dev/null @@ -1,48 +0,0 @@ -%li{ class: mr_css_classes(merge_request) } - .merge-request-title - %span.str-truncated - = link_to_gfm merge_request.title, merge_request_path(merge_request), class: "row_title" - .pull-right.light - - if merge_request.merged? - %span - %i.fa.fa-check - MERGED - - elsif merge_request.closed? - %span - %i.fa.fa-close - CLOSED - - else - %span.hidden-xs.hidden-sm - %span.label-branch< - %i.fa.fa-code-fork - %span= merge_request.target_branch - - note_count = merge_request.mr_and_commit_notes.user.count - - if note_count > 0 - - %span - %i.fa.fa-comments - = note_count - .merge-request-info - = link_to "##{merge_request.iid}", merge_request_path(merge_request), class: "light" - - if merge_request.assignee - assigned to #{link_to_member(merge_request.source_project, merge_request.assignee)} - - else - Unassigned - - if merge_request.votes_count > 0 - = render 'votes/votes_inline', votable: merge_request - - if merge_request.milestone_id? - %span - %i.fa.fa-clock-o - = merge_request.milestone.title - - if merge_request.tasks? - %span.task-status - = merge_request.task_status - - - .pull-right.hidden-xs - %small updated #{time_ago_with_tooltip(merge_request.updated_at, 'bottom', 'merge_request_updated_ago')} - - .merge-request-labels - - merge_request.labels.each do |label| - = link_to namespace_project_merge_requests_path(merge_request.project.namespace, merge_request.project, label_name: label.name) do - = render_colored_label(label) diff --git a/app/views/projects/merge_requests/_merge_requests.html.haml b/app/views/projects/merge_requests/_merge_requests.html.haml deleted file mode 100644 index b8a0ca9a42f..00000000000 --- a/app/views/projects/merge_requests/_merge_requests.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -.panel.panel-default - %ul.well-list.mr-list - = render @merge_requests - - if @merge_requests.blank? - %li - .nothing-here-block No merge requests to show - -- if @merge_requests.present? - .pull-right - %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter - - = paginate @merge_requests, theme: "gitlab" - diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml deleted file mode 100644 index 17e76059fdb..00000000000 --- a/app/views/projects/merge_requests/_new_compare.html.haml +++ /dev/null @@ -1,89 +0,0 @@ -%h3.page-title Compare branches for new Merge Request -%hr - -= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], url: new_namespace_project_merge_request_path(@project.namespace, @project), method: :get, html: { class: "merge-request-form form-inline" } do |f| - .hide.alert.alert-danger.mr-compare-errors - .merge-request-branches.row - .col-md-6 - .panel.panel-default - .panel-heading - %strong Source branch - .panel-body - = f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project select2 span3', disabled: @merge_request.persisted? }) - - = f.select(:source_branch, @merge_request.source_branches, { include_blank: "Select branch" }, {class: 'source_branch select2 span2'}) - .panel-footer - .mr_source_commit - - .col-md-6 - .panel.panel-default - .panel-heading - %strong Target branch - .panel-body - - projects = @project.forked_from_project.nil? ? [@project] : [@project, @project.forked_from_project] - = f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace', f.object.target_project_id), {}, { class: 'target_project select2 span3', disabled: @merge_request.persisted? }) - - = f.select(:target_branch, @merge_request.target_branches, { include_blank: "Select branch" }, {class: 'target_branch select2 span2'}) - .panel-footer - .mr_target_commit - - - if @merge_request.errors.any? - .alert.alert-danger - - @merge_request.errors.full_messages.each do |msg| - %div= msg - - - elsif @merge_request.source_branch.present? && @merge_request.target_branch.present? - - if @merge_request.compare_failed - .alert.alert-danger - %h4 Compare failed - %p We can't compare selected branches. It may be because of huge diff or satellite timeout. Please try again or select different branches. - - else - .light-well - .center - %h4 - There isn't anything to merge. - %p.slead - - if @merge_request.source_branch == @merge_request.target_branch - You'll need to use different branch names to get a valid comparison. - - else - %span.label-branch #{@merge_request.source_branch} - and - %span.label-branch #{@merge_request.target_branch} - are the same. - - - %hr - = f.submit 'Compare branches', class: "btn btn-primary mr-compare-btn" - -:javascript - var source_branch = $("#merge_request_source_branch") - , target_branch = $("#merge_request_target_branch") - , target_project = $("#merge_request_target_project_id"); - - $.get("#{branch_from_namespace_project_merge_requests_path(@source_project.namespace, @source_project)}", {ref: source_branch.val() }); - $.get("#{branch_to_namespace_project_merge_requests_path(@source_project.namespace, @source_project)}", {target_project_id: target_project.val(),ref: target_branch.val() }); - - target_project.on("change", function() { - $.get("#{update_branches_namespace_project_merge_requests_path(@source_project.namespace, @source_project)}", {target_project_id: $(this).val() }); - }); - source_branch.on("change", function() { - $.get("#{branch_from_namespace_project_merge_requests_path(@source_project.namespace, @source_project)}", {ref: $(this).val() }); - $(".mr-compare-errors").fadeOut(); - $(".mr-compare-btn").enable(); - }); - target_branch.on("change", function() { - $.get("#{branch_to_namespace_project_merge_requests_path(@source_project.namespace, @source_project)}", {target_project_id: target_project.val(),ref: $(this).val() }); - $(".mr-compare-errors").fadeOut(); - $(".mr-compare-btn").enable(); - }); - - -:coffeescript - - $(".merge-request-form").on 'submit', -> - if $("#merge_request_source_branch").val() is "" or $('#merge_request_target_branch').val() is "" - $(".mr-compare-errors").html("You must select source and target branch to proceed") - $(".mr-compare-errors").fadeIn() - event.preventDefault() - return - diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml deleted file mode 100644 index d986ce67c0c..00000000000 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ /dev/null @@ -1,123 +0,0 @@ -%h3.page-title - New merge request -%p.slead - From - %strong.label-branch #{@merge_request.source_project_namespace}:#{@merge_request.source_branch} - %span into - %strong.label-branch #{@merge_request.target_project_namespace}:#{@merge_request.target_branch} - - %span.pull-right - = link_to 'Change branches', new_namespace_project_merge_request_path(@project.namespace, @project) - -= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], html: { class: "merge-request-form form-horizontal gfm-form" } do |f| - .merge-request-form-info - .form-group - = f.label :title, class: 'control-label' do - %strong Title * - .col-sm-10 - = f.text_field :title, maxlength: 255, autofocus: true, class: 'form-control pad js-gfm-input', required: true - .form-group.issuable-description - = f.label :description, 'Description', class: 'control-label' - .col-sm-10 - = render layout: 'projects/md_preview', locals: { preview_class: "wiki" } do - = render 'projects/zen', f: f, attr: :description, classes: 'description form-control' - - .col-sm-12-hint - .pull-left - Parsed with - #{link_to 'Gitlab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}. - .pull-right - Attach files by dragging & dropping - or #{link_to 'selecting them', '#', class: 'markdown-selector'}. - - .clearfix - .error-alert - %hr - .form-group - .issue-assignee - = f.label :assignee_id, class: 'control-label' do - %i.fa.fa-user - Assign to - .col-sm-10 - = users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id, project_id: @merge_request.target_project_id) - - = link_to 'Assign to me', '#', class: 'btn assign-to-me-link' - .form-group - .issue-milestone - = f.label :milestone_id, class: 'control-label' do - %i.fa.fa-clock-o - Milestone - .col-sm-10 - - if milestone_options(@merge_request).present? - = f.select(:milestone_id, milestone_options(@merge_request), {include_blank: 'Select milestone'}, {class: 'select2'}) - - else - %span.light No open milestones available. - - - if can? current_user, :admin_milestone, @merge_request.target_project - = link_to 'Create new milestone', new_namespace_project_milestone_path(@merge_request.target_project.namespace, @merge_request.target_project), target: :blank - .form-group - = f.label :label_ids, class: 'control-label' do - %i.fa.fa-tag - Labels - .col-sm-10 - - if @merge_request.target_project.labels.any? - = f.collection_select :label_ids, @merge_request.target_project.labels.all, :id, :name, {selected: @merge_request.label_ids}, multiple: true, class: 'select2' - - else - %span.light No labels yet. - - - if can? current_user, :admin_label, @merge_request.target_project - = link_to 'Create new label', new_namespace_project_label_path(@merge_request.target_project.namespace, @merge_request.target_project), target: :blank - - .form-actions - - if guide_url = contribution_guide_url(@target_project) - %p - Please review the - %strong #{link_to 'guidelines for contribution', guide_url} - to this repository. - = f.hidden_field :source_project_id - = f.hidden_field :source_branch - = f.hidden_field :target_project_id - = f.hidden_field :target_branch - = f.submit 'Submit merge request', class: 'btn btn-create' - -.mr-compare.merge-request - %ul.nav.nav-tabs.merge-request-tabs - %li.commits-tab{data: {action: 'commits'}} - = link_to url_for(params) do - %i.fa.fa-history - Commits - %span.badge= @commits.size - %li.diffs-tab{data: {action: 'diffs'}} - = link_to url_for(params) do - %i.fa.fa-list-alt - Changes - %span.badge= @diffs.size - - .commits.tab-content - = render "projects/commits/commits", project: @project - .diffs.tab-content - - if @diffs.present? - = render "projects/diffs/diffs", diffs: @diffs, project: @project - - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE - .alert.alert-danger - %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits. - %p To preserve performance the line changes are not shown. - - else - .alert.alert-danger - %h4 This comparison includes a huge diff. - %p To preserve performance the line changes are not shown. - -:javascript - $('.assign-to-me-link').on('click', function(e){ - $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); - e.preventDefault(); - }); - - window.project_uploads_path = "#{namespace_project_uploads_path @project.namespace, @project}"; - -:javascript - var merge_request - merge_request = new MergeRequest({ - action: 'commits' - }); - diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml deleted file mode 100644 index a74aede4e6b..00000000000 --- a/app/views/projects/merge_requests/_show.html.haml +++ /dev/null @@ -1,77 +0,0 @@ -.merge-request{'data-url' => merge_request_path(@merge_request)} - .merge-request-details - = render "projects/merge_requests/show/mr_title" - %hr - = render "projects/merge_requests/show/mr_box" - %hr - .append-bottom-20 - .slead - %span From - - if @merge_request.for_fork? - %strong.label-branch< - - if @merge_request.source_project - = link_to @merge_request.source_project_namespace, namespace_project_path(@merge_request.source_project.namespace, @merge_request.source_project) - - else - \ #{@merge_request.source_project_namespace} - \:#{@merge_request.source_branch} - %span into - %strong.label-branch #{@merge_request.target_project_namespace}:#{@merge_request.target_branch} - - else - %strong.label-branch #{@merge_request.source_branch} - %span into - %strong.label-branch #{@merge_request.target_branch} - - if @merge_request.open? - %span.pull-right - .btn-group - %a.btn.dropdown-toggle{ data: {toggle: :dropdown} } - %i.fa.fa-download - Download as - %span.caret - %ul.dropdown-menu - %li= link_to "Email Patches", merge_request_path(@merge_request, format: :patch) - %li= link_to "Plain Diff", merge_request_path(@merge_request, format: :diff) - - = render "projects/merge_requests/show/how_to_merge" - = render "projects/merge_requests/show/state_widget" - - - if @commits.present? - %ul.nav.nav-tabs.merge-request-tabs - %li.notes-tab{data: {action: 'notes'}} - = link_to merge_request_path(@merge_request) do - %i.fa.fa-comments - Discussion - %span.badge= @merge_request.mr_and_commit_notes.user.count - %li.commits-tab{data: {action: 'commits'}} - = link_to merge_request_path(@merge_request), title: 'Commits' do - %i.fa.fa-history - Commits - %span.badge= @commits.size - %li.diffs-tab{data: {action: 'diffs'}} - = link_to diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request) do - %i.fa.fa-list-alt - Changes - %span.badge= @merge_request.diffs.size - - .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } - = render "projects/merge_requests/discussion" - .commits.tab-content - = render "projects/merge_requests/show/commits" - .diffs.tab-content - - if current_page?(action: 'diffs') - = render "projects/merge_requests/show/diffs" - - .mr-loading-status - = spinner - - -:javascript - var merge_request; - - merge_request = new MergeRequest({ - url_to_automerge_check: "#{automerge_check_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", - check_enable: #{@merge_request.unchecked? ? "true" : "false"}, - url_to_ci_check: "#{ci_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", - ci_enable: #{@project.ci_service ? "true" : "false"}, - current_status: "#{@merge_request.merge_status_name}", - action: "#{controller.action_name}" - }); diff --git a/app/views/projects/merge_requests/automerge.js.haml b/app/views/projects/merge_requests/automerge.js.haml deleted file mode 100644 index a53cbb150a4..00000000000 --- a/app/views/projects/merge_requests/automerge.js.haml +++ /dev/null @@ -1,6 +0,0 @@ --if @status - :plain - merge_request.mergeInProgress(); --else - :plain - merge_request.alreadyOrCannotBeMerged() diff --git a/app/views/projects/merge_requests/branch_from.js.haml b/app/views/projects/merge_requests/branch_from.js.haml deleted file mode 100644 index 8372afa61b5..00000000000 --- a/app/views/projects/merge_requests/branch_from.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -:plain - $(".mr_source_commit").html("#{commit_to_html(@commit, @source_project, false)}"); diff --git a/app/views/projects/merge_requests/branch_to.js.haml b/app/views/projects/merge_requests/branch_to.js.haml deleted file mode 100644 index f7ede0ded53..00000000000 --- a/app/views/projects/merge_requests/branch_to.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -:plain - $(".mr_target_commit").html("#{commit_to_html(@commit, @target_project, false)}"); diff --git a/app/views/projects/merge_requests/diffs.html.haml b/app/views/projects/merge_requests/diffs.html.haml deleted file mode 100644 index 2a5b8b1441e..00000000000 --- a/app/views/projects/merge_requests/diffs.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "show" diff --git a/app/views/projects/merge_requests/edit.html.haml b/app/views/projects/merge_requests/edit.html.haml deleted file mode 100644 index 839c63986ab..00000000000 --- a/app/views/projects/merge_requests/edit.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3.page-title - = "Edit merge request ##{@merge_request.iid}" -%hr -= render 'form' diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml deleted file mode 100644 index d7992bdd19e..00000000000 --- a/app/views/projects/merge_requests/index.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.append-bottom-10 - .pull-right - = render 'shared/issuable_search_form', path: namespace_project_merge_requests_path(@project.namespace, @project) - - - if can? current_user, :write_merge_request, @project - = link_to new_namespace_project_merge_request_path(@project.namespace, @project), class: "btn btn-new pull-left", title: "New Merge Request" do - %i.fa.fa-plus - New Merge Request - = render 'shared/issuable_filter' -.merge-requests-holder - = render 'merge_requests' diff --git a/app/views/projects/merge_requests/invalid.html.haml b/app/views/projects/merge_requests/invalid.html.haml deleted file mode 100644 index b9c466657de..00000000000 --- a/app/views/projects/merge_requests/invalid.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -.merge-request - = render "projects/merge_requests/show/mr_title" - = render "projects/merge_requests/show/mr_box" - - .alert.alert-danger - %p - We cannot render this merge request properly because - - if @merge_request.for_fork? && !@merge_request.source_project - fork project was removed - - elsif !@merge_request.source_branch_exists? - %span.label.label-inverse= @merge_request.source_branch - does not exist in - %span.label.label-info= @merge_request.source_project_path - - elsif !@merge_request.target_branch_exists? - %span.label.label-inverse= @merge_request.target_branch - does not exist in - %span.label.label-info= @merge_request.target_project_path - - else - of internal error - - %strong - Please close Merge Request or change branches with existing one - diff --git a/app/views/projects/merge_requests/new.html.haml b/app/views/projects/merge_requests/new.html.haml deleted file mode 100644 index 4756903d0e0..00000000000 --- a/app/views/projects/merge_requests/new.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- if @merge_request.can_be_created - = render 'new_submit' -- else - = render 'new_compare' diff --git a/app/views/projects/merge_requests/show.html.haml b/app/views/projects/merge_requests/show.html.haml deleted file mode 100644 index 2a5b8b1441e..00000000000 --- a/app/views/projects/merge_requests/show.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "show" diff --git a/app/views/projects/merge_requests/show/_commits.html.haml b/app/views/projects/merge_requests/show/_commits.html.haml deleted file mode 100644 index 3b7f283daf0..00000000000 --- a/app/views/projects/merge_requests/show/_commits.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "projects/commits/commits", project: @merge_request.source_project diff --git a/app/views/projects/merge_requests/show/_context.html.haml b/app/views/projects/merge_requests/show/_context.html.haml deleted file mode 100644 index 105562fb05e..00000000000 --- a/app/views/projects/merge_requests/show/_context.html.haml +++ /dev/null @@ -1,48 +0,0 @@ -= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], remote: true, html: {class: 'edit-merge_request inline-update'} do |f| - %div.prepend-top-20 - .issuable-context-title - %label - Assignee: - - if @merge_request.assignee - %strong= link_to_member(@project, @merge_request.assignee, size: 24) - - else - none - .issuable-context-selectbox - - if can?(current_user, :modify_merge_request, @merge_request) - = users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @merge_request.assignee_id, null_user: true) - - %div.prepend-top-20.clearfix - .issuable-context-title - %label - Milestone: - - if @merge_request.milestone - %span.back-to-milestone - = link_to namespace_project_milestone_path(@project.namespace, @project, @merge_request.milestone) do - %strong - %i.fa.fa-clock-o - = @merge_request.milestone.title - - else - none - .issuable-context-selectbox - - if can?(current_user, :modify_merge_request, @merge_request) - = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'}) - = hidden_field_tag :merge_request_context - = f.submit class: 'btn' - - - if current_user - %div.prepend-top-20.clearfix - .issuable-context-title - %label - Subscription: - %button.btn.btn-block.subscribe-button - %i.fa.fa-eye - %span= @merge_request.subscribed?(current_user) ? "Unsubscribe" : "Subscribe" - - subscribtion_status = @merge_request.subscribed?(current_user) ? "subscribed" : "unsubscribed" - .subscription-status{"data-status" => subscribtion_status} - .description-block.unsubscribed{class: ( "hidden" if @merge_request.subscribed?(current_user) )} - You're not receiving notifications from this thread. - .description-block.subscribed{class: ( "hidden" unless @merge_request.subscribed?(current_user) )} - You're receiving notifications because you're subscribed to this thread. - -:coffeescript - new Subscription("#{toggle_subscription_namespace_project_merge_request_path(@merge_request.project.namespace, @project, @merge_request)}") diff --git a/app/views/projects/merge_requests/show/_diffs.html.haml b/app/views/projects/merge_requests/show/_diffs.html.haml deleted file mode 100644 index 786b5f39063..00000000000 --- a/app/views/projects/merge_requests/show/_diffs.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -- if @merge_request_diff.collected? - = render "projects/diffs/diffs", diffs: @merge_request.diffs, project: @merge_request.source_project -- elsif @merge_request_diff.empty? - .nothing-here-block Nothing to merge from #{@merge_request.source_branch} into #{@merge_request.target_branch} -- else - .alert.alert-warning - %h4 - Changes view for this comparison is extremely large. - %p - You can - = link_to "download it", merge_request_path(@merge_request, format: :diff), class: "vlink" - instead. diff --git a/app/views/projects/merge_requests/show/_how_to_merge.html.haml b/app/views/projects/merge_requests/show/_how_to_merge.html.haml deleted file mode 100644 index 63db4b30968..00000000000 --- a/app/views/projects/merge_requests/show/_how_to_merge.html.haml +++ /dev/null @@ -1,53 +0,0 @@ -%div#modal_merge_info.modal.hide - .modal-dialog - .modal-content - .modal-header - %a.close{href: "#", "data-dismiss" => "modal"} × - %h3 How to merge - .modal-body - - if @merge_request.for_fork? - - source_remote = @merge_request.source_project.namespace.nil? ? "source" :@merge_request.source_project.namespace.path - - target_remote = @merge_request.target_project.namespace.nil? ? "target" :@merge_request.target_project.namespace.path - %p - %strong Step 1. - Fetch the code and create a new branch pointing to it - %pre.dark - :preserve - git fetch #{@merge_request.source_project.http_url_to_repo} #{@merge_request.source_branch} - git checkout -b #{@merge_request.source_project_path}-#{@merge_request.source_branch} FETCH_HEAD - %p - %strong Step 2. - Merge the branch and push the changes to GitLab - %pre.dark - :preserve - git checkout #{@merge_request.target_branch} - git merge --no-ff #{@merge_request.source_project_path}-#{@merge_request.source_branch} - git push origin #{@merge_request.target_branch} - - else - %p - %strong Step 1. - Update the repo and checkout the branch we are going to merge - %pre.dark - :preserve - git fetch origin - git checkout -b #{@merge_request.source_branch} origin/#{@merge_request.source_branch} - %p - %strong Step 2. - Merge the branch and push the changes to GitLab - %pre.dark - :preserve - git checkout #{@merge_request.target_branch} - git merge --no-ff #{@merge_request.source_branch} - git push origin #{@merge_request.target_branch} - - -:javascript - $(function(){ - var modal = $('#modal_merge_info').modal({modal: true, show:false}); - $('.how_to_merge_link').bind("click", function(){ - modal.show(); - }); - $('.modal-header .close').bind("click", function(){ - modal.hide(); - }) - }) diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml deleted file mode 100644 index 9f51f84d400..00000000000 --- a/app/views/projects/merge_requests/show/_mr_accept.html.haml +++ /dev/null @@ -1,74 +0,0 @@ -- unless @allowed_to_merge - - if @project.archived? - %p - %strong Archived projects cannot be committed to! - - else - .automerge_widget.cannot_be_merged.hide - %strong This can't be merged automatically, even if it could be merged you don't have the permission to do so. - .automerge_widget.can_be_merged.hide - %strong This can be merged automatically but you don't have the permission to do so. - - -- if @show_merge_controls - .automerge_widget.can_be_merged.hide - .clearfix - = form_for [:automerge, @project.namespace.becomes(Namespace), @project, @merge_request], remote: true, method: :post do |f| - .accept-merge-holder.clearfix.js-toggle-container - .accept-action - = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request" - - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork? - .accept-control.checkbox - = label_tag :should_remove_source_branch, class: "remove_source_checkbox" do - = check_box_tag :should_remove_source_branch - Remove source-branch - .accept-control - = link_to "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message" do - %i.fa.fa-edit - Modify commit message - .js-toggle-content.hide.prepend-top-20 - = render 'shared/commit_message_container', params: params, - text: @merge_request.merge_commit_message, - rows: 14, hint: true - - %br - .light - If you still want to merge this request manually - use - %strong - = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal" - - - .automerge_widget.no_satellite.hide - %p - %span - %strong This repository does not have satellite. Ask an administrator to fix this issue - - .automerge_widget.cannot_be_merged.hide - %h4 - This request can't be merged with GitLab. - You should do it manually with - %strong - = link_to "#modal_merge_info", class: "underlined-link how_to_merge_link", title: "How To Merge", "data-toggle" => "modal" do - command line - - %p - %button.btn.disabled - %i.fa.fa-warning - Accept Merge Request - - This usually happens when git can not resolve conflicts between branches automatically. - - .automerge_widget.unchecked - %p - %strong - %i.fa.fa-spinner.fa-spin - Checking for ability to automatically merge… - - .automerge_widget.already_cannot_be_merged.hide - %p - %strong This merge request can not be merged. Try to reload the page. - - .merge-in-progress.hide - %p - %i.fa.fa-spinner.fa-spin - - Merge is in progress. Please wait. Page will be automatically reloaded. diff --git a/app/views/projects/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml deleted file mode 100644 index ada9ae58b8f..00000000000 --- a/app/views/projects/merge_requests/show/_mr_box.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%h2.issue-title - = gfm escape_once(@merge_request.title) - -%div - - if @merge_request.description.present? - .description - .wiki - = preserve do - = markdown(@merge_request.description, parse_tasks: true) diff --git a/app/views/projects/merge_requests/show/_mr_ci.html.haml b/app/views/projects/merge_requests/show/_mr_ci.html.haml deleted file mode 100644 index ffa3f7b0e36..00000000000 --- a/app/views/projects/merge_requests/show/_mr_ci.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -- if @commits.any? - .ci_widget.ci-success{style: "display:none"} - %i.fa.fa-check - %span CI build passed - for #{@merge_request.last_commit_short_sha}. - = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" - - - .ci_widget.ci-failed{style: "display:none"} - %i.fa.fa-times - %span CI build failed - for #{@merge_request.last_commit_short_sha}. - = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" - - - [:running, :pending].each do |status| - .ci_widget{class: "ci-#{status}", style: "display:none"} - %i.fa.fa-clock-o - %span CI build #{status} - for #{@merge_request.last_commit_short_sha}. - = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" - - .ci_widget - %i.fa.fa-spinner - Checking for CI status for #{@merge_request.last_commit_short_sha} - - .ci_widget.ci-canceled{style: "display:none"} - %i.fa.fa-times - %span CI build canceled - for #{@merge_request.last_commit_short_sha}. - = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" - - .ci_widget.ci-error{style: "display:none"} - %i.fa.fa-times - %span Cannot connect to the CI server. Please check your settings and try again. diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml deleted file mode 100644 index 46e92a9c558..00000000000 --- a/app/views/projects/merge_requests/show/_mr_title.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%h4.page-title - .issue-box{ class: issue_box_class(@merge_request) } - - if @merge_request.merged? - Merged - - elsif @merge_request.closed? - Closed - - else - Open - = "Merge Request ##{@merge_request.iid}" - %small.creator - · - created by #{link_to_member(@project, @merge_request.author)} #{time_ago_with_tooltip(@merge_request.created_at)} - - .issue-btn-group.pull-right - - if can?(current_user, :modify_merge_request, @merge_request) - - if @merge_request.open? - = link_to 'Close', merge_request_path(@merge_request, merge_request: { state_event: :close }), method: :put, class: "btn btn-grouped btn-close", title: "Close merge request" - = link_to edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: "btn btn-grouped issuable-edit", id: "edit_merge_request" do - %i.fa.fa-pencil-square-o - Edit - - if @merge_request.closed? - = link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link", title: "Close merge request" diff --git a/app/views/projects/merge_requests/show/_no_accept.html.haml b/app/views/projects/merge_requests/show/_no_accept.html.haml deleted file mode 100644 index 423fcd48e25..00000000000 --- a/app/views/projects/merge_requests/show/_no_accept.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h4 - Can't be merged -%p - This merge request can not be accepted because branch - - unless @merge_request.source_branch_exists? - %span.label.label-inverse= @merge_request.source_branch - does not exist in - %span.label.label-info= @merge_request.source_project_path - - else - %span.label.label-inverse= @merge_request.target_branch - does not exist in - %span.label.label-info= @merge_request.target_project_path - %br - %strong Please close this merge request or change branches with existing one diff --git a/app/views/projects/merge_requests/show/_participants.html.haml b/app/views/projects/merge_requests/show/_participants.html.haml deleted file mode 100644 index 9c93fa55fe6..00000000000 --- a/app/views/projects/merge_requests/show/_participants.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -.participants - %span #{@merge_request.participants(current_user).count} participants - - @merge_request.participants(current_user).each do |participant| - = link_to_member(@project, participant, name: false, size: 24) diff --git a/app/views/projects/merge_requests/show/_remove_source_branch.html.haml b/app/views/projects/merge_requests/show/_remove_source_branch.html.haml deleted file mode 100644 index 59cb85edfce..00000000000 --- a/app/views/projects/merge_requests/show/_remove_source_branch.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- if @source_branch.blank? - Source branch has been removed - -- elsif can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && @merge_request.merged? - .remove_source_branch_widget - %p Changes merged into #{@merge_request.target_branch}. You can remove source branch now - = link_to namespace_project_branch_path(@merge_request.source_project.namespace, @merge_request.source_project, @source_branch), remote: true, method: :delete, class: "btn btn-primary btn-sm remove_source_branch" do - %i.fa.fa-times - Remove Source Branch - - .remove_source_branch_widget.failed.hide - Failed to remove source branch '#{@merge_request.source_branch}' - - .remove_source_branch_in_progress.hide - %i.fa.fa-spinner.fa-spin - - Removing source branch '#{@merge_request.source_branch}'. Please wait. Page will be automatically reloaded. diff --git a/app/views/projects/merge_requests/show/_state_widget.html.haml b/app/views/projects/merge_requests/show/_state_widget.html.haml deleted file mode 100644 index 44bd9347f51..00000000000 --- a/app/views/projects/merge_requests/show/_state_widget.html.haml +++ /dev/null @@ -1,50 +0,0 @@ -.mr-state-widget - - if @merge_request.source_project.ci_service && @commits.any? - .mr-widget-heading - = render "projects/merge_requests/show/mr_ci" - .mr-widget-body - - if @merge_request.open? - - if @merge_request.source_branch_exists? && @merge_request.target_branch_exists? - = render "projects/merge_requests/show/mr_accept" - - else - = render "projects/merge_requests/show/no_accept" - - - if @merge_request.closed? - %h4 - Closed - - if @merge_request.closed_event - by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)} - #{time_ago_with_tooltip(@merge_request.closed_event.created_at)} - %p Changes were not merged into target branch - - - if @merge_request.merged? - %h4 - Merged - - if @merge_request.merge_event - by #{link_to_member(@project, @merge_request.merge_event.author, avatar: false)} - #{time_ago_with_tooltip(@merge_request.merge_event.created_at)} - = render "projects/merge_requests/show/remove_source_branch" - - - if @merge_request.locked? - %h4 - Merge in progress... - %p - Merging is in progress. While merging this request is locked and cannot be closed. - - - unless @commits.any? - %h4 Nothing to merge - %p - Nothing to merge from - %span.label-branch #{@merge_request.source_branch} - to - %span.label-branch #{@merge_request.target_branch} - %br - Try to use different branches or push new code. - - - if @closes_issues.present? && @merge_request.open? - .mr-widget-footer - %span - %i.fa.fa-check - Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'} - = succeed '.' do - != gfm(issues_sentence(@closes_issues)) diff --git a/app/views/projects/merge_requests/update.js.haml b/app/views/projects/merge_requests/update.js.haml deleted file mode 100644 index b4df1d20737..00000000000 --- a/app/views/projects/merge_requests/update.js.haml +++ /dev/null @@ -1,8 +0,0 @@ -- if params[:merge_request_context] - $('.context').html("#{escape_javascript(render partial: 'projects/merge_requests/show/context', locals: { issue: @issue })}"); - $('.context').effect('highlight'); - - new UsersSelect() - - $('select.select2').select2({width: 'resolve', dropdownAutoWidth: true}); - merge_request = new MergeRequest(); diff --git a/app/views/projects/merge_requests/update_branches.js.haml b/app/views/projects/merge_requests/update_branches.js.haml deleted file mode 100644 index ca21b3bc0de..00000000000 --- a/app/views/projects/merge_requests/update_branches.js.haml +++ /dev/null @@ -1,9 +0,0 @@ -:plain - $(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}"); - - $('select.target_branch').select2({ - width: 'resolve', - dropdownAutoWidth: true - }); - - $(".mr_target_commit").html(""); diff --git a/app/views/projects/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml deleted file mode 100644 index 95b7070ce5c..00000000000 --- a/app/views/projects/milestones/_form.html.haml +++ /dev/null @@ -1,54 +0,0 @@ -%h3.page-title= @milestone.new_record? ? "New Milestone" : "Edit Milestone ##{@milestone.iid}" -.back-link - = link_to namespace_project_milestones_path(@project.namespace, @project) do - ← To milestones - -%hr - -= form_for [@project.namespace.becomes(Namespace), @project, @milestone], html: {class: 'form-horizontal milestone-form gfm-form'} do |f| - -if @milestone.errors.any? - .alert.alert-danger - %ul - - @milestone.errors.full_messages.each do |msg| - %li= msg - .row - .col-md-6 - .form-group - = f.label :title, "Title", class: "control-label" - .col-sm-10 - = f.text_field :title, maxlength: 255, class: "form-control" - %p.hint Required - .form-group.milestone-description - = f.label :description, "Description", class: "control-label" - .col-sm-10 - = render layout: 'projects/md_preview', locals: { preview_class: "wiki" } do - = render 'projects/zen', f: f, attr: :description, classes: 'description form-control' - .hint - .pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}. - .pull-left Attach files by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. - .clearfix - .error-alert - .col-md-6 - .form-group - = f.label :due_date, "Due Date", class: "control-label" - .col-sm-10= f.hidden_field :due_date - .col-sm-10 - .datepicker - - .form-actions - - if @milestone.new_record? - = f.submit 'Create milestone', class: "btn-create btn" - = link_to "Cancel", namespace_project_milestones_path(@project.namespace, @project), class: "btn btn-cancel" - -else - = f.submit 'Save changes', class: "btn-save btn" - = link_to "Cancel", namespace_project_milestone_path(@project.namespace, @project, @milestone), class: "btn btn-cancel" - - -:javascript - disableButtonIfEmptyField("#milestone_title", ".btn-save"); - $( ".datepicker" ).datepicker({ - dateFormat: "yy-mm-dd", - onSelect: function(dateText, inst) { $("#milestone_due_date").val(dateText) } - }).datepicker("setDate", $.datepicker.parseDate('yy-mm-dd', $('#milestone_due_date').val())); - - window.project_uploads_path = "#{namespace_project_uploads_path @project.namespace, @project}"; diff --git a/app/views/projects/milestones/_issue.html.haml b/app/views/projects/milestones/_issue.html.haml deleted file mode 100644 index 88fccfe4981..00000000000 --- a/app/views/projects/milestones/_issue.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%li{ id: dom_id(issue, 'sortable'), class: 'issue-row', 'data-iid' => issue.iid, 'data-url' => issue_path(issue) } - .pull-right.assignee-icon - - if issue.assignee - = image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16", alt: '' - %span - = link_to [@project.namespace.becomes(Namespace), @project, issue] do - %span.cgray ##{issue.iid} - = link_to_gfm issue.title, [@project.namespace.becomes(Namespace), @project, issue], title: issue.title - diff --git a/app/views/projects/milestones/_issues.html.haml b/app/views/projects/milestones/_issues.html.haml deleted file mode 100644 index 6e4df75a3df..00000000000 --- a/app/views/projects/milestones/_issues.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.panel.panel-default - .panel-heading= title - %ul{ class: "well-list issues-sortable-list", id: "issues-list-#{id}", "data-state" => id } - - issues.sort_by(&:position).each do |issue| - = render 'issue', issue: issue - %li.light.ui-sort-disabled Drag and drop available diff --git a/app/views/projects/milestones/_merge_request.html.haml b/app/views/projects/milestones/_merge_request.html.haml deleted file mode 100644 index 0d7a118569a..00000000000 --- a/app/views/projects/milestones/_merge_request.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%li{ id: dom_id(merge_request, 'sortable'), class: 'mr-row', 'data-iid' => merge_request.iid, 'data-url' => merge_request_path(merge_request) } - %span.str-truncated - = link_to [@project.namespace.becomes(Namespace), @project, merge_request] do - %span.cgray ##{merge_request.iid} - = link_to_gfm merge_request.title, [@project.namespace.becomes(Namespace), @project, merge_request], title: merge_request.title - .pull-right.assignee-icon - - if merge_request.assignee - = image_tag avatar_icon(merge_request.assignee.email, 16), class: "avatar s16", alt: '' diff --git a/app/views/projects/milestones/_merge_requests.html.haml b/app/views/projects/milestones/_merge_requests.html.haml deleted file mode 100644 index 00889a5eb24..00000000000 --- a/app/views/projects/milestones/_merge_requests.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.panel.panel-default - .panel-heading= title - %ul{ class: "well-list merge_requests-sortable-list", id: "merge_requests-list-#{id}", "data-state" => id } - - merge_requests.sort_by(&:position).each do |merge_request| - = render 'merge_request', merge_request: merge_request - %li.light.ui-sort-disabled Drag and drop available diff --git a/app/views/projects/milestones/_milestone.html.haml b/app/views/projects/milestones/_milestone.html.haml deleted file mode 100644 index 62360158ff9..00000000000 --- a/app/views/projects/milestones/_milestone.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -%li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone) } - .pull-right - - if can?(current_user, :admin_milestone, milestone.project) and milestone.active? - = link_to edit_namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone), class: "btn btn-sm edit-milestone-link btn-grouped" do - %i.fa.fa-pencil-square-o - Edit - = link_to 'Close Milestone', namespace_project_milestone_path(@project.namespace, @project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-sm btn-close" - %h4 - = link_to_gfm truncate(milestone.title, length: 100), namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone) - - if milestone.expired? and not milestone.closed? - %span.cred (Expired) - %small - = milestone.expires_at - .row - .col-sm-6 - = link_to namespace_project_issues_path(milestone.project.namespace, milestone.project, milestone_id: milestone.id) do - = pluralize milestone.issues.count, 'Issue' - - = link_to namespace_project_merge_requests_path(milestone.project.namespace, milestone.project, milestone_id: milestone.id) do - = pluralize milestone.merge_requests.count, 'Merge Request' - - %span.light #{milestone.percent_complete}% complete - .col-sm-6 - = milestone_progress_bar(milestone) diff --git a/app/views/projects/milestones/edit.html.haml b/app/views/projects/milestones/edit.html.haml deleted file mode 100644 index b1bc3ba0eba..00000000000 --- a/app/views/projects/milestones/edit.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "form" diff --git a/app/views/projects/milestones/index.html.haml b/app/views/projects/milestones/index.html.haml deleted file mode 100644 index d3eab8d6d75..00000000000 --- a/app/views/projects/milestones/index.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -.pull-right - - if can? current_user, :admin_milestone, @project - = link_to new_namespace_project_milestone_path(@project.namespace, @project), class: "pull-right btn btn-new", title: "New Milestone" do - %i.fa.fa-plus - New Milestone -= render 'shared/milestones_filter' - -.milestones - .panel.panel-default - %ul.well-list - = render @milestones - - - if @milestones.blank? - %li - .nothing-here-block No milestones to show - - = paginate @milestones, theme: "gitlab" diff --git a/app/views/projects/milestones/new.html.haml b/app/views/projects/milestones/new.html.haml deleted file mode 100644 index b1bc3ba0eba..00000000000 --- a/app/views/projects/milestones/new.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "form" diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml deleted file mode 100644 index 25cc0030965..00000000000 --- a/app/views/projects/milestones/show.html.haml +++ /dev/null @@ -1,103 +0,0 @@ -%h4.page-title - .issue-box{ class: issue_box_class(@milestone) } - - if @milestone.closed? - Closed - - elsif @milestone.expired? - Expired - - else - Open - Milestone ##{@milestone.iid} - %small.creator - = @milestone.expires_at - .pull-right - - if can?(current_user, :admin_milestone, @project) - = link_to edit_namespace_project_milestone_path(@project.namespace, @project, @milestone), class: "btn btn-grouped" do - %i.fa.fa-pencil-square-o - Edit - - if @milestone.active? - = link_to 'Close Milestone', namespace_project_milestone_path(@project.namespace, @project, @milestone, milestone: {state_event: :close }), method: :put, class: "btn btn-close btn-grouped" - - else - = link_to 'Reopen Milestone', namespace_project_milestone_path(@project.namespace, @project, @milestone, milestone: {state_event: :activate }), method: :put, class: "btn btn-reopen btn-grouped" - -%hr -- if @milestone.issues.any? && @milestone.can_be_closed? - .alert.alert-success - %span All issues for this milestone are closed. You may close milestone now. - -%h3.issue-title - = gfm escape_once(@milestone.title) -%div - - if @milestone.description.present? - .description - .wiki - = preserve do - = markdown @milestone.description - -%hr -.context - %p.lead - Progress: - #{@milestone.closed_items_count} closed - – - #{@milestone.open_items_count} open - - %span.light #{@milestone.percent_complete}% complete - %span.pull-right= @milestone.expires_at - = milestone_progress_bar(@milestone) - - -%ul.nav.nav-tabs - %li.active - = link_to '#tab-issues', 'data-toggle' => 'tab' do - Issues - %span.badge= @issues.count - %li - = link_to '#tab-merge-requests', 'data-toggle' => 'tab' do - Merge Requests - %span.badge= @merge_requests.count - %li - = link_to '#tab-participants', 'data-toggle' => 'tab' do - Participants - %span.badge= @users.count - - - if @project.issues_enabled - .pull-right - = link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { milestone_id: @milestone.id }), class: "btn btn-grouped", title: "New Issue" do - %i.fa.fa-plus - New Issue - = link_to 'Browse Issues', namespace_project_issues_path(@milestone.project.namespace, @milestone.project, milestone_id: @milestone.id), class: "btn edit-milestone-link btn-grouped" - -.tab-content - .tab-pane.active#tab-issues - .row - .col-md-4 - = render('issues', title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned, id: 'unassigned') - .col-md-4 - = render('issues', title: 'Ongoing Issues (open and assigned)', issues: @issues.opened.assigned, id: 'ongoing') - .col-md-4 - = render('issues', title: 'Completed Issues (closed)', issues: @issues.closed, id: 'closed') - - .tab-pane#tab-merge-requests - .row - .col-md-3 - = render('merge_requests', title: 'Work in progress (open and unassigned)', merge_requests: @merge_requests.opened.unassigned, id: 'unassigned') - .col-md-3 - = render('merge_requests', title: 'Waiting for merge (open and assigned)', merge_requests: @merge_requests.opened.assigned, id: 'ongoing') - .col-md-3 - = render('merge_requests', title: 'Declined (closed)', merge_requests: @merge_requests.declined, id: 'closed') - .col-md-3 - .panel.panel-primary - .panel-heading Merged - %ul.well-list - - @merge_requests.merged.each do |merge_request| - = render 'merge_request', merge_request: merge_request - - .tab-pane#tab-participants - %ul.bordered-list - - @users.each do |user| - %li - = link_to user, title: user.name, class: "darken" do - = image_tag avatar_icon(user.email, 32), class: "avatar s32" - %strong= truncate(user.name, lenght: 40) - %br - %small.cgray= user.username diff --git a/app/views/projects/milestones/update.js.haml b/app/views/projects/milestones/update.js.haml deleted file mode 100644 index 3ff84915e97..00000000000 --- a/app/views/projects/milestones/update.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -:plain - $('##{dom_id(@milestone)}').fadeOut(); diff --git a/app/views/projects/network/_head.html.haml b/app/views/projects/network/_head.html.haml deleted file mode 100644 index 415c98ec6a6..00000000000 --- a/app/views/projects/network/_head.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -.append-bottom-20 - = render partial: 'shared/ref_switcher', locals: {destination: 'graph'} - .pull-right.visible-lg.light You can move around the graph by using the arrow keys. diff --git a/app/views/projects/network/show.html.haml b/app/views/projects/network/show.html.haml deleted file mode 100644 index c36bad1e94b..00000000000 --- a/app/views/projects/network/show.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -= render "head" -.project-network - .controls - = form_tag namespace_project_network_path(@project.namespace, @project, @id), method: :get, class: 'form-inline network-form' do |f| - = text_field_tag :extended_sha1, @options[:extended_sha1], placeholder: "Input an extended SHA1 syntax", class: 'search-input form-control input-mx-250 search-sha' - = button_tag class: 'btn btn-success btn-search-sha' do - %i.fa.fa-search - .inline.prepend-left-20 - .checkbox.light - = label_tag :filter_ref do - = check_box_tag :filter_ref, 1, @options[:filter_ref] - %span Begin with the selected commit - - .network-graph - = spinner nil, true - -:javascript - disableButtonIfEmptyField('#extended_sha1', '.btn-search-sha') - - network_graph = new Network({ - url: '#{namespace_project_network_path(@project.namespace, @project, @ref, @options.merge(format: :json))}', - commit_url: '#{namespace_project_commit_path(@project.namespace, @project, 'ae45ca32').gsub("ae45ca32", "%s")}', - ref: '#{@ref}', - commit_id: '#{@commit.id}' - }) - new ShortcutsNetwork(network_graph.branch_graph) diff --git a/app/views/projects/network/show.json.erb b/app/views/projects/network/show.json.erb deleted file mode 100644 index dc82adcb2c6..00000000000 --- a/app/views/projects/network/show.json.erb +++ /dev/null @@ -1,23 +0,0 @@ -<% self.formats = ["html"] %> - -<%= raw( - { - days: @graph.days.compact.map { |d| [d.day, d.strftime("%b")] }, - commits: @graph.commits.map do |c| - { - parents: parents_zip_spaces(c.parents(@graph.map), c.parent_spaces), - author: { - name: c.author_name, - email: c.author_email, - icon: avatar_icon(c.author_email, 20) - }, - time: c.time, - space: c.spaces.first, - refs: get_refs(@graph.repo, c), - id: c.sha, - date: c.date, - message: c.message, - } - end - }.to_json -) %> diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml deleted file mode 100644 index a06c85b4251..00000000000 --- a/app/views/projects/new.html.haml +++ /dev/null @@ -1,120 +0,0 @@ -.project-edit-container - .project-edit-errors - = render 'projects/errors' - .project-edit-content - - = form_for @project, html: { class: 'new_project form-horizontal' } do |f| - .form-group.project-name-holder - = f.label :path, class: 'control-label' do - %strong Project path - .col-sm-10 - .input-group - = f.text_field :path, placeholder: "my-awesome-project", class: "form-control", tabindex: 1, autofocus: true - .input-group-addon - \.git - - - if current_user.can_select_namespace? - .form-group - = f.label :namespace_id, class: 'control-label' do - %span Namespace - .col-sm-10 - = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'select2', tabindex: 2} - - %hr - - .project-import.js-toggle-container - .form-group - %label.control-label Import project from - .col-sm-10 - - if github_import_enabled? - = link_to status_import_github_path, class: 'btn' do - %i.fa.fa-github - GitHub - - else - = link_to '#', class: 'how_to_import_link light btn' do - %i.fa.fa-github - GitHub - = render 'github_import_modal' - - - - if bitbucket_import_enabled? - = link_to status_import_bitbucket_path, class: 'btn' do - %i.fa.fa-bitbucket - Bitbucket - - else - = link_to '#', class: 'how_to_import_link light btn' do - %i.fa.fa-bitbucket - Bitbucket - = render 'bitbucket_import_modal' - - - unless request.host == 'gitlab.com' - - if gitlab_import_enabled? - = link_to status_import_gitlab_path, class: 'btn' do - %i.fa.fa-heart - GitLab.com - - else - = link_to '#', class: 'how_to_import_link light btn' do - %i.fa.fa-heart - GitLab.com - = render 'gitlab_import_modal' - - = link_to new_import_gitorious_path, class: 'btn' do - %i.icon-gitorious.icon-gitorious-small - Gitorious.org - - = link_to new_import_google_code_path, class: 'btn' do - %i.fa.fa-google - Google Code - - = link_to "#", class: 'btn js-toggle-button' do - %i.fa.fa-git - %span Any repo by URL - - .js-toggle-content.hide - .form-group.import-url-data - = f.label :import_url, class: 'control-label' do - %span Git repository URL - .col-sm-10 - = f.text_field :import_url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git' - .well.prepend-top-20 - %ul - %li - The repository must be accessible over HTTP(S). If it is not publicly accessible, you can add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>. - %li - The import will time out after 4 minutes. For big repositories, use a clone/push combination. - %li - To migrate an SVN repository, check out #{link_to "this document", "http://doc.gitlab.com/ce/workflow/migrating_from_svn.html"}. - - %hr.prepend-botton-10 - - .form-group - = f.label :description, class: 'control-label' do - Description - %span.light (optional) - .col-sm-10 - = f.text_area :description, placeholder: "Awesome project", class: "form-control", rows: 3, maxlength: 250, tabindex: 3 - = render "visibility_level", f: f, visibility_level: gitlab_config.default_projects_features.visibility_level, can_change_visibility_level: true - - .form-actions - = f.submit 'Create project', class: "btn btn-create project-submit", tabindex: 4 - - - if current_user.can_create_group? - .pull-right - .light - Need a group for several dependent projects? - = link_to new_group_path, class: "btn btn-xs" do - Create a group - -.save-project-loader.hide - .center - %h2 - %i.fa.fa-spinner.fa-spin - Creating project & repository. - %p Please wait a moment, this page will automatically refresh when ready. - -:coffeescript - $('.how_to_import_link').bind 'click', (e) -> - e.preventDefault() - import_modal = $(this).next(".modal").show() - $('.modal-header .close').bind 'click', -> - $(".modal").hide() diff --git a/app/views/projects/no_repo.html.haml b/app/views/projects/no_repo.html.haml deleted file mode 100644 index 720957e8336..00000000000 --- a/app/views/projects/no_repo.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%h2 - %i.fa.fa-warning - No repository - -%p.slead - The repository for this project does not exist. - %br - This means you can not push code until you create an empty repository or import existing one. -%hr - -.no-repo-actions - = link_to namespace_project_repository_path(@project.namespace, @project), method: :post, class: 'btn btn-primary' do - Create empty bare repository - - %strong.prepend-left-10.append-right-10 or - - = link_to new_namespace_project_import_path(@project.namespace, @project), class: 'btn' do - Import repository - -- if can? current_user, :remove_project, @project - .prepend-top-20 - = link_to 'Remove project', project_path(@project), data: { confirm: remove_project_message(@project)}, method: :delete, class: "btn btn-remove pull-right" diff --git a/app/views/projects/notes/_commit_discussion.html.haml b/app/views/projects/notes/_commit_discussion.html.haml deleted file mode 100644 index e69de29bb2d..00000000000 --- a/app/views/projects/notes/_commit_discussion.html.haml +++ /dev/null diff --git a/app/views/projects/notes/_diff_notes_with_reply.html.haml b/app/views/projects/notes/_diff_notes_with_reply.html.haml deleted file mode 100644 index c731baf0a65..00000000000 --- a/app/views/projects/notes/_diff_notes_with_reply.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- note = notes.first # example note --# Check if line want not changed since comment was left -- if !defined?(line) || line == note.diff_line - %tr.notes_holder - %td.notes_line{ colspan: 2 } - %span.discussion-notes-count - %i.fa.fa-comment - = notes.count - %td.notes_content - %ul.notes{ rel: note.discussion_id } - = render notes - .discussion-reply-holder - = link_to_reply_diff(note) diff --git a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml deleted file mode 100644 index 789f3e19fd2..00000000000 --- a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -- note1 = notes1.present? ? notes1.first : nil -- note2 = notes2.present? ? notes2.first : nil - -%tr.notes_holder - - if note1 - %td.notes_line - %span.btn.disabled - %i.fa.fa-comment - = notes1.count - %td.notes_content.parallel - %ul.notes{ rel: note1.discussion_id } - = render notes1 - - .discussion-reply-holder - = link_to_reply_diff(note1) - - else - %td= "" - %td= "" - - - if note2 - %td.notes_line - %span.btn.disabled - %i.fa.fa-comment - = notes2.count - %td.notes_content.parallel - %ul.notes{ rel: note2.discussion_id } - = render notes2 - - .discussion-reply-holder - = link_to_reply_diff(note2) - - else - %td= "" - %td= "" - diff --git a/app/views/projects/notes/_discussion.html.haml b/app/views/projects/notes/_discussion.html.haml deleted file mode 100644 index b8068835b3a..00000000000 --- a/app/views/projects/notes/_discussion.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- note = discussion_notes.first -.timeline-entry - .timeline-entry-inner - .timeline-icon - = link_to user_path(note.author) do - = image_tag avatar_icon(note.author_email), class: "avatar s40" - .timeline-content - - if note.for_merge_request? - - (active_notes, outdated_notes) = discussion_notes.partition(&:active?) - = render "projects/notes/discussions/active", discussion_notes: active_notes if active_notes.length > 0 - = render "projects/notes/discussions/outdated", discussion_notes: outdated_notes if outdated_notes.length > 0 - - else - = render "projects/notes/discussions/commit", discussion_notes: discussion_notes diff --git a/app/views/projects/notes/_edit_form.html.haml b/app/views/projects/notes/_edit_form.html.haml deleted file mode 100644 index acb3991d294..00000000000 --- a/app/views/projects/notes/_edit_form.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -.note-edit-form - = form_for note, url: namespace_project_note_path(@project.namespace, @project, note), method: :put, remote: true, authenticity_token: true do |f| - = note_target_fields(note) - = render layout: 'projects/md_preview', locals: { preview_class: "note-text" } do - = render 'projects/zen', f: f, attr: :note, - classes: 'note_text js-note-text' - - .comment-hints.clearfix - .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }} - .pull-right Attach files by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector', tabindex: -1 }. - - .note-form-actions - .buttons - = f.submit 'Save Comment', class: "btn btn-primary btn-save btn-grouped js-comment-button" - = link_to 'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
\ No newline at end of file diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml deleted file mode 100644 index 2ada6cb6700..00000000000 --- a/app/views/projects/notes/_form.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -= form_for [@project.namespace.becomes(Namespace), @project, @note], remote: true, html: { :'data-type' => 'json', multipart: true, id: nil, class: "new_note js-new-note-form common-note-form gfm-form" }, authenticity_token: true do |f| - = note_target_fields(@note) - = f.hidden_field :commit_id - = f.hidden_field :line_code - = f.hidden_field :noteable_id - = f.hidden_field :noteable_type - - = render layout: 'projects/md_preview', locals: { preview_class: "note-text" } do - = render 'projects/zen', f: f, attr: :note, - classes: 'note_text js-note-text' - - .comment-hints.clearfix - .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }} - .pull-right Attach files by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector', tabindex: -1 }. - .error-alert - - .note-form-actions - .buttons - = f.submit 'Add Comment', class: "btn comment-btn btn-grouped js-comment-button" - = yield(:note_actions) - %a.btn.grouped.js-close-discussion-note-form Cancel - -:javascript - window.project_uploads_path = "#{namespace_project_uploads_path @project.namespace, @project}"; diff --git a/app/views/projects/notes/_form_errors.html.haml b/app/views/projects/notes/_form_errors.html.haml deleted file mode 100644 index 0b68bf243f0..00000000000 --- a/app/views/projects/notes/_form_errors.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -.error-message.js-errors - - note.errors.full_messages.each do |msg| - %div= msg diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml deleted file mode 100644 index 0728f8fa42b..00000000000 --- a/app/views/projects/notes/_note.html.haml +++ /dev/null @@ -1,71 +0,0 @@ -%li.timeline-entry{ id: dom_id(note), class: [dom_class(note), "note-row-#{note.id}", ('system-note' if note.system)], data: { discussion: note.discussion_id } } - .timeline-entry-inner - .timeline-icon - - if note.system - %span.fa.fa-circle - - else - = link_to user_path(note.author) do - = image_tag avatar_icon(note.author_email), class: "avatar s40", alt: '' - .timeline-content - .note-header - .note-actions - = link_to "##{dom_id(note)}", name: dom_id(note) do - %i.fa.fa-link - Link here - - - if can?(current_user, :admin_note, note) && note.editable? - = link_to "#", title: "Edit comment", class: "js-note-edit" do - %i.fa.fa-pencil-square-o - Edit - - = link_to namespace_project_note_path(@project.namespace, @project, note), title: "Remove comment", method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: "danger js-note-delete" do - %i.fa.fa-trash-o.cred - Remove - - if note.system - = link_to user_path(note.author) do - = image_tag avatar_icon(note.author_email), class: "avatar s16", alt: '' - = link_to_member(@project, note.author, avatar: false) - %span.author-username - = '@' + note.author.username - %span.note-last-update - = note_timestamp(note) - - - if note.superceded?(@notes) - - if note.upvote? - %span.vote.upvote.label.label-gray.strikethrough - %i.fa.fa-thumbs-up - \+1 - - if note.downvote? - %span.vote.downvote.label.label-gray.strikethrough - %i.fa.fa-thumbs-down - \-1 - - else - - if note.upvote? - %span.vote.upvote.label.label-success - %i.fa.fa-thumbs-up - \+1 - - if note.downvote? - %span.vote.downvote.label.label-danger - %i.fa.fa-thumbs-down - \-1 - - - .note-body - .note-text - = preserve do - = markdown(note.note, {no_header_anchors: true}) - = render 'projects/notes/edit_form', note: note - - - if note.attachment.url - .note-attachment - - if note.attachment.image? - = link_to note.attachment.url, target: '_blank' do - = image_tag note.attachment.url, class: 'note-image-attach' - .attachment - = link_to note.attachment.url, target: "_blank" do - %i.fa.fa-paperclip - = note.attachment_identifier - = link_to delete_attachment_namespace_project_note_path(@project.namespace, @project, note), - title: "Delete this attachment", method: :delete, remote: true, data: { confirm: 'Are you sure you want to remove the attachment?' }, class: "danger js-note-attachment-delete" do - %i.fa.fa-trash-o.cred - .clear diff --git a/app/views/projects/notes/_notes.html.haml b/app/views/projects/notes/_notes.html.haml deleted file mode 100644 index ca60dd239b2..00000000000 --- a/app/views/projects/notes/_notes.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -- if @discussions.present? - - @discussions.each do |discussion_notes| - - note = discussion_notes.first - - if note_for_main_target?(note) - = render discussion_notes - - else - = render 'projects/notes/discussion', discussion_notes: discussion_notes -- else - - @notes.each do |note| - - next unless note.author - = render note diff --git a/app/views/projects/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml deleted file mode 100644 index 813e37276bd..00000000000 --- a/app/views/projects/notes/_notes_with_form.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%ul#notes-list.notes.main-notes-list.timeline - = render "projects/notes/notes" -.js-notes-busy - -.js-main-target-form -- if can? current_user, :write_note, @project - = render "projects/notes/form" - -:javascript - new Notes("#{namespace_project_notes_path(namespace_id: @project.namespace, target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}) diff --git a/app/views/projects/notes/discussions/_active.html.haml b/app/views/projects/notes/discussions/_active.html.haml deleted file mode 100644 index 7c6f7243173..00000000000 --- a/app/views/projects/notes/discussions/_active.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -- note = discussion_notes.first -.discussion.js-toggle-container{ class: note.discussion_id } - .discussion-header - .discussion-actions - = link_to "#", class: "js-toggle-button" do - %i.fa.fa-chevron-up - Show/hide discussion - %div - = link_to_member(@project, note.author, avatar: false) - started a discussion - = link_to diffs_namespace_project_merge_request_path(note.project.namespace, note.project, note.noteable, anchor: note.line_code) do - %strong on the diff - .last-update.hide.js-toggle-content - - last_note = discussion_notes.last - last updated by - = link_to_member(@project, last_note.author, avatar: false) - %span.discussion-last-update - #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} - .discussion-body.js-toggle-content - = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note diff --git a/app/views/projects/notes/discussions/_commit.html.haml b/app/views/projects/notes/discussions/_commit.html.haml deleted file mode 100644 index 62609cfc1c8..00000000000 --- a/app/views/projects/notes/discussions/_commit.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -- note = discussion_notes.first -.discussion.js-toggle-container{ class: note.discussion_id } - .discussion-header - .discussion-actions - = link_to "#", class: "js-toggle-button" do - %i.fa.fa-chevron-up - Show/hide discussion - %div - = link_to_member(@project, note.author, avatar: false) - started a discussion on commit - = link_to(note.noteable.short_id, namespace_project_commit_path(note.project.namespace, note.project, note.noteable), class: 'monospace') - .last-update.hide.js-toggle-content - - last_note = discussion_notes.last - last updated by - = link_to_member(@project, last_note.author, avatar: false) - %span.discussion-last-update - #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} - .discussion-body.js-toggle-content - - if note.for_diff_line? - = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note - - else - .panel.panel-default - .notes{ rel: discussion_notes.first.discussion_id } - = render discussion_notes - .discussion-reply-holder - = link_to_reply_diff(discussion_notes.first) - diff --git a/app/views/projects/notes/discussions/_diff.html.haml b/app/views/projects/notes/discussions/_diff.html.haml deleted file mode 100644 index 711aa39101b..00000000000 --- a/app/views/projects/notes/discussions/_diff.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -- diff = note.diff -- if diff - .diff-file - .diff-header - %span - - if diff.deleted_file - = diff.old_path - - else - = diff.new_path - - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode - %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" - .diff-content - %table - - note.truncated_diff_lines.each do |line| - - line_code = generate_line_code(note.file_path, line) - %tr.line_holder{ id: line_code } - - if line.type == "match" - %td.old_line= "..." - %td.new_line= "..." - %td.line_content.matched= line.text - - else - %td.old_line{class: line.type == "new" ? "new" : "old"} - = raw(line.type == "new" ? " " : line.old_pos) - %td.new_line{class: line.type == "new" ? "new" : "old"} - = raw(line.type == "old" ? " " : line.new_pos) - %td.line_content{class: "noteable_line #{line.type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line.text) - - - if line_code == note.line_code - = render "projects/notes/diff_notes_with_reply", notes: discussion_notes diff --git a/app/views/projects/notes/discussions/_outdated.html.haml b/app/views/projects/notes/discussions/_outdated.html.haml deleted file mode 100644 index 52a1d342f55..00000000000 --- a/app/views/projects/notes/discussions/_outdated.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -- note = discussion_notes.first -.discussion.js-toggle-container{ class: note.discussion_id } - .discussion-header - .discussion-actions - = link_to "#", class: "js-toggle-button" do - %i.fa.fa-chevron-down - Show/hide discussion - %div - = link_to_member(@project, note.author, avatar: false) - started a discussion on the - %strong outdated diff - %div - - last_note = discussion_notes.last - last updated by - = link_to_member(@project, last_note.author, avatar: false) - %span.discussion-last-update - #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} - .discussion-body.js-toggle-content.hide - = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note diff --git a/app/views/projects/project_members/_group_members.html.haml b/app/views/projects/project_members/_group_members.html.haml deleted file mode 100644 index 43e92437cf5..00000000000 --- a/app/views/projects/project_members/_group_members.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -.panel.panel-default - .panel-heading - %strong #{@group.name} - group members - %small - (#{members.count}) - .panel-head-actions - = link_to group_group_members_path(@group), class: 'btn btn-sm' do - %i.fa.fa-pencil-square-o - Edit group members - %ul.well-list - - members.each do |member| - = render 'groups/group_members/group_member', member: member, show_controls: false - - if members.count > 20 - %li - and #{members.count - 20} more. For full list visit #{link_to 'group members page', group_group_members_path(@group)} diff --git a/app/views/projects/project_members/_new_project_member.html.haml b/app/views/projects/project_members/_new_project_member.html.haml deleted file mode 100644 index d708b01a114..00000000000 --- a/app/views/projects/project_members/_new_project_member.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -= form_for @project_member, as: :project_member, url: namespace_project_project_members_path(@project.namespace, @project), html: { class: 'form-horizontal users-project-form' } do |f| - .form-group - = f.label :user_ids, "People", class: 'control-label' - .col-sm-10 - = users_select_tag(:user_ids, multiple: true, class: 'input-large', scope: :all, email_user: true) - .help-block - Search for existing users or invite new ones using their email address. - - .form-group - = f.label :access_level, "Project Access", class: 'control-label' - .col-sm-10 - = select_tag :access_level, options_for_select(ProjectMember.access_roles, @project_member.access_level), class: "project-access-select select2" - .help-block - Read more about role permissions - %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink" - - .form-actions - = f.submit 'Add users to project', class: "btn btn-create" diff --git a/app/views/projects/project_members/_project_member.html.haml b/app/views/projects/project_members/_project_member.html.haml deleted file mode 100644 index 635e4d70941..00000000000 --- a/app/views/projects/project_members/_project_member.html.haml +++ /dev/null @@ -1,53 +0,0 @@ -- user = member.user -- return unless user || member.invite? - -%li{class: "#{dom_class(member)} js-toggle-container project_member_row access-#{member.human_access.downcase}", id: dom_id(member)} - %span.list-item-name - - if member.user - = image_tag avatar_icon(user.email, 16), class: "avatar s16", alt: '' - %strong - = link_to user.name, user_path(user) - %span.cgray= user.username - - if user == current_user - %span.label.label-success It's you - - if user.blocked? - %label.label.label-danger - %strong Blocked - - else - = image_tag avatar_icon(member.invite_email, 16), class: "avatar s16", alt: '' - %strong - = member.invite_email - %span.cgray - invited - - if member.created_by - by - = link_to member.created_by.name, user_path(member.created_by) - = time_ago_with_tooltip(member.created_at) - - - if current_user_can_admin_project - = link_to resend_invite_namespace_project_project_member_path(@project.namespace, @project, member), method: :post, class: "btn-xs btn", title: 'Resend invite' do - Resend invite - - - if current_user_can_admin_project - - unless @project.personal? && user == current_user - .pull-right - %strong= member.human_access - = button_tag class: "btn-xs btn js-toggle-button", - title: 'Edit access level', type: 'button' do - %i.fa.fa-pencil-square-o - - - - if current_user == user - = link_to leave_namespace_project_project_members_path(@project.namespace, @project), data: { confirm: "Leave project?"}, method: :delete, class: "btn-xs btn btn-remove", title: 'Leave project' do - %i.fa.fa-minus.fa-inverse - - else - = link_to namespace_project_project_member_path(@project.namespace, @project, member), data: { confirm: remove_from_project_team_message(@project, member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from team' do - %i.fa.fa-minus.fa-inverse - - .edit-member.hide.js-toggle-content - %br - = form_for member, as: :project_member, url: namespace_project_project_member_path(@project.namespace, @project, member), remote: true do |f| - .prepend-top-10 - = f.select :access_level, options_for_select(ProjectMember.access_roles, member.access_level), {}, class: 'form-control' - .prepend-top-10 - = f.submit 'Save', class: 'btn btn-save' diff --git a/app/views/projects/project_members/_team.html.haml b/app/views/projects/project_members/_team.html.haml deleted file mode 100644 index 615c425e59a..00000000000 --- a/app/views/projects/project_members/_team.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -- can_admin_project = can?(current_user, :admin_project, @project) - -.panel.panel-default.prepend-top-20 - .panel-heading - %strong #{@project.name} - project members - %small - (#{members.count}) - %ul.well-list - - members.each do |project_member| - = render 'project_member', member: project_member, current_user_can_admin_project: can_admin_project diff --git a/app/views/projects/project_members/import.html.haml b/app/views/projects/project_members/import.html.haml deleted file mode 100644 index 293754cd0c0..00000000000 --- a/app/views/projects/project_members/import.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h3.page-title - Import members from another project -%p.light - Only project members will be imported. Group members will be skipped. -%hr -= form_tag apply_import_namespace_project_project_members_path(@project.namespace, @project), method: 'post', class: 'form-horizontal' do - .form-group - = label_tag :source_project_id, "Project", class: 'control-label' - .col-sm-10= select_tag(:source_project_id, options_from_collection_for_select(current_user.authorized_projects, :id, :name_with_namespace), prompt: "Select project", class: "select2 lg", required: true) - - .form-actions - = button_tag 'Import project members', class: "btn btn-create" - = link_to "Cancel", namespace_project_project_members_path(@project.namespace, @project), class: "btn btn-cancel" - diff --git a/app/views/projects/project_members/index.html.haml b/app/views/projects/project_members/index.html.haml deleted file mode 100644 index 36a6f6a1554..00000000000 --- a/app/views/projects/project_members/index.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -%h3.page-title - Users with access to this project - -%p.light - Read more about project permissions - %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink" - -%hr - -.clearfix.js-toggle-container - = form_tag namespace_project_project_members_path(@project.namespace, @project), method: :get, class: 'form-inline member-search-form' do - .form-group - = search_field_tag :search, params[:search], { placeholder: 'Find existing member by name', class: 'form-control search-text-input input-mn-300' } - = button_tag 'Search', class: 'btn' - - - if can?(current_user, :admin_project_member, @project) - %span.pull-right - = button_tag class: 'btn btn-new btn-grouped js-toggle-button', type: 'button' do - Add members - %i.fa.fa-chevron-down - = link_to import_namespace_project_project_members_path(@project.namespace, @project), class: "btn btn-grouped", title: "Import members from another project" do - Import members - - .js-toggle-content.hide.new-group-member-holder - = render "new_project_member" - -= render "team", members: @project_members - -- if @group - = render "group_members", members: @group_members - -:coffeescript - $('form.member-search-form').on 'submit', (event) -> - event.preventDefault() - Turbolinks.visit @.action + '?' + $(@).serialize() diff --git a/app/views/projects/project_members/update.js.haml b/app/views/projects/project_members/update.js.haml deleted file mode 100644 index 811b1858821..00000000000 --- a/app/views/projects/project_members/update.js.haml +++ /dev/null @@ -1,3 +0,0 @@ -- can_admin_project = can?(current_user, :admin_project, @project) -:plain - $("##{dom_id(@project_member)}").replaceWith('#{escape_javascript(render("project_member", member: @project_member, current_user_can_admin_project: can_admin_project))}'); diff --git a/app/views/projects/protected_branches/_branches_list.html.haml b/app/views/projects/protected_branches/_branches_list.html.haml deleted file mode 100644 index bb49f4de873..00000000000 --- a/app/views/projects/protected_branches/_branches_list.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -- unless @branches.empty? - %br - %h4 Already Protected: - %table.table.protected-branches-list - %thead - %tr.no-border - %th Branch - %th Developers can push - %th Last commit - %th - - %tbody - - @branches.each do |branch| - - @url = namespace_project_protected_branch_path(@project.namespace, @project, branch) - %tr - %td - = link_to namespace_project_commits_path(@project.namespace, @project, branch.name) do - %strong= branch.name - - if @project.root_ref?(branch.name) - %span.label.label-info default - %td - = check_box_tag "developers_can_push", branch.id, branch.developers_can_push, "data-url" => @url - %td - - if commit = branch.commit - = link_to namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit_short_id' do - = commit.short_id - · - #{time_ago_with_tooltip(commit.committed_date)} - - else - (branch was removed from repository) - %td - .pull-right - - if can? current_user, :admin_project, @project - = link_to 'Unprotect', [@project.namespace.becomes(Namespace), @project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-remove btn-sm" diff --git a/app/views/projects/protected_branches/index.html.haml b/app/views/projects/protected_branches/index.html.haml deleted file mode 100644 index a3464c0e5e1..00000000000 --- a/app/views/projects/protected_branches/index.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -%h3.page-title Protected branches -%p.light Keep stable branches secure and force developers to use Merge Requests -%hr - -.well.append-bottom-20 - %p Protected branches are designed to - %ul - %li prevent pushes from everybody except #{link_to "masters", help_page_path("permissions", "permissions"), class: "vlink"} - %li prevent anyone from force pushing to the branch - %li prevent anyone from deleting the branch - %p Read more about #{link_to "project permissions", help_page_path("permissions", "permissions"), class: "underlined-link"} - -- if can? current_user, :admin_project, @project - = form_for [@project.namespace.becomes(Namespace), @project, @protected_branch], html: { class: 'form-horizontal' } do |f| - -if @protected_branch.errors.any? - .alert.alert-danger - %ul - - @protected_branch.errors.full_messages.each do |msg| - %li= msg - - .form-group - = f.label :name, "Branch", class: 'control-label' - .col-sm-10 - = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "select2"}) - .form-group - .col-sm-offset-2.col-sm-10 - .checkbox - = f.label :developers_can_push do - = f.check_box :developers_can_push - %strong Developers can push - .help-block Allow developers to push to this branch - .form-actions - = f.submit 'Protect', class: "btn-create btn" -= render 'branches_list' - diff --git a/app/views/projects/refs/logs_tree.js.haml b/app/views/projects/refs/logs_tree.js.haml deleted file mode 100644 index 35c15cf3a9e..00000000000 --- a/app/views/projects/refs/logs_tree.js.haml +++ /dev/null @@ -1,19 +0,0 @@ -- @logs.each do |content_data| - - file_name = content_data[:file_name] - - commit = content_data[:commit] - - next unless commit - - :plain - var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); - row.find("td.tree_time_ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}'); - row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}'); - -- if @logs.present? - :plain - var current_url = location.href.replace(/\/?$/, '/'); - var log_url = '#{namespace_project_tree_url(@project.namespace, @project, tree_join(@ref, @path || '/'))}'.replace(/\/?$/, '/'); - if(current_url == log_url) { - // Load 10 more commit log for each file in tree - // if we still on the same page - ajaxGet('#{logs_file_namespace_project_ref_path(@project.namespace, @project, @ref, @path || '', offset: (@offset + @limit))}'); - } diff --git a/app/views/projects/repositories/_download_archive.html.haml b/app/views/projects/repositories/_download_archive.html.haml deleted file mode 100644 index b9486a9b492..00000000000 --- a/app/views/projects/repositories/_download_archive.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -- ref = ref || nil -- btn_class = btn_class || '' -- split_button = split_button || false -- if split_button == true - %span.btn-group{class: btn_class} - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'zip'), class: 'btn col-xs-10', rel: 'nofollow' do - %i.fa.fa-download - %span Download zip - %a.col-xs-2.btn.dropdown-toggle{ 'data-toggle' => 'dropdown' } - %span.caret - %span.sr-only - Select Archive Format - %ul.col-xs-10.dropdown-menu{ role: 'menu' } - %li - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'zip'), rel: 'nofollow' do - %i.fa.fa-download - %span Download zip - %li - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'tar.gz'), rel: 'nofollow' do - %i.fa.fa-download - %span Download tar.gz - %li - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'tar.bz2'), rel: 'nofollow' do - %i.fa.fa-download - %span Download tar.bz2 - %li - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'tar'), rel: 'nofollow' do - %i.fa.fa-download - %span Download tar -- else - %span.btn-group{class: btn_class} - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'zip'), class: 'btn', rel: 'nofollow' do - %i.fa.fa-download - %span zip - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: ref, format: 'tar.gz'), class: 'btn', rel: 'nofollow' do - %i.fa.fa-download - %span tar.gz diff --git a/app/views/projects/repositories/_feed.html.haml b/app/views/projects/repositories/_feed.html.haml deleted file mode 100644 index f3526ad0747..00000000000 --- a/app/views/projects/repositories/_feed.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -- commit = update -%tr - %td - = link_to namespace_project_commits_path(@project.namespace, @project, commit.head.name) do - %strong - = commit.head.name - - if @project.root_ref?(commit.head.name) - %span.label default - - %td - %div - = link_to namespace_project_commits_path(@project.namespace, @project, commit.id) do - %code= commit.short_id - = image_tag avatar_icon(commit.author_email), class: "", width: 16, alt: '' - = gfm escape_once(truncate(commit.title, length: 40)) - %td - %span.pull-right.cgray - = time_ago_with_tooltip(commit.committed_date) diff --git a/app/views/projects/services/_form.html.haml b/app/views/projects/services/_form.html.haml deleted file mode 100644 index ce6b7a0737a..00000000000 --- a/app/views/projects/services/_form.html.haml +++ /dev/null @@ -1,106 +0,0 @@ -%h3.page-title - = @service.title - = boolean_to_icon @service.activated? - -%p= @service.description - -.back-link - = link_to namespace_project_services_path(@project.namespace, @project) do - ← to services - -%hr - -= form_for(@service, as: :service, url: namespace_project_service_path(@project.namespace, @project, @service.to_param), method: :put, html: { class: 'form-horizontal' }) do |f| - - if @service.errors.any? - .alert.alert-danger - %ul - - @service.errors.full_messages.each do |msg| - %li= msg - - - if @service.help.present? - .well - = preserve do - = markdown @service.help - - .form-group - = f.label :active, "Active", class: "control-label" - .col-sm-10 - = f.check_box :active - - - if @service.supported_events.length > 1 - .form-group - = f.label :url, "Trigger", class: 'control-label' - .col-sm-10 - - if @service.supported_events.include?("push") - %div - = f.check_box :push_events, class: 'pull-left' - .prepend-left-20 - = f.label :push_events, class: 'list-label' do - %strong Push events - %p.light - This url will be triggered by a push to the repository - - if @service.supported_events.include?("tag_push") - %div - = f.check_box :tag_push_events, class: 'pull-left' - .prepend-left-20 - = f.label :tag_push_events, class: 'list-label' do - %strong Tag push events - %p.light - This url will be triggered when a new tag is pushed to the repository - - if @service.supported_events.include?("note") - %div - = f.check_box :note_events, class: 'pull-left' - .prepend-left-20 - = f.label :note_events, class: 'list-label' do - %strong Comments - %p.light - This url will be triggered when someone adds a comment - - if @service.supported_events.include?("issue") - %div - = f.check_box :issues_events, class: 'pull-left' - .prepend-left-20 - = f.label :issues_events, class: 'list-label' do - %strong Issues events - %p.light - This url will be triggered when an issue is created - - if @service.supported_events.include?("merge_request") - %div - = f.check_box :merge_requests_events, class: 'pull-left' - .prepend-left-20 - = f.label :merge_requests_events, class: 'list-label' do - %strong Merge Request events - %p.light - This url will be triggered when a merge request is created - - - @service.fields.each do |field| - - name = field[:name] - - title = field[:title] || name.humanize - - value = service_field_value(field[:type], @service.send(name)) - - type = field[:type] - - placeholder = field[:placeholder] - - choices = field[:choices] - - default_choice = field[:default_choice] - - help = field[:help] - - .form-group - = f.label name, title, class: "control-label" - .col-sm-10 - - if type == 'text' - = f.text_field name, class: "form-control", placeholder: placeholder - - elsif type == 'textarea' - = f.text_area name, rows: 5, class: "form-control", placeholder: placeholder - - elsif type == 'checkbox' - = f.check_box name - - elsif type == 'select' - = f.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" } - - elsif type == 'password' - = f.password_field name, placeholder: value, class: 'form-control' - - if help - %span.help-block= help - - .form-actions - = f.submit 'Save', class: 'btn btn-save' - - - if @service.valid? && @service.activated? - - disabled = @service.can_test? ? '':'disabled' - = link_to 'Test settings', test_namespace_project_service_path(@project.namespace, @project, @service.to_param), class: "btn #{disabled}" diff --git a/app/views/projects/services/edit.html.haml b/app/views/projects/services/edit.html.haml deleted file mode 100644 index bcc5832792f..00000000000 --- a/app/views/projects/services/edit.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render 'form' diff --git a/app/views/projects/services/index.html.haml b/app/views/projects/services/index.html.haml deleted file mode 100644 index 0d3ccb6bb83..00000000000 --- a/app/views/projects/services/index.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%h3.page-title Project services -%p.light Project services allow you to integrate GitLab with other applications - -%table.table - %thead - %tr - %th - %th Service - %th Description - %th Last edit - - @services.sort_by(&:title).each do |service| - %tr - %td - = boolean_to_icon service.activated? - %td - = link_to edit_namespace_project_service_path(@project.namespace, @project, service.to_param) do - %strong= service.title - %td - = service.description - %td.light - = time_ago_in_words service.updated_at - ago diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml deleted file mode 100644 index 4464c51744a..00000000000 --- a/app/views/projects/show.html.haml +++ /dev/null @@ -1,108 +0,0 @@ -- if current_user && can?(current_user, :download_code, @project) - = render 'shared/no_ssh' - = render 'shared/no_password' - -= render "home_panel" - -%ul.nav.nav-tabs - %li.active - = link_to '#tab-activity', 'data-toggle' => 'tab' do - Activity - - if @repository.readme - %li - = link_to '#tab-readme', 'data-toggle' => 'tab' do - Readme - - if @repository.changelog - %li - = link_to changelog_url(@project) do - Changelog - - if @repository.contribution_guide - %li - = link_to contribution_guide_url(@project) do - Contribution guide - - if @repository.license - %li - = link_to license_url(@project) do - License - - .project-home-links - - unless @project.empty_repo? - = link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) - = link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), namespace_project_branches_path(@project.namespace, @project) - = link_to pluralize(number_with_delimiter(@repository.tag_names.count), 'tag'), namespace_project_tags_path(@project.namespace, @project) - %span.light.prepend-left-20= repository_size - -.tab-content - .tab-pane.active#tab-activity - .row - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left - %section.col-md-9 - = render "events/event_last_push", event: @last_push - = render 'shared/event_filter' - .content_list - = spinner - %aside.col-md-3.project-side - .clearfix - - if @project.archived? - .alert.alert-warning - %h4 - %i.fa.fa-exclamation-triangle - Archived project! - %p Repository is read-only - - - if @project.forked_from_project - .well - %i.fa.fa-code-fork.project-fork-icon - Forked from: - %br - = link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project) - - - unless @project.empty_repo? - = link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do - %i.fa.fa-exchange - Compare code - - - if can?(current_user, :download_code, @project) - = render 'projects/repositories/download_archive', split_button: true, btn_class: 'btn-block' - - - if version = @repository.version - - detail_url = changelog_url(@project) || version_url(@project) - = link_to detail_url, class: 'btn btn-block' do - %i.fa.fa-file-text-o - Version: - %span.count - = @repository.blob_by_oid(version.id).data - - .prepend-top-10.append-bottom-10 - %p - %span.light Created on - #{@project.created_at.stamp('Aug 22, 2013')} - %p - %span.light Owned by #{@project.group ? "the" : nil} - - if @project.group - #{link_to @project.group.name, @project.group} group - - else - #{link_to @project.owner_name, @project.owner} - - - .prepend-top-10 - - @project.ci_services.each do |ci_service| - - if ci_service.active? && ci_service.respond_to?(:builds_path) - %hr - - if ci_service.respond_to?(:status_img_path) - = link_to ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' do - = image_tag ci_service.status_img_path, alt: "build status" - - else - %span.light CI provided by - = link_to ci_service.title, ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' - - - if readme = @repository.readme - .tab-pane#tab-readme - %article.readme-holder#README - = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)) do - %h4.readme-file-title - %i.fa.fa-file - = readme.name - .wiki - = render_readme(readme) diff --git a/app/views/projects/snippets/_snippet.html.haml b/app/views/projects/snippets/_snippet.html.haml deleted file mode 100644 index b2c35edc44c..00000000000 --- a/app/views/projects/snippets/_snippet.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -%li - %h4.snippet-title - = link_to reliable_snippet_path(snippet) do - = truncate(snippet.title, length: 60) - %span.cgray.monospace.tiny.pull-right - = snippet.file_name - - .snippet-info - = "##{snippet.id}" - %span - by - = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16" - = snippet.author_name - %span.light - #{time_ago_with_tooltip(snippet.created_at)} diff --git a/app/views/projects/snippets/edit.html.haml b/app/views/projects/snippets/edit.html.haml deleted file mode 100644 index 2d4d5d030ab..00000000000 --- a/app/views/projects/snippets/edit.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3.page-title - Edit snippet -%hr -= render "shared/snippets/form", url: namespace_project_snippet_path(@project.namespace, @project, @snippet) diff --git a/app/views/projects/snippets/index.html.haml b/app/views/projects/snippets/index.html.haml deleted file mode 100644 index e2d8ec673a1..00000000000 --- a/app/views/projects/snippets/index.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -%h3.page-title - Snippets - - if can? current_user, :write_project_snippet, @project - = link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new pull-right", title: "New Snippet" do - Add new snippet - -%p.light - Share code pastes with others out of git repository - -%hr -%ul.bordered-list - = render partial: "projects/snippets/snippet", collection: @snippets - - if @snippets.empty? - %li - .nothing-here-block Nothing here. diff --git a/app/views/projects/snippets/new.html.haml b/app/views/projects/snippets/new.html.haml deleted file mode 100644 index bb659dba0cf..00000000000 --- a/app/views/projects/snippets/new.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3.page-title - New snippet -%hr -= render "shared/snippets/form", url: namespace_project_snippets_path(@project.namespace, @project, @snippet) diff --git a/app/views/projects/snippets/show.html.haml b/app/views/projects/snippets/show.html.haml deleted file mode 100644 index d19689a1056..00000000000 --- a/app/views/projects/snippets/show.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -%h3.page-title - = @snippet.title - - .pull-right - = link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new", title: "New Snippet" do - Add new snippet - -%hr - -.append-bottom-20 - .pull-right - = "##{@snippet.id}" - %span.light - by - = link_to user_path(@snippet.author) do - = image_tag avatar_icon(@snippet.author_email), class: "avatar avatar-inline s16" - = @snippet.author_name - - .back-link - = link_to namespace_project_snippets_path(@project.namespace, @project) do - ← project snippets - -.file-holder - .file-title - %i.fa.fa-file - %strong - = @snippet.file_name - .file-actions - .btn-group - - if can?(current_user, :modify_project_snippet, @snippet) - = link_to "edit", edit_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-sm", title: 'Edit Snippet' - = link_to "raw", raw_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-sm", target: "_blank" - - if can?(current_user, :admin_project_snippet, @snippet) - = link_to "remove", namespace_project_snippet_path(@project.namespace, @project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-sm btn-remove", title: 'Delete Snippet' - = render 'shared/snippets/blob' - -%div#notes= render "projects/notes/notes_with_form" diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml deleted file mode 100644 index 28ad272322f..00000000000 --- a/app/views/projects/tags/_tag.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -- commit = @repository.commit(tag.target) -%li - %h4 - = link_to namespace_project_commits_path(@project.namespace, @project, tag.name), class: "" do - %i.fa.fa-tag - = tag.name - - if tag.message.present? - - = strip_gpg_signature(tag.message) - .pull-right - - if can? current_user, :download_code, @project - = render 'projects/repositories/download_archive', ref: tag.name, btn_class: 'btn-grouped btn-group-xs' - - if can?(current_user, :admin_project, @project) - = link_to namespace_project_tag_path(@project.namespace, @project, tag.name), class: 'btn btn-xs btn-remove remove-row grouped', method: :delete, data: { confirm: 'Removed tag cannot be restored. Are you sure?'}, remote: true do - %i.fa.fa-trash-o - - - if commit - %ul.list-unstyled - = render 'projects/commits/inline_commit', commit: commit, project: @project - - else - %p - Cant find HEAD commit for this tag diff --git a/app/views/projects/tags/destroy.js.haml b/app/views/projects/tags/destroy.js.haml deleted file mode 100644 index ada6710f940..00000000000 --- a/app/views/projects/tags/destroy.js.haml +++ /dev/null @@ -1,3 +0,0 @@ -$('.js-totaltags-count').html("#{@repository.tags.size}") -- if @repository.tags.size == 0 - $('.tags').load(document.URL + ' .nothing-here-block').hide().fadeIn(1000) diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml deleted file mode 100644 index f1bc2bc9a2b..00000000000 --- a/app/views/projects/tags/index.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -= render "projects/commits/head" - -%h3.page-title - Git Tags - - if can? current_user, :push_code, @project - .pull-right - = link_to new_namespace_project_tag_path(@project.namespace, @project), class: 'btn btn-create new-tag-btn' do - %i.fa.fa-add-sign - New tag - -%p.light - Tags give the ability to mark specific points in history as being important -%hr - -.tags - - unless @tags.empty? - %ul.bordered-list - - @tags.each do |tag| - = render 'tag', tag: @repository.find_tag(tag) - - = paginate @tags, theme: 'gitlab' - - - else - .nothing-here-block - Repository has no tags yet. - %br - %small - Use git tag command to add a new one: - %br - %span.monospace git tag -a v1.4 -m 'version 1.4' diff --git a/app/views/projects/tags/new.html.haml b/app/views/projects/tags/new.html.haml deleted file mode 100644 index 655044438d5..00000000000 --- a/app/views/projects/tags/new.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -- if @error - .alert.alert-danger - %button{ type: "button", class: "close", "data-dismiss" => "alert"} × - = @error -%h3.page-title - %i.fa.fa-code-fork - New tag -= form_tag namespace_project_tags_path, method: :post, id: "new-tag-form", class: "form-horizontal" do - .form-group - = label_tag :tag_name, 'Name for new tag', class: 'control-label' - .col-sm-10 - = text_field_tag :tag_name, params[:tag_name], placeholder: 'v3.0.1', required: true, tabindex: 1, class: 'form-control' - .form-group - = label_tag :ref, 'Create from', class: 'control-label' - .col-sm-10 - = text_field_tag :ref, params[:ref], placeholder: 'master', required: true, tabindex: 2, class: 'form-control' - .light Branch name or commit SHA - .form-group - = label_tag :message, 'Message', class: 'control-label' - .col-sm-10 - = text_field_tag :message, nil, placeholder: 'Enter message.', required: false, tabindex: 3, class: 'form-control' - .light (Optional) Entering a message will create an annotated tag. - .form-actions - = button_tag 'Create tag', class: 'btn btn-create', tabindex: 3 - = link_to 'Cancel', namespace_project_tags_path(@project.namespace, @project), class: 'btn btn-cancel' - -:javascript - disableButtonIfAnyEmptyField($("#new-tag-form"), ".form-control", ".btn-create"); - var availableTags = #{@project.repository.ref_names.to_json}; - - $("#ref").autocomplete({ - source: availableTags, - minLength: 1 - }); diff --git a/app/views/projects/transfer.js.haml b/app/views/projects/transfer.js.haml deleted file mode 100644 index 17b9fecfeb1..00000000000 --- a/app/views/projects/transfer.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -:plain - location.href = "#{edit_namespace_project_path(@project.namespace, @project)}"; diff --git a/app/views/projects/tree/_blob_item.html.haml b/app/views/projects/tree/_blob_item.html.haml deleted file mode 100644 index 02ecbade219..00000000000 --- a/app/views/projects/tree/_blob_item.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%tr{ class: "tree-item #{tree_hex_class(blob_item)}" } - %td.tree-item-file-name - = tree_icon(type, blob_item.mode, blob_item.name) - %span.str-truncated - = link_to blob_item.name, namespace_project_blob_path(@project.namespace, @project, tree_join(@id || @commit.id, blob_item.name)) - %td.tree_time_ago.cgray - = render 'spinner' - %td.hidden-xs.tree_commit diff --git a/app/views/projects/tree/_readme.html.haml b/app/views/projects/tree/_readme.html.haml deleted file mode 100644 index f082d711865..00000000000 --- a/app/views/projects/tree/_readme.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%article.readme-holder#README - = link_to '#README' do - %h4.readme-file-title - %i.fa.fa-file - = readme.name - .wiki - = render_readme(readme) diff --git a/app/views/projects/tree/_spinner.html.haml b/app/views/projects/tree/_spinner.html.haml deleted file mode 100644 index b47ad0f41e4..00000000000 --- a/app/views/projects/tree/_spinner.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%span.log_loading.hide - %i.fa.fa-spinner.fa-spin - Loading commit data... diff --git a/app/views/projects/tree/_submodule_item.html.haml b/app/views/projects/tree/_submodule_item.html.haml deleted file mode 100644 index 2b5f671c09e..00000000000 --- a/app/views/projects/tree/_submodule_item.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%tr{ class: "tree-item" } - %td.tree-item-file-name - %i.fa.fa-archive.fa-fw - = submodule_link(submodule_item, @ref) - %td - %td.hidden-xs diff --git a/app/views/projects/tree/_tree.html.haml b/app/views/projects/tree/_tree.html.haml deleted file mode 100644 index d304690d162..00000000000 --- a/app/views/projects/tree/_tree.html.haml +++ /dev/null @@ -1,53 +0,0 @@ -%ul.breadcrumb.repo-breadcrumb - %li - = link_to namespace_project_tree_path(@project.namespace, @project, @ref) do - = @project.path - - tree_breadcrumbs(tree, 6) do |title, path| - %li - - if path - = link_to truncate(title, length: 40), namespace_project_tree_path(@project.namespace, @project, path) - - else - = link_to title, '#' - - if current_user && can_push_branch?(@project, @ref) - %li - = link_to namespace_project_new_blob_path(@project.namespace, @project, @id), title: 'New file', id: 'new-file-link' do - %small - %i.fa.fa-plus - -%div#tree-content-holder.tree-content-holder - %table#tree-slider{class: "table_#{@hex_path} tree-table" } - %thead - %tr - %th Name - %th Last Update - %th.hidden-xs - .pull-left Last Commit - .last-commit.hidden-sm.pull-left - - %i.fa.fa-angle-right - - %small.light - = link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @commit) - – - = truncate(@commit.title, length: 50) - = link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id), class: 'pull-right' - - - if @path.present? - %tr.tree-item - %td.tree-item-file-name - = link_to "..", namespace_project_tree_path(@project.namespace, @project, up_dir_path), class: 'prepend-left-10' - %td - %td.hidden-xs - - = render_tree(tree) - - - if tree.readme - = render "projects/tree/readme", readme: tree.readme - -%div.tree_progress - -:javascript - // Load last commit log for each file in tree - $('#tree-slider').waitForImages(function() { - ajaxGet('#{@logs_path}'); - }); diff --git a/app/views/projects/tree/_tree_commit_column.html.haml b/app/views/projects/tree/_tree_commit_column.html.haml deleted file mode 100644 index 50521264a61..00000000000 --- a/app/views/projects/tree/_tree_commit_column.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%span.str-truncated - %span.tree_author= commit_author_link(commit, avatar: true, size: 16) - = link_to_gfm commit.title, namespace_project_commit_path(@project.namespace, @project, commit.id), class: "tree-commit-link" diff --git a/app/views/projects/tree/_tree_item.html.haml b/app/views/projects/tree/_tree_item.html.haml deleted file mode 100644 index e87138bf980..00000000000 --- a/app/views/projects/tree/_tree_item.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%tr{ class: "tree-item #{tree_hex_class(tree_item)}" } - %td.tree-item-file-name - = tree_icon(type, tree_item.mode, tree_item.name) - %span.str-truncated - - path = flatten_tree(tree_item) - = link_to path, namespace_project_tree_path(@project.namespace, @project, tree_join(@id || @commit.id, path)) - %td.tree_time_ago.cgray - = render 'spinner' - %td.hidden-xs.tree_commit diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml deleted file mode 100644 index feca1453697..00000000000 --- a/app/views/projects/tree/show.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -.tree-ref-holder - = render 'shared/ref_switcher', destination: 'tree', path: @path - -- if can? current_user, :download_code, @project - .tree-download-holder - = render 'projects/repositories/download_archive', ref: @ref, btn_class: 'btn-group-sm pull-right hidden-xs hidden-sm', split_button: true - -#tree-holder.tree-holder.clearfix - = render "tree", tree: @tree diff --git a/app/views/projects/update.js.haml b/app/views/projects/update.js.haml deleted file mode 100644 index 4f3f4cab8d5..00000000000 --- a/app/views/projects/update.js.haml +++ /dev/null @@ -1,9 +0,0 @@ -- if @project.valid? - :plain - location.href = "#{edit_namespace_project_path(@project.namespace, @project)}"; -- else - :plain - $(".project-edit-errors").html("#{escape_javascript(render('errors'))}"); - $('.save-project-loader').hide(); - $('.project-edit-container').show(); - $('.project-edit-content .btn-save').enableButton(); diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml deleted file mode 100644 index 9fbfa0b1aeb..00000000000 --- a/app/views/projects/wikis/_form.html.haml +++ /dev/null @@ -1,46 +0,0 @@ -= form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal wiki-form gfm-form' } do |f| - -if @page.errors.any? - #error_explanation - .alert.alert-danger - - @page.errors.full_messages.each do |msg| - %p= msg - - = f.hidden_field :title, value: @page.title - .form-group - = f.label :format, class: 'control-label' - .col-sm-10 - = f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: "form-control" - - .row - .col-sm-2 - .col-sm-10 - %p.cgray - To link to a (new) page you can just type - %code [Link Title](page-slug) - \. - - .form-group.wiki-content - = f.label :content, class: 'control-label' - .col-sm-10 - = render layout: 'projects/md_preview', locals: { preview_class: "wiki" } do - = render 'projects/zen', f: f, attr: :content, classes: 'description form-control' - .col-sm-12.hint - .pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'} - .pull-right Attach files by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. - - .clearfix - .error-alert - .form-group - = f.label :commit_message, class: 'control-label' - .col-sm-10= f.text_field :message, class: 'form-control', rows: 18 - - .form-actions - - if @page && @page.persisted? - = f.submit 'Save changes', class: "btn-save btn" - = link_to "Cancel", namespace_project_wiki_path(@project.namespace, @project, @page), class: "btn btn-cancel" - - else - = f.submit 'Create page', class: "btn-create btn" - = link_to "Cancel", namespace_project_wiki_path(@project.namespace, @project, :home), class: "btn btn-cancel" - -:javascript - window.project_uploads_path = "#{namespace_project_uploads_path @project.namespace, @project}"; diff --git a/app/views/projects/wikis/_main_links.html.haml b/app/views/projects/wikis/_main_links.html.haml deleted file mode 100644 index 633214a4e86..00000000000 --- a/app/views/projects/wikis/_main_links.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%span.pull-right - - if (@page && @page.persisted?) - = link_to history_namespace_project_wiki_path(@project.namespace, @project, @page), class: "btn btn-grouped" do - Page History - - if can?(current_user, :write_wiki, @project) - = link_to edit_namespace_project_wiki_path(@project.namespace, @project, @page), class: "btn btn-grouped" do - %i.fa.fa-pencil-square-o - Edit diff --git a/app/views/projects/wikis/_nav.html.haml b/app/views/projects/wikis/_nav.html.haml deleted file mode 100644 index 693c3facb32..00000000000 --- a/app/views/projects/wikis/_nav.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -%ul.nav.nav-tabs - = nav_link(html_options: {class: params[:id] == 'home' ? 'active' : '' }) do - = link_to 'Home', namespace_project_wiki_path(@project.namespace, @project, :home) - - = nav_link(path: 'wikis#pages') do - = link_to 'Pages', pages_namespace_project_wikis_path(@project.namespace, @project) - - = nav_link(path: 'wikis#git_access') do - = link_to git_access_namespace_project_wikis_path(@project.namespace, @project) do - %i.fa.fa-download - Git Access - - - if can?(current_user, :write_wiki, @project) - .pull-right - = link_to '#modal-new-wiki', class: "add-new-wiki btn btn-new", "data-toggle" => "modal" do - %i.fa.fa-plus - New Page - -= render 'projects/wikis/new' diff --git a/app/views/projects/wikis/_new.html.haml b/app/views/projects/wikis/_new.html.haml deleted file mode 100644 index 6834969de8b..00000000000 --- a/app/views/projects/wikis/_new.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%div#modal-new-wiki.modal.hide - .modal-dialog - .modal-content - .modal-header - %a.close{href: "#", "data-dismiss" => "modal"} × - %h3.page-title New Wiki Page - .modal-body - = label_tag :new_wiki_path do - %span Page slug - = text_field_tag :new_wiki_path, nil, placeholder: 'how-to-setup', class: 'form-control', required: true, :'data-wikis-path' => namespace_project_wikis_path(@project.namespace, @project) - %p.hint - Please don't use spaces. - .modal-footer - = link_to 'Build', '#', class: 'build-new-wiki btn btn-create' diff --git a/app/views/projects/wikis/edit.html.haml b/app/views/projects/wikis/edit.html.haml deleted file mode 100644 index 566850cb78d..00000000000 --- a/app/views/projects/wikis/edit.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -= render 'nav' -.pull-right - = render 'main_links' -%h3.page-title - Editing - - %span.light #{@page.title} -%hr -= render 'form' - -.pull-right - - if @page.persisted? && can?(current_user, :admin_wiki, @project) - = link_to namespace_project_wiki_path(@project.namespace, @project, @page), data: { confirm: "Are you sure you want to delete this page?"}, method: :delete, class: "btn btn-sm btn-remove" do - Delete this page diff --git a/app/views/projects/wikis/empty.html.haml b/app/views/projects/wikis/empty.html.haml deleted file mode 100644 index 48058124f97..00000000000 --- a/app/views/projects/wikis/empty.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3.page-title Empty page -%hr -.error_message - You are not allowed to create wiki pages diff --git a/app/views/projects/wikis/git_access.html.haml b/app/views/projects/wikis/git_access.html.haml deleted file mode 100644 index 365edb524f4..00000000000 --- a/app/views/projects/wikis/git_access.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -= render 'nav' -.row - .col-sm-6 - %h3.page-title - Git access for - %strong= @project_wiki.path_with_namespace - - .col-sm-6 - = render "shared/clone_panel", project: @project_wiki - -.git-empty - %fieldset - %legend Install Gollum: - %pre.dark - :preserve - gem install gollum - - %legend Clone Your Wiki: - %pre.dark - :preserve - git clone #{ content_tag(:span, default_url_to_repo(@project_wiki), class: 'clone')} - cd #{@project_wiki.path} - - %legend Start Gollum And Edit Locally: - %pre.dark - :preserve - gollum - == Sinatra/1.3.5 has taken the stage on 4567 for development with backup from Thin - >> Thin web server (v1.5.0 codename Knife) - >> Maximum connections set to 1024 - >> Listening on 0.0.0.0:4567, CTRL+C to stop diff --git a/app/views/projects/wikis/history.html.haml b/app/views/projects/wikis/history.html.haml deleted file mode 100644 index 91291f753f7..00000000000 --- a/app/views/projects/wikis/history.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -= render 'nav' -%h3.page-title - %span.light History for - = link_to @page.title, namespace_project_wiki_path(@project.namespace, @project, @page) - -%table.table - %thead - %tr - %th Page version - %th Author - %th Commit Message - %th Last updated - %th Format - %tbody - - @page.versions.each_with_index do |version, index| - - commit = version - %tr - %td - = link_to project_wiki_path_with_version(@project, @page, - commit.id, index == 0) do - = truncate_sha(commit.id) - %td - = commit.author.name - %td - = commit.message - %td - #{time_ago_with_tooltip(version.authored_date)} - %td - %strong - = @page.page.wiki.page(@page.page.name, commit.id).try(:format) diff --git a/app/views/projects/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml deleted file mode 100644 index ee233d9086f..00000000000 --- a/app/views/projects/wikis/pages.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -= render 'nav' -%h3.page-title - All Pages -%ul.bordered-list - - @wiki_pages.each do |wiki_page| - %li - %h4 - = link_to wiki_page.title, namespace_project_wiki_path(@project.namespace, @project, wiki_page) - %small (#{wiki_page.format}) - .pull-right - %small Last edited #{time_ago_with_tooltip(wiki_page.commit.authored_date)} -= paginate @wiki_pages, theme: 'gitlab' diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml deleted file mode 100644 index a6263e93f67..00000000000 --- a/app/views/projects/wikis/show.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -= render 'nav' -%h3.page-title - = @page.title - = render 'main_links' -- if @page.historical? - .warning_message - This is an old version of this page. - You can view the #{link_to "most recent version", namespace_project_wiki_path(@project.namespace, @project, @page)} or browse the #{link_to "history", history_namespace_project_wiki_path(@project.namespace, @project, @page)}. - -%hr - -.wiki-holder - .wiki - = preserve do - = render_wiki_content(@page) - -%hr - -.wiki-last-edit-by - Last edited by #{@page.commit.author.name} #{time_ago_with_tooltip(@page.commit.authored_date)} diff --git a/app/views/search/_filter.html.haml b/app/views/search/_filter.html.haml deleted file mode 100644 index ffc145497ab..00000000000 --- a/app/views/search/_filter.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -.dropdown.inline - %button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'} - %i.fa.fa-tags - %span.light Group: - - if @group.present? - %strong= @group.name - - else - Any - %b.caret - %ul.dropdown-menu - %li - = link_to search_filter_path(group_id: nil) do - Any - - current_user.authorized_groups.sort_by(&:name).each do |group| - %li - = link_to search_filter_path(group_id: group.id, project_id: nil) do - = group.name - -.dropdown.inline.prepend-left-10.project-filter - %button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'} - %i.fa.fa-tags - %span.light Project: - - if @project.present? - %strong= @project.name_with_namespace - - else - Any - %b.caret - %ul.dropdown-menu - %li - = link_to search_filter_path(project_id: nil) do - Any - - current_user.authorized_projects.sort_by(&:name_with_namespace).each do |project| - %li - = link_to search_filter_path(project_id: project.id, group_id: nil) do - = project.name_with_namespace diff --git a/app/views/search/_global_filter.html.haml b/app/views/search/_global_filter.html.haml deleted file mode 100644 index 442bd84f930..00000000000 --- a/app/views/search/_global_filter.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%ul.nav.nav-pills.nav-stacked.search-filter - %li{class: ("active" if @scope == 'projects')} - = link_to search_filter_path(scope: 'projects') do - Projects - .pull-right - = @search_results.projects_count - %li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - Issues - .pull-right - = @search_results.issues_count - %li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - Merge requests - .pull-right - = @search_results.merge_requests_count diff --git a/app/views/search/_project_filter.html.haml b/app/views/search/_project_filter.html.haml deleted file mode 100644 index ad933502a28..00000000000 --- a/app/views/search/_project_filter.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -%ul.nav.nav-pills.nav-stacked.search-filter - %li{class: ("active" if @scope == 'blobs')} - = link_to search_filter_path(scope: 'blobs') do - %i.fa.fa-code - Code - .pull-right - = @search_results.blobs_count - %li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - %i.fa.fa-exclamation-circle - Issues - .pull-right - = @search_results.issues_count - %li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - %i.fa.fa-code-fork - Merge requests - .pull-right - = @search_results.merge_requests_count - %li{class: ("active" if @scope == 'notes')} - = link_to search_filter_path(scope: 'notes') do - %i.fa.fa-comments - Comments - .pull-right - = @search_results.notes_count - %li{class: ("active" if @scope == 'wiki_blobs')} - = link_to search_filter_path(scope: 'wiki_blobs') do - %i.fa.fa-book - Wiki - .pull-right - = @search_results.wiki_blobs_count - diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml deleted file mode 100644 index 796dd752a4c..00000000000 --- a/app/views/search/_results.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -%h4 - #{@search_results.total_count} results found - - unless @show_snippets - - if @project - for #{link_to @project.name_with_namespace, [@project.namespace.becomes(Namespace), @project]} - - elsif @group - for #{link_to @group.name, @group} - -%hr - -.row - .col-sm-3 - - if @project - = render "project_filter" - - elsif @show_snippets - = render 'snippet_filter' - - else - = render "global_filter" - .col-sm-9 - .search-results - - if @search_results.empty? - = render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" } - - else - = render partial: "search/results/#{@scope.singularize}", collection: @objects - = paginate @objects, theme: 'gitlab' - -:javascript - $(".search-results .term").highlight("#{escape_javascript(params[:search])}"); diff --git a/app/views/search/_snippet_filter.html.haml b/app/views/search/_snippet_filter.html.haml deleted file mode 100644 index 95d23fa9f47..00000000000 --- a/app/views/search/_snippet_filter.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%ul.nav.nav-pills.nav-stacked.search-filter - %li{class: ("active" if @scope == 'snippet_blobs')} - = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do - %i.fa.fa-code - Snippet Contents - .pull-right - = @search_results.snippet_blobs_count - %li{class: ("active" if @scope == 'snippet_titles')} - = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do - %i.fa.fa-book - Titles and Filenames - .pull-right - = @search_results.snippet_titles_count diff --git a/app/views/search/results/_blob.html.haml b/app/views/search/results/_blob.html.haml deleted file mode 100644 index 84e9be82c44..00000000000 --- a/app/views/search/results/_blob.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -.blob-result - .file-holder - .file-title - = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(blob.ref, blob.filename), :anchor => "L" + blob.startline.to_s) do - %i.fa.fa-file - %strong - = blob.filename - .file-content.code.term - = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, user_color_scheme_class: 'white' diff --git a/app/views/search/results/_empty.html.haml b/app/views/search/results/_empty.html.haml deleted file mode 100644 index 01fb8cd9b8e..00000000000 --- a/app/views/search/results/_empty.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -.search_box - .search_glyph - %span.fa.fa-search - %h4 #{message} diff --git a/app/views/search/results/_issue.html.haml b/app/views/search/results/_issue.html.haml deleted file mode 100644 index ce8ddff9556..00000000000 --- a/app/views/search/results/_issue.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.search-result-row - %h4 - = link_to [issue.project.namespace.becomes(Namespace), issue.project, issue] do - %span.term.str-truncated= issue.title - .pull-right ##{issue.iid} - - if issue.description.present? - .description.term - = preserve do - = search_md_sanitize(markdown(issue.description)) - %span.light - #{issue.project.name_with_namespace} - - if issue.closed? - .pull-right - %span.label.label-danger Closed diff --git a/app/views/search/results/_merge_request.html.haml b/app/views/search/results/_merge_request.html.haml deleted file mode 100644 index 2efa616d664..00000000000 --- a/app/views/search/results/_merge_request.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -.search-result-row - %h4 - = link_to [merge_request.target_project.namespace.becomes(Namespace), merge_request.target_project, merge_request] do - %span.term.str-truncated= merge_request.title - .pull-right ##{merge_request.iid} - - if merge_request.description.present? - .description.term - = preserve do - = search_md_sanitize(markdown(merge_request.description)) - %span.light - #{merge_request.project.name_with_namespace} - .pull-right - - if merge_request.merged? - %span.label.label-primary Merged - - elsif merge_request.closed? - %span.label.label-danger Closed diff --git a/app/views/search/results/_note.html.haml b/app/views/search/results/_note.html.haml deleted file mode 100644 index 5fcba2b7e93..00000000000 --- a/app/views/search/results/_note.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -- project = note.project -.search-result-row - %h5.note-search-caption.str-truncated - %i.fa.fa-comment - = link_to_member(project, note.author, avatar: false) - commented on - - - if note.for_commit? - = link_to project do - = project.name_with_namespace - · - = link_to namespace_project_commit_path(project.namespace, project, note.commit_id, anchor: dom_id(note)) do - Commit #{truncate_sha(note.commit_id)} - - else - = link_to project do - = project.name_with_namespace - · - %span #{note.noteable_type.titleize} ##{note.noteable.iid} - · - = link_to [project.namespace.becomes(Namespace), project, note.noteable, anchor: dom_id(note)] do - = note.noteable.title - - .note-search-result - .term - = preserve do - = search_md_sanitize(markdown(note.note, {no_header_anchors: true})) diff --git a/app/views/search/results/_project.html.haml b/app/views/search/results/_project.html.haml deleted file mode 100644 index 195cf06c8ea..00000000000 --- a/app/views/search/results/_project.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.search-result-row - %h4 - = link_to [project.namespace.becomes(Namespace), project] do - %span.term= project.name_with_namespace - - if project.description.present? - %span.light.term= project.description diff --git a/app/views/search/results/_snippet_blob.html.haml b/app/views/search/results/_snippet_blob.html.haml deleted file mode 100644 index 8af393777f0..00000000000 --- a/app/views/search/results/_snippet_blob.html.haml +++ /dev/null @@ -1,59 +0,0 @@ -.search-result-row - %span - = snippet_blob[:snippet_object].title - by - = link_to user_snippets_path(snippet_blob[:snippet_object].author) do - = image_tag avatar_icon(snippet_blob[:snippet_object].author_email), class: "avatar avatar-inline s16", alt: '' - = snippet_blob[:snippet_object].author_name - %span.light #{time_ago_with_tooltip(snippet_blob[:snippet_object].created_at)} - %h4.snippet-title - - snippet_path = reliable_snippet_path(snippet_blob[:snippet_object]) - = link_to snippet_path do - .file-holder - .file-title - %i.fa.fa-file - %strong= snippet_blob[:snippet_object].file_name - - if gitlab_markdown?(snippet_blob[:snippet_object].file_name) - .file-content.wiki - - snippet_blob[:snippet_chunks].each do |snippet| - - unless snippet[:data].empty? - = preserve do - = markdown(snippet[:data]) - - else - .file-content.code - .nothing-here-block Empty file - - elsif markup?(snippet_blob[:snippet_object].file_name) - .file-content.wiki - - snippet_blob[:snippet_chunks].each do |snippet| - - unless snippet[:data].empty? - = render_markup(snippet_blob[:snippet_object].file_name, snippet[:data]) - - else - .file-content.code - .nothing-here-block Empty file - - else - .file-content.code - %div.highlighted-data{class: user_color_scheme_class} - .line-numbers - - snippet_blob[:snippet_chunks].each do |snippet| - - unless snippet[:data].empty? - - snippet[:data].lines.to_a.size.times do |index| - - offset = defined?(snippet[:start_line]) ? snippet[:start_line] : 1 - - i = index + offset - = link_to snippet_path+"#L#{i}", id: "L#{i}", rel: "#L#{i}" do - %i.fa.fa-link - = i - - unless snippet == snippet_blob[:snippet_chunks].last - %a - = "." - .highlight.term - %pre - %code - - snippet_blob[:snippet_chunks].each do |snippet| - - unless snippet[:data].empty? - = snippet[:data] - - unless snippet == snippet_blob[:snippet_chunks].last - %a - = "..." - - else - .file-content.code - .nothing-here-block Empty file diff --git a/app/views/search/results/_snippet_title.html.haml b/app/views/search/results/_snippet_title.html.haml deleted file mode 100644 index c414acb6a11..00000000000 --- a/app/views/search/results/_snippet_title.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -.search-result-row - %h4.snippet-title.term - = link_to reliable_snippet_path(snippet_title) do - = truncate(snippet_title.title, length: 60) - - if snippet_title.private? - %span.label.label-gray - %i.fa.fa-lock - private - %span.cgray.monospace.tiny.pull-right.term - = snippet_title.file_name - - %small.pull-right.cgray - - if snippet_title.project_id? - = link_to snippet_title.project.name_with_namespace, namespace_project_path(snippet_title.project.namespace, snippet_title.project) - - .snippet-info - = "##{snippet_title.id}" - %span - by - = link_to user_snippets_path(snippet_title.author) do - = image_tag avatar_icon(snippet_title.author_email), class: "avatar avatar-inline s16", alt: '' - = snippet_title.author_name - %span.light #{time_ago_with_tooltip(snippet_title.created_at)} diff --git a/app/views/search/results/_wiki_blob.html.haml b/app/views/search/results/_wiki_blob.html.haml deleted file mode 100644 index f9c5810e3d0..00000000000 --- a/app/views/search/results/_wiki_blob.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -.blob-result - .file-holder - .file-title - = link_to namespace_project_wiki_path(@project.namespace, @project, wiki_blob.filename) do - %i.fa.fa-file - %strong - = wiki_blob.filename - .file-content.code.term - = render 'shared/file_highlight', blob: wiki_blob, first_line_number: wiki_blob.startline, user_color_scheme_class: 'white' diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml deleted file mode 100644 index 5b4816e4c40..00000000000 --- a/app/views/search/show.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -= form_tag search_path, method: :get, class: 'form-horizontal' do |f| - .search-holder.clearfix - .form-group - = label_tag :search, class: 'control-label' do - %span Looking for - .col-sm-6 - = search_field_tag :search, params[:search], placeholder: "issue 143", class: "form-control search-text-input", id: "dashboard_search" - .col-sm-4 - = button_tag 'Search', class: "btn btn-create" - .form-group - .col-sm-2 - - unless params[:snippets].eql? 'true' - .col-sm-10 - = render 'filter', f: f - = hidden_field_tag :project_id, params[:project_id] - = hidden_field_tag :group_id, params[:group_id] - = hidden_field_tag :snippets, params[:snippets] - = hidden_field_tag :scope, params[:scope] - - .results.prepend-top-10 - - if params[:search].present? - = render 'search/results' diff --git a/app/views/shared/_choose_group_avatar_button.html.haml b/app/views/shared/_choose_group_avatar_button.html.haml deleted file mode 100644 index 000532b1c9a..00000000000 --- a/app/views/shared/_choose_group_avatar_button.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%a.choose-btn.btn.btn-sm.js-choose-group-avatar-button - %i.fa.fa-paperclip - %span Choose File ... - -%span.file_name.js-avatar-filename File name... -= f.file_field :avatar, class: 'js-group-avatar-input hidden' -.light The maximum file size allowed is 200KB. diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml deleted file mode 100644 index a1121750ca3..00000000000 --- a/app/views/shared/_clone_panel.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- project = project || @project -.git-clone-holder.input-group - .input-group-btn - %button{ | - class: "btn #{ 'active' if default_clone_protocol == 'ssh' }#{ ' has_tooltip' if current_user && current_user.require_ssh_key? }", | - :"data-clone" => project.ssh_url_to_repo, | - :"data-title" => "Add an SSH key to your profile<br> to pull or push via SSH", - :"data-html" => "true", - :"data-container" => "body"} - SSH - %button{ | - class: "btn #{ 'active' if default_clone_protocol == 'http' }#{ ' has_tooltip' if current_user && current_user.require_password? }", | - :"data-clone" => project.http_url_to_repo, | - :"data-title" => "Set a password on your account<br> to pull or push via #{gitlab_config.protocol.upcase}", - :"data-html" => "true", - :"data-container" => "body"} - = gitlab_config.protocol.upcase - = text_field_tag :project_clone, default_url_to_repo(project), class: "one_click_select form-control", readonly: true - - if project.kind_of?(Project) - .input-group-addon - .visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(project.visibility_level)} project" } - = visibility_level_icon(project.visibility_level) - = visibility_level_label(project.visibility_level).downcase diff --git a/app/views/shared/_commit_message_container.html.haml b/app/views/shared/_commit_message_container.html.haml deleted file mode 100644 index 5071ff640f1..00000000000 --- a/app/views/shared/_commit_message_container.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.form-group.commit_message-group - = label_tag 'commit_message', class: 'control-label' do - Commit message - .col-sm-10 - .commit-message-container - .max-width-marker - = text_area_tag 'commit_message', - (params[:commit_message] || local_assigns[:text]), - class: 'form-control', placeholder: local_assigns[:placeholder], - required: true, rows: (local_assigns[:rows] || 3) - - if local_assigns[:hint] - %p.hint - Try to keep the first line under 52 characters - and the others under 72. diff --git a/app/views/shared/_confirm_modal.html.haml b/app/views/shared/_confirm_modal.html.haml deleted file mode 100644 index 30ba361c860..00000000000 --- a/app/views/shared/_confirm_modal.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -#modal-confirm-danger.modal.hide{tabindex: -1} - .modal-dialog - .modal-content - .modal-header - %a.close{href: "#", "data-dismiss" => "modal"} × - %h4 Confirmation required - - .modal-body - %p.cred.lead.js-confirm-text - - %p - This action can lead to data loss. - To prevent accidental actions we ask you to confirm your intention. - %br - Please type - %code.js-confirm-danger-match #{phrase} - to proceed or close this modal to cancel - - .form-group - = text_field_tag 'confirm_name_input', '', class: 'form-control js-confirm-danger-input' - .form-group - = submit_tag 'Confirm', class: "btn btn-danger js-confirm-danger-submit" diff --git a/app/views/shared/_event_filter.html.haml b/app/views/shared/_event_filter.html.haml deleted file mode 100644 index d07a9e2b924..00000000000 --- a/app/views/shared/_event_filter.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -%ul.nav.nav-pills.event_filter - = event_filter_link EventFilter.push, 'Push events' - = event_filter_link EventFilter.merged, 'Merge events' - = event_filter_link EventFilter.comments, 'Comments' - = event_filter_link EventFilter.team, 'Team' - - - if current_user - - if current_controller?(:dashboard) - %li.pull-right - = link_to dashboard_path(:atom, { private_token: current_user.private_token }), class: 'rss-btn' do - %i.fa.fa-rss - News Feed - - - if current_controller?(:groups) - %li.pull-right - = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed", class: 'rss-btn' do - %i.fa.fa-rss - News Feed -%hr diff --git a/app/views/shared/_file_highlight.html.haml b/app/views/shared/_file_highlight.html.haml deleted file mode 100644 index fba69dd0f3f..00000000000 --- a/app/views/shared/_file_highlight.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.file-content.code{class: user_color_scheme_class} - .line-numbers - - if blob.data.present? - - blob.data.lines.to_a.size.times do |index| - - offset = defined?(first_line_number) ? first_line_number : 1 - - i = index + offset - = link_to "#L#{i}", id: "L#{i}", rel: "#L#{i}" do - %i.fa.fa-link - = i - :preserve - #{highlight(blob.name, blob.data)} diff --git a/app/views/shared/_group_form.html.haml b/app/views/shared/_group_form.html.haml deleted file mode 100644 index c0a9923348e..00000000000 --- a/app/views/shared/_group_form.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -- if @group.persisted? - .form-group - = f.label :name, class: 'control-label' do - Group name - .col-sm-10 - = f.text_field :name, placeholder: 'open-source', class: 'form-control' - -.form-group - = f.label :path, class: 'control-label' do - Group path - .col-sm-10 - .input-group - .input-group-addon - = root_url - = f.text_field :path, placeholder: 'open-source', class: 'form-control', - autofocus: local_assigns[:autofocus] || false - - if @group.persisted? - .alert.alert-warning.prepend-top-10 - %ul - %li Changing group path can have unintended side effects. - %li Renaming group path will rename directory for all related projects - %li It will change web url for access group and group projects. - %li It will change the git path to repositories under this group. - -.form-group.group-description-holder - = f.label :description, 'Details', class: 'control-label' - .col-sm-10 - = f.text_area :description, maxlength: 250, - class: 'form-control js-gfm-input', rows: 4 diff --git a/app/views/shared/_group_tips.html.haml b/app/views/shared/_group_tips.html.haml deleted file mode 100644 index e5cf783beb7..00000000000 --- a/app/views/shared/_group_tips.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%ul - %li A group is a collection of several projects - %li Groups are private by default - %li Members of a group may only view projects they have permission to access - %li Group project URLs are prefixed with the group namespace - %li Existing projects may be moved into a group diff --git a/app/views/shared/_issuable_filter.html.haml b/app/views/shared/_issuable_filter.html.haml deleted file mode 100644 index 83f5a3a8015..00000000000 --- a/app/views/shared/_issuable_filter.html.haml +++ /dev/null @@ -1,58 +0,0 @@ -.issues-filters - .issues-state-filters - %ul.nav.nav-tabs - %li{class: ("active" if params[:state] == 'opened')} - = link_to page_filter_path(state: 'opened') do - %i.fa.fa-exclamation-circle - Open - %li{class: ("active" if params[:state] == 'closed')} - = link_to page_filter_path(state: 'closed') do - %i.fa.fa-check-circle - Closed - %li{class: ("active" if params[:state] == 'all')} - = link_to page_filter_path(state: 'all') do - %i.fa.fa-compass - All - - .issues-details-filters - = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_id, :label_name]), method: :get, class: 'filter-form' do - - if controller.controller_name == 'issues' - .check-all-holder - = check_box_tag "check_all_issues", nil, false, - class: "check_all_issues left", - disabled: !can?(current_user, :modify_issue, @project) - .issues-other-filters - .filter-item.inline - = users_select_tag(:assignee_id, selected: params[:assignee_id], - placeholder: 'Assignee', class: 'trigger-submit', any_user: true, null_user: true, first_user: true) - - .filter-item.inline - = users_select_tag(:author_id, selected: params[:author_id], - placeholder: 'Author', class: 'trigger-submit', any_user: true, first_user: true) - - .filter-item.inline.milestone-filter - = select_tag('milestone_id', projects_milestones_options, class: "select2 trigger-submit", prompt: 'Milestone') - - - if @project - .filter-item.inline.labels-filter - = select_tag('label_name', project_labels_options(@project), class: "select2 trigger-submit", prompt: 'Label') - - .pull-right - = render 'shared/sort_dropdown' - - - if controller.controller_name == 'issues' - .issues_bulk_update.hide - = form_tag bulk_update_namespace_project_issues_path(@project.namespace, @project), method: :post do - = select_tag('update[state_event]', options_for_select([['Open', 'reopen'], ['Closed', 'close']]), prompt: "Status", class: 'form-control') - = users_select_tag('update[assignee_id]', placeholder: 'Assignee', null_user: true) - = select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone") - = hidden_field_tag 'update[issues_ids]', [] - = hidden_field_tag :state_event, params[:state_event] - = button_tag "Update issues", class: "btn update_selected_issues btn-save" - -:coffeescript - new UsersSelect() - - $('form.filter-form').on 'submit', (event) -> - event.preventDefault() - Turbolinks.visit @.action + '&' + $(@).serialize() diff --git a/app/views/shared/_issuable_search_form.html.haml b/app/views/shared/_issuable_search_form.html.haml deleted file mode 100644 index 639d203dcd6..00000000000 --- a/app/views/shared/_issuable_search_form.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -= form_tag(path, method: :get, id: "issue_search_form", class: 'pull-left issue-search-form') do - .append-right-10.hidden-xs.hidden-sm - = search_field_tag :issue_search, params[:issue_search], { placeholder: 'Filter by title or description', class: 'form-control issue_search search-text-input input-mn-300' } - = hidden_field_tag :state, params['state'] - = hidden_field_tag :scope, params['scope'] - = hidden_field_tag :assignee_id, params['assignee_id'] - = hidden_field_tag :author_id, params['author_id'] - = hidden_field_tag :milestone_id, params['milestone_id'] - = hidden_field_tag :label_id, params['label_id'] diff --git a/app/views/shared/_issues.html.haml b/app/views/shared/_issues.html.haml deleted file mode 100644 index 0dbb6a04393..00000000000 --- a/app/views/shared/_issues.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- if @issues.any? - - @issues.group_by(&:project).each do |group| - .panel.panel-default.panel-small - - project = group[0] - .panel-heading - = link_to_project project - = link_to 'show all', namespace_project_issues_path(project.namespace, project), class: 'pull-right' - - %ul.well-list.issues-list - - group[1].each do |issue| - = render 'projects/issues/issue', issue: issue - = paginate @issues, theme: "gitlab" -- else - .nothing-here-block No issues to show - diff --git a/app/views/shared/_merge_requests.html.haml b/app/views/shared/_merge_requests.html.haml deleted file mode 100644 index c02c5af008a..00000000000 --- a/app/views/shared/_merge_requests.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -- if @merge_requests.any? - - @merge_requests.group_by(&:target_project).each do |group| - .panel.panel-default.panel-small - - project = group[0] - .panel-heading - = link_to_project project - = link_to 'show all', namespace_project_merge_requests_path(project.namespace, project), class: 'pull-right' - %ul.well-list.mr-list - - group[1].each do |merge_request| - = render 'projects/merge_requests/merge_request', merge_request: merge_request - = paginate @merge_requests, theme: "gitlab" - -- else - .nothing-here-block No merge requests to show diff --git a/app/views/shared/_milestones_filter.html.haml b/app/views/shared/_milestones_filter.html.haml deleted file mode 100644 index f685ae7726c..00000000000 --- a/app/views/shared/_milestones_filter.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.milestones-filters.append-bottom-10 - %ul.nav.nav-tabs - %li{class: ("active" if params[:state].blank? || params[:state] == 'opened')} - = link_to milestones_filter_path(state: 'opened') do - %i.fa.fa-exclamation-circle - Open - %li{class: ("active" if params[:state] == 'closed')} - = link_to milestones_filter_path(state: 'closed') do - %i.fa.fa-check-circle - Closed - %li{class: ("active" if params[:state] == 'all')} - = link_to milestones_filter_path(state: 'all') do - %i.fa.fa-compass - All diff --git a/app/views/shared/_no_password.html.haml b/app/views/shared/_no_password.html.haml deleted file mode 100644 index a43bf33751a..00000000000 --- a/app/views/shared/_no_password.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -- if cookies[:hide_no_password_message].blank? && !current_user.hide_no_password && current_user.require_password? - .no-password-message.alert.alert-warning.hidden-xs - You won't be able to pull or push project code via #{gitlab_config.protocol.upcase} until you #{link_to 'set a password', edit_profile_password_path} on your account - - .pull-right - = link_to "Don't show again", profile_path(user: {hide_no_password: true}), method: :put - | - = link_to 'Remind later', '#', class: 'hide-no-password-message' diff --git a/app/views/shared/_no_ssh.html.haml b/app/views/shared/_no_ssh.html.haml deleted file mode 100644 index 089179e677a..00000000000 --- a/app/views/shared/_no_ssh.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -- if cookies[:hide_no_ssh_message].blank? && !current_user.hide_no_ssh_key && current_user.require_ssh_key? - .no-ssh-key-message.alert.alert-warning.hidden-xs - You won't be able to pull or push project code via SSH until you #{link_to 'add an SSH key', new_profile_key_path, class: 'alert-link'} to your profile - - .pull-right - = link_to "Don't show again", profile_path(user: {hide_no_ssh_key: true}), method: :put, class: 'alert-link' - | - = link_to 'Remind later', '#', class: 'hide-no-ssh-message alert-link' diff --git a/app/views/shared/_outdated_browser.html.haml b/app/views/shared/_outdated_browser.html.haml deleted file mode 100644 index 0eba1fe075f..00000000000 --- a/app/views/shared/_outdated_browser.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -- if outdated_browser? - - link = "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/requirements.md#supported-web-browsers" - .browser-alert - GitLab may not work properly because you are using an outdated web browser. - %br - Please install a - = link_to 'supported web browser', link - for a better experience. diff --git a/app/views/shared/_project.html.haml b/app/views/shared/_project.html.haml deleted file mode 100644 index 722a7f7ce0f..00000000000 --- a/app/views/shared/_project.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -= cache [project.namespace, project, controller.controller_name, controller.action_name] do - = link_to project_path(project), class: dom_class(project) do - - if avatar - .dash-project-avatar - = project_icon(project, alt: '', class: 'avatar project-avatar s40') - .dash-project-access-icon - = visibility_level_icon(project.visibility_level) - %span.str-truncated - %span.namespace-name - - if project.namespace - = project.namespace.human_name - \/ - %span.project-name.filter-title - = project.name - - if stars - %span.pull-right.light - %i.fa.fa-star - = project.star_count - - else - %span.arrow - %i.fa.fa-angle-right diff --git a/app/views/shared/_projects_list.html.haml b/app/views/shared/_projects_list.html.haml deleted file mode 100644 index 4c58092af44..00000000000 --- a/app/views/shared/_projects_list.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- projects_limit = 20 unless local_assigns[:projects_limit] -- avatar = true unless local_assigns[:avatar] == false -- stars = false unless local_assigns[:stars] == true -%ul.well-list.projects-list - - projects.each_with_index do |project, i| - %li{class: (i >= projects_limit) ? 'project-row hide' : 'project-row'} - = render "shared/project", project: project, avatar: avatar, stars: stars - - if projects.blank? - %li - .nothing-here-block There are no projects here. - - if projects.count > projects_limit - %li.bottom - %span.light - #{projects_limit} of #{pluralize(projects.count, 'project')} displayed. - %span - = link_to '#', class: 'js-expand' do - Show all diff --git a/app/views/shared/_promo.html.haml b/app/views/shared/_promo.html.haml deleted file mode 100644 index 3596aabe309..00000000000 --- a/app/views/shared/_promo.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.gitlab-promo - = link_to 'Homepage', promo_url - = link_to "Blog", promo_url + '/blog/' - = link_to "@gitlab", "https://twitter.com/gitlab" - = link_to "Requests", "http://feedback.gitlab.com/" diff --git a/app/views/shared/_ref_switcher.html.haml b/app/views/shared/_ref_switcher.html.haml deleted file mode 100644 index eb2e1919e19..00000000000 --- a/app/views/shared/_ref_switcher.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -= form_tag switch_namespace_project_refs_path(@project.namespace, @project), method: :get, class: "project-refs-form" do - = select_tag "ref", grouped_options_refs, class: "project-refs-select select2 select2-sm" - = hidden_field_tag :destination, destination - - if defined?(path) - = hidden_field_tag :path, path - - @options && @options.each do |key, value| - = hidden_field_tag key, value, id: nil diff --git a/app/views/shared/_sort_dropdown.html.haml b/app/views/shared/_sort_dropdown.html.haml deleted file mode 100644 index af3d35de325..00000000000 --- a/app/views/shared/_sort_dropdown.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -.dropdown.inline.prepend-left-10 - %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'} - %span.light sort: - - if @sort.present? - = sort_options_hash[@sort] - - else - = sort_title_recently_created - %b.caret - %ul.dropdown-menu.dropdown-menu-align-right - %li - = link_to page_filter_path(sort: sort_value_recently_created) do - = sort_title_recently_created - = link_to page_filter_path(sort: sort_value_oldest_created) do - = sort_title_oldest_created - = link_to page_filter_path(sort: sort_value_recently_updated) do - = sort_title_recently_updated - = link_to page_filter_path(sort: sort_value_oldest_updated) do - = sort_title_oldest_updated - = link_to page_filter_path(sort: sort_value_milestone_soon) do - = sort_title_milestone_soon - = link_to page_filter_path(sort: sort_value_milestone_later) do - = sort_title_milestone_later diff --git a/app/views/shared/snippets/_blob.html.haml b/app/views/shared/snippets/_blob.html.haml deleted file mode 100644 index 30458793fd1..00000000000 --- a/app/views/shared/snippets/_blob.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -- unless @snippet.content.empty? - - if gitlab_markdown?(@snippet.file_name) - .file-content.wiki - = preserve do - = markdown(@snippet.data) - - elsif markup?(@snippet.file_name) - .file-content.wiki - = render_markup(@snippet.file_name, @snippet.data) - - else - .file-content.code - = render 'shared/file_highlight', blob: @snippet -- else - .file-content.code - .nothing-here-block Empty file diff --git a/app/views/shared/snippets/_form.html.haml b/app/views/shared/snippets/_form.html.haml deleted file mode 100644 index 4e0663ea208..00000000000 --- a/app/views/shared/snippets/_form.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -.snippet-form-holder - = form_for @snippet, url: url, html: { class: "form-horizontal snippet-form" } do |f| - - if @snippet.errors.any? - .alert.alert-danger - %ul - - @snippet.errors.full_messages.each do |msg| - %li= msg - - .form-group - = f.label :title, class: 'control-label' - .col-sm-10= f.text_field :title, placeholder: "Example Snippet", class: 'form-control', required: true - - = render "shared/snippets/visibility_level", f: f, visibility_level: gitlab_config.default_projects_features.visibility_level, can_change_visibility_level: true - - .form-group - .file-editor - = f.label :file_name, "File", class: 'control-label' - .col-sm-10 - .file-holder.snippet - .file-title - = f.text_field :file_name, placeholder: "example.rb", class: 'form-control snippet-file-name', required: true - .file-content.code - %pre#editor= @snippet.content - = f.hidden_field :content, class: 'snippet-file-content' - - .form-actions - - if @snippet.new_record? - = f.submit 'Create snippet', class: "btn-create btn" - - else - = f.submit 'Save', class: "btn-save btn" - - - if @snippet.respond_to?(:project) - = link_to "Cancel", namespace_project_snippets_path(@project.namespace, @project), class: "btn btn-cancel" - - else - = link_to "Cancel", snippets_path(@project), class: "btn btn-cancel" - -:javascript - var editor = ace.edit("editor"); - $(".snippet-form-holder form").submit(function(){ - $(".snippet-file-content").val(editor.getValue()); - }); diff --git a/app/views/shared/snippets/_visibility_level.html.haml b/app/views/shared/snippets/_visibility_level.html.haml deleted file mode 100644 index 9acff18e450..00000000000 --- a/app/views/shared/snippets/_visibility_level.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -.form-group.project-visibility-level-holder - = f.label :visibility_level, class: 'control-label' do - Visibility Level - = link_to "(?)", help_page_path("public_access", "public_access") - .col-sm-10 - - if can_change_visibility_level - - Gitlab::VisibilityLevel.values.each do |level| - .radio - - restricted = restricted_visibility_levels.include?(level) - = f.radio_button :visibility_level, level, disabled: restricted - = label "#{dom_class(@snippet)}_visibility_level", level do - = visibility_level_icon(level) - .option-title - = visibility_level_label(level) - .option-descr - = snippet_visibility_level_description(level) - - unless restricted_visibility_levels.empty? - .col-sm-10 - %span.info - Some visibility level settings have been restricted by the administrator. - - else - .col-sm-10 - %span.info - = visibility_level_icon(visibility_level) - %strong - = visibility_level_label(visibility_level) - .light= visibility_level_description(visibility_level) diff --git a/app/views/snippets/_snippet.html.haml b/app/views/snippets/_snippet.html.haml deleted file mode 100644 index 5bb28664349..00000000000 --- a/app/views/snippets/_snippet.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%li - %h4.snippet-title - = link_to reliable_snippet_path(snippet) do - = truncate(snippet.title, length: 60) - - if snippet.private? - %span.label.label-gray - %i.fa.fa-lock - private - %span.cgray.monospace.tiny.pull-right - = snippet.file_name - - %small.pull-right.cgray - - if snippet.project_id? - = link_to snippet.project.name_with_namespace, namespace_project_path(snippet.project.namespace, snippet.project) - - .snippet-info - = "##{snippet.id}" - %span - by - = link_to user_snippets_path(snippet.author) do - = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: '' - = snippet.author_name - %span.light #{time_ago_with_tooltip(snippet.created_at)} diff --git a/app/views/snippets/_snippets.html.haml b/app/views/snippets/_snippets.html.haml deleted file mode 100644 index 40df42b6cf5..00000000000 --- a/app/views/snippets/_snippets.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%ul.bordered-list - = render partial: 'snippet', collection: @snippets - - if @snippets.empty? - %li - .nothing-here-block Nothing here. - -= paginate @snippets, theme: 'gitlab' diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml deleted file mode 100644 index 0df5ade500d..00000000000 --- a/app/views/snippets/current_user_index.html.haml +++ /dev/null @@ -1,39 +0,0 @@ -%h3.page-title - Your Snippets - .pull-right - = link_to new_snippet_path, class: "btn btn-new btn-grouped", title: "New Snippet" do - Add new snippet - = link_to snippets_path, class: "btn btn-grouped" do - Discover snippets - -%p.light - Share code pastes with others out of git repository -%hr - -.row - .col-md-3 - %ul.nav.nav-pills.nav-stacked - = nav_tab :scope, nil do - = link_to user_snippets_path(@user) do - All - %span.pull-right - = @user.snippets.count - = nav_tab :scope, 'are_private' do - = link_to user_snippets_path(@user, scope: 'are_private') do - Private - %span.pull-right - = @user.snippets.are_private.count - = nav_tab :scope, 'are_internal' do - = link_to user_snippets_path(@user, scope: 'are_internal') do - Internal - %span.pull-right - = @user.snippets.are_internal.count - = nav_tab :scope, 'are_public' do - = link_to user_snippets_path(@user, scope: 'are_public') do - Public - %span.pull-right - = @user.snippets.are_public.count - - .col-md-9.my-snippets - = render 'snippets' - diff --git a/app/views/snippets/edit.html.haml b/app/views/snippets/edit.html.haml deleted file mode 100644 index 7042d07d5e8..00000000000 --- a/app/views/snippets/edit.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3.page-title - Edit snippet -%hr -= render "shared/snippets/form", url: snippet_path(@snippet) diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml deleted file mode 100644 index 5cd8ae26cf9..00000000000 --- a/app/views/snippets/index.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -%h3.page-title - Public snippets - - .pull-right - - - if current_user - = link_to new_snippet_path, class: "btn btn-new btn-grouped", title: "New Snippet" do - Add new snippet - = link_to user_snippets_path(current_user), class: "btn btn-grouped" do - Your snippets - -%p.light - Public snippets created by you and other users are listed here - -%hr -= render 'snippets' - diff --git a/app/views/snippets/new.html.haml b/app/views/snippets/new.html.haml deleted file mode 100644 index 694d7058317..00000000000 --- a/app/views/snippets/new.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3.page-title - New snippet -%hr -= render "shared/snippets/form", url: snippets_path(@snippet) diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml deleted file mode 100644 index 5204fb9a907..00000000000 --- a/app/views/snippets/show.html.haml +++ /dev/null @@ -1,43 +0,0 @@ -%h3.page-title - = @snippet.title - - - if @snippet.private? - %span.label.label-success - %i.fa.fa-lock - private - - .pull-right - = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do - Add new snippet -%hr - -.append-bottom-20 - .pull-right - = "##{@snippet.id}" - %span.light - by - = link_to user_snippets_path(@snippet.author) do - = image_tag avatar_icon(@snippet.author_email), class: "avatar avatar-inline s16", alt: '' - = @snippet.author_name - - .back-link - - if @snippet.author == current_user - = link_to user_snippets_path(current_user) do - ← your snippets - - else - = link_to snippets_path do - ← discover snippets - -.file-holder - .file-title - %i.fa.fa-file - %strong - = @snippet.file_name - .file-actions - .btn-group - - if can?(current_user, :modify_personal_snippet, @snippet) - = link_to "edit", edit_snippet_path(@snippet), class: "btn btn-sm", title: 'Edit Snippet' - = link_to "raw", raw_snippet_path(@snippet), class: "btn btn-sm", target: "_blank" - - if can?(current_user, :admin_personal_snippet, @snippet) - = link_to "remove", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-sm btn-remove", title: 'Delete Snippet' - = render 'shared/snippets/blob' diff --git a/app/views/snippets/user_index.html.haml b/app/views/snippets/user_index.html.haml deleted file mode 100644 index df524cd18b0..00000000000 --- a/app/views/snippets/user_index.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%h3.page-title - = image_tag avatar_icon(@user.email), class: "avatar s24" - = @user.name - %span - \/ - Snippets - - if current_user - = link_to new_snippet_path, class: "btn btn-sm add_new pull-right", title: "New Snippet" do - Add new snippet - -%hr - -= render 'snippets' diff --git a/app/views/users/_groups.html.haml b/app/views/users/_groups.html.haml deleted file mode 100644 index f360fbb3d5d..00000000000 --- a/app/views/users/_groups.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -.clearfix - - groups.each do |group| - = link_to group, class: 'profile-groups-avatars inline', title: group.name do - = image_tag group_icon(group), class: 'avatar group-avatar s40' diff --git a/app/views/users/_profile.html.haml b/app/views/users/_profile.html.haml deleted file mode 100644 index 90d9980c85c..00000000000 --- a/app/views/users/_profile.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -.panel.panel-default - .panel-heading - Profile - %ul.well-list - %li - %span.light Member since - %strong= user.created_at.stamp("Aug 21, 2011") - - unless user.public_email.blank? - %li - %span.light E-mail: - %strong= link_to user.public_email, "mailto:#{user.public_email}" - - unless user.skype.blank? - %li - %span.light Skype: - %strong= link_to user.skype, "skype:#{user.skype}" - - unless user.linkedin.blank? - %li - %span.light LinkedIn: - %strong= link_to user.linkedin, "http://www.linkedin.com/in/#{user.linkedin}" - - unless user.twitter.blank? - %li - %span.light Twitter: - %strong= link_to user.twitter, "http://www.twitter.com/#{user.twitter}" - - unless user.website_url.blank? - %li - %span.light Website: - %strong= link_to user.short_website_url, user.full_website_url - - unless user.location.blank? - %li - %span.light Location: - %strong= user.location diff --git a/app/views/users/_projects.html.haml b/app/views/users/_projects.html.haml deleted file mode 100644 index 297fa537394..00000000000 --- a/app/views/users/_projects.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- if local_assigns.has_key?(:contributed_projects) && contributed_projects.present? - .panel.panel-default.contributed-projects - .panel-heading Projects contributed to - = render 'shared/projects_list', - projects: contributed_projects.sort_by(&:star_count).reverse, - projects_limit: 5, stars: true, avatar: false - -- if local_assigns.has_key?(:projects) && projects.present? - .panel.panel-default - .panel-heading Personal projects - = render 'shared/projects_list', - projects: projects.sort_by(&:star_count).reverse, - projects_limit: 10, stars: true, avatar: false diff --git a/app/views/users/calendar.html.haml b/app/views/users/calendar.html.haml deleted file mode 100644 index 922b0c6cebf..00000000000 --- a/app/views/users/calendar.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -%h4 - Contributions calendar - .pull-right - %small Issues, merge requests and push events -#cal-heatmap.calendar - :javascript - new Calendar( - #{@timestamps.to_json}, - #{@starting_year}, - #{@starting_month}, - '#{user_calendar_activities_path}' - ); diff --git a/app/views/users/calendar_activities.html.haml b/app/views/users/calendar_activities.html.haml deleted file mode 100644 index 027a93a75fc..00000000000 --- a/app/views/users/calendar_activities.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h4.prepend-top-20 - %span.light Contributions for - %strong #{@calendar_date.to_s(:short)} - -%ul.bordered-list - - @events.sort_by(&:created_at).each do |event| - %li - %span.light - %i.fa.fa-clock-o - = event.created_at.to_s(:time) - - if event.push? - #{event.action_name} #{event.ref_type} #{event.ref_name} - - else - = event_action_name(event) - - if event.target - %strong= link_to "##{event.target_iid}", [event.project.namespace.becomes(Namespace), event.project, event.target] - - at - %strong - - if event.project - = link_to_project event.project - - else - = event.project_name diff --git a/app/views/users/show.atom.builder b/app/views/users/show.atom.builder deleted file mode 100644 index 8fe30b23635..00000000000 --- a/app/views/users/show.atom.builder +++ /dev/null @@ -1,12 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "Activity feed for #{@user.name}" - xml.link href: user_url(@user, :atom), rel: "self", type: "application/atom+xml" - xml.link href: user_url(@user), rel: "alternate", type: "text/html" - xml.id projects_url - xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? - - @events.each do |event| - event_to_atom(xml, event) - end -end diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml deleted file mode 100644 index 9dd8cb0738c..00000000000 --- a/app/views/users/show.html.haml +++ /dev/null @@ -1,50 +0,0 @@ -.row - = link_to '#aside', class: 'show-aside' do - %i.fa.fa-angle-left - %section.col-md-8 - .header-with-avatar - = image_tag avatar_icon(@user.email, 90), class: "avatar avatar-tile s90", alt: '' - %h3 - = @user.name - - if @user == current_user - .pull-right - = link_to profile_path, class: 'btn btn-sm' do - %i.fa.fa-pencil-square-o - Edit Profile settings - .username - @#{@user.username} - .description - - if @user.bio.present? - = @user.bio - - .clearfix - - - if @groups.any? - .prepend-top-20 - %h4 Groups - = render 'groups', groups: @groups - %hr - - .hidden-xs - .user-calendar - %h4.center.light - %i.fa.fa-spinner.fa-spin - .user-calendar-activities - %hr - %h4 - User Activity - - - if current_user - %span.rss-icon.pull-right - = link_to user_path(@user, :atom, { private_token: current_user.private_token }) do - %strong - %i.fa.fa-rss - - .content_list - = spinner - %aside.col-md-4 - = render 'profile', user: @user - = render 'projects', projects: @projects, contributed_projects: @contributed_projects - -:coffeescript - $(".user-calendar").load("#{user_calendar_path}") diff --git a/app/views/votes/_votes_block.html.haml b/app/views/votes/_votes_block.html.haml deleted file mode 100644 index 36ea6742064..00000000000 --- a/app/views/votes/_votes_block.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -.votes.votes-block - .btn-group - - unless votable.upvotes.zero? - .btn.btn-sm.disabled.cgreen - %i.fa.fa-thumbs-up - = votable.upvotes - - unless votable.downvotes.zero? - .btn.btn-sm.disabled.cred - %i.fa.fa-thumbs-down - = votable.downvotes diff --git a/app/views/votes/_votes_inline.html.haml b/app/views/votes/_votes_inline.html.haml deleted file mode 100644 index 2cb3ae04e1a..00000000000 --- a/app/views/votes/_votes_inline.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -.votes.votes-inline - - unless votable.upvotes.zero? - %span.upvotes.cgreen - + #{votable.upvotes} - - unless votable.downvotes.zero? - \/ - - unless votable.downvotes.zero? - %span.downvotes.cred - \- #{votable.downvotes} diff --git a/app/workers/auto_merge_worker.rb b/app/workers/auto_merge_worker.rb deleted file mode 100644 index a6dd73eee5f..00000000000 --- a/app/workers/auto_merge_worker.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AutoMergeWorker - include Sidekiq::Worker - - sidekiq_options queue: :default - - def perform(merge_request_id, current_user_id, params) - params = params.with_indifferent_access - current_user = User.find(current_user_id) - merge_request = MergeRequest.find(merge_request_id) - merge_request.should_remove_source_branch = params[:should_remove_source_branch] - merge_request.automerge!(current_user, params[:commit_message]) - end -end diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb deleted file mode 100644 index 1d21addece6..00000000000 --- a/app/workers/emails_on_push_worker.rb +++ /dev/null @@ -1,61 +0,0 @@ -class EmailsOnPushWorker - include Sidekiq::Worker - - def perform(project_id, recipients, push_data, options = {}) - options.symbolize_keys! - options.reverse_merge!( - send_from_committer_email: false, - disable_diffs: false - ) - send_from_committer_email = options[:send_from_committer_email] - disable_diffs = options[:disable_diffs] - - project = Project.find(project_id) - before_sha = push_data["before"] - after_sha = push_data["after"] - ref = push_data["ref"] - author_id = push_data["user_id"] - - action = - if Gitlab::Git.blank_ref?(before_sha) - :create - elsif Gitlab::Git.blank_ref?(after_sha) - :delete - else - :push - end - - compare = nil - reverse_compare = false - if action == :push - compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha) - - return false if compare.same - - if compare.commits.empty? - compare = Gitlab::Git::Compare.new(project.repository.raw_repository, after_sha, before_sha) - - reverse_compare = true - - return false if compare.commits.empty? - end - end - - recipients.split(" ").each do |recipient| - Notify.repository_push_email( - project_id, - recipient, - author_id: author_id, - ref: ref, - action: action, - compare: compare, - reverse_compare: reverse_compare, - send_from_committer_email: send_from_committer_email, - disable_diffs: disable_diffs - ).deliver - end - ensure - compare = nil - GC.start - end -end diff --git a/app/workers/fork_registration_worker.rb b/app/workers/fork_registration_worker.rb deleted file mode 100644 index fffa8b3a659..00000000000 --- a/app/workers/fork_registration_worker.rb +++ /dev/null @@ -1,12 +0,0 @@ -class ForkRegistrationWorker - include Sidekiq::Worker - - sidekiq_options queue: :default - - def perform(from_project_id, to_project_id, private_token) - from_project = Project.find(from_project_id) - to_project = Project.find(to_project_id) - - from_project.gitlab_ci_service.fork_registration(to_project, private_token) - end -end diff --git a/app/workers/gitlab_shell_worker.rb b/app/workers/gitlab_shell_worker.rb deleted file mode 100644 index cfeda88bbc5..00000000000 --- a/app/workers/gitlab_shell_worker.rb +++ /dev/null @@ -1,10 +0,0 @@ -class GitlabShellWorker - include Sidekiq::Worker - include Gitlab::ShellAdapter - - sidekiq_options queue: :gitlab_shell - - def perform(action, *arg) - gitlab_shell.send(action, *arg) - end -end diff --git a/app/workers/irker_worker.rb b/app/workers/irker_worker.rb deleted file mode 100644 index 8b50f423984..00000000000 --- a/app/workers/irker_worker.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'json' -require 'socket' - -class IrkerWorker - include Sidekiq::Worker - - def perform(project_id, chans, colors, push_data, settings) - project = Project.find(project_id) - - # Get config parameters - return false unless init_perform settings, chans, colors - - repo_name = push_data['repository']['name'] - committer = push_data['user_name'] - branch = push_data['ref'].gsub(%r'refs/[^/]*/', '') - - if @colors - repo_name = "\x0304#{repo_name}\x0f" - branch = "\x0305#{branch}\x0f" - end - - # Firsts messages are for branch creation/deletion - send_branch_updates push_data, project, repo_name, committer, branch - - # Next messages are for commits - send_commits push_data, project, repo_name, committer, branch - - close_connection - true - end - - private - - def init_perform(set, chans, colors) - @colors = colors - @channels = chans - start_connection set['server_ip'], set['server_port'] - end - - def start_connection(irker_server, irker_port) - begin - @socket = TCPSocket.new irker_server, irker_port - rescue Errno::ECONNREFUSED => e - logger.fatal "Can't connect to Irker daemon: #{e}" - return false - end - true - end - - def sendtoirker(privmsg) - to_send = { to: @channels, privmsg: privmsg } - @socket.puts JSON.dump(to_send) - end - - def close_connection - @socket.close - end - - def send_branch_updates(push_data, project, repo_name, committer, branch) - if Gitlab::Git.blank_ref?(push_data['before']) - send_new_branch project, repo_name, committer, branch - elsif Gitlab::Git.blank_ref?(push_data['after']) - send_del_branch repo_name, committer, branch - end - end - - def send_new_branch(project, repo_name, committer, branch) - repo_path = project.path_with_namespace - newbranch = "#{Gitlab.config.gitlab.url}/#{repo_path}/branches" - newbranch = "\x0302\x1f#{newbranch}\x0f" if @colors - - privmsg = "[#{repo_name}] #{committer} has created a new branch " - privmsg += "#{branch}: #{newbranch}" - sendtoirker privmsg - end - - def send_del_branch(repo_name, committer, branch) - privmsg = "[#{repo_name}] #{committer} has deleted the branch #{branch}" - sendtoirker privmsg - end - - def send_commits(push_data, project, repo_name, committer, branch) - return if push_data['total_commits_count'] == 0 - - # Next message is for number of commit pushed, if any - if Gitlab::Git.blank_ref?(push_data['before']) - # Tweak on push_data["before"] in order to have a nice compare URL - push_data['before'] = before_on_new_branch push_data, project - end - - send_commits_count(push_data, project, repo_name, committer, branch) - - # One message per commit, limited by 3 messages (same limit as the - # github irc hook) - commits = push_data['commits'].first(3) - commits.each do |hook_attrs| - send_one_commit project, hook_attrs, repo_name, branch - end - end - - def before_on_new_branch(push_data, project) - commit = commit_from_id project, push_data['commits'][0]['id'] - parents = commit.parents - # Return old value if there's no new one - return push_data['before'] if parents.empty? - # Or return the first parent-commit - parents[0].id - end - - def send_commits_count(data, project, repo, committer, branch) - url = compare_url data, project.path_with_namespace - commits = colorize_commits data['total_commits_count'] - - new_commits = 'new commit' - new_commits += 's' if data['total_commits_count'] > 1 - - sendtoirker "[#{repo}] #{committer} pushed #{commits} #{new_commits} " \ - "to #{branch}: #{url}" - end - - def compare_url(data, repo_path) - sha1 = Commit::truncate_sha(data['before']) - sha2 = Commit::truncate_sha(data['after']) - compare_url = "#{Gitlab.config.gitlab.url}/#{repo_path}/compare" - compare_url += "/#{sha1}...#{sha2}" - colorize_url compare_url - end - - def send_one_commit(project, hook_attrs, repo_name, branch) - commit = commit_from_id project, hook_attrs['id'] - sha = colorize_sha Commit::truncate_sha(hook_attrs['id']) - author = hook_attrs['author']['name'] - files = colorize_nb_files(files_count commit) - title = commit.title - - sendtoirker "#{repo_name}/#{branch} #{sha} #{author} (#{files}): #{title}" - end - - def commit_from_id(project, id) - commit = Gitlab::Git::Commit.find(project.repository, id) - Commit.new(commit) - end - - def files_count(commit) - files = "#{commit.diffs.count} file" - files += 's' if commit.diffs.count > 1 - files - end - - def colorize_sha(sha) - sha = "\x0314#{sha}\x0f" if @colors - sha - end - - def colorize_nb_files(nb_files) - nb_files = "\x0312#{nb_files}\x0f" if @colors - nb_files - end - - def colorize_url(url) - url = "\x0302\x1f#{url}\x0f" if @colors - url - end - - def colorize_commits(commits) - commits = "\x02#{commits}\x0f" if @colors - commits - end -end diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb deleted file mode 100644 index 33d8cc8861b..00000000000 --- a/app/workers/post_receive.rb +++ /dev/null @@ -1,62 +0,0 @@ -class PostReceive - include Sidekiq::Worker - include Gitlab::Identifier - - sidekiq_options queue: :post_receive - - def perform(repo_path, identifier, changes) - if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s) - repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "") - else - log("Check gitlab.yml config for correct gitlab_shell.repos_path variable. \"#{Gitlab.config.gitlab_shell.repos_path}\" does not match \"#{repo_path}\"") - end - - repo_path.gsub!(/\.git\z/, "") - repo_path.gsub!(/\A\//, "") - - project = Project.find_with_namespace(repo_path) - - if project.nil? - log("Triggered hook for non-existing project with full path \"#{repo_path} \"") - return false - end - - changes = Base64.decode64(changes) unless changes.include?(" ") - changes = utf8_encode_changes(changes) - changes = changes.lines - - changes.each do |change| - oldrev, newrev, ref = change.strip.split(' ') - - @user ||= identify(identifier, project, newrev) - - unless @user - log("Triggered hook for non-existing user \"#{identifier} \"") - return false - end - - if Gitlab::Git.tag_ref?(ref) - GitTagPushService.new.execute(project, @user, oldrev, newrev, ref) - else - GitPushService.new.execute(project, @user, oldrev, newrev, ref) - end - end - end - - def utf8_encode_changes(changes) - changes = changes.dup - - changes.force_encoding("UTF-8") - return changes if changes.valid_encoding? - - # Convert non-UTF-8 branch/tag names to UTF-8 so they can be dumped as JSON. - detection = CharlockHolmes::EncodingDetector.detect(changes) - return changes unless detection && detection[:encoding] - - CharlockHolmes::Converter.convert(changes, detection[:encoding], 'UTF-8') - end - - def log(message) - Gitlab::GitLogger.error("POST-RECEIVE: #{message}") - end -end diff --git a/app/workers/project_service_worker.rb b/app/workers/project_service_worker.rb deleted file mode 100644 index 64d39c4d3f7..00000000000 --- a/app/workers/project_service_worker.rb +++ /dev/null @@ -1,10 +0,0 @@ -class ProjectServiceWorker - include Sidekiq::Worker - - sidekiq_options queue: :project_web_hook - - def perform(hook_id, data) - data = data.with_indifferent_access - Service.find(hook_id).execute(data) - end -end diff --git a/app/workers/project_web_hook_worker.rb b/app/workers/project_web_hook_worker.rb deleted file mode 100644 index 73085c046bd..00000000000 --- a/app/workers/project_web_hook_worker.rb +++ /dev/null @@ -1,10 +0,0 @@ -class ProjectWebHookWorker - include Sidekiq::Worker - - sidekiq_options queue: :project_web_hook - - def perform(hook_id, data) - data = data.with_indifferent_access - WebHook.find(hook_id).execute(data) - end -end diff --git a/app/workers/repository_archive_worker.rb b/app/workers/repository_archive_worker.rb deleted file mode 100644 index 021c1139568..00000000000 --- a/app/workers/repository_archive_worker.rb +++ /dev/null @@ -1,43 +0,0 @@ -class RepositoryArchiveWorker - include Sidekiq::Worker - - sidekiq_options queue: :archive_repo - - attr_accessor :project, :ref, :format - - def perform(project_id, ref, format) - @project = Project.find(project_id) - @ref, @format = ref, format.downcase - - repository = project.repository - - repository.clean_old_archives - - return unless file_path - return if archived? || archiving? - - repository.archive_repo(ref, storage_path, format) - end - - private - - def storage_path - Gitlab.config.gitlab.repository_downloads_path - end - - def file_path - @file_path ||= project.repository.archive_file_path(ref, storage_path, format) - end - - def pid_file_path - @pid_file_path ||= project.repository.archive_pid_file_path(ref, storage_path, format) - end - - def archived? - File.exist?(file_path) - end - - def archiving? - File.exist?(pid_file_path) - end -end diff --git a/app/workers/repository_import_worker.rb b/app/workers/repository_import_worker.rb deleted file mode 100644 index e6a50afedb1..00000000000 --- a/app/workers/repository_import_worker.rb +++ /dev/null @@ -1,34 +0,0 @@ -class RepositoryImportWorker - include Sidekiq::Worker - include Gitlab::ShellAdapter - - sidekiq_options queue: :gitlab_shell - - def perform(project_id) - project = Project.find(project_id) - - import_result = gitlab_shell.send(:import_repository, - project.path_with_namespace, - project.import_url) - return project.import_fail unless import_result - - data_import_result = if project.import_type == 'github' - Gitlab::GithubImport::Importer.new(project).execute - elsif project.import_type == 'gitlab' - Gitlab::GitlabImport::Importer.new(project).execute - elsif project.import_type == 'bitbucket' - Gitlab::BitbucketImport::Importer.new(project).execute - elsif project.import_type == 'google_code' - Gitlab::GoogleCodeImport::Importer.new(project).execute - else - true - end - return project.import_fail unless data_import_result - - project.import_finish - project.save - project.satellite.create unless project.satellite.exists? - project.update_repository_size - Gitlab::BitbucketImport::KeyDeleter.new(project).execute if project.import_type == 'bitbucket' - end -end diff --git a/app/workers/system_hook_worker.rb b/app/workers/system_hook_worker.rb deleted file mode 100644 index 3ebc62b7e7a..00000000000 --- a/app/workers/system_hook_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -class SystemHookWorker - include Sidekiq::Worker - - sidekiq_options queue: :system_hook - - def perform(hook_id, data) - SystemHook.find(hook_id).execute data - end -end |