Project tab r1 is finished

This commit is contained in:
Dmitriy Zaporozhets 2011-12-30 08:54:42 +02:00
parent c1c903fb95
commit 0f627a65f4
16 changed files with 128 additions and 53 deletions

View file

@ -573,7 +573,6 @@ 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;
@ -600,7 +599,9 @@ h4.middle-panel {
} }
} }
.activities-tab span { background: url("images.png") no-repeat -161px -1px; } .activities-tab span { background: url("images.png") no-repeat -161px -1px; }
.stat-tab, .team-tab, .snippets-tab span { background: url("images.png") no-repeat -38px -77px; } .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; } .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; }

View file

@ -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" }
@ -67,16 +67,16 @@ class ProjectsController < ApplicationController
end end
def show def show
return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
limit = (params[:limit] || 20).to_i
@activities = @project.cached_updates(limit)
end end
def files def files
@notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC") @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC")
end end
def activities def info
return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
limit = (params[:limit] || 20).to_i
@activities = @project.cached_updates(limit)
end end
# #

View file

@ -6,7 +6,7 @@
%ol.project-list %ol.project-list
- @projects.each do |project| - @projects.each do |project|
%li %li
%a{:href => activities_project_path(project)} %a{:href => project_path(project)}
%span.arrow → %span.arrow →
%span.project-name= project.name %span.project-name= project.name
%span.time %span.time

View file

@ -23,7 +23,7 @@
.project-sidebar .project-sidebar
.fixed .fixed
%aside %aside
= link_to "Project", project_path(@project), :class => (current_page?(:controller => "projects", :action => "activities", :id => @project) || controller.controller_name == "snippets" || current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members" || current_page?(project_path(@project))) ? "current" : nil = link_to "Project", project_path(@project), :class => (current_page?(:controller => "projects", :action => "show", :id => @project) || controller.controller_name == "snippets" || current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members" || current_page?(project_path(@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 "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 "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

View file

@ -1,26 +1,17 @@
%div
-#- if can? current_user, :admin_project, @project
-#%span.entity-info
-#= link_to edit_project_path(@project) do
-#.entity-button
-#Edit Project
-#%i
-#%h2= @project.name
.merge-tabs .merge-tabs
= link_to activities_project_path(@project), :class => "activities-tab tab #{'active' if current_page?(activities_project_path(@project)) }" do = link_to project_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_path(@project)) }" do
%span %span
Activities Activities
= link_to project_path(@project), :class => "stat-tab tab" do = 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 %span
Info Info
= link_to team_project_path(@project), :class => "team-tab tab" do = link_to team_project_path(@project), :class => "team-tab tab #{'active' if current_page?(team_project_path(@project)) }" do
%span %span
Team Team
= link_to files_project_path(@project), :class => "files-tab tab" do = link_to files_project_path(@project), :class => "files-tab tab #{'active' if current_page?(files_project_path(@project)) }" do
%span %span
Files Files
= link_to project_snippets_path(@project), :class => "snippets-tab tab" do = link_to project_snippets_path(@project), :class => "snippets-tab tab #{'active' if current_page?(project_snippets_path(@project)) }" do
%span %span
Snippets Snippets

View file

@ -1,9 +1,7 @@
%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

View file

@ -2,7 +2,7 @@
- projects.each_with_index do |project, i| - projects.each_with_index do |project, i|
%div.grid_1.projects_selector %div.grid_1.projects_selector
%div{ :class => "project-box ui-box ui-box-big" } %div{ :class => "project-box ui-box ui-box-big" }
= link_to activities_project_path(project) do = link_to project_path(project) do
%h3= truncate(project.name, :length => 20) %h3= truncate(project.name, :length => 20)
.data .data
%p.title.repository.git_url_wrapper %p.title.repository.git_url_wrapper

View file

@ -1,13 +0,0 @@
- content_for(:body_class, "project-page dashboard")
= render "project_head"
#news-feed.news-feed
.project-box.project-updates.ui-box.ui-box-small.ui-box-big
- @activities.each do |update|
= render "projects/feed", :update => update, :project => @project
:javascript
function updateDashboard(){
$('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*");
}
setInterval("updateDashboard()", 300000);

View file

@ -1 +0,0 @@
<%= render 'form' %>

View file

@ -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(){
$('form #project_default_branch').chosen();
})

View file

@ -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

View file

@ -1,6 +1,13 @@
- content_for(:body_class, "project-page dashboard")
= render "project_head" = render "project_head"
.stats #news-feed.news-feed
- unless @project.description.empty? .project-box.project-updates.ui-box.ui-box-small.ui-box-big
%h3= simple_format @project.description - @activities.each do |update|
= render "projects/feed", :update => update, :project => @project
:javascript
function updateDashboard(){
$('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*");
}
setInterval("updateDashboard()", 300000);

View file

@ -1,6 +1,6 @@
- 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'))}");

View file

@ -1,7 +1,4 @@
= render "projects/project_head" = render "projects/project_head"
%h2.icon
%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"

View file

@ -42,9 +42,7 @@ Gitlab::Application.routes.draw do
get "team" get "team"
get "wall" get "wall"
get "graph" get "graph"
get "activities" get "info"
get "branches"
get "tags"
get "files" get "files"
end end

View file

@ -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