Dashboard refactoring:
* dashboard should be in dashboard controller not project index * projects index removed
This commit is contained in:
parent
9ef9c58f55
commit
edd81a79c5
15 changed files with 84 additions and 101 deletions
36
app/views/dashboard/index.atom.builder
Normal file
36
app/views/dashboard/index.atom.builder
Normal file
|
@ -0,0 +1,36 @@
|
|||
xml.instruct!
|
||||
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
|
||||
xml.title "Dashboard feed#{" - #{current_user.name}" if current_user.name.present?}"
|
||||
xml.link :href => projects_url(:atom), :rel => "self", :type => "application/atom+xml"
|
||||
xml.link :href => projects_url, :rel => "alternate", :type => "text/html"
|
||||
xml.id projects_url
|
||||
xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any?
|
||||
|
||||
@events.each do |event|
|
||||
if event.allowed?
|
||||
xml.entry do
|
||||
if event.issue?
|
||||
event_link = project_issue_url(event.project, event.issue)
|
||||
event_title = event.issue_title
|
||||
elsif event.merge_request?
|
||||
event_link = project_merge_request_url(event.project, event.merge_request)
|
||||
event_title = event.merge_request_title
|
||||
elsif event.push?
|
||||
event_link = project_commits_url(event.project, :ref => event.ref_name)
|
||||
event_title = event.ref_name
|
||||
end
|
||||
|
||||
xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}"
|
||||
xml.link :href => event_link
|
||||
xml.title truncate(event_title, :length => 80)
|
||||
xml.updated event.created_at.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(event.author_email)
|
||||
xml.author do |author|
|
||||
xml.name event.author_name
|
||||
xml.email event.author_email
|
||||
end
|
||||
xml.summary event_title
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
56
app/views/dashboard/index.html.haml
Normal file
56
app/views/dashboard/index.html.haml
Normal file
|
@ -0,0 +1,56 @@
|
|||
- if @projects.any?
|
||||
.projects
|
||||
.activities.span8
|
||||
- if current_user.require_ssh_key?
|
||||
.alert.alert-error.padded
|
||||
%span
|
||||
You wont be able to pull/push project code unless you
|
||||
%strong
|
||||
= link_to new_key_path, :class => "vlink" do
|
||||
add new key
|
||||
to your profile
|
||||
- if @events.any?
|
||||
= render @events
|
||||
- else
|
||||
%h4.nothing_here_message Projects activity will be displayed here
|
||||
.side
|
||||
= render "events/event_last_push", :event => @last_push
|
||||
.projects_box
|
||||
%h5
|
||||
Projects
|
||||
%small
|
||||
(#{@projects.total_count})
|
||||
- if current_user.can_create_project?
|
||||
%span.right
|
||||
= link_to new_project_path, :class => "btn very_small info" do
|
||||
%i.icon-plus
|
||||
New Project
|
||||
- @projects.each do |project|
|
||||
= link_to project_path(project), :class => dom_class(project) do
|
||||
%h4
|
||||
%span.ico.project
|
||||
= truncate(project.name, :length => 25)
|
||||
%span.right
|
||||
→
|
||||
.bottom= paginate @projects, :theme => "gitlab"
|
||||
|
||||
%hr
|
||||
%div
|
||||
%span.rss-icon
|
||||
= link_to dashboard_path(:atom, { :private_token => current_user.private_token }) do
|
||||
= image_tag "rss_ui.png", :title => "feed"
|
||||
%strong News Feed
|
||||
|
||||
- else
|
||||
%h3.nothing_here_message There are no projects you have access to.
|
||||
%br
|
||||
%h4.nothing_here_message
|
||||
- if current_user.can_create_project?
|
||||
You can create up to
|
||||
= current_user.projects_limit
|
||||
projects. Click on button below to add a new one
|
||||
.link_holder
|
||||
= link_to new_project_path, :class => "btn primary" do
|
||||
New Project »
|
||||
- else
|
||||
If you will be added to project - it will be displayed here
|
2
app/views/dashboard/index.js.haml
Normal file
2
app/views/dashboard/index.js.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
:plain
|
||||
$(".projects .activities").append("#{escape_javascript(render(@events))}");
|
Loading…
Add table
Add a link
Reference in a new issue