diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 19686ac2773d9097251b8a99353b4ba099a80868..4e3452085a6d2eb3bb4d4abbc2cdc5859773d007 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1,4 +1,5 @@ a { + outline: none; color: $link_color; &:hover { text-decoration:none; @@ -10,6 +11,10 @@ a { } } +a:focus { + outline: none; +} + .vlink { color: $link_color !important; } @@ -442,36 +447,6 @@ input.git_clone_url { background:#fff !important; } -.project_tile { - @include shade; - @include round-borders-all(4px); - margin-bottom:20px; - width:298px; - float:left; - margin-left:20px; - border: 1px solid #DDD; - padding-bottom:20px; - - .title { - background:#f5f5f5; - padding: 5px 10px 2px 20px; - border-bottom: 1px solid #DDD; - margin-bottom: 15px; - - h3 { - &:hover { - text-decoration: underline; - } - } - } - .data { - margin: 0 20px; - } - .buttons { - margin: 0 20px; - } -} - /** * * COMMIT SHOw @@ -610,26 +585,6 @@ p.time { .dashboard_category { margin-bottom:30px; - .ico { - background: url("images.png") no-repeat -85px -77px; - width: 19px; - height: 16px; - float: left; - position: relative; - margin-right: 10px; - top: 8px; - - &.project { - background-position: -37px -77px; - } - - &.activities { - background-position:-162px -22px; - } - &.projects { - background-position:-209px -21px; - } - } h3 a { @@ -688,3 +643,39 @@ p.time { .wll:hover { background:none } } + +.projects_list { + a.project { + h4 { + color:#888; + } + &.active { + h4 { + color:#111; + .ico.project { + background-position:-209px -21px; + } + } + } + } +} +.ico { + background: url("images.png") no-repeat -85px -77px; + width: 19px; + height: 16px; + float: left; + position: relative; + margin-right: 10px; + top: 8px; + + &.project { + background-position: -37px -77px; + } + + &.activities { + background-position:-162px -22px; + } + &.projects { + background-position:-209px -21px; + } +} diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 51fd27328852b3a8c10ebe9e822f56ce82d74ee5..90372cf5c8b4b9639571c27ae68da2557d59558f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -11,8 +11,8 @@ class ProjectsController < ApplicationController before_filter :require_non_empty_project, :only => [:blob, :tree, :graph] def index - @limit, @offset = (params[:limit] || 16), (params[:offset] || 0) - @projects = current_user.projects.limit(@limit).offset(@offset) + @projects = current_user.projects + @projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse end def new @@ -67,9 +67,19 @@ class ProjectsController < ApplicationController end def show - return render "projects/empty" unless @project.repo_exists? && @project.has_commits? limit = (params[:limit] || 20).to_i @events = @project.events.recent.limit(limit) + + respond_to do |format| + format.html do + if @project.repo_exists? && @project.has_commits? + render :show + else + render "projects/empty" + end + end + format.js + end end def files diff --git a/app/views/projects/_show.html.haml b/app/views/projects/_show.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..ee0b19e1a514d596edd8aac495a50d3a9ea2e2ee --- /dev/null +++ b/app/views/projects/_show.html.haml @@ -0,0 +1,23 @@ +%h4 + = @project.name +%hr +%div + %a.btn.info{:href => tree_project_ref_path(@project, @project.root_ref)} Browse code + + %a.btn{:href => project_commits_path(@project)} Commits + %strong.right + = link_to project_path(@project) do + Switch to project → +%hr +.alert-message.block-message.warning + .input + .input-prepend + %span.add-on git clone + = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url" + += simple_format @project.description +- unless @events.blank? + %h5.cgray Recent Activity + .content_list= render @events + + diff --git a/app/views/projects/_tile.html.haml b/app/views/projects/_tile.html.haml deleted file mode 100644 index e49aa076230a252c1082174d23841e2bcb2a9190..0000000000000000000000000000000000000000 --- a/app/views/projects/_tile.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- @projects.in_groups_of(3, false) do |projects| - .row - - projects.each_with_index do |project, i| - %div.project_tile - .title - = link_to project_path(project) do - %h3= truncate(project.name, :length => 28) - .data - %p - %input{ :value => project.url_to_repo, :class => ['git-url', 'one_click_select', 'text', 'project_list_url'], :readonly => 'readonly' } - .buttons - %a.btn.info{:href => tree_project_ref_path(project, project.root_ref)} Browse code - %a.btn{:href => project_commits_path(project)} Commits diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 3838c3398a7374223075f812be973bed2acc6097..b26a8672b0d732e1d7e658da973c389eb9301482 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -7,17 +7,33 @@ New Project %hr - unless @projects.empty? - %div.content_list= render "tile" + .row + .span5 + %div.content_list.projects_list + - @projects.each do |project| + = link_to project_path(project), :remote => true, :class => dom_class(project) do + %h4 + %span.ico.project + = truncate(project.name, :length => 26) + .span11.right.show_holder + .loading - -# If projects requris paging - -# We add ajax loader & init script - - if @projects.count == @limit - .loading{ :style => "display:none;"} - %center= image_tag "ajax-loader.gif" - - :javascript - $(function(){ - Pager.init(#{@limit}); - }); - else %h2 Nothing here + + +:javascript + $(function(){ + $("a.project").live("ajax:before", function() { + $(".show_holder").html("<div class='loading'>"); + $('a.project').removeClass("active"); + $(this).addClass("active"); + }); + $('a.project:first-child').trigger("click"); + }); + +- if @projects.count == @limit + :javascript + $(function(){ + Pager.init(#{@limit}); + }); diff --git a/app/views/projects/show.js.haml b/app/views/projects/show.js.haml new file mode 100644 index 0000000000000000000000000000000000000000..132ebebf23fcd4d51b1e21b2a90ac82e093ef17d --- /dev/null +++ b/app/views/projects/show.js.haml @@ -0,0 +1,7 @@ +- if @project.repo_exists? && @project.has_commits? + :plain + $(".show_holder").html("#{escape_javascript(render(:partial => 'projects/show'))}"); +- else + :plain + $(".show_holder").html("#{escape_javascript(render(:template => 'projects/empty'))}"); +