From 2f790001a029144f7a614d49a123cd1037f6398c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 12 Nov 2011 16:28:14 +0200 Subject: [PATCH] project -> show refactor --- app/controllers/projects_controller.rb | 17 ++--------------- app/views/dashboard/index.html.haml | 2 +- app/views/projects/show.html.haml | 2 +- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0494e1820..0639982c6 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -64,21 +64,8 @@ class ProjectsController < ApplicationController def show return render "projects/empty" unless @project.repo_exists? - @date = case params[:view] - when "week" then Date.today - 7.days - when "day" then Date.today - else nil - end - - if @date - @date = @date.at_beginning_of_day - - @commits = @project.commits_since(@date) - @messages = project.notes.since(@date).order("created_at DESC") - else - @commits = @project.fresh_commits - @messages = project.notes.fresh.limit(10) - end + limit = (params[:limit] || 40).to_i + @activities = @project.updates(limit) end # diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml index a8b7f2538..e25ec249e 100644 --- a/app/views/dashboard/index.html.haml +++ b/app/views/dashboard/index.html.haml @@ -28,7 +28,7 @@ = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40 %span.update-title - if update.kind_of?(Grit::Commit) - %span.tag.commit= update.head.name + %span.right.tag.commit= update.head.name = dashboard_feed_title(update) %span.update-author %strong= update.author_name diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 97ac92d14..0530736fb 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -5,7 +5,7 @@ %span> Activities .project-box.project-updates.ui-box.ui-box-small.ui-box-big - - @project.updates(20).each do |update| + - @activities.each do |update| = render "projects/feed", :update => update, :project => @project :javascript -- 2.11.0