From 5e7f7f8d31cce732533e36b7be756b824b748f74 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Jul 2015 15:22:56 +0200 Subject: Redesign project home page Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/pages/projects.scss | 72 +++++++++++++----------------- app/views/projects/_home_panel.html.haml | 63 ++++++++++++-------------- app/views/projects/empty.html.haml | 26 +++++------ app/views/projects/show.html.haml | 42 ++++++++++++++--- app/views/shared/_clone_panel.html.haml | 2 +- 5 files changed, 110 insertions(+), 95 deletions(-) diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index e19b2eafa43..b363b4206ed 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -15,48 +15,31 @@ } .project-home-panel { - margin-top: 10px; - margin-bottom: 15px; - position: relative; - padding-left: 65px; - min-height: 50px; + text-align: center; + margin-bottom: 20px; .project-identicon-holder { - position: absolute; - left: 0; - top: -14px; + margin-bottom: 15px; - .avatar { - width: 50px; - height: 50px; + .avatar, .identicon { + margin: 0 auto; + float: none; } .identicon { - font-size: 26px; - line-height: 50px; + @include border-radius(50%); } } - .project-home-row { - @extend .clearfix; - margin-bottom: 15px; - - &.project-home-row-top { - margin-bottom: 15px; + .lead { + p { + display: inline; } + } - .project-home-desc { - color: $gray; - float: left; - font-size: 16px; - line-height: 1.3; - margin-right: 250px; - - // Render Markdown-generated HTML inline for this block - p { - display: inline; - } - } + .git-clone-holder { + max-width: 600px; + margin: 0 auto; } .visibility-level-label { @@ -67,22 +50,19 @@ } .project-repo-buttons { - margin-top: -3px; - position: absolute; - right: 0; - width: 265px; - text-align: right; - + margin-top: 25px; + margin-bottom: 25px; .btn { + @extend .btn-info; font-weight: bold; font-size: 14px; line-height: 16px; + padding: 8px 12px; .count { - padding-left: 10px; - border-left: 1px solid #ccc; + padding-left: 7px; display: inline-block; - margin-left: 10px; + margin-left: 7px; } } } @@ -307,3 +287,15 @@ table.table.protected-branches-list tr.no-border { float: left; margin-right: 10px; } + +.project-stats { + text-align: center; + + ul.nav-pills { display:inline-block; } + li { display:inline; } + a { float:left; } +} + +pre.light-well { + border-color: #f1f1f1; +} diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 076afb11a9d..e22758f8a45 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -1,37 +1,32 @@ - empty_repo = @project.empty_repo? .project-home-panel.clearfix{:class => ("empty-project" if empty_repo)} .project-identicon-holder - = project_icon(@project, alt: '', class: 'avatar project-avatar') - .project-home-row.project-home-row-top - .project-home-desc - - if @project.description.present? - = markdown(@project.description, pipeline: :description) - - if can?(current_user, :admin_project, @project) - – - = link_to 'Edit', edit_namespace_project_path - - elsif !empty_repo && @repository.readme - - readme = @repository.readme - – - = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)) do - = readme.name - .project-repo-buttons - .inline.star.js-toggler-container{class: @show_star ? 'on' : ''} - - if current_user - = link_to_toggle_star('Star this project.', false) - = link_to_toggle_star('Unstar this project.', true) - - else - = link_to new_user_session_path, class: 'btn star-btn has_tooltip', title: 'You must sign in to star a project' do - %span - = icon('star') - Star - %span.count - = @project.star_count - - unless empty_repo - - 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_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_toggle_fork + = project_icon(@project, alt: '', class: 'project-avatar avatar s90') + .lead + - if @project.description.present? + = markdown(@project.description, pipeline: :description) + + + .project-repo-buttons + .inline.star.js-toggler-container{class: @show_star ? 'on' : ''} + - if current_user + = link_to_toggle_star('Star this project.', false) + = link_to_toggle_star('Unstar this project.', true) + - else + = link_to new_user_session_path, class: 'btn star-btn has_tooltip', title: 'You must sign in to star a project' do + %span + = icon('star') + Star + %span.count + = @project.star_count + - unless empty_repo + - 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_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_toggle_fork + + = render "shared/clone_panel" diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml index 8080a904978..f103fba404e 100644 --- a/app/views/projects/empty.html.haml +++ b/app/views/projects/empty.html.haml @@ -4,30 +4,28 @@ = render "home_panel" -.center.well - %h3 +.center.light-well + %h3.page-title The repository for this project is empty - %h4 + %p You can - = link_to namespace_project_new_blob_path(@project.namespace, @project, 'master'), class: 'btn btn-new btn-lg' do + = link_to namespace_project_new_blob_path(@project.namespace, @project, 'master'), class: 'btn btn-new' do add a file  or do a push via the command line. -.well - = render "shared/clone_panel" -%h4 - %strong Command line instructions +%h3.page-title + Command line instructions %div.git-empty %fieldset - %legend Git global setup - %pre.dark + %h5 Git global setup + %pre.light-well :preserve git config --global user.name "#{git_user_name}" git config --global user.email "#{git_user_email}" %fieldset - %legend Create a new repository - %pre.dark + %h5 Create a new repository + %pre.light-well :preserve git clone #{ content_tag(:span, default_url_to_repo, class: 'clone')} cd #{@project.path} @@ -37,8 +35,8 @@ git push -u origin master %fieldset - %legend Existing folder or Git repository - %pre.dark + %h5 Existing folder or Git repository + %pre.light-well :preserve cd existing_folder git init diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 2259dea0865..d7b1704f036 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -7,10 +7,40 @@ = render 'shared/no_password' = render "home_panel" -= render 'shared/show_aside' +.project-stats + %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') + - if @repository.changelog + %li + = 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 -.row - %section.col-md-8 - = render 'section' - %aside.col-md-4.project-side - = render 'aside' +%hr +%section + - if readme = @repository.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) + - else + %h4 Add README to this repository diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml index 6de2aed29ed..07672359dba 100644 --- a/app/views/shared/_clone_panel.html.haml +++ b/app/views/shared/_clone_panel.html.haml @@ -20,7 +20,7 @@ :"data-container" => "body"} = gitlab_config.protocol.upcase = text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control input-sm", readonly: true - - if project.kind_of?(Project) && project.empty_repo? + - if project.kind_of?(Project) .input-group-addon .visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(project.visibility_level)} project" } = visibility_level_icon(project.visibility_level) -- cgit v1.2.1 From d192f921c17561c82943bc803875ba6bf11fd8ce Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Jul 2015 16:01:12 +0200 Subject: Move project activity to separate tab. Add more features to project home page Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/dispatcher.js.coffee | 3 +- app/controllers/projects_controller.rb | 19 +++-- app/helpers/gitlab_routing_helper.rb | 4 ++ app/helpers/projects_helper.rb | 2 +- app/views/layouts/nav/_project.html.haml | 7 +- app/views/projects/_aside.html.haml | 106 ---------------------------- app/views/projects/_home_panel.html.haml | 9 ++- app/views/projects/_section.html.haml | 36 ---------- app/views/projects/activity.html.haml | 13 ++++ app/views/projects/show.html.haml | 24 ++++++- config/routes.rb | 1 + db/schema.rb | 14 +++- 12 files changed, 80 insertions(+), 158 deletions(-) delete mode 100644 app/views/projects/_aside.html.haml delete mode 100644 app/views/projects/_section.html.haml create mode 100644 app/views/projects/activity.html.haml 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 diff --git a/config/routes.rb b/config/routes.rb index 8617839a256..fd04d7b2f54 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 8736d1e0df5..05d024c8c88 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 -- cgit v1.2.1 From bc3cd44ba71c2843330428ea41b221b6905378ab Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Jul 2015 16:53:25 +0200 Subject: Add download button to project page Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/_home_panel.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index d100a1586e4..7e2860128f8 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -33,5 +33,9 @@ = icon("code-fork fw") Forked from = forked_from_project.namespace.try(:name) + - if can? current_user, :download_code, @project + .inline.prepend-left-10 + = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do + %i.fa.fa-download = render "shared/clone_panel" -- cgit v1.2.1 From 5be6cbac6fd50f6e97c483f78de667ce5628a3ce Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Jul 2015 16:54:52 +0200 Subject: Add spacing around buttons on project page Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/_home_panel.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 7e2860128f8..6335d76ab81 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -29,10 +29,11 @@ = 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) + .inline.prepend-left-10 + = link_to project_path(forked_from_project), class: 'btn' do + = icon("code-fork fw") + Forked from + = forked_from_project.namespace.try(:name) - if can? current_user, :download_code, @project .inline.prepend-left-10 = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do -- cgit v1.2.1 From c2f02fc1a4b88e1c01cb3562168322d0c5debba3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 12:25:34 +0200 Subject: Refactor star and fork buttons Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/project_show.js.coffee | 5 --- app/assets/stylesheets/pages/projects.scss | 3 ++ app/controllers/projects_controller.rb | 7 ++-- app/helpers/projects_helper.rb | 47 --------------------------- app/views/projects/_home_panel.html.haml | 40 +++++++---------------- app/views/projects/buttons/_fork.html.haml | 13 ++++++++ app/views/projects/buttons/_star.html.haml | 22 +++++++++++++ 7 files changed, 54 insertions(+), 83 deletions(-) create mode 100644 app/views/projects/buttons/_fork.html.haml create mode 100644 app/views/projects/buttons/_star.html.haml diff --git a/app/assets/javascripts/project_show.js.coffee b/app/assets/javascripts/project_show.js.coffee index 6828ae471e5..cb47062842e 100644 --- a/app/assets/javascripts/project_show.js.coffee +++ b/app/assets/javascripts/project_show.js.coffee @@ -1,10 +1,5 @@ class @ProjectShow constructor: -> - $('.project-home-panel .star').on 'ajax:success', (e, data, status, xhr) -> - $(@).toggleClass('on').find('.count').html(data.star_count) - .on 'ajax:error', (e, xhr, status, error) -> - new Flash('Star toggle failed. Try again later.', 'alert') - $("a[data-toggle='tab']").on "shown.bs.tab", (e) -> $.cookie "default_view", $(e.target).attr("href"), { expires: 30, path: '/' } diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index b363b4206ed..5f415f2d78f 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -52,8 +52,11 @@ .project-repo-buttons { margin-top: 25px; margin-bottom: 25px; + .btn { @extend .btn-info; + + margin-left: 10px; font-weight: bold; font-size: 14px; line-height: 16px; diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6db65cf47ef..be85521ffa5 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -75,8 +75,6 @@ class ProjectsController < ApplicationController return end - @show_star = !(current_user && current_user.starred?(@project)) - respond_to do |format| format.html do if @project.repository_exists? @@ -152,7 +150,10 @@ class ProjectsController < ApplicationController def toggle_star current_user.toggle_star(@project) @project.reload - render json: { star_count: @project.star_count } + + render json: { + html: view_to_html_string("projects/buttons/_star") + } end def markdown_preview diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ae65985ce75..74c8d4dad06 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -84,53 +84,6 @@ module ProjectsHelper @project.milestones.active.order("due_date, title ASC") end - def link_to_toggle_star(title, starred) - cls = 'star-btn btn' - - toggle_text = - if starred - ' Unstar' - else - ' Star' - end - - toggle_html = content_tag('span', class: 'toggle') do - icon('star') + toggle_text - end - - count_html = content_tag('span', class: 'count') do - @project.star_count.to_s - end - - link_opts = { - title: title, - class: cls, - method: :post, - remote: true, - data: { type: 'json' } - } - - path = toggle_star_namespace_project_path(@project.namespace, @project) - - content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do - link_to(path, link_opts) do - toggle_html + ' ' + count_html - end - end - end - - def link_to_toggle_fork - html = content_tag('span') do - icon('code-fork') + ' Fork' - end - - count_html = content_tag(:span, class: 'count') do - @project.forks_count.to_s - end - - html + count_html - end - def project_for_deploy_key(deploy_key) if deploy_key.projects.include?(@project) @project diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 6335d76ab81..2c32d9ccafe 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -8,35 +8,19 @@ .project-repo-buttons - .inline.star.js-toggler-container{class: @show_star ? 'on' : ''} - - if current_user - = link_to_toggle_star('Star this project.', false) - = link_to_toggle_star('Unstar this project.', true) - - else - = link_to new_user_session_path, class: 'btn star-btn has_tooltip', title: 'You must sign in to star a project' do - %span - = icon('star') - Star - %span.count - = @project.star_count + = render 'projects/buttons/star' + - unless empty_repo - - 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' do - = link_to_toggle_fork - - else - = 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 - .inline.prepend-left-10 - = link_to project_path(forked_from_project), class: 'btn' do - = icon("code-fork fw") - Forked from - = forked_from_project.namespace.try(:name) + = render 'projects/buttons/fork' + + - if 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) + - if can? current_user, :download_code, @project - .inline.prepend-left-10 - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do - %i.fa.fa-download + = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do + %i.fa.fa-download = render "shared/clone_panel" diff --git a/app/views/projects/buttons/_fork.html.haml b/app/views/projects/buttons/_fork.html.haml new file mode 100644 index 00000000000..f0483c79edc --- /dev/null +++ b/app/views/projects/buttons/_fork.html.haml @@ -0,0 +1,13 @@ +- if current_user && can?(current_user, :fork_project, @project) + - 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' do + = icon('code-fork') + Fork + %span.count + = @project.forks_count + - else + = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn' do + = icon('code-fork') + Fork + %span.count + = @project.forks_count diff --git a/app/views/projects/buttons/_star.html.haml b/app/views/projects/buttons/_star.html.haml new file mode 100644 index 00000000000..89e3f4ac738 --- /dev/null +++ b/app/views/projects/buttons/_star.html.haml @@ -0,0 +1,22 @@ +- if current_user + = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn toggle-star', method: :post, remote: true do + - if current_user.starred?(@project) + Unstar + - else + Star + %span.count + = @project.star_count +- else + = link_to new_user_session_path, class: 'btn has_tooltip', title: 'You must sign in to star a project' do + = icon('star') + Star + %span.count + = @project.star_count + +:coffeescript + $('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) -> + $(@).replaceWith(data.html) + .on 'ajax:error', (e, xhr, status, error) -> + new Flash('Star toggle failed. Try again later.', 'alert') + + -- cgit v1.2.1 From 8404ab46b91103033a78fdd183e9873f85799b6f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 12:43:46 +0200 Subject: Add shortcut for project activity page Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/dispatcher.js.coffee | 1 + app/assets/javascripts/shortcuts_navigation.coffee | 1 + app/views/help/_shortcuts.html.haml | 6 ++++++ app/views/layouts/nav/_project.html.haml | 4 ++-- features/project/shortcuts.feature | 8 +++++++- features/steps/project/project_shortcuts.rb | 5 +++++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index aa6b50ca0f9..8ceaef81a07 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -64,6 +64,7 @@ class Dispatcher shortcut_handler = new ShortcutsNavigation() when 'projects:activity' new Activities() + shortcut_handler = new ShortcutsNavigation() when 'projects:show' shortcut_handler = new ShortcutsNavigation() when 'groups:show' diff --git a/app/assets/javascripts/shortcuts_navigation.coffee b/app/assets/javascripts/shortcuts_navigation.coffee index 31895fbf2bc..5b6f9e7e3f2 100644 --- a/app/assets/javascripts/shortcuts_navigation.coffee +++ b/app/assets/javascripts/shortcuts_navigation.coffee @@ -4,6 +4,7 @@ class @ShortcutsNavigation extends Shortcuts constructor: -> super() Mousetrap.bind('g p', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-project')) + Mousetrap.bind('g e', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-project-activity')) Mousetrap.bind('g f', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-tree')) Mousetrap.bind('g c', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-commits')) Mousetrap.bind('g n', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-network')) diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml index 825acb0ae3e..e809d99ba71 100644 --- a/app/views/help/_shortcuts.html.haml +++ b/app/views/help/_shortcuts.html.haml @@ -79,6 +79,12 @@ %td.shortcut .key g .key p + %td + Go to the project's home page + %tr + %td.shortcut + .key g + .key e %td Go to the project's activity feed %tr diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index cbd5de4cba2..2012478eba9 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -4,8 +4,8 @@ = 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 + = nav_link(path: 'projects#activity') do + = link_to activity_project_path(@project), title: 'Project Activity', class: 'shortcuts-project-activity', data: {placement: 'right'} do = icon('dashboard fw') %span Activity diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature index cfb68bf1f50..9567b571120 100644 --- a/features/project/shortcuts.feature +++ b/features/project/shortcuts.feature @@ -46,7 +46,13 @@ Feature: Project Shortcuts Then the active main tab should be Wiki @javascript - Scenario: Navigate to project feed + Scenario: Navigate to project home Given I visit my project's files page Given I press "g" and "p" Then the active main tab should be Home + + @javascript + Scenario: Navigate to project feed + Given I visit my project's files page + Given I press "g" and "e" + Then the active main tab should be Activity diff --git a/features/steps/project/project_shortcuts.rb b/features/steps/project/project_shortcuts.rb index a10e7bf78ee..49e9c5520bb 100644 --- a/features/steps/project/project_shortcuts.rb +++ b/features/steps/project/project_shortcuts.rb @@ -33,4 +33,9 @@ class Spinach::Features::ProjectShortcuts < Spinach::FeatureSteps find('body').native.send_key('g') find('body').native.send_key('w') end + + step 'I press "g" and "e"' do + find('body').native.send_key('g') + find('body').native.send_key('e') + end end -- cgit v1.2.1 From 77fb7e078e49685fa649abc8ebe24376203c2c2c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 12:49:06 +0200 Subject: Fix db schema Signed-off-by: Dmitriy Zaporozhets --- db/schema.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 05d024c8c88..fb0982b10fd 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: 20150625153454) do +ActiveRecord::Schema.define(version: 20150620233230) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -344,14 +344,6 @@ ActiveRecord::Schema.define(version: 20150625153454) 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" -- cgit v1.2.1 From 17156cf909fff49ea068b2dc00fd607af20967f8 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 13:34:05 +0200 Subject: Imrpove mobile view for project page Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/mobile.scss | 24 +++++++++++------------- app/views/projects/_home_panel.html.haml | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/generic/mobile.scss b/app/assets/stylesheets/generic/mobile.scss index a49775daf8b..24c828e0d97 100644 --- a/app/assets/stylesheets/generic/mobile.scss +++ b/app/assets/stylesheets/generic/mobile.scss @@ -44,20 +44,18 @@ .project-home-panel { padding-left: 0 !important; - .project-home-row { - .project-home-desc { - margin-right: 0 !important; - float: none !important; - } - - .project-repo-buttons { - position: static; - margin-top: 15px; - width: 100%; - float: none; - text-align: left; - } + .project-avatar { + display: block; } + + .project-repo-buttons, + .git-clone-holder { + display: none; + } + } + + .project-stats { + display: none; } .container .title { diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 2c32d9ccafe..95c84c96c41 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -2,7 +2,7 @@ .project-home-panel.clearfix{:class => ("empty-project" if empty_repo)} .project-identicon-holder = project_icon(@project, alt: '', class: 'project-avatar avatar s90') - .lead + .project-home-desc.lead - if @project.description.present? = markdown(@project.description, pipeline: :description) -- cgit v1.2.1 From bd08ac55c7b8eb1b41862937aa4f7cc7a53e4bfe Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 13:41:03 +0200 Subject: Recommend user to create README file for both empty and existing project Signed-off-by: Dmitriy Zaporozhets --- app/helpers/projects_helper.rb | 7 +++++++ app/views/projects/empty.html.haml | 10 ++++++---- app/views/projects/show.html.haml | 17 +++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 74c8d4dad06..1bcd9a49527 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -259,4 +259,11 @@ module ProjectsHelper def leave_project_message(project) "Are you sure you want to leave \"#{project.name}\" project?" end + + def new_readme_path + ref = @repository.root_ref if @repository + ref ||= 'master' + + namespace_project_new_blob_path(@project.namespace, @project, tree_join(ref), file_name: 'README.md') + end end diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml index f103fba404e..dfe45a3802d 100644 --- a/app/views/projects/empty.html.haml +++ b/app/views/projects/empty.html.haml @@ -8,11 +8,13 @@ %h3.page-title The repository for this project is empty %p - You can - = link_to namespace_project_new_blob_path(@project.namespace, @project, 'master'), class: 'btn btn-new' do - add a file -  or do a push via the command line. + If you already have files you can push them using command line instructions below. + %br + Otherwise you can start with + = link_to "adding README", new_readme_path, class: 'underlined-link' + file to this project. +.prepend-top-20 %h3.page-title Command line instructions %div.git-empty diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index ceaf6c8cab3..8fb5f25c2f6 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -50,10 +50,19 @@ .wiki = render_readme(readme) - else - %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 + %h3.page-title + This project does not have README yet :( + - if can?(current_user, :push_code, @project) + %p.slead + A + %code README + file contains information about other files in a repository and is commonly + distributed with computer software, forming part of its documentation. + %br + We recommend you to + = link_to "add README", new_readme_path, class: 'underlined-link' + file to the repository and GitLab will render it here instead of this message. + - if current_user -- cgit v1.2.1 From 39a4bb2abda20fe85a362c1718eab9dfd7de13a3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 16:55:04 +0200 Subject: Cleanup and some test fixes after refactoring project home page Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/project_show.js.coffee | 9 +-------- app/views/projects/buttons/_star.html.haml | 19 +++++++++---------- app/views/projects/show.html.haml | 2 +- features/project/issues/issues.feature | 1 + features/project/shortcuts.feature | 1 - features/steps/project/issues/issues.rb | 5 +++++ features/steps/project/star.rb | 2 +- features/steps/shared/project_tab.rb | 4 ++++ 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/project_show.js.coffee b/app/assets/javascripts/project_show.js.coffee index cb47062842e..1fdf28f2528 100644 --- a/app/assets/javascripts/project_show.js.coffee +++ b/app/assets/javascripts/project_show.js.coffee @@ -1,10 +1,3 @@ class @ProjectShow constructor: -> - $("a[data-toggle='tab']").on "shown.bs.tab", (e) -> - $.cookie "default_view", $(e.target).attr("href"), { expires: 30, path: '/' } - - defaultView = $.cookie("default_view") - if defaultView - $("a[href=" + defaultView + "]").tab "show" - else - $("a[data-toggle='tab']:first").tab "show" + # I kept class for future diff --git a/app/views/projects/buttons/_star.html.haml b/app/views/projects/buttons/_star.html.haml index 89e3f4ac738..664ebd18295 100644 --- a/app/views/projects/buttons/_star.html.haml +++ b/app/views/projects/buttons/_star.html.haml @@ -1,22 +1,21 @@ - if current_user - = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn toggle-star', method: :post, remote: true do + = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star', method: :post, remote: true do - if current_user.starred?(@project) Unstar - else Star %span.count = @project.star_count + + :coffeescript + $('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) -> + $(@).replaceWith(data.html) + .on 'ajax:error', (e, xhr, status, error) -> + new Flash('Star toggle failed. Try again later.', 'alert') + - else - = link_to new_user_session_path, class: 'btn has_tooltip', title: 'You must sign in to star a project' do + = link_to new_user_session_path, class: 'btn has_tooltip star-btn', title: 'You must sign in to star a project' do = icon('star') Star %span.count = @project.star_count - -:coffeescript - $('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) -> - $(@).replaceWith(data.html) - .on 'ajax:error', (e, xhr, status, error) -> - new Flash('Star toggle failed. Try again later.', 'alert') - - diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 8fb5f25c2f6..17907a42e3c 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -51,7 +51,7 @@ = render_readme(readme) - else %h3.page-title - This project does not have README yet :( + This project does not have README yet - if can?(current_user, :push_code, @project) %p.slead A diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index a15298fc452..28cc43ef710 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -189,6 +189,7 @@ Feature: Project Issues Given I logout Given public project "Community" When I visit project "Community" page + And I visit project "Community" issues page And I click link "New Issue" And I should not see assignee field And I should not see milestone field diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature index 9567b571120..2369c02806f 100644 --- a/features/project/shortcuts.feature +++ b/features/project/shortcuts.feature @@ -53,6 +53,5 @@ Feature: Project Shortcuts @javascript Scenario: Navigate to project feed - Given I visit my project's files page Given I press "g" and "e" Then the active main tab should be Activity diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index 9ace6436b15..239392eab96 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -194,6 +194,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end end + When "I visit project \"Community\" issues page" do + project = Project.find_by(name: 'Community') + visit namespace_project_issues_path(project.namespace, project) + end + When "I visit empty project's issues page" do project = Project.find_by(name: 'Empty Project') visit namespace_project_issues_path(project.namespace, project) diff --git a/features/steps/project/star.rb b/features/steps/project/star.rb index 8b50bfcef04..bd2e0619cdd 100644 --- a/features/steps/project/star.rb +++ b/features/steps/project/star.rb @@ -5,7 +5,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps include SharedUser step "The project has no stars" do - expect(page).not_to have_content '.star-buttons' + expect(page).not_to have_content '.toggle-star' end step "The project has 0 stars" do diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb index 3b94b7d8621..c67e5e4a06a 100644 --- a/features/steps/shared/project_tab.rb +++ b/features/steps/shared/project_tab.rb @@ -49,4 +49,8 @@ module SharedProjectTab expect(page).to have_content('Back to project') end end + + step 'the active main tab should be Activity' do + ensure_active_main_tab('Activity') + end end -- cgit v1.2.1 From 0ebe8be02d9d17ea8caa2887466509e060e67075 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 17:36:31 +0200 Subject: Fix schortcut tests Signed-off-by: Dmitriy Zaporozhets --- features/project/shortcuts.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature index 2369c02806f..0f71c32380b 100644 --- a/features/project/shortcuts.feature +++ b/features/project/shortcuts.feature @@ -3,7 +3,7 @@ Feature: Project Shortcuts Background: Given I sign in as a user And I own a project - And I visit my project's home page + And I visit my project's commits page @javascript Scenario: Navigate to files tab @@ -12,6 +12,7 @@ Feature: Project Shortcuts @javascript Scenario: Navigate to commits tab + Given I visit my project's files page Given I press "g" and "c" Then the active main tab should be Commits @@ -47,7 +48,6 @@ Feature: Project Shortcuts @javascript Scenario: Navigate to project home - Given I visit my project's files page Given I press "g" and "p" Then the active main tab should be Home -- cgit v1.2.1 From e05fbf04941f1ec5cb17fccb1462353aba2ea04d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 17:41:59 +0200 Subject: Fix creating file in new repo Signed-off-by: Dmitriy Zaporozhets --- features/steps/project/source/browse_files.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 398c9bf5756..95879b9544d 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -187,7 +187,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I click on "add a file" link' do - click_link 'add a file' + click_link 'adding README' # Remove pre-receive hook so we can push without auth FileUtils.rm_f(File.join(@project.repository.path, 'hooks', 'pre-receive')) -- cgit v1.2.1 From a0b9fe12886f55875bc4bce49f2566be3bff79cd Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 20:22:42 +0200 Subject: Fix project tests Signed-off-by: Dmitriy Zaporozhets --- features/project/project.feature | 18 +++++------------- features/steps/shared/paths.rb | 4 ++++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/features/project/project.feature b/features/project/project.feature index 56ae5c78d01..5fb2c67401e 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -18,9 +18,13 @@ Feature: Project Then I should see the default project avatar And I should not see the "Remove avatar" button + Scenario: I should have readme on page + And I visit project "Shop" page + Then I should see project "Shop" README + @javascript Scenario: I should see project activity - When I visit project "Shop" page + When I visit project "Shop" activity page Then I should see project "Shop" activity feed Scenario: I visit edit project @@ -38,24 +42,12 @@ Feature: Project And change project path settings Then I should see project with new path settings - Scenario: I should see project readme and version - When I visit project "Shop" page - And I should see project "Shop" version - Scenario: I should change project default branch When I visit edit project "Shop" page And change project default branch And I save project Then I should see project default branch changed - @javascript - Scenario: I should have default tab per my preference - And I own project "Forum" - When I select project "Forum" README tab - Then I should see project "Forum" README - And I visit project "Shop" page - Then I should see project "Shop" README - Scenario: I tag a project When I visit edit project "Shop" page Then I should see project settings diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index fe651e81dac..88a98a37807 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -251,6 +251,10 @@ module SharedPaths visit namespace_project_path(project.namespace, project) end + step 'I visit project "Shop" activity page' do + visit activity_namespace_project_path(project.namespace, project) + end + step 'I visit project "Forked Shop" merge requests page' do visit namespace_project_merge_requests_path(@forked_project.namespace, @forked_project) end -- cgit v1.2.1