summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2011-12-30 21:58:02 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2011-12-30 21:58:02 +0200
commite33aab0b21e38f4cf7aed8bb6451d737fcefe110 (patch)
treeca3f25b7bc5c3ab57984a20df0d4aa254b0b5693
parent7279e8c1774f3116dd74ca462447189730f9eff8 (diff)
parent61a2ce41104171b5803164830121df9125668dce (diff)
downloadgitlab-ce-e33aab0b21e38f4cf7aed8bb6451d737fcefe110.tar.gz
Merge branch 'feature/project_tab'
-rw-r--r--app/assets/stylesheets/projects.css.scss9
-rw-r--r--app/controllers/projects_controller.rb9
-rw-r--r--app/helpers/projects_helper.rb21
-rw-r--r--app/views/layouts/project.html.haml14
-rw-r--r--app/views/projects/_project_head.html.haml18
-rw-r--r--app/views/projects/_team.html.haml4
-rw-r--r--app/views/projects/edit.html.erb1
-rw-r--r--app/views/projects/edit.html.haml69
-rw-r--r--app/views/projects/files.html.haml17
-rw-r--r--app/views/projects/info.html.haml28
-rw-r--r--app/views/projects/show.html.haml4
-rw-r--r--app/views/projects/team.html.haml1
-rw-r--r--app/views/projects/update.js.haml2
-rw-r--r--app/views/snippets/index.html.haml4
-rw-r--r--config/routes.rb2
-rw-r--r--spec/requests/projects_spec.rb2
16 files changed, 172 insertions, 33 deletions
diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss
index 33d70e30a88..6916d65cfa5 100644
--- a/app/assets/stylesheets/projects.css.scss
+++ b/app/assets/stylesheets/projects.css.scss
@@ -561,6 +561,7 @@ h4.middle-panel {
display:none;
}
+
.merge-tabs {
margin: 0;
border: 1px solid #ccc;
@@ -572,11 +573,10 @@ h4.middle-panel {
.tab {
font-weight: bold;
- text-transform: uppercase;
border-right: 1px solid #ddd;
background:none;
padding: 10px;
- width:60px;
+ min-width:60px;
float:left;
position:relative;
top:-5px;
@@ -598,6 +598,11 @@ h4.middle-panel {
}
}
}
+.activities-tab span { background: url("images.png") no-repeat -161px -1px; }
+.stat-tab span,
+.team-tab span,
+.snippets-tab span { background: url("images.png") no-repeat -38px -77px; }
+.files-tab span { background: url("images.png") no-repeat -112px -23px; }
.merge-notes-tab span { background: url("images.png") no-repeat -161px -1px; }
.merge-commits-tab span { background: url("images.png") no-repeat -86px 1px; }
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 4b4f748f36b..1e859ceac31 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -57,7 +57,7 @@ class ProjectsController < ApplicationController
def update
respond_to do |format|
if project.update_attributes(params[:project])
- format.html { redirect_to project, :notice => 'Project was successfully updated.' }
+ format.html { redirect_to info_project_path(project), :notice => 'Project was successfully updated.' }
format.js
else
format.html { render action: "edit" }
@@ -72,6 +72,13 @@ class ProjectsController < ApplicationController
@activities = @project.cached_updates(limit)
end
+ def files
+ @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100)
+ end
+
+ def info
+ end
+
#
# Wall
#
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 5acda509ec2..cc1d69d46c5 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -16,12 +16,21 @@ module ProjectsHelper
nil
end
- # expires in 360 days
- def switch_colorscheme_link(opts)
- if cookies[:colorschema].blank?
- link_to_function "paint it black!", "$.cookie('colorschema','black', {expires:360}); window.location.reload()", opts
- else
- link_to_function "paint it white!", "$.cookie('colorschema','', {expires:360}); window.location.reload()", opts
+ def project_tab_class
+ [:show, :files, :team, :edit, :update, :info].each do |action|
+ return "current" if current_page?(:controller => "projects", :action => action, :id => @project)
+ end
+
+ if controller.controller_name == "snippets" ||
+ controller.controller_name == "team_members"
+ "current"
end
end
+
+ def tree_tab_class
+ current_page?(:controller => "refs",
+ :action => "tree",
+ :project_id => @project,
+ :id => @ref || @project.root_ref ) ? "current" : nil
+ end
end
diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml
index 5de97b523d9..1c9b588476a 100644
--- a/app/views/layouts/project.html.haml
+++ b/app/views/layouts/project.html.haml
@@ -23,14 +23,10 @@
.project-sidebar
.fixed
%aside
- = link_to "Activities", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
- = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => current_page?(:controller => "refs", :action => "tree", :project_id => @project, :id => @ref || @project.root_ref ) ? "current" : nil
+ = link_to "Project", project_path(@project), :class => project_tab_class
+ = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class
= link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil
= link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
- = link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do
- Team
- - if @project.users_projects.count > 0
- %span{ :class => "number" }= @project.users_projects.count
= link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
Issues
- if @project.issues.open_for(current_user).count > 0
@@ -43,13 +39,7 @@
Merge Requests
- if @project.merge_requests.opened.count > 0
%span{ :class => "number" }= @project.merge_requests.opened.count
- = link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do
- Snippets
- - if @project.snippets.non_expired.count > 0
- %span{ :class => "number" }= @project.snippets.non_expired.count
- - if can? current_user, :admin_project, @project
- = link_to "Admin", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil
.medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project
diff --git a/app/views/projects/_project_head.html.haml b/app/views/projects/_project_head.html.haml
new file mode 100644
index 00000000000..0a9e30944b2
--- /dev/null
+++ b/app/views/projects/_project_head.html.haml
@@ -0,0 +1,18 @@
+.merge-tabs
+ = link_to project_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_path(@project)) }" do
+ %span
+ Activities
+ = link_to info_project_path(@project), :class => "stat-tab tab #{'active' if current_page?(info_project_path(@project)) || current_page?(edit_project_path(@project)) }" do
+ %span
+ Info
+ = link_to team_project_path(@project), :class => "team-tab tab #{'active' if current_page?(team_project_path(@project)) }" do
+ %span
+ Team
+ = link_to files_project_path(@project), :class => "files-tab tab #{'active' if current_page?(files_project_path(@project)) }" do
+ %span
+ Files
+ = link_to project_snippets_path(@project), :class => "snippets-tab tab #{'active' if current_page?(project_snippets_path(@project)) }" do
+ %span
+ Snippets
+
+
diff --git a/app/views/projects/_team.html.haml b/app/views/projects/_team.html.haml
index 7c647e33e9b..6cda3b9b103 100644
--- a/app/views/projects/_team.html.haml
+++ b/app/views/projects/_team.html.haml
@@ -1,9 +1,7 @@
-%h2.icon
- %span>
- Team
- if can? current_user, :admin_team_member, @project
%div#new-member-holder
.right= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button"
+ .clear
%br
%table.round-borders#team-table
%thead
diff --git a/app/views/projects/edit.html.erb b/app/views/projects/edit.html.erb
deleted file mode 100644
index 2d3436368bd..00000000000
--- a/app/views/projects/edit.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= render 'form' %>
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
new file mode 100644
index 00000000000..69e0f218ecd
--- /dev/null
+++ b/app/views/projects/edit.html.haml
@@ -0,0 +1,69 @@
+= render "project_head"
+
+= form_for(@project, :remote => true) do |f|
+ %div
+ %span.entity-info
+ = link_to info_project_path(@project) do
+ .entity-button
+ Info
+ %i
+ %h2= @project.name
+ %hr
+ %table.no-borders
+ -if @project.errors.any?
+ %tr
+ %td{:colspan => 2}
+ #error_explanation
+ - @project.errors.full_messages.each do |msg|
+ %span= msg
+ %br
+
+ %tr
+ %td= f.label :name
+ %td= f.text_field :name, :placeholder => "Example Project"
+ %tr
+ %td
+ .left= f.label :path
+ %cite.right= "git@#{GIT_HOST["host"]}:"
+ %td
+ = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
+ %tr
+ %td
+ .left= f.label :code
+ %cite.right= "http://#{GIT_HOST["host"]}/"
+ %td= f.text_field :code, :placeholder => "example"
+
+ - unless @project.new_record? || @project.heads.empty?
+ %tr
+ %td= f.label :default_branch, "Default Branch"
+ %td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;")
+
+ %tr
+ %td= f.label :description
+ %td= f.text_area :description, :placeholder => "project description", :style => "height:50px"
+
+ %br
+
+ .merge-tabs
+ = f.submit 'Save', :class => "grey-button"
+ &nbsp;
+ - unless @project.new_record?
+ .right
+ = link_to 'Remove', @project, :confirm => 'Are you sure?', :method => :delete, :class => "red-button"
+
+%div{ :class => "ajax_loader", :style => "display:none;height:200px;"}
+ %center
+ = image_tag "ajax-loader.gif", :class => "append-bottom"
+ %h3.prepend-top Updating project &amp; repository. Please wait for few minutes
+
+:javascript
+ $('.edit_project').bind('ajax:before', function() {
+ $(".edit_project").hide();
+ $('.ajax_loader').show();
+ });
+
+:javascript
+ $(function(){
+ $('#project_default_branch').chosen();
+ })
+
diff --git a/app/views/projects/files.html.haml b/app/views/projects/files.html.haml
new file mode 100644
index 00000000000..0d1ba8e8082
--- /dev/null
+++ b/app/views/projects/files.html.haml
@@ -0,0 +1,17 @@
+= render "project_head"
+- unless @notes.empty?
+ %div.update-data.ui-box.ui-box-small
+ .data
+ - @notes.each do |note|
+ %a.update-item{:href => note.attachment.url}
+ = image_tag gravatar_icon(note.author_email), :class => "left", :width => 16
+ %span.update-title{:style => "margin-bottom:0px;"}
+ = note.attachment_identifier
+ %span.update-author.right
+ Added
+ = time_ago_in_words(note.created_at)
+ ago
+- else
+ %h3 All files attached to project wall, issues etc will be displayed here
+
+
diff --git a/app/views/projects/info.html.haml b/app/views/projects/info.html.haml
new file mode 100644
index 00000000000..787ad06d30e
--- /dev/null
+++ b/app/views/projects/info.html.haml
@@ -0,0 +1,28 @@
+= render "project_head"
+
+%div
+ %span.entity-info
+ = link_to edit_project_path(@project) do
+ .entity-button
+ Edit
+ %i
+ %h2= @project.name
+ %hr
+
+%table.no-borders
+ %tr
+ %td Name
+ %td= @project.name
+
+ %tr
+ %td Slug
+ %td= @project.code
+
+ %tr
+ %td Created
+ %td= @project.created_at.stamp("Aug 21, 2011")
+
+ %tr
+ %td{:colspan => 2}= simple_format @project.description
+
+
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 0530736fb4c..bbc31a599f4 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -1,9 +1,7 @@
- content_for(:body_class, "project-page dashboard")
+= render "project_head"
#news-feed.news-feed
- %h2.icon
- %span>
- Activities
.project-box.project-updates.ui-box.ui-box-small.ui-box-big
- @activities.each do |update|
= render "projects/feed", :update => update, :project => @project
diff --git a/app/views/projects/team.html.haml b/app/views/projects/team.html.haml
index 3b2c4b3ef9c..41afc451a80 100644
--- a/app/views/projects/team.html.haml
+++ b/app/views/projects/team.html.haml
@@ -1,3 +1,4 @@
+= render "project_head"
%div
= render :partial => "team", :locals => {:project => @project}
diff --git a/app/views/projects/update.js.haml b/app/views/projects/update.js.haml
index 0188f083735..70d8490ebe2 100644
--- a/app/views/projects/update.js.haml
+++ b/app/views/projects/update.js.haml
@@ -1,6 +1,6 @@
- if @project.valid?
:plain
- location.href = "#{project_path(@project, :notice => 'Project was successfully updated.')}";
+ location.href = "#{info_project_path(@project, :notice => 'Project was successfully updated.')}";
- else
:plain
$(".edit_project").replaceWith("#{escape_javascript(render('form'))}");
diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml
index f08a3d1d673..9af12f74c2b 100644
--- a/app/views/snippets/index.html.haml
+++ b/app/views/snippets/index.html.haml
@@ -1,6 +1,4 @@
-%h2.icon
- %span>
- Snippets
+= render "projects/project_head"
- if can? current_user, :write_snippet, @project
.right= link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10"
diff --git a/config/routes.rb b/config/routes.rb
index bf9fe95454d..5888096653a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -42,6 +42,8 @@ Gitlab::Application.routes.draw do
get "team"
get "wall"
get "graph"
+ get "info"
+ get "files"
end
resources :refs, :only => [], :path => "/" do
diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb
index b0a52dcb3c1..391bc3e5d2e 100644
--- a/spec/requests/projects_spec.rb
+++ b/spec/requests/projects_spec.rb
@@ -140,7 +140,7 @@ describe "Projects" do
end
it "should be correct path" do
- current_path.should == project_path(@project)
+ current_path.should == info_project_path(@project)
end
it "should show project" do