Commit ccfae827234a4b8acb86d1944b9b5b7bdd68481a

Authored by Dmitriy Zaporozhets
1 parent b7614c71

project alert/error messages

app/assets/stylesheets/projects.css.scss
@@ -588,3 +588,7 @@ tr.line_notes_row { @@ -588,3 +588,7 @@ tr.line_notes_row {
588 } 588 }
589 } 589 }
590 } 590 }
  591 +
  592 +.new-project-hodler {
  593 + padding:20px;
  594 +}
app/assets/stylesheets/style.scss
@@ -712,8 +712,8 @@ body, button, input, select, textarea { @@ -712,8 +712,8 @@ body, button, input, select, textarea {
712 .errors_holder { 712 .errors_holder {
713 background:#D30; 713 background:#D30;
714 color:#fff; 714 color:#fff;
715 - border:1px solid $lite_border_color;  
716 @include round-borders-all(4px); 715 @include round-borders-all(4px);
  716 + border:1px solid #a30;
717 padding:5px; 717 padding:5px;
718 list-style:none; 718 list-style:none;
719 font-weight: bold; 719 font-weight: bold;
@@ -723,3 +723,33 @@ body, button, input, select, textarea { @@ -723,3 +723,33 @@ body, button, input, select, textarea {
723 padding:10px; 723 padding:10px;
724 } 724 }
725 } 725 }
  726 +
  727 +.notice_holder {
  728 + background:#DDF4FB;
  729 + color:#444;
  730 + border:1px solid #C6EDF9;
  731 + @include round-borders-all(4px);
  732 + padding:5px;
  733 + list-style:none;
  734 + font-weight: bold;
  735 + text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.25);
  736 +
  737 + li {
  738 + padding:10px;
  739 + }
  740 +}
  741 +
  742 +.alert_holder {
  743 + background:#FDF5D9;
  744 + color:#444;
  745 + border:1px solid #FCEEC1;
  746 + @include round-borders-all(4px);
  747 + padding:5px;
  748 + list-style:none;
  749 + font-weight: bold;
  750 + text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.25);
  751 +
  752 + li {
  753 + padding:10px;
  754 + }
  755 +}
app/models/repository.rb
@@ -74,9 +74,9 @@ class Repository @@ -74,9 +74,9 @@ class Repository
74 end 74 end
75 75
76 def repo_exists? 76 def repo_exists?
77 - repo && !repo.branches.empty? 77 + @repo_exists ||= (repo && !repo.branches.empty?)
78 rescue 78 rescue
79 - false 79 + @repo_exists = false
80 end 80 end
81 81
82 def tags 82 def tags
app/views/layouts/project.html.haml
@@ -26,18 +26,19 @@ @@ -26,18 +26,19 @@
26 = link_to project_path(@project), :class => project_tab_class do 26 = link_to project_path(@project), :class => project_tab_class do
27 Project 27 Project
28 28
29 - = link_to "Repository", project_repository_path(@project), :class => repository_tab_class  
30 - = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class  
31 - = link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil  
32 - = link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil  
33 - = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do  
34 - Issues  
35 - = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do  
36 - Wall  
37 - - if @project.common_notes.today.count > 0  
38 - %span{ :class => "number" }= @project.common_notes.today.count  
39 - = link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do  
40 - Requests 29 + - if @project.repo_exists?
  30 + = link_to "Repository", project_repository_path(@project), :class => repository_tab_class
  31 + = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class
  32 + = link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil
  33 + = link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
  34 + = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
  35 + Issues
  36 + = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do
  37 + Wall
  38 + - if @project.common_notes.today.count > 0
  39 + %span{ :class => "number" }= @project.common_notes.today.count
  40 + = link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do
  41 + Requests
41 42
42 43
43 44
app/views/projects/_form.html.haml
@@ -6,13 +6,9 @@ @@ -6,13 +6,9 @@
6 = @project.name 6 = @project.name
7 .clear 7 .clear
8 - if @project.errors.any? 8 - if @project.errors.any?
9 - #error_explanation  
10 - %h2  
11 - = pluralize(@project.errors.count, "error")  
12 - prohibited this project from being saved:  
13 - %ul  
14 - - @project.errors.full_messages.each do |msg|  
15 - %li= msg 9 + %ul.errors_holder
  10 + - @project.errors.full_messages.each do |msg|
  11 + %li= msg
