Commit d192f921 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Move project activity to separate tab. Add more features to project home page

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 5e7f7f8d
...@@ -62,8 +62,9 @@ class Dispatcher ...@@ -62,8 +62,9 @@ class Dispatcher
shortcut_handler = new ShortcutsNavigation() shortcut_handler = new ShortcutsNavigation()
when 'projects:commits:show' when 'projects:commits:show'
shortcut_handler = new ShortcutsNavigation() shortcut_handler = new ShortcutsNavigation()
when 'projects:show' when 'projects:activity'
new Activities() new Activities()
when 'projects:show'
shortcut_handler = new ShortcutsNavigation() shortcut_handler = new ShortcutsNavigation()
when 'groups:show' when 'groups:show'
new Activities() new Activities()
......
...@@ -6,7 +6,7 @@ class ProjectsController < ApplicationController ...@@ -6,7 +6,7 @@ class ProjectsController < ApplicationController
# Authorize # Authorize
before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive] before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive]
before_action :event_filter, only: :show before_action :event_filter, only: [:show, :activity]
layout :determine_layout layout :determine_layout
...@@ -59,6 +59,16 @@ class ProjectsController < ApplicationController ...@@ -59,6 +59,16 @@ class ProjectsController < ApplicationController
end end
end end
def activity
respond_to do |format|
format.html
format.json do
load_events
pager_json('events/_events', @events.count)
end
end
end
def show def show
if @project.import_in_progress? if @project.import_in_progress?
redirect_to namespace_project_import_path(@project.namespace, @project) redirect_to namespace_project_import_path(@project.namespace, @project)
...@@ -81,11 +91,6 @@ class ProjectsController < ApplicationController ...@@ -81,11 +91,6 @@ class ProjectsController < ApplicationController
end end
end end
format.json do
load_events
pager_json('events/_events', @events.count)
end
format.atom do format.atom do
load_events load_events
render layout: false render layout: false
......
...@@ -17,6 +17,10 @@ module GitlabRoutingHelper ...@@ -17,6 +17,10 @@ module GitlabRoutingHelper
namespace_project_path(project.namespace, project, *args) namespace_project_path(project.namespace, project, *args)
end end
def activity_project_path(project, *args)
activity_namespace_project_path(project.namespace, project, *args)
end
def edit_project_path(project, *args) def edit_project_path(project, *args)
edit_namespace_project_path(project.namespace, project, *args) edit_namespace_project_path(project.namespace, project, *args)
end end
......
...@@ -85,7 +85,7 @@ module ProjectsHelper ...@@ -85,7 +85,7 @@ module ProjectsHelper
end end
def link_to_toggle_star(title, starred) def link_to_toggle_star(title, starred)
cls = 'star-btn btn btn-sm btn-default' cls = 'star-btn btn'
toggle_text = toggle_text =
if starred if starred
......
%ul.nav.nav-sidebar %ul.nav.nav-sidebar
= nav_link(path: 'projects#show', html_options: {class: 'home'}) do = nav_link(path: 'projects#show', html_options: {class: 'home'}) do
= link_to project_path(@project), title: 'Project', class: 'shortcuts-project', data: {placement: 'right'} do = link_to project_path(@project), title: 'Project', class: 'shortcuts-project', data: {placement: 'right'} do
= icon('dashboard fw') = icon('home fw')
%span %span
Project Project
= nav_link(path: 'projects#activity', html_options: {class: 'activity'}) do
= link_to activity_project_path(@project), title: 'Project', data: {placement: 'right'} do
= icon('dashboard fw')
%span
Activity
- if project_nav_tab? :files - if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree)) do = nav_link(controller: %w(tree blob blame edit_tree new_tree)) do
= link_to namespace_project_tree_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Files', class: 'shortcuts-tree', data: {placement: 'right'} do = link_to namespace_project_tree_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Files', class: 'shortcuts-tree', data: {placement: 'right'} do
......
.clearfix
- unless @project.empty_repo?
.panel.panel-default
.panel-heading
= visibility_level_icon(@project.visibility_level)
= "#{visibility_level_label(@project.visibility_level).capitalize} project"
.panel-body
- if @repository.changelog || @repository.license || @repository.contribution_guide
%ul.nav.nav-pills
- if @repository.changelog
%li.hidden-xs
= link_to changelog_url(@project) do
Changelog
- if @repository.license
%li
= link_to license_url(@project) do
License
- if @repository.contribution_guide
%li
= link_to contribution_guide_url(@project) do
Contribution guide
.actions
- if can? current_user, :create_issue, @project
= link_to url_for_new_issue(@project, only_path: true), title: "New Issue", class: 'btn btn-sm append-right-10' do
New Issue
- if can? current_user, :create_merge_request, @project
= link_to new_namespace_project_merge_request_path(@project.namespace, @project), class: "btn btn-sm", title: "New Merge Request" do
New Merge Request
- if forked_from_project = @project.forked_from_project
.panel-footer
= icon("code-fork fw")
Forked from
.pull-right
= link_to forked_from_project.namespace.try(:name), project_path(forked_from_project)
- @project.ci_services.each do |ci_service|
- if ci_service.active? && ci_service.respond_to?(:builds_path)
.panel-footer
= icon("check fw")
= ci_service.title
.pull-right
- if ci_service.respond_to?(:status_img_path)
= link_to ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' do
= image_tag ci_service.status_img_path, alt: "build status", class: 'ci-status-image'
- else
= link_to 'view builds', ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink'
- unless @project.empty_repo?
.panel.panel-default
.panel-heading
= icon("folder-o fw")
Repository
.panel-body
%ul.nav.nav-pills
%li
= link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do
= pluralize(number_with_delimiter(@repository.commit_count), 'commit')
%li
= link_to namespace_project_branches_path(@project.namespace, @project) do
= pluralize(number_with_delimiter(@repository.branch_names.count), 'branch')
%li
= link_to namespace_project_tags_path(@project.namespace, @project) do
= pluralize(number_with_delimiter(@repository.tag_names.count), 'tag')
.actions
= link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-sm append-right-10' do
%i.fa.fa-exchange
Compare code
- if can?(current_user, :download_code, @project)
= render 'projects/repositories/download_archive', split_button: true, btn_class: 'btn-group-sm'
- if version = @repository.version
.panel-footer
= icon("clock-o fw")
Version
.pull-right
= link_to version_url(@project) do
= @repository.blob_by_oid(version.id).data
= render "shared/clone_panel"
- if @project.archived?
%br
.alert.alert-warning
%h4
= icon("exclamation-triangle fw")
Archived project!
%p Repository is read-only
- if current_user
- access = user_max_access_in_project(current_user, @project)
- if access
.light-well.light.prepend-top-20
%small
You have #{access} access to this project.
- if @project.project_member_by_id(current_user)
%br
= link_to leave_namespace_project_project_members_path(@project.namespace, @project),
data: { confirm: leave_project_message(@project) }, method: :delete, title: 'Leave project' do
Leave this project
...@@ -23,10 +23,15 @@ ...@@ -23,10 +23,15 @@
- if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
.inline.fork-buttons.prepend-left-10 .inline.fork-buttons.prepend-left-10
- if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2 - if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2
= link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn btn-sm btn-default' do = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn' do
= link_to_toggle_fork = link_to_toggle_fork
- else - else
= link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn btn-sm btn-default' do = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn' do
= link_to_toggle_fork = link_to_toggle_fork
- elsif forked_from_project = @project.forked_from_project
= link_to project_path(forked_from_project), class: 'btn' do
= icon("code-fork fw")
Forked from
= forked_from_project.namespace.try(:name)
= render "shared/clone_panel" = render "shared/clone_panel"
%ul.nav.nav-tabs
%li.active
= link_to '#tab-activity', 'data-toggle' => 'tab' do
= icon("tachometer")
Activity
- if @repository.readme
%li
= link_to '#tab-readme', 'data-toggle' => 'tab' do
= icon("file-text-o")
Readme
.tab-content
.tab-pane.active#tab-activity
.hidden-xs
= render "events/event_last_push", event: @last_push
- if current_user
%ul.nav.nav-pills.event_filter.pull-right
%li
= link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do
%i.fa.fa-rss
= render 'shared/event_filter'
%hr
.content_list
= spinner
- if readme = @repository.readme
.tab-pane#tab-readme
%article.readme-holder#README
.clearfix
%small.pull-right
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do
%i.fa.fa-file
= readme.name
.wiki
= render_readme(readme)
.hidden-xs
= render "events/event_last_push", event: @last_push
- if current_user
%ul.nav.nav-pills.event_filter.pull-right
%li
= link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do
%i.fa.fa-rss
= render 'shared/event_filter'
%hr
.content_list
= spinner
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
= render 'shared/no_password' = render 'shared/no_password'
= render "home_panel" = render "home_panel"
.project-stats .project-stats
%ul.nav.nav-pills %ul.nav.nav-pills
%li %li
...@@ -31,6 +32,12 @@ ...@@ -31,6 +32,12 @@
= link_to contribution_guide_url(@project) do = link_to contribution_guide_url(@project) do
Contribution guide Contribution guide
- if @project.archived?
.text-warning.center.prepend-top-20
%p
= icon("exclamation-triangle fw")
Archived project! Repository is read-only
%hr %hr
%section %section
- if readme = @repository.readme - if readme = @repository.readme
...@@ -43,4 +50,19 @@ ...@@ -43,4 +50,19 @@
.wiki .wiki
= render_readme(readme) = render_readme(readme)
- else - else
%h4 Add README to this repository %h4
Please
= link_to "add README", namespace_project_new_blob_path(@project.namespace, @project, tree_join(@repository.root_ref), file_name: 'README.md')
file to this repository
- if current_user
- access = user_max_access_in_project(current_user, @project)
- if access
%hr
%p.light
You have #{access} access to this project.
- if @project.project_member_by_id(current_user)
= link_to leave_namespace_project_project_members_path(@project.namespace, @project),
data: { confirm: leave_project_message(@project) }, method: :delete, title: 'Leave project', class: 'cred' do
Leave this project
...@@ -314,6 +314,7 @@ Gitlab::Application.routes.draw do ...@@ -314,6 +314,7 @@ Gitlab::Application.routes.draw do
post :toggle_star post :toggle_star
post :markdown_preview post :markdown_preview
get :autocomplete_sources get :autocomplete_sources
get :activity
end end
scope module: :projects do scope module: :projects do
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150620233230) do ActiveRecord::Schema.define(version: 20150625153454) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -28,11 +28,11 @@ ActiveRecord::Schema.define(version: 20150620233230) do ...@@ -28,11 +28,11 @@ ActiveRecord::Schema.define(version: 20150620233230) do
t.integer "default_branch_protection", default: 2 t.integer "default_branch_protection", default: 2
t.boolean "twitter_sharing_enabled", default: true t.boolean "twitter_sharing_enabled", default: true
t.text "restricted_visibility_levels" t.text "restricted_visibility_levels"
t.boolean "version_check_enabled", default: true
t.integer "max_attachment_size", default: 10, null: false t.integer "max_attachment_size", default: 10, null: false
t.integer "default_project_visibility" t.integer "default_project_visibility"
t.integer "default_snippet_visibility" t.integer "default_snippet_visibility"
t.text "restricted_signup_domains" t.text "restricted_signup_domains"
t.boolean "version_check_enabled", default: true
t.boolean "user_oauth_applications", default: true t.boolean "user_oauth_applications", default: true
t.string "after_sign_out_path" t.string "after_sign_out_path"
t.integer "session_expire_delay", default: 10080, null: false t.integer "session_expire_delay", default: 10080, null: false
...@@ -344,6 +344,14 @@ ActiveRecord::Schema.define(version: 20150620233230) do ...@@ -344,6 +344,14 @@ ActiveRecord::Schema.define(version: 20150620233230) do
add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree
add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
create_table "participants", force: true do |t|
t.integer "target_id", null: false
t.string "target_type", null: false
t.integer "user_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "project_import_data", force: true do |t| create_table "project_import_data", force: true do |t|
t.integer "project_id" t.integer "project_id"
t.text "data" t.text "data"
...@@ -510,12 +518,12 @@ ActiveRecord::Schema.define(version: 20150620233230) do ...@@ -510,12 +518,12 @@ ActiveRecord::Schema.define(version: 20150620233230) do
t.string "bitbucket_access_token" t.string "bitbucket_access_token"
t.string "bitbucket_access_token_secret" t.string "bitbucket_access_token_secret"
t.string "location" t.string "location"
t.string "public_email", default: "", null: false
t.string "encrypted_otp_secret" t.string "encrypted_otp_secret"
t.string "encrypted_otp_secret_iv" t.string "encrypted_otp_secret_iv"
t.string "encrypted_otp_secret_salt" t.string "encrypted_otp_secret_salt"
t.boolean "otp_required_for_login", default: false, null: false t.boolean "otp_required_for_login", default: false, null: false
t.text "otp_backup_codes" t.text "otp_backup_codes"
t.string "public_email", default: "", null: false
t.integer "dashboard", default: 0 t.integer "dashboard", default: 0
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