diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index a8ec0abc2643e26e457ca3784870fda83fdafd06..aa6b50ca0f90e9cfd0eb22ceb45b0c90392005ec 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -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() diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index be5968cd7b00178b461928a93b7c324e1b4085d6..6db65cf47ef11889a4ff414ff56b7bb9bf0b550b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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) diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb index 9d072f81092f9480f905131f9f05541740a81a81..d0fae255a043d0fff3b316d025d59860803bb635 100644 --- a/app/helpers/gitlab_routing_helper.rb +++ b/app/helpers/gitlab_routing_helper.rb @@ -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 diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ec65e473919a29659bf7cb50051cb5b328da2833..ae65985ce75fcb9a59da9d2b1b15b6b4194f874e 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -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 diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 6de97302dc1c8749951fc8efe2baff90650aefe7..cbd5de4cba205965eb1be42fa2da833cb32b1b29 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -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 diff --git a/app/views/projects/_aside.html.haml b/app/views/projects/_aside.html.haml deleted file mode 100644 index 72aea8814f57255deb31c7e0e35c8c2d31bc40de..0000000000000000000000000000000000000000 --- a/app/views/projects/_aside.html.haml +++ /dev/null @@ -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 diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index e22758f8a4572407d6706985707554af933fe696..d100a1586e4670e9cf2681ed8cf3885f6936b52b 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -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" diff --git a/app/views/projects/_section.html.haml b/app/views/projects/_section.html.haml deleted file mode 100644 index d7b06197f6737e6ef6a5494f95e2326205ef876c..0000000000000000000000000000000000000000 --- a/app/views/projects/_section.html.haml +++ /dev/null @@ -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) diff --git a/app/views/projects/activity.html.haml b/app/views/projects/activity.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..25bd93cae87135c96666d5804e40a1988f816cef --- /dev/null +++ b/app/views/projects/activity.html.haml @@ -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 diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index d7b1704f0361f81bc1b5d941f87f7f949c8824db..ceaf6c8cab3d60c9bb9a0b09f59eee7ef685671c 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 8617839a2565c898cbd30c1981d5e2ac4ddd0c77..fd04d7b2f54b2b27175e423f98210a51a526d52d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 8736d1e0df5257558edae71fd42b83be39371c5d..05d024c8c884186ddc5590000d83328f13f62625 100644 --- a/db/schema.rb +++ b/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