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

Dashboard to resource

parent bd3b677b
......@@ -2,9 +2,9 @@ class DashboardController < ApplicationController
respond_to :html
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
@has_authorized_projects = @projects.count > 0
@teams = current_user.authorized_teams
......
......@@ -9,9 +9,9 @@ module DashboardHelper
case entity
when 'issue' then
dashboard_issues_path(options)
issues_dashboard_path(options)
when 'merge_request'
dashboard_merge_requests_path(options)
merge_requests_dashboard_path(options)
end
end
......
......@@ -28,4 +28,4 @@
%h3.nothing_here_message There are no projects here.
- if @projects_count > 20
%li.bottom
%strong= link_to "show all projects", dashboard_projects_path
%strong= link_to "show all projects", projects_dashboard_path
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
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 => dashboard_issues_url(:private_token => current_user.private_token), :rel => "alternate", :type => "text/html"
xml.id dashboard_issues_url(:private_token => current_user.private_token)
xml.link :href => issues_dashboard_url(:atom, :private_token => current_user.private_token), :rel => "self", :type => "application/atom+xml"
xml.link :href => issues_dashboard_url(:private_token => current_user.private_token), :rel => "alternate", :type => "text/html"
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?
@issues.each do |issue|
......
......@@ -8,19 +8,20 @@
%i.icon-plus
New Project
%hr
.row
.span3
%ul.nav.nav-pills.nav-stacked
= nav_tab :scope, nil do
= link_to "All", dashboard_projects_path
= link_to "All", projects_dashboard_path
= 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
= link_to "Joined", dashboard_projects_path(scope: 'joined')
= link_to "Joined", projects_dashboard_path(scope: 'joined')
.span9
= form_tag dashboard_projects_path, method: 'get' do
= form_tag projects_dashboard_path, method: 'get' do
%fieldset.dashboard-search-filter
= hidden_field_tag "scope", params[:scope]
= search_field_tag "search", params[:search], { placeholder: 'Search', class: 'left input-xxlarge' }
......@@ -29,16 +30,25 @@
%ul.well-list
- @projects.each do |project|
%li
= link_to project_path(project), class: dom_class(project) do
- if project.namespace
= project.namespace.human_name
\/
%strong.well-title
= truncate(project.name, length: 25)
%span.right.light
%li.clearfix
.left
= link_to project_path(project), class: dom_class(project) do
- if project.namespace
= project.namespace.human_name
\/
%strong.well-title
= truncate(project.name, length: 25)
%br
%small.light
%strong Last activity:
%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?
%li
%h3.nothing_here_message There are no projects here.
......
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 => 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.link :href => issues_dashboard_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml"
xml.link :href => issues_dashboard_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html"
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?
@issues.each do |issue|
......
......@@ -6,17 +6,17 @@
= render "layouts/head_panel", title: "Dashboard"
.container
%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"
= nav_link(path: 'dashboard#projects') do
= link_to dashboard_projects_path do
= link_to projects_dashboard_path do
Projects
= nav_link(path: 'dashboard#issues') do
= link_to dashboard_issues_path do
= link_to issues_dashboard_path do
Issues
%span.count= current_user.assigned_issues.opened.count
= nav_link(path: 'dashboard#merge_requests') do
= link_to dashboard_merge_requests_path do
= link_to merge_requests_dashboard_path do
Merge Requests
%span.count= current_user.cared_merge_requests.opened.count
= nav_link(path: 'search#show') do
......
......@@ -118,10 +118,13 @@ Gitlab::Application.routes.draw do
#
# Dashboard Area
#
get "dashboard" => "dashboard#index"
get "dashboard/projects" => "dashboard#projects"
get "dashboard/issues" => "dashboard#issues"
get "dashboard/merge_requests" => "dashboard#merge_requests"
resource :dashboard, controller: "dashboard" do
member do
get :projects
get :issues
get :merge_requests
end
end
#
# Groups Area
......@@ -285,5 +288,5 @@ Gitlab::Application.routes.draw do
end
end
root to: "dashboard#index"
root to: "dashboard#show"
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