diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-08 22:17:53 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-08 22:17:53 +0200 |
commit | cd779e56e1ce799fc6ec25dc2fbc8a3e0f775ee8 (patch) | |
tree | b10daacc88ec915f7f61e43a2b38701c4722daa2 /app | |
parent | 4107f2cc2e6d0b93208573f4873305ba0ef4c5de (diff) | |
download | gitlab-ce-cd779e56e1ce799fc6ec25dc2fbc8a3e0f775ee8.tar.gz |
dashboard v1
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/dashboard_controller.rb | 31 | ||||
-rw-r--r-- | app/controllers/user_issues_controller.rb | 20 | ||||
-rw-r--r-- | app/controllers/user_merge_requests_controller.rb | 8 | ||||
-rw-r--r-- | app/views/dashboard/_issues_feed.html.haml | 29 | ||||
-rw-r--r-- | app/views/dashboard/_merge_requests_feed.html.haml | 31 | ||||
-rw-r--r-- | app/views/dashboard/_projects_feed.html.haml | 20 | ||||
-rw-r--r-- | app/views/dashboard/_sidebar.html.haml | 15 | ||||
-rw-r--r-- | app/views/dashboard/index.html.haml | 17 | ||||
-rw-r--r-- | app/views/dashboard/index.js.haml | 7 | ||||
-rw-r--r-- | app/views/dashboard/issues.atom.builder (renamed from app/views/user_issues/index.atom.builder) | 6 | ||||
-rw-r--r-- | app/views/dashboard/issues.html.haml | 5 | ||||
-rw-r--r-- | app/views/dashboard/issues.js.haml | 7 | ||||
-rw-r--r-- | app/views/dashboard/merge_requests.html.haml | 5 | ||||
-rw-r--r-- | app/views/dashboard/merge_requests.js.haml | 7 | ||||
-rw-r--r-- | app/views/merge_requests/_merge_request.html.haml | 3 | ||||
-rw-r--r-- | app/views/user_issues/index.html.haml | 18 | ||||
-rw-r--r-- | app/views/user_merge_requests/index.html.haml | 18 |
17 files changed, 124 insertions, 123 deletions
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 1c50c66e5f6..7c5739936cd 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,6 +1,37 @@ class DashboardController < ApplicationController + respond_to :js, :html + def index @projects = current_user.projects.all @active_projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse + + respond_to do |format| + format.html + format.js { no_cache_headers } + end + end + + def merge_requests + @projects = current_user.projects.all + @merge_requests = current_user.assigned_merge_requests.order("created_at DESC").limit(40) + + respond_to do |format| + format.html + format.js { no_cache_headers } + end + end + + def issues + @projects = current_user.projects.all + @user = current_user + @issues = current_user.assigned_issues.opened.order("created_at DESC").limit(40) + + @issues = @issues.includes(:author, :project) + + respond_to do |format| + format.html + format.js { no_cache_headers } + format.atom { render :layout => false } + end end end diff --git a/app/controllers/user_issues_controller.rb b/app/controllers/user_issues_controller.rb deleted file mode 100644 index d7613aa090d..00000000000 --- a/app/controllers/user_issues_controller.rb +++ /dev/null @@ -1,20 +0,0 @@ -class UserIssuesController < ApplicationController - before_filter :authenticate_user! - - respond_to :js, :html - - def index - @projects = current_user.projects.all - @user = current_user - @issues = current_user.assigned_issues.opened - - @issues = @issues.includes(:author, :project) - - respond_to do |format| - format.html - format.js - format.atom { render :layout => false } - end - end - -end diff --git a/app/controllers/user_merge_requests_controller.rb b/app/controllers/user_merge_requests_controller.rb deleted file mode 100644 index 879499e1013..00000000000 --- a/app/controllers/user_merge_requests_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -class UserMergeRequestsController < ApplicationController - before_filter :authenticate_user! - - def index - @projects = current_user.projects.all - @merge_requests = current_user.assigned_merge_requests - end -end diff --git a/app/views/dashboard/_issues_feed.html.haml b/app/views/dashboard/_issues_feed.html.haml index bd0d144d930..5945a370d37 100644 --- a/app/views/dashboard/_issues_feed.html.haml +++ b/app/views/dashboard/_issues_feed.html.haml @@ -1,28 +1,31 @@ -#news-feed.news-feed - %div - = link_to dashboard_path, :class => "left" do - .box-arrow - ← - %h2{:style => "width:86%; text-align:center"} - Issues - = link_to merge_requests_path, :class => "right" do - .box-arrow - → +%div + = link_to dashboard_path, :remote => true, :class => "left" do + .box-arrow + ← + %h2{:style => "width:86%; text-align:center"} + Issues + = link_to dashboard_merge_requests_path, :remote => true, :class => "right" do + .box-arrow + → +#feeds_content_holder .project-box.project-updates.ui-box.ui-box-small.ui-box-big .data - @issues.each do |update| %a.project-update{:href => dashboard_feed_path(update.project, update)} = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40 %span.update-title - = dashboard_feed_title(update) + = truncate update.title, :length => 50 + .right= update.project.name %span.update-author %strong= update.author_name authored = time_ago_in_words(update.created_at) ago .right - - klass = update.class.to_s.split("::").last.downcase - %span.tag{ :class => klass }= klass + - if update.critical + %span.tag.high critical + - if update.today? + %span.tag.today today diff --git a/app/views/dashboard/_merge_requests_feed.html.haml b/app/views/dashboard/_merge_requests_feed.html.haml index 7443d5fa2f8..22a7e703a31 100644 --- a/app/views/dashboard/_merge_requests_feed.html.haml +++ b/app/views/dashboard/_merge_requests_feed.html.haml @@ -1,27 +1,28 @@ -#news-feed.news-feed - %div - = link_to issues_path, :class => "left" do - .box-arrow - ← - %h2{:style => "width:86%; text-align:center"} - Merge Requests - = link_to dashboard_path, :class => "right" do - .box-arrow - → +%div + = link_to dashboard_issues_path, :remote => true, :class => "left" do + .box-arrow + ← + %h2{:style => "width:86%; text-align:center"} + Merge Requests + = link_to dashboard_path, :remote => true, :class => "right" do + .box-arrow + → +#feeds_content_holder .project-box.project-updates.ui-box.ui-box-small.ui-box-big .data - @merge_requests.each do |update| - %a.project-update{:href => dashboard_feed_path(update.project, update)} + %a.project-update{:href => project_merge_request_path(update.project, update)} = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40 %span.update-title - = dashboard_feed_title(update) + = truncate update.title, :length => 70 + .right= update.project.name %span.update-author %strong= update.author_name authored = time_ago_in_words(update.created_at) ago .right - - klass = update.class.to_s.split("::").last.downcase - %span.tag{ :class => klass }= klass - + %span.tag.commit= update.source_branch + → + %span.tag.commit= update.target_branch diff --git a/app/views/dashboard/_projects_feed.html.haml b/app/views/dashboard/_projects_feed.html.haml index 7fe93240fd6..bae5fbfb595 100644 --- a/app/views/dashboard/_projects_feed.html.haml +++ b/app/views/dashboard/_projects_feed.html.haml @@ -1,14 +1,14 @@ -#news-feed.news-feed - %div - = link_to merge_requests_path, :class => "left" do - .box-arrow - ← - %h2{:style => "width:86%; text-align:center"} - Activities - = link_to issues_path, :class => "right" do - .box-arrow - → +%div + = link_to dashboard_merge_requests_path, :remote => true, :class => "left", :id => "merge_requests_slide" do + .box-arrow + ← + %h2{:style => "width:86%; text-align:center"} + Activities + = link_to dashboard_issues_path, :remote => true, :class => "right", :id => "issues_slide" do + .box-arrow + → +#feeds_content_holder - @active_projects.first(3).each do |project| .project-box.project-updates.ui-box.ui-box-small.ui-box-big = link_to project, do diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml new file mode 100644 index 00000000000..337c1541a3e --- /dev/null +++ b/app/views/dashboard/_sidebar.html.haml @@ -0,0 +1,15 @@ +%aside + %h4 + - if current_user.can_create_project? + %a.button-small.button-green{:href => new_project_path} New Project + Your Projects + %ol.project-list + - @projects.each do |project| + %li + %a{:href => project_path(project)} + %span.arrow → + %span.project-name= project.name + %span.time + %strong Last activity: + = project.last_activity_date ? time_ago_in_words(project.last_activity_date) + " ago" : "Never" + diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml index 2c934998f68..b3de30f2ecd 100644 --- a/app/views/dashboard/index.html.haml +++ b/app/views/dashboard/index.html.haml @@ -1,18 +1,5 @@ - content_for(:body_class, "dashboard-page") #dashboard-content.dashboard-content.content - %aside - %h4 - - if current_user.can_create_project? - %a.button-small.button-green{:href => new_project_path} New Project - Your Projects - %ol.project-list - - @projects.each do |project| - %li - %a{:href => project_path(project)} - %span.arrow → - %span.project-name= project.name - %span.time - %strong Last activity: - = project.last_activity_date ? time_ago_in_words(project.last_activity_date) + " ago" : "Never" - = render "dashboard/projects_feed" + = render "dashboard/sidebar" + #news-feed.news-feed= render "dashboard/projects_feed" diff --git a/app/views/dashboard/index.js.haml b/app/views/dashboard/index.js.haml new file mode 100644 index 00000000000..44b3b801f7b --- /dev/null +++ b/app/views/dashboard/index.js.haml @@ -0,0 +1,7 @@ +:plain + $("#feeds_content_holder").hide("slide", { direction: "left" }, 150, function(){ + $("#news-feed").html("#{escape_javascript(render(:partial => "projects_feed"))}"); + $("#feeds_content_holder").show("slide", { direction: "right" }, 150); + history.pushState({ path: this.path }, '', '#{dashboard_path}') + }); + diff --git a/app/views/user_issues/index.atom.builder b/app/views/dashboard/issues.atom.builder index 42fc5245f72..5bd07bcd89f 100644 --- a/app/views/user_issues/index.atom.builder +++ b/app/views/dashboard/issues.atom.builder @@ -1,9 +1,9 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.title "#{@user.name} issues" - xml.link :href => issues_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml" - xml.link :href => issues_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html" - xml.id issues_url(:private_token => @user.private_token) + xml.link :href => dashboard_issues_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml" + xml.link :href => dashboard_issues_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html" + xml.id dashboard_issues_url(:private_token => @user.private_token) xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? @issues.each do |issue| diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml new file mode 100644 index 00000000000..063183ed0d1 --- /dev/null +++ b/app/views/dashboard/issues.html.haml @@ -0,0 +1,5 @@ +- content_for(:body_class, "dashboard-page") + +#dashboard-content.dashboard-content.content + = render "dashboard/sidebar" + #news-feed.news-feed= render "dashboard/issues_feed" diff --git a/app/views/dashboard/issues.js.haml b/app/views/dashboard/issues.js.haml new file mode 100644 index 00000000000..30a71af6c72 --- /dev/null +++ b/app/views/dashboard/issues.js.haml @@ -0,0 +1,7 @@ +:plain + $("#feeds_content_holder").hide("slide", { direction: "left" }, 150, function(){ + $("#news-feed").html("#{escape_javascript(render(:partial => "issues_feed"))}"); + $("#feeds_content_holder").show("slide", { direction: "right" }, 150); + history.pushState({ path: this.path }, '', '#{dashboard_issues_path}') + }); + diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml new file mode 100644 index 00000000000..088577eaf50 --- /dev/null +++ b/app/views/dashboard/merge_requests.html.haml @@ -0,0 +1,5 @@ +- content_for(:body_class, "dashboard-page") + +#dashboard-content.dashboard-content.content + = render "dashboard/sidebar" + #news-feed.news-feed= render "dashboard/merge_requests_feed" diff --git a/app/views/dashboard/merge_requests.js.haml b/app/views/dashboard/merge_requests.js.haml new file mode 100644 index 00000000000..81d3424b5d0 --- /dev/null +++ b/app/views/dashboard/merge_requests.js.haml @@ -0,0 +1,7 @@ +:plain + $("#feeds_content_holder").hide("slide", { direction: "left" }, 150, function(){ + $("#news-feed").html("#{escape_javascript(render(:partial => "merge_requests_feed"))}"); + $("#feeds_content_holder").show("slide", { direction: "right" }, 150); + history.pushState({ path: this.path }, '', '#{dashboard_merge_requests_path}') + }); + diff --git a/app/views/merge_requests/_merge_request.html.haml b/app/views/merge_requests/_merge_request.html.haml index ef290833a27..937af5b98d8 100644 --- a/app/views/merge_requests/_merge_request.html.haml +++ b/app/views/merge_requests/_merge_request.html.haml @@ -3,9 +3,6 @@ %span.update-title = merge_request.title %span.update-author - - if not @project.present? - %strong= merge_request.project.name - = '-' %strong= merge_request.author_name authored = time_ago_in_words(merge_request.created_at) diff --git a/app/views/user_issues/index.html.haml b/app/views/user_issues/index.html.haml deleted file mode 100644 index d2c745e8c31..00000000000 --- a/app/views/user_issues/index.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -- content_for(:body_class, "dashboard-page") - -#dashboard-content.dashboard-content.content - %aside - %h4 - - if current_user.can_create_project? - %a.button-small.button-green{:href => new_project_path} New Project - Your Projects - %ol.project-list - - @projects.each do |project| - %li - %a{:href => project_path(project)} - %span.arrow → - %span.project-name= project.name - %span.time - %strong Last activity: - = project.last_activity_date ? time_ago_in_words(project.last_activity_date) + " ago" : "Never" - = render "dashboard/issues_feed" diff --git a/app/views/user_merge_requests/index.html.haml b/app/views/user_merge_requests/index.html.haml deleted file mode 100644 index 75d56bf5e44..00000000000 --- a/app/views/user_merge_requests/index.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -- content_for(:body_class, "dashboard-page") - -#dashboard-content.dashboard-content.content - %aside - %h4 - - if current_user.can_create_project? - %a.button-small.button-green{:href => new_project_path} New Project - Your Projects - %ol.project-list - - @projects.each do |project| - %li - %a{:href => project_path(project)} - %span.arrow → - %span.project-name= project.name - %span.time - %strong Last activity: - = project.last_activity_date ? time_ago_in_words(project.last_activity_date) + " ago" : "Never" - = render "dashboard/merge_requests_feed" |