Commit aa50408ecb5c7355d7cac86f7a59f02ae087714c

Authored by Dmitriy Zaporozhets
1 parent 5c7ed6fa

1. Better message if no ssh key

2. SSH Keys Help page
app/assets/stylesheets/common.scss
... ... @@ -735,3 +735,11 @@ li.note {
735 735 font-size: 12px;
736 736 }
737 737 }
  738 +
  739 +.error_message {
  740 + @extend .cred;
  741 + border-bottom: 1px solid #D21;
  742 + padding-bottom:20px;
  743 + text-align:center;
  744 + margin-bottom:10px;
  745 +}
... ...
app/assets/stylesheets/gitlab_bootstrap.scss
... ... @@ -4,6 +4,11 @@ body {
4 4  
5 5 pre {
6 6 font-family:'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono','lucida console',monospace;
  7 +
  8 + &.dark {
  9 + background: #333;
  10 + color:#f5f5f5;
  11 + }
7 12 }
8 13  
9 14 a {
... ...
app/views/dashboard/index.html.haml
1 1 - if @projects.any?
2 2 .projects
3 3 .activities.span8
4   - - if current_user.require_ssh_key?
5   - .alert.alert-error.padded
6   - %span
7   - You wont be able to pull/push project code unless you
8   - %strong
9   - = link_to new_key_path, class: "vlink" do
10   - add new key
11   - to your profile
  4 + = render 'shared/no_ssh'
12 5 - if @events.any?
13 6 .content_list= render @events
14 7 - else
... ... @@ -57,5 +50,5 @@
57 50 If you will be added to project - it will be displayed here
58 51  
59 52  
60   -:javascript
  53 +:javascript
61 54 $(function(){ Pager.init(20); });
... ...
app/views/help/index.html.haml
... ... @@ -31,3 +31,6 @@
31 31  
32 32 %li
33 33 %h5= link_to "Gitlab Markdown", help_markdown_path
  34 +
  35 + %li
  36 + %h5= link_to "SSH keys", help_ssh_path
... ...
app/views/help/permissions.html.haml
1   -%h3 Permissions
  1 +%h3.page_title Permissions
2 2 .back_link
3   - = link_to help_path do
  3 + = link_to help_path do
4 4 ← to index
5 5 %hr
6 6  
... ...
app/views/help/ssh.html.haml 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +%h3.page_title SSH Keys
  2 +.back_link
  3 + = link_to help_path do
  4 + ← to index
  5 +%hr
  6 +
  7 +%p.slead
  8 + SSH key allows you to establish a secure connection between your computer and Gitlab
  9 +
  10 +%p.slead
  11 + To generate a new SSH key just open your terminal and use code below.
  12 +
  13 +%pre.dark
  14 + ssh-keygen -t rsa -C "#{current_user.email}"
  15 +
  16 + \# Creates a new ssh key using the provided email
  17 + \# Generating public/private rsa key pair...
  18 +
  19 +%p.slead
  20 + Next just use code below to dump your public key and add to GITLAB SSH Keys
  21 +
  22 +%pre.dark
  23 + cat ~/.ssh/id_rsa.pub
  24 +
  25 + \# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....
... ...
app/views/help/system_hooks.html.haml
1 1 %h3 System hooks
2 2 .back_link
3   - = link_to :back do
  3 + = link_to :back do
4 4 ← back
5 5 %hr
6 6  
7   -%p.slead
  7 +%p.slead
8 8 Your Gitlab instance can perform HTTP POST request on next event: create_project, delete_project, create_user, delete_user, change_team_member.
9 9 %br
10 10 System Hooks can be used for logging or change information in LDAP server.
... ...
app/views/help/web_hooks.html.haml
1   -%h3 Web hooks
  1 +%h3.page_title Web hooks
2 2 .back_link
3   - = link_to help_path do
  3 + = link_to help_path do
4 4 ← to index
5 5 %hr
6 6  
7   -%p.slead
8   - Every Gitlab project can trigger a web server whenever the repo is pushed to.
  7 +%p.slead
  8 + Every Gitlab project can trigger a web server whenever the repo is pushed to.
9 9 %br
10 10 Web Hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server.
11 11 %br
... ...
app/views/help/workflow.html.haml
1   -- bash_lexer = Pygments::Lexer[:bash]
2   -%h3 Workflow
  1 +%h3.page_title Workflow
3 2 .back_link
4   - = link_to help_path do
  3 + = link_to help_path do
5 4 ← to index
6 5 %hr
7 6  
... ... @@ -9,25 +8,25 @@
9 8 %li
10 9 %p Clone project
11 10 .bash
12   - %pre
  11 + %pre.dark
13 12 git clone git@example.com:project-name.git
14 13  
15 14 %li
16 15 %p Create branch with your feature
17 16 .bash
18   - %pre
  17 + %pre.dark
19 18 git checkout -b $feature_name
20 19  
21 20 %li
22 21 %p Write code. Commit changes
23 22 .bash
24   - %pre
  23 + %pre.dark
25 24 git commit -am "My feature is ready"
26 25  
27 26 %li
28 27 %p Push your branch to gitlabhq
29 28 .bash
30   - %pre
  29 + %pre.dark
31 30 git push origin $feature_name
32 31  
33 32 %li
... ...
app/views/keys/_form.html.haml
... ... @@ -11,7 +11,13 @@
11 11 .input= f.text_field :title
12 12 .clearfix
13 13 = f.label :key
14   - .input= f.text_area :key, class: [:xxlarge, :thin_area]
  14 + .input
  15 + = f.text_area :key, class: [:xxlarge, :thin_area]
  16 + %p.hint
  17 + Paste your public key here. Read more about how generate it
  18 + = link_to "here", help_ssh_path
  19 +
  20 +
15 21 .actions
16 22 = f.submit 'Save', class: "primary btn"
17 23 = link_to "Cancel", keys_path, class: "btn"
... ...
app/views/keys/new.html.haml
1   -%h3.page_title New key
  1 +%h3.page_title Add an SSH Key
2 2 %hr
3 3 = render 'form'
4 4  
... ...
app/views/merge_requests/show/_how_to_merge.html.haml
... ... @@ -3,13 +3,12 @@
3 3 %a.close{href: "#"} ×
4 4 %h3 How To Merge
5 5 .modal-body
6   - %pre
  6 + %pre.dark
7 7 = preserve do
8   - :erb
9   - git checkout <%= @merge_request.target_branch %>
10   - git fetch origin
11   - git merge origin/<%= @merge_request.source_branch %>
12   - git push origin <%= @merge_request.target_branch %>
  8 + git checkout #{@merge_request.target_branch}
  9 + git fetch origin
  10 + git merge origin/#{@merge_request.source_branch}
  11 + git push origin #{@merge_request.target_branch}
13 12  
14 13  
15 14 :javascript
... ...
app/views/projects/empty.html.haml
1   -- if current_user.require_ssh_key?
2   - .alert-message.block-message.error
3   - %ul
4   - %li You have no ssh keys added to your profile.
5   - %li You wont be able to pull/push repository.
6   - %li Visit profile &rarr; keys and add public key of every machine you want to use for work with gitlabhq.
7   -
8   -.alert-message.block-message.error
9   - %ul.unstyled.alert_holder
10   - %li You should push repository to proceed.
11   - %li After push you will be able to browse code, commits etc.
12   -
13   -- bash_lexer = Pygments::Lexer[:bash]
  1 += render 'shared/no_ssh'
14 2 %div.git-empty
15   - %h3 Git global setup:
16   - - setup_str = ["git config --global user.name \"#{current_user.name}\"",
17   - "git config --global user.email \"#{current_user.email}\""].join("\n")
18   - = preserve do
19   - = raw bash_lexer.highlight(setup_str, lexer: 'bash', options: {encoding: 'utf-8'})
20   -
21   - %br
22   - %br
23   - %h3 Create Repository
24   - - repo_setup_str = ["mkdir #{@project.path}",
25   - "cd #{@project.path}",
26   - "git init",
27   - "touch README",
28   - "git add README",
29   - "git commit -m 'first commit'",
30   - "git remote add origin #{@project.url_to_repo}",
31   - "git push -u origin master"].join("\n")
  3 + %h4 Git global setup:
  4 + %pre.dark
  5 + = preserve do
  6 + git config --global user.name "#{current_user.name}"
  7 + git config --global user.email "#{current_user.email}"
32 8  
33   - = preserve do
34   - = raw bash_lexer.highlight(repo_setup_str)
  9 + %h4.prepend-top-20 Create Repository
  10 + %pre.dark
  11 + = preserve do
  12 + mkdir #{@project.path}
  13 + cd #{@project.path}
  14 + git init
  15 + touch README
  16 + git add README
  17 + git commit -m 'first commit'
  18 + git remote add origin #{@project.url_to_repo}
  19 + git push -u origin master
35 20  
36   - %br
37   - %br
38   - %h3 Existing Git Repo?
39   - - exist_repo_setup_str = ["cd existing_git_repo",
40   - "git remote add origin #{@project.url_to_repo}",
41   - "git push -u origin master"].join("\n")
42   - = preserve do
43   - = raw bash_lexer.highlight(exist_repo_setup_str)
  21 + %h4.prepend-top-20 Existing Git Repo?
  22 + %pre.dark
  23 + = preserve do
  24 + cd existing_git_repo
  25 + git remote add origin #{@project.url_to_repo}
  26 + git push -u origin master
44 27  
45 28 - if can? current_user, :admin_project, @project
46   - .alert-message.block-message.error.prepend-top-20
47   - = link_to 'Remove project', @project, confirm: 'Are you sure?', method: :delete, class: "btn danger"
  29 + .prepend-top-20
  30 + = link_to 'Remove project', @project, confirm: 'Are you sure?', method: :delete, class: "btn danger right"
... ...
app/views/shared/_no_ssh.html.haml 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +- if current_user.require_ssh_key?
  2 + %h6.error_message
  3 + %span
  4 + You wont be able to pull/push project code unless you
  5 + %strong
  6 + = link_to new_key_path, class: "vlink" do
  7 + add SSH key
  8 + to your profile
... ...
config/routes.rb
... ... @@ -30,6 +30,7 @@ Gitlab::Application.routes.draw do
30 30 get 'help/web_hooks' => 'help#web_hooks'
31 31 get 'help/system_hooks' => 'help#system_hooks'
32 32 get 'help/markdown' => 'help#markdown'
  33 + get 'help/ssh' => 'help#ssh'
33 34  
34 35 #
35 36 # Admin Area
... ...