Commit 6b01196f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Dashboard to resource

parent bd3b677b
...@@ -2,9 +2,9 @@ class DashboardController < ApplicationController ...@@ -2,9 +2,9 @@ class DashboardController < ApplicationController
respond_to :html respond_to :html
before_filter :load_projects before_filter :load_projects
before_filter :event_filter, only: :index before_filter :event_filter, only: :show
def index def show
@groups = current_user.authorized_groups @groups = current_user.authorized_groups
@has_authorized_projects = @projects.count > 0 @has_authorized_projects = @projects.count > 0
@teams = current_user.authorized_teams @teams = current_user.authorized_teams
......
...@@ -9,9 +9,9 @@ module DashboardHelper ...@@ -9,9 +9,9 @@ module DashboardHelper
case entity case entity
when 'issue' then when 'issue' then
dashboard_issues_path(options) issues_dashboard_path(options)
when 'merge_request' when 'merge_request'
dashboard_merge_requests_path(options) merge_requests_dashboard_path(options)
end end
end end
......
...@@ -28,4 +28,4 @@ ...@@ -28,4 +28,4 @@
%h3.nothing_here_message There are no projects here. %h3.nothing_here_message There are no projects here.
- if @projects_count > 20 - if @projects_count > 20
%li.bottom %li.bottom
%strong= link_to "show all projects", dashboard_projects_path %strong= link_to "show all projects", projects_dashboard_path
xml.instruct! xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "#{current_user.name} issues" xml.title "#{current_user.name} issues"
xml.link :href => dashboard_issues_url(:atom, :private_token => current_user.private_token), :rel => "self", :type => "application/atom+xml" xml.link :href => issues_dashboard_url(:atom, :private_token => current_user.private_token), :rel => "self", :type => "application/atom+xml"
xml.link :href => dashboard_issues_url(:private_token => current_user.private_token), :rel => "alternate", :type => "text/html" xml.link :href => issues_dashboard_url(:private_token => current_user.private_token), :rel => "alternate", :type => "text/html"
xml.id dashboard_issues_url(:private_token => current_user.private_token) xml.id issues_dashboard_url(:private_token => current_user.private_token)
xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any?
@issues.each do |issue| @issues.each do |issue|
......
...@@ -8,19 +8,20 @@ ...@@ -8,19 +8,20 @@
%i.icon-plus %i.icon-plus
New Project New Project
%hr %hr
.row .row
.span3 .span3
%ul.nav.nav-pills.nav-stacked %ul.nav.nav-pills.nav-stacked
= nav_tab :scope, nil do = nav_tab :scope, nil do
= link_to "All", dashboard_projects_path = link_to "All", projects_dashboard_path
= nav_tab :scope, 'personal' do = nav_tab :scope, 'personal' do
= link_to "Personal", dashboard_projects_path(scope: 'personal') = link_to "Personal", projects_dashboard_path(scope: 'personal')
= nav_tab :scope, 'joined' do = nav_tab :scope, 'joined' do
= link_to "Joined", dashboard_projects_path(scope: 'joined') = link_to "Joined", projects_dashboard_path(scope: 'joined')
.span9 .span9
= form_tag dashboard_projects_path, method: 'get' do = form_tag projects_dashboard_path, method: 'get' do
%fieldset.dashboard-search-filter %fieldset.dashboard-search-filter
= hidden_field_tag "scope", params[:scope] = hidden_field_tag "scope", params[:scope]
= search_field_tag "search", params[:search], { placeholder: 'Search', class: 'left input-xxlarge' } = search_field_tag "search", params[:search], { placeholder: 'Search', class: 'left input-xxlarge' }
...@@ -29,16 +30,25 @@ ...@@ -29,16 +30,25 @@
%ul.well-list %ul.well-list
- @projects.each do |project| - @projects.each do |project|
%li %li.clearfix
.left
= link_to project_path(project), class: dom_class(project) do = link_to project_path(project), class: dom_class(project) do
- if project.namespace - if project.namespace
= project.namespace.human_name = project.namespace.human_name
\/ \/
%strong.well-title %strong.well-title
= truncate(project.name, length: 25) = truncate(project.name, length: 25)
%span.right.light %br
%small.light
%strong Last activity: %strong Last activity:
%span= project_last_activity(project) %span= project_last_activity(project)
.right.light
- if project.owner == current_user
%i.icon-wrench
- tm = project.team.get_tm(current_user.id)
- if tm
= tm.project_access_human
- if @projects.blank? - if @projects.blank?
%li %li
%h3.nothing_here_message There are no projects here. %h3.nothing_here_message There are no projects here.
......
xml.instruct! xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "#{@user.name} issues" xml.title "#{@user.name} issues"
xml.link :href => dashboard_issues_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml" xml.link :href => issues_dashboard_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.link :href => issues_dashboard_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html"
xml.id dashboard_issues_url(:private_token => @user.private_token) xml.id issues_dashboard_url(:private_token => @user.private_token)
xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any?
@issues.each do |issue| @issues.each do |issue|
......
...@@ -6,17 +6,17 @@ ...@@ -6,17 +6,17 @@
= render "layouts/head_panel", title: "Dashboard" = render "layouts/head_panel", title: "Dashboard"
.container .container
%ul.main_menu %ul.main_menu
= nav_link(path: 'dashboard#index', html_options: {class: 'home'}) do = nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do
= link_to "Home", root_path, title: "Home" = link_to "Home", root_path, title: "Home"
= nav_link(path: 'dashboard#projects') do = nav_link(path: 'dashboard#projects') do
= link_to dashboard_projects_path do = link_to projects_dashboard_path do
Projects Projects
= nav_link(path: 'dashboard#issues') do = nav_link(path: 'dashboard#issues') do
= link_to dashboard_issues_path do = link_to issues_dashboard_path do
Issues Issues
%span.count= current_user.assigned_issues.opened.count %span.count= current_user.assigned_issues.opened.count
= nav_link(path: 'dashboard#merge_requests') do = nav_link(path: 'dashboard#merge_requests') do
= link_to dashboard_merge_requests_path do = link_to merge_requests_dashboard_path do
Merge Requests Merge Requests
%span.count= current_user.cared_merge_requests.opened.count %span.count= current_user.cared_merge_requests.opened.count
= nav_link(path: 'search#show') do = nav_link(path: 'search#show') do
......
...@@ -118,10 +118,13 @@ Gitlab::Application.routes.draw do ...@@ -118,10 +118,13 @@ Gitlab::Application.routes.draw do
# #
# Dashboard Area # Dashboard Area
# #
get "dashboard" => "dashboard#index" resource :dashboard, controller: "dashboard" do
get "dashboard/projects" => "dashboard#projects" member do
get "dashboard/issues" => "dashboard#issues" get :projects
get "dashboard/merge_requests" => "dashboard#merge_requests" get :issues
get :merge_requests
end
end
# #
# Groups Area # Groups Area
...@@ -285,5 +288,5 @@ Gitlab::Application.routes.draw do ...@@ -285,5 +288,5 @@ Gitlab::Application.routes.draw do
end end
end end
root to: "dashboard#index" root to: "dashboard#show"
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment