From 5f2e8b6147eecc8f9a946b4e964bbb99b676ec58 Mon Sep 17 00:00:00 2001 From: Guillaume Delbergue Date: Fri, 24 Apr 2015 10:00:31 +0200 Subject: Add footnotes support to Markdown Signed-off-by: Guillaume Delbergue --- CHANGELOG | 1 + app/helpers/gitlab_markdown_helper.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 2e91c72a25f..fd6ea54fbf1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -17,6 +17,7 @@ v 7.11.0 (unreleased) - Improve UI for sidebar. Increase separation between navigation and content - Improve new project command options (Ben Bodenmiller) - Prevent sending empty messages to HipChat (Chulki Lee) + - Add footnotes support to Markdown (Guillaume Delbergue) v 7.10.0 (unreleased) - Ignore submodules that are defined in .gitmodules but are checked in as directories. diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index aff7011edd0..bc234500000 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -49,7 +49,8 @@ module GitlabMarkdownHelper strikethrough: true, lax_spacing: true, space_after_headers: true, - superscript: true + superscript: true, + footnotes: true ) end -- cgit v1.2.1 From d5fe1e57d5107c5ddc57feee5c3d1f7ed03941ab Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 28 Apr 2015 12:48:42 +0300 Subject: Draft improvements to search layout Signed-off-by: Dmitriy Zaporozhets --- app/controllers/search_controller.rb | 9 ++++--- app/views/layouts/_search.html.haml | 2 +- app/views/layouts/nav/_search.html.haml | 30 +++++++++++++++++++++ app/views/layouts/nav/search/_project.html.haml | 35 ++++++++++++++++++++++++ app/views/layouts/nav/search/_snippet.html.haml | 14 ++++++++++ app/views/layouts/search.html.haml | 6 +---- app/views/search/_global_filter.html.haml | 16 ----------- app/views/search/_project_filter.html.haml | 32 ---------------------- app/views/search/_results.html.haml | 31 +++++---------------- app/views/search/_snippet_filter.html.haml | 13 --------- app/views/search/show.html.haml | 36 +++++++++++-------------- 11 files changed, 109 insertions(+), 115 deletions(-) create mode 100644 app/views/layouts/nav/_search.html.haml create mode 100644 app/views/layouts/nav/search/_project.html.haml create mode 100644 app/views/layouts/nav/search/_snippet.html.haml delete mode 100644 app/views/search/_global_filter.html.haml delete mode 100644 app/views/search/_project_filter.html.haml delete mode 100644 app/views/search/_snippet_filter.html.haml diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index c5828d0b2df..ad9e9e8487e 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -4,20 +4,22 @@ class SearchController < ApplicationController def show return if params[:search].nil? || params[:search].blank? + @search_term = params[:search] + if params[:project_id].present? @project = Project.find_by(id: params[:project_id]) @project = nil unless can?(current_user, :download_code, @project) end if params[:group_id].present? - @group = Group.find_by(id: params[:group_id]) + @group = Group.find_by(id: params[:group_id]) @group = nil unless can?(current_user, :read_group, @group) end - + @scope = params[:scope] @show_snippets = params[:snippets].eql? 'true' - @search_results = + @search_results = if @project unless %w(blobs notes issues merge_requests wiki_blobs). include?(@scope) @@ -37,6 +39,7 @@ class SearchController < ApplicationController end Search::GlobalService.new(current_user, params).execute end + @objects = @search_results.objects(@scope, params[:page]) end diff --git a/app/views/layouts/_search.html.haml b/app/views/layouts/_search.html.haml index 04f79846858..58e6bd3158f 100644 --- a/app/views/layouts/_search.html.haml +++ b/app/views/layouts/_search.html.haml @@ -1,6 +1,6 @@ .search = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f| - = search_field_tag "search", nil, placeholder: search_placeholder, class: "search-input" + = search_field_tag "search", @search_term, placeholder: search_placeholder, class: "search-input" = hidden_field_tag :group_id, @group.try(:id) - if @project && @project.persisted? = hidden_field_tag :project_id, @project.id diff --git a/app/views/layouts/nav/_search.html.haml b/app/views/layouts/nav/_search.html.haml new file mode 100644 index 00000000000..35806c2d0fb --- /dev/null +++ b/app/views/layouts/nav/_search.html.haml @@ -0,0 +1,30 @@ +%ul.nav.nav-sidebar.search-filter + - if @project + = render 'layouts/nav/search/project' + + - elsif @show_snippets + = render 'layouts/nav/search/snippet' + + - else + %li{class: ("active" if @scope == 'projects')} + = link_to search_filter_path(scope: 'projects') do + = icon('bookmark fw') + %span + Projects + %span.count + = @search_results.projects_count + %li{class: ("active" if @scope == 'issues')} + = link_to search_filter_path(scope: 'issues') do + = icon('exclamation-circle fw') + %span + Issues + %span.count + = @search_results.issues_count + %li{class: ("active" if @scope == 'merge_requests')} + = link_to search_filter_path(scope: 'merge_requests') do + = icon('tasks fw') + %span + Merge requests + %span.count + = @search_results.merge_requests_count + diff --git a/app/views/layouts/nav/search/_project.html.haml b/app/views/layouts/nav/search/_project.html.haml new file mode 100644 index 00000000000..344cb4b4801 --- /dev/null +++ b/app/views/layouts/nav/search/_project.html.haml @@ -0,0 +1,35 @@ +%li{class: ("active" if @scope == 'blobs')} + = link_to search_filter_path(scope: 'blobs') do + = icon('code fw') + %span + Code + %span.count + = @search_results.blobs_count +%li{class: ("active" if @scope == 'issues')} + = link_to search_filter_path(scope: 'issues') do + = icon('exclamation-circle fw') + %span + Issues + %span.count + = @search_results.issues_count +%li{class: ("active" if @scope == 'merge_requests')} + = link_to search_filter_path(scope: 'merge_requests') do + = icon('tasks fw') + %span + Merge requests + %span.count + = @search_results.merge_requests_count +%li{class: ("active" if @scope == 'notes')} + = link_to search_filter_path(scope: 'notes') do + = icon('comments fw') + %span + Comments + %span.count + = @search_results.notes_count +%li{class: ("active" if @scope == 'wiki_blobs')} + = link_to search_filter_path(scope: 'wiki_blobs') do + = icon('book fw') + %span + Wiki + %span.count + = @search_results.wiki_blobs_count diff --git a/app/views/layouts/nav/search/_snippet.html.haml b/app/views/layouts/nav/search/_snippet.html.haml new file mode 100644 index 00000000000..e63a221fb82 --- /dev/null +++ b/app/views/layouts/nav/search/_snippet.html.haml @@ -0,0 +1,14 @@ +%li{class: ("active" if @scope == 'snippet_blobs')} + = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do + = icon('code fw') + %span + Snippet Contents + %span.count + = @search_results.snippet_blobs_count +%li{class: ("active" if @scope == 'snippet_titles')} + = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do + = icon('book fw') + %span + Titles and Filenames + %span.count + = @search_results.snippet_titles_count diff --git a/app/views/layouts/search.html.haml b/app/views/layouts/search.html.haml index f9d8db06e10..c9b76e8fca4 100644 --- a/app/views/layouts/search.html.haml +++ b/app/views/layouts/search.html.haml @@ -2,9 +2,5 @@ %html{ lang: "en"} = render "layouts/head", title: "Search" %body{class: "#{app_theme} application", :'data-page' => body_data_page} - = render "layouts/broadcast" = render "layouts/head_panel", title: link_to("Search", search_path) - .container.navless-container - .content - = render "layouts/flash" - = yield + = render 'layouts/page', sidebar: 'layouts/nav/search' diff --git a/app/views/search/_global_filter.html.haml b/app/views/search/_global_filter.html.haml deleted file mode 100644 index 442bd84f930..00000000000 --- a/app/views/search/_global_filter.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%ul.nav.nav-pills.nav-stacked.search-filter - %li{class: ("active" if @scope == 'projects')} - = link_to search_filter_path(scope: 'projects') do - Projects - .pull-right - = @search_results.projects_count - %li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - Issues - .pull-right - = @search_results.issues_count - %li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - Merge requests - .pull-right - = @search_results.merge_requests_count diff --git a/app/views/search/_project_filter.html.haml b/app/views/search/_project_filter.html.haml deleted file mode 100644 index ad933502a28..00000000000 --- a/app/views/search/_project_filter.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -%ul.nav.nav-pills.nav-stacked.search-filter - %li{class: ("active" if @scope == 'blobs')} - = link_to search_filter_path(scope: 'blobs') do - %i.fa.fa-code - Code - .pull-right - = @search_results.blobs_count - %li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - %i.fa.fa-exclamation-circle - Issues - .pull-right - = @search_results.issues_count - %li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - %i.fa.fa-code-fork - Merge requests - .pull-right - = @search_results.merge_requests_count - %li{class: ("active" if @scope == 'notes')} - = link_to search_filter_path(scope: 'notes') do - %i.fa.fa-comments - Comments - .pull-right - = @search_results.notes_count - %li{class: ("active" if @scope == 'wiki_blobs')} - = link_to search_filter_path(scope: 'wiki_blobs') do - %i.fa.fa-book - Wiki - .pull-right - = @search_results.wiki_blobs_count - diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml index 796dd752a4c..f741a64cbab 100644 --- a/app/views/search/_results.html.haml +++ b/app/views/search/_results.html.haml @@ -1,28 +1,9 @@ -%h4 - #{@search_results.total_count} results found - - unless @show_snippets - - if @project - for #{link_to @project.name_with_namespace, [@project.namespace.becomes(Namespace), @project]} - - elsif @group - for #{link_to @group.name, @group} - -%hr - -.row - .col-sm-3 - - if @project - = render "project_filter" - - elsif @show_snippets - = render 'snippet_filter' - - else - = render "global_filter" - .col-sm-9 - .search-results - - if @search_results.empty? - = render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" } - - else - = render partial: "search/results/#{@scope.singularize}", collection: @objects - = paginate @objects, theme: 'gitlab' +.search-results + - if @search_results.empty? + = render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" } + - else + = render partial: "search/results/#{@scope.singularize}", collection: @objects + = paginate @objects, theme: 'gitlab' :javascript $(".search-results .term").highlight("#{escape_javascript(params[:search])}"); diff --git a/app/views/search/_snippet_filter.html.haml b/app/views/search/_snippet_filter.html.haml deleted file mode 100644 index 95d23fa9f47..00000000000 --- a/app/views/search/_snippet_filter.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%ul.nav.nav-pills.nav-stacked.search-filter - %li{class: ("active" if @scope == 'snippet_blobs')} - = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do - %i.fa.fa-code - Snippet Contents - .pull-right - = @search_results.snippet_blobs_count - %li{class: ("active" if @scope == 'snippet_titles')} - = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do - %i.fa.fa-book - Titles and Filenames - .pull-right - = @search_results.snippet_titles_count diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index 5b4816e4c40..fcdd63a764d 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,22 +1,18 @@ -= form_tag search_path, method: :get, class: 'form-horizontal' do |f| - .search-holder.clearfix - .form-group - = label_tag :search, class: 'control-label' do - %span Looking for - .col-sm-6 - = search_field_tag :search, params[:search], placeholder: "issue 143", class: "form-control search-text-input", id: "dashboard_search" - .col-sm-4 - = button_tag 'Search', class: "btn btn-create" - .form-group - .col-sm-2 - - unless params[:snippets].eql? 'true' - .col-sm-10 - = render 'filter', f: f - = hidden_field_tag :project_id, params[:project_id] - = hidden_field_tag :group_id, params[:group_id] - = hidden_field_tag :snippets, params[:snippets] - = hidden_field_tag :scope, params[:scope] +- if @search_term + .lead + Search for + %code + = @search_term + - unless @show_snippets + - if @project + in project #{link_to @project.name_with_namespace, [@project.namespace.becomes(Namespace), @project]} + - elsif @group + in group #{link_to @group.name, @group} + .pull-right + = render 'filter' + %hr .results.prepend-top-10 - - if params[:search].present? - = render 'search/results' + = render 'search/results' +- else + wow -- cgit v1.2.1 From 1ff01d26e1943a16f77e2ab08e89c92d72fcbf62 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 28 Apr 2015 22:04:19 +0300 Subject: Continue refactoring and restyle of search layout Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/common.scss | 11 +----- app/views/layouts/_head_panel.html.haml | 5 +-- app/views/layouts/_search.html.haml | 2 +- app/views/layouts/nav/_search.html.haml | 56 +++++++++++++++--------------- app/views/search/_filter.html.haml | 4 +-- app/views/search/_form.html.haml | 12 +++++++ app/views/search/_results.html.haml | 24 +++++++++---- app/views/search/results/_empty.html.haml | 6 ++-- app/views/search/show.html.haml | 20 ++--------- db/schema.rb | 28 +++++++++++++-- 10 files changed, 98 insertions(+), 70 deletions(-) create mode 100644 app/views/search/_form.html.haml diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss index 7c3021989a8..1e569978cc8 100644 --- a/app/assets/stylesheets/generic/common.scss +++ b/app/assets/stylesheets/generic/common.scss @@ -333,17 +333,8 @@ table { } .search_box { - position: relative; - padding: 30px; + @extend .well; text-align: center; - background-color: #F9F9F9; - border: 1px solid #DDDDDD; - border-radius: 0px; -} - -.search_glyph { - color: #555; - font-size: 42px; } .task-status { diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index fc4656be079..a7ec19cb692 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -13,8 +13,9 @@ .navbar-collapse.collapse %ul.nav.navbar-nav - %li.hidden-sm.hidden-xs - = render 'layouts/search' + - unless current_controller?(:search) + %li.hidden-sm.hidden-xs + = render 'layouts/search' %li.visible-sm.visible-xs = link_to search_path, title: 'Search', data: {toggle: 'tooltip', placement: 'bottom'} do = icon('search') diff --git a/app/views/layouts/_search.html.haml b/app/views/layouts/_search.html.haml index 58e6bd3158f..04f79846858 100644 --- a/app/views/layouts/_search.html.haml +++ b/app/views/layouts/_search.html.haml @@ -1,6 +1,6 @@ .search = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f| - = search_field_tag "search", @search_term, placeholder: search_placeholder, class: "search-input" + = search_field_tag "search", nil, placeholder: search_placeholder, class: "search-input" = hidden_field_tag :group_id, @group.try(:id) - if @project && @project.persisted? = hidden_field_tag :project_id, @project.id diff --git a/app/views/layouts/nav/_search.html.haml b/app/views/layouts/nav/_search.html.haml index 35806c2d0fb..f95f6acb28d 100644 --- a/app/views/layouts/nav/_search.html.haml +++ b/app/views/layouts/nav/_search.html.haml @@ -1,30 +1,30 @@ -%ul.nav.nav-sidebar.search-filter - - if @project - = render 'layouts/nav/search/project' +- if @search_term + %ul.nav.nav-sidebar.search-filter + - if @project + = render 'layouts/nav/search/project' - - elsif @show_snippets - = render 'layouts/nav/search/snippet' - - - else - %li{class: ("active" if @scope == 'projects')} - = link_to search_filter_path(scope: 'projects') do - = icon('bookmark fw') - %span - Projects - %span.count - = @search_results.projects_count - %li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - = icon('exclamation-circle fw') - %span - Issues - %span.count - = @search_results.issues_count - %li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - = icon('tasks fw') - %span - Merge requests - %span.count - = @search_results.merge_requests_count + - elsif @show_snippets + = render 'layouts/nav/search/snippet' + - else + %li{class: ("active" if @scope == 'projects')} + = link_to search_filter_path(scope: 'projects') do + = icon('bookmark fw') + %span + Projects + %span.count + = @search_results.projects_count + %li{class: ("active" if @scope == 'issues')} + = link_to search_filter_path(scope: 'issues') do + = icon('exclamation-circle fw') + %span + Issues + %span.count + = @search_results.issues_count + %li{class: ("active" if @scope == 'merge_requests')} + = link_to search_filter_path(scope: 'merge_requests') do + = icon('tasks fw') + %span + Merge requests + %span.count + = @search_results.merge_requests_count diff --git a/app/views/search/_filter.html.haml b/app/views/search/_filter.html.haml index ffc145497ab..e2d0cab9e79 100644 --- a/app/views/search/_filter.html.haml +++ b/app/views/search/_filter.html.haml @@ -1,5 +1,5 @@ .dropdown.inline - %button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'} + %button.dropdown-toggle.btn.btn{type: 'button', 'data-toggle' => 'dropdown'} %i.fa.fa-tags %span.light Group: - if @group.present? @@ -17,7 +17,7 @@ = group.name .dropdown.inline.prepend-left-10.project-filter - %button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'} + %button.dropdown-toggle.btn.btn{type: 'button', 'data-toggle' => 'dropdown'} %i.fa.fa-tags %span.light Project: - if @project.present? diff --git a/app/views/search/_form.html.haml b/app/views/search/_form.html.haml new file mode 100644 index 00000000000..a9ec7df2967 --- /dev/null +++ b/app/views/search/_form.html.haml @@ -0,0 +1,12 @@ += form_tag search_path, method: :get, class: 'form-inline' do |f| + = hidden_field_tag :project_id, params[:project_id] + = hidden_field_tag :group_id, params[:group_id] + = hidden_field_tag :snippets, params[:snippets] + = hidden_field_tag :scope, params[:scope] + .search-holder.clearfix + .form-group + = search_field_tag :search, params[:search], placeholder: "Search for projects, issues etc", class: "form-control search-text-input input-mn-300", id: "dashboard_search", autofocus: true + = button_tag 'Search', class: "btn btn-info" + - unless params[:snippets].eql? 'true' + .pull-right + = render 'filter' diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml index f741a64cbab..741c780ad96 100644 --- a/app/views/search/_results.html.haml +++ b/app/views/search/_results.html.haml @@ -1,9 +1,21 @@ -.search-results - - if @search_results.empty? - = render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" } - - else - = render partial: "search/results/#{@scope.singularize}", collection: @objects - = paginate @objects, theme: 'gitlab' +- if @search_results.empty? + = render partial: "search/results/empty" +- else + .light + Search results for + %code + = @search_term + - unless @show_snippets + - if @project + in project #{link_to @project.name_with_namespace, [@project.namespace.becomes(Namespace), @project]} + - elsif @group + in group #{link_to @group.name, @group} + + %br + .results.prepend-top-10 + .search-results + = render partial: "search/results/#{@scope.singularize}", collection: @objects + = paginate @objects, theme: 'gitlab' :javascript $(".search-results .term").highlight("#{escape_javascript(params[:search])}"); diff --git a/app/views/search/results/_empty.html.haml b/app/views/search/results/_empty.html.haml index 01fb8cd9b8e..05a63016c09 100644 --- a/app/views/search/results/_empty.html.haml +++ b/app/views/search/results/_empty.html.haml @@ -1,4 +1,6 @@ .search_box .search_glyph - %span.fa.fa-search - %h4 #{message} + %h4 + = icon('search') + We couldn't find any results matching + %code #{@search_term} diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index fcdd63a764d..8e11154279f 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,18 +1,4 @@ += render 'search/form' +%hr - if @search_term - .lead - Search for - %code - = @search_term - - unless @show_snippets - - if @project - in project #{link_to @project.name_with_namespace, [@project.namespace.becomes(Namespace), @project]} - - elsif @group - in group #{link_to @group.name, @group} - - .pull-right - = render 'filter' - %hr - .results.prepend-top-10 - = render 'search/results' -- else - wow + = render 'search/results' diff --git a/db/schema.rb b/db/schema.rb index 8683c0446fe..43faaf31682 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -349,10 +349,10 @@ ActiveRecord::Schema.define(version: 20150425173433) do t.string "import_url" t.integer "visibility_level", default: 0, null: false t.boolean "archived", default: false, null: false - t.string "avatar" t.string "import_status" t.float "repository_size", default: 0.0 t.integer "star_count", default: 0, null: false + t.string "avatar" t.string "import_type" t.string "import_source" end @@ -472,7 +472,6 @@ ActiveRecord::Schema.define(version: 20150425173433) do t.integer "notification_level", default: 1, null: false t.datetime "password_expires_at" t.integer "created_by_id" - t.datetime "last_credential_check_at" t.string "avatar" t.string "confirmation_token" t.datetime "confirmed_at" @@ -480,6 +479,7 @@ ActiveRecord::Schema.define(version: 20150425173433) do t.string "unconfirmed_email" t.boolean "hide_no_ssh_key", default: false t.string "website_url", default: "", null: false + t.datetime "last_credential_check_at" t.string "github_access_token" t.string "gitlab_access_token" t.string "notification_email" @@ -501,6 +501,30 @@ ActiveRecord::Schema.define(version: 20150425173433) do add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree add_index "users", ["username"], name: "index_users_on_username", using: :btree + create_table "users_groups", force: true do |t| + t.integer "group_access", null: false + t.integer "group_id", null: false + t.integer "user_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "notification_level", default: 3, null: false + end + + add_index "users_groups", ["user_id"], name: "index_users_groups_on_user_id", using: :btree + + create_table "users_projects", force: true do |t| + t.integer "user_id", null: false + t.integer "project_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "project_access", default: 0, null: false + t.integer "notification_level", default: 3, null: false + end + + add_index "users_projects", ["project_access"], name: "index_users_projects_on_project_access", using: :btree + add_index "users_projects", ["project_id"], name: "index_users_projects_on_project_id", using: :btree + add_index "users_projects", ["user_id"], name: "index_users_projects_on_user_id", using: :btree + create_table "users_star_projects", force: true do |t| t.integer "project_id", null: false t.integer "user_id", null: false -- cgit v1.2.1 From a8956e8850b9bc691a1f6875b821159e4722c2b9 Mon Sep 17 00:00:00 2001 From: Karen Carias Date: Tue, 28 Apr 2015 23:45:44 +0000 Subject: Added phrase "Here's how to close multiple issues in one commit message" so that doc is easier to find by users --- doc/customization/issue_closing.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/customization/issue_closing.md b/doc/customization/issue_closing.md index aa65a082a53..64f128f5a63 100644 --- a/doc/customization/issue_closing.md +++ b/doc/customization/issue_closing.md @@ -1,5 +1,7 @@ # Issue closing pattern +Here's how to close multiple issues in one commit message: + If a commit message matches the regular expression below, all issues referenced from the matched text will be closed. This happens when the commit is pushed or merged into the default branch of a project. @@ -33,4 +35,4 @@ issue_closing_pattern: '((?:[Cc]los(?:e[sd]|ing)|[Ff]ix(?:e[sd]|ing)?) +(?:(?:is For manual installs you can customize the pattern in [gitlab.yml][0]. [0]: https://gitlab.com/gitlab-org/gitlab-ce/blob/40c3675372320febf5264061c9bcd63db2dfd13c/config/gitlab.yml.example#L65 -[1]: http://rubular.com/r/Xmbexed1OJ +[1]: http://rubular.com/r/Xmbexed1OJ \ No newline at end of file -- cgit v1.2.1 From 24037e7e6323ff0f91d21d111bd2092f948c8255 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 29 Apr 2015 12:19:54 +0300 Subject: Move search categories (projects, issues etc) below search field. Instead use sidebar for dashbaord nav Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/base/gl_bootstrap.scss | 6 ++ app/views/layouts/nav/_search.html.haml | 30 ---------- app/views/layouts/nav/search/_project.html.haml | 35 ----------- app/views/layouts/nav/search/_snippet.html.haml | 14 ----- app/views/layouts/search.html.haml | 2 +- app/views/search/_category.html.haml | 77 +++++++++++++++++++++++++ app/views/search/_form.html.haml | 2 +- app/views/search/show.html.haml | 2 + 8 files changed, 87 insertions(+), 81 deletions(-) delete mode 100644 app/views/layouts/nav/_search.html.haml delete mode 100644 app/views/layouts/nav/search/_project.html.haml delete mode 100644 app/views/layouts/nav/search/_snippet.html.haml create mode 100644 app/views/search/_category.html.haml diff --git a/app/assets/stylesheets/base/gl_bootstrap.scss b/app/assets/stylesheets/base/gl_bootstrap.scss index 427f333423c..21acbfa5e5a 100644 --- a/app/assets/stylesheets/base/gl_bootstrap.scss +++ b/app/assets/stylesheets/base/gl_bootstrap.scss @@ -137,6 +137,12 @@ color: #666; } +.nav-pills > .active > a > span > .badge { + background-color: #fff; + color: $gl-primary; +} + + /** * fix to keep tooltips position in top navigation bar * diff --git a/app/views/layouts/nav/_search.html.haml b/app/views/layouts/nav/_search.html.haml deleted file mode 100644 index f95f6acb28d..00000000000 --- a/app/views/layouts/nav/_search.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -- if @search_term - %ul.nav.nav-sidebar.search-filter - - if @project - = render 'layouts/nav/search/project' - - - elsif @show_snippets - = render 'layouts/nav/search/snippet' - - - else - %li{class: ("active" if @scope == 'projects')} - = link_to search_filter_path(scope: 'projects') do - = icon('bookmark fw') - %span - Projects - %span.count - = @search_results.projects_count - %li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - = icon('exclamation-circle fw') - %span - Issues - %span.count - = @search_results.issues_count - %li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - = icon('tasks fw') - %span - Merge requests - %span.count - = @search_results.merge_requests_count diff --git a/app/views/layouts/nav/search/_project.html.haml b/app/views/layouts/nav/search/_project.html.haml deleted file mode 100644 index 344cb4b4801..00000000000 --- a/app/views/layouts/nav/search/_project.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -%li{class: ("active" if @scope == 'blobs')} - = link_to search_filter_path(scope: 'blobs') do - = icon('code fw') - %span - Code - %span.count - = @search_results.blobs_count -%li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - = icon('exclamation-circle fw') - %span - Issues - %span.count - = @search_results.issues_count -%li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - = icon('tasks fw') - %span - Merge requests - %span.count - = @search_results.merge_requests_count -%li{class: ("active" if @scope == 'notes')} - = link_to search_filter_path(scope: 'notes') do - = icon('comments fw') - %span - Comments - %span.count - = @search_results.notes_count -%li{class: ("active" if @scope == 'wiki_blobs')} - = link_to search_filter_path(scope: 'wiki_blobs') do - = icon('book fw') - %span - Wiki - %span.count - = @search_results.wiki_blobs_count diff --git a/app/views/layouts/nav/search/_snippet.html.haml b/app/views/layouts/nav/search/_snippet.html.haml deleted file mode 100644 index e63a221fb82..00000000000 --- a/app/views/layouts/nav/search/_snippet.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%li{class: ("active" if @scope == 'snippet_blobs')} - = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do - = icon('code fw') - %span - Snippet Contents - %span.count - = @search_results.snippet_blobs_count -%li{class: ("active" if @scope == 'snippet_titles')} - = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do - = icon('book fw') - %span - Titles and Filenames - %span.count - = @search_results.snippet_titles_count diff --git a/app/views/layouts/search.html.haml b/app/views/layouts/search.html.haml index c9b76e8fca4..4b526686be4 100644 --- a/app/views/layouts/search.html.haml +++ b/app/views/layouts/search.html.haml @@ -3,4 +3,4 @@ = render "layouts/head", title: "Search" %body{class: "#{app_theme} application", :'data-page' => body_data_page} = render "layouts/head_panel", title: link_to("Search", search_path) - = render 'layouts/page', sidebar: 'layouts/nav/search' + = render 'layouts/page' diff --git a/app/views/search/_category.html.haml b/app/views/search/_category.html.haml new file mode 100644 index 00000000000..154332cb9a9 --- /dev/null +++ b/app/views/search/_category.html.haml @@ -0,0 +1,77 @@ +%ul.nav.nav-pills.search-filter + - if @project + %li{class: ("active" if @scope == 'blobs')} + = link_to search_filter_path(scope: 'blobs') do + = icon('code fw') + %span + Code + %span.badge + = @search_results.blobs_count + %li{class: ("active" if @scope == 'issues')} + = link_to search_filter_path(scope: 'issues') do + = icon('exclamation-circle fw') + %span + Issues + %span.badge + = @search_results.issues_count + %li{class: ("active" if @scope == 'merge_requests')} + = link_to search_filter_path(scope: 'merge_requests') do + = icon('tasks fw') + %span + Merge requests + %span.badge + = @search_results.merge_requests_count + %li{class: ("active" if @scope == 'notes')} + = link_to search_filter_path(scope: 'notes') do + = icon('comments fw') + %span + Comments + %span.badge + = @search_results.notes_count + %li{class: ("active" if @scope == 'wiki_blobs')} + = link_to search_filter_path(scope: 'wiki_blobs') do + = icon('book fw') + %span + Wiki + %span.badge + = @search_results.wiki_blobs_count + + - elsif @show_snippets + %li{class: ("active" if @scope == 'snippet_blobs')} + = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do + = icon('code fw') + %span + Snippet Contents + %span.badge + = @search_results.snippet_blobs_count + %li{class: ("active" if @scope == 'snippet_titles')} + = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do + = icon('book fw') + %span + Titles and Filenames + %span.badge + = @search_results.snippet_titles_count + + - else + %li{class: ("active" if @scope == 'projects')} + = link_to search_filter_path(scope: 'projects') do + = icon('bookmark fw') + %span + Projects + %span.badge + = @search_results.projects_count + %li{class: ("active" if @scope == 'issues')} + = link_to search_filter_path(scope: 'issues') do + = icon('exclamation-circle fw') + %span + Issues + %span.badge + = @search_results.issues_count + %li{class: ("active" if @scope == 'merge_requests')} + = link_to search_filter_path(scope: 'merge_requests') do + = icon('tasks fw') + %span + Merge requests + %span.badge + = @search_results.merge_requests_count + diff --git a/app/views/search/_form.html.haml b/app/views/search/_form.html.haml index a9ec7df2967..47016daf1f0 100644 --- a/app/views/search/_form.html.haml +++ b/app/views/search/_form.html.haml @@ -6,7 +6,7 @@ .search-holder.clearfix .form-group = search_field_tag :search, params[:search], placeholder: "Search for projects, issues etc", class: "form-control search-text-input input-mn-300", id: "dashboard_search", autofocus: true - = button_tag 'Search', class: "btn btn-info" + = button_tag 'Search', class: "btn btn-primary" - unless params[:snippets].eql? 'true' .pull-right = render 'filter' diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index 8e11154279f..e9f2711be2a 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,4 +1,6 @@ = render 'search/form' %hr - if @search_term + = render 'search/category' + %hr = render 'search/results' -- cgit v1.2.1 From 808b05e9747d46821ff1cc6a0071e881c2dc0056 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 29 Apr 2015 07:52:27 -0700 Subject: Move service template and project service settings into a shared view --- app/views/admin/services/_form.html.haml | 74 +-------------------------- app/views/projects/services/_form.html.haml | 75 +--------------------------- app/views/shared/_service_settings.html.haml | 75 ++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 147 deletions(-) create mode 100644 app/views/shared/_service_settings.html.haml diff --git a/app/views/admin/services/_form.html.haml b/app/views/admin/services/_form.html.haml index 34ca7776c9e..cdbfc60f9a4 100644 --- a/app/views/admin/services/_form.html.haml +++ b/app/views/admin/services/_form.html.haml @@ -4,79 +4,7 @@ %p #{@service.description} template = form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'form-horizontal fieldset-form' } do |form| - - if @service.errors.any? - #error_explanation - .alert.alert-danger - - @service.errors.full_messages.each do |msg| - %p= msg - - if @service.help.present? - .well - = preserve do - = markdown @service.help - - .form-group - = form.label :active, "Active", class: "control-label" - .col-sm-10 - = form.check_box :active - - - if @service.supported_events.length > 1 - .form-group - = form.label :url, "Trigger", class: 'control-label' - .col-sm-10 - - if @service.supported_events.include?("push") - %div - = form.check_box :push_events, class: 'pull-left' - .prepend-left-20 - = form.label :push_events, class: 'list-label' do - %strong Push events - %p.light - This url will be triggered by a push to the repository - - if @service.supported_events.include?("tag_push") - %div - = form.check_box :tag_push_events, class: 'pull-left' - .prepend-left-20 - = form.label :tag_push_events, class: 'list-label' do - %strong Tag push events - %p.light - This url will be triggered when a new tag is pushed to the repository - - if @service.supported_events.include?("note") - %div - = form.check_box :note_events, class: 'pull-left' - .prepend-left-20 - = form.label :note_events, class: 'list-label' do - %strong Comments - %p.light - This url will be triggered when someone adds a comment - - if @service.supported_events.include?("issue") - %div - = form.check_box :issues_events, class: 'pull-left' - .prepend-left-20 - = form.label :issues_events, class: 'list-label' do - %strong Issues events - %p.light - This url will be triggered when an issue is created - - if @service.supported_events.include?("merge_request") - %div - = form.check_box :merge_requests_events, class: 'pull-left' - .prepend-left-20 - = form.label :merge_requests_events, class: 'list-label' do - %strong Merge Request events - %p.light - This url will be triggered when a merge request is created - - - @service.fields.each do |field| - - type = field[:type] - - - if type == 'fieldset' - - fields = field[:fields] - - legend = field[:legend] - - %fieldset - %legend= legend - - fields.each do |subfield| - = render 'shared/field', form: form, field: subfield - - else - = render 'shared/field', form: form, field: field + = render 'shared/service_settings', form: form .form-actions = form.submit 'Save', class: 'btn btn-save' diff --git a/app/views/projects/services/_form.html.haml b/app/views/projects/services/_form.html.haml index 1b465e3addd..e1823b51198 100644 --- a/app/views/projects/services/_form.html.haml +++ b/app/views/projects/services/_form.html.haml @@ -11,80 +11,7 @@ %hr = form_for(@service, as: :service, url: namespace_project_service_path(@project.namespace, @project, @service.to_param), method: :put, html: { class: 'form-horizontal' }) do |form| - - if @service.errors.any? - .alert.alert-danger - %ul - - @service.errors.full_messages.each do |msg| - %li= msg - - - if @service.help.present? - .well - = preserve do - = markdown @service.help - - .form-group - = form.label :active, "Active", class: "control-label" - .col-sm-10 - = form.check_box :active - - - if @service.supported_events.length > 1 - .form-group - = form.label :url, "Trigger", class: 'control-label' - .col-sm-10 - - if @service.supported_events.include?("push") - %div - = form.check_box :push_events, class: 'pull-left' - .prepend-left-20 - = form.label :push_events, class: 'list-label' do - %strong Push events - %p.light - This url will be triggered by a push to the repository - - if @service.supported_events.include?("tag_push") - %div - = form.check_box :tag_push_events, class: 'pull-left' - .prepend-left-20 - = form.label :tag_push_events, class: 'list-label' do - %strong Tag push events - %p.light - This url will be triggered when a new tag is pushed to the repository - - if @service.supported_events.include?("note") - %div - = form.check_box :note_events, class: 'pull-left' - .prepend-left-20 - = form.label :note_events, class: 'list-label' do - %strong Comments - %p.light - This url will be triggered when someone adds a comment - - if @service.supported_events.include?("issue") - %div - = form.check_box :issues_events, class: 'pull-left' - .prepend-left-20 - = form.label :issues_events, class: 'list-label' do - %strong Issues events - %p.light - This url will be triggered when an issue is created - - if @service.supported_events.include?("merge_request") - %div - = form.check_box :merge_requests_events, class: 'pull-left' - .prepend-left-20 - = form.label :merge_requests_events, class: 'list-label' do - %strong Merge Request events - %p.light - This url will be triggered when a merge request is created - - - @service.fields.each do |field| - - type = field[:type] - - - if type == 'fieldset' - - fields = field[:fields] - - legend = field[:legend] - - %fieldset - %legend= legend - - fields.each do |subfield| - = render 'shared/field', form: form, field: subfield - - else - = render 'shared/field', form: form, field: field + = render 'shared/service_settings', form: form .form-actions = form.submit 'Save', class: 'btn btn-save' diff --git a/app/views/shared/_service_settings.html.haml b/app/views/shared/_service_settings.html.haml new file mode 100644 index 00000000000..16a98a7233c --- /dev/null +++ b/app/views/shared/_service_settings.html.haml @@ -0,0 +1,75 @@ +- if @service.errors.any? + #error_explanation + .alert.alert-danger + %ul + - @service.errors.full_messages.each do |msg| + %li= msg + +- if @service.help.present? + .well + = preserve do + = markdown @service.help + +.form-group + = form.label :active, "Active", class: "control-label" + .col-sm-10 + = form.check_box :active + +- if @service.supported_events.length > 1 + .form-group + = form.label :url, "Trigger", class: 'control-label' + .col-sm-10 + - if @service.supported_events.include?("push") + %div + = form.check_box :push_events, class: 'pull-left' + .prepend-left-20 + = form.label :push_events, class: 'list-label' do + %strong Push events + %p.light + This url will be triggered by a push to the repository + - if @service.supported_events.include?("tag_push") + %div + = form.check_box :tag_push_events, class: 'pull-left' + .prepend-left-20 + = form.label :tag_push_events, class: 'list-label' do + %strong Tag push events + %p.light + This url will be triggered when a new tag is pushed to the repository + - if @service.supported_events.include?("note") + %div + = form.check_box :note_events, class: 'pull-left' + .prepend-left-20 + = form.label :note_events, class: 'list-label' do + %strong Comments + %p.light + This url will be triggered when someone adds a comment + - if @service.supported_events.include?("issue") + %div + = form.check_box :issues_events, class: 'pull-left' + .prepend-left-20 + = form.label :issues_events, class: 'list-label' do + %strong Issues events + %p.light + This url will be triggered when an issue is created + - if @service.supported_events.include?("merge_request") + %div + = form.check_box :merge_requests_events, class: 'pull-left' + .prepend-left-20 + = form.label :merge_requests_events, class: 'list-label' do + %strong Merge Request events + %p.light + This url will be triggered when a merge request is created + +- @service.fields.each do |field| + - type = field[:type] + + - if type == 'fieldset' + - fields = field[:fields] + - legend = field[:legend] + + %fieldset + %legend= legend + - fields.each do |subfield| + = render 'shared/field', form: form, field: subfield + - else + = render 'shared/field', form: form, field: field -- cgit v1.2.1 From 7534d0ef46debee418fa36d65670cd1e43810baa Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 29 Apr 2015 19:52:25 +0300 Subject: Fix tests Signed-off-by: Dmitriy Zaporozhets --- features/steps/project/source/search_code.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/steps/project/source/search_code.rb b/features/steps/project/source/search_code.rb index 9c2864cc936..b66c5a4123a 100644 --- a/features/steps/project/source/search_code.rb +++ b/features/steps/project/source/search_code.rb @@ -14,6 +14,6 @@ class Spinach::Features::ProjectSourceSearchCode < Spinach::FeatureSteps end step 'I should see empty result' do - page.should have_content "We couldn't find any matching" + page.should have_content "We couldn't find any" end end -- cgit v1.2.1 From 5bf9f69df7f46b1c82bf3c02bf806a9f604480e5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 29 Apr 2015 20:32:48 +0300 Subject: Fix visibility settings UI in admin area Signed-off-by: Dmitriy Zaporozhets --- app/views/admin/application_settings/_form.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index 98d3e00153d..87e7c9634e9 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -42,11 +42,11 @@ = f.label :default_branch_protection, class: 'control-label col-sm-2' .col-sm-10 = f.select :default_branch_protection, options_for_select(Gitlab::Access.protection_options, @application_setting.default_branch_protection), {}, class: 'form-control' - .form-group + .form-group.project-visibility-level-holder = f.label :default_project_visibility, class: 'control-label col-sm-2' .col-sm-10 = render('shared/visibility_radios', model_method: :default_project_visibility, form: f, selected_level: @application_setting.default_project_visibility, form_model: 'Project') - .form-group + .form-group.project-visibility-level-holder = f.label :default_snippet_visibility, class: 'control-label col-sm-2' .col-sm-10 = render('shared/visibility_radios', model_method: :default_snippet_visibility, form: f, selected_level: @application_setting.default_snippet_visibility, form_model: 'Snippet') -- cgit v1.2.1