mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-20 14:11:11 +00:00
Move project activity to separate tab. Add more features to project home page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
@ -62,8 +62,9 @@ class Dispatcher
|
||||
shortcut_handler = new ShortcutsNavigation()
|
||||
when 'projects:commits:show'
|
||||
shortcut_handler = new ShortcutsNavigation()
|
||||
when 'projects:show'
|
||||
when 'projects:activity'
|
||||
new Activities()
|
||||
when 'projects:show'
|
||||
shortcut_handler = new ShortcutsNavigation()
|
||||
when 'groups:show'
|
||||
new Activities()
|
||||
|
@ -6,7 +6,7 @@ class ProjectsController < ApplicationController
|
||||
|
||||
# Authorize
|
||||
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
|
||||
|
||||
@ -59,6 +59,16 @@ class ProjectsController < ApplicationController
|
||||
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
|
||||
if @project.import_in_progress?
|
||||
redirect_to namespace_project_import_path(@project.namespace, @project)
|
||||
@ -81,11 +91,6 @@ class ProjectsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
format.json do
|
||||
load_events
|
||||
pager_json('events/_events', @events.count)
|
||||
end
|
||||
|
||||
format.atom do
|
||||
load_events
|
||||
render layout: false
|
||||
@ -151,7 +156,7 @@ class ProjectsController < ApplicationController
|
||||
end
|
||||
|
||||
def markdown_preview
|
||||
text = params[:text]
|
||||
text = params[:text]
|
||||
|
||||
ext = Gitlab::ReferenceExtractor.new(@project, current_user)
|
||||
ext.analyze(text)
|
||||
|
@ -17,6 +17,10 @@ module GitlabRoutingHelper
|
||||
namespace_project_path(project.namespace, project, *args)
|
||||
end
|
||||
|
||||
def activity_project_path(project, *args)
|
||||
activity_namespace_project_path(project.namespace, project, *args)
|
||||
end
|
||||
|
||||
def edit_project_path(project, *args)
|
||||
edit_namespace_project_path(project.namespace, project, *args)
|
||||
end
|
||||
|
@ -85,7 +85,7 @@ module ProjectsHelper
|
||||
end
|
||||
|
||||
def link_to_toggle_star(title, starred)
|
||||
cls = 'star-btn btn btn-sm btn-default'
|
||||
cls = 'star-btn btn'
|
||||
|
||||
toggle_text =
|
||||
if starred
|
||||
|
@ -1,9 +1,14 @@
|
||||
%ul.nav.nav-sidebar
|
||||
= nav_link(path: 'projects#show', html_options: {class: 'home'}) do
|
||||
= link_to project_path(@project), title: 'Project', class: 'shortcuts-project', data: {placement: 'right'} do
|
||||
= icon('dashboard fw')
|
||||
= icon('home fw')
|
||||
%span
|
||||
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
|
||||
= 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
|
||||
|
@ -1,106 +0,0 @@
|
||||
.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 @@
|
||||
- if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
|
||||
.inline.fork-buttons.prepend-left-10
|
||||
- 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
|
||||
- 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
|
||||
- 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"
|
||||
|
@ -1,36 +0,0 @@
|
||||
%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)
|
13
app/views/projects/activity.html.haml
Normal file
13
app/views/projects/activity.html.haml
Normal file
@ -0,0 +1,13 @@
|
||||
.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 @@
|
||||
= render 'shared/no_password'
|
||||
|
||||
= render "home_panel"
|
||||
|
||||
.project-stats
|
||||
%ul.nav.nav-pills
|
||||
%li
|
||||
@ -31,6 +32,12 @@
|
||||
= link_to contribution_guide_url(@project) do
|
||||
Contribution guide
|
||||
|
||||
- if @project.archived?
|
||||
.text-warning.center.prepend-top-20
|
||||
%p
|
||||
= icon("exclamation-triangle fw")
|
||||
Archived project! Repository is read-only
|
||||
|
||||
%hr
|
||||
%section
|
||||
- if readme = @repository.readme
|
||||
@ -43,4 +50,19 @@
|
||||
.wiki
|
||||
= render_readme(readme)
|
||||
- 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
|
||||
post :toggle_star
|
||||
post :markdown_preview
|
||||
get :autocomplete_sources
|
||||
get :activity
|
||||
end
|
||||
|
||||
scope module: :projects do
|
||||
|
14
db/schema.rb
14
db/schema.rb
@ -11,7 +11,7 @@
|
||||
#
|
||||
# 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
|
||||
enable_extension "plpgsql"
|
||||
@ -28,11 +28,11 @@ ActiveRecord::Schema.define(version: 20150620233230) do
|
||||
t.integer "default_branch_protection", default: 2
|
||||
t.boolean "twitter_sharing_enabled", default: true
|
||||
t.text "restricted_visibility_levels"
|
||||
t.boolean "version_check_enabled", default: true
|
||||
t.integer "max_attachment_size", default: 10, null: false
|
||||
t.integer "default_project_visibility"
|
||||
t.integer "default_snippet_visibility"
|
||||
t.text "restricted_signup_domains"
|
||||
t.boolean "version_check_enabled", default: true
|
||||
t.boolean "user_oauth_applications", default: true
|
||||
t.string "after_sign_out_path"
|
||||
t.integer "session_expire_delay", default: 10080, null: false
|
||||
@ -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", ["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|
|
||||
t.integer "project_id"
|
||||
t.text "data"
|
||||
@ -510,12 +518,12 @@ ActiveRecord::Schema.define(version: 20150620233230) do
|
||||
t.string "bitbucket_access_token"
|
||||
t.string "bitbucket_access_token_secret"
|
||||
t.string "location"
|
||||
t.string "public_email", default: "", null: false
|
||||
t.string "encrypted_otp_secret"
|
||||
t.string "encrypted_otp_secret_iv"
|
||||
t.string "encrypted_otp_secret_salt"
|
||||
t.boolean "otp_required_for_login", default: false, null: false
|
||||
t.text "otp_backup_codes"
|
||||
t.string "public_email", default: "", null: false
|
||||
t.integer "dashboard", default: 0
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user