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

button_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bbb35afca89e0d9335169c0af3df9b0123ebc924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module ButtonHelper
  def clipboard_button
    content_tag :button,
      icon('clipboard'),
      class: 'btn btn-xs btn-clipboard js-clipboard-trigger',
      type: :button
  end

  def http_clone_button(project)
    klass = 'btn'
    klass << ' active'      if default_clone_protocol == 'http'
    klass << ' has_tooltip' if current_user.try(:require_password?)

    protocol = gitlab_config.protocol.upcase

    content_tag :button, protocol,
      class: klass,
      data: {
        clone: project.http_url_to_repo,
        container: 'body',
        html: 'true',
        title: "Set a password on your account<br>to pull or push via #{protocol}"
      },
      type: :button
  end

  def ssh_clone_button(project)
    klass = 'btn'
    klass << ' active'      if default_clone_protocol == 'ssh'
    klass << ' has_tooltip' if current_user.try(:require_ssh_key?)

    content_tag :button, 'SSH',
      class: klass,
      data: {
        clone: project.ssh_url_to_repo,
        container: 'body',
        html: 'true',
        title: 'Add an SSH key to your profile<br>to pull or push via SSH.'
      },
      type: :button
  end
end