diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-07 16:01:12 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-07 16:01:12 +0200 |
commit | d192f921c17561c82943bc803875ba6bf11fd8ce (patch) | |
tree | cd57bd9bf9a0c2e1e0659260e638c543c0fcf13f /app | |
parent | 5e7f7f8d31cce732533e36b7be756b824b748f74 (diff) | |
download | gitlab-ce-d192f921c17561c82943bc803875ba6bf11fd8ce.tar.gz |
Move project activity to separate tab. Add more features to project home page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/dispatcher.js.coffee | 3 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 19 | ||||
-rw-r--r-- | app/helpers/gitlab_routing_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 2 | ||||
-rw-r--r-- | app/views/layouts/nav/_project.html.haml | 7 | ||||
-rw-r--r-- | app/views/projects/_aside.html.haml | 106 | ||||
-rw-r--r-- | app/views/projects/_home_panel.html.haml | 9 | ||||
-rw-r--r-- | app/views/projects/_section.html.haml | 36 | ||||
-rw-r--r-- | app/views/projects/activity.html.haml | 13 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 24 |
10 files changed, 68 insertions, 155 deletions
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index a8ec0abc264..aa6b50ca0f9 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 be5968cd7b0..6db65cf47ef 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 9d072f81092..d0fae255a04 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 ec65e473919..ae65985ce75 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 6de97302dc1..cbd5de4cba2 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 72aea8814f5..00000000000 --- 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 e22758f8a45..d100a1586e4 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 d7b06197f67..00000000000 --- 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 00000000000..25bd93cae87 --- /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 d7b1704f036..ceaf6c8cab3 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 |