16 %table 12 %table
17 %tr 13 %tr
18 %td= f.label :name 14 %td= f.label :name
app/views/projects/empty.html.erb
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -<% bash_lexer = Pygments::Lexer[:bash] %>  
2 -<div class="">  
3 - <div class="git-empty">  
4 - <h2>Git global setup:</h2>  
5 -<% setup_str = <<eos  
6 -git config --global user.name "#{current_user.name}"  
7 -git config --global user.email "#{current_user.email}"  
8 -eos  
9 -%>  
10 - <%= raw bash_lexer.highlight(setup_str) %>  
11 - <br />  
12 - <br />  
13 - <h2>Next steps:</h2>  
14 -<% repo_setup_str = <<eos  
15 -mkdir #{@project.path}  
16 -cd #{@project.path}  
17 -git init  
18 -touch README  
19 -git add README  
20 -git commit -m 'first commit'  
21 -git remote add origin #{@project.url_to_repo}  
22 -git push -u origin master  
23 -eos  
24 -%>  
25 - <%= raw bash_lexer.highlight(repo_setup_str) %>  
26 -  
27 - <br /><br />  
28 - <h2>Existing Git Repo?</h2>  
29 -<% exist_repo_setup_str = <<eos  
30 -cd existing_git_repo  
31 -git remote add origin #{@project.url_to_repo}  
32 -git push -u origin master  
33 -eos  
34 -%>  
35 - <%= raw bash_lexer.highlight(exist_repo_setup_str) %>  
36 -  
37 - <br/>  
38 - </div>  
39 -</div>  
app/views/projects/empty.html.haml 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +- if current_user.require_ssh_key?
  2 + %ul.errors_holder
  3 + %li You have no ssh keys added yo tour profile.
  4 + %li You wont be able to pull/push repository.
  5 + %li Visit profile &rarr; keys and add public key of every machine you want to use for work with gitlabhq.
  6 +
  7 +
  8 +%ul.alert_holder
  9 + %li You should push repository to proceed.
  10 + %li After push you will be able to browse code, commits etc.
  11 +
  12 +- bash_lexer = Pygments::Lexer[:bash]
  13 +%div.git-empty
  14 + %h3 Git global setup:
  15 + - setup_str = ["git config --global user.name \"#{current_user.name}\"",
  16 + "git config --global user.email \"#{current_user.email}\""].join("\n")
  17 + = raw bash_lexer.highlight(setup_str)
  18 +
  19 + %br
  20 + %br
  21 + %h3 Create Repository
  22 + - repo_setup_str = ["mkdir #{@project.path}",
  23 + "cd #{@project.path}",
  24 + "git init",
  25 + "touch README",
  26 + "git add README",
  27 + "git commit -m 'first commit'",
  28 + "git remote add origin #{@project.url_to_repo}",
  29 + "git push -u origin master"].join("\n")
  30 +
  31 + = raw bash_lexer.highlight(repo_setup_str)
  32 +
  33 + %br
  34 + %br
  35 + %h3 Existing Git Repo?
  36 + - exist_repo_setup_str = ["cd existing_git_repo",
  37 + "git remote add origin #{@project.url_to_repo}",
  38 + "git push -u origin master"].join("\n")
  39 + = raw bash_lexer.highlight(exist_repo_setup_str)
app/views/projects/files.html.haml
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 = time_ago_in_words(note.created_at) 12 = time_ago_in_words(note.created_at)
13 ago 13 ago
14 - else 14 - else
15 - %h3 All files attached to project wall, issues etc will be displayed here 15 + .notice_holder
  16 + %li All files attached to project wall, issues etc will be displayed here
16 17
17 18
app/views/snippets/index.html.haml
@@ -4,3 +4,9 @@ @@ -4,3 +4,9 @@
4 %div{ :class => "update-data ui-box ui-box-small ui-box-big" } 4 %div{ :class => "update-data ui-box ui-box-small ui-box-big" }
5 .data 5 .data
6 = render @snippets.fresh 6 = render @snippets.fresh
  7 +- else
  8 + .notice_holder
  9 + %li Snippets do not exist yet.
  10 + - if can? current_user, :write_snippet, @project
  11 + %li You can add a new one by clicking on plus icon
  12 +
config/database.yml
@@ -20,6 +20,6 @@ test: @@ -20,6 +20,6 @@ test:
20 20
21 production: 21 production:
22 adapter: sqlite3 22 adapter: sqlite3
23 - database: db/production.sqlite3 23 + database: db/development.sqlite3
24 pool: 5 24 pool: 5
25 timeout: 5000 25 timeout: 5000