BigW Consortium Gitlab

Commit e33aab0b by Dmitriy Zaporozhets

Merge branch 'feature/project_tab'

parents 7279e8c1 61a2ce41
......@@ -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; }
......
......@@ -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
#
......
......@@ -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
......@@ -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
......
.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
%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
......
= 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")
= 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
......
= render "project_head"
%div
= render :partial => "team", :locals => {:project => @project}
- 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'))}");
%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"
......
......@@ -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
......
......@@ -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
......
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