Commit 2f790001a029144f7a614d49a123cd1037f6398c
1 parent
8786aff2
Exists in
master
and in
4 other branches
project -> show refactor
Showing
3 changed files
with
4 additions
and
17 deletions
Show diff stats
app/controllers/projects_controller.rb
| @@ -64,21 +64,8 @@ class ProjectsController < ApplicationController | @@ -64,21 +64,8 @@ class ProjectsController < ApplicationController | ||
| 64 | 64 | ||
| 65 | def show | 65 | def show |
| 66 | return render "projects/empty" unless @project.repo_exists? | 66 | return render "projects/empty" unless @project.repo_exists? |
| 67 | - @date = case params[:view] | ||
| 68 | - when "week" then Date.today - 7.days | ||
| 69 | - when "day" then Date.today | ||
| 70 | - else nil | ||
| 71 | - end | ||
| 72 | - | ||
| 73 | - if @date | ||
| 74 | - @date = @date.at_beginning_of_day | ||
| 75 | - | ||
| 76 | - @commits = @project.commits_since(@date) | ||
| 77 | - @messages = project.notes.since(@date).order("created_at DESC") | ||
| 78 | - else | ||
| 79 | - @commits = @project.fresh_commits | ||
| 80 | - @messages = project.notes.fresh.limit(10) | ||
| 81 | - end | 67 | + limit = (params[:limit] || 40).to_i |
| 68 | + @activities = @project.updates(limit) | ||
| 82 | end | 69 | end |
| 83 | 70 | ||
| 84 | # | 71 | # |
app/views/dashboard/index.html.haml
| @@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
| 28 | = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40 | 28 | = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40 |
| 29 | %span.update-title | 29 | %span.update-title |
| 30 | - if update.kind_of?(Grit::Commit) | 30 | - if update.kind_of?(Grit::Commit) |
| 31 | - %span.tag.commit= update.head.name | 31 | + %span.right.tag.commit= update.head.name |
| 32 | = dashboard_feed_title(update) | 32 | = dashboard_feed_title(update) |
| 33 | %span.update-author | 33 | %span.update-author |
| 34 | %strong= update.author_name | 34 | %strong= update.author_name |
app/views/projects/show.html.haml
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | %span> | 5 | %span> |
| 6 | Activities | 6 | Activities |
| 7 | .project-box.project-updates.ui-box.ui-box-small.ui-box-big | 7 | .project-box.project-updates.ui-box.ui-box-small.ui-box-big |
| 8 | - - @project.updates(20).each do |update| | 8 | + - @activities.each do |update| |
| 9 | = render "projects/feed", :update => update, :project => @project | 9 | = render "projects/feed", :update => update, :project => @project |
| 10 | 10 | ||
| 11 | :javascript | 11 | :javascript |