BigW Consortium Gitlab

Commit e33aab0b by Dmitriy Zaporozhets

Merge branch 'feature/project_tab'

parents 7279e8c1 61a2ce41
...@@ -561,6 +561,7 @@ h4.middle-panel { ...@@ -561,6 +561,7 @@ h4.middle-panel {
display:none; display:none;
} }
.merge-tabs { .merge-tabs {
margin: 0; margin: 0;
border: 1px solid #ccc; border: 1px solid #ccc;
...@@ -572,11 +573,10 @@ h4.middle-panel { ...@@ -572,11 +573,10 @@ h4.middle-panel {
.tab { .tab {
font-weight: bold; font-weight: bold;
text-transform: uppercase;
border-right: 1px solid #ddd; border-right: 1px solid #ddd;
background:none; background:none;
padding: 10px; padding: 10px;
width:60px; min-width:60px;
float:left; float:left;
position:relative; position:relative;
top:-5px; top:-5px;
...@@ -598,6 +598,11 @@ h4.middle-panel { ...@@ -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-notes-tab span { background: url("images.png") no-repeat -161px -1px; }
.merge-commits-tab span { background: url("images.png") no-repeat -86px 1px; } .merge-commits-tab span { background: url("images.png") no-repeat -86px 1px; }
......
...@@ -57,7 +57,7 @@ class ProjectsController < ApplicationController ...@@ -57,7 +57,7 @@ class ProjectsController < ApplicationController
def update def update
respond_to do |format| respond_to do |format|
if project.update_attributes(params[:project]) 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 format.js
else else
format.html { render action: "edit" } format.html { render action: "edit" }
...@@ -72,6 +72,13 @@ class ProjectsController < ApplicationController ...@@ -72,6 +72,13 @@ class ProjectsController < ApplicationController
@activities = @project.cached_updates(limit) @activities = @project.cached_updates(limit)
end end
def files
@notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100)
end
def info
end
# #
# Wall # Wall
# #
......
...@@ -16,12 +16,21 @@ module ProjectsHelper ...@@ -16,12 +16,21 @@ module ProjectsHelper
nil nil
end end
# expires in 360 days def project_tab_class
def switch_colorscheme_link(opts) [:show, :files, :team, :edit, :update, :info].each do |action|
if cookies[:colorschema].blank? return "current" if current_page?(:controller => "projects", :action => action, :id => @project)
link_to_function "paint it black!", "$.cookie('colorschema','black', {expires:360}); window.location.reload()", opts end
else
link_to_function "paint it white!", "$.cookie('colorschema','', {expires:360}); window.location.reload()", opts if controller.controller_name == "snippets" ||
controller.controller_name == "team_members"
"current"
end end
end end
def tree_tab_class
current_page?(:controller => "refs",
:action => "tree",
:project_id => @project,
:id => @ref || @project.root_ref ) ? "current" : nil
end
end end
...@@ -23,14 +23,10 @@ ...@@ -23,14 +23,10 @@
.project-sidebar .project-sidebar
.fixed .fixed
%aside %aside
= link_to "Activities", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil = link_to "Project", project_path(@project), :class => project_tab_class
= 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 "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 "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 "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 = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
Issues Issues
- if @project.issues.open_for(current_user).count > 0 - if @project.issues.open_for(current_user).count > 0
...@@ -43,13 +39,7 @@ ...@@ -43,13 +39,7 @@
Merge Requests Merge Requests
- if @project.merge_requests.opened.count > 0 - if @project.merge_requests.opened.count > 0
%span{ :class => "number" }= @project.merge_requests.opened.count %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 .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project
......
.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
%h2.icon
%span>
Team
- if can? current_user, :admin_team_member, @project - if can? current_user, :admin_team_member, @project
%div#new-member-holder %div#new-member-holder
.right= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button" .right= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button"
.clear
%br %br
%table.round-borders#team-table %table.round-borders#team-table
%thead %thead
......
= 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();
})
= 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
= 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
- content_for(:body_class, "project-page dashboard") - content_for(:body_class, "project-page dashboard")
= render "project_head"
#news-feed.news-feed #news-feed.news-feed
%h2.icon
%span>
Activities
.project-box.project-updates.ui-box.ui-box-small.ui-box-big .project-box.project-updates.ui-box.ui-box-small.ui-box-big
- @activities.each do |update| - @activities.each do |update|
= render "projects/feed", :update => update, :project => @project = render "projects/feed", :update => update, :project => @project
......
= render "project_head"
%div %div
= render :partial => "team", :locals => {:project => @project} = render :partial => "team", :locals => {:project => @project}
- if @project.valid? - if @project.valid?
:plain :plain
location.href = "#{project_path(@project, :notice => 'Project was successfully updated.')}"; location.href = "#{info_project_path(@project, :notice => 'Project was successfully updated.')}";
- else - else
:plain :plain
$(".edit_project").replaceWith("#{escape_javascript(render('form'))}"); $(".edit_project").replaceWith("#{escape_javascript(render('form'))}");
%h2.icon = render "projects/project_head"
%span>
Snippets
- if can? current_user, :write_snippet, @project - if can? current_user, :write_snippet, @project
.right= link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" .right= link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10"
......
...@@ -42,6 +42,8 @@ Gitlab::Application.routes.draw do ...@@ -42,6 +42,8 @@ Gitlab::Application.routes.draw do
get "team" get "team"
get "wall" get "wall"
get "graph" get "graph"
get "info"
get "files"
end end
resources :refs, :only => [], :path => "/" do resources :refs, :only => [], :path => "/" do
......
...@@ -140,7 +140,7 @@ describe "Projects" do ...@@ -140,7 +140,7 @@ describe "Projects" do
end end
it "should be correct path" do it "should be correct path" do
current_path.should == project_path(@project) current_path.should == info_project_path(@project)
end end
it "should show project" do it "should show project" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment