diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-07-12 13:17:25 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-07-12 13:17:25 +0000 |
commit | c43b289612b2420bc7e3c5faaf014b527ccace04 (patch) | |
tree | b8c914942c8c69cfa7886712e68b8cd63abcf079 | |
parent | f1fc1ae6f10d122c6b852edc0fdf11f38a2d7e30 (diff) | |
parent | 92ef845fa5fdf0ffbc50e0a35cf366765fbfc631 (diff) | |
download | gitlab-ce-c43b289612b2420bc7e3c5faaf014b527ccace04.tar.gz |
Merge branch '6-0-dev' of /home/git/repositories/gitlab/gitlabhq
477 files changed, 2880 insertions, 5052 deletions
diff --git a/CHANGELOG b/CHANGELOG index c614443b542..08cee5d2346 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,22 @@ +v 6.0.0 + - Epic: Replace teams with group membership + - Add project filter on dashboard + - cache project graph + - Drop support of root namespaces + - Redesign project settings navigation + - Restlyed login screen + - Default theme is classic now + - Cache result of methods like authorize_projects, project.team.members etc + - Remove $.ready events + - Fix onclick events being double binded + - Add notification level to group membership + - Move all project controllers/views under Projects:: module + - Move all profile controllers/views under Profiles:: module + - Redesign ssh keys page + - Generate fingerprint for ssh keys + - You an use arrows to navigate at tree view + - Apply user project limit only for personal projects + v 5.4.0 - Ability to edit own comments - Documentation improvements diff --git a/Capfile.example b/Capfile.example deleted file mode 100644 index 8863835da4a..00000000000 --- a/Capfile.example +++ /dev/null @@ -1,4 +0,0 @@ -load 'deploy' -load 'deploy/assets' -require 'bundler/capistrano' -load 'config/deploy' @@ -23,7 +23,7 @@ gem 'omniauth-github' # Extracting information from a git repository # Provide access to Gitlab::Git library -gem 'gitlab_git', '~> 1.3.0' +gem 'gitlab_git', '~> 1.4.1' # Ruby/Rack Git Smart-HTTP Server Handler gem 'gitlab-grack', '~> 1.0.1', require: 'grack' @@ -35,7 +35,7 @@ gem 'gitlab_omniauth-ldap', '1.0.3', require: "omniauth-ldap" gem "gitlab-pygments.rb", '~> 0.3.2', require: 'pygments.rb' # Git Wiki -gem "gitlab-gollum-lib", "~> 1.0.0", require: 'gollum-lib' +gem "gitlab-gollum-lib", "~> 1.0.1", require: 'gollum-lib' # Language detection gem "github-linguist", require: "linguist" @@ -173,7 +173,7 @@ group :development, :test do gem 'factory_girl_rails' # Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826) - gem 'minitest' + gem 'minitest', '~> 4.7.0' # Generate Fake data gem "ffaker" @@ -203,5 +203,5 @@ group :test do end group :production do - gem "gitlab_meta", '5.0' + gem "gitlab_meta", '6.0' end diff --git a/Gemfile.lock b/Gemfile.lock index c26eeede69f..5d13837b61f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GIT remote: https://github.com/ctran/annotate_models.git - revision: 8bd159c7a484093fde84beaa9e6398f25ddacf09 + revision: 18a4e2eb77c8f3ef695b563e4a7ca45dfede819b specs: - annotate (2.6.0.beta1) + annotate (2.6.0.beta2) activerecord (>= 2.3.0) rake (>= 0.8.7) @@ -42,20 +42,20 @@ GEM activesupport (3.2.13) i18n (= 0.6.1) multi_json (~> 1.0) - acts-as-taggable-on (2.4.0) - rails (~> 3.0) + acts-as-taggable-on (2.4.1) + rails (>= 3, < 5) addressable (2.3.4) arel (3.0.2) asciidoctor (0.1.3) awesome_print (1.1.0) - backports (2.6.7) + backports (3.3.2) bcrypt-ruby (3.0.1) - better_errors (0.8.0) + better_errors (0.9.0) coderay (>= 1.0.0) erubis (>= 2.6.6) - binding_of_caller (0.7.1) + binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bootstrap-sass (2.3.1.0) + bootstrap-sass (2.3.2.0) sass (~> 3.2) builder (3.0.4) capybara (2.1.0) @@ -67,7 +67,7 @@ GEM carrierwave (0.8.0) activemodel (>= 3.2.0) activesupport (>= 3.2.0) - celluloid (0.14.0) + celluloid (0.14.1) timers (>= 1.0.0) charlock_holmes (0.6.9.4) childprocess (0.3.9) @@ -75,7 +75,7 @@ GEM chosen-rails (0.9.8) railties (~> 3.0) thor (~> 0.14) - code_analyzer (0.3.1) + code_analyzer (0.3.2) sexp_processor coderay (1.0.9) coffee-rails (3.2.2) @@ -87,15 +87,16 @@ GEM coffee-script-source (1.6.2) colored (1.2) colorize (0.5.8) - connection_pool (1.0.0) + connection_pool (1.1.0) coveralls (0.6.7) colorize multi_json (~> 1.3) rest-client simplecov (>= 0.7) thor - crack (0.3.2) - d3_rails (3.1.4) + crack (0.4.0) + safe_yaml (~> 0.9.0) + d3_rails (3.1.10) railties (>= 3.1.0) daemons (1.1.9) database_cleaner (1.0.1) @@ -107,11 +108,11 @@ GEM railties (~> 3.1) warden (~> 1.2.1) diff-lcs (1.2.4) - dotenv (0.7.0) + dotenv (0.8.0) email_spec (1.4.0) launchy (~> 2.1) mail (~> 2.2) - enumerize (0.5.1) + enumerize (0.6.1) activesupport (>= 3.2) erubis (2.7.0) escape_utils (0.2.4) @@ -130,8 +131,8 @@ GEM faraday (>= 0.7.4, < 0.9) faye-websocket (0.4.7) eventmachine (>= 0.12.0) - ffaker (1.16.0) - ffi (1.8.1) + ffaker (1.16.1) + ffi (1.9.0) fog (1.3.1) builder excon (~> 0.13.0) @@ -157,17 +158,17 @@ GEM pygments.rb (>= 0.2.13) github-markdown (0.5.3) github-markup (0.7.5) - gitlab-gollum-lib (1.0.0) + gitlab-gollum-lib (1.0.1) github-markdown (~> 0.5.3) github-markup (>= 0.7.5, < 1.0.0) - gitlab-grit (~> 2.5.1) + gitlab-grit (>= 2.5.1) nokogiri (~> 1.5.9) pygments.rb (~> 0.4.2) sanitize (~> 2.0.3) stringex (~> 1.5.1) gitlab-grack (1.0.1) rack (~> 1.4.1) - gitlab-grit (2.5.1) + gitlab-grit (2.6.0) charlock_holmes (~> 0.6.9) diff-lcs (~> 1.1) mime-types (~> 1.15) @@ -175,17 +176,17 @@ GEM gitlab-pygments.rb (0.3.2) posix-spawn (~> 0.3.6) yajl-ruby (~> 1.1.0) - gitlab_git (1.3.0) + gitlab_git (1.4.1) activesupport (~> 3.2.13) github-linguist (~> 2.3.4) - gitlab-grit (~> 2.5.1) - gitlab_meta (5.0) + gitlab-grit (~> 2.6.0) + gitlab_meta (6.0) gitlab_omniauth-ldap (1.0.3) net-ldap (~> 0.3.1) omniauth (~> 1.0) pyu-ruby-sasl (~> 0.0.3.1) rubyntlm (~> 0.1.1) - gon (4.1.0) + gon (4.1.1) actionpack (>= 2.3.0) json grape (0.4.1) @@ -202,19 +203,19 @@ GEM activesupport multi_json (>= 1.3.2) growl (1.0.3) - guard (1.8.0) + guard (1.8.1) formatador (>= 0.2.4) listen (>= 1.0.0) lumberjack (>= 1.0.2) pry (>= 0.9.10) thor (>= 0.14.6) - guard-rspec (3.0.0) + guard-rspec (3.0.2) guard (>= 1.8) rspec (~> 2.13) guard-spinach (0.0.2) guard (>= 1.1) spinach - haml (4.0.2) + haml (4.0.3) tilt haml-rails (0.4) actionpack (>= 3.1, < 4.1) @@ -222,9 +223,10 @@ GEM haml (>= 3.1, < 4.1) railties (>= 3.1, < 4.1) hashie (1.2.0) - hike (1.2.2) + hike (1.2.3) hipchat (0.9.0) httparty + httparty http_parser.rb (0.5.3) httparty (0.11.0) multi_json (~> 1.0) @@ -255,18 +257,17 @@ GEM actionpack (>= 3.0.0) activesupport (>= 3.0.0) kgio (2.8.0) - launchy (2.2.0) + launchy (2.3.0) addressable (~> 2.3) - letter_opener (1.1.0) - launchy (~> 2.2.0) + letter_opener (1.1.1) + launchy (~> 2.2) libv8 (3.11.8.17) - listen (1.1.3) + listen (1.2.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) rb-kqueue (>= 0.2) lumberjack (1.0.3) - mail (2.5.3) - i18n (>= 0.4.0) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) method_source (0.8.1) @@ -274,15 +275,15 @@ GEM minitest (4.7.4) modernizr (2.6.2) sprockets (~> 2.0) - multi_json (1.7.3) - multi_xml (0.5.3) + multi_json (1.7.7) + multi_xml (0.5.4) multipart-post (1.2.0) mysql2 (0.3.11) net-ldap (0.3.1) net-scp (1.0.4) net-ssh (>= 1.99.1) net-ssh (2.6.8) - nokogiri (1.5.9) + nokogiri (1.5.10) oauth (0.4.7) oauth2 (0.8.1) faraday (~> 0.8) @@ -296,7 +297,7 @@ GEM omniauth-github (1.1.0) omniauth (~> 1.0) omniauth-oauth2 (~> 1.1) - omniauth-google-oauth2 (0.1.17) + omniauth-google-oauth2 (0.1.19) omniauth (~> 1.0) omniauth-oauth2 omniauth-oauth (1.0.1) @@ -305,7 +306,7 @@ GEM omniauth-oauth2 (1.1.1) oauth2 (~> 0.8.0) omniauth (~> 1.0) - omniauth-twitter (0.0.16) + omniauth-twitter (0.0.17) multi_json (~> 1.3) omniauth-oauth (~> 1.0) orm_adapter (0.4.0) @@ -354,7 +355,7 @@ GEM rails-dev-tweaks (0.6.1) actionpack (~> 3.1) railties (~> 3.1) - rails_best_practices (1.13.4) + rails_best_practices (1.13.8) activesupport awesome_print code_analyzer @@ -370,7 +371,7 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) raindrops (0.11.0) - rake (10.0.4) + rake (10.1.0) rb-fsevent (0.9.3) rb-inotify (0.9.0) ffi (>= 0.5.0) @@ -398,7 +399,7 @@ GEM redis-store (~> 1.1.0) redis-store (1.1.3) redis (>= 2.2.0) - ref (1.0.4) + ref (1.0.5) rest-client (1.6.7) mime-types (>= 1.16) rspec (2.13.0) @@ -409,7 +410,7 @@ GEM rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.13.1) - rspec-rails (2.13.1) + rspec-rails (2.13.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -417,9 +418,10 @@ GEM rspec-expectations (~> 2.13.0) rspec-mocks (~> 2.13.0) ruby-hmac (0.4.0) - ruby-progressbar (1.0.2) + ruby-progressbar (1.1.1) rubyntlm (0.1.1) rubyzip (0.9.9) + safe_yaml (0.9.3) sanitize (2.0.3) nokogiri (>= 1.4.4, < 1.6) sass (3.2.9) @@ -433,10 +435,10 @@ GEM seed-fu (2.2.0) activerecord (~> 3.1) activesupport (~> 3.1) - select2-rails (3.3.1) - sass-rails (>= 3.2) + select2-rails (3.4.2) + sass-rails thor (~> 0.14) - selenium-webdriver (2.32.1) + selenium-webdriver (2.33.0) childprocess (>= 0.2.5) multi_json (~> 1.0) rubyzip @@ -445,8 +447,8 @@ GEM sexp_processor (4.2.1) shoulda-matchers (2.1.0) activesupport (>= 3.0.0) - sidekiq (2.12.0) - celluloid (>= 0.14.0) + sidekiq (2.12.4) + celluloid (>= 0.14.1) connection_pool (>= 1.0.0) json redis (>= 3.0) @@ -456,23 +458,23 @@ GEM multi_json (~> 1.0) simplecov-html (~> 0.7.1) simplecov-html (0.7.1) - sinatra (1.3.6) + sinatra (1.4.3) rack (~> 1.4) - rack-protection (~> 1.3) - tilt (~> 1.3, >= 1.3.3) + rack-protection (~> 1.4) + tilt (~> 1.3, >= 1.3.4) six (0.2.0) - slim (1.3.8) - temple (~> 0.6.3) - tilt (~> 1.3.3) + slim (2.0.0) + temple (~> 0.6.5) + tilt (~> 1.3, >= 1.3.3) slop (3.4.5) - spinach (0.8.2) + spinach (0.8.3) colorize (= 0.5.8) gherkin-ruby (~> 0.3.0) spinach-rails (0.2.1) capybara (>= 2.0.0) railties (>= 3) spinach (>= 0.4) - spork (1.0.0rc3) + spork (1.0.0rc2) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -481,7 +483,7 @@ GEM stamp (0.5.0) state_machine (1.2.0) stringex (1.5.1) - temple (0.6.4) + temple (0.6.5) test_after_commit (0.2.0) therubyracer (0.11.4) libv8 (~> 3.11.8.12) @@ -491,7 +493,7 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.18.1) - tilt (1.3.7) + tilt (1.4.1) timers (1.1.0) tinder (1.9.2) eventmachine (~> 1.0) @@ -502,17 +504,17 @@ GEM mime-types (~> 1.19) multi_json (~> 1.5) twitter-stream (~> 0.1) - treetop (1.4.12) + treetop (1.4.14) polyglot polyglot (>= 0.3.1) - turbolinks (1.1.1) + turbolinks (1.2.0) coffee-rails twitter-stream (0.1.16) eventmachine (>= 0.12.8) http_parser.rb (~> 0.5.1) simple_oauth (~> 0.1.4) tzinfo (0.3.37) - uglifier (2.0.1) + uglifier (2.1.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) underscore-rails (1.4.4) @@ -520,8 +522,8 @@ GEM kgio (~> 2.6) rack raindrops (~> 0.7) - virtus (0.5.4) - backports (~> 2.6.1) + virtus (0.5.5) + backports (~> 3.3) descendants_tracker (~> 0.0.1) warden (1.2.1) rack (>= 1.0) @@ -563,11 +565,11 @@ DEPENDENCIES gemoji (~> 1.2.1) github-linguist github-markup (~> 0.7.4) - gitlab-gollum-lib (~> 1.0.0) + gitlab-gollum-lib (~> 1.0.1) gitlab-grack (~> 1.0.1) gitlab-pygments.rb (~> 0.3.2) - gitlab_git (~> 1.3.0) - gitlab_meta (= 5.0) + gitlab_git (~> 1.4.1) + gitlab_meta (= 6.0) gitlab_omniauth-ldap (= 1.0.3) gon grape (~> 0.4.1) @@ -586,7 +588,7 @@ DEPENDENCIES kaminari (~> 0.14.1) launchy letter_opener - minitest + minitest (~> 4.7.0) modernizr (= 2.6.2) mysql2 omniauth (~> 1.1.3) @@ -1,2 +1,2 @@ -web: bundle exec puma -p $PORT +web: bundle exec unicorn_rails -p $PORT -E development worker: bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,common,default,gitlab_shell @@ -1 +1 @@ -5.4.0.rc1 +6.0.0.pre diff --git a/app/assets/images/login-logo.png b/app/assets/images/login-logo.png Binary files differindex 8c064b12dd0..a61c41303c4 100644 --- a/app/assets/images/login-logo.png +++ b/app/assets/images/login-logo.png diff --git a/app/assets/javascripts/blob.js.coffee b/app/assets/javascripts/blob.js.coffee new file mode 100644 index 00000000000..03e280f8976 --- /dev/null +++ b/app/assets/javascripts/blob.js.coffee @@ -0,0 +1,24 @@ +class BlobView + constructor: -> + # See if there are lines selected + # "#L12" and "#L34-56" supported + highlightBlobLines = -> + if window.location.hash isnt "" + matches = window.location.hash.match(/\#L(\d+)(\-(\d+))?/) + first_line = parseInt(matches?[1]) + last_line = parseInt(matches?[3]) + + unless isNaN first_line + last_line = first_line if isNaN(last_line) + $("#tree-content-holder .highlight .line").removeClass("hll") + $("#LC#{line}").addClass("hll") for line in [first_line..last_line] + $("#L#{first_line}").ScrollTo() + + # Highlight the correct lines on load + highlightBlobLines() + + # Highlight the correct lines when the hash part of the URL changes + $(window).on 'hashchange', highlightBlobLines + + +@BlobView = BlobView diff --git a/app/assets/javascripts/dashboard.js.coffee b/app/assets/javascripts/dashboard.js.coffee index c2fb95ca635..8db53039e98 100644 --- a/app/assets/javascripts/dashboard.js.coffee +++ b/app/assets/javascripts/dashboard.js.coffee @@ -8,6 +8,22 @@ class Dashboard @toggleFilter($(event.currentTarget)) @reloadActivities() + $(".dash-filter").keyup -> + terms = $(this).val() + uiBox = $(this).parents('.ui-box').first() + if terms == "" || terms == undefined + uiBox.find(".dash-list li").show() + else + uiBox.find(".dash-list li").each (index) -> + name = $(this).find(".well-title").text() + + if name.toLowerCase().search(terms.toLowerCase()) == -1 + $(this).hide() + else + $(this).show() + + + reloadActivities: -> $(".content_list").html '' Pager.init 20, true diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index 130db5bfdbb..890b6a0ade2 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -16,20 +16,26 @@ class Dispatcher path = page.split(':') switch page - when 'issues:index' + when 'projects:issues:index' Issues.init() when 'dashboard:show' new Dashboard() - when 'commit:show' + when 'projects:commit:show' new Commit() - when 'groups:show', 'teams:show', 'projects:show' + when 'groups:show', 'projects:show' Pager.init(20, true) when 'projects:new', 'projects:edit' new Project() - when 'walls:show' + when 'projects:walls:show' new Wall(project_id) - when 'teams:members:index' + when 'projects:teams:members:index' new TeamMembers() + when 'groups:people' + new GroupMembers() + when 'projects:tree:show' + new TreeView() + when 'projects:blob:show' + new BlobView() switch path.first() when 'admin' then new Admin() diff --git a/app/assets/javascripts/groups.js.coffee b/app/assets/javascripts/groups.js.coffee new file mode 100644 index 00000000000..c0ffccd8f70 --- /dev/null +++ b/app/assets/javascripts/groups.js.coffee @@ -0,0 +1,6 @@ +class GroupMembers + constructor: -> + $('li.users_group').bind 'ajax:success', -> + $(this).fadeOut() + +@GroupMembers = GroupMembers diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee index fd7e296efde..0e7e0a4de13 100644 --- a/app/assets/javascripts/main.js.coffee +++ b/app/assets/javascripts/main.js.coffee @@ -50,11 +50,12 @@ window.startSpinner = -> window.stopSpinner = -> $('.turbolink-spinner').fadeOut() -window.stopEndlessScroll = -> +window.unbindEvents = -> $(document).unbind('scroll') + $(document).off('scroll') document.addEventListener("page:fetch", startSpinner) -document.addEventListener("page:fetch", stopEndlessScroll) +document.addEventListener("page:fetch", unbindEvents) document.addEventListener("page:receive", stopSpinner) $ -> @@ -66,7 +67,6 @@ $ -> $('.appear-data').fadeIn() e.preventDefault() - # Initialize chosen selects $('select.chosen').chosen() @@ -110,6 +110,10 @@ $ -> when 115 $("#search").focus() e.preventDefault() + when 63 + new Shortcuts() + e.preventDefault() + # Commit show suppressed diff $(".supp_diff_link").bind "click", -> diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 62961b529fd..6dfe722a5e8 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -1,5 +1,5 @@ var NoteList = { - + id: null, notes_path: null, target_params: null, target_id: 0, @@ -16,6 +16,22 @@ var NoteList = { // get initial set of notes NoteList.getContent(); + // Unbind events to prevent firing twice + $(document).off("click", ".js-add-diff-note-button"); + $(document).off("click", ".js-discussion-reply-button"); + $(document).off("click", ".js-note-preview-button"); + $(document).off("click", ".js-note-attachment-input"); + $(document).off("click", ".js-close-discussion-note-form"); + $(document).off("click", ".js-note-delete"); + $(document).off("click", ".js-note-edit"); + $(document).off("click", ".js-note-edit-cancel"); + $(document).off("click", ".js-note-attachment-delete"); + $(document).off("click", ".js-choose-note-attachment-button"); + $(document).off("click", ".js-show-outdated-discussion"); + + $(document).off("ajax:complete", ".js-main-target-form"); + + // add a new diff note $(document).on("click", ".js-add-diff-note-button", diff --git a/app/assets/javascripts/shortcuts.js.coffee b/app/assets/javascripts/shortcuts.js.coffee new file mode 100644 index 00000000000..e7e40a066ec --- /dev/null +++ b/app/assets/javascripts/shortcuts.js.coffee @@ -0,0 +1,11 @@ +class Shortcuts + constructor: -> + if $('#modal-shortcuts').length > 0 + $('#modal-shortcuts').modal('show') + else + $.ajax( + url: '/help/shortcuts', + dataType: "script" + ) + +@Shortcuts = Shortcuts diff --git a/app/assets/javascripts/stat_graph_contributors.js.coffee b/app/assets/javascripts/stat_graph_contributors.js.coffee index 12dfe4da841..5b4b3dae411 100644 --- a/app/assets/javascripts/stat_graph_contributors.js.coffee +++ b/app/assets/javascripts/stat_graph_contributors.js.coffee @@ -12,14 +12,35 @@ class window.ContributorsStatGraph @master_graph.draw() add_authors_graph: (author_data) -> @authors = [] - _.each(author_data, (d) => + limited_author_data = author_data.slice(0, 100) + _.each(limited_author_data, (d) => author_header = @create_author_header(d) $(".contributors-list").append(author_header) @authors[d.author] = author_graph = new ContributorsAuthorGraph(d.dates) author_graph.draw() ) format_author_commit_info: (author) -> - author.commits + " commits " + author.additions + " ++ / " + author.deletions + " --" + commits = $('<span/>', { + class: 'graph-author-commits-count' + }) + commits.text(author.commits + " commits") + + additions = $('<span/>', { + class: 'graph-additions' + }) + additions.text(author.additions + " ++") + + deletions = $('<span/>', { + class: 'graph-deletions' + }) + deletions.text(author.deletions + " --") + + $('<span/>').append(commits) + .append(" / ") + .append(additions) + .append(" / ") + .append(deletions) + create_author_header: (author) -> list_item = $('<li/>', { class: 'person' @@ -30,7 +51,7 @@ class window.ContributorsStatGraph class: 'commits' }) author_commit_info = @format_author_commit_info(author) - author_commit_info_span.text(author_commit_info) + author_commit_info_span.html(author_commit_info) list_item.append(author_name) list_item.append(author_commit_info_span) list_item @@ -52,10 +73,10 @@ class window.ContributorsStatGraph @field = field change_date_header: -> x_domain = ContributorsGraph.prototype.x_domain - print_date_format = d3.time.format("%B %e %Y"); - print = print_date_format(x_domain[0]) + " - " + print_date_format(x_domain[1]); - $("#date_header").text(print); + print_date_format = d3.time.format("%B %e %Y") + print = print_date_format(x_domain[0]) + " - " + print_date_format(x_domain[1]) + $("#date_header").text(print) redraw_author_commit_info: (author) -> author_list_item = $(@authors[author.author].list_item) author_commit_info = @format_author_commit_info(author) - author_list_item.find("span").text(author_commit_info)
\ No newline at end of file + author_list_item.find("span").html(author_commit_info) diff --git a/app/assets/javascripts/stat_graph_contributors_graph.js.coffee b/app/assets/javascripts/stat_graph_contributors_graph.js.coffee index e7a120fb572..15cf68ff31b 100644 --- a/app/assets/javascripts/stat_graph_contributors_graph.js.coffee +++ b/app/assets/javascripts/stat_graph_contributors_graph.js.coffee @@ -71,7 +71,7 @@ class window.ContributorsMasterGraph extends ContributorsGraph super @width, @height create_axes: -> @x_axis = d3.svg.axis().scale(@x).orient("bottom") - @y_axis = d3.svg.axis().scale(@y).orient("left") + @y_axis = d3.svg.axis().scale(@y).orient("left").ticks(5) create_svg: -> @svg = d3.select("#contributors-master").append("svg") .attr("width", @width + @MARGIN.left + @MARGIN.right) @@ -130,8 +130,8 @@ class window.ContributorsAuthorGraph extends ContributorsGraph create_scale: -> super @width, @height create_axes: -> - @x_axis = d3.svg.axis().scale(@x).orient("bottom").tickFormat(d3.time.format("%m/%d")); - @y_axis = d3.svg.axis().scale(@y).orient("left") + @x_axis = d3.svg.axis().scale(@x).orient("bottom").ticks(8) + @y_axis = d3.svg.axis().scale(@y).orient("left").ticks(5) create_area: (x, y) -> @area = d3.svg.area().x((d) -> parseDate = d3.time.format("%Y-%m-%d").parse @@ -148,7 +148,7 @@ class window.ContributorsAuthorGraph extends ContributorsGraph .append("g") .attr("transform", "translate(" + @MARGIN.left + "," + @MARGIN.top + ")") draw_path: (data) -> - @svg.append("path").datum(data).attr("class", "area-contributor").attr("d", @area); + @svg.append("path").datum(data).attr("class", "area-contributor").attr("d", @area) draw: -> @create_scale() @create_axes() diff --git a/app/assets/javascripts/tree.js.coffee b/app/assets/javascripts/tree.js.coffee index fdc82ff6668..4852e879b68 100644 --- a/app/assets/javascripts/tree.js.coffee +++ b/app/assets/javascripts/tree.js.coffee @@ -1,29 +1,43 @@ -# Code browser tree slider -# Make the entire tree-item row clickable, but not if clicking another link (like a commit message) -$(".tree-content-holder .tree-item").live 'click', (e) -> - if (e.target.nodeName != "A") - path = $('.tree-item-file-name a', this).attr('href') - Turbolinks.visit(path) +class TreeView + constructor: -> + @initKeyNav() -$ -> - # Show the "Loading commit data" for only the first element - $('span.log_loading:first').removeClass('hide') + # Code browser tree slider + # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) + $(".tree-content-holder .tree-item").on 'click', (e) -> + if (e.target.nodeName != "A") + path = $('.tree-item-file-name a', this).attr('href') + Turbolinks.visit(path) - # See if there are lines selected - # "#L12" and "#L34-56" supported - highlightBlobLines = -> - if window.location.hash isnt "" - matches = window.location.hash.match(/\#L(\d+)(\-(\d+))?/) - first_line = parseInt(matches?[1]) - last_line = parseInt(matches?[3]) + # Show the "Loading commit data" for only the first element + $('span.log_loading:first').removeClass('hide') - unless isNaN first_line - last_line = first_line if isNaN(last_line) - $("#tree-content-holder .highlight .line").removeClass("hll") - $("#LC#{line}").addClass("hll") for line in [first_line..last_line] - $("#L#{first_line}").ScrollTo() + initKeyNav: -> + li = $("tr.tree-item") + liSelected = null + $('body').keydown (e) -> + if e.which is 40 + if liSelected + next = liSelected.next() + if next.length > 0 + liSelected.removeClass "selected" + liSelected = next.addClass("selected") + else + liSelected = li.eq(0).addClass("selected") - # Highlight the correct lines on load - highlightBlobLines() - # Highlight the correct lines when the hash part of the URL changes - $(window).on 'hashchange', highlightBlobLines + $(liSelected).focus() + else if e.which is 38 + if liSelected + next = liSelected.prev() + if next.length > 0 + liSelected.removeClass "selected" + liSelected = next.addClass("selected") + else + liSelected = li.last().addClass("selected") + + $(liSelected).focus() + else if e.which is 13 + path = $('.tree-item.selected .tree-item-file-name a').attr('href') + Turbolinks.visit(path) + +@TreeView = TreeView diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 8c76b4baa22..16d14a3c9e2 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -206,17 +206,6 @@ p.time { } } -.arrow{ - background: #E3E5EA; - padding: 5px; - margin-top: 5px; - @include border-radius(5px); - text-shadow: none; - color: #999; - line-height: 16px; - font-weight: bold; -} - .thin_area{ height: 150px; } @@ -311,14 +300,17 @@ li.note { } } -.error_message { - @extend .cred; - border-left: 4px solid #E99; +.error-message { padding: 10px; - margin-bottom: 10px; - background: #FEE; + background: #C67; padding-left: 20px; + margin: 0; + color: #FFF; + a { + color: #fff; + text-decoration: underline; + } &.centered { text-align: center; } diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss index d2460c5f022..4a77e166e67 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/common.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss @@ -87,3 +87,10 @@ fieldset legend { font-size: 17px; } color: #333; text-shadow: 0 1px 1px #FFF; } + +pre.well-pre { + border: 1px solid #EEE; + background: #f9f9f9; + border-radius: 0; + color: #555; +} diff --git a/app/assets/stylesheets/gitlab_bootstrap/lists.scss b/app/assets/stylesheets/gitlab_bootstrap/lists.scss index e661e02623e..0fa4da44de5 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/lists.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/lists.scss @@ -16,6 +16,12 @@ color: #888; } + &.unstyled { + &:hover { + background: none; + } + } + &.smoke { background-color: #f5f5f5; } &:hover { diff --git a/app/assets/stylesheets/gitlab_bootstrap/nav.scss b/app/assets/stylesheets/gitlab_bootstrap/nav.scss index 847c7180ce2..de077303617 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/nav.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/nav.scss @@ -22,6 +22,13 @@ color: $style_color; font-weight: bold; } + + &.nav-stacked-menu { + background: #FAFAFA; + li > a { + padding: 20px; + } + } } } diff --git a/app/assets/stylesheets/sections/dashboard.scss b/app/assets/stylesheets/sections/dashboard.scss index 9bc4a09a097..cab6dd807de 100644 --- a/app/assets/stylesheets/sections/dashboard.scss +++ b/app/assets/stylesheets/sections/dashboard.scss @@ -7,28 +7,13 @@ @extend .pull-right; .ui-box { - margin: 3px; + margin: 0px; + box-shadow: none; + > .title { padding: 2px 15px; } .nav-projects-tabs li { padding: 0; } - .well-list { - li { padding: 15px; } - .arrow { - float: right; - padding: 10px; - margin: 0; - } - .last_activity { - padding-top: 5px; - display: block; - span, strong { - font-size: 12px; - color: #666; - } - } - } - @extend .ui-box; } } } @@ -46,3 +31,72 @@ } } +.dashboard { + .dash-filter { + margin: 0; + padding: 4px 6px; + width: 202px; + float: left; + margin-top: 3px; + margin-left: -2px; + } +} + +@media (max-width: 1200px) { + .dashboard .dash-filter { + width: 132px; + } +} + +.dash-sidebar-tabs { + margin-bottom: 2px; + border: none; + margin: 0; + + li { + &.active { + a { + @include linear-gradient(#f5f5f5, #eee); + border-bottom: 1px solid #EEE !important; + &:hover { + background: #eee; + } + } + } + + a { + border-color: #CCC !important; + } + } +} + +.project-row, .group-row { + padding: 15px !important; + + .namespace-name { + color: #666; + font-weight: bold; + } + + .project-name, .group-name { + font-size: 16px; + } + + + .arrow { + float: right; + padding: 10px 5px; + margin: 0; + font-size: 20px; + color: #666; + } + + .last-activity, .owner-info { + color: #AAA; + display: block; + margin-top: 5px; + .date, .owner { + color: #777; + } + } +} diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss index d057bcf669c..b1dc597f201 100644 --- a/app/assets/stylesheets/sections/events.scss +++ b/app/assets/stylesheets/sections/events.scss @@ -41,6 +41,8 @@ } } .event-body { + margin-left: 35px; + .commit p { color: #666; padding-top: 5px; @@ -51,7 +53,6 @@ .event-note { color: #555; margin-top: 5px; - margin-left: 40px; pre { border: none; @@ -77,10 +78,6 @@ margin-right: 5px; } } - .avatar { - position: relative; - top: -3px; - } .event_icon { position: relative; float: right; @@ -95,11 +92,10 @@ } } ul { - margin-left: 50px; margin-bottom: 5px; .avatar { width: 18px; - margin-top: 3px; + margin: 2px 4px; } } @@ -118,7 +114,12 @@ } &.commits-stat { display: block; - margin-top: 5px; + padding: 3px; + margin-top: 3px; + + &:hover { + background: none; + } } } } diff --git a/app/assets/stylesheets/sections/graph.scss b/app/assets/stylesheets/sections/graph.scss index 9be4cb788c1..dd5d638b721 100644 --- a/app/assets/stylesheets/sections/graph.scss +++ b/app/assets/stylesheets/sections/graph.scss @@ -1,15 +1,15 @@ -.graph_holder { +.graph_holder { border: 1px solid #aaa; padding: 1px; - h4 { + h4 { padding: 0 10px; border-bottom: 1px solid #bbb; @include bg-gray-gradient; } - .graph { + .graph { background: #f1f1f1; height: 500px; overflow-y: scroll; @@ -17,3 +17,16 @@ } } +.graphs { + .graph-author-commits-count { + } + + .graph-additions { + color: #4a2; + } + + .graph-deletions { + color: #d12f19; + } +} + diff --git a/app/assets/stylesheets/sections/header.scss b/app/assets/stylesheets/sections/header.scss index 38c08814224..98c010ed72d 100644 --- a/app/assets/stylesheets/sections/header.scss +++ b/app/assets/stylesheets/sections/header.scss @@ -120,7 +120,7 @@ header { border-bottom: 1px solid #AAA; .nav > li > a { - color: #DDD; + color: #AAA; text-shadow: 0 1px 0 #444; &:hover { @@ -130,6 +130,10 @@ header { } } + .turbolink-spinner { + color: #FFF; + } + .search { .search-input { background-color: #D2D5DA; @@ -156,7 +160,10 @@ header { } .project_name { a { - color: #FFF; + color: #DDD; + &:hover { + color: #FFF; + } } color: #fff; text-shadow: 0 1px 1px #444; diff --git a/app/assets/stylesheets/sections/login.scss b/app/assets/stylesheets/sections/login.scss index e3fe0b436c3..e6fbc837d9e 100644 --- a/app/assets/stylesheets/sections/login.scss +++ b/app/assets/stylesheets/sections/login.scss @@ -1,6 +1,6 @@ /* Login Page */ body.login-page{ - background: #EEE; + background: #474D57; .container .content { padding-top: 5%; } } diff --git a/app/assets/stylesheets/sections/nav.scss b/app/assets/stylesheets/sections/nav.scss index 7b7bcf807b5..7d09f548589 100644 --- a/app/assets/stylesheets/sections/nav.scss +++ b/app/assets/stylesheets/sections/nav.scss @@ -1,13 +1,13 @@ .main-nav { + background: #f5f5f5; margin: 30px 0; - margin-top: 10px; + margin-top: 0; + padding-top: 4px; border-bottom: 1px solid #E1E1E1; ul { margin: auto; - height: 39px; - position: relative; - top: 3px; + height: 40px; overflow: hidden; .count { font-weight: normal; @@ -33,10 +33,29 @@ display: table-cell; width: 1%; &.active { - border-bottom: 3px solid #777; a { color: $style_color; font-weight: bolder; + + &:after { + content: ''; + display: block; + position: relative; + bottom: 8px; + left: 50%; + width: 0; + height: 0; + border-color: transparent transparent #777 transparent; + border-style: solid; + border-width: 6px; + margin-left: -6px; + } + } + } + + &:hover { + a { + color: $style_color; } } @@ -54,11 +73,13 @@ display: block; text-align: center; font-weight: normal; - height: 36px; + height: 38px; line-height: 34px; color: #777; text-shadow: 0 1px 1px white; padding: 0 10px; + text-decoration: none; + padding-top: 2px; } } } diff --git a/app/assets/stylesheets/sections/themes.scss b/app/assets/stylesheets/sections/themes.scss index 4e5eaf575ae..c5487f9f40c 100644 --- a/app/assets/stylesheets/sections/themes.scss +++ b/app/assets/stylesheets/sections/themes.scss @@ -27,15 +27,15 @@ } &.modern { - background: #567; + background: #345; } &.gray { - background: #708090; + background: #373737; } &.violet { - background: #657; + background: #547; } } } diff --git a/app/assets/stylesheets/sections/tree.scss b/app/assets/stylesheets/sections/tree.scss index ffde6aa3fa6..d8f32e49c2d 100644 --- a/app/assets/stylesheets/sections/tree.scss +++ b/app/assets/stylesheets/sections/tree.scss @@ -23,6 +23,14 @@ } cursor: pointer; } + + &.selected { + td { + background: $hover; + border-top: 1px solid #ADF; + border-bottom: 1px solid #ADF; + } + } } } diff --git a/app/assets/stylesheets/themes/ui_basic.scss b/app/assets/stylesheets/themes/ui_basic.scss index b0ee94ef34a..30f0bbaf4c8 100644 --- a/app/assets/stylesheets/themes/ui_basic.scss +++ b/app/assets/stylesheets/themes/ui_basic.scss @@ -8,4 +8,8 @@ background: #F9F9F9; border-left: 1px solid #DDD; } + + .main-nav { + background: #FFF; + } } diff --git a/app/assets/stylesheets/themes/ui_color.scss b/app/assets/stylesheets/themes/ui_color.scss index d7a554ff9e5..07e854b73d8 100644 --- a/app/assets/stylesheets/themes/ui_color.scss +++ b/app/assets/stylesheets/themes/ui_color.scss @@ -16,15 +16,15 @@ @extend .header-dark; &.navbar-gitlab { .navbar-inner { - background: #657; + background: #547; .app_logo { &:hover { - background-color: #6A5A7A; + background-color: #435; } } .separator { - background: #546; - border-left: 1px solid #706080; + background: #435; + border-left: 1px solid #658; } } } diff --git a/app/assets/stylesheets/themes/ui_gray.scss b/app/assets/stylesheets/themes/ui_gray.scss index f0547c72157..4f88c631e4d 100644 --- a/app/assets/stylesheets/themes/ui_gray.scss +++ b/app/assets/stylesheets/themes/ui_gray.scss @@ -16,15 +16,15 @@ @extend .header-dark; &.navbar-gitlab { .navbar-inner { - background: #708090; + background: #373737; .app_logo { &:hover { - background-color: #6A7A8A; + background-color: #272727; } } .separator { - background: #607080; - border-left: 1px solid #8090A0; + background: #272727; + border-left: 1px solid #474747; } } } diff --git a/app/assets/stylesheets/themes/ui_modern.scss b/app/assets/stylesheets/themes/ui_modern.scss index a5bf414c443..68318f93016 100644 --- a/app/assets/stylesheets/themes/ui_modern.scss +++ b/app/assets/stylesheets/themes/ui_modern.scss @@ -16,15 +16,15 @@ @extend .header-dark; &.navbar-gitlab { .navbar-inner { - background: #567; + background: #345; .app_logo { &:hover { - background-color: #516171; + background-color: #234; } } .separator { - background: #456; - border-left: 1px solid #678; + background: #234; + border-left: 1px solid #456; } } } diff --git a/app/contexts/projects/create_context.rb b/app/contexts/projects/create_context.rb index d3b8dee3948..aee3c1c566c 100644 --- a/app/contexts/projects/create_context.rb +++ b/app/contexts/projects/create_context.rb @@ -33,7 +33,7 @@ module Projects # Find matching namespace and check if it allowed # for current user if namespace_id passed. if allowed_namespace?(current_user, namespace_id) - @project.namespace_id = namespace_id unless namespace_id == Namespace.global_id + @project.namespace_id = namespace_id else deny_namespace return @project @@ -48,6 +48,7 @@ module Projects # Import project from cloneable resource if @project.valid? && @project.import_url.present? shell = Gitlab::Shell.new + if shell.import_repository(@project.path_with_namespace, @project.import_url) # We should create satellite for imported repo @project.satellite.create unless @project.satellite.exists? @@ -59,7 +60,11 @@ module Projects end if @project.save - @project.users_projects.create(project_access: UsersProject::MASTER, user: current_user) + unless @project.group + @project.users_projects.create(project_access: UsersProject::MASTER, user: current_user) + end + + @project.discover_default_branch end @project @@ -75,12 +80,8 @@ module Projects end def allowed_namespace?(user, namespace_id) - if namespace_id == Namespace.global_id - return user.admin - else - namespace = Namespace.find_by_id(namespace_id) - current_user.can?(:manage_namespace, namespace) - end + namespace = Namespace.find_by_id(namespace_id) + current_user.can?(:manage_namespace, namespace) end end end diff --git a/app/contexts/projects/transfer_context.rb b/app/contexts/projects/transfer_context.rb index aed396a5da5..3011984e3f8 100644 --- a/app/contexts/projects/transfer_context.rb +++ b/app/contexts/projects/transfer_context.rb @@ -5,12 +5,7 @@ module Projects allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin if allowed_transfer && namespace_id.present? - if namespace_id == Namespace.global_id - if project.namespace.present? - # Transfer to global namespace from anyone - project.transfer(nil) - end - elsif namespace_id.to_i != project.namespace_id + if namespace_id.to_i != project.namespace_id # Transfer to someone namespace namespace = Namespace.find(namespace_id) project.transfer(namespace) diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 749c8fbecef..a2201f732e6 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -25,7 +25,7 @@ class Admin::GroupsController < Admin::ApplicationController if @group.save redirect_to [:admin, @group], notice: 'Group was successfully created.' else - render action: "new" + render "new" end end @@ -34,42 +34,23 @@ class Admin::GroupsController < Admin::ApplicationController owner_id =group_params.delete(:owner_id) if owner_id - @group.owner = User.find(owner_id) + @group.change_owner(User.find(owner_id)) end if @group.update_attributes(group_params) redirect_to [:admin, @group], notice: 'Group was successfully updated.' else - render action: "edit" + render "edit" end end - def project_update - project_ids = params[:project_ids] - - Project.where(id: project_ids).each do |project| - project.transfer(@group) - end - - redirect_to :back, notice: 'Group was successfully updated.' - end - - def remove_project - @project = Project.find(params[:project_id]) - @project.transfer(nil) - - redirect_to :back, notice: 'Group was successfully updated.' - end - def project_teams_update - @group.add_users_to_project_teams(params[:user_ids].split(','), params[:project_access]) + @group.add_users(params[:user_ids].split(','), params[:group_access]) redirect_to [:admin, @group], notice: 'Users were successfully added.' end def destroy - @group.truncate_teams - @group.destroy redirect_to admin_groups_path, notice: 'Group was successfully deleted.' diff --git a/app/controllers/admin/members_controller.rb b/app/controllers/admin/members_controller.rb new file mode 100644 index 00000000000..d9201930501 --- /dev/null +++ b/app/controllers/admin/members_controller.rb @@ -0,0 +1,9 @@ +class Admin::MembersController < Admin::ApplicationController + def destroy + user = User.find_by_username(params[:id]) + project = Project.find_with_namespace(params[:project_id]) + project.users_projects.where(user_id: user).first.destroy + + redirect_to :back + end +end diff --git a/app/controllers/admin/projects/application_controller.rb b/app/controllers/admin/projects/application_controller.rb deleted file mode 100644 index b3f1539f387..00000000000 --- a/app/controllers/admin/projects/application_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Provides a base class for Admin controllers to subclass -# -# Automatically sets the layout and ensures an administrator is logged in -class Admin::Projects::ApplicationController < Admin::ApplicationController - - protected - - def project - @project ||= Project.find_with_namespace(params[:project_id]) - end -end diff --git a/app/controllers/admin/projects/members_controller.rb b/app/controllers/admin/projects/members_controller.rb deleted file mode 100644 index d9c0d572bb1..00000000000 --- a/app/controllers/admin/projects/members_controller.rb +++ /dev/null @@ -1,32 +0,0 @@ -class Admin::Projects::MembersController < Admin::Projects::ApplicationController - def edit - @member = team_member - @project = project - @team_member_relation = team_member_relation - end - - def update - if team_member_relation.update_attributes(params[:team_member]) - redirect_to [:admin, project], notice: 'Project Access was successfully updated.' - else - render action: "edit" - end - end - - def destroy - team_member_relation.destroy - - redirect_to :back - end - - private - - def team_member - @member ||= project.users.find_by_username(params[:id]) - end - - def team_member_relation - team_member.users_projects.find_by_project_id(project) - end - -end diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index a63c4694a81..088174fd3b8 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -9,13 +9,13 @@ class Admin::ProjectsController < Admin::ApplicationController @projects = @projects.where(public: true) if params[:public_only].present? @projects = @projects.with_push if params[:with_push].present? @projects = @projects.abandoned if params[:abandoned].present? - @projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id @projects = @projects.search(params[:name]) if params[:name].present? @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) end def show @repository = @project.repository + @group = @project.group end protected diff --git a/app/controllers/admin/teams/application_controller.rb b/app/controllers/admin/teams/application_controller.rb deleted file mode 100644 index 8710821454e..00000000000 --- a/app/controllers/admin/teams/application_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Provides a base class for Admin controllers to subclass -# -# Automatically sets the layout and ensures an administrator is logged in -class Admin::Teams::ApplicationController < Admin::ApplicationController - - private - - def user_team - @team = UserTeam.find_by_path(params[:team_id]) - end -end diff --git a/app/controllers/admin/teams/members_controller.rb b/app/controllers/admin/teams/members_controller.rb deleted file mode 100644 index 590617f67c9..00000000000 --- a/app/controllers/admin/teams/members_controller.rb +++ /dev/null @@ -1,40 +0,0 @@ -class Admin::Teams::MembersController < Admin::Teams::ApplicationController - def new - @users = User.potential_team_members(user_team) - end - - def create - unless params[:user_ids].blank? - user_ids = params[:user_ids] - access = params[:default_project_access] - is_admin = params[:group_admin] - user_team.add_members(user_ids, access, is_admin) - end - - redirect_to admin_team_path(user_team), notice: 'Members were successfully added into Team of users.' - end - - def edit - team_member - end - - def update - options = {default_projects_access: params[:default_project_access], group_admin: params[:group_admin]} - if user_team.update_membership(team_member, options) - redirect_to admin_team_path(user_team), notice: "Membership for #{team_member.name} was successfully updated in Team of users." - else - render :edit - end - end - - def destroy - user_team.remove_member(team_member) - redirect_to admin_team_path(user_team), notice: "Member #{team_member.name} was successfully removed from Team of users." - end - - protected - - def team_member - @member ||= user_team.members.find_by_username(params[:id]) - end -end diff --git a/app/controllers/admin/teams/projects_controller.rb b/app/controllers/admin/teams/projects_controller.rb deleted file mode 100644 index 687f8f68bf2..00000000000 --- a/app/controllers/admin/teams/projects_controller.rb +++ /dev/null @@ -1,41 +0,0 @@ -class Admin::Teams::ProjectsController < Admin::Teams::ApplicationController - def new - @projects = Project.scoped - @projects = @projects.without_team(user_team) if user_team.projects.any? - #@projects.reject!(&:empty_repo?) - end - - def create - unless params[:project_ids].blank? - project_ids = params[:project_ids] - access = params[:greatest_project_access] - user_team.assign_to_projects(project_ids, access) - end - - redirect_to admin_team_path(user_team), notice: 'Team of users was successfully assigned to projects.' - end - - def edit - team_project - end - - def update - if user_team.update_project_access(team_project, params[:greatest_project_access]) - redirect_to admin_team_path(user_team), notice: 'Access was successfully updated.' - else - render :edit - end - end - - def destroy - user_team.resign_from_project(team_project) - redirect_to admin_team_path(user_team), notice: 'Team of users was successfully reassigned from project.' - end - - protected - - def team_project - @project ||= user_team.projects.find_with_namespace(params[:id]) - end - -end diff --git a/app/controllers/admin/teams_controller.rb b/app/controllers/admin/teams_controller.rb deleted file mode 100644 index 786957cbc59..00000000000 --- a/app/controllers/admin/teams_controller.rb +++ /dev/null @@ -1,59 +0,0 @@ -class Admin::TeamsController < Admin::ApplicationController - def index - @teams = UserTeam.order('name ASC') - @teams = @teams.search(params[:name]) if params[:name].present? - @teams = @teams.page(params[:page]).per(20) - end - - def show - user_team - end - - def new - @team = UserTeam.new - end - - def edit - user_team - end - - def create - @team = UserTeam.new(params[:user_team]) - @team.path = @team.name.dup.parameterize if @team.name - @team.owner = current_user - - if @team.save - redirect_to admin_team_path(@team), notice: 'Team of users was successfully created.' - else - render action: "new" - end - end - - def update - user_team_params = params[:user_team].dup - owner_id = user_team_params.delete(:owner_id) - - if owner_id - user_team.owner = User.find(owner_id) - end - - if user_team.update_attributes(user_team_params) - redirect_to admin_team_path(user_team), notice: 'Team of users was successfully updated.' - else - render action: "edit" - end - end - - def destroy - user_team.destroy - - redirect_to admin_teams_path, notice: 'Team of users was successfully deleted.' - end - - protected - - def user_team - @team ||= UserTeam.find_by_path(params[:id]) - end - -end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index ec3209fdfe2..62b9fe08091 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,43 +1,27 @@ class Admin::UsersController < Admin::ApplicationController - before_filter :admin_user, only: [:show, :edit, :update, :destroy] + before_filter :user, only: [:show, :edit, :update, :destroy] def index - @admin_users = User.scoped - @admin_users = @admin_users.filter(params[:filter]) - @admin_users = @admin_users.search(params[:name]) if params[:name].present? - @admin_users = @admin_users.alphabetically.page(params[:page]) + @users = User.scoped + @users = @users.filter(params[:filter]) + @users = @users.search(params[:name]) if params[:name].present? + @users = @users.alphabetically.page(params[:page]) end def show - # Projects user can be added to - @not_in_projects = Project.scoped - @not_in_projects = @not_in_projects.without_user(admin_user) if admin_user.authorized_projects.present? - - # Projects he already own or joined - @projects = admin_user.authorized_projects + @projects = user.authorized_projects end - def team_update - UsersProject.add_users_into_projects( - params[:project_ids], - [admin_user.id], - params[:project_access] - ) - - redirect_to [:admin, admin_user], notice: 'Teams were successfully updated.' - end - - def new - @admin_user = User.new.with_defaults + @user = User.new.with_defaults end def edit - admin_user + user end def block - if admin_user.block + if user.block redirect_to :back, alert: "Successfully blocked" else redirect_to :back, alert: "Error occured. User was not blocked" @@ -45,7 +29,7 @@ class Admin::UsersController < Admin::ApplicationController end def unblock - if admin_user.activate + if user.activate redirect_to :back, alert: "Successfully unblocked" else redirect_to :back, alert: "Error occured. User was not unblocked" @@ -60,17 +44,17 @@ class Admin::UsersController < Admin::ApplicationController password_expires_at: Time.now } - @admin_user = User.new(params[:user].merge(opts), as: :admin) - @admin_user.admin = (admin && admin.to_i > 0) - @admin_user.created_by_id = current_user.id + @user = User.new(params[:user].merge(opts), as: :admin) + @user.admin = (admin && admin.to_i > 0) + @user.created_by_id = current_user.id respond_to do |format| - if @admin_user.save - format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully created.' } - format.json { render json: @admin_user, status: :created, location: @admin_user } + if @user.save + format.html { redirect_to [:admin, @user], notice: 'User was successfully created.' } + format.json { render json: @user, status: :created, location: @user } else - format.html { render action: "new" } - format.json { render json: @admin_user.errors, status: :unprocessable_entity } + format.html { render "new" } + format.json { render json: @user.errors, status: :unprocessable_entity } end end end @@ -83,26 +67,26 @@ class Admin::UsersController < Admin::ApplicationController params[:user].delete(:password_confirmation) end - admin_user.admin = (admin && admin.to_i > 0) + user.admin = (admin && admin.to_i > 0) respond_to do |format| - if admin_user.update_attributes(params[:user], as: :admin) - format.html { redirect_to [:admin, admin_user], notice: 'User was successfully updated.' } + if user.update_attributes(params[:user], as: :admin) + format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' } format.json { head :ok } else # restore username to keep form action url. - admin_user.username = params[:id] - format.html { render action: "edit" } - format.json { render json: admin_user.errors, status: :unprocessable_entity } + user.username = params[:id] + format.html { render "edit" } + format.json { render json: user.errors, status: :unprocessable_entity } end end end def destroy - if admin_user.personal_projects.count > 0 + if user.personal_projects.count > 0 redirect_to admin_users_path, alert: "User is a project owner and can't be removed." and return end - admin_user.destroy + user.destroy respond_to do |format| format.html { redirect_to admin_users_path } @@ -112,7 +96,7 @@ class Admin::UsersController < Admin::ApplicationController protected - def admin_user - @admin_user ||= User.find_by_username!(params[:id]) + def user + @user ||= User.find_by_username!(params[:id]) end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fda05feefc0..e84220c1e57 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -95,14 +95,6 @@ class ApplicationController < ActionController::Base return access_denied! unless can?(current_user, :create_team, nil) end - def authorize_manage_user_team! - return access_denied! unless user_team.present? && can?(current_user, :manage_user_team, user_team) - end - - def authorize_admin_user_team! - return access_denied! unless user_team.present? && can?(current_user, :admin_user_team, user_team) - end - def access_denied! render "errors/access_denied", layout: "errors", status: 404 end diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index b74c22b1547..4b9bfcf843b 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,13 +1,12 @@ class DashboardController < ApplicationController respond_to :html - before_filter :load_projects + before_filter :load_projects, except: [:projects] before_filter :event_filter, only: :show def show @groups = current_user.authorized_groups.sort_by(&:human_name) @has_authorized_projects = @projects.count > 0 - @teams = current_user.authorized_teams @projects_count = @projects.count @projects = @projects.limit(20) @@ -27,18 +26,21 @@ class DashboardController < ApplicationController def projects @projects = case params[:scope] when 'personal' then - @projects.personal(current_user) + current_user.namespace.projects when 'joined' then - @projects.joined(current_user) + current_user.authorized_projects.joined(current_user) + when 'owned' then + current_user.owned_projects else - @projects - end + current_user.authorized_projects + end.sorted_by_activity - @projects = @projects.tagged_with(params[:label]) if params[:label].present? @projects = @projects.search(params[:search]) if params[:search].present? - @projects = @projects.page(params[:page]).per(30) - @labels = Project.where(id: @projects.map(&:id)).tags_on(:labels) + @labels = current_user.authorized_projects.tags_on(:labels) + + @projects = @projects.tagged_with(params[:label]) if params[:label].present? + @projects = @projects.page(params[:page]).per(30) end # Get authored or assigned open merge requests diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index e6559b8d8fe..416bfa77af0 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -63,19 +63,8 @@ class GroupsController < ApplicationController def people @project = group.projects.find(params[:project_id]) if params[:project_id] - @users = @project ? @project.users : group.users - @users.sort_by!(&:name) - - if @project - @team_member = @project.users_projects.new - else - @team_member = UsersProject.new - end - end - - def team_members - @group.add_users_to_project_teams(params[:user_ids].split(','), params[:project_access]) - redirect_to people_group_path(@group), notice: 'Users were successfully added.' + @members = group.users_groups.order('group_access DESC') + @users_group = UsersGroup.new end def edit @@ -83,7 +72,7 @@ class GroupsController < ApplicationController def update group_params = params[:group].dup - owner_id =group_params.delete(:owner_id) + owner_id = group_params.delete(:owner_id) if owner_id @group.owner = User.find(owner_id) diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 2958367e0f8..051cbdfaf05 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -12,4 +12,7 @@ class HelpController < ApplicationController not_found! end end + + def shortcuts + end end diff --git a/app/controllers/keys_controller.rb b/app/controllers/profiles/keys_controller.rb index 1a25d834e12..c36dae2abd3 100644 --- a/app/controllers/keys_controller.rb +++ b/app/controllers/profiles/keys_controller.rb @@ -1,9 +1,8 @@ -class KeysController < ApplicationController +class Profiles::KeysController < ApplicationController layout "profile" - respond_to :js, :html def index - @keys = current_user.keys.all + @keys = current_user.keys.order('id DESC').all end def show @@ -12,15 +11,16 @@ class KeysController < ApplicationController def new @key = current_user.keys.new - - respond_with(@key) end def create @key = current_user.keys.new(params[:key]) - @key.save - respond_with(@key) + if @key.save + redirect_to profile_key_path(@key) + else + render 'new' + end end def destroy @@ -28,7 +28,7 @@ class KeysController < ApplicationController @key.destroy respond_to do |format| - format.html { redirect_to keys_url } + format.html { redirect_to profile_keys_url } format.js { render nothing: true } end end diff --git a/app/controllers/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb index 4aa3172912f..5c492aeb49d 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/profiles/notifications_controller.rb @@ -1,9 +1,10 @@ -class NotificationsController < ApplicationController +class Profiles::NotificationsController < ApplicationController layout 'profile' def show @notification = current_user.notification @users_projects = current_user.users_projects + @users_groups = current_user.users_groups end def update @@ -12,6 +13,10 @@ class NotificationsController < ApplicationController @saved = if type == 'global' current_user.notification_level = params[:notification_level] current_user.save + elsif type == 'group' + users_group = current_user.users_groups.find(params[:notification_id]) + users_group.notification_level = params[:notification_level] + users_group.save else users_project = current_user.users_projects.find(params[:notification_id]) users_project.notification_level = params[:notification_level] diff --git a/app/controllers/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb index 0e5b42178a7..432899f857d 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/profiles/passwords_controller.rb @@ -1,4 +1,4 @@ -class PasswordsController < ApplicationController +class Profiles::PasswordsController < ApplicationController layout 'navless' skip_before_filter :check_password_expiration diff --git a/app/controllers/project_resource_controller.rb b/app/controllers/project_resource_controller.rb deleted file mode 100644 index ea78b3ff7c4..00000000000 --- a/app/controllers/project_resource_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class ProjectResourceController < ApplicationController - before_filter :project - before_filter :repository -end diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index 86e4a7cbd6b..1f2a75175cf 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -1,4 +1,5 @@ class Projects::ApplicationController < ApplicationController before_filter :project before_filter :repository + layout 'projects' end diff --git a/app/controllers/blame_controller.rb b/app/controllers/projects/blame_controller.rb index c950af56e26..e58b4507202 100644 --- a/app/controllers/blame_controller.rb +++ b/app/controllers/projects/blame_controller.rb @@ -1,5 +1,5 @@ # Controller for viewing a file's blame -class BlameController < ProjectResourceController +class Projects::BlameController < Projects::ApplicationController include ExtractsPath # Authorize diff --git a/app/controllers/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 3547dfe2323..b1329c01ce7 100644 --- a/app/controllers/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -1,5 +1,5 @@ # Controller for viewing a file's blame -class BlobController < ProjectResourceController +class Projects::BlobController < Projects::ApplicationController include ExtractsPath # Authorize diff --git a/app/controllers/commit_controller.rb b/app/controllers/projects/commit_controller.rb index a164de33107..6a2d2315c1d 100644 --- a/app/controllers/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -1,7 +1,7 @@ # Controller for a specific Commit # # Not to be confused with CommitsController, plural. -class CommitController < ProjectResourceController +class Projects::CommitController < Projects::ApplicationController # Authorize before_filter :authorize_read_project! before_filter :authorize_code_access! diff --git a/app/controllers/commits_controller.rb b/app/controllers/projects/commits_controller.rb index cde1f459d76..bdffc940ea5 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/projects/commits_controller.rb @@ -1,6 +1,6 @@ require "base64" -class CommitsController < ProjectResourceController +class Projects::CommitsController < Projects::ApplicationController include ExtractsPath # Authorize diff --git a/app/controllers/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 750e9c2380e..126a2ea50c9 100644 --- a/app/controllers/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -1,4 +1,4 @@ -class CompareController < ProjectResourceController +class Projects::CompareController < Projects::ApplicationController # Authorize before_filter :authorize_read_project! before_filter :authorize_code_access! diff --git a/app/controllers/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb index 35d28becd05..0750e0a146f 100644 --- a/app/controllers/deploy_keys_controller.rb +++ b/app/controllers/projects/deploy_keys_controller.rb @@ -1,9 +1,11 @@ -class DeployKeysController < ProjectResourceController +class Projects::DeployKeysController < Projects::ApplicationController respond_to :html # Authorize before_filter :authorize_admin_project! + layout "project_settings" + def index @enabled_keys = @project.deploy_keys.all @available_keys = available_keys - @enabled_keys diff --git a/app/controllers/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb index 9ed7a2143e4..11c97291296 100644 --- a/app/controllers/edit_tree_controller.rb +++ b/app/controllers/projects/edit_tree_controller.rb @@ -1,5 +1,5 @@ # Controller for edit a repository's file -class EditTreeController < ProjectResourceController +class Projects::EditTreeController < Projects::ApplicationController include ExtractsPath # Authorize diff --git a/app/controllers/graphs_controller.rb b/app/controllers/projects/graphs_controller.rb index 5ae9c15c0f7..252d47d939e 100644 --- a/app/controllers/graphs_controller.rb +++ b/app/controllers/projects/graphs_controller.rb @@ -1,4 +1,4 @@ -class GraphsController < ProjectResourceController +class Projects::GraphsController < Projects::ApplicationController # Authorize before_filter :authorize_read_project! before_filter :authorize_code_access! @@ -8,10 +8,18 @@ class GraphsController < ProjectResourceController respond_to do |format| format.html format.js do - @repo = @project.repository - @stats = Gitlab::Git::GitStats.new(@repo.raw, @repo.root_ref) - @log = @stats.parsed_log.to_json + fetch_graph end end end + + private + + def fetch_graph + @log = @project.repository.graph_log.to_json + @success = true + rescue => ex + @log = [] + @success = false + end end diff --git a/app/controllers/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index b7d25e36252..3367ddb5d14 100644 --- a/app/controllers/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -1,10 +1,12 @@ -class HooksController < ProjectResourceController +class Projects::HooksController < Projects::ApplicationController # Authorize before_filter :authorize_read_project! before_filter :authorize_admin_project!, only: [:new, :create, :destroy] respond_to :html + layout "project_settings" + def index @hooks = @project.hooks.all @hook = ProjectHook.new diff --git a/app/controllers/issues_controller.rb b/app/controllers/projects/issues_controller.rb index ba92ba2bdae..06f8a1233a3 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -1,4 +1,4 @@ -class IssuesController < ProjectResourceController +class Projects::IssuesController < Projects::ApplicationController before_filter :module_enabled before_filter :issue, only: [:edit, :update, :show] @@ -23,7 +23,7 @@ class IssuesController < ProjectResourceController assignee_id, milestone_id = params[:assignee_id], params[:milestone_id] - @assignee = @project.users.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero? + @assignee = @project.team.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero? @milestone = @project.milestones.find(milestone_id) if milestone_id.present? && !milestone_id.to_i.zero? respond_to do |format| diff --git a/app/controllers/labels_controller.rb b/app/controllers/projects/labels_controller.rb index 0e78cecf4d1..65f9e2b9d57 100644 --- a/app/controllers/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -1,4 +1,4 @@ -class LabelsController < ProjectResourceController +class Projects::LabelsController < Projects::ApplicationController before_filter :module_enabled # Allow read any issue diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 17c0392c384..33c1a1feff7 100644 --- a/app/controllers/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -1,6 +1,6 @@ require 'gitlab/satellite/satellite' -class MergeRequestsController < ProjectResourceController +class Projects::MergeRequestsController < Projects::ApplicationController before_filter :module_enabled before_filter :merge_request, only: [:edit, :update, :show, :commits, :diffs, :automerge, :automerge_check, :ci_status] before_filter :validates_merge_request, only: [:show, :diffs] @@ -30,7 +30,6 @@ class MergeRequestsController < ProjectResourceController end def diffs - @diffs = @merge_request.diffs @commit = @merge_request.last_commit @comments_allowed = @reply_allowed = true @@ -54,7 +53,7 @@ class MergeRequestsController < ProjectResourceController @merge_request.reload_code redirect_to [@project, @merge_request], notice: 'Merge request was successfully created.' else - render action: "new" + render "new" end end @@ -64,7 +63,7 @@ class MergeRequestsController < ProjectResourceController @merge_request.mark_as_unchecked redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.' else - render action: "edit" + render "edit" end end diff --git a/app/controllers/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index 25647f97576..f4ee7427d29 100644 --- a/app/controllers/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -1,4 +1,4 @@ -class MilestonesController < ProjectResourceController +class Projects::MilestonesController < Projects::ApplicationController before_filter :module_enabled before_filter :milestone, only: [:edit, :update, :destroy, :show] diff --git a/app/controllers/network_controller.rb b/app/controllers/projects/network_controller.rb index 3c8e747ba4e..e4a84f80787 100644 --- a/app/controllers/network_controller.rb +++ b/app/controllers/projects/network_controller.rb @@ -1,4 +1,4 @@ -class NetworkController < ProjectResourceController +class Projects::NetworkController < Projects::ApplicationController include ExtractsPath include ApplicationHelper diff --git a/app/controllers/notes_controller.rb b/app/controllers/projects/notes_controller.rb index dbec660b761..8214163c315 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -1,4 +1,4 @@ -class NotesController < ProjectResourceController +class Projects::NotesController < Projects::ApplicationController # Authorize before_filter :authorize_read_note! before_filter :authorize_write_note!, only: [:create] diff --git a/app/controllers/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb index fd2734eff84..81531bb0ac0 100644 --- a/app/controllers/protected_branches_controller.rb +++ b/app/controllers/projects/protected_branches_controller.rb @@ -1,4 +1,4 @@ -class ProtectedBranchesController < ProjectResourceController +class Projects::ProtectedBranchesController < Projects::ApplicationController # Authorize before_filter :authorize_read_project! before_filter :require_non_empty_project diff --git a/app/controllers/raw_controller.rb b/app/controllers/projects/raw_controller.rb index 18b401fe611..0d35f373e9c 100644 --- a/app/controllers/raw_controller.rb +++ b/app/controllers/projects/raw_controller.rb @@ -1,5 +1,5 @@ # Controller for viewing a file's raw -class RawController < ProjectResourceController +class Projects::RawController < Projects::ApplicationController include ExtractsPath # Authorize diff --git a/app/controllers/refs_controller.rb b/app/controllers/projects/refs_controller.rb index cae9193a1da..e5c090e1f4d 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -1,4 +1,4 @@ -class RefsController < ProjectResourceController +class Projects::RefsController < Projects::ApplicationController include ExtractsPath # Authorize diff --git a/app/controllers/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index a7d393af82b..b65af029803 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -1,4 +1,4 @@ -class RepositoriesController < ProjectResourceController +class Projects::RepositoriesController < Projects::ApplicationController # Authorize before_filter :authorize_read_project! before_filter :authorize_code_access! diff --git a/app/controllers/services_controller.rb b/app/controllers/projects/services_controller.rb index fcfc4c84a91..6db22186c14 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -1,10 +1,12 @@ -class ServicesController < ProjectResourceController +class Projects::ServicesController < Projects::ApplicationController # Authorize before_filter :authorize_admin_project! before_filter :service, only: [:edit, :update, :test] respond_to :html + layout "project_settings" + def index @project.build_missing_services @services = @project.services.reload diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 1165fa1c583..59063103ecb 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -14,7 +14,7 @@ class Projects::SnippetsController < Projects::ApplicationController # Allow destroy snippet before_filter :authorize_admin_project_snippet!, only: [:destroy] - layout 'project_resource' + layout 'projects' respond_to :html diff --git a/app/controllers/team_members_controller.rb b/app/controllers/projects/team_members_controller.rb index 35aa315dac1..07ad7d86153 100644 --- a/app/controllers/team_members_controller.rb +++ b/app/controllers/projects/team_members_controller.rb @@ -1,14 +1,13 @@ -class TeamMembersController < ProjectResourceController +class Projects::TeamMembersController < Projects::ApplicationController # Authorize before_filter :authorize_read_project! before_filter :authorize_admin_project!, except: [:index, :show] - def index - @team = @project.users_projects.scoped - @team = @team.send(params[:type]) if %w(masters developers reporters guests).include?(params[:type]) - @team = @team.sort_by(&:project_access).reverse.group_by(&:project_access) + layout "project_settings" - @assigned_teams = @project.user_team_project_relationships + def index + @group = @project.group + @users_projects = @project.users_projects.order('project_access DESC') end def new diff --git a/app/controllers/projects/teams_controller.rb b/app/controllers/projects/teams_controller.rb deleted file mode 100644 index c7d51b84fc4..00000000000 --- a/app/controllers/projects/teams_controller.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Projects::TeamsController < Projects::ApplicationController - - before_filter :authorize_admin_team_member! - - def available - @teams = current_user.is_admin? ? UserTeam.scoped : current_user.user_teams - @teams = @teams.without_project(project) - unless @teams.any? - redirect_to project_team_index_path(project), notice: "No available teams for assigment." - end - end - - def assign - unless params[:team_id].blank? - team = UserTeam.find(params[:team_id]) - access = params[:greatest_project_access] - team.assign_to_project(project, access) - end - redirect_to project_team_index_path(project) - end - - def resign - team = project.user_teams.find_by_path(params[:id]) - team.resign_from_project(project) - - redirect_to project_team_index_path(project) - end - - protected - - def user_team - @team ||= UserTeam.find_by_path(params[:id]) - end -end diff --git a/app/controllers/tree_controller.rb b/app/controllers/projects/tree_controller.rb index 24e1329f926..5d543f35665 100644 --- a/app/controllers/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -1,5 +1,5 @@ # Controller for viewing a repository's file structure -class TreeController < ProjectResourceController +class Projects::TreeController < Projects::ApplicationController include ExtractsPath # Authorize diff --git a/app/controllers/walls_controller.rb b/app/controllers/projects/walls_controller.rb index 5993a5e2409..834215a1473 100644 --- a/app/controllers/walls_controller.rb +++ b/app/controllers/projects/walls_controller.rb @@ -1,4 +1,4 @@ -class WallsController < ProjectResourceController +class Projects::WallsController < Projects::ApplicationController before_filter :module_enabled respond_to :js, :html diff --git a/app/controllers/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index be9ae4f37a4..797f3d3dd41 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -1,4 +1,4 @@ -class WikisController < ProjectResourceController +class Projects::WikisController < Projects::ApplicationController before_filter :authorize_read_wiki! before_filter :authorize_write_wiki!, only: [:edit, :create, :history] before_filter :authorize_admin_wiki!, only: :destroy diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index fad681eeef8..34b1d708ba7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,4 +1,4 @@ -class ProjectsController < ProjectResourceController +class ProjectsController < Projects::ApplicationController skip_before_filter :project, only: [:new, :create] skip_before_filter :repository, only: [:new, :create] @@ -15,6 +15,7 @@ class ProjectsController < ProjectResourceController end def edit + render 'edit', layout: "project_settings" end def create @@ -26,7 +27,7 @@ class ProjectsController < ProjectResourceController if @project.saved? redirect_to @project else - render action: "new" + render "new" end end format.js @@ -42,7 +43,7 @@ class ProjectsController < ProjectResourceController format.html { redirect_to edit_project_path(@project), notice: 'Project was successfully updated.' } format.js else - format.html { render action: "edit" } + format.html { render "edit", layout: "project_settings" } format.js end end @@ -89,7 +90,7 @@ class ProjectsController < ProjectResourceController redirect_to(@forked_project, notice: 'Project was successfully forked.') else @title = 'Fork project' - render action: "fork" + render "fork" end end format.js @@ -100,7 +101,7 @@ class ProjectsController < ProjectResourceController @suggestions = { emojis: Emoji.names, issues: @project.issues.select([:id, :title, :description]), - members: @project.users.select([:username, :name]).order(:username) + members: @project.team.members.sort_by(&:username).map { |user| { username: user.username, name: user.name } } } respond_to do |format| diff --git a/app/controllers/teams/application_controller.rb b/app/controllers/teams/application_controller.rb deleted file mode 100644 index fc23202610c..00000000000 --- a/app/controllers/teams/application_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Teams::ApplicationController < ApplicationController - - layout 'user_team' - - before_filter :authorize_manage_user_team! - - protected - - def user_team - @team ||= UserTeam.find_by_path(params[:team_id]) - end - -end diff --git a/app/controllers/teams/members_controller.rb b/app/controllers/teams/members_controller.rb deleted file mode 100644 index 8ef786d1a66..00000000000 --- a/app/controllers/teams/members_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -class Teams::MembersController < Teams::ApplicationController - - skip_before_filter :authorize_manage_user_team!, only: [:index] - - def index - @members = user_team.members - end - - def new - @users = User.potential_team_members(user_team) - end - - def create - unless params[:user_ids].blank? - user_ids = params[:user_ids].split(',') - access = params[:default_project_access] - is_admin = params[:group_admin] - user_team.add_members(user_ids, access, is_admin) - end - - redirect_to team_members_path(user_team), notice: 'Members were successfully added into Team of users.' - end - - def edit - team_member - end - - def update - member_params = params[:team_member] - - options = { - default_projects_access: member_params[:permission], - group_admin: member_params[:group_admin] - } - - if user_team.update_membership(team_member, options) - redirect_to team_members_path(user_team), notice: "Membership for #{team_member.name} was successfully updated in Team of users." - else - render :edit - end - end - - def destroy - user_team.remove_member(team_member) - redirect_to team_path(user_team), notice: "Member #{team_member.name} was successfully removed from Team of users." - end - - protected - - def team_member - @member ||= user_team.members.find_by_username(params[:id]) - end -end diff --git a/app/controllers/teams/projects_controller.rb b/app/controllers/teams/projects_controller.rb deleted file mode 100644 index 81ffa238b46..00000000000 --- a/app/controllers/teams/projects_controller.rb +++ /dev/null @@ -1,40 +0,0 @@ -class Teams::ProjectsController < Teams::ApplicationController - def create - redirect_to :back if params[:project_ids].blank? - - project_ids = params[:project_ids] - access = params[:greatest_project_access] - - # Reject non-allowed projects - allowed_project_ids = current_user.owned_projects.map(&:id) - project_ids.select! { |id| allowed_project_ids.include?(id.to_i) } - - # Assign projects to team - user_team.assign_to_projects(project_ids, access) - - redirect_to edit_team_path(user_team), notice: 'Team of users was successfully assigned to projects.' - end - - def edit - team_project - end - - def update - if user_team.update_project_access(team_project, params[:greatest_project_access]) - redirect_to edit_team_path(user_team), notice: 'Access was successfully updated.' - else - render :edit - end - end - - def destroy - user_team.resign_from_project(team_project) - redirect_to team_projects_path(user_team), notice: 'Team of users was successfully reassigned from project.' - end - - private - - def team_project - @project ||= user_team.projects.find_with_namespace(params[:id]) - end -end diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb deleted file mode 100644 index 57ab2a88e03..00000000000 --- a/app/controllers/teams_controller.rb +++ /dev/null @@ -1,93 +0,0 @@ -class TeamsController < ApplicationController - # Authorize - before_filter :authorize_create_team!, only: [:new, :create] - before_filter :authorize_manage_user_team!, only: [:edit, :update] - before_filter :authorize_admin_user_team!, only: [:destroy] - - before_filter :user_team, except: [:new, :create] - - layout :determine_layout - - before_filter :set_title, only: [:new, :create] - - def show - projects - @events = Event.in_projects(user_team.project_ids).limit(20).offset(params[:offset] || 0) - end - - def edit - projects - @avaliable_projects = current_user.owned_projects.without_team(user_team) - end - - def update - if user_team.update_attributes(params[:user_team]) - redirect_to team_path(user_team) - else - render action: :edit - end - end - - def destroy - user_team.destroy - redirect_to dashboard_path - end - - def new - @team = UserTeam.new - end - - def create - @team = UserTeam.new(params[:user_team]) - @team.owner = current_user unless params[:owner] - @team.path = @team.name.dup.parameterize if @team.name - - if @team.save - # Add current user as Master to the team - @team.add_members([current_user.id], UsersProject::MASTER, true) - - redirect_to team_path(@team) - else - render action: :new - end - end - - # Get authored or assigned open merge requests - def merge_requests - projects - @merge_requests = MergeRequest.of_user_team(user_team) - @merge_requests = FilterContext.new(@merge_requests, params).execute - @merge_requests = @merge_requests.recent.page(params[:page]).per(20) - end - - # Get only assigned issues - def issues - projects - @issues = Issue.of_user_team(user_team) - @issues = FilterContext.new(@issues, params).execute - @issues = @issues.recent.page(params[:page]).per(20) - @issues = @issues.includes(:author, :project) - end - - protected - - def projects - @projects ||= user_team.projects.sorted_by_activity - end - - def user_team - @team ||= current_user.authorized_teams.find_by_path(params[:id]) - end - - def set_title - @title = 'New Team' - end - - def determine_layout - if [:new, :create].include?(action_name.to_sym) - 'navless' - else - 'user_team' - end - end -end diff --git a/app/controllers/users_groups_controller.rb b/app/controllers/users_groups_controller.rb new file mode 100644 index 00000000000..c30034d7d0e --- /dev/null +++ b/app/controllers/users_groups_controller.rb @@ -0,0 +1,40 @@ +class UsersGroupsController < ApplicationController + before_filter :group + + # Authorize + before_filter :authorize_admin_group! + + layout 'group' + + def create + @group.add_users(params[:user_ids].split(','), params[:group_access]) + + redirect_to people_group_path(@group), notice: 'Users were successfully added.' + end + + def update + # TODO: implement + end + + def destroy + @users_group = @group.users_groups.find(params[:id]) + @users_group.destroy unless @users_group.user == @group.owner + + respond_to do |format| + format.html { redirect_to people_group_path(@group), notice: 'User was successfully removed from group.' } + format.js { render nothing: true } + end + end + + protected + + def group + @group ||= Group.find_by_path(params[:group_id]) + end + + def authorize_admin_group! + unless can?(current_user, :manage_group, group) + return render_404 + end + end +end diff --git a/app/helpers/admin/teams/members_helper.rb b/app/helpers/admin/teams/members_helper.rb deleted file mode 100644 index 58b9f1896c4..00000000000 --- a/app/helpers/admin/teams/members_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Admin::Teams::MembersHelper - def member_since(team, member) - team.user_team_user_relationships.find_by_user_id(member).created_at - end -end diff --git a/app/helpers/admin/teams/projects_helper.rb b/app/helpers/admin/teams/projects_helper.rb deleted file mode 100644 index b97cc403337..00000000000 --- a/app/helpers/admin/teams/projects_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Admin::Teams::ProjectsHelper - def assigned_since(team, project) - team.user_team_project_relationships.find_by_project_id(project).created_at - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a73d574f22e..9b10d90fecb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -92,11 +92,10 @@ module ApplicationHelper def search_autocomplete_source projects = current_user.authorized_projects.map { |p| { label: "project: #{simple_sanitize(p.name_with_namespace)}", url: project_path(p) } } groups = current_user.authorized_groups.map { |group| { label: "group: #{simple_sanitize(group.name)}", url: group_path(group) } } - teams = current_user.authorized_teams.map { |team| { label: "team: #{simple_sanitize(team.name)}", url: team_path(team) } } default_nav = [ { label: "My Profile", url: profile_path }, - { label: "My SSH Keys", url: keys_path }, + { label: "My SSH Keys", url: profile_keys_path }, { label: "My Dashboard", url: root_path }, { label: "Admin Section", url: admin_root_path }, ] @@ -116,19 +115,21 @@ module ApplicationHelper project_nav = [] if @project && @project.repository.exists? && @project.repository.root_ref project_nav = [ - { label: "#{simple_sanitize(@project.name_with_namespace)} - Issues", url: project_issues_path(@project) }, + { label: "#{simple_sanitize(@project.name_with_namespace)} - Files", url: project_tree_path(@project, @ref || @project.repository.root_ref) }, { label: "#{simple_sanitize(@project.name_with_namespace)} - Commits", url: project_commits_path(@project, @ref || @project.repository.root_ref) }, + { label: "#{simple_sanitize(@project.name_with_namespace)} - Network", url: project_network_path(@project, @ref || @project.repository.root_ref) }, + { label: "#{simple_sanitize(@project.name_with_namespace)} - Graph", url: project_graph_path(@project, @ref || @project.repository.root_ref) }, + { label: "#{simple_sanitize(@project.name_with_namespace)} - Issues", url: project_issues_path(@project) }, { label: "#{simple_sanitize(@project.name_with_namespace)} - Merge Requests", url: project_merge_requests_path(@project) }, { label: "#{simple_sanitize(@project.name_with_namespace)} - Milestones", url: project_milestones_path(@project) }, { label: "#{simple_sanitize(@project.name_with_namespace)} - Snippets", url: project_snippets_path(@project) }, { label: "#{simple_sanitize(@project.name_with_namespace)} - Team", url: project_team_index_path(@project) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Tree", url: project_tree_path(@project, @ref || @project.repository.root_ref) }, { label: "#{simple_sanitize(@project.name_with_namespace)} - Wall", url: project_wall_path(@project) }, { label: "#{simple_sanitize(@project.name_with_namespace)} - Wiki", url: project_wikis_path(@project) }, ] end - [groups, teams, projects, default_nav, project_nav, help_nav].flatten.to_json + [groups, projects, default_nav, project_nav, help_nav].flatten.to_json end def emoji_autocomplete_source diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 95ca294cd2d..2bc61894193 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -109,7 +109,7 @@ module CommitsHelper end def commit_to_html commit - escape_javascript(render 'commits/commit', commit: commit) + escape_javascript(render 'projects/commits/commit', commit: commit) end def diff_line_content(line) diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 7c1aee76d4a..b93b1502b34 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -45,13 +45,15 @@ module EventsHelper def event_feed_title(event) if event.issue? - "#{event.author_name} #{event.action_name} issue ##{event.target_id}: #{event.issue_title} at #{event.project.name}" + "#{event.author_name} #{event.action_name} issue ##{event.target_id}: #{event.issue_title} at #{event.project_name}" elsif event.merge_request? - "#{event.author_name} #{event.action_name} MR ##{event.target_id}: #{event.merge_request_title} at #{event.project.name}" + "#{event.author_name} #{event.action_name} MR ##{event.target_id}: #{event.merge_request_title} at #{event.project_name}" elsif event.push? - "#{event.author_name} #{event.push_action_name} #{event.ref_type} #{event.ref_name} at #{event.project.name}" + "#{event.author_name} #{event.push_action_name} #{event.ref_type} #{event.ref_name} at #{event.project_name}" elsif event.membership_changed? - "#{event.author_name} #{event.action_name} #{event.project.name}" + "#{event.author_name} #{event.action_name} #{event.project_name}" + elsif event.note? + "#{event.author_name} commented on #{event.note_target_type} ##{truncate event.note_target_id} at #{event.project_name}" else "" end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 283119bc24c..2ffbff7af8d 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -14,4 +14,8 @@ module GroupsHelper merge_requests_group_path(@group, options) end end + + def remove_user_from_group_message(group, user) + "You are going to remove #{user.name} from #{group.name} Group. Are you sure?" + end end diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index 69ad3de5031..dc88e178360 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -3,12 +3,10 @@ module NamespacesHelper groups = current_user.owned_groups.select {|n| n.type == 'Group'} users = current_user.namespaces.reject {|n| n.type == 'Group'} - global_opts = ["Global", [['/', Namespace.global_id]] ] group_opts = ["Groups", groups.sort_by(&:human_name).map {|g| [g.human_name, g.id]} ] users_opts = [ "Users", users.sort_by(&:human_name).map {|u| [u.human_name, u.id]} ] options = [] - options << global_opts if current_user.admin options << group_opts options << users_opts diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index af633f6fd04..d41f8377559 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -10,13 +10,13 @@ module TreeHelper tree = "" # Render folders if we have any - tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present? + tree += render partial: 'projects/tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present? # Render files if we have any - tree += render partial: 'tree/blob_item', collection: files, locals: {type: 'file'} if files.present? + tree += render partial: 'projects/tree/blob_item', collection: files, locals: {type: 'file'} if files.present? # Render submodules if we have any - tree += render partial: 'tree/submodule_item', collection: submodules if submodules.present? + tree += render partial: 'projects/tree/submodule_item', collection: submodules if submodules.present? tree.html_safe end diff --git a/app/helpers/user_teams_helper.rb b/app/helpers/user_teams_helper.rb deleted file mode 100644 index 8603ee434a8..00000000000 --- a/app/helpers/user_teams_helper.rb +++ /dev/null @@ -1,25 +0,0 @@ -module UserTeamsHelper - def team_filter_path(entity, options={}) - exist_opts = { - status: params[:status], - project_id: params[:project_id], - } - - options = exist_opts.merge(options) - - case entity - when 'issue' then - issues_team_path(@team, options) - when 'merge_request' - merge_requests_team_path(@team, options) - end - end - - def grouped_user_team_members(team) - team.user_team_user_relationships.sort_by(&:permission).reverse.group_by(&:permission) - end - - def remove_from_user_team_message(team, member) - "You are going to remove #{member.name} from #{team.name}. Are you sure?" - end -end diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index 79731b60f45..c1112a98f92 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -8,7 +8,7 @@ module Emails def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id) @issue = Issue.find(issue_id) - @previous_assignee ||= User.find(previous_assignee_id) + @previous_assignee = User.find_by_id(previous_assignee_id) if previous_assignee_id @project = @issue.project mail(to: recipient(recipient_id), subject: subject("changed issue ##{@issue.id}", @issue.title)) end diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index 806f1b01b72..de47903c0d4 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -8,7 +8,7 @@ module Emails def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) @merge_request = MergeRequest.find(merge_request_id) - @previous_assignee ||= User.find(previous_assignee_id) + @previous_assignee = User.find_by_id(previous_assignee_id) if previous_assignee_id @project = @merge_request.project mail(to: recipient(recipient_id), subject: subject("changed merge request !#{@merge_request.id}", @merge_request.title)) end diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index dcd894bb8ef..1ad7ca588bd 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -8,10 +8,10 @@ module Emails end - def project_was_moved_email(user_project_id) - @users_project = UsersProject.find user_project_id - @project = @users_project.project - mail(to: @users_project.user.email, + def project_was_moved_email(project_id, user_id) + @user = User.find user_id + @project = Project.find project_id + mail(to: @user.email, subject: subject("project was moved")) end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 0b6314cd555..0b77564adc6 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -10,8 +10,8 @@ class Ability when "ProjectSnippet" then project_snippet_abilities(user, subject) when "PersonalSnippet" then personal_snippet_abilities(user, subject) when "MergeRequest" then merge_request_abilities(user, subject) - when "Group", "Namespace" then group_abilities(user, subject) - when "UserTeam" then user_team_abilities(user, subject) + when "Group" then group_abilities(user, subject) + when "Namespace" then namespace_abilities(user, subject) else [] end.concat(global_abilities(user)) end @@ -19,7 +19,6 @@ class Ability def global_abilities(user) rules = [] rules << :create_group if user.can_create_group - rules << :create_team if user.can_create_team rules end @@ -50,6 +49,10 @@ class Ability rules << project_admin_rules end + if project.group && project.group.owners.include?(user) + rules << project_admin_rules + end + rules.flatten end @@ -132,7 +135,7 @@ class Ability rules = [] # Only group owner and administrators can manage group - if group.owner == user || user.admin? + if group.owners.include?(user) || user.admin? rules << [ :manage_group, :manage_namespace @@ -142,16 +145,14 @@ class Ability rules.flatten end - def user_team_abilities user, team + def namespace_abilities user, namespace rules = [] - # Only group owner and administrators can manage team - if user.admin? || team.owner == user || team.admin?(user) - rules << [ :manage_user_team ] - end - - if team.owner == user || user.admin? - rules << [ :admin_user_team ] + # Only namespace owner and administrators can manage it + if namespace.owner == user || user.admin? + rules << [ + :manage_namespace + ] end rules.flatten diff --git a/app/models/campfire_service.rb b/app/models/campfire_service.rb index 6450ffe7318..fb2a49fd586 100644 --- a/app/models/campfire_service.rb +++ b/app/models/campfire_service.rb @@ -11,6 +11,8 @@ # updated_at :datetime not null # active :boolean default(FALSE), not null # project_url :string(255) +# subdomain :string(255) +# room :string(255) # class CampfireService < Service diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 38440859064..8868e818daa 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -22,7 +22,6 @@ module Issuable scope :opened, -> { with_state(:opened) } scope :closed, -> { with_state(:closed) } scope :of_group, ->(group) { where(project_id: group.project_ids) } - scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) } scope :assigned_to, ->(u) { where(assignee_id: u.id)} scope :recent, -> { order("created_at DESC") } scope :assigned, -> { where("assignee_id IS NOT NULL") } diff --git a/app/models/concerns/notifiable.rb b/app/models/concerns/notifiable.rb new file mode 100644 index 00000000000..722f375e71d --- /dev/null +++ b/app/models/concerns/notifiable.rb @@ -0,0 +1,15 @@ +# == Notifiable concern +# +# Contains notification functionality shared between UsersProject and UsersGroup +# +module Notifiable + extend ActiveSupport::Concern + + included do + validates :notification_level, inclusion: { in: Notification.project_notification_levels }, presence: true + end + + def notification + @notification ||= Notification.new(self) + end +end diff --git a/app/models/deploy_key.rb b/app/models/deploy_key.rb index 548ef4f9a27..f983198085c 100644 --- a/app/models/deploy_key.rb +++ b/app/models/deploy_key.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: keys +# +# id :integer not null, primary key +# user_id :integer +# created_at :datetime +# updated_at :datetime +# key :text +# title :string(255) +# identifier :string(255) +# type :string(255) +# + class DeployKey < Key has_many :deploy_keys_projects, dependent: :destroy has_many :projects, through: :deploy_keys_projects diff --git a/app/models/deploy_keys_project.rb b/app/models/deploy_keys_project.rb index 48350a3e4d9..6f109e48314 100644 --- a/app/models/deploy_keys_project.rb +++ b/app/models/deploy_keys_project.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: deploy_keys_projects +# +# id :integer not null, primary key +# deploy_key_id :integer not null +# project_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + class DeployKeysProject < ActiveRecord::Base attr_accessible :key_id, :project_id diff --git a/app/models/user_team.rb b/app/models/deprecated/user_team.rb index a036cedc4c7..a036cedc4c7 100644 --- a/app/models/user_team.rb +++ b/app/models/deprecated/user_team.rb diff --git a/app/models/user_team_project_relationship.rb b/app/models/deprecated/user_team_project_relationship.rb index 991510be936..991510be936 100644 --- a/app/models/user_team_project_relationship.rb +++ b/app/models/deprecated/user_team_project_relationship.rb diff --git a/app/models/user_team_user_relationship.rb b/app/models/deprecated/user_team_user_relationship.rb index 1f7e2625f5f..1f7e2625f5f 100644 --- a/app/models/user_team_user_relationship.rb +++ b/app/models/deprecated/user_team_user_relationship.rb diff --git a/app/models/event.rb b/app/models/event.rb index 793ed445947..a6b5167fba6 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -68,7 +68,7 @@ class Event < ActiveRecord::Base def project_name if project - project.name + project.name_with_namespace else "(deleted project)" end diff --git a/app/models/forked_project_link.rb b/app/models/forked_project_link.rb index c3199ca264e..aaa527a1145 100644 --- a/app/models/forked_project_link.rb +++ b/app/models/forked_project_link.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: forked_project_links +# +# id :integer not null, primary key +# forked_to_project_id :integer not null +# forked_from_project_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + class ForkedProjectLink < ActiveRecord::Base attr_accessible :forked_from_project_id, :forked_to_project_id diff --git a/app/models/gitlab_ci_service.rb b/app/models/gitlab_ci_service.rb index bdbe7724be0..7f5380a4551 100644 --- a/app/models/gitlab_ci_service.rb +++ b/app/models/gitlab_ci_service.rb @@ -11,6 +11,8 @@ # updated_at :datetime not null # active :boolean default(FALSE), not null # project_url :string(255) +# subdomain :string(255) +# room :string(255) # class GitlabCiService < Service diff --git a/app/models/group.rb b/app/models/group.rb index 17671c3defe..1c8eb98e0f2 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -13,26 +13,39 @@ # class Group < Namespace + has_many :users_groups, dependent: :destroy + has_many :users, through: :users_groups - def add_users_to_project_teams(user_ids, project_access) - UsersProject.add_users_into_projects( - projects.map(&:id), - user_ids, - project_access - ) + after_create :add_owner + + def human_name + name end - def users - users = User.joins(:users_projects).where(users_projects: {project_id: project_ids}) - users = users << owner - users.uniq + def owners + @owners ||= (users_groups.owners.map(&:user) << owner) end - def human_name - name + def add_users(user_ids, group_access) + user_ids.compact.each do |user_id| + self.users_groups.create(user_id: user_id, group_access: group_access) + end end - def truncate_teams - UsersProject.truncate_teams(project_ids) + def change_owner(user) + self.owner = user + membership = users_groups.where(user_id: user.id).first + + if membership + membership.update_attributes(group_access: UsersGroup::OWNER) + else + add_owner + end + end + + private + + def add_owner + self.add_users([owner.id], UsersGroup::OWNER) end end diff --git a/app/models/hipchat_service.rb b/app/models/hipchat_service.rb index 13429fa83b4..c3fb4826334 100644 --- a/app/models/hipchat_service.rb +++ b/app/models/hipchat_service.rb @@ -11,6 +11,8 @@ # updated_at :datetime not null # active :boolean default(FALSE), not null # project_url :string(255) +# subdomain :string(255) +# room :string(255) # class HipchatService < Service @@ -70,4 +72,4 @@ class HipchatService < Service message end -end
\ No newline at end of file +end diff --git a/app/models/issue.rb b/app/models/issue.rb index de6e015c68e..f56928891dc 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -7,8 +7,8 @@ # assignee_id :integer # author_id :integer # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # position :integer default(0) # branch_name :string(255) # description :text diff --git a/app/models/key.rb b/app/models/key.rb index 61b4838f884..11c01242b15 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -4,17 +4,19 @@ # # id :integer not null, primary key # user_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # key :text # title :string(255) # identifier :string(255) -# project_id :integer +# type :string(255) # require 'digest/md5' class Key < ActiveRecord::Base + include Gitlab::Popen + belongs_to :user attr_accessible :key, :title @@ -34,16 +36,10 @@ class Key < ActiveRecord::Base def fingerprintable_key return true unless key # Don't test if there is no key. - file = Tempfile.new('key_file') - begin - file.puts key - file.rewind - fingerprint_output = `ssh-keygen -lf #{file.path} 2>&1` # Catch stderr. - ensure - file.close - file.unlink # deletes the temp file + unless generate_fingerpint + errors.add(:key, "can't be fingerprinted") + false end - errors.add(:key, "can't be fingerprinted") if $?.exitstatus != 0 end # projects that has this key @@ -54,4 +50,30 @@ class Key < ActiveRecord::Base def shell_id "key-#{id}" end + + private + + def generate_fingerpint + cmd_status = 0 + cmd_output = '' + file = Tempfile.new('gitlab_key_file') + + begin + file.puts key + file.rewind + cmd_output, cmd_status = popen("ssh-keygen -lf #{file.path}", '/tmp') + ensure + file.close + file.unlink # deletes the temp file + end + + if cmd_status.zero? + cmd_output.gsub /([\d\h]{2}:)+[\d\h]{2}/ do |match| + self.fingerprint = match + end + true + else + false + end + end end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index f41473336bc..2a476355404 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -9,8 +9,8 @@ # author_id :integer # assignee_id :integer # title :string(255) -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # st_commits :text(2147483647) # st_diffs :text(2147483647) # milestone_id :integer @@ -116,7 +116,7 @@ class MergeRequest < ActiveRecord::Base end def diffs - load_diffs(st_diffs) || [] + @diffs ||= (load_diffs(st_diffs) || []) end def reloaded_diffs @@ -128,6 +128,8 @@ class MergeRequest < ActiveRecord::Base def broken_diffs? diffs == broken_diffs + rescue + true end def valid_diffs? diff --git a/app/models/note.rb b/app/models/note.rb index 56a8749e47d..c23aab03bcc 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -6,8 +6,8 @@ # note :text # noteable_type :string(255) # author_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # project_id :integer # attachment :string(255) # line_code :string(255) diff --git a/app/models/personal_snippet.rb b/app/models/personal_snippet.rb index d581c6092aa..a3c0d201ee5 100644 --- a/app/models/personal_snippet.rb +++ b/app/models/personal_snippet.rb @@ -6,13 +6,14 @@ # title :string(255) # content :text # author_id :integer not null -# project_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# project_id :integer +# created_at :datetime +# updated_at :datetime # file_name :string(255) # expires_at :datetime +# private :boolean default(TRUE), not null # type :string(255) -# private :boolean +# class PersonalSnippet < Snippet end diff --git a/app/models/project.rb b/app/models/project.rb index e3f88b2cf98..8297c11ba8a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -6,8 +6,8 @@ # name :string(255) # path :string(255) # description :text -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # creator_id :integer # default_branch :string(255) # issues_enabled :boolean default(TRUE), not null @@ -20,6 +20,7 @@ # issues_tracker_id :string(255) # snippets_enabled :boolean default(TRUE), not null # last_activity_at :datetime +# imported :boolean default(FALSE), not null # require "grit" @@ -55,22 +56,19 @@ class Project < ActiveRecord::Base has_many :merge_requests, dependent: :destroy has_many :issues, dependent: :destroy, order: "state DESC, created_at DESC" has_many :milestones, dependent: :destroy - has_many :users_projects, dependent: :destroy has_many :notes, dependent: :destroy has_many :snippets, dependent: :destroy, class_name: "ProjectSnippet" has_many :hooks, dependent: :destroy, class_name: "ProjectHook" has_many :protected_branches, dependent: :destroy - has_many :user_team_project_relationships, dependent: :destroy - has_many :users, through: :users_projects - has_many :user_teams, through: :user_team_project_relationships - has_many :user_team_user_relationships, through: :user_teams - has_many :user_teams_members, through: :user_team_user_relationships + has_many :users_projects, dependent: :destroy + has_many :users, through: :users_projects has_many :deploy_keys_projects, dependent: :destroy has_many :deploy_keys, through: :deploy_keys_projects delegate :name, to: :owner, allow_nil: true, prefix: true + delegate :members, to: :team, prefix: true # Validations validates :creator, presence: true @@ -102,7 +100,7 @@ class Project < ActiveRecord::Base scope :in_team, ->(team) { where("projects.id IN (:ids)", ids: team.projects.map(&:id)) } scope :in_namespace, ->(namespace) { where(namespace_id: namespace.id) } scope :in_group_namespace, -> { joins(:group) } - scope :sorted_by_activity, -> { order("projects.last_activity_at DESC") } + scope :sorted_by_activity, -> { reorder("projects.last_activity_at DESC") } scope :personal, ->(user) { where(namespace_id: user.namespace_id) } scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) } scope :public_only, -> { where(public: true) } @@ -248,8 +246,8 @@ class Project < ActiveRecord::Base end def send_move_instructions - self.users_projects.each do |member| - Notify.delay.project_was_moved_email(member.id) + team.members.each do |user| + Notify.delay.project_was_moved_email(self.id, user.id) end end @@ -417,6 +415,10 @@ class Project < ActiveRecord::Base imported end + def personal? + !group + end + def rename_repo old_path_with_namespace = File.join(namespace_dir, path_was) new_path_with_namespace = File.join(namespace_dir, path) diff --git a/app/models/project_hook.rb b/app/models/project_hook.rb index 2576fc979d4..b82e1ffd4ab 100644 --- a/app/models/project_hook.rb +++ b/app/models/project_hook.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # url :string(255) # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # type :string(255) default("ProjectHook") # service_id :integer # diff --git a/app/models/project_snippet.rb b/app/models/project_snippet.rb index a86f2e7a32f..14c88046423 100644 --- a/app/models/project_snippet.rb +++ b/app/models/project_snippet.rb @@ -6,13 +6,14 @@ # title :string(255) # content :text # author_id :integer not null -# project_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# project_id :integer +# created_at :datetime +# updated_at :datetime # file_name :string(255) # expires_at :datetime +# private :boolean default(TRUE), not null # type :string(255) -# private :boolean +# class ProjectSnippet < Snippet belongs_to :project diff --git a/app/models/project_team.rb b/app/models/project_team.rb index f3e5c0e5354..c797c36882f 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -21,7 +21,17 @@ class ProjectTeam end end - def get_tm user_id + def find(user_id) + user = project.users.find_by_id(user_id) + + if group + user ||= group.users.find_by_id(user_id) + end + + user + end + + def find_tm(user_id) project.users_projects.find_by_user_id(user_id) end @@ -47,23 +57,23 @@ class ProjectTeam end def members - project.users_projects + @members ||= fetch_members end def guests - members.guests.map(&:user) + @guests ||= fetch_members(:guests) end def reporters - members.reporters.map(&:user) + @reporters ||= fetch_members(:reporters) end def developers - members.developers.map(&:user) + @developers ||= fetch_members(:developers) end def masters - members.masters.map(&:user) + @masters ||= fetch_members(:masters) end def import(source_project) @@ -82,7 +92,6 @@ class ProjectTeam new_tm = tm.dup new_tm.id = nil new_tm.project_id = target_project.id - new_tm.skip_git = true new_tm end @@ -96,4 +105,22 @@ class ProjectTeam rescue false end + + private + + def fetch_members(level = nil) + project_members = project.users_projects + group_members = group ? group.users_groups : [] + + if level + project_members = project_members.send(level) + group_members = group_members.send(level) if group + end + + (project_members + group_members).map(&:user).uniq + end + + def group + project.group + end end diff --git a/app/models/repository.rb b/app/models/repository.rb index daf176576ad..b18e98bdf47 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -33,6 +33,18 @@ class Repository commits end + def round_commit_count + if commit_count > 10000 + '10000+' + elsif commit_count > 5000 + '5000+' + elsif commit_count > 1000 + '1000+' + else + commit_count + end + end + def branch_names Rails.cache.fetch(cache_key(:branch_names)) do raw_repository.branch_names @@ -45,8 +57,10 @@ class Repository end end - def method_missing(m, *args, &block) - raw_repository.send(m, *args, &block) + def commit_count + Rails.cache.fetch(cache_key(:commit_count)) do + raw_repository.raw.commit_count + end end # Return repo size in megabytes @@ -61,12 +75,25 @@ class Repository Rails.cache.delete(cache_key(:size)) Rails.cache.delete(cache_key(:branch_names)) Rails.cache.delete(cache_key(:tag_names)) + Rails.cache.delete(cache_key(:commit_count)) + Rails.cache.delete(cache_key(:graph_log)) + end + + def graph_log + Rails.cache.fetch(cache_key(:graph_log)) do + stats = Gitlab::Git::GitStats.new(raw, root_ref) + stats.parsed_log + end end def cache_key(type) "#{type}:#{path_with_namespace}" end + def method_missing(m, *args, &block) + raw_repository.send(m, *args, &block) + end + def respond_to?(method) return true if raw_repository.respond_to?(method) diff --git a/app/models/service.rb b/app/models/service.rb index 3e945aa898c..d21e8a2c567 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -11,6 +11,8 @@ # updated_at :datetime not null # active :boolean default(FALSE), not null # project_url :string(255) +# subdomain :string(255) +# room :string(255) # # To add new service you should build a class inherited from Service diff --git a/app/models/service_hook.rb b/app/models/service_hook.rb index 4cd2b272eec..433e8059788 100644 --- a/app/models/service_hook.rb +++ b/app/models/service_hook.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # url :string(255) # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # type :string(255) default("ProjectHook") # service_id :integer # diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 1b37ffe8339..3a2fc17e59c 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -6,13 +6,14 @@ # title :string(255) # content :text # author_id :integer not null -# project_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# project_id :integer +# created_at :datetime +# updated_at :datetime # file_name :string(255) # expires_at :datetime +# private :boolean default(TRUE), not null # type :string(255) -# private :boolean +# class Snippet < ActiveRecord::Base include Linguist::BlobHelper diff --git a/app/models/system_hook.rb b/app/models/system_hook.rb index 5cdf046644f..2d28f4cd452 100644 --- a/app/models/system_hook.rb +++ b/app/models/system_hook.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # url :string(255) # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # type :string(255) default("ProjectHook") # service_id :integer # diff --git a/app/models/user.rb b/app/models/user.rb index ddbdec8acfc..193349c95fc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,7 +4,7 @@ # # id :integer not null, primary key # email :string(255) default(""), not null -# encrypted_password :string(255) default(""), not null +# encrypted_password :string(128) default(""), not null # reset_password_token :string(255) # reset_password_sent_at :datetime # remember_created_at :datetime @@ -13,8 +13,8 @@ # last_sign_in_at :datetime # current_sign_in_ip :string(255) # last_sign_in_ip :string(255) -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # name :string(255) # admin :boolean default(FALSE), not null # projects_limit :integer default(10) @@ -34,6 +34,8 @@ # state :string(255) # color_scheme_id :integer default(1), not null # notification_level :integer default(1), not null +# password_expires_at :datetime +# created_by_id :integer # class User < ActiveRecord::Base @@ -71,14 +73,11 @@ class User < ActiveRecord::Base has_many :keys, dependent: :destroy # Groups - has_many :groups, class_name: "Group", foreign_key: :owner_id + has_many :own_groups, class_name: "Group", foreign_key: :owner_id + has_many :owned_groups, through: :users_groups, source: :group, conditions: { users_groups: { group_access: UsersGroup::OWNER } } - # Teams - has_many :own_teams, dependent: :destroy, class_name: "UserTeam", foreign_key: :owner_id - has_many :user_team_user_relationships, dependent: :destroy - has_many :user_teams, through: :user_team_user_relationships - has_many :user_team_project_relationships, through: :user_teams - has_many :team_projects, through: :user_team_project_relationships + has_many :users_groups, dependent: :destroy + has_many :groups, through: :users_groups # Projects has_many :snippets, dependent: :destroy, foreign_key: :author_id, class_name: "Snippet" @@ -91,10 +90,9 @@ class User < ActiveRecord::Base has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue" has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest" + has_many :groups_projects, through: :groups, source: :projects has_many :personal_projects, through: :namespace, source: :projects has_many :projects, through: :users_projects - has_many :master_projects, through: :users_projects, source: :project, - conditions: { users_projects: { project_access: UsersProject::MASTER } } has_many :own_projects, foreign_key: :creator_id, class_name: 'Project' has_many :owned_projects, through: :namespaces, source: :projects @@ -211,6 +209,7 @@ class User < ActiveRecord::Base u.projects_limit = Gitlab.config.gitlab.default_projects_limit u.can_create_group = Gitlab.config.gitlab.default_can_create_group u.can_create_team = Gitlab.config.gitlab.default_can_create_team + u.theme_id = Gitlab::Theme::MARS end end @@ -231,35 +230,21 @@ class User < ActiveRecord::Base end end - # Groups where user is an owner - def owned_groups - groups - end - - def owned_teams - own_teams - end - # Groups user has access to def authorized_groups - @group_ids ||= (groups.pluck(:id) + authorized_projects.pluck(:namespace_id)) - Group.where(id: @group_ids) + @authorized_groups ||= begin + group_ids = (groups.pluck(:id) + own_groups.pluck(:id) + authorized_projects.pluck(:namespace_id)) + Group.where(id: group_ids).order('namespaces.name ASC') + end end # Projects user has access to def authorized_projects - @project_ids ||= (owned_projects.pluck(:id) + projects.pluck(:id)).uniq - Project.where(id: @project_ids) - end - - def authorized_teams - if admin? - UserTeam.scoped - else - @team_ids ||= (user_teams.pluck(:id) + own_teams.pluck(:id)).uniq - UserTeam.where(id: @team_ids) - end + @authorized_projects ||= begin + project_ids = (owned_projects.pluck(:id) + groups_projects.pluck(:id) + projects.pluck(:id)).uniq + Project.where(id: project_ids).joins(:namespace).order('namespaces.name ASC') + end end # Team membership in authorized projects @@ -280,7 +265,7 @@ class User < ActiveRecord::Base end def can_create_project? - projects_limit > owned_projects.count + projects_limit_left > 0 end def can_create_group? @@ -312,12 +297,12 @@ class User < ActiveRecord::Base end def projects_limit_left - projects_limit - owned_projects.count + projects_limit - personal_projects.count end def projects_limit_percent return 100 if projects_limit.zero? - (owned_projects.count.to_f / projects_limit) * 100 + (personal_projects.count.to_f / projects_limit) * 100 end def recent_push project_id = nil @@ -368,7 +353,7 @@ class User < ActiveRecord::Base end def accessible_deploy_keys - DeployKey.in_projects(self.master_projects).uniq + DeployKey.in_projects(self.authorized_projects).uniq end def created_by diff --git a/app/models/users_group.rb b/app/models/users_group.rb new file mode 100644 index 00000000000..b334066b8c8 --- /dev/null +++ b/app/models/users_group.rb @@ -0,0 +1,56 @@ +# == Schema Information +# +# Table name: users_groups +# +# id :integer not null, primary key +# group_access :integer not null +# group_id :integer not null +# user_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + +class UsersGroup < ActiveRecord::Base + include Notifiable + + GUEST = 10 + REPORTER = 20 + DEVELOPER = 30 + MASTER = 40 + OWNER = 50 + + def self.group_access_roles + { + "Guest" => GUEST, + "Reporter" => REPORTER, + "Developer" => DEVELOPER, + "Master" => MASTER, + "Owner" => OWNER + } + end + + attr_accessible :group_access, :user_id + + belongs_to :user + belongs_to :group + + scope :guests, -> { where(group_access: GUEST) } + scope :reporters, -> { where(group_access: REPORTER) } + scope :developers, -> { where(group_access: DEVELOPER) } + scope :masters, -> { where(group_access: MASTER) } + scope :owners, -> { where(group_access: OWNER) } + + scope :with_group, ->(group) { where(group_id: group.id) } + scope :with_user, ->(user) { where(user_id: user.id) } + + validates :group_access, inclusion: { in: UsersGroup.group_access_roles.values }, presence: true + validates :user_id, presence: true + validates :group_id, presence: true + validates :user_id, uniqueness: { scope: [:group_id], message: "already exists in group" } + + delegate :name, :username, :email, to: :user, prefix: true + + def human_access + UsersGroup.group_access_roles.key(self.group_access) + end +end diff --git a/app/models/users_project.rb b/app/models/users_project.rb index 935ecede42c..45e9305cafb 100644 --- a/app/models/users_project.rb +++ b/app/models/users_project.rb @@ -5,14 +5,15 @@ # id :integer not null, primary key # user_id :integer not null # project_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # project_access :integer default(0), not null # notification_level :integer default(3), not null # class UsersProject < ActiveRecord::Base include Gitlab::ShellAdapter + include Notifiable GUEST = 10 REPORTER = 20 @@ -24,13 +25,10 @@ class UsersProject < ActiveRecord::Base belongs_to :user belongs_to :project - attr_accessor :skip_git - validates :user, presence: true validates :user_id, uniqueness: { scope: [:project_id], message: "already exists in project" } validates :project_access, inclusion: { in: [GUEST, REPORTER, DEVELOPER, MASTER] }, presence: true validates :project, presence: true - validates :notification_level, inclusion: { in: Notification.project_notification_levels }, presence: true delegate :name, :username, :email, to: :user, prefix: true @@ -77,7 +75,6 @@ class UsersProject < ActiveRecord::Base user_ids.each do |user_id| users_project = UsersProject.new(project_access: project_access, user_id: user_id) users_project.project_id = project_id - users_project.skip_git = true users_project.save end end @@ -92,7 +89,6 @@ class UsersProject < ActiveRecord::Base UsersProject.transaction do users_projects = UsersProject.where(project_id: project_ids) users_projects.each do |users_project| - users_project.skip_git = true users_project.destroy end end @@ -129,15 +125,5 @@ class UsersProject < ActiveRecord::Base Project.access_options.key(self.project_access) end - def repo_access_human - self.class.access_roles.invert[self.project_access] - end - - def skip_git? - !!@skip_git - end - - def notification - @notification ||= Notification.new(self) - end + alias_method :human_access, :project_access_human end diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb index 3f22b1082fb..1e6ea885ea9 100644 --- a/app/models/web_hook.rb +++ b/app/models/web_hook.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # url :string(255) # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # type :string(255) default("ProjectHook") # service_id :integer # diff --git a/app/observers/key_observer.rb b/app/observers/key_observer.rb index 28fef55abf9..c013594e787 100644 --- a/app/observers/key_observer.rb +++ b/app/observers/key_observer.rb @@ -1,5 +1,5 @@ class KeyObserver < BaseObserver - def after_save(key) + def after_create(key) GitlabShellWorker.perform_async( :add_key, key.shell_id, diff --git a/app/observers/project_observer.rb b/app/observers/project_observer.rb index 3d4d161a1a2..c1a4611536d 100644 --- a/app/observers/project_observer.rb +++ b/app/observers/project_observer.rb @@ -13,6 +13,12 @@ class ProjectObserver < BaseObserver def after_update(project) project.send_move_instructions if project.namespace_id_changed? project.rename_repo if project.path_changed? + + GitlabShellWorker.perform_async( + :update_repository_head, + project.path_with_namespace, + project.default_branch + ) if project.default_branch_changed? end def before_destroy(project) diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index b0243481b35..f3dc552a8e7 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -149,14 +149,19 @@ class NotificationService # Get project users with WATCH notification level def project_watchers(project) - - # Get project notification settings since it has higher priority - user_ids = project.users_projects.where(notification_level: Notification::N_WATCH).pluck(:user_id) - project_watchers = User.where(id: user_ids) - - # next collect users who use global settings with watch state - user_ids = project.users_projects.where(notification_level: Notification::N_GLOBAL).pluck(:user_id) - project_watchers += User.where(id: user_ids, notification_level: Notification::N_WATCH) + project_watchers = [] + member_methods = { project => :users_projects } + member_methods.merge!(project.group => :users_groups) if project.group + + member_methods.each do |object, member_method| + # Get project notification settings since it has higher priority + user_ids = object.send(member_method).where(notification_level: Notification::N_WATCH).pluck(:user_id) + project_watchers += User.where(id: user_ids) + + # next collect users who use global settings with watch state + user_ids = object.send(member_method).where(notification_level: Notification::N_GLOBAL).pluck(:user_id) + project_watchers += User.where(id: user_ids, notification_level: Notification::N_WATCH) + end project_watchers.uniq end @@ -171,6 +176,10 @@ class NotificationService tm = project.users_projects.find_by_user_id(user.id) + if !tm && project.group + tm = project.group.users_groups.find_by_user_id(user.id) + end + # reject users who globally disabled notification and has no membership next user.notification.disabled? unless tm diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb index a52d13d5237..01ddf99e97b 100644 --- a/app/services/system_hooks_service.rb +++ b/app/services/system_hooks_service.rb @@ -43,7 +43,7 @@ class SystemHooksService project_id: model.project_id, user_name: model.user.name, user_email: model.user.email, - project_access: model.repo_access_human + project_access: model.project_access_human }) end end diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml index a69b26073f0..2774ccb85fe 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -50,10 +50,6 @@ %h4 Stats %hr %p - Teams - %span.light.pull-right - = UserTeam.count - %p Forks %span.light.pull-right = ForkedProjectLink.count diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index 9c4b91b1bfa..977fac291f3 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -49,10 +49,23 @@ %strong = @group.created_at.stamp("March 1, 1999") + .ui-box + %h5.title + Projects + %small + (#{@group.projects.count}) + %ul.well-list + - @group.projects.sort_by(&:name).each do |project| + %li + %strong + = link_to project.name_with_namespace, [:admin, project] + %span.pull-right.light + %span.monospace= project.path_with_namespace + ".git" + .span6 .ui-box %h5.title - Add user to Group projects: + Add user(s) to the group: .ui-box-body.form-holder %p.light Read more about project permissions @@ -62,32 +75,21 @@ %div = users_select_tag(:user_ids, multiple: true) %div.prepend-top-10 - = select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"} + = select_tag :group_access, options_for_select(UsersGroup.group_access_roles), class: "project-access-select chosen" %hr - = submit_tag 'Add user to projects in group', class: "btn btn-create" + = submit_tag 'Add users into group', class: "btn btn-create" .ui-box %h5.title - Users from Group projects + %strong #{@group.name} + Group Members %small - (#{@group.users.count}) - %ul.well-list - - @group.users.sort_by(&:name).each do |user| + (#{@group.users_groups.count}) + %ul.well-list.group-users-list + - @group.users_groups.order('group_access DESC').each do |member| + - user = member.user %li{class: dom_class(user)} %strong = link_to user.name, admin_user_path(user) %span.pull-right.light - = pluralize user.authorized_projects.in_namespace(@group).count, 'project' + = member.human_access - .span6 - .ui-box - %h5.title - Projects - %small - (#{@group.projects.count}) - %ul.well-list - - @group.projects.sort_by(&:name).each do |project| - %li - %strong - = link_to project.name_with_namespace, [:admin, project] - %span.pull-right.light - %span.monospace= project.path_with_namespace + ".git" diff --git a/app/views/admin/projects/members/_form.html.haml b/app/views/admin/projects/members/_form.html.haml deleted file mode 100644 index 8041202980d..00000000000 --- a/app/views/admin/projects/members/_form.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= form_for @team_member_relation, as: :team_member, url: admin_project_member_path(@project, @member) do |f| - -if @team_member_relation.errors.any? - .alert.alert-error - %ul - - @team_member_relation.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Project Access: - .input - = f.select :project_access, options_for_select(Project.access_options, @team_member_relation.project_access), {}, class: "project-access-select chosen span3" - - %br - .actions - = f.submit 'Save', class: "btn btn-primary" - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/admin/projects/members/edit.html.haml b/app/views/admin/projects/members/edit.html.haml deleted file mode 100644 index 2d76deb2aca..00000000000 --- a/app/views/admin/projects/members/edit.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%p.slead - Edit access for - = link_to @member.name, admin_user_path(@member) - in - = link_to @project.name_with_namespace, admin_project_path(@project) - -%hr -= render 'form' diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 92b8960151e..8779ec08870 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -74,17 +74,33 @@ %i.icon-lock Private .span6 + - if @group + .ui-box + %h5.title + %strong #{@group.name} Group + members (#{@group.users_groups.count}) + .pull-right + = link_to admin_group_path(@group), class: 'btn btn-small' do + %i.icon-edit + %ul.well-list + - @group.users_groups.order('group_access DESC').each do |member| + = render 'users_groups/users_group', member: member, show_controls: false + .ui-box %h5.title Team %small (#{@project.users.count}) - = link_to project_team_index_path(@project), class: "btn btn-tiny" do - %i.icon-edit - Edit Team + .pull-right + = link_to project_team_index_path(@project), class: "btn btn-tiny" do + %i.icon-edit + Manage Access %ul.well-list.team_members - - @project.users.each do |tm| + - @project.users.each do |user| %li %strong - = link_to tm.name, admin_user_path(tm) - %span.pull-right.light= @project.project_access_human(tm) + = link_to user.name, admin_user_path(user) + .pull-right + %span.light= @project.project_access_human(user) + = link_to admin_project_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn btn-small btn-remove" do + %i.icon-remove diff --git a/app/views/admin/teams/edit.html.haml b/app/views/admin/teams/edit.html.haml deleted file mode 100644 index 0a3d993b132..00000000000 --- a/app/views/admin/teams/edit.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -%h3.page_title Edit Team -%hr -= form_for @team, url: admin_team_path(@team), method: :put do |f| - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix.team_name_holder - = f.label :name do - Team name is - .input - = f.text_field :name, placeholder: "Example Team", class: "xxlarge" - - .clearfix.team-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .clearfix.team_name_holder - = f.label :path do - %span.cred Team path is - .input - = f.text_field :path, placeholder: "example-team", class: "xxlarge danger" - %ul.cred - %li It will change web url for access team and team projects. - - .form-actions - = f.submit 'Edit team', class: "btn btn-remove" - = link_to 'Cancel', admin_teams_path, class: "btn btn-cancel" diff --git a/app/views/admin/teams/index.html.haml b/app/views/admin/teams/index.html.haml deleted file mode 100644 index 05ddc3cee89..00000000000 --- a/app/views/admin/teams/index.html.haml +++ /dev/null @@ -1,48 +0,0 @@ -%h3.page_title - Teams (#{@teams.total_count}) - %small - allow you to organize groups of people that have a common focus. Use teams to simplify the process of assigning roles to groups of people. - - = link_to 'New Team', new_admin_team_path, class: "btn btn-small pull-right" -%br - -= form_tag admin_teams_path, method: :get, class: 'form-inline' do - = text_field_tag :name, params[:name], class: "span6" - = submit_tag "Search", class: "btn submit btn-primary" - -%hr - -%ul.bordered-list - - @teams.each do |team| - %li - .clearfix - .pull-right.prepend-top-10 - = link_to 'Edit', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small" - = link_to 'Destroy', admin_team_path(team), confirm: "REMOVE #{team.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" - - %h4 - = link_to admin_team_path(team) do - %i.icon-group - = team.name - - .clearfix.light.append-bottom-10 - %span - %b Owner: - - if team.owner - = link_to team.owner.name, admin_user_path(team.owner) - - else - (deleted) - \| - %span - %b Users: - %span.badge= team.members.count - \| - %span - %b Projects: - %span.badge= team.projects.count - - .clearfix - %p - = truncate team.description, length: 150 - -= paginate @teams, theme: "gitlab" diff --git a/app/views/admin/teams/members/_form.html.haml b/app/views/admin/teams/members/_form.html.haml deleted file mode 100644 index f1388aab4bb..00000000000 --- a/app/views/admin/teams/members/_form.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -= form_tag admin_team_member_path(@team, @member), method: :put do - -if @member.errors.any? - .alert.alert-error - %ul - - @member.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Default access for Team projects: - .input - = select_tag :default_project_access, options_for_select(UserTeam.access_roles, @team.default_projects_access(@member)), class: "project-access-select chosen span3" - .clearfix - %label Team admin? - .input - = check_box_tag :group_admin, true, @team.admin?(@member) - - %br - .actions - = submit_tag 'Save', class: "btn btn-primary" - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/admin/teams/members/edit.html.haml b/app/views/admin/teams/members/edit.html.haml deleted file mode 100644 index a82847ee5f8..00000000000 --- a/app/views/admin/teams/members/edit.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3 - Edit access #{@member.name} in #{@team.name} team - -%hr -%table.zebra-striped - %tr - %td User: - %td= @member.name - %tr - %td Team: - %td= @team.name - %tr - %td Since: - %td= member_since(@team, @member).stamp("Nov 11, 2010") - -= render 'form' diff --git a/app/views/admin/teams/members/new.html.haml b/app/views/admin/teams/members/new.html.haml deleted file mode 100644 index 96b6d61b974..00000000000 --- a/app/views/admin/teams/members/new.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -%h3.page_title - New members for - = link_to @team.name, admin_team_path(@team) - team -%hr -= form_tag admin_team_members_path(@team), id: "team_members", class: "bulk_import", method: :post do - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix - = label_tag :user_ids do - Users to add - .input - = select_tag :user_ids, options_from_collection_for_select(@users , :id, :name_with_username), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5' - .clearfix.group-description-holder - = label_tag :default_project_access do - Default permission in projects - .input - = select_tag :default_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" } - .clearfix - = label_tag :group_admin do - Is team admin - .input - = check_box_tag :group_admin - .clearfix.form-actions - = submit_tag 'Add users into team', class: "btn btn-primary", id: :add_members_to_team - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/admin/teams/new.html.haml b/app/views/admin/teams/new.html.haml deleted file mode 100644 index 8bccdacc351..00000000000 --- a/app/views/admin/teams/new.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -%h3.page_title New Team -%hr -= form_for @team, url: admin_teams_path do |f| - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix - = f.label :name do - Team name is - .input - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" - - .clearfix.team-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .form-actions - = f.submit 'Create team', class: "btn btn-create" - - %hr - .padded - %ul - %li All created teams are public (users can view who enter into team and which project are assigned for this team) - %li People within a team see only projects they have access to - %li You will be able to assign existing projects for team diff --git a/app/views/admin/teams/projects/_form.html.haml b/app/views/admin/teams/projects/_form.html.haml deleted file mode 100644 index 5b79d518d42..00000000000 --- a/app/views/admin/teams/projects/_form.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= form_tag admin_team_project_path(@team, @project), method: :put do - -if @project.errors.any? - .alert.alert-error - %ul - - @project.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Max access for Team members: - .input - = select_tag :greatest_project_access, options_for_select(UserTeam.access_roles, @team.max_project_access(@project)), class: "project-access-select chosen span3" - - %br - .actions - = submit_tag 'Save', class: "btn btn-primary" - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/admin/teams/projects/edit.html.haml b/app/views/admin/teams/projects/edit.html.haml deleted file mode 100644 index b91a4982b81..00000000000 --- a/app/views/admin/teams/projects/edit.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3 - Edit max access in #{@project.name} for #{@team.name} team - -%hr -%table.zebra-striped - %tr - %td Project: - %td= @project.name - %tr - %td Team: - %td= @team.name - %tr - %td Since: - %td= assigned_since(@team, @project).stamp("Nov 11, 2010") - -= render 'form' diff --git a/app/views/admin/teams/projects/new.html.haml b/app/views/admin/teams/projects/new.html.haml deleted file mode 100644 index 21bf65f9c3d..00000000000 --- a/app/views/admin/teams/projects/new.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -%h3.page_title - Team: #{@team.name} -%hr -= form_tag admin_team_projects_path(@team), id: "assign_projects", class: "bulk_import", method: :post do - %h6 Choose Projects you want to assign: - .clearfix - = label_tag :project_ids, "Projects" - .input - = select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span5' - - %h6 Choose greatest user access for your team in these projects: - .clearfix - = label_tag :greatest_project_access, "Greatest Access" - .input - = select_tag :greatest_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" } - - .form-actions - = submit_tag 'Add team to projects', class: "btn btn-create", id: :assign_projects_to_team diff --git a/app/views/admin/teams/show.html.haml b/app/views/admin/teams/show.html.haml deleted file mode 100644 index cf105c096e3..00000000000 --- a/app/views/admin/teams/show.html.haml +++ /dev/null @@ -1,96 +0,0 @@ -%h3.page_title - Team: #{@team.name} - - - = link_to edit_admin_team_path(@team), class: "btn btn-small pull-right" do - %i.icon-edit - Edit -%hr - - -.row - .span6 - .ui-box - %h5.title - Team info: - %ul.well-list - %li - %span.light Name: - %strong= @team.name - %li - %span.light Path: - %strong - = @team.path - - %li - %span.light Description: - %strong - = @team.description - - %li - %span.light Owned by: - %strong - - if @team.owner - = link_to @team.owner.name, admin_user_path(@team.owner) - - else - (deleted) - .pull-right - = link_to "#", class: "btn btn-small change-owner-link" do - %i.icon-edit - Change owner - %li.change-owner-holder.hide.bgred - .form-holder - %strong.cred New Owner: - = form_for @team, url: admin_team_path(@team) do |f| - = users_select_tag(:"user_team[owner_id]") - .prepend-top-10 - = f.submit 'Change Owner', class: "btn btn-remove" - = link_to "Cancel", "#", class: "btn change-owner-cancel-link" - - %li - %span.light Created at: - %strong - = @team.created_at.stamp("March 1, 1999") - - .span6 - .ui-box - %h5.title - Members (#{@team.members.count}) - .pull-right - = link_to 'Add members', new_admin_team_member_path(@team), class: "btn btn-small", id: :add_members_to_team - %ul.well-list#members_list - - @team.members.each do |member| - %li.member{ class: "user_#{member.id}"} - = link_to [:admin, member] do - %strong - = member.name - .pull-right - %span.light - = @team.human_default_projects_access(member) - - if @team.admin?(member) - %span.label.label-info Admin - - = link_to 'Edit', edit_admin_team_member_path(@team, member), class: "btn btn-small" - - = link_to 'Remove', admin_team_member_path(@team, member), confirm: 'Remove member from team. Are you sure?', method: :delete, class: "btn btn-remove btn-small", id: "remove_member_#{member.id}" - - - .ui-box - %h5.title - Projects (#{@team.projects.count}) - .pull-right - = link_to 'Add projects', new_admin_team_project_path(@team), class: "btn btn-small", id: :assign_projects_to_team - %ul.well-list#projects_list - - @team.projects.each do |project| - %li.project - = link_to [:admin, project] do - %strong - = project.name_with_namespace - - .pull-right - %span.light - = @team.human_max_project_access(project) - - = link_to 'Edit', edit_admin_team_project_path(@team, project), class: "btn btn-small" - - = link_to 'Relegate', admin_team_project_path(@team, project), confirm: 'Remove project from team. Are you sure?', method: :delete, class: "btn btn-remove small", id: "relegate_project_#{project.id}" diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml index fdf37965091..4f7f05c84f1 100644 --- a/app/views/admin/users/_form.html.haml +++ b/app/views/admin/users/_form.html.haml @@ -1,9 +1,9 @@ .user_new - = form_for [:admin, @admin_user] do |f| - -if @admin_user.errors.any? + = form_for [:admin, @user] do |f| + -if @user.errors.any? #error_explanation %ul.unstyled.alert.alert-error - - @admin_user.errors.full_messages.each do |msg| + - @user.errors.full_messages.each do |msg| %li= msg %fieldset @@ -24,7 +24,7 @@ = f.text_field :email, required: true, autocomplete: "off" %span.help-inline * required - - if @admin_user.new_record? + - if @user.new_record? %fieldset %legend Password .clearfix @@ -65,14 +65,14 @@ %strong.cred Administrator .input= f.check_box :admin .span4 - - unless @admin_user.new_record? + - unless @user.new_record? .alert.alert-error - - if @admin_user.blocked? + - if @user.blocked? %p This user is blocked and is not able to login to GitLab - = link_to 'Unblock User', unblock_admin_user_path(@admin_user), method: :put, class: "btn btn-small" + = link_to 'Unblock User', unblock_admin_user_path(@user), method: :put, class: "btn btn-small" - else %p Blocked users will be removed from all projects & will not be able to login to GitLab. - = link_to 'Block User', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove" + = link_to 'Block User', block_admin_user_path(@user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove" %fieldset %legend Profile .clearfix @@ -86,9 +86,9 @@ .input= f.text_field :twitter .actions - - if @admin_user.new_record? + - if @user.new_record? = f.submit 'Create user', class: "btn btn-create" = link_to 'Cancel', admin_users_path, class: "btn btn-cancel" - else = f.submit 'Save changes', class: "btn btn-save" - = link_to 'Cancel', admin_user_path(@admin_user), class: "btn btn-cancel" + = link_to 'Cancel', admin_user_path(@user), class: "btn btn-cancel" diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml index f8ff77b8f53..0e31a0ba332 100644 --- a/app/views/admin/users/edit.html.haml +++ b/app/views/admin/users/edit.html.haml @@ -1,5 +1,5 @@ %h3.page_title - #{@admin_user.name} → + #{@user.name} → %i.icon-edit Edit user %hr diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 3657f660c9b..0f74e8f68f4 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -33,9 +33,9 @@ .span9 .ui-box %h5.title - Users (#{@admin_users.total_count}) + Users (#{@users.total_count}) %ul.well-list - - @admin_users.each do |user| + - @users.each do |user| %li - if user.blocked? %i.icon-lock.cred @@ -58,4 +58,4 @@ - else = link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove" = link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove" - = paginate @admin_users, theme: "gitlab" + = paginate @users, theme: "gitlab" diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index 3edd76a7c1b..eaa7ebc3f49 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -1,21 +1,21 @@ %h3.page_title User: - = @admin_user.name - - if @admin_user.blocked? + = @user.name + - if @user.blocked? %span.cred (Blocked) - - if @admin_user.admin + - if @user.admin %span.cred (Admin) .pull-right - = link_to edit_admin_user_path(@admin_user), class: "btn grouped btn-small" do + = link_to edit_admin_user_path(@user), class: "btn grouped btn-small" do %i.icon-edit Edit - - unless @admin_user == current_user - - if @admin_user.blocked? - = link_to 'Unblock', unblock_admin_user_path(@admin_user), method: :put, class: "btn grouped btn-small success" + - unless @user == current_user + - if @user.blocked? + = link_to 'Unblock', unblock_admin_user_path(@user), method: :put, class: "btn grouped btn-small success" - else - = link_to 'Block', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn grouped btn-small btn-remove" - = link_to 'Destroy', [:admin, @admin_user], confirm: "USER #{@admin_user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn grouped btn-small btn-remove" + = link_to 'Block', block_admin_user_path(@user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn grouped btn-small btn-remove" + = link_to 'Destroy', [:admin, @user], confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn grouped btn-small btn-remove" %hr .row @@ -24,89 +24,62 @@ %h5.title Account: .pull-right - = image_tag gravatar_icon(@admin_user.email, 32), class:"avatar s32", alt:"" + = image_tag gravatar_icon(@user.email, 32), class: "avatar s32" %ul.well-list %li %span.light Name: - %strong= @admin_user.name + %strong= @user.name %li %span.light Username: %strong - = @admin_user.username + = @user.username %li %span.light Email: %strong - = mail_to @admin_user.email + = mail_to @user.email %li %span.light Member since: %strong - = @admin_user.created_at.stamp("Nov 12, 2031") + = @user.created_at.stamp("Nov 12, 2031") %li %span.light Last sign-in at: %strong - - if @admin_user.last_sign_in_at - = @admin_user.last_sign_in_at.stamp("Nov 12, 2031") + - if @user.last_sign_in_at + = @user.last_sign_in_at.stamp("Nov 12, 2031") - else never - - if @admin_user.ldap_user? + - if @user.ldap_user? %li %span.light LDAP uid: %strong - = @admin_user.extern_uid + = @user.extern_uid - - if @admin_user.created_by + - if @user.created_by %li %span.light Created by: %strong - = link_to @admin_user.created_by.name, [:admin, @admin_user.created_by] - %hr - %h5 - Add User to Projects - %small - Read more about project permissions - %strong= link_to "here", help_permissions_path, class: "vlink" - %br - = form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do - .control-group - = label_tag :project_ids, "Projects", class: 'control-label' - .controls - = select_tag :project_ids, options_from_collection_for_select(@not_in_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span3' - .control-group - = label_tag :project_access, "Project Access", class: 'control-label' - .controls - = select_tag :project_access, options_for_select(Project.access_options), class: "project-access-select chosen span3" + = link_to @user.created_by.name, [:admin, @user.created_by] - .form-actions - = submit_tag 'Add', class: "btn btn-create" - .pull-right - %br - - - if @admin_user.owned_groups.present? + - if @user.users_groups.present? .ui-box - %h5.title Owned groups: + %h5.title Groups: %ul.well-list - - @admin_user.groups.each do |group| + - @user.users_groups.each do |user_group| + - group = user_group.group %li %strong= link_to group.name, admin_group_path(group) - - - if @admin_user.owned_teams.present? - .ui-box - %h5.title Owned teams: - %ul.well-list - - @admin_user.owned_teams.each do |team| - %li - %strong= link_to team.name, admin_team_path(team) - + .pull-right + %span.light= user_group.human_access .span6 .ui-box %h5.title Projects (#{@projects.count}) %ul.well-list - @projects.sort_by(&:name_with_namespace).each do |project| - - tm = project.team.get_tm(@admin_user.id) + - tm = project.team.find_tm(@user.id) %li = link_to admin_project_path(project), class: dom_class(project) do - if project.namespace @@ -115,16 +88,8 @@ %strong.well-title = truncate(project.name, length: 45) - - if project.owner == @admin_user - %span.label.label-info owner - - if tm .pull-right - = link_to edit_admin_project_member_path(project, tm.user), class: "btn grouped btn-small" do - %i.icon-edit - = link_to admin_project_member_path(project, tm.user), confirm: remove_from_project_team_message(project, @admin_user), method: :delete, class: "btn grouped btn-small btn-remove" do + %span.light= tm.human_access + = link_to admin_project_member_path(project, tm.user), confirm: remove_from_project_team_message(project, @user), method: :delete, class: "btn btn-small btn-remove" do %i.icon-remove - - .pull-right.light - = tm.project_access_human - diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml index 2fedf87a9ba..a072641a074 100644 --- a/app/views/dashboard/_groups.html.haml +++ b/app/views/dashboard/_groups.html.haml @@ -1,24 +1,22 @@ .ui-box - %h5.title - Groups - %span.light - (#{groups.count}) + %h5.title.clearfix + = search_field_tag :filter_group, nil, placeholder: 'Filter by name', class: 'dash-filter' - if current_user.can_create_group? %span.pull-right - = link_to new_group_path, class: "btn btn-small" do + = link_to new_group_path, class: "btn" do %i.icon-plus New Group - %ul.well-list + %ul.well-list.dash-list - groups.each do |group| - %li + %li.group-row = link_to group_path(id: group.path), class: dom_class(group) do - %strong.well-title + %span.group-name = truncate(group.name, length: 35) %span.arrow - → - %span.last_activity - %strong Owner: - %span= group.owner_name + %i.icon-angle-right + %span.owner-info + %span Owner: + %span.owner= group.owner_name - if groups.blank? %li %h3.nothing_here_message You have no groups yet. diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml index a106e83e783..d52f10fa759 100644 --- a/app/views/dashboard/_projects.html.haml +++ b/app/views/dashboard/_projects.html.haml @@ -1,28 +1,27 @@ .ui-box - %h5.title - Projects - %span.light - (#{@projects_count}) + %h5.title.clearfix + = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-filter' - if current_user.can_create_project? %span.pull-right - = link_to new_project_path, class: "btn btn-small" do + = link_to new_project_path, class: "btn" do %i.icon-plus New Project - %ul.well-list + %ul.well-list.dash-list - projects.each do |project| - %li + %li.project-row = link_to project_path(project), class: dom_class(project) do - - if project.namespace - = project.namespace.human_name - \/ - %strong.well-title + %span.namespace-name + - if project.namespace + = project.namespace.human_name + \/ + %span.project-name = truncate(project.name, length: 25) %span.arrow - → - %span.last_activity - %strong Last activity: - %span= project_last_activity(project) + %i.icon-angle-right + %span.last-activity + %span Last activity: + %span.date= project_last_activity(project) - if projects.blank? %li %h3.nothing_here_message There are no projects here. diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml index 748ff9810b5..fed4b2776ae 100644 --- a/app/views/dashboard/_sidebar.html.haml +++ b/app/views/dashboard/_sidebar.html.haml @@ -1,18 +1,18 @@ %ul.nav.nav-tabs.dash-sidebar-tabs %li.active - = link_to 'Projects', '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' + = link_to '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' do + Projects + %span.badge= @projects_count %li - = link_to 'Groups', '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' - %li - = link_to 'Teams', '#teams', 'data-toggle' => 'tab', id: 'sidebar-teams-tab' + = link_to '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' do + Groups + %span.badge= @groups.count .tab-content .tab-pane.active#projects = render "projects", projects: @projects .tab-pane#groups = render "groups", groups: @groups - .tab-pane#teams - = render "teams", teams: @teams .prepend-top-20 %span.rss-icon diff --git a/app/views/dashboard/_teams.html.haml b/app/views/dashboard/_teams.html.haml deleted file mode 100644 index 95d87f508e0..00000000000 --- a/app/views/dashboard/_teams.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -.ui-box.teams-box - %h5.title - Teams - %span.light - (#{teams.count}) - %span.pull-right - = link_to new_team_path, class: "btn btn-small" do - %i.icon-plus - New Team - %ul.well-list - - teams.each do |team| - %li - = link_to team_path(id: team.path), class: dom_class(team) do - %strong.well-title= truncate(team.name, length: 35) - %span.pull-right.light - - if team.owner == current_user - %i.icon-wrench - - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id) - - if tm - = tm.access_human - - if teams.blank? - %li - %h3.nothing_here_message You have no teams yet. diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index b41edb9eb60..356e0847ae7 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -22,7 +22,7 @@ %ul.well-list.issues-list - group[1].each do |issue| - = render issue + = render 'projects/issues/issue', issue: issue %hr = paginate @issues, theme: "gitlab" - else diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml index 25239105e3b..5c5fa528fab 100644 --- a/app/views/dashboard/projects.html.haml +++ b/app/views/dashboard/projects.html.haml @@ -1,15 +1,3 @@ -%h3.page_title - Projects - %span - (#{@projects.total_count}) - - if current_user.can_create_project? - %span.pull-right - = link_to new_project_path, class: "btn btn-tiny info" do - %i.icon-plus - New Project - - -%hr .row .span3 %ul.nav.nav-pills.nav-stacked @@ -19,8 +7,10 @@ = link_to "Personal", projects_dashboard_path(scope: 'personal') = nav_tab :scope, 'joined' do = link_to "Joined", projects_dashboard_path(scope: 'joined') + = nav_tab :scope, 'owned' do + = link_to "Owned", projects_dashboard_path(scope: 'owned') - - if @labels.any? + - if @labels.present? %p.light Filter by label: %ul.bordered-list - @labels.each do |label| @@ -31,48 +21,31 @@ .span9 - - if @projects.any? - = form_tag projects_dashboard_path, method: 'get' do - %fieldset.dashboard-search-filter - = hidden_field_tag "scope", params[:scope] - = search_field_tag "search", params[:search], { id: 'dashboard_projects_search', placeholder: 'Search', class: 'left input-xxlarge'} - = button_tag type: 'submit', class: 'btn' do - %i.icon-search - - %ul.bordered-list - - @projects.each do |project| - %li.clearfix - .clearfix - %h5 - = link_to project_path(project), class: dom_class(project) do - - if project.namespace - = project.namespace.human_name - %span= "/" - %strong - = truncate(project.name, length: 45) - .pull-right.light - - if project.owner == current_user - %i.icon-wrench - - tm = project.team.get_tm(current_user.id) - - if tm - %strong= tm.project_access_human - .clearfix - .left - - if project.description.present? - %span.light= project.description - - project.labels.each do |label| - %span.label.label-info - %i.icon-tag - = label.name + .ui-box + %h5.title + Projects (#{@projects.total_count}) + .pull-right.light + %small Last activity + %ul.well-list + - @projects.each do |project| + %li + - if project.public + = public_icon + - else + = private_icon + = link_to project_path(project), class: dom_class(project) do + %strong + = project.name_with_namespace + - if project.description.present? + %span.light + = truncate project.description, length: 80 .pull-right.light - %small.light - Last activity #{project_last_activity(project)} + %small #{project_last_activity(project)} - - if @projects.blank? - %li - %h3.nothing_here_message There are no projects here. + - if @projects.blank? + %li + %h3.nothing_here_message There are no projects here. .bottom - %hr = paginate @projects, theme: "gitlab" diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index e5800025c6d..d85b4ab08b2 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,5 +1,4 @@ = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: "login-box" }) do |f| - = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo" %h3 Change your password = devise_error_messages! = f.hidden_field :reset_password_token diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb deleted file mode 100644 index 0e39f318726..00000000000 --- a/app/views/devise/passwords/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { class: "login-box", method: :post }) do |f| %> - <%= image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo" %> - <%= devise_error_messages! %> - <%= f.email_field :email, placeholder: "Email", class: "text" %> - <br/> - <br/> - <%= f.submit "Reset password", class: "btn-primary btn" %> - <div class="pull-right"> <%= link_to "Sign in", new_session_path(resource_name), class: "btn" %><br /></div> -<% end %> diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml new file mode 100644 index 00000000000..5d47cbc3b83 --- /dev/null +++ b/app/views/devise/passwords/new.html.haml @@ -0,0 +1,11 @@ += form_for(resource, as: resource_name, url: password_path(resource_name), html: { class: "login-box", method: :post }) do |f| + %h3.page_title Reset password + %br + = devise_error_messages! + = f.email_field :email, placeholder: "Email", class: "text" + %br/ + %br/ + = f.submit "Reset password", class: "btn-primary btn" + .pull-right + = link_to "Sign in", new_session_path(resource_name), class: "btn" + %br/ diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 12b0438229b..17a0c8fd79a 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,5 +1,6 @@ = form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "login-box" }) do |f| - = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo" + %h3.page_title Sign Up + %br = devise_error_messages! %div = f.text_field :name, class: "text top", placeholder: "Name", required: true diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 8b71ebed5f4..50452255860 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,12 +1,12 @@ .login-box - = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo" - + %h3.page_title Sign in + %br - if ldap_enabled? %ul.nav.nav-tabs %li.active = link_to 'LDAP', '#tab-ldap', 'data-toggle' => 'tab' %li - = link_to 'Ordinary', '#tab-signin', 'data-toggle' => 'tab' + = link_to 'Standard', '#tab-signin', 'data-toggle' => 'tab' .tab-content %div#tab-ldap.tab-pane.active = render partial: 'devise/sessions/new_ldap' diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml index 9dd0767e896..8384bbecd06 100644 --- a/app/views/events/event/_note.html.haml +++ b/app/views/events/event/_note.html.haml @@ -13,9 +13,10 @@ = sanitize(markdown(truncate(event.target.note, length: 150)), tags: %w(a img b pre p)) - note = event.target - if note.attachment.url - = link_to note.attachment.secure_url, target: "_blank", class: 'note-file-attach' do - - if note.attachment.image? + - if note.attachment.image? + = link_to note.attachment.url, target: '_blank' do = image_tag note.attachment.url, class: 'note-image-attach' - - else + - else + = link_to note.attachment.secure_url, target: "_blank", class: 'note-file-attach' do %i.icon-paper-clip = note.attachment_identifier diff --git a/app/views/graphs/show.js.haml b/app/views/graphs/show.js.haml deleted file mode 100644 index b7c9b4113e9..00000000000 --- a/app/views/graphs/show.js.haml +++ /dev/null @@ -1,16 +0,0 @@ -:plain - controller = new ContributorsStatGraph - controller.init(#{@log}) - - $("select").change( function () { - var field = $(this).val() - controller.set_current_field(field) - controller.redraw_master() - controller.redraw_authors() - }) - - $("#brush_change").change( function () { - controller.change_date_header() - controller.redraw_authors() - }) - diff --git a/app/views/groups/_new_group_member.html.haml b/app/views/groups/_new_group_member.html.haml index 78db1c23320..786a52a6011 100644 --- a/app/views/groups/_new_group_member.html.haml +++ b/app/views/groups/_new_group_member.html.haml @@ -1,18 +1,18 @@ -= form_for @team_member, as: :team_member, url: team_members_group_path(@group) do |f| += form_for @users_group, url: group_users_groups_path(@group) do |f| %fieldset - %legend= "New Team member(s) for projects in #{@group.name}" + %legend= "New Group member(s) for #{@group.name}" - %h6 1. Choose people you want in the team + %h6 1. Choose people you want in the group .clearfix = f.label :user_ids, "People" - .input= users_select_tag(:user_ids, multiple: true) + .input= users_select_tag(:user_ids, multiple: true, class: 'input-large') %h6 2. Set access level for them .clearfix - = f.label :project_access, "Project Access" - .input= select_tag :project_access, options_for_select(Project.access_options, @team_member.project_access), class: "project-access-select chosen" + = f.label :group_access, "Group Access" + .input= select_tag :group_access, options_for_select(UsersGroup.group_access_roles, @users_group.group_access), class: "project-access-select chosen" .form-actions = hidden_field_tag :redirect_to, people_group_path(@group) - = f.submit 'Add', class: "btn btn-save" + = f.submit 'Add users into group', class: "btn btn-create" diff --git a/app/views/groups/_new_member.html.haml b/app/views/groups/_new_member.html.haml deleted file mode 100644 index 4a762ed39ed..00000000000 --- a/app/views/groups/_new_member.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -= form_for @team_member, as: :team_member, url: project_team_members_path(@project, @team_member) do |f| - %fieldset - %legend= "New Team member(s) for #{@project.name}" - - %h6 1. Choose people you want in the team - .clearfix - = f.label :user_ids, "People" - .input= users_select_tag(:user_ids, multiple: true) - - %h6 2. Set access level for them - .clearfix - = f.label :project_access, "Project Access" - .input= select_tag :project_access, options_for_select(Project.access_options, @team_member.project_access), class: "project-access-select chosen" - - .form-actions - = hidden_field_tag :redirect_to, people_group_path(@group, project_id: @project.id) - = f.submit 'Add', class: "btn btn-save" - diff --git a/app/views/groups/_people_filter.html.haml b/app/views/groups/_people_filter.html.haml deleted file mode 100644 index ee63743eb4f..00000000000 --- a/app/views/groups/_people_filter.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= form_tag people_group_path(@group), method: 'get' do - %fieldset - %legend Projects: - %ul.nav.nav-pills.nav-stacked - - @projects.each do |project| - %li{class: ("active" if params[:project_id] == project.id.to_s)} - = link_to people_group_path(@group, project_id: project.id) do - = project.name_with_namespace - %small.pull-right= project.users.count - - if @projects.blank? - %p.nothing_here_message This group has no projects yet - - %fieldset - %hr - = link_to "Reset", people_group_path(@group), class: 'btn pull-right' - diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml index bf1a624b48f..ff6b71b9ec0 100644 --- a/app/views/groups/_projects.html.haml +++ b/app/views/groups/_projects.html.haml @@ -1,22 +1,21 @@ .ui-box %h5.title - Projects - %small - (#{projects.count}) + Projects (#{projects.count}) - if can? current_user, :manage_group, @group %span.pull-right - = link_to new_project_path(namespace_id: @group.id), class: "btn btn-tiny info" do + = link_to new_project_path(namespace_id: @group.id), class: "btn" do %i.icon-plus New Project %ul.well-list - if projects.blank? %p.nothing_here_message This groups has no projects yet - projects.each do |project| - %li + %li.project-row = link_to project_path(project), class: dom_class(project) do - %strong.well-title= truncate(project.name, length: 25) + %span.project-name + = truncate(project.name, length: 25) %span.arrow - → - %span.last_activity - %strong Last activity: - %span= project_last_activity(project) + %i.icon-angle-right + %span.last-activity + %span Last activity: + %span.date= project_last_activity(project) diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index aaedcc585c1..eeaa4767cf9 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -1,38 +1,26 @@ .row - .span3 - %ul.nav.nav-pills.nav-stacked + .span2 + %ul.nav.nav-pills.nav-stacked.nav-stacked-menu %li.active - = link_to 'Projects', '#tab-projects', 'data-toggle' => 'tab' + = link_to '#tab-edit', 'data-toggle' => 'tab' do + %i.icon-edit + Edit Group %li - = link_to 'Edit Group', '#tab-edit', 'data-toggle' => 'tab' + = link_to '#tab-projects', 'data-toggle' => 'tab' do + %i.icon-folder-close + Projects %li = link_to 'Transfer', '#tab-transfer', 'data-toggle' => 'tab' %li = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab' - .span9 + .span10 .tab-content - .tab-pane.active#tab-projects + .tab-pane.active#tab-edit .ui-box - %h5.title Projects - %ul.well-list - - @group.projects.each do |project| - %li - - if project.public - = public_icon - - else - = private_icon - = link_to project.name_with_namespace, project - .pull-right - = link_to 'Team', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" - = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" - = link_to 'Remove', project, confirm: remove_project_message(project), method: :delete, class: "btn btn-small btn-remove" - - if @group.projects.blank? - %p.nothing_here_message This group has no projects yet - - .tab-pane#tab-edit - .ui-box - %h5.title Edit Group + %h5.title + %strong= @group.name + Group Settings: %div.form-holder = form_for @group do |f| - if @group.errors.any? @@ -52,6 +40,31 @@ .form-actions = f.submit 'Save group', class: "btn btn-save" + .tab-pane#tab-projects + .ui-box + %h5.title + %strong= @group.name + Projects: + - if can? current_user, :manage_group, @group + %span.pull-right + = link_to new_project_path(namespace_id: @group.id), class: "btn btn-tiny" do + %i.icon-plus + New Project + %ul.well-list + - @group.projects.each do |project| + %li + - if project.public + = public_icon + - else + = private_icon + = link_to project.name_with_namespace, project + .pull-right + = link_to 'Team', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" + = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" + = link_to 'Remove', project, confirm: remove_project_message(project), method: :delete, class: "btn btn-small btn-remove" + - if @group.projects.blank? + %p.nothing_here_message This group has no projects yet + .tab-pane#tab-transfer .ui-box.ui-box-danger %h5.title Transfer group diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 6d642b65cbd..38dac634bf9 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -16,7 +16,7 @@ = link_to_project project %ul.well-list.issues-list - group[1].each do |issue| - = render issue + = render 'projects/issues/issue', issue: issue %hr = paginate @issues, theme: "gitlab" - else diff --git a/app/views/groups/people.html.haml b/app/views/groups/people.html.haml index 44f623006eb..5b595ad3584 100644 --- a/app/views/groups/people.html.haml +++ b/app/views/groups/people.html.haml @@ -1,20 +1,20 @@ +- can_manage_group = current_user.can? :manage_group, @group .row - .span3 - = render 'people_filter' - .span9 - - if can?(current_user, :manage_group, @group) - = render (@project ? "new_member" : "new_group_member") + .span6 + - if can_manage_group + = render "new_group_member" + - else + .light-well + %h4.nothing_here_message + Only group owners can manage group members + .span6 .ui-box %h5.title - Team + #{@group.name} Group Members %small - (#{@users.size}) + (#{@members.count}) %ul.well-list - - @users.each do |user| - %li - = image_tag gravatar_icon(user.email, 16), class: "avatar s16" , alt: '' - %strong= user.name - %span.cgray= user.email - - if @group.owner == user - %span.btn.btn-small.disabled.pull-right Group Owner - + - @members.each do |member| + = render 'users_groups/users_group', member: member, show_controls: can_manage_group + %p.light + Group members get access to all projects in this group diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml new file mode 100644 index 00000000000..e979e7c0d07 --- /dev/null +++ b/app/views/help/_shortcuts.html.haml @@ -0,0 +1,30 @@ +#modal-shortcuts.modal.hide + .modal-header + %a.close{href: "#", "data-dismiss" => "modal"} × + %h3 Keyboard Shortcuts + .modal-body + %h5 Global Shortcuts + %p + %span.label.label-inverse s + – + Focus Search + %p + %span.label.label-inverse ? + – + Show this dialog + + %h5 Project Files browsing + %p + %span.label.label-inverse + %i.icon-arrow-up + – + Move selection up + %p + %span.label.label-inverse + %i.icon-arrow-down + – + Move selection down + %p + %span.label.label-inverse Enter + – + Open selection diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index 80ddc05b503..6529da7ddd5 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -25,6 +25,9 @@ = link_to "search bar", '#', onclick: "$('#search').focus();" on the top of this page %li + Use + = link_to "shortcuts", '#', onclick: "new Shortcuts()" + %li Ask in our = link_to "mailing list", "https://groups.google.com/forum/#!forum/gitlabhq" or on @@ -32,6 +35,7 @@ %li Browse our = link_to "issue tracker", "https://github.com/gitlabhq/gitlabhq/issues" + .span4 .ui-box .title diff --git a/app/views/help/shortcuts.js.haml b/app/views/help/shortcuts.js.haml new file mode 100644 index 00000000000..99ed042ea3b --- /dev/null +++ b/app/views/help/shortcuts.js.haml @@ -0,0 +1,3 @@ +:plain + $("body").append("#{escape_javascript(render('shortcuts'))}"); + $("#modal-shortcuts").modal(); diff --git a/app/views/keys/_show.html.haml b/app/views/keys/_show.html.haml deleted file mode 100644 index 52bbea6fc7b..00000000000 --- a/app/views/keys/_show.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -%tr - %td - = link_to key_path(key) do - %strong= key.title - %td - %span.cgray - Added - = time_ago_in_words(key.created_at) - ago - %td - = link_to 'Remove', key, confirm: 'Are you sure?', method: :delete, class: "btn btn-small btn-remove delete-key pull-right" - diff --git a/app/views/keys/edit.html.haml b/app/views/keys/edit.html.haml deleted file mode 100644 index 60a3afedddc..00000000000 --- a/app/views/keys/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 Editing key - -= render 'form' - -= link_to 'Show', @key -\| -= link_to 'Back', keys_path diff --git a/app/views/keys/index.html.haml b/app/views/keys/index.html.haml deleted file mode 100644 index 7730b344a7d..00000000000 --- a/app/views/keys/index.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%h3.page_title - SSH Keys - = link_to "Add new", new_key_path, class: "btn pull-right" - -%hr -%p.slead - SSH key allows you to establish a secure connection between your computer and GitLab - - -%table#keys-table - %thead - %tr - %th Name - %th Added - %th - - @keys.each do |key| - = render(partial: 'show', locals: {key: key}) - - if @keys.blank? - %tr - %td{colspan: 3} - %p.nothing_here_message There are no SSH keys with access to your account. - diff --git a/app/views/keys/show.html.haml b/app/views/keys/show.html.haml deleted file mode 100644 index 059fe5e5806..00000000000 --- a/app/views/keys/show.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h3.page_title - Public key: - = @key.title - %small - created at - = @key.created_at.stamp("Aug 21, 2011") -.back_link - = link_to keys_path do - ← To keys list -%hr - -%pre= @key.key -.pull-right - = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: "btn btn-remove delete-key" diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index 8a3581cd318..5644c89016b 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -36,5 +36,5 @@ = link_to destroy_user_session_path, class: "logout", method: :delete, title: "Logout", class: 'has_bottom_tooltip', 'data-original-title' => 'Logout' do %i.icon-signout %li - = link_to current_user, class: "profile-pic" do - = image_tag(gravatar_icon(current_user.email, 26), alt: '') + = link_to current_user, class: "profile-pic", id: 'profile-pic' do + = image_tag gravatar_icon(current_user.email, 26), alt: '' diff --git a/app/views/layouts/_init_auto_complete.html.haml b/app/views/layouts/_init_auto_complete.html.haml index 3549794b90d..7d16a75af6e 100644 --- a/app/views/layouts/_init_auto_complete.html.haml +++ b/app/views/layouts/_init_auto_complete.html.haml @@ -1,6 +1,4 @@ :javascript - $(function() { - GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_project_path(@project)}" - GitLab.GfmAutoComplete.Emoji.assetBase = '#{image_path("emoji")}' - GitLab.GfmAutoComplete.setup(); - }); + GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_project_path(@project)}" + GitLab.GfmAutoComplete.Emoji.assetBase = '#{image_path("emoji")}' + GitLab.GfmAutoComplete.setup(); diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml index a9758f19d36..0fa36211739 100644 --- a/app/views/layouts/devise.html.haml +++ b/app/views/layouts/devise.html.haml @@ -5,4 +5,6 @@ = render "layouts/flash" .container .content + %center + = image_tag image_path "login-logo.png" = yield diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml index e9ca29ea3be..73946f99889 100644 --- a/app/views/layouts/nav/_admin.html.haml +++ b/app/views/layouts/nav/_admin.html.haml @@ -4,8 +4,6 @@ %i.icon-home = nav_link(controller: :projects) do = link_to "Projects", admin_projects_path - = nav_link(controller: :teams) do - = link_to "Teams", admin_teams_path = nav_link(controller: :groups) do = link_to "Groups", admin_groups_path = nav_link(controller: :users) do diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml index e5e4b27c665..c2db7067e44 100644 --- a/app/views/layouts/nav/_profile.html.haml +++ b/app/views/layouts/nav/_profile.html.haml @@ -7,7 +7,7 @@ = nav_link(controller: :notifications) do = link_to "Notifications", profile_notifications_path = nav_link(controller: :keys) do - = link_to keys_path do + = link_to profile_keys_path do SSH Keys %span.count= current_user.keys.count = nav_link(path: 'profiles#design') do diff --git a/app/views/layouts/nav/_team.html.haml b/app/views/layouts/nav/_team.html.haml deleted file mode 100644 index 575c5b7e1f3..00000000000 --- a/app/views/layouts/nav/_team.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -%ul - = nav_link(path: 'teams#show', html_options: {class: 'home'}) do - = link_to team_path(@team), title: "Home" do - %i.icon-home - - = nav_link(path: 'teams#issues') do - = link_to issues_team_path(@team) do - Issues - %span.count= Issue.opened.of_user_team(@team).count - - = nav_link(path: 'teams#merge_requests') do - = link_to merge_requests_team_path(@team) do - Merge Requests - %span.count= MergeRequest.opened.of_user_team(@team).count - - = nav_link(controller: [:members]) do - = link_to team_members_path(@team), class: "team-tab tab" do - Members - %span.count= @team.members.count - - - if can? current_user, :manage_user_team, @team - = nav_link(path: 'teams#edit') do - = link_to edit_team_path(@team), class: "stat-tab tab " do - Settings - diff --git a/app/views/layouts/project_settings.html.haml b/app/views/layouts/project_settings.html.haml new file mode 100644 index 00000000000..ea739da73d8 --- /dev/null +++ b/app/views/layouts/project_settings.html.haml @@ -0,0 +1,20 @@ +!!! 5 +%html{ lang: "en"} + = render "layouts/head", title: @project.name_with_namespace + %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } + = render "layouts/head_panel", title: project_title(@project) + = render "layouts/init_auto_complete" + = render "layouts/flash" + - if can?(current_user, :download_code, @project) + = render 'shared/no_ssh' + + %nav.main-nav + .container= render 'layouts/nav/project' + + .container + .content + .row + .span2 + = render "projects/settings_nav" + .span10 + = yield diff --git a/app/views/layouts/project_resource.html.haml b/app/views/layouts/projects.html.haml index 6d8bf9b710b..6d8bf9b710b 100644 --- a/app/views/layouts/project_resource.html.haml +++ b/app/views/layouts/projects.html.haml diff --git a/app/views/notifications/show.html.haml b/app/views/notifications/show.html.haml deleted file mode 100644 index b7f39306fd8..00000000000 --- a/app/views/notifications/show.html.haml +++ /dev/null @@ -1,77 +0,0 @@ -%h3.page_title Setup your notification level - -%br - -%p.light - %strong Disabled - – You will not get any notifications via email -%p.light - %strong Participating - – You will receive only notifications from related resources(ex. from assigned issue or your commit) -%p.light - %strong Watch - – You will receive all notifications from projects in which you participate -%hr - -.row - .span4 - %h5 Global setting - .span7 - = form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do - = hidden_field_tag :notification_type, 'global' - - = label_tag do - = radio_button_tag :notification_level, Notification::N_DISABLED, @notification.disabled?, class: 'trigger-submit' - %span Disabled - - = label_tag do - = radio_button_tag :notification_level, Notification::N_PARTICIPATING, @notification.participating?, class: 'trigger-submit' - %span Participating - - = label_tag do - = radio_button_tag :notification_level, Notification::N_WATCH, @notification.watch?, class: 'trigger-submit' - %span Watch - -%hr -= link_to '#', class: 'js-toggle-visibility-link' do - %h6.btn.btn-tiny - %i.icon-chevron-down - %span Per project notifications setting - -%ul.well-list.js-toggle-visibility-container.hide - - @users_projects.each do |users_project| - - notification = Notification.new(users_project) - %li - .row - .span4 - %span - = link_to_project(users_project.project) - .span7 - = form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do - = hidden_field_tag :notification_type, 'project', id: dom_id(users_project, 'notification_type') - = hidden_field_tag :notification_id, users_project.id, id: dom_id(users_project, 'notification_id') - - = label_tag do - = radio_button_tag :notification_level, Notification::N_GLOBAL, notification.global?, id: dom_id(users_project, 'notification_level'), class: 'trigger-submit' - %span Use global setting - - = label_tag do - = radio_button_tag :notification_level, Notification::N_DISABLED, notification.disabled?, id: dom_id(users_project, 'notification_level'), class: 'trigger-submit' - %span Disabled - - = label_tag do - = radio_button_tag :notification_level, Notification::N_PARTICIPATING, notification.participating?, id: dom_id(users_project, 'notification_level'), class: 'trigger-submit' - %span Participating - - = label_tag do - = radio_button_tag :notification_level, Notification::N_WATCH, notification.watch?, id: dom_id(users_project, 'notification_level'), class: 'trigger-submit' - %span Watch - - -.save-status-fixed - %span.update-success.cgreen.hide - %i.icon-ok - Saved - %span.update-failed.cred.hide - %i.icon-remove - Failed diff --git a/app/views/notify/new_ssh_key_email.html.haml b/app/views/notify/new_ssh_key_email.html.haml index eff197ce0f4..deb0822d8f2 100644 --- a/app/views/notify/new_ssh_key_email.html.haml +++ b/app/views/notify/new_ssh_key_email.html.haml @@ -7,4 +7,4 @@ %code= @key.title %p If this key was added in error, you can remove it here: - = link_to "SSH Keys", keys_url + = link_to "SSH Keys", profile_keys_url diff --git a/app/views/notify/new_ssh_key_email.text.erb b/app/views/notify/new_ssh_key_email.text.erb index 2b1f8a06858..5f0080c2b76 100644 --- a/app/views/notify/new_ssh_key_email.text.erb +++ b/app/views/notify/new_ssh_key_email.text.erb @@ -4,4 +4,4 @@ A new public key was added to your account: title.................. <%= @key.title %> -If this key was added in error, you can remove it here: <%= keys_url %> +If this key was added in error, you can remove it here: <%= profile_keys_url %> diff --git a/app/views/notify/reassigned_issue_email.html.haml b/app/views/notify/reassigned_issue_email.html.haml index 018f20bf708..6d332af3d70 100644 --- a/app/views/notify/reassigned_issue_email.html.haml +++ b/app/views/notify/reassigned_issue_email.html.haml @@ -2,8 +2,10 @@ = "Reassigned Issue ##{@issue.id}" = link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue) %p - Assignee changed from - %strong #{@previous_assignee.name} + Assignee changed + - if @previous_assignee + from + %strong #{@previous_assignee.name} to %strong #{@issue.assignee_name} diff --git a/app/views/notify/reassigned_issue_email.text.erb b/app/views/notify/reassigned_issue_email.text.erb index 497044184dc..867c4d01da5 100644 --- a/app/views/notify/reassigned_issue_email.text.erb +++ b/app/views/notify/reassigned_issue_email.text.erb @@ -2,6 +2,4 @@ Reassigned Issue <%= @issue.id %> <%= url_for(project_issue_url(@issue.project, @issue)) %> - -Assignee changed from <%= @previous_assignee.name %> to <%= @issue.assignee_name %> - +Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= @issue.assignee_name %> diff --git a/app/views/notify/reassigned_merge_request_email.html.haml b/app/views/notify/reassigned_merge_request_email.html.haml index 9039bc8b12d..5ad72764e38 100644 --- a/app/views/notify/reassigned_merge_request_email.html.haml +++ b/app/views/notify/reassigned_merge_request_email.html.haml @@ -2,7 +2,9 @@ = "Reassigned Merge Request !#{@merge_request.id}" = link_to_gfm truncate(@merge_request.title, length: 30), project_merge_request_url(@merge_request.project, @merge_request) %p - Assignee changed from - %strong #{@previous_assignee.name} + Assignee changed + - if @previous_assignee + from + %strong #{@previous_assignee.name} to %strong #{@merge_request.assignee_name} diff --git a/app/views/notify/reassigned_merge_request_email.text.erb b/app/views/notify/reassigned_merge_request_email.text.erb index 1af4ab559f6..25b2a43fcdd 100644 --- a/app/views/notify/reassigned_merge_request_email.text.erb +++ b/app/views/notify/reassigned_merge_request_email.text.erb @@ -3,5 +3,5 @@ Reassigned Merge Request <%= @merge_request.id %> <%= url_for(project_merge_request_url(@merge_request.project, @merge_request)) %> -Assignee changed from <%= @previous_assignee.name %> to <%= @merge_request.assignee_name %> +Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= @merge_request.assignee_name %> diff --git a/app/views/profiles/design.html.haml b/app/views/profiles/design.html.haml index 9ada69c9d5d..9b6cace4e89 100644 --- a/app/views/profiles/design.html.haml +++ b/app/views/profiles/design.html.haml @@ -24,7 +24,7 @@ = label_tag do .prev.gray = f.radio_button :theme_id, 4 - SlateGray + Gray = label_tag do .prev.violet diff --git a/app/views/keys/_form.html.haml b/app/views/profiles/keys/_form.html.haml index fe26216b1d5..7ba8e20a44f 100644 --- a/app/views/keys/_form.html.haml +++ b/app/views/profiles/keys/_form.html.haml @@ -1,6 +1,6 @@ %div - = form_for @key do |f| - -if @key.errors.any? + = form_for [:profile, @key] do |f| + - if @key.errors.any? .alert.alert-error %ul - @key.errors.full_messages.each do |msg| @@ -12,13 +12,12 @@ .clearfix = f.label :key .input + %p.light + Paste your public key here. Read more about how generate it #{link_to "here", help_ssh_path} = f.text_area :key, class: [:xxlarge, :thin_area] - %p.hint - Paste your public key here. Read more about how generate it - = link_to "here", help_ssh_path .actions - = f.submit 'Save', class: "btn btn-save" - = link_to "Cancel", keys_path, class: "btn btn-cancel" + = f.submit 'Add key', class: "btn btn-create" + = link_to "Cancel", profile_keys_path, class: "btn btn-cancel" diff --git a/app/views/profiles/keys/_key.html.haml b/app/views/profiles/keys/_key.html.haml new file mode 100644 index 00000000000..d0a3fe32c35 --- /dev/null +++ b/app/views/profiles/keys/_key.html.haml @@ -0,0 +1,11 @@ +%li + = link_to profile_key_path(key) do + %strong= key.title + %span + (#{key.fingerprint}) + %span.cgray + added + = time_ago_in_words(key.created_at) + ago + + = link_to 'Remove', profile_key_path(key), confirm: 'Are you sure?', method: :delete, class: "btn btn-small btn-remove delete-key pull-right" diff --git a/app/views/profiles/keys/index.html.haml b/app/views/profiles/keys/index.html.haml new file mode 100644 index 00000000000..05c481ded23 --- /dev/null +++ b/app/views/profiles/keys/index.html.haml @@ -0,0 +1,24 @@ +%h3.page_title + SSH Keys + = link_to "Add SSH Key", new_profile_key_path, class: "btn pull-right btn-primary" + +%br +%p.light + SSH key allows you to establish a secure connection between your computer and GitLab +%p.light + Before you can add ssh key you need to + = link_to "generate it", help_ssh_path + + + +.ui-box + %h5.title + SSH Keys (#{@keys.count}) + .pull-right + %ul.well-list#keys-table + = render @keys + - if @keys.blank? + %li + %h3.nothing_here_message There are no SSH keys with access to your account. + + diff --git a/app/views/keys/new.html.haml b/app/views/profiles/keys/new.html.haml index fff3805890e..fff3805890e 100644 --- a/app/views/keys/new.html.haml +++ b/app/views/profiles/keys/new.html.haml diff --git a/app/views/profiles/keys/show.html.haml b/app/views/profiles/keys/show.html.haml new file mode 100644 index 00000000000..735e9d1f936 --- /dev/null +++ b/app/views/profiles/keys/show.html.haml @@ -0,0 +1,22 @@ +.row + .span4 + .ui-box + %h5.title + SSH Key + %ul.well-list + %li + %span.light Title: + %strong= @key.title + %li + %span.light Created at: + %strong= @key.created_at.stamp("Aug 21, 2011") + + .span8 + %p + %span.light Fingerprint: + %strong= @key.fingerprint + %pre.well-pre + = @key.key + +.pull-right + = link_to 'Remove', profile_key_path(@key), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove delete-key" diff --git a/app/views/profiles/notifications/_settings.html.haml b/app/views/profiles/notifications/_settings.html.haml new file mode 100644 index 00000000000..1a4a4a9f916 --- /dev/null +++ b/app/views/profiles/notifications/_settings.html.haml @@ -0,0 +1,29 @@ +%li + .row + .span4 + %span + - if membership.kind_of? UsersGroup + = link_to membership.group.name, membership.group + - else + = link_to_project(membership.project) + .span7 + = form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do + = hidden_field_tag :notification_type, type, id: dom_id(membership, 'notification_type') + = hidden_field_tag :notification_id, membership.id, id: dom_id(membership, 'notification_id') + + = label_tag do + = radio_button_tag :notification_level, Notification::N_GLOBAL, notification.global?, id: dom_id(membership, 'notification_level'), class: 'trigger-submit' + %span Use global setting + + = label_tag do + = radio_button_tag :notification_level, Notification::N_DISABLED, notification.disabled?, id: dom_id(membership, 'notification_level'), class: 'trigger-submit' + %span Disabled + + = label_tag do + = radio_button_tag :notification_level, Notification::N_PARTICIPATING, notification.participating?, id: dom_id(membership, 'notification_level'), class: 'trigger-submit' + %span Participating + + = label_tag do + = radio_button_tag :notification_level, Notification::N_WATCH, notification.watch?, id: dom_id(membership, 'notification_level'), class: 'trigger-submit' + %span Watch + diff --git a/app/views/profiles/notifications/show.html.haml b/app/views/profiles/notifications/show.html.haml new file mode 100644 index 00000000000..069747097c5 --- /dev/null +++ b/app/views/profiles/notifications/show.html.haml @@ -0,0 +1,60 @@ +%h3.page_title Setup your notification level + +%br + +%p.light + %strong Disabled + – You will not get any notifications via email +%p.light + %strong Participating + – You will receive only notifications from related resources(ex. from assigned issue or your commit) +%p.light + %strong Watch + – You will receive all notifications from projects in which you participate +%hr + +.row + .span4 + %h5 Global setting + .span7 + = form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do + = hidden_field_tag :notification_type, 'global' + + = label_tag do + = radio_button_tag :notification_level, Notification::N_DISABLED, @notification.disabled?, class: 'trigger-submit' + %span Disabled + + = label_tag do + = radio_button_tag :notification_level, Notification::N_PARTICIPATING, @notification.participating?, class: 'trigger-submit' + %span Participating + + = label_tag do + = radio_button_tag :notification_level, Notification::N_WATCH, @notification.watch?, class: 'trigger-submit' + %span Watch + +%hr += link_to '#', class: 'js-toggle-visibility-link' do + %h6.btn.btn-tiny + %i.icon-chevron-down + %span Advanced notifications settings +.js-toggle-visibility-container.hide + %h5 Groups: + %ul.well-list + - @users_groups.each do |users_group| + - notification = Notification.new(users_group) + = render 'settings', type: 'group', membership: users_group, notification: notification + + %h5 Projects: + %ul.well-list + - @users_projects.each do |users_project| + - notification = Notification.new(users_project) + = render 'settings', type: 'project', membership: users_project, notification: notification + + +.save-status-fixed + %span.update-success.cgreen.hide + %i.icon-ok + Saved + %span.update-failed.cred.hide + %i.icon-remove + Failed diff --git a/app/views/notifications/update.js.haml b/app/views/profiles/notifications/update.js.haml index 88e74d50671..88e74d50671 100644 --- a/app/views/notifications/update.js.haml +++ b/app/views/profiles/notifications/update.js.haml diff --git a/app/views/passwords/new.html.haml b/app/views/profiles/passwords/new.html.haml index c92424160b3..c92424160b3 100644 --- a/app/views/passwords/new.html.haml +++ b/app/views/profiles/passwords/new.html.haml diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 96870924371..0bcf03bae8a 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -67,18 +67,12 @@ Need a group for several dependent projects? = link_to new_group_path, class: "btn btn-tiny" do Create a group - - if current_user.can_create_team? - %li - %p - Want to share a team between projects? - = link_to new_team_path, class: "btn btn-tiny" do - Create a team - unless current_user.projects_limit_left > 100 %fieldset %legend - Owned projects: + Personal projects: %small.pull-right - %span= current_user.owned_projects.count + %span= current_user.personal_projects.count of %span= current_user.projects_limit .padded @@ -89,9 +83,9 @@ %legend SSH public keys: %span.pull-right - = link_to pluralize(current_user.keys.count, 'key'), keys_path + = link_to pluralize(current_user.keys.count, 'key'), profile_keys_path .padded - = link_to "Add Public Key", new_key_path, class: "btn btn-small" + = link_to "Add Public Key", new_profile_key_path, class: "btn btn-small" .form-actions = f.submit 'Save', class: "btn btn-save" diff --git a/app/views/projects/_clone_panel.html.haml b/app/views/projects/_clone_panel.html.haml index ebce06edf74..4aee2b16bdb 100644 --- a/app/views/projects/_clone_panel.html.haml +++ b/app/views/projects/_clone_panel.html.haml @@ -17,9 +17,28 @@ - if can? current_user, :download_code, @project = link_to archive_project_repository_path(@project), class: "btn grouped" do %i.icon-download-alt - Download - - = link_to tags_project_repository_path(@project), class: "btn grouped only-wide", title: 'Git Tags' do - %i.icon-tags - Tags + %span.only-wide Download + .dropdown.pull-right + %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} + %i.icon-plus-sign-alt + %span.only-wide New + %b.caret + %ul.dropdown-menu + - if @project.issues_enabled && can?(current_user, :write_issue, @project) + %li + = link_to url_for_new_issue, title: "New Issue" do + Issue + - if @project.merge_requests_enabled && can?(current_user, :write_merge_request, @project) + %li + = link_to new_project_merge_request_path(@project), title: "New Merge Request" do + Merge Request + - if @project.snippets_enabled && can?(current_user, :write_snippet, @project) + %li + = link_to new_project_snippet_path(@project), title: "New Snippet" do + Snippet + - if can?(current_user, :admin_team_member, @project) + %li.divider + %li + = link_to new_project_team_member_path(@project), title: "New Team member" do + Team member diff --git a/app/views/projects/_settings_nav.html.haml b/app/views/projects/_settings_nav.html.haml index 346bbd2daf3..f59e2871aa3 100644 --- a/app/views/projects/_settings_nav.html.haml +++ b/app/views/projects/_settings_nav.html.haml @@ -1,12 +1,12 @@ -%ul.nav.nav-tabs +%ul.nav.nav-pills.nav-stacked.nav-stacked-menu = nav_link(path: 'projects#edit') do = link_to edit_project_path(@project), class: "stat-tab tab " do %i.icon-edit - Edit + Edit Project = nav_link(controller: [:team_members, :teams]) do = link_to project_team_index_path(@project), class: "team-tab tab" do %i.icon-group - Project Members + Members = nav_link(controller: :deploy_keys) do = link_to project_deploy_keys_path(@project) do %span diff --git a/app/views/blame/_head.html.haml b/app/views/projects/blame/_head.html.haml index 3a883829562..3a883829562 100644 --- a/app/views/blame/_head.html.haml +++ b/app/views/projects/blame/_head.html.haml diff --git a/app/views/blame/show.html.haml b/app/views/projects/blame/show.html.haml index 297e30356a7..3f68db659fc 100644 --- a/app/views/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -17,7 +17,7 @@ %span.file_name = @blob.name %small= number_to_human_size @blob.size - %span.options= render "blob/actions" + %span.options= render "projects/blob/actions" .file_content.blame %table - current_line = 1 diff --git a/app/views/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml index 456c7432c94..456c7432c94 100644 --- a/app/views/blob/_actions.html.haml +++ b/app/views/projects/blob/_actions.html.haml diff --git a/app/views/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml index 68d6c06065c..68d6c06065c 100644 --- a/app/views/blob/_blob.html.haml +++ b/app/views/projects/blob/_blob.html.haml diff --git a/app/views/blob/_download.html.haml b/app/views/projects/blob/_download.html.haml index 864c209db76..864c209db76 100644 --- a/app/views/blob/_download.html.haml +++ b/app/views/projects/blob/_download.html.haml diff --git a/app/views/blob/_image.html.haml b/app/views/projects/blob/_image.html.haml index 7b23f0c810c..7b23f0c810c 100644 --- a/app/views/blob/_image.html.haml +++ b/app/views/projects/blob/_image.html.haml diff --git a/app/views/blob/_text.html.haml b/app/views/projects/blob/_text.html.haml index 122e275219d..122e275219d 100644 --- a/app/views/blob/_text.html.haml +++ b/app/views/projects/blob/_text.html.haml diff --git a/app/views/blob/show.html.haml b/app/views/projects/blob/show.html.haml index d96595bc7f0..d96595bc7f0 100644 --- a/app/views/blob/show.html.haml +++ b/app/views/projects/blob/show.html.haml diff --git a/app/views/commit/_commit_box.html.haml b/app/views/projects/commit/_commit_box.html.haml index 646791773b2..646791773b2 100644 --- a/app/views/commit/_commit_box.html.haml +++ b/app/views/projects/commit/_commit_box.html.haml diff --git a/app/views/commit/huge_commit.html.haml b/app/views/projects/commit/huge_commit.html.haml index 5d447d6cee5..5d447d6cee5 100644 --- a/app/views/commit/huge_commit.html.haml +++ b/app/views/projects/commit/huge_commit.html.haml diff --git a/app/views/commit/show.html.haml b/app/views/projects/commit/show.html.haml index 6cb1a6905ca..603406202ca 100644 --- a/app/views/commit/show.html.haml +++ b/app/views/projects/commit/show.html.haml @@ -7,5 +7,5 @@ and %span.cred #{@commit.stats.deletions} deletions -= render "commits/diffs", diffs: @commit.diffs -= render "notes/notes_with_form" += render "projects/commits/diffs", diffs: @commit.diffs += render "projects/notes/notes_with_form" diff --git a/app/views/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml index eba6c206c46..eba6c206c46 100644 --- a/app/views/commits/_commit.html.haml +++ b/app/views/projects/commits/_commit.html.haml diff --git a/app/views/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml index 933780e4534..933780e4534 100644 --- a/app/views/commits/_commits.html.haml +++ b/app/views/projects/commits/_commits.html.haml diff --git a/app/views/commits/_diff_head.html.haml b/app/views/projects/commits/_diff_head.html.haml index 5aa542287fe..5aa542287fe 100644 --- a/app/views/commits/_diff_head.html.haml +++ b/app/views/projects/commits/_diff_head.html.haml diff --git a/app/views/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml index 3f4d51f753a..8e3cbff8f3e 100644 --- a/app/views/commits/_diffs.html.haml +++ b/app/views/projects/commits/_diffs.html.haml @@ -10,7 +10,7 @@ %p.cgray Showing #{pluralize(diffs.count, "changed file")} .file-stats - = render "commits/diff_head", diffs: diffs + = render "projects/commits/diff_head", diffs: diffs .files - unless @suppress_diff @@ -41,9 +41,9 @@ -# Skipp all non non-supported blobs - next unless file.respond_to?('text?') - if file.text? - = render "commits/text_file", diff: diff, index: i + = render "projects/commits/text_file", diff: diff, index: i - elsif file.image? - old_file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) if @commit.parent_id - = render "commits/image", diff: diff, old_file: old_file, file: file, index: i + = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i - else %p.nothing_here_message No preview for this file type diff --git a/app/views/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml index 20b9195c4c3..20b9195c4c3 100644 --- a/app/views/commits/_head.html.haml +++ b/app/views/projects/commits/_head.html.haml diff --git a/app/views/commits/_image.html.haml b/app/views/projects/commits/_image.html.haml index db02fa333b9..db02fa333b9 100644 --- a/app/views/commits/_image.html.haml +++ b/app/views/projects/commits/_image.html.haml diff --git a/app/views/commits/_text_file.html.haml b/app/views/projects/commits/_text_file.html.haml index 8f737e43887..bfc3180a84c 100644 --- a/app/views/commits/_text_file.html.haml +++ b/app/views/projects/commits/_text_file.html.haml @@ -13,11 +13,11 @@ %td.old_line = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code - if @comments_allowed - = render "notes/diff_note_link", line_code: line_code + = render "projects/notes/diff_note_link", line_code: line_code %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line) - if @reply_allowed - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at) - unless comments.empty? - = render "notes/diff_notes_with_reply", notes: comments + = render "projects/notes/diff_notes_with_reply", notes: comments diff --git a/app/views/commits/show.atom.builder b/app/views/projects/commits/show.atom.builder index 46f9838e84a..46f9838e84a 100644 --- a/app/views/commits/show.atom.builder +++ b/app/views/projects/commits/show.atom.builder diff --git a/app/views/commits/show.html.haml b/app/views/projects/commits/show.html.haml index cb9ef820d3e..cb9ef820d3e 100644 --- a/app/views/commits/show.html.haml +++ b/app/views/projects/commits/show.html.haml diff --git a/app/views/commits/show.js.haml b/app/views/projects/commits/show.js.haml index 797bc14cc1b..045c9dd83d7 100644 --- a/app/views/commits/show.js.haml +++ b/app/views/projects/commits/show.js.haml @@ -1,3 +1,3 @@ :plain - CommitsList.append(#{@commits.count}, "#{escape_javascript(render(partial: 'commits/commits'))}"); + CommitsList.append(#{@commits.count}, "#{escape_javascript(render('projects/commits/commits'))}"); diff --git a/app/views/compare/_form.html.haml b/app/views/projects/compare/_form.html.haml index ef80cd4ac90..ccdd0fc98eb 100644 --- a/app/views/compare/_form.html.haml +++ b/app/views/projects/compare/_form.html.haml @@ -27,13 +27,11 @@ :javascript - $(function() { - var availableTags = #{@project.repository.ref_names.to_json}; + var availableTags = #{@project.repository.ref_names.to_json}; - $("#from, #to").autocomplete({ - source: availableTags, - minLength: 1 - }); - - disableButtonIfEmptyField('#to', '.commits-compare-btn'); + $("#from, #to").autocomplete({ + source: availableTags, + minLength: 1 }); + + disableButtonIfEmptyField('#to', '.commits-compare-btn'); diff --git a/app/views/compare/index.html.haml b/app/views/projects/compare/index.html.haml index 6c9a5fd8305..95cfb60d885 100644 --- a/app/views/compare/index.html.haml +++ b/app/views/projects/compare/index.html.haml @@ -1,4 +1,4 @@ -= render "commits/head" += render "projects/commits/head" %h3.page_title Compare View diff --git a/app/views/compare/show.html.haml b/app/views/projects/compare/show.html.haml index 56c4a113ea0..51e88d1c47d 100644 --- a/app/views/compare/show.html.haml +++ b/app/views/projects/compare/show.html.haml @@ -1,4 +1,4 @@ -= render "commits/head" += render "projects/commits/head" %h3.page_title Compare View @@ -20,4 +20,4 @@ - unless @diffs.empty? %h4 Diff - = render "commits/diffs", diffs: @diffs + = render "projects/commits/diffs", diffs: @diffs diff --git a/app/views/deploy_keys/_deploy_key.html.haml b/app/views/projects/deploy_keys/_deploy_key.html.haml index 45f80ecd556..45f80ecd556 100644 --- a/app/views/deploy_keys/_deploy_key.html.haml +++ b/app/views/projects/deploy_keys/_deploy_key.html.haml diff --git a/app/views/deploy_keys/_form.html.haml b/app/views/projects/deploy_keys/_form.html.haml index 71bf309dd8b..71bf309dd8b 100644 --- a/app/views/deploy_keys/_form.html.haml +++ b/app/views/projects/deploy_keys/_form.html.haml diff --git a/app/views/deploy_keys/index.html.haml b/app/views/projects/deploy_keys/index.html.haml index 7801302d3f4..a1fa3475a84 100644 --- a/app/views/deploy_keys/index.html.haml +++ b/app/views/projects/deploy_keys/index.html.haml @@ -1,5 +1,3 @@ -= render "projects/settings_nav" - %p.slead Deploy keys allow read-only access to repository. They can be used for CI, staging or production servers @@ -12,7 +10,7 @@ %hr.clearfix .row - .span6.enabled-keys + .span5.enabled-keys %h5.cgreen Enabled deploy keys %small for this project @@ -21,7 +19,7 @@ - if @enabled_keys.blank? .light-well %p.nothing_here_message Create #{link_to 'new deploy key', new_project_deploy_key_path(@project)} or add existing one - .span6.available-keys + .span5.available-keys %h5 Available deploy keys %small from projects you are able to manage diff --git a/app/views/deploy_keys/new.html.haml b/app/views/projects/deploy_keys/new.html.haml index 0bbea1ebed5..b0e2a8b2949 100644 --- a/app/views/deploy_keys/new.html.haml +++ b/app/views/projects/deploy_keys/new.html.haml @@ -1,5 +1,3 @@ -= render "projects/settings_nav" - %h3.page_title New Deploy key %hr diff --git a/app/views/deploy_keys/show.html.haml b/app/views/projects/deploy_keys/show.html.haml index 5b59d322343..26fd7428b7e 100644 --- a/app/views/deploy_keys/show.html.haml +++ b/app/views/projects/deploy_keys/show.html.haml @@ -1,5 +1,3 @@ -= render "projects/settings_nav" - %h3.page_title Deploy key: = @key.title diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index bec64bf6c58..5d399da661d 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -1,175 +1,155 @@ -= render "projects/settings_nav" - .project-edit-container - %h3.page_title Edit Project - %hr .project-edit-errors .project-edit-content - .row - .span3 - %ul.nav.nav-pills.nav-stacked - %li.active - = link_to 'Settings', '#tab-settings', 'data-toggle' => 'tab' - %li - = link_to 'Rename repo', '#tab-rename', 'data-toggle' => 'tab' - %li - = link_to 'Transfer', '#tab-transfer', 'data-toggle' => 'tab' - %li - = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab' - - .span9 - .tab-content - .tab-pane.active#tab-settings - .ui-box.white - %h5.title Settings: - .form-holder - = form_for(@project, remote: true) do |f| - %fieldset - .clearfix.project_name_holder - = f.label :name do - Project name is - .input - = f.text_field :name, placeholder: "Example Project", class: "span5" - - - .clearfix - = f.label :description do - Project description - %span.light (optional) - .input - = f.text_area :description, placeholder: "awesome project", class: "span5", rows: 3, maxlength: 250 - - - unless @project.empty_repo? - .clearfix - = f.label :default_branch, "Default Branch" - .input= f.select(:default_branch, @repository.branch_names, {}, {class: 'chosen'}) - - - - if can?(current_user, :change_public_mode, @project) - %fieldset.public-mode - %legend - Public mode: - .control-group - = f.label :public, class: 'control-label' do - %span Public access - .controls - = f.check_box :public - %span.descr - If checked, this project can be cloned - %em without any - authentication. - It will also be listed on the #{link_to "public access directory", public_root_path}. - %em Any - user will have #{link_to "Guest", help_permissions_path} permissions on the repository. - - %fieldset.features - %legend - Labels: - .control-group - = f.label :label_list, "Labels", class: 'control-label' - .controls - = f.text_field :label_list, maxlength: 2000, class: "span5" - %p.hint Separate with comma. - - %fieldset.features - %legend - Features: - .control-group - = f.label :issues_enabled, "Issues", class: 'control-label' - .controls - = f.check_box :issues_enabled - %span.descr Lightweight issue tracking system for this project - - - if Project.issues_tracker.values.count > 1 - .control-group - = f.label :issues_tracker, "Issues tracker", class: 'control-label' - .input= f.select(:issues_tracker, Project.issues_tracker.values, {}, { disabled: !@project.issues_enabled }) - - .clearfix - = f.label :issues_tracker_id, "Project name or id in issues tracker", class: 'control-label' - .input= f.text_field :issues_tracker_id, disabled: !@project.can_have_issues_tracker_id? - - .control-group - = f.label :merge_requests_enabled, "Merge Requests", class: 'control-label' - .controls - = f.check_box :merge_requests_enabled - %span.descr Submit changes to be merged upstream. - - .control-group - = f.label :wiki_enabled, "Wiki", class: 'control-label' - .controls - = f.check_box :wiki_enabled - %span.descr Pages for project documentation - - .control-group - = f.label :wall_enabled, "Wall", class: 'control-label' - .controls - = f.check_box :wall_enabled - %span.descr Simple chat system for broadcasting inside project - - .control-group - = f.label :snippets_enabled, "Snippets", class: 'control-label' - .controls - = f.check_box :snippets_enabled - %span.descr Share code pastes with others out of git repository - - - .form-actions - = f.submit 'Save', class: "btn btn-save" - - .tab-pane#tab-transfer - - if can?(current_user, :change_namespace, @project) - .ui-box.ui-box-danger - %h5.title Transfer project - .errors-holder - .form-holder - = form_for(@project, url: transfer_project_path(@project), remote: true, html: { class: 'transfer-project' }) do |f| - .control-group - = f.label :namespace_id do - %span Namespace - .controls - .clearfix - = f.select :namespace_id, namespaces_options(@project.namespace_id || Namespace::global_id), {prompt: 'Choose a project namespace'}, {class: 'chosen'} - %ul - %li Be careful. Changing project namespace can have unintended side effects - %li You can transfer project only to namespaces you can manage - %li You will need to update your local repositories to point to the new location. - .form-actions - = f.submit 'Transfer', class: "btn btn-remove" - - else - %p.nothing_here_message Only project owner can transfer a project - - .tab-pane#tab-rename - .ui-box.ui-box-danger - %h5.title Rename repository - .errors-holder - .form-holder - = form_for(@project) do |f| - .control-group - = f.label :path do - %span Path - .controls - .clearfix - = f.text_field :path - %ul - %li Be careful. Rename of project repo can have unintended side effects - %li You will need to update your local repositories to point to the new location. - .form-actions - = f.submit 'Rename', class: "btn btn-remove" - - .tab-pane#tab-remove - - if can?(current_user, :remove_project, @project) - .ui-box.ui-box-danger - %h5.title Remove project - .ui-box-body - %p - Remove of project will cause removing repository and all related resources like issues, merge requests etc. - %p - %strong Removed project can not be restored! - - = link_to 'Remove project', @project, confirm: remove_project_message(@project), method: :delete, class: "btn btn-remove btn-small" - - else - %p.nothing_here_message Only project owner can remove a project + .ui-box.white + %h5.title + %strong= @project.name + Project Settings: + .form-holder + = form_for(@project, remote: true) do |f| + %fieldset + .clearfix.project_name_holder + = f.label :name do + Project name is + .input + = f.text_field :name, placeholder: "Example Project", class: "span5" + + + .clearfix + = f.label :description do + Project description + %span.light (optional) + .input + = f.text_area :description, placeholder: "awesome project", class: "span5", rows: 3, maxlength: 250 + + - unless @project.empty_repo? + .clearfix + = f.label :default_branch, "Default Branch" + .input= f.select(:default_branch, @repository.branch_names, {}, {class: 'chosen'}) + + + - if can?(current_user, :change_public_mode, @project) + %fieldset.public-mode + %legend + Public mode: + .control-group + = f.label :public, class: 'control-label' do + %span Public access + .controls + = f.check_box :public + %span.descr + If checked, this project can be cloned + %em without any + authentication. + It will also be listed on the #{link_to "public access directory", public_root_path}. + %em Any + user will have #{link_to "Guest", help_permissions_path} permissions on the repository. + + %fieldset.features + %legend + Labels: + .control-group + = f.label :label_list, "Labels", class: 'control-label' + .controls + = f.text_field :label_list, maxlength: 2000, class: "span5" + %p.hint Separate with comma. + + %fieldset.features + %legend + Features: + .control-group + = f.label :issues_enabled, "Issues", class: 'control-label' + .controls + = f.check_box :issues_enabled + %span.descr Lightweight issue tracking system for this project + + - if Project.issues_tracker.values.count > 1 + .control-group + = f.label :issues_tracker, "Issues tracker", class: 'control-label' + .input= f.select(:issues_tracker, Project.issues_tracker.values, {}, { disabled: !@project.issues_enabled }) + + .clearfix + = f.label :issues_tracker_id, "Project name or id in issues tracker", class: 'control-label' + .input= f.text_field :issues_tracker_id, disabled: !@project.can_have_issues_tracker_id? + + .control-group + = f.label :merge_requests_enabled, "Merge Requests", class: 'control-label' + .controls + = f.check_box :merge_requests_enabled + %span.descr Submit changes to be merged upstream. + + .control-group + = f.label :wiki_enabled, "Wiki", class: 'control-label' + .controls + = f.check_box :wiki_enabled + %span.descr Pages for project documentation + + .control-group + = f.label :wall_enabled, "Wall", class: 'control-label' + .controls + = f.check_box :wall_enabled + %span.descr Simple chat system for broadcasting inside project + + .control-group + = f.label :snippets_enabled, "Snippets", class: 'control-label' + .controls + = f.check_box :snippets_enabled + %span.descr Share code pastes with others out of git repository + + + .form-actions + = f.submit 'Save', class: "btn btn-save" + + - if can?(current_user, :change_namespace, @project) + .ui-box.ui-box-danger + %h5.title Transfer project + .errors-holder + .form-holder + = form_for(@project, url: transfer_project_path(@project), remote: true, html: { class: 'transfer-project' }) do |f| + .control-group + = f.label :namespace_id do + %span Namespace + .controls + .clearfix + = f.select :namespace_id, namespaces_options(@project.namespace_id), {prompt: 'Choose a project namespace'}, {class: 'chosen'} + %ul + %li Be careful. Changing project namespace can have unintended side effects + %li You can transfer project only to namespaces you can manage + %li You will need to update your local repositories to point to the new location. + .form-actions + = f.submit 'Transfer', class: "btn btn-remove" + - else + %p.nothing_here_message Only project owner can transfer a project + + .ui-box.ui-box-danger + %h5.title Rename repository + .errors-holder + .form-holder + = form_for(@project) do |f| + .control-group + = f.label :path do + %span Path + .controls + .clearfix + = f.text_field :path + %ul + %li Be careful. Rename of project repo can have unintended side effects + %li You will need to update your local repositories to point to the new location. + .form-actions + = f.submit 'Rename', class: "btn btn-remove" + + - if can?(current_user, :remove_project, @project) + .ui-box.ui-box-danger + %h5.title Remove project + .ui-box-body + %p + Remove of project will cause removing repository and all related resources like issues, merge requests etc. + %p + %strong Removed project can not be restored! + + = link_to 'Remove project', @project, confirm: remove_project_message(@project), method: :delete, class: "btn btn-remove btn-small" + - else + %p.nothing_here_message Only project owner can remove a project .save-project-loader.hide %center diff --git a/app/views/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml index 101b479afed..101b479afed 100644 --- a/app/views/edit_tree/show.html.haml +++ b/app/views/projects/edit_tree/show.html.haml diff --git a/app/views/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml index 05bc1436e6d..6593319af27 100644 --- a/app/views/graphs/show.html.haml +++ b/app/views/projects/graphs/show.html.haml @@ -24,8 +24,8 @@ type: "GET", url: location.href, complete: function() { + $(".stat-graph").fadeIn(); $(".loading-graph").hide(); - $(".stat-graph").show(); }, dataType: "script" }); diff --git a/app/views/projects/graphs/show.js.haml b/app/views/projects/graphs/show.js.haml new file mode 100644 index 00000000000..43e776e5330 --- /dev/null +++ b/app/views/projects/graphs/show.js.haml @@ -0,0 +1,19 @@ +- if @success + :plain + controller = new ContributorsStatGraph + controller.init(#{@log}) + + $("select").change( function () { + var field = $(this).val() + controller.set_current_field(field) + controller.redraw_master() + controller.redraw_authors() + }) + + $("#brush_change").change( function () { + controller.change_date_header() + controller.redraw_authors() + }) +- else + :plain + $('.stat-graph').replaceWith('<div class="alert alert-error">Failed to load graph</div>') diff --git a/app/views/hooks/_data_ex.html.erb b/app/views/projects/hooks/_data_ex.html.erb index b4281fa18c7..b4281fa18c7 100644 --- a/app/views/hooks/_data_ex.html.erb +++ b/app/views/projects/hooks/_data_ex.html.erb diff --git a/app/views/hooks/index.html.haml b/app/views/projects/hooks/index.html.haml index 3155dd32177..641ab082d8d 100644 --- a/app/views/hooks/index.html.haml +++ b/app/views/projects/hooks/index.html.haml @@ -1,5 +1,3 @@ -= render "projects/settings_nav" - - if can? current_user, :admin_project, @project .alert.alert-info %span @@ -22,21 +20,15 @@ %hr -if @hooks.any? - %h3.page_title - Hooks (#{@hooks.count}) - %br - %table - %thead - %tr - %th URL - %th - - @hooks.each do |hook| - %tr - %td + .ui-box + %h5.title + Hooks (#{@hooks.count}) + %ul.well-list + - @hooks.each do |hook| + %li %span.badge.badge-info POST → %span.monospace= hook.url - %td .pull-right = link_to 'Test Hook', test_project_hook_path(@project, hook), class: "btn btn-small grouped" = link_to 'Remove', project_hook_path(@project, hook), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove btn-small grouped" diff --git a/app/views/issues/_filter.html.haml b/app/views/projects/issues/_filter.html.haml index 8495c323cb8..8495c323cb8 100644 --- a/app/views/issues/_filter.html.haml +++ b/app/views/projects/issues/_filter.html.haml diff --git a/app/views/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index 57460e623ab..38aea6f06dc 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -21,7 +21,7 @@ Assign to .input .pull-left - = f.select(:assignee_id, @project.users.alphabetically.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) + = f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) .pull-right = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' diff --git a/app/views/issues/_head.html.haml b/app/views/projects/issues/_head.html.haml index 44d14d5cdf9..44d14d5cdf9 100644 --- a/app/views/issues/_head.html.haml +++ b/app/views/projects/issues/_head.html.haml diff --git a/app/views/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 0f3c4f752eb..0f3c4f752eb 100644 --- a/app/views/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml diff --git a/app/views/issues/_issues.html.haml b/app/views/projects/issues/_issues.html.haml index fb15effceb8..5923d11a913 100644 --- a/app/views/issues/_issues.html.haml +++ b/app/views/projects/issues/_issues.html.haml @@ -7,7 +7,7 @@ %span.update_issues_text Update selected issues with .left = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status") - = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") + = select_tag('update[assignee_id]', options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id]), prompt: "Assignee") = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") = hidden_field_tag 'update[issues_ids]', [] = hidden_field_tag :status, params[:status] @@ -50,7 +50,7 @@ Any = link_to project_issues_with_filter_path(@project, assignee_id: 0) do Unassigned - - @project.users.sort_by(&:name).each do |user| + - @project.team.members.sort_by(&:name).each do |user| %li = link_to project_issues_with_filter_path(@project, assignee_id: user.id) do = image_tag gravatar_icon(user.email), class: "avatar s16", alt: '' diff --git a/app/views/issues/edit.html.haml b/app/views/projects/issues/edit.html.haml index b1bc3ba0eba..b1bc3ba0eba 100644 --- a/app/views/issues/edit.html.haml +++ b/app/views/projects/issues/edit.html.haml diff --git a/app/views/issues/index.atom.builder b/app/views/projects/issues/index.atom.builder index 00ddd4bf702..00ddd4bf702 100644 --- a/app/views/issues/index.atom.builder +++ b/app/views/projects/issues/index.atom.builder diff --git a/app/views/issues/index.html.haml b/app/views/projects/issues/index.html.haml index bf33769349a..d3fd9886d45 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -1,4 +1,4 @@ -= render "issues/head" += render "head" .issues_content %h3.page_title Issues diff --git a/app/views/issues/index.js.haml b/app/views/projects/issues/index.js.haml index 1be6a64f535..1be6a64f535 100644 --- a/app/views/issues/index.js.haml +++ b/app/views/projects/issues/index.js.haml diff --git a/app/views/issues/new.html.haml b/app/views/projects/issues/new.html.haml index b1bc3ba0eba..b1bc3ba0eba 100644 --- a/app/views/issues/new.html.haml +++ b/app/views/projects/issues/new.html.haml diff --git a/app/views/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 891a01f14c9..2c72d550b3c 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -70,4 +70,4 @@ - @issue.participants.each do |participant| = link_to_member(@project, participant, name: false, size: 24) -.voting_notes#notes= render "notes/notes_with_form" +.voting_notes#notes= render "projects/notes/notes_with_form" diff --git a/app/views/issues/update.js.haml b/app/views/projects/issues/update.js.haml index 7f66022a2de..7f66022a2de 100644 --- a/app/views/issues/update.js.haml +++ b/app/views/projects/issues/update.js.haml diff --git a/app/views/labels/_label.html.haml b/app/views/projects/labels/_label.html.haml index 2b1aafc546b..2b1aafc546b 100644 --- a/app/views/labels/_label.html.haml +++ b/app/views/projects/labels/_label.html.haml diff --git a/app/views/labels/index.html.haml b/app/views/projects/labels/index.html.haml index 53f411d932c..b6a4b07b9ae 100644 --- a/app/views/labels/index.html.haml +++ b/app/views/projects/labels/index.html.haml @@ -1,4 +1,4 @@ -= render "issues/head" += render "projects/issues/head" %h3.page_title Labels diff --git a/app/views/merge_requests/_filter.html.haml b/app/views/projects/merge_requests/_filter.html.haml index 4b48306ed05..4b48306ed05 100644 --- a/app/views/merge_requests/_filter.html.haml +++ b/app/views/projects/merge_requests/_filter.html.haml diff --git a/app/views/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml index 1c3aca176ab..b3da15608e4 100644 --- a/app/views/merge_requests/_form.html.haml +++ b/app/views/projects/merge_requests/_form.html.haml @@ -40,12 +40,12 @@ = f.label :assignee_id do %i.icon-user Assign to - .input= f.select(:assignee_id, @project.users.alphabetically.collect {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, {class: 'chosen span3'}) + .input= f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, {class: 'chosen span3'}) .left = f.label :milestone_id do %i.icon-time Milestone - .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) + .input= f.select(:milestone_id, @project.milestones.active.all.map {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) .control-group @@ -62,20 +62,18 @@ Cancel :javascript - $(function(){ - disableButtonIfEmptyField("#merge_request_title", ".btn-save"); + disableButtonIfEmptyField("#merge_request_title", ".btn-save"); - var source_branch = $("#merge_request_source_branch") - , target_branch = $("#merge_request_target_branch"); + var source_branch = $("#merge_request_source_branch") + , target_branch = $("#merge_request_target_branch"); - $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: source_branch.val() }); - $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: target_branch.val() }); + $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: source_branch.val() }); + $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: target_branch.val() }); - source_branch.live("change", function() { - $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() }); - }); + source_branch.live("change", function() { + $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() }); + }); - target_branch.live("change", function() { - $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: $(this).val() }); - }); + target_branch.live("change", function() { + $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: $(this).val() }); }); diff --git a/app/views/merge_requests/_head.html.haml b/app/views/projects/merge_requests/_head.html.haml index 35a86e6511c..35a86e6511c 100644 --- a/app/views/merge_requests/_head.html.haml +++ b/app/views/projects/merge_requests/_head.html.haml diff --git a/app/views/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index ffc6b8fda1e..ffc6b8fda1e 100644 --- a/app/views/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml diff --git a/app/views/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml index d6e00ca9b8b..8df12644fa1 100644 --- a/app/views/merge_requests/_show.html.haml +++ b/app/views/projects/merge_requests/_show.html.haml @@ -1,11 +1,11 @@ .merge-request - = render "merge_requests/show/mr_title" - = render "merge_requests/show/how_to_merge" - = render "merge_requests/show/mr_box" - = render "merge_requests/show/mr_accept" + = render "projects/merge_requests/show/mr_title" + = render "projects/merge_requests/show/how_to_merge" + = render "projects/merge_requests/show/mr_box" + = render "projects/merge_requests/show/mr_accept" - if @project.gitlab_ci? - = render "merge_requests/show/mr_ci" - = render "merge_requests/show/commits" + = render "projects/merge_requests/show/mr_ci" + = render "projects/merge_requests/show/commits" - if @commits.present? %ul.nav.nav-tabs @@ -19,9 +19,10 @@ Diff .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } - = render "notes/notes_with_form" + = render "projects/notes/notes_with_form" .diffs.tab-content - = render "merge_requests/show/diffs" if @diffs + - if current_page?(action: 'diffs') + = render "projects/merge_requests/show/diffs" .status :javascript diff --git a/app/views/merge_requests/automerge.js.haml b/app/views/projects/merge_requests/automerge.js.haml index e01ff662e7d..e01ff662e7d 100644 --- a/app/views/merge_requests/automerge.js.haml +++ b/app/views/projects/merge_requests/automerge.js.haml diff --git a/app/views/merge_requests/branch_from.js.haml b/app/views/projects/merge_requests/branch_from.js.haml index 0637fdcb72e..0637fdcb72e 100644 --- a/app/views/merge_requests/branch_from.js.haml +++ b/app/views/projects/merge_requests/branch_from.js.haml diff --git a/app/views/merge_requests/branch_to.js.haml b/app/views/projects/merge_requests/branch_to.js.haml index 974100d1ba7..974100d1ba7 100644 --- a/app/views/merge_requests/branch_to.js.haml +++ b/app/views/projects/merge_requests/branch_to.js.haml diff --git a/app/views/merge_requests/commits.js.haml b/app/views/projects/merge_requests/commits.js.haml index 923b1ea032f..923b1ea032f 100644 --- a/app/views/merge_requests/commits.js.haml +++ b/app/views/projects/merge_requests/commits.js.haml diff --git a/app/views/merge_requests/diffs.html.haml b/app/views/projects/merge_requests/diffs.html.haml index 2a5b8b1441e..2a5b8b1441e 100644 --- a/app/views/merge_requests/diffs.html.haml +++ b/app/views/projects/merge_requests/diffs.html.haml diff --git a/app/views/merge_requests/diffs.js.haml b/app/views/projects/merge_requests/diffs.js.haml index 266892c01ef..2964f0ec462 100644 --- a/app/views/merge_requests/diffs.js.haml +++ b/app/views/projects/merge_requests/diffs.js.haml @@ -1,2 +1,2 @@ :plain - merge_request.$(".diffs").html("#{escape_javascript(render(partial: "merge_requests/show/diffs"))}"); + merge_request.$(".diffs").html("#{escape_javascript(render(partial: "projects/merge_requests/show/diffs"))}"); diff --git a/app/views/merge_requests/edit.html.haml b/app/views/projects/merge_requests/edit.html.haml index eee148994d7..eee148994d7 100644 --- a/app/views/merge_requests/edit.html.haml +++ b/app/views/projects/merge_requests/edit.html.haml diff --git a/app/views/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml index b9e9096e3ae..b9e9096e3ae 100644 --- a/app/views/merge_requests/index.html.haml +++ b/app/views/projects/merge_requests/index.html.haml diff --git a/app/views/merge_requests/invalid.html.haml b/app/views/projects/merge_requests/invalid.html.haml index a73bef9e80a..c962811a3e4 100644 --- a/app/views/merge_requests/invalid.html.haml +++ b/app/views/projects/merge_requests/invalid.html.haml @@ -1,6 +1,6 @@ .merge-request - = render "merge_requests/show/mr_title" - = render "merge_requests/show/mr_box" + = render "projects/merge_requests/show/mr_title" + = render "projects/merge_requests/show/mr_box" .alert.alert-error %h5 diff --git a/app/views/merge_requests/new.html.haml b/app/views/projects/merge_requests/new.html.haml index 594089995ea..594089995ea 100644 --- a/app/views/merge_requests/new.html.haml +++ b/app/views/projects/merge_requests/new.html.haml diff --git a/app/views/merge_requests/show.html.haml b/app/views/projects/merge_requests/show.html.haml index 2a5b8b1441e..2a5b8b1441e 100644 --- a/app/views/merge_requests/show.html.haml +++ b/app/views/projects/merge_requests/show.html.haml diff --git a/app/views/merge_requests/show.js.haml b/app/views/projects/merge_requests/show.js.haml index 2ce6eb63290..2ce6eb63290 100644 --- a/app/views/merge_requests/show.js.haml +++ b/app/views/projects/merge_requests/show.js.haml diff --git a/app/views/merge_requests/show/_commits.html.haml b/app/views/projects/merge_requests/show/_commits.html.haml index eee786d71ef..8630f02d5d9 100644 --- a/app/views/merge_requests/show/_commits.html.haml +++ b/app/views/projects/merge_requests/show/_commits.html.haml @@ -7,19 +7,19 @@ - if @commits.count > 8 %ul.first-commits.well-list - @commits.first(8).each do |commit| - = render "commits/commit", commit: commit + = render "projects/commits/commit", commit: commit %li.bottom 8 of #{@commits.count} commits displayed. %strong %a.show-all-commits Click here to show all %ul.all-commits.hide.well-list - @commits.each do |commit| - = render "commits/commit", commit: commit + = render "projects/commits/commit", commit: commit - else %ul.well-list - @commits.each do |commit| - = render "commits/commit", commit: commit + = render "projects/commits/commit", commit: commit - else %h4.nothing_here_message diff --git a/app/views/merge_requests/show/_diffs.html.haml b/app/views/projects/merge_requests/show/_diffs.html.haml index 033d66a4ad4..3c1d14572aa 100644 --- a/app/views/merge_requests/show/_diffs.html.haml +++ b/app/views/projects/merge_requests/show/_diffs.html.haml @@ -1,5 +1,5 @@ - if @merge_request.valid_diffs? - = render "commits/diffs", diffs: @diffs + = render "projects/commits/diffs", diffs: @merge_request.diffs - elsif @merge_request.broken_diffs? %h4.nothing_here_message Can't load diff. diff --git a/app/views/merge_requests/show/_how_to_merge.html.haml b/app/views/projects/merge_requests/show/_how_to_merge.html.haml index 7f1e33418de..7f1e33418de 100644 --- a/app/views/merge_requests/show/_how_to_merge.html.haml +++ b/app/views/projects/merge_requests/show/_how_to_merge.html.haml diff --git a/app/views/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml index ac97f6327c0..ac97f6327c0 100644 --- a/app/views/merge_requests/show/_mr_accept.html.haml +++ b/app/views/projects/merge_requests/show/_mr_accept.html.haml diff --git a/app/views/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml index 594f4061c23..594f4061c23 100644 --- a/app/views/merge_requests/show/_mr_box.html.haml +++ b/app/views/projects/merge_requests/show/_mr_box.html.haml diff --git a/app/views/merge_requests/show/_mr_ci.html.haml b/app/views/projects/merge_requests/show/_mr_ci.html.haml index 9b15c4526e9..9b15c4526e9 100644 --- a/app/views/merge_requests/show/_mr_ci.html.haml +++ b/app/views/projects/merge_requests/show/_mr_ci.html.haml diff --git a/app/views/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml index 24285c272a8..24285c272a8 100644 --- a/app/views/merge_requests/show/_mr_title.html.haml +++ b/app/views/projects/merge_requests/show/_mr_title.html.haml diff --git a/app/views/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml index fbaf64a305c..50e3e71b2c3 100644 --- a/app/views/milestones/_form.html.haml +++ b/app/views/projects/milestones/_form.html.haml @@ -40,10 +40,8 @@ :javascript - $(function() { - disableButtonIfEmptyField("#milestone_title", ".btn-save"); - $( ".datepicker" ).datepicker({ - dateFormat: "yy-mm-dd", - onSelect: function(dateText, inst) { $("#milestone_due_date").val(dateText) } - }).datepicker("setDate", $.datepicker.parseDate('yy-mm-dd', $('#milestone_due_date').val())); - }); + disableButtonIfEmptyField("#milestone_title", ".btn-save"); + $( ".datepicker" ).datepicker({ + dateFormat: "yy-mm-dd", + onSelect: function(dateText, inst) { $("#milestone_due_date").val(dateText) } + }).datepicker("setDate", $.datepicker.parseDate('yy-mm-dd', $('#milestone_due_date').val())); diff --git a/app/views/milestones/_issues.html.haml b/app/views/projects/milestones/_issues.html.haml index eccf3ddbfa5..67a7bf819fe 100644 --- a/app/views/milestones/_issues.html.haml +++ b/app/views/projects/milestones/_issues.html.haml @@ -5,7 +5,7 @@ %li = link_to [@project, issue] do %span.badge{class: issue.closed? ? 'badge-important' : 'badge-info'} ##{issue.id} - = link_to_gfm truncate(issue.title, length: 60), [@project, issue] + = link_to_gfm truncate(issue.title, length: 40), [@project, issue] - if issue.assignee .pull-right = image_tag gravatar_icon(issue.assignee.email, 16), class: "avatar s16" diff --git a/app/views/milestones/_merge_request.html.haml b/app/views/projects/milestones/_merge_request.html.haml index 7f815894069..7f815894069 100644 --- a/app/views/milestones/_merge_request.html.haml +++ b/app/views/projects/milestones/_merge_request.html.haml diff --git a/app/views/milestones/_milestone.html.haml b/app/views/projects/milestones/_milestone.html.haml index 894fa6c1133..894fa6c1133 100644 --- a/app/views/milestones/_milestone.html.haml +++ b/app/views/projects/milestones/_milestone.html.haml diff --git a/app/views/milestones/edit.html.haml b/app/views/projects/milestones/edit.html.haml index b1bc3ba0eba..b1bc3ba0eba 100644 --- a/app/views/milestones/edit.html.haml +++ b/app/views/projects/milestones/edit.html.haml diff --git a/app/views/milestones/index.html.haml b/app/views/projects/milestones/index.html.haml index fb7cbc41edf..1bc359398ab 100644 --- a/app/views/milestones/index.html.haml +++ b/app/views/projects/milestones/index.html.haml @@ -1,4 +1,4 @@ -= render "issues/head" += render "projects/issues/head" .milestones_content %h3.page_title Milestones diff --git a/app/views/milestones/new.html.haml b/app/views/projects/milestones/new.html.haml index b1bc3ba0eba..b1bc3ba0eba 100644 --- a/app/views/milestones/new.html.haml +++ b/app/views/projects/milestones/new.html.haml diff --git a/app/views/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index de33ab363e6..d16de0da390 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -1,4 +1,4 @@ -= render "issues/head" += render "projects/issues/head" .row .span6 %h3.page_title diff --git a/app/views/milestones/update.js.haml b/app/views/projects/milestones/update.js.haml index 3ff84915e97..3ff84915e97 100644 --- a/app/views/milestones/update.js.haml +++ b/app/views/projects/milestones/update.js.haml diff --git a/app/views/network/_head.html.haml b/app/views/projects/network/_head.html.haml index 62ab8b049ac..62ab8b049ac 100644 --- a/app/views/network/_head.html.haml +++ b/app/views/projects/network/_head.html.haml diff --git a/app/views/network/show.html.haml b/app/views/projects/network/show.html.haml index a480ceaf995..a480ceaf995 100644 --- a/app/views/network/show.html.haml +++ b/app/views/projects/network/show.html.haml diff --git a/app/views/network/show.json.erb b/app/views/projects/network/show.json.erb index 9a62cdb3dc9..9a62cdb3dc9 100644 --- a/app/views/network/show.json.erb +++ b/app/views/projects/network/show.json.erb diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 0754ee83114..ba389018d59 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -40,12 +40,6 @@ Need a group for several dependent projects? = link_to new_group_path, class: "btn btn-tiny" do Create a group - - if current_user.can_create_team? - .clearfix - .input.light - Want to share a project between team? - = link_to new_team_path, class: "btn btn-tiny" do - Create a team .save-project-loader.hide %center diff --git a/app/views/notes/_diff_note_link.html.haml b/app/views/projects/notes/_diff_note_link.html.haml index 377c926a204..377c926a204 100644 --- a/app/views/notes/_diff_note_link.html.haml +++ b/app/views/projects/notes/_diff_note_link.html.haml diff --git a/app/views/notes/_diff_notes_with_reply.html.haml b/app/views/projects/notes/_diff_notes_with_reply.html.haml index 0808f86b090..5a1a945f399 100644 --- a/app/views/notes/_diff_notes_with_reply.html.haml +++ b/app/views/projects/notes/_diff_notes_with_reply.html.haml @@ -8,4 +8,4 @@ %ul.notes{ rel: note.discussion_id } = render notes - = render "notes/discussion_reply_button", note: note + = render "projects/notes/discussion_reply_button", note: note diff --git a/app/views/notes/_discussion.html.haml b/app/views/projects/notes/_discussion.html.haml index e65a4f390e6..14d81bbb5ce 100644 --- a/app/views/notes/_discussion.html.haml +++ b/app/views/projects/notes/_discussion.html.haml @@ -8,7 +8,7 @@ = link_to "javascript:;", class: "js-details-target turn-off js-toggler-target" do %i.icon-eye-open Show discussion - = image_tag gravatar_icon(note.author.email), class: "avatar s32", alt: '' + = image_tag gravatar_icon(note.author_email), class: "avatar s32" %div = link_to_member(@project, note.author, avatar: false) - if note.for_merge_request? @@ -38,7 +38,7 @@ - if note.for_diff_line? - if note.diff .content - .file= render "notes/discussion_diff", discussion_notes: discussion_notes, note: note + .file= render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note - else = link_to 'show outdated discussion', '#', class: 'js-show-outdated-discussion' %div.hide.outdated-discussion @@ -51,7 +51,7 @@ .content .notes{ rel: discussion_notes.first.discussion_id } = render discussion_notes - = render "notes/discussion_reply_button", note: discussion_notes.first + = render "projects/notes/discussion_reply_button", note: discussion_notes.first -# will be shown when the other one is hidden .discussion-hidden.content.hide diff --git a/app/views/notes/_discussion_diff.html.haml b/app/views/projects/notes/_discussion_diff.html.haml index 20bdb3f3562..c3f41a1b6b5 100644 --- a/app/views/notes/_discussion_diff.html.haml +++ b/app/views/projects/notes/_discussion_diff.html.haml @@ -21,4 +21,4 @@ %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " - if line_code == note.line_code - = render "notes/diff_notes_with_reply", notes: discussion_notes + = render "projects/notes/diff_notes_with_reply", notes: discussion_notes diff --git a/app/views/notes/_discussion_reply_button.html.haml b/app/views/projects/notes/_discussion_reply_button.html.haml index d1c5ccc29db..d1c5ccc29db 100644 --- a/app/views/notes/_discussion_reply_button.html.haml +++ b/app/views/projects/notes/_discussion_reply_button.html.haml diff --git a/app/views/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index 7add2921830..7add2921830 100644 --- a/app/views/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml diff --git a/app/views/notes/_form_errors.html.haml b/app/views/projects/notes/_form_errors.html.haml index 0851536f0da..0b68bf243f0 100644 --- a/app/views/notes/_form_errors.html.haml +++ b/app/views/projects/notes/_form_errors.html.haml @@ -1,3 +1,3 @@ -.error_message.js-errors +.error-message.js-errors - note.errors.full_messages.each do |msg| %div= msg diff --git a/app/views/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index 6089b9505b2..1389d899310 100644 --- a/app/views/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -10,7 +10,7 @@ %i.icon-edit = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, confirm: 'Are you sure you want to remove this comment?', remote: true, class: "danger js-note-delete" do %i.icon-trash.cred - = image_tag gravatar_icon(note.author.email), class: "avatar s32", alt: '' + = image_tag gravatar_icon(note.author_email), class: "avatar s32" = link_to_member(@project, note.author, avatar: false) %span.note-last-update = note_timestamp(note) @@ -51,7 +51,8 @@ - if note.attachment.url .note-attachment - if note.attachment.image? - = image_tag note.attachment.url, class: 'note-image-attach' + = link_to note.attachment.url, target: '_blank' do + = image_tag note.attachment.url, class: 'note-image-attach' .attachment.pull-right = link_to note.attachment.secure_url, target: "_blank" do %i.icon-paper-clip @@ -59,4 +60,4 @@ = link_to delete_attachment_project_note_path(@project, note), title: "Delete this attachment", method: :delete, remote: true, confirm: 'Are you sure you want to remove the attachment?', class: "danger js-note-attachment-delete" do %i.icon-trash.cred - .clear
\ No newline at end of file + .clear diff --git a/app/views/notes/_notes.html.haml b/app/views/projects/notes/_notes.html.haml index 4904249aeff..ac8901fe704 100644 --- a/app/views/notes/_notes.html.haml +++ b/app/views/projects/notes/_notes.html.haml @@ -8,4 +8,4 @@ - else - @notes.each do |note| - next unless note.author - = render 'note', note: note + = render note diff --git a/app/views/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml index 38d1a3c93c0..ac28c7432ef 100644 --- a/app/views/notes/_notes_with_form.html.haml +++ b/app/views/projects/notes/_notes_with_form.html.haml @@ -3,7 +3,7 @@ .js-main-target-form - if can? current_user, :write_note, @project - = render "notes/form" + = render "projects/notes/form" :javascript NoteList.init("#{@target_id}", "#{@target_type}", "#{project_notes_path(@project)}"); diff --git a/app/views/notes/create.js.haml b/app/views/projects/notes/create.js.haml index 43e79c69f11..c113b3482ec 100644 --- a/app/views/notes/create.js.haml +++ b/app/views/projects/notes/create.js.haml @@ -1,17 +1,17 @@ - if @note.valid? - var noteHtml = "#{escape_javascript(render "notes/note", note: @note)}"; + var noteHtml = "#{escape_javascript(render @note)}"; - if note_for_main_target?(@note) NoteList.appendNewNote(#{@note.id}, noteHtml); - else :plain - var firstDiscussionNoteHtml = "#{escape_javascript(render "notes/diff_notes_with_reply", notes: [@note])}"; + var firstDiscussionNoteHtml = "#{escape_javascript(render "projects/notes/diff_notes_with_reply", notes: [@note])}"; NoteList.appendNewDiscussionNote("#{@note.discussion_id}", firstDiscussionNoteHtml, noteHtml); - else - var errorsHtml = "#{escape_javascript(render 'notes/form_errors', note: @note)}"; + var errorsHtml = "#{escape_javascript(render 'projects/notes/form_errors', note: @note)}"; - if note_for_main_target?(@note) NoteList.errorsOnForm(errorsHtml); - else diff --git a/app/views/notes/index.js.haml b/app/views/projects/notes/index.js.haml index 826862b1a86..6c4ed203497 100644 --- a/app/views/notes/index.js.haml +++ b/app/views/projects/notes/index.js.haml @@ -1,4 +1,4 @@ - unless @notes.blank? - var notesHtml = "#{escape_javascript(render 'notes/notes')}"; + var notesHtml = "#{escape_javascript(render 'projects/notes/notes')}"; - new_note_ids = @notes.map(&:id) NoteList.setContent(#{new_note_ids}, notesHtml); diff --git a/app/views/protected_branches/index.html.haml b/app/views/projects/protected_branches/index.html.haml index a338344c52d..f741f2f0495 100644 --- a/app/views/protected_branches/index.html.haml +++ b/app/views/projects/protected_branches/index.html.haml @@ -1,7 +1,7 @@ -= render "commits/head" += render "projects/commits/head" .row .span3 - = render "repositories/filter" + = render "projects/repositories/filter" .span9 .alert %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}. diff --git a/app/views/refs/logs_tree.js.haml b/app/views/projects/refs/logs_tree.js.haml index 0b517327139..213c54f5f75 100644 --- a/app/views/refs/logs_tree.js.haml +++ b/app/views/projects/refs/logs_tree.js.haml @@ -1,8 +1,9 @@ - @logs.each do |content_data| - file_name = content_data[:file_name] - commit = content_data[:commit] + - next unless commit :plain var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); row.find("td.tree_time_ago").html('#{escape_javascript time_ago_in_words(commit.committed_date)} ago'); - row.find("td.tree_commit").html('#{escape_javascript render("tree/tree_commit_column", commit: commit)}'); + row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}'); diff --git a/app/views/repositories/_branch.html.haml b/app/views/projects/repositories/_branch.html.haml index 2115f3c427f..2115f3c427f 100644 --- a/app/views/repositories/_branch.html.haml +++ b/app/views/projects/repositories/_branch.html.haml diff --git a/app/views/repositories/_feed.html.haml b/app/views/projects/repositories/_feed.html.haml index faa3ed1746c..faa3ed1746c 100644 --- a/app/views/repositories/_feed.html.haml +++ b/app/views/projects/repositories/_feed.html.haml diff --git a/app/views/repositories/_filter.html.haml b/app/views/projects/repositories/_filter.html.haml index e718d48190a..e718d48190a 100644 --- a/app/views/repositories/_filter.html.haml +++ b/app/views/projects/repositories/_filter.html.haml diff --git a/app/views/repositories/branches.html.haml b/app/views/projects/repositories/branches.html.haml index 14b5082e44e..2bdd304cdac 100644 --- a/app/views/repositories/branches.html.haml +++ b/app/views/projects/repositories/branches.html.haml @@ -1,4 +1,4 @@ -= render "commits/head" += render "projects/commits/head" .row .span3 = render "filter" @@ -12,4 +12,4 @@ %th %tbody - @branches.each do |branch| - = render "repositories/branch", branch: branch + = render "projects/repositories/branch", branch: branch diff --git a/app/views/repositories/show.html.haml b/app/views/projects/repositories/show.html.haml index e58e16f8bf1..84a32e62426 100644 --- a/app/views/repositories/show.html.haml +++ b/app/views/projects/repositories/show.html.haml @@ -1,4 +1,4 @@ -= render "commits/head" += render "projects/commits/head" .row .span3 = render "filter" @@ -10,5 +10,5 @@ %th Last commit %th - @activities.each do |update| - = render "repositories/branch", branch: update.head + = render "branch", branch: update.head diff --git a/app/views/repositories/stats.html.haml b/app/views/projects/repositories/stats.html.haml index fc8ccfe458d..454296e82fd 100644 --- a/app/views/repositories/stats.html.haml +++ b/app/views/projects/repositories/stats.html.haml @@ -1,4 +1,4 @@ -= render "commits/head" += render "projects/commits/head" .row .span6 %div#activity-chart.chart diff --git a/app/views/repositories/tags.html.haml b/app/views/projects/repositories/tags.html.haml index bef5cd0841b..5972ea6c531 100644 --- a/app/views/repositories/tags.html.haml +++ b/app/views/projects/repositories/tags.html.haml @@ -1,4 +1,4 @@ -= render "commits/head" += render "projects/commits/head" - unless @tags.empty? %ul.bordered-list - @tags.each do |tag| diff --git a/app/views/services/_form.html.haml b/app/views/projects/services/_form.html.haml index ff6769531c4..ff6769531c4 100644 --- a/app/views/services/_form.html.haml +++ b/app/views/projects/services/_form.html.haml diff --git a/app/views/projects/services/edit.html.haml b/app/views/projects/services/edit.html.haml new file mode 100644 index 00000000000..bcc5832792f --- /dev/null +++ b/app/views/projects/services/edit.html.haml @@ -0,0 +1 @@ += render 'form' diff --git a/app/views/services/index.html.haml b/app/views/projects/services/index.html.haml index bd52948a6fd..6d254f66f1c 100644 --- a/app/views/services/index.html.haml +++ b/app/views/projects/services/index.html.haml @@ -1,5 +1,3 @@ -= render "projects/settings_nav" - %h3.page_title Services %br diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 7d708ce7b8f..b36b56415aa 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -7,29 +7,6 @@ .loading.hide .span3 .light-well - .dropdown.pull-right - %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"} - %i.icon-plus-sign-alt - %b.caret - %ul.dropdown-menu - - if @project.issues_enabled && can?(current_user, :write_issue, @project) - %li - = link_to url_for_new_issue, title: "New Issue" do - Issue - - if @project.merge_requests_enabled && can?(current_user, :write_merge_request, @project) - %li - = link_to new_project_merge_request_path(@project), title: "New Merge Request" do - Merge Request - - if @project.snippets_enabled && can?(current_user, :write_snippet, @project) - %li - = link_to new_project_snippet_path(@project), title: "New Snippet" do - Snippet - - if can?(current_user, :admin_team_member, @project) - %li.divider - %li - = link_to new_project_team_member_path(@project), title: "New Team member" do - Team member - %h3.page_title = @project.name - if @project.description.present? @@ -37,16 +14,34 @@ %hr %p - %p Repo Size: #{@project.repository.size} MB - %p Created on: #{@project.created_at.stamp('Aug 22, 2013')} - %p Owner: #{link_to @project.owner_name, @project.owner} + %p + %span.light Repo size is + #{@project.repository.size} MB + %p + %span.light Created at + #{@project.created_at.stamp('Aug 22, 2013')} + %p + %span.light Owned by + - if @project.group + #{link_to @project.group.name, @project.group} Group + - else + #{link_to @project.owner_name, @project.owner} - if @project.forked_from_project %p %i.icon-code-fork Forked from: = link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project) + %hr + %p + = link_to pluralize(@repository.round_commit_count, 'commit'), project_commits_path(@project, @ref || @repository.root_ref) + %p + = link_to pluralize(@repository.branch_names.count, 'branch'), project_repository_path(@project) + %p + = link_to pluralize(@repository.tag_names.count, 'tag'), tags_project_repository_path(@project) + - if @project.gitlab_ci? %hr = link_to @project.gitlab_ci_service.builds_path do = image_tag @project.gitlab_ci_service.status_img_path, alt: "build status" + diff --git a/app/views/projects/snippets/show.html.haml b/app/views/projects/snippets/show.html.haml index da93e4bdbb1..36161c5706c 100644 --- a/app/views/projects/snippets/show.html.haml +++ b/app/views/projects/snippets/show.html.haml @@ -10,4 +10,4 @@ = @snippet.author_name %br %div= render 'projects/snippets/blob' -%div#notes= render "notes/notes_with_form" +%div#notes= render "projects/notes/notes_with_form" diff --git a/app/views/team_members/_form.html.haml b/app/views/projects/team_members/_form.html.haml index 4e8f67702cf..4e8f67702cf 100644 --- a/app/views/team_members/_form.html.haml +++ b/app/views/projects/team_members/_form.html.haml diff --git a/app/views/projects/team_members/_group_members.html.haml b/app/views/projects/team_members/_group_members.html.haml new file mode 100644 index 00000000000..7d9333d38e6 --- /dev/null +++ b/app/views/projects/team_members/_group_members.html.haml @@ -0,0 +1,10 @@ +.ui-box + %h5.title + %strong #{@group.name} Group + members (#{@group.users_groups.count}) + .pull-right + = link_to people_group_path(@group), class: 'btn btn-small' do + %i.icon-edit + %ul.well-list + - @group.users_groups.order('group_access DESC').each do |member| + = render 'users_groups/users_group', member: member, show_controls: false diff --git a/app/views/projects/team_members/_team.html.haml b/app/views/projects/team_members/_team.html.haml new file mode 100644 index 00000000000..99231e92152 --- /dev/null +++ b/app/views/projects/team_members/_team.html.haml @@ -0,0 +1,9 @@ +.team-table + - can_admin_project = (can? current_user, :admin_project, @project) + .ui-box + %h5.title + %strong #{@project.name} Project + members (#{members.count}) + %ul.well-list + - members.each do |team_member| + = render 'team_member', member: team_member, current_user_can_admin_project: can_admin_project diff --git a/app/views/projects/team_members/_team_member.html.haml b/app/views/projects/team_members/_team_member.html.haml new file mode 100644 index 00000000000..916cf2e7a87 --- /dev/null +++ b/app/views/projects/team_members/_team_member.html.haml @@ -0,0 +1,17 @@ +- user = member.user +%li{id: dom_id(user), class: "team_member_row access-#{member.human_access.downcase}"} + .pull-right + - if current_user_can_admin_project + - unless @project.personal? && user == current_user + .pull-left + = form_for(member, as: :team_member, url: project_team_member_path(@project, member.user)) do |f| + = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2 trigger-submit" + + = link_to project_team_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from team' do + %i.icon-minus.icon-white + = image_tag gravatar_icon(user.email, 32), class: "avatar s32" + %p + %strong= user.name + %span.cgray= user.username + + diff --git a/app/views/team_members/import.html.haml b/app/views/projects/team_members/import.html.haml index 0f7175b9018..2b22c917a16 100644 --- a/app/views/team_members/import.html.haml +++ b/app/views/projects/team_members/import.html.haml @@ -1,5 +1,3 @@ -= render "projects/settings_nav" - %h3.page_title = "Import team from another project" %hr diff --git a/app/views/projects/team_members/index.html.haml b/app/views/projects/team_members/index.html.haml new file mode 100644 index 00000000000..8f81390ca13 --- /dev/null +++ b/app/views/projects/team_members/index.html.haml @@ -0,0 +1,16 @@ +%h3.page_title + Users with access to this project + + - if can? current_user, :admin_team_member, @project + %span.pull-right + = link_to import_project_team_members_path(@project), class: "btn btn-small grouped", title: "Import team from another project" do + Import team from another project + = link_to new_project_team_member_path(@project), class: "btn btn-primary small grouped", title: "New Team Member" do + New Team Member + +%p.light + Read more about project permissions + %strong= link_to "here", help_permissions_path, class: "vlink" +- if @group + = render "group_members" += render "team", members: @users_projects diff --git a/app/views/projects/team_members/new.html.haml b/app/views/projects/team_members/new.html.haml new file mode 100644 index 00000000000..b1bc3ba0eba --- /dev/null +++ b/app/views/projects/team_members/new.html.haml @@ -0,0 +1 @@ += render "form" diff --git a/app/views/team_members/update.js.haml b/app/views/projects/team_members/update.js.haml index c68fe9574a2..c68fe9574a2 100644 --- a/app/views/team_members/update.js.haml +++ b/app/views/projects/team_members/update.js.haml diff --git a/app/views/projects/teams/available.html.haml b/app/views/projects/teams/available.html.haml deleted file mode 100644 index 880a02aeaf5..00000000000 --- a/app/views/projects/teams/available.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -= render "projects/settings_nav" - -%h3.page_title - = "Assign project to team of users" -%hr -%p.slead - Read more about assign to team of users #{link_to "here", '#', class: 'vlink'}. -= form_tag assign_project_teams_path(@project), method: 'post' do - %p.slead Choose Team of users you want to assign: - .padded - = label_tag :team_id, "Team" - .input= select_tag(:team_id, options_from_collection_for_select(@teams, :id, :name), prompt: "Select team", class: "chosen xxlarge", required: true) - %p.slead Choose greatest user access for your team in this project: - .padded - = label_tag :team_ids, "Permission" - .input= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen span3" } - - - .actions - = submit_tag 'Assign', class: "btn btn-create" - = link_to "Cancel", project_team_index_path(@project), class: "btn btn-cancel" - diff --git a/app/views/tree/_blob_item.html.haml b/app/views/projects/tree/_blob_item.html.haml index ec15b608f85..ec15b608f85 100644 --- a/app/views/tree/_blob_item.html.haml +++ b/app/views/projects/tree/_blob_item.html.haml diff --git a/app/views/tree/_readme.html.haml b/app/views/projects/tree/_readme.html.haml index e9bb112745b..e9bb112745b 100644 --- a/app/views/tree/_readme.html.haml +++ b/app/views/projects/tree/_readme.html.haml diff --git a/app/views/tree/_submodule_item.html.haml b/app/views/projects/tree/_submodule_item.html.haml index 092a024afbc..092a024afbc 100644 --- a/app/views/tree/_submodule_item.html.haml +++ b/app/views/projects/tree/_submodule_item.html.haml diff --git a/app/views/tree/_tree.html.haml b/app/views/projects/tree/_tree.html.haml index cc45faa1459..0b1148b3e74 100644 --- a/app/views/tree/_tree.html.haml +++ b/app/views/projects/tree/_tree.html.haml @@ -40,7 +40,7 @@ = render_tree(tree) - if tree.readme - = render "tree/readme", readme: tree.readme + = render "projects/tree/readme", readme: tree.readme %div.tree_progress diff --git a/app/views/tree/_tree_commit_column.html.haml b/app/views/projects/tree/_tree_commit_column.html.haml index 7ae2582c130..7ae2582c130 100644 --- a/app/views/tree/_tree_commit_column.html.haml +++ b/app/views/projects/tree/_tree_commit_column.html.haml diff --git a/app/views/tree/_tree_item.html.haml b/app/views/projects/tree/_tree_item.html.haml index 0a76d5c21b6..0a76d5c21b6 100644 --- a/app/views/tree/_tree_item.html.haml +++ b/app/views/projects/tree/_tree_item.html.haml diff --git a/app/views/tree/show.html.haml b/app/views/projects/tree/show.html.haml index 0f7692aba7f..0f7692aba7f 100644 --- a/app/views/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml diff --git a/app/views/walls/show.html.haml b/app/views/projects/walls/show.html.haml index 88aecee0815..88aecee0815 100644 --- a/app/views/walls/show.html.haml +++ b/app/views/projects/walls/show.html.haml diff --git a/app/views/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml index 7cf08815f78..7cf08815f78 100644 --- a/app/views/wikis/_form.html.haml +++ b/app/views/projects/wikis/_form.html.haml diff --git a/app/views/wikis/_main_links.html.haml b/app/views/projects/wikis/_main_links.html.haml index cb8ccf81c7b..cb8ccf81c7b 100644 --- a/app/views/wikis/_main_links.html.haml +++ b/app/views/projects/wikis/_main_links.html.haml diff --git a/app/views/wikis/_nav.html.haml b/app/views/projects/wikis/_nav.html.haml index 09a1986e105..d62b46a7e5b 100644 --- a/app/views/wikis/_nav.html.haml +++ b/app/views/projects/wikis/_nav.html.haml @@ -16,4 +16,4 @@ %i.icon-plus New Page -= render 'wikis/new' += render 'projects/wikis/new' diff --git a/app/views/wikis/_new.html.haml b/app/views/projects/wikis/_new.html.haml index ca8e7c1b4b4..ca8e7c1b4b4 100644 --- a/app/views/wikis/_new.html.haml +++ b/app/views/projects/wikis/_new.html.haml diff --git a/app/views/wikis/edit.html.haml b/app/views/projects/wikis/edit.html.haml index 7441ceff5c8..4e318c92db3 100644 --- a/app/views/wikis/edit.html.haml +++ b/app/views/projects/wikis/edit.html.haml @@ -1,7 +1,7 @@ -= render 'wikis/nav' += render 'nav' %h3.page_title Editing page - = render partial: 'main_links' + = render 'main_links' = render 'form' .pull-right diff --git a/app/views/wikis/empty.html.haml b/app/views/projects/wikis/empty.html.haml index 08b59f0328b..08b59f0328b 100644 --- a/app/views/wikis/empty.html.haml +++ b/app/views/projects/wikis/empty.html.haml diff --git a/app/views/wikis/git_access.html.haml b/app/views/projects/wikis/git_access.html.haml index 462d483fd85..71e2b48d370 100644 --- a/app/views/wikis/git_access.html.haml +++ b/app/views/projects/wikis/git_access.html.haml @@ -1,8 +1,8 @@ -= render 'wikis/nav' += render 'nav' %h3.page_title Git Access %strong= @gollum_wiki.path_with_namespace - = render partial: 'main_links' + = render 'main_links' %br .content diff --git a/app/views/wikis/history.html.haml b/app/views/projects/wikis/history.html.haml index f4946ed000d..138c384353d 100644 --- a/app/views/wikis/history.html.haml +++ b/app/views/projects/wikis/history.html.haml @@ -1,8 +1,8 @@ -= render 'wikis/nav' += render 'nav' %h3.page_title %span.light History for = @wiki.title.titleize - = render partial: 'main_links' + = render 'main_links' %br %table %thead diff --git a/app/views/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml index 95d5eef16f5..07e942ec62f 100644 --- a/app/views/wikis/pages.html.haml +++ b/app/views/projects/wikis/pages.html.haml @@ -1,7 +1,7 @@ -= render 'wikis/nav' += render 'nav' %h3.page_title All Pages - = render partial: 'main_links' + = render 'main_links' %br %table %thead diff --git a/app/views/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml index b237bc524ed..d9d57e2d8be 100644 --- a/app/views/wikis/show.html.haml +++ b/app/views/projects/wikis/show.html.haml @@ -1,7 +1,7 @@ -= render 'wikis/nav' += render 'nav' %h3.page_title = @wiki.title.titleize - = render partial: 'main_links' + = render 'main_links' %br - if @wiki.historical? .warning_message diff --git a/app/views/search/_result.html.haml b/app/views/search/_result.html.haml index 4d8caa5e70c..4e56eea084e 100644 --- a/app/views/search/_result.html.haml +++ b/app/views/search/_result.html.haml @@ -49,7 +49,5 @@ = paginate @blobs, theme: 'gitlab' :javascript - $(function() { - $(".search_results .term").highlight("#{escape_javascript(params[:search])}"); - }) + $(".search_results .term").highlight("#{escape_javascript(params[:search])}"); diff --git a/app/views/services/edit.html.haml b/app/views/services/edit.html.haml deleted file mode 100644 index d4bc9e41c27..00000000000 --- a/app/views/services/edit.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= render "projects/settings_nav" - -= render 'form' diff --git a/app/views/shared/_merge_requests.html.haml b/app/views/shared/_merge_requests.html.haml index a2800b11d8d..a7037d5987a 100644 --- a/app/views/shared/_merge_requests.html.haml +++ b/app/views/shared/_merge_requests.html.haml @@ -6,7 +6,7 @@ = link_to_project project %ul.well-list.mr-list - group[1].each do |merge_request| - = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) + = render 'projects/merge_requests/merge_request', merge_request: merge_request %hr = paginate @merge_requests, theme: "gitlab" diff --git a/app/views/shared/_no_ssh.html.haml b/app/views/shared/_no_ssh.html.haml index 5fdcea850b2..82bf00aa280 100644 --- a/app/views/shared/_no_ssh.html.haml +++ b/app/views/shared/_no_ssh.html.haml @@ -1,3 +1,3 @@ - if current_user.require_ssh_key? - %p.error_message.centered - You won't be able to pull or push project code via SSH until you #{link_to 'add an SSH key', new_key_path} to your profile + %p.error-message.centered + You won't be able to pull or push project code via SSH until you #{link_to 'add an SSH key', new_profile_key_path} to your profile diff --git a/app/views/team_members/_assigned_team.html.haml b/app/views/team_members/_assigned_team.html.haml deleted file mode 100644 index 51a31a6456d..00000000000 --- a/app/views/team_members/_assigned_team.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%li{id: dom_id(team), class: "user_team_row team_#{team.id}"} - .pull-right - - if can?(current_user, :admin_team_member, @project) - = link_to resign_project_team_path(@project, team), method: :delete, confirm: "Are you sure?", class: "btn btn-remove btn-tiny" do - %i.icon-minus.icon-white - - %strong= link_to team.name, team_path(team), title: team.name, class: "dark" - %br - %small.cgray Members: #{team.members.count} - %small.cgray Max access: #{team_relation.human_max_access} diff --git a/app/views/team_members/_assigned_teams.html.haml b/app/views/team_members/_assigned_teams.html.haml deleted file mode 100644 index 91c6d8f7157..00000000000 --- a/app/views/team_members/_assigned_teams.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -.ui-box - %ul.well-list - - assigned_teams.sort_by(&:team_name).each do |team_relation| - = render "team_members/assigned_team", team_relation: team_relation, team: team_relation.user_team diff --git a/app/views/team_members/_team.html.haml b/app/views/team_members/_team.html.haml deleted file mode 100644 index 4ff170ac86e..00000000000 --- a/app/views/team_members/_team.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -- can_admin_project = (can? current_user, :admin_project, @project) -- team.each do |access, members| - - role = Project.access_options.key(access).pluralize - .ui-box{class: role.downcase} - %h5.title - = role - %span.light (#{members.size}) - %ul.well-list - - members.sort_by(&:user_name).each do |team_member| - = render 'team_members/team_member', member: team_member, current_user_can_admin_project: can_admin_project diff --git a/app/views/team_members/_team_member.html.haml b/app/views/team_members/_team_member.html.haml deleted file mode 100644 index d61513fa03a..00000000000 --- a/app/views/team_members/_team_member.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -- user = member.user -- allow_admin = current_user_can_admin_project -%li{id: dom_id(user), class: "team_member_row user_#{user.id}"} - .row - .span4 - = link_to user, title: user.name, class: "dark" do - = image_tag gravatar_icon(user.email, 32), class: "avatar s32", alt: '' - %strong= truncate(user.name, lenght: 40) - %br - %small.cgray= user.username - - .span4.pull-right - - if allow_admin - .left - = form_for(member, as: :team_member, url: project_team_member_path(@project, member.user)) do |f| - = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2 trigger-submit" - .pull-right - - if current_user == user - %span.label.label-success This is you! - - if @project.namespace_owner == user - %span.label.label-info Owner - - elsif user.blocked? - %span.label.label-error Blocked - - elsif allow_admin - = link_to project_team_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from team' do - %i.icon-minus.icon-white - diff --git a/app/views/team_members/index.html.haml b/app/views/team_members/index.html.haml deleted file mode 100644 index c0f7ee4330d..00000000000 --- a/app/views/team_members/index.html.haml +++ /dev/null @@ -1,56 +0,0 @@ -= render "projects/settings_nav" -%h3.page_title - Project Members - (#{@project.users.count}) - %small - Read more about project permissions - %strong= link_to "here", help_permissions_path, class: "vlink" - - - if can? current_user, :admin_team_member, @project - %span.pull-right - = link_to import_project_team_members_path(@project), class: "btn btn-small grouped", title: "Import team from another project" do - Import team from another project - = link_to available_project_teams_path(@project), class: "btn btn-small grouped", title: "Assign project to team of users" do - Assign project to Team of users - = link_to new_project_team_member_path(@project), class: "btn btn-primary small grouped", title: "New Team Member" do - New Team Member - -%hr - -.clearfix -.row - .span3 - %ul.nav.nav-pills.nav-stacked - %li{class: ("active" if !params[:type])} - = link_to project_team_index_path(type: nil) do - All - %li{class: ("active" if params[:type] == 'masters')} - = link_to project_team_index_path(type: 'masters') do - Masters - %span.pull-right= @project.users_projects.masters.count - %li{class: ("active" if params[:type] == 'developers')} - = link_to project_team_index_path(type: 'developers') do - Developers - %span.pull-right= @project.users_projects.developers.count - %li{class: ("active" if params[:type] == 'reporters')} - = link_to project_team_index_path(type: 'reporters') do - Reporters - %span.pull-right= @project.users_projects.reporters.count - %li{class: ("active" if params[:type] == 'guests')} - = link_to project_team_index_path(type: 'guests') do - Guests - %span.pull-right= @project.users_projects.guests.count - - - if @assigned_teams.present? - %h5 - Assigned teams - (#{@project.user_teams.count}) - %div - = render "team_members/assigned_teams", assigned_teams: @assigned_teams - - .span9 - %div.team-table - = render "team_members/team", team: @team - - - diff --git a/app/views/team_members/new.html.haml b/app/views/team_members/new.html.haml deleted file mode 100644 index 7e20f50d964..00000000000 --- a/app/views/team_members/new.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -= render "projects/settings_nav" -= render "team_members/form" diff --git a/app/views/teams/_filter.html.haml b/app/views/teams/_filter.html.haml deleted file mode 100644 index f461fcad42e..00000000000 --- a/app/views/teams/_filter.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -= form_tag team_filter_path(entity), method: 'get' do - %fieldset.dashboard-search-filter - = search_field_tag "search", params[:search], { placeholder: 'Search', class: 'search-text-input' } - = button_tag type: 'submit', class: 'btn' do - %i.icon-search - - %fieldset - %legend Status: - %ul.nav.nav-pills.nav-stacked - %li{class: ("active" if !params[:status])} - = link_to team_filter_path(entity, status: nil) do - Open - %li{class: ("active" if params[:status] == 'closed')} - = link_to team_filter_path(entity, status: 'closed') do - Closed - %li{class: ("active" if params[:status] == 'all')} - = link_to team_filter_path(entity, status: 'all') do - All - - %fieldset - %legend Projects: - %ul.nav.nav-pills.nav-stacked - - @projects.each do |project| - - unless entities_per_project(project, entity).zero? - %li{class: ("active" if params[:project_id] == project.id.to_s)} - = link_to team_filter_path(entity, project_id: project.id) do - = project.name_with_namespace - %small.pull-right= entities_per_project(project, entity) - - %fieldset - %hr - = link_to "Reset", team_filter_path(entity), class: 'btn pull-right' - diff --git a/app/views/teams/_projects.html.haml b/app/views/teams/_projects.html.haml deleted file mode 100644 index d0061aa2df7..00000000000 --- a/app/views/teams/_projects.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -.ui-box - %h5.title - Projects - %small - (#{projects.count}) - - if can? current_user, :manage_user_team, @team - %span.pull-right - = link_to edit_team_path(@team), class: "btn btn-tiny info" do - %i.icon-plus - Assign Project - %ul.well-list - - if projects.blank? - %p.nothing_here_message This team has no projects yet - - projects.each do |project| - %li - = link_to project_path(project), class: dom_class(project) do - %strong.well-title= truncate(project.name_with_namespace, length: 40) - %span.arrow - → - %span.last_activity - %strong Last activity: - %span= project_last_activity(project) diff --git a/app/views/teams/edit.html.haml b/app/views/teams/edit.html.haml deleted file mode 100644 index 7f2273ee26c..00000000000 --- a/app/views/teams/edit.html.haml +++ /dev/null @@ -1,74 +0,0 @@ -.row - .span3 - %ul.nav.nav-pills.nav-stacked - %li.active - = link_to 'Projects', '#tab-projects', 'data-toggle' => 'tab' - %li - = link_to 'Edit Team', '#tab-edit', 'data-toggle' => 'tab' - - if can? current_user, :admin_user_team, @team - %li - = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab' - - .span9 - .tab-content - .tab-pane.active#tab-projects - .ui-box.projects-table - %h5.title Projects - %ul.well-list - - @projects.each do |project| - %li - - if project.public - %i.icon-share - - else - %i.icon-lock.cgreen - = link_to project.name_with_namespace, project - .pull-right - = link_to 'Edit max access', edit_team_project_path(@team, project), class: "btn btn-small" - = link_to 'Relegate', team_project_path(@team, project), confirm: 'Remove project from team and move to global namespace. Are you sure?', method: :delete, class: "btn btn-remove small" - .form-holder - = form_tag team_projects_path(@team), id: "assign_projects", class: "bulk_import", method: :post do - %table.headless - %tr - %td= select_tag :project_ids, options_from_collection_for_select(@avaliable_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span4' - %td= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen" } - %td= submit_tag 'Add Project', class: "btn btn-create", id: :assign_projects_to_team - - - .tab-pane#tab-edit - .ui-box - %h5.title Edit Team - %div.form-holder - = form_for @team, url: team_path(@team) do |f| - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix - = f.label :name do - Team name is - .input - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xlarge left" - - .clearfix.team-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xlarge js-gfm-input", rows: 4 - - .clearfix - = f.label :path do - Team path is - .input - = f.text_field :path, placeholder: "opensource", class: "xlarge left" - - .form-actions - = f.submit 'Save team changes', class: "btn btn-primary" - - .tab-pane#tab-remove - .ui-box.ui-box-danger - %h5.title Remove team - .ui-box-body - %p - Remove of team will cause removing members access to projects. - %p - %strong Removed team can not be restored! - - = link_to 'Remove team', team_path(@team), method: :delete, confirm: "You are sure?", class: "btn btn-remove btn-small" diff --git a/app/views/teams/issues.html.haml b/app/views/teams/issues.html.haml deleted file mode 100644 index 94818ccd7f4..00000000000 --- a/app/views/teams/issues.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h3.page_title - Issues - %small (in Team projects assigned to Team members) - %small.pull-right #{@issues.total_count} issues - -%hr -.row - .span3 - = render 'filter', entity: 'issue' - .span9 - - if @issues.any? - - @issues.group_by(&:project).each do |group| - %div.ui-box - - @project = group[0] - %h5.title - = link_to_project @project - %ul.well-list.issues-list - - group[1].each do |issue| - = render issue - %hr - = paginate @issues, theme: "gitlab" - - else - %p.nothing_here_message Nothing to show here diff --git a/app/views/teams/members/_form.html.haml b/app/views/teams/members/_form.html.haml deleted file mode 100644 index c22ee78305f..00000000000 --- a/app/views/teams/members/_form.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -= form_tag admin_team_member_path(@team, @member), method: :put do - -if @member.errors.any? - .alert.alert-error - %ul - - @member.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Default access for Team projects: - .input - = select_tag :default_project_access, options_for_select(UserTeam.access_roles, @team.default_projects_access(@member)), class: "project-access-select chosen span3" - .clearfix - %label Team admin? - .input - = check_box_tag :group_admin, true, @team.admin?(@member) - - %br - .actions - = submit_tag 'Save', class: "btn btn-save" - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/teams/members/_member.html.haml b/app/views/teams/members/_member.html.haml deleted file mode 100644 index 19591db03e2..00000000000 --- a/app/views/teams/members/_member.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -- user = member.user -- allow_admin = can? current_user, :manage_user_team, @team -%li{id: dom_id(member), class: "team_member_row user_#{user.id}"} - .row - .span3 - = link_to user_path(user.username), title: user.name, class: "dark" do - = image_tag gravatar_icon(user.email, 40), class: "avatar s32", alt: '' - = link_to user_path(user.username), title: user.name, class: "dark" do - %strong= truncate(user.name, lenght: 40) - %br - %small.cgray= user.username - - .span5.pull-right - - if allow_admin - .pull-left - = form_for(member, as: :team_member, url: team_member_path(@team, user)) do |f| - = label_tag :group_admin do - = f.check_box :group_admin, class: 'trigger-submit' - %span Admin access - - = f.select :permission, options_for_select(UsersProject.access_roles, @team.default_projects_access(user)), {}, class: "span2 trigger-submit" - .pull-right - - if current_user == user - %span.label.label-success This is you! - - if @team.owner == user - %span.label.label-info Owner - - elsif user.blocked? - %span.label.label-error Blocked - - elsif allow_admin - = link_to team_member_path(@team, user), confirm: remove_from_user_team_message(@team, user), method: :delete, class: "btn-tiny btn btn-remove", title: "Remove from team" do - %i.icon-minus.icon-white diff --git a/app/views/teams/members/_team.html.haml b/app/views/teams/members/_team.html.haml deleted file mode 100644 index 52bb597cd80..00000000000 --- a/app/views/teams/members/_team.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -- grouped_user_team_members(team).each do |access, members| - - access_key = Project.access_options.key(access) - - next if params[:type].present? && params[:type] != access_key.tableize - .ui-box - %h5.title - = access_key.pluralize - %small= members.size - %ul.well-list.team-members - - members.sort_by(&:user_name).each do |member| - = render 'teams/members/member', member: member diff --git a/app/views/teams/members/edit.html.haml b/app/views/teams/members/edit.html.haml deleted file mode 100644 index 375880496ab..00000000000 --- a/app/views/teams/members/edit.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3.page_title - Edit access #{@member.name} in #{@team.name} team - -%hr -%table.zebra-striped - %tr - %td User: - %td= @member.name - %tr - %td Team: - %td= @team.name - %tr - %td Since: - %td= member_since(@team, @member).stamp("Nov 11, 2010") - -= render 'form' diff --git a/app/views/teams/members/index.html.haml b/app/views/teams/members/index.html.haml deleted file mode 100644 index 02700e9fb71..00000000000 --- a/app/views/teams/members/index.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -%h3.page_title - Team Members - (#{@members.count}) - %small - Read more about project permissions - %strong= link_to "here", help_permissions_path, class: "vlink" - - - if can? current_user, :manage_user_team, @team - %span.pull-right - = link_to new_team_member_path(@team), class: "btn btn-primary small grouped", title: "New Team Member" do - New Team Member -%hr - - -.row - .span3 - %ul.nav.nav-pills.nav-stacked - %li{class: ("active" if !params[:type])} - = link_to team_members_path(@team, type: nil) do - All - %li{class: ("active" if params[:type] == 'masters')} - = link_to team_members_path(@team, type: 'masters') do - Masters - %li{class: ("active" if params[:type] == 'developers')} - = link_to team_members_path(@team, type: 'developers') do - Developers - %li{class: ("active" if params[:type] == 'reporters')} - = link_to team_members_path(@team, type: 'reporters') do - Reporters - %li{class: ("active" if params[:type] == 'guests')} - = link_to team_members_path(@team, type: 'guests') do - Guests - - .span9 - .clearfix - %div.team-table - = render "teams/members/team", team: @team diff --git a/app/views/teams/members/new.html.haml b/app/views/teams/members/new.html.haml deleted file mode 100644 index 99530ebb7f0..00000000000 --- a/app/views/teams/members/new.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -%h3.page_title - Team: #{@team.name} - -%hr - -= form_tag team_members_path(@team), id: "team_members", class: "bulk_import", method: :post do - %h6 1. Choose people you want in the team - .clearfix - = label_tag :user_ids, "People" - .input - = users_select_tag(:user_ids, multiple: true) - - %h6 2. Set access level for them - .clearfix - = label_tag :project_access, "Project Access" - .input= select_tag :default_project_access, options_for_select(Project.access_options), class: "project-access-select chosen" - - .clearfix - = label_tag :group_admin do - %span Team Admin? - .input= check_box_tag :group_admin - - .actions - = submit_tag 'Add users', class: "btn btn-create", id: :add_members_to_team - = link_to "Cancel", team_members_path(@team), class: "btn btn-cancel" diff --git a/app/views/teams/merge_requests.html.haml b/app/views/teams/merge_requests.html.haml deleted file mode 100644 index 417d1aa6040..00000000000 --- a/app/views/teams/merge_requests.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -%h3.page_title - Merge Requests - %small (authored by or assigned to Team members) - %small.pull-right #{@merge_requests.total_count} merge requests - -%hr -.row - .span3 - = render 'filter', entity: 'merge_request' - .span9 - - if @merge_requests.any? - - @merge_requests.group_by(&:project).each do |group| - .ui-box - - @project = group[0] - %h5.title - = link_to_project @project - %ul.well-list - - group[1].each do |merge_request| - = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) - %hr - = paginate @merge_requests, theme: "gitlab" - - - else - %h3.nothing_here_message Nothing to show here diff --git a/app/views/teams/new.html.haml b/app/views/teams/new.html.haml deleted file mode 100644 index fe1f9cf10ec..00000000000 --- a/app/views/teams/new.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -= form_for @team, url: teams_path do |f| - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix - = f.label :name do - Team name is - .input - = f.text_field :name, placeholder: "Ex. Ruby Developers", class: "xxlarge left" - - .clearfix.team-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - - .clearfix - .input - %ul - %li All created teams are public (users can view who enter into team and which project are assigned for this team) - %li People within a team see only projects they have access to - %li You will be able to assign existing projects for team - .form-actions - = f.submit 'Create team', class: "btn btn-create" - - - if current_user.can_create_group? - .clearfix - .input.light - Need a group for several dependent projects? - = link_to new_group_path, class: "btn btn-tiny" do - Create a group - - if current_user.can_create_project? - .clearfix - .input.light - Want to create a project? - = link_to new_project_path, class: "btn btn-tiny" do - Create a project diff --git a/app/views/teams/projects/_form.html.haml b/app/views/teams/projects/_form.html.haml deleted file mode 100644 index d2c89b0c36b..00000000000 --- a/app/views/teams/projects/_form.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= form_tag team_project_path(@team, @project), method: :put do - -if @project.errors.any? - .alert.alert-error - %ul - - @project.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Max access for Team members: - .input - = select_tag :greatest_project_access, options_for_select(UserTeam.access_roles, @team.max_project_access(@project)), class: "project-access-select chosen span3" - - %br - .actions - = submit_tag 'Save', class: "btn btn-save" - = link_to 'Cancel', :back, class: "btn btn-cancel" diff --git a/app/views/teams/projects/edit.html.haml b/app/views/teams/projects/edit.html.haml deleted file mode 100644 index 82c7d734815..00000000000 --- a/app/views/teams/projects/edit.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h3.page_title - Edit max access in #{link_to @project.name_with_namespace, @project} for #{link_to(@team.name, team_path(@team))} team - -%hr - -= render 'form' diff --git a/app/views/teams/show.atom.builder b/app/views/teams/show.atom.builder deleted file mode 100644 index fffb78d53e8..00000000000 --- a/app/views/teams/show.atom.builder +++ /dev/null @@ -1,28 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "Team feed - #{@team.name}" - xml.link :href => team_url(@team, :atom), :rel => "self", :type => "application/atom+xml" - xml.link :href => team_url(@team), :rel => "alternate", :type => "text/html" - xml.id projects_url - xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? - - @events.each do |event| - if event.proper? - xml.entry do - event_link = event_feed_url(event) - event_title = event_feed_title(event) - - xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}" - xml.link :href => event_link - xml.title truncate(event_title, :length => 80) - xml.updated event.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") - xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(event.author_email) - xml.author do |author| - xml.name event.author_name - xml.email event.author_email - end - xml.summary event_title - end - end - end -end diff --git a/app/views/teams/show.html.haml b/app/views/teams/show.html.haml deleted file mode 100644 index 8582f85a2b5..00000000000 --- a/app/views/teams/show.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -.dashboard - .activities.span8 - = link_to dashboard_path, class: 'btn btn-tiny' do - ← To dashboard - - %span.cgray Events and projects are filtered in scope of team - %hr - - if @events.any? - .content_list - - else - %p.nothing_here_message Projects activity will be displayed here - .loading.hide - .side.span4 - - if @team.description.present? - .description-block - = @team.description - = render "projects", projects: @projects - .prepend-top-20 - = link_to team_path(@team, { format: :atom, private_token: current_user.private_token }), title: "Feed" do - %strong - %i.icon-rss - News Feed - - %hr - = render 'shared/promo' diff --git a/app/views/teams/show.js.haml b/app/views/teams/show.js.haml deleted file mode 100644 index 7e5a148e5ef..00000000000 --- a/app/views/teams/show.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -:plain - Pager.append(#{@events.count}, "#{escape_javascript(render(@events))}"); diff --git a/app/views/users/_projects.html.haml b/app/views/users/_projects.html.haml index 4bee2f0c8ff..9f1446c0317 100644 --- a/app/views/users/_projects.html.haml +++ b/app/views/users/_projects.html.haml @@ -9,12 +9,3 @@ \/ %strong.well-title = truncate(project.name, length: 45) - %span.pull-right.light - - if project.owner == user - %i.icon-wrench - - tm = project.team.get_tm(user.id) - - if tm - = tm.project_access_human -%p.light - %i.icon-wrench - – user is a project owner diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 548458e0d3b..b70f4193209 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -14,7 +14,7 @@ %small member since #{@user.created_at.stamp("Nov 12, 2031")} .clearfix %hr - %h5 Recent events + %h5 User Activity: = render @events .span4 = render 'profile', user: @user diff --git a/app/views/users_groups/_users_group.html.haml b/app/views/users_groups/_users_group.html.haml new file mode 100644 index 00000000000..3a1e32dd79d --- /dev/null +++ b/app/views/users_groups/_users_group.html.haml @@ -0,0 +1,18 @@ +- user = member.user +- return unless user +%li{class: dom_class(member)} + = image_tag gravatar_icon(user.email, 16), class: "avatar s16" + %strong= user.name + %span.cgray= user.username + - if user == current_user + %span.label.label-success It's you + + %span.pull-right + - if @group.owners.include?(user) + %span.label.label-info Group Owner + - else + = member.human_access + + - if show_controls && user != current_user && user != @group.owner + = link_to group_users_group_path(@group, member), confirm: remove_user_from_group_message(@group, user), method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do + %i.icon-minus.icon-white diff --git a/config/deploy.rb.example b/config/deploy.rb.example deleted file mode 100644 index ddce4671b58..00000000000 --- a/config/deploy.rb.example +++ /dev/null @@ -1,72 +0,0 @@ -set :domain, 'set application domain here' -set :db_adapter, 'mysql' # or postgres -set :mount_point, '/' -set :application, 'gitlabhq' -set :user, 'git' -set :rails_env, 'production' -set :deploy_to, "/home/#{user}/apps/#{application}" -set :bundle_without, %w[development test] + (%w[mysql postgres] - [db_adapter]) -set :asset_env, "RAILS_GROUPS=assets RAILS_RELATIVE_URL_ROOT=#{mount_point.sub /\/+\Z/, ''}" - -set :use_sudo, false -default_run_options[:pty] = true - -# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` -set :scm, :git -set :repository, "git@#{domain}:#{application}.git" -set :deploy_via, :remote_cache - -# Alternatively, you can deploy via copy, if you don't have gitlab in git -#set :scm, :none -#set :repository, '.' -#set :deploy_via, :copy - -server domain, :app, :web, :db, primary: true - -namespace :foreman do - desc 'Export the Procfile to Ubuntu upstart scripts' - task :export, roles: :app do - foreman_export = "foreman export upstart /etc/init -f Procfile -a #{application} -u #{user} -l #{shared_path}/log/foreman" - run "cd #{release_path} && #{sudo} #{fetch :bundle_cmd, 'bundle'} exec #{foreman_export}" - end - - desc 'Start the application services' - task :start, roles: :app do - run "#{sudo} service #{application} start" - end - - desc 'Stop the application services' - task :stop, roles: :app do - run "#{sudo} service #{application} stop" - end - - desc 'Restart the application services' - task :restart, roles: :app do - run "#{sudo} service #{application} restart" - end -end - -namespace :deploy do - desc 'Start the application services' - task :start, roles: :app do - foreman.start - end - - desc 'Stop the application services' - task :stop, roles: :app do - foreman.stop - end - - desc 'Restart the application services' - task :restart, roles: :app do - foreman.restart - end -end - -after 'deploy:cold' do - run "cd #{release_path} && #{rake} gitlab:setup force=yes RAILS_ENV=#{rails_env}" - deploy.restart -end - -after 'deploy:update', 'foreman:export' # Export foreman scripts -#after 'deploy:update', 'foreman:restart' # Restart application scripts diff --git a/config/environments/production.rb b/config/environments/production.rb index 7e02c75e562..2e2d46c4161 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -52,7 +52,7 @@ Gitlab::Application.configure do # config.action_mailer.raise_delivery_errors = false # Enable threaded mode - config.threadsafe! unless $rails_rake_task + # config.threadsafe! unless $rails_rake_task # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found) diff --git a/config/puma.rb.example b/config/puma.rb.example index 08eace369fd..c363ad010b6 100644 --- a/config/puma.rb.example +++ b/config/puma.rb.example @@ -8,47 +8,12 @@ # ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" application_path = '/home/git/gitlab' - -# The directory to operate out of. -# -# The default is the current directory. -# directory application_path - -# Set the environment in which the rack's app will run. -# -# The default is “development”. -# environment 'production' - -# Daemonize the server into the background. Highly suggest that -# this be combined with “pidfile” and “stdout_redirect”. -# -# The default is “false”. -# daemonize true - -# Store the pid of the server in the file at “path”. -# pidfile "#{application_path}/tmp/pids/puma.pid" - -# Use “path” as the file to store the server info state. This is -# used by “pumactl” to query and control the server. -# state_path "#{application_path}/tmp/pids/puma.state" - -# Redirect STDOUT and STDERR to files specified. The 3rd parameter -# (“append”) specifies whether the output is appended, the default is -# “false”. -# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" -# stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true - -# Disable request logging. -# -# The default is “false”. -# -# quiet # Configure “min” to be the minimum number of threads to use to answer # requests and “max” the maximum. @@ -63,6 +28,9 @@ stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/ # The default is “tcp://0.0.0.0:9292”. # # bind 'tcp://0.0.0.0:9292' +# bind 'unix:///var/run/puma.sock' +# bind 'unix:///var/run/puma.sock?umask=0777' +# bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert' bind "unix://#{application_path}/tmp/sockets/gitlab.socket" # Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you diff --git a/config/routes.rb b/config/routes.rb index f545ad82f77..f319ef221df 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -38,6 +38,7 @@ Gitlab::Application.routes.draw do get 'help/system_hooks' => 'help#system_hooks' get 'help/web_hooks' => 'help#web_hooks' get 'help/workflow' => 'help#workflow' + get 'help/shortcuts' # # Global snippets @@ -76,16 +77,7 @@ Gitlab::Application.routes.draw do resources :groups, constraints: { id: /[^\/]+/ } do member do - put :project_update put :project_teams_update - delete :remove_project - end - end - - resources :teams, constraints: { id: /[^\/]+/ } do - scope module: :teams do - resources :members, only: [:edit, :update, :destroy, :new, :create] - resources :projects, only: [:edit, :update, :destroy, :new, :create], constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } end end @@ -97,9 +89,7 @@ Gitlab::Application.routes.draw do resource :background_jobs, controller: 'background_jobs', only: [:show] resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do - scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do - resources :members, only: [:edit, :update, :destroy] - end + resources :members, only: [:destroy] end root to: "dashboard#index" @@ -122,11 +112,13 @@ Gitlab::Application.routes.draw do put :update_username end - resource :notifications - resource :password + scope module: :profiles do + resource :notifications, only: [:show, :update] + resource :password, only: [:new, :create] + resources :keys + end end - resources :keys match "/u/:username" => "users#show", as: :user, constraints: { username: /.*/ } @@ -134,7 +126,7 @@ Gitlab::Application.routes.draw do # # Dashboard Area # - resource :dashboard, controller: "dashboard" do + resource :dashboard, controller: "dashboard", only: [:show] do member do get :projects get :issues @@ -149,24 +141,10 @@ Gitlab::Application.routes.draw do member do get :issues get :merge_requests - get :search get :people - post :team_members end - end - # - # Teams Area - # - resources :teams, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} do - member do - get :issues - get :merge_requests - end - scope module: :teams do - resources :members, only: [:index, :new, :create, :edit, :update, :destroy] - resources :projects, only: [:index, :new, :create, :edit, :update, :destroy], constraints: { id: /[a-zA-Z.0-9_\-\/]+/ } - end + resources :users_groups, only: [:create, :update, :destroy] end resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create] @@ -183,148 +161,137 @@ Gitlab::Application.routes.draw do get :autocomplete_sources end - resources :blob, only: [:show], constraints: {id: /.+/} - resources :raw, only: [:show], constraints: {id: /.+/} - resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ } - resources :edit_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'edit' - resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} - resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} - resources :compare, only: [:index, :create] - resources :blame, only: [:show], constraints: {id: /.+/} - resources :network, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} - resources :graphs, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} - match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/} - scope module: :projects do - resources :snippets do - member do - get "raw" + resources :blob, only: [:show], constraints: {id: /.+/} + resources :raw, only: [:show], constraints: {id: /.+/} + resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ } + resources :edit_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'edit' + resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} + resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} + resources :compare, only: [:index, :create] + resources :blame, only: [:show], constraints: {id: /.+/} + resources :network, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} + resources :graphs, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} + match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/} + + resources :snippets do + member do + get "raw" + end end - end - end - resources :wikis, only: [:show, :edit, :destroy, :create] do - collection do - get :pages - put ':id' => 'wikis#update' - get :git_access - end + resources :wikis, only: [:show, :edit, :destroy, :create] do + collection do + get :pages + put ':id' => 'wikis#update' + get :git_access + end - member do - get "history" + member do + get "history" + end end - end - resource :wall, only: [:show] do - member do - get 'notes' + resource :wall, only: [:show] do + member do + get 'notes' + end end - end - resource :repository do - member do - get "branches" - get "tags" - get "stats" - get "archive" + resource :repository, only: [:show] do + member do + get "branches" + get "tags" + get "stats" + get "archive" + end end - end - resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do - member do - get :test + resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do + member do + get :test + end end - end - resources :deploy_keys do - member do - put :enable - put :disable + resources :deploy_keys do + member do + put :enable + put :disable + end end - end - resources :protected_branches, only: [:index, :create, :destroy] + resources :protected_branches, only: [:index, :create, :destroy] - resources :refs, only: [] do - collection do - get "switch" - end + resources :refs, only: [] do + collection do + get "switch" + end - member do - # tree viewer logs - get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } - get "logs_tree/:path" => "refs#logs_tree", - as: :logs_file, - constraints: { - id: /[a-zA-Z.0-9\/_\-#%+]+/, - path: /.*/ - } + member do + # tree viewer logs + get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } + get "logs_tree/:path" => "refs#logs_tree", + as: :logs_file, + constraints: { + id: /[a-zA-Z.0-9\/_\-#%+]+/, + path: /.*/ + } + end end - end - resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do - member do - get :diffs - get :automerge - get :automerge_check - get :ci_status - end + resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do + member do + get :diffs + get :automerge + get :automerge_check + get :ci_status + end - collection do - get :branch_from - get :branch_to + collection do + get :branch_from + get :branch_to + end end - end - resources :hooks, only: [:index, :create, :destroy] do - member do - get :test + resources :hooks, only: [:index, :create, :destroy] do + member do + get :test + end end - end - resources :team, controller: 'team_members', only: [:index] - resources :milestones, except: [:destroy] + resources :team, controller: 'team_members', only: [:index] + resources :milestones, except: [:destroy] - resources :labels, only: [:index] do - collection do - post :generate + resources :labels, only: [:index] do + collection do + post :generate + end end - end - resources :issues, except: [:destroy] do - collection do - post :bulk_update + resources :issues, except: [:destroy] do + collection do + post :bulk_update + end end - end - resources :team_members, except: [:index, :edit] do - collection do + resources :team_members, except: [:index, :edit] do + collection do - # Used for import team - # from another project - get :import - post :apply_import + # Used for import team + # from another project + get :import + post :apply_import + end end - end - scope module: :projects do - resources :teams, only: [] do - collection do - get :available - post :assign - end + resources :notes, only: [:index, :create, :destroy, :update] do member do - delete :resign + delete :delete_attachment end - end - end - resources :notes, only: [:index, :create, :destroy, :update] do - member do - delete :delete_attachment - end - collection do - post :preview + collection do + post :preview + end end end end diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example index 00c509dd829..e010de6d6a9 100644 --- a/config/unicorn.rb.example +++ b/config/unicorn.rb.example @@ -21,7 +21,7 @@ worker_processes 2 # Help ensure your application will always spawn in the symlinked # "current" directory that Capistrano sets up. -working_directory "/home/git/gitlab/current" # available in 0.94.0+ +working_directory "/home/git/gitlab" # available in 0.94.0+ # listen on both a Unix domain socket and a TCP port, # we use a shorter backlog for quicker failover when busy diff --git a/db/fixtures/development/01_admin.rb b/db/fixtures/development/01_admin.rb index fbe41e4d22d..948a3459283 100644 --- a/db/fixtures/development/01_admin.rb +++ b/db/fixtures/development/01_admin.rb @@ -7,5 +7,6 @@ User.seed(:id, [ password: "5iveL!fe", password_confirmation: "5iveL!fe", admin: true, + projects_limit: 100, } ]) diff --git a/db/fixtures/development/02_source_code.rb b/db/fixtures/development/02_source_code.rb deleted file mode 100644 index 5ce5bcf4aba..00000000000 --- a/db/fixtures/development/02_source_code.rb +++ /dev/null @@ -1,29 +0,0 @@ -gitlab_shell_path = File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}") -root = Gitlab.config.gitlab_shell.repos_path - -projects = [ - { path: 'underscore.git', git: 'https://github.com/documentcloud/underscore.git' }, - { path: 'diaspora.git', git: 'https://github.com/diaspora/diaspora.git' }, - { path: 'brightbox/brightbox-cli.git', git: 'https://github.com/brightbox/brightbox-cli.git' }, - { path: 'brightbox/puppet.git', git: 'https://github.com/brightbox/puppet.git' }, - { path: 'gitlab/gitlabhq.git', git: 'https://github.com/gitlabhq/gitlabhq.git' }, - { path: 'gitlab/gitlab-ci.git', git: 'https://github.com/gitlabhq/gitlab-ci.git' }, - { path: 'gitlab/gitlab-recipes.git', git: 'https://github.com/gitlabhq/gitlab-recipes.git' }, -] - -projects.each do |project| - project_path = File.join(root, project[:path]) - - if File.exists?(project_path) - print '-' - next - end - if system("#{gitlab_shell_path}/gitlab-shell/bin/gitlab-projects import-project #{project[:path]} #{project[:git]}") - print '.' - else - print 'F' - end -end - -puts "OK".green - diff --git a/db/fixtures/development/03_group.rb b/db/fixtures/development/03_group.rb deleted file mode 100644 index 01174a4b72a..00000000000 --- a/db/fixtures/development/03_group.rb +++ /dev/null @@ -1,5 +0,0 @@ -Group.seed(:id, [ - { id: 99, name: "GitLab", path: 'gitlab', owner_id: 1 }, - { id: 100, name: "Brightbox", path: 'brightbox', owner_id: 1 }, - { id: 101, name: "KDE", path: 'kde', owner_id: 1 }, -]) diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/04_project.rb index 9904c48e518..43178dee25d 100644 --- a/db/fixtures/development/04_project.rb +++ b/db/fixtures/development/04_project.rb @@ -1,20 +1,49 @@ -Project.seed(:id, [ +project_urls = [ + 'https://github.com/documentcloud/underscore.git', + 'https://github.com/diaspora/diaspora.git', + 'https://github.com/diaspora/diaspora-project-site.git', + 'https://github.com/diaspora/diaspora-client.git', + 'https://github.com/brightbox/brightbox-cli.git', + 'https://github.com/brightbox/puppet.git', + 'https://github.com/gitlabhq/gitlabhq.git', + 'https://github.com/gitlabhq/gitlab-ci.git', + 'https://github.com/gitlabhq/gitlab-recipes.git', + 'https://github.com/gitlabhq/gitlab-shell.git', + 'https://github.com/gitlabhq/grack.git', + 'https://github.com/twitter/flight.git', + 'https://github.com/twitter/typeahead.js.git', + 'https://github.com/h5bp/html5-boilerplate.git', + 'https://github.com/h5bp/mobile-boilerplate.git', +] - # Global - { id: 1, name: "Underscore.js", path: "underscore", creator_id: 1 }, - { id: 2, name: "Diaspora", path: "diaspora", creator_id: 1 }, +project_urls.each_with_index do |url, i| + group_path, project_path = url.split('/')[-2..-1] - # Brightbox - { id: 3, namespace_id: 100, name: "Brightbox CLI", path: "brightbox-cli", creator_id: 1 }, - { id: 4, namespace_id: 100, name: "Puppet", path: "puppet", creator_id: 1 }, + group = Group.find_by_path(group_path) - # KDE - { id: 5, namespace_id: 101, name: "kdebase", path: "kdebase", creator_id: 1}, - { id: 6, namespace_id: 101, name: "kdelibs", path: "kdelibs", creator_id: 1}, - { id: 7, namespace_id: 101, name: "amarok", path: "amarok", creator_id: 1}, + unless group + group = Group.new( + name: group_path.titleize, + path: group_path + ) + group.owner = User.first + group.save + end - # GitLab - { id: 8, namespace_id: 99, name: "gitlabhq", path: "gitlabhq", creator_id: 1}, - { id: 9, namespace_id: 99, name: "gitlab-ci", path: "gitlab-ci", creator_id: 1}, - { id: 10, namespace_id: 99, name: "gitlab-recipes", path: "gitlab-recipes", creator_id: 1}, -]) + project_path.gsub!(".git", "") + + params = { + import_url: url, + namespace_id: group.id, + name: project_path.titleize + } + + project = Projects::CreateContext.new(User.first, params).execute + + if project.valid? + print '.' + else + puts project.errors.full_messages + print 'F' + end +end diff --git a/db/fixtures/development/05_users.rb b/db/fixtures/development/05_users.rb index abcb0259618..cbb3e636acc 100644 --- a/db/fixtures/development/05_users.rb +++ b/db/fixtures/development/05_users.rb @@ -1,5 +1,5 @@ Gitlab::Seeder.quiet do - (2..300).each do |i| + (2..50).each do |i| begin User.seed(:id, [{ id: i, diff --git a/db/fixtures/development/06_teams.rb b/db/fixtures/development/06_teams.rb index f82977d7fdc..a1e01879db5 100644 --- a/db/fixtures/development/06_teams.rb +++ b/db/fixtures/development/06_teams.rb @@ -1,14 +1,23 @@ ActiveRecord::Base.observers.disable :all Gitlab::Seeder.quiet do - Project.all.each do |project| - project.team << [User.first, :master] - print '.' + Group.all.each do |group| + User.all.sample(4).each do |user| + if group.add_users([user.id], UsersGroup.group_access_roles.values.sample) + print '.' + else + print 'F' + end + end + end - User.all.sample(rand(10)).each do |user| - role = [:master, :developer, :reporter].sample - project.team << [user, role] - print '.' + Project.all.each do |project| + User.all.sample(4).each do |user| + if project.team << [user, UsersProject.access_roles.values.sample] + print '.' + else + print 'F' + end end end end diff --git a/db/migrate/20130617095603_create_users_groups.rb b/db/migrate/20130617095603_create_users_groups.rb new file mode 100644 index 00000000000..2efc04f1151 --- /dev/null +++ b/db/migrate/20130617095603_create_users_groups.rb @@ -0,0 +1,11 @@ +class CreateUsersGroups < ActiveRecord::Migration + def change + create_table :users_groups do |t| + t.integer :group_access, null: false + t.integer :group_id, null: false + t.integer :user_id, null: false + + t.timestamps + end + end +end diff --git a/db/migrate/20130621195223_add_notification_level_to_user_group.rb b/db/migrate/20130621195223_add_notification_level_to_user_group.rb new file mode 100644 index 00000000000..8c2e3dfcaca --- /dev/null +++ b/db/migrate/20130621195223_add_notification_level_to_user_group.rb @@ -0,0 +1,5 @@ +class AddNotificationLevelToUserGroup < ActiveRecord::Migration + def change + add_column :users_groups, :notification_level, :integer, null: false, default: 3 + end +end diff --git a/db/migrate/20130622115340_add_more_db_index.rb b/db/migrate/20130622115340_add_more_db_index.rb new file mode 100644 index 00000000000..9570a7a3f1e --- /dev/null +++ b/db/migrate/20130622115340_add_more_db_index.rb @@ -0,0 +1,12 @@ +class AddMoreDbIndex < ActiveRecord::Migration + def change + add_index :deploy_keys_projects, :project_id + add_index :web_hooks, :project_id + add_index :protected_branches, :project_id + + add_index :users_groups, :user_id + add_index :snippets, :author_id + add_index :notes, :author_id + add_index :notes, [:noteable_id, :noteable_type] + end +end diff --git a/db/migrate/20130624162710_add_fingerprint_to_key.rb b/db/migrate/20130624162710_add_fingerprint_to_key.rb new file mode 100644 index 00000000000..544a8366727 --- /dev/null +++ b/db/migrate/20130624162710_add_fingerprint_to_key.rb @@ -0,0 +1,6 @@ +class AddFingerprintToKey < ActiveRecord::Migration + def change + add_column :keys, :fingerprint, :string + remove_column :keys, :identifier + end +end diff --git a/db/schema.rb b/db/schema.rb index 348272e0832..3208e8c2354 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130614132337) do +ActiveRecord::Schema.define(:version => 20130624162710) do create_table "deploy_keys_projects", :force => true do |t| t.integer "deploy_key_id", :null => false @@ -20,6 +20,8 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.datetime "updated_at", :null => false end + add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id" + create_table "events", :force => true do |t| t.string "target_type" t.integer "target_id" @@ -53,8 +55,8 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.integer "assignee_id" t.integer "author_id" t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "position", :default => 0 t.string "branch_name" t.text "description" @@ -71,15 +73,14 @@ ActiveRecord::Schema.define(:version => 20130614132337) do create_table "keys", :force => true do |t| t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "key" t.string "title" - t.string "identifier" t.string "type" + t.string "fingerprint" end - add_index "keys", ["identifier"], :name => "index_keys_on_identifier" add_index "keys", ["user_id"], :name => "index_keys_on_user_id" create_table "merge_requests", :force => true do |t| @@ -89,8 +90,8 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.integer "author_id" t.integer "assignee_id" t.string "title" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "st_commits", :limit => 2147483647 t.text "st_diffs", :limit => 2147483647 t.integer "milestone_id" @@ -139,8 +140,8 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.text "note" t.string "noteable_type" t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "project_id" t.string "attachment" t.string "line_code" @@ -148,8 +149,10 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.integer "noteable_id" end + add_index "notes", ["author_id"], :name => "index_notes_on_author_id" add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" add_index "notes", ["created_at"], :name => "index_notes_on_created_at" + add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type" add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" add_index "notes", ["project_id"], :name => "index_notes_on_project_id" @@ -158,8 +161,8 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.string "name" t.string "path" t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "creator_id" t.string "default_branch" t.boolean "issues_enabled", :default => true, :null => false @@ -186,6 +189,8 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.datetime "updated_at", :null => false end + add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id" + create_table "services", :force => true do |t| t.string "type" t.string "title" @@ -206,14 +211,15 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.text "content" t.integer "author_id", :null => false t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "file_name" t.datetime "expires_at" t.boolean "private", :default => true, :null => false t.string "type" end + add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id" add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at" add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at" add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" @@ -228,9 +234,6 @@ ActiveRecord::Schema.define(:version => 20130614132337) do t.datetime "created_at" end - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - create_table "tags", :force => true do |t| t.string "name" end @@ -262,37 +265,37 @@ ActiveRecord::Schema.define(:version => 20130614132337) do end create_table "users", :force => true do |t| - t.string "email", :default => "", :null => false - t.string "encrypted_password", :default => "", :null => false + t.string "email", :default => "", :null => false + t.string "encrypted_password", :limit => 128, :default => "", :null => false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", :default => 0 + t.integer "sign_in_count", :default => 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "name" - t.boolean "admin", :default => false, :null => false - t.integer "projects_limit", :default => 10 - t.string "skype", :default => "", :null => false - t.string "linkedin", :default => "", :null => false - t.string "twitter", :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "projects_limit", :default => 10 + t.string "skype", :default => "", :null => false + t.string "linkedin", :default => "", :null => false + t.string "twitter", :default => "", :null => false t.string "authentication_token" - t.integer "theme_id", :default => 1, :null => false + t.integer "theme_id", :default => 1, :null => false t.string "bio" - t.integer "failed_attempts", :default => 0 + t.integer "failed_attempts", :default => 0 t.datetime "locked_at" t.string "extern_uid" t.string "provider" t.string "username" - t.boolean "can_create_group", :default => true, :null => false - t.boolean "can_create_team", :default => true, :null => false + t.boolean "can_create_group", :default => true, :null => false + t.boolean "can_create_team", :default => true, :null => false t.string "state" - t.integer "color_scheme_id", :default => 1, :null => false - t.integer "notification_level", :default => 1, :null => false + t.integer "color_scheme_id", :default => 1, :null => false + t.integer "notification_level", :default => 1, :null => false t.datetime "password_expires_at" t.integer "created_by_id" end @@ -300,16 +303,26 @@ ActiveRecord::Schema.define(:version => 20130614132337) do add_index "users", ["admin"], :name => "index_users_on_admin" add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token", :unique => true add_index "users", ["email"], :name => "index_users_on_email", :unique => true - add_index "users", ["extern_uid", "provider"], :name => "index_users_on_extern_uid_and_provider", :unique => true add_index "users", ["name"], :name => "index_users_on_name" add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true add_index "users", ["username"], :name => "index_users_on_username" - create_table "users_projects", :force => true do |t| + 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.integer "project_id", :null => false t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "notification_level", :default => 3, :null => false + end + + add_index "users_groups", ["user_id"], :name => "index_users_groups_on_user_id" + + 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 @@ -321,10 +334,12 @@ ActiveRecord::Schema.define(:version => 20130614132337) do create_table "web_hooks", :force => true do |t| t.string "url" t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "type", :default => "ProjectHook" t.integer "service_id" end + add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id" + end diff --git a/doc/install/installation.md b/doc/install/installation.md index 6cad280acaf..65865e1635b 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -88,8 +88,8 @@ Remove the old Ruby 1.8 if present Download Ruby and compile it: mkdir /tmp/ruby && cd /tmp/ruby - curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz - cd ruby-1.9.3-p392 + curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | tar xz + cd ruby-2.0.0-p247 ./configure make sudo make install @@ -186,11 +186,11 @@ You can change `5-3-stable` to `master` if you want the *bleeding edge* version, sudo chmod -R u+rwX public/uploads # Copy the example Puma config - sudo -u git -H cp config/puma.rb.example config/puma.rb + sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb # Enable cluster mode if you expect to have a high load instance # Ex. change amount of workers to 3 for 2GB RAM server - sudo -u git -H editor config/puma.rb + sudo -u git -H vim config/unicorn.rb # Configure Git global settings for git user, useful when editing via web # Edit user.email according to what is set in gitlab.yml @@ -198,7 +198,7 @@ You can change `5-3-stable` to `master` if you want the *bleeding edge* version, sudo -u git -H git config --global user.email "gitlab@localhost" **Important Note:** -Make sure to edit both `gitlab.yml` and `puma.rb` to match your setup. +Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup. ## Configure GitLab DB settings diff --git a/doc/update/5.4-to-6.0.md b/doc/update/5.4-to-6.0.md new file mode 100644 index 00000000000..d241b422c66 --- /dev/null +++ b/doc/update/5.4-to-6.0.md @@ -0,0 +1,71 @@ +# From 5.4 to 6.0 + +### 0. Backup + +It's useful to make a backup just in case things go south: +(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) + +```bash +cd /home/git/gitlab +sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:create +``` + +### 1. Stop server + + sudo service gitlab stop + +### 2. Get latest code + +```bash +cd /home/git/gitlab +sudo -u git -H git fetch +sudo -u git -H git checkout 6-0-dev +``` + +### 3. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL +sudo -u git -H bundle install --without development test postgres --deployment + +#PostgreSQL +sudo -u git -H bundle install --without development test mysql --deployment + +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production +sudo -u git -H bundle exec rake migrate_groups RAILS_ENV=production +sudo -u git -H bundle exec rake migrate_global_projects RAILS_ENV=production +sudo -u git -H bundle exec rake migrate_global_keys RAILS_ENV=production + +``` + +### 4. Update config files + +* Make `/home/git/gitlab/config/gitlab.yml` same as https://github.com/gitlabhq/gitlabhq/blob/5-3-stable/config/gitlab.yml.example but with your settings. +* Make `/home/git/gitlab/config/puma.rb` same as https://github.com/gitlabhq/gitlabhq/blob/5-3-stable/config/puma.rb.example but with your settings. + +### 5. Update Init script + +```bash +sudo rm /etc/init.d/gitlab +sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-3-stable/lib/support/init.d/gitlab +sudo chmod +x /etc/init.d/gitlab +``` + +### 6. Start application + + sudo service gitlab start + sudo service nginx restart + +### 7. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + +If all items are green, then congratulations upgrade complete! diff --git a/features/admin/groups.feature b/features/admin/groups.feature index 054dccfd64c..6fed9a34869 100644 --- a/features/admin/groups.feature +++ b/features/admin/groups.feature @@ -5,6 +5,9 @@ Feature: Admin Groups And Create gitlab user "John" And I visit admin groups page + Scenario: See group list + Then I should be all groups + Scenario: Create a group When I click new group link And submit form with new group info diff --git a/features/admin/teams.feature b/features/admin/teams.feature deleted file mode 100644 index 6a15fddcdcc..00000000000 --- a/features/admin/teams.feature +++ /dev/null @@ -1,70 +0,0 @@ -Feature: Admin Teams - Background: - Given I sign in as an admin - And Create gitlab user "John" - - Scenario: Create a team - When I visit admin teams page - And I click new team link - And submit form with new team info - Then I should be redirected to team page - And I should see newly created team - - Scenario: Add user to team - When I visit admin teams page - When I have clean "HardCoders" team - And I visit "HardCoders" team page - When I click to "Add members" link - When I select user "John" from user list as "Developer" - And submit form with new team member info - Then I should see "John" in teams members list as "Developer" - - Scenario: Assign team to existing project - When I visit admin teams page - When I have "HardCoders" team with "John" member with "Developer" role - When I have "Shop" project - And I visit "HardCoders" team page - Then I should see empty projects table - When I click to "Add projects" link - When I select project "Shop" with max access "Reporter" - And submit form with new team project info - Then I should see "Shop" project in projects list - When I visit "Shop" project admin page - Then I should see "John" user with role "Reporter" in team table - - Scenario: Add user to team with ptojects - When I visit admin teams page - When I have "HardCoders" team with "John" member with "Developer" role - And "HardCoders" team assigned to "Shop" project with "Developer" max role access - When I have gitlab user "Jimm" - And I visit "HardCoders" team page - Then I should see members table without "Jimm" member - When I click to "Add members" link - When I select user "Jimm" ub team members list as "Master" - And submit form with new team member info - Then I should see "Jimm" in teams members list as "Master" - - Scenario: Remove member from team - Given I have users team "HardCoders" - And gitlab user "John" is a member "HardCoders" team - And gitlab user "Jimm" is a member "HardCoders" team - And "HardCoders" team is assigned to "Shop" project - When I visit admin teams page - When I visit "HardCoders" team admin page - Then I shoould see "John" in members list - And I should see "Jimm" in members list - And I should see "Shop" in projects list - When I click on remove "Jimm" user link - Then I should be redirected to "HardCoders" team admin page - And I should not to see "Jimm" user in members list - - Scenario: Remove project from team - Given I have users team "HardCoders" - And gitlab user "John" is a member "HardCoders" team - And gitlab user "Jimm" is a member "HardCoders" team - And "HardCoders" team is assigned to "Shop" project - When I visit admin teams page - When I visit "HardCoders" team admin page - Then I should see "Shop" project in projects list - When I click on "Relegate" link on "Shop" project - Then I should see projects liston team page without "Shop" project diff --git a/features/dashboard/projects.feature b/features/dashboard/projects.feature index 7e617bd1bfc..7d8c129face 100644 --- a/features/dashboard/projects.feature +++ b/features/dashboard/projects.feature @@ -6,7 +6,3 @@ Feature: Dashboard projects Scenario: I should see projects list Then I should see projects list - - Scenario: I should see project I am looking for - Given I search for "Sho" - Then I should see "Shop" project link diff --git a/features/profile/notifications.feature b/features/profile/notifications.feature new file mode 100644 index 00000000000..e7937953c1b --- /dev/null +++ b/features/profile/notifications.feature @@ -0,0 +1,8 @@ +Feature: Profile Notifications + Background: + Given I sign in as a user + And I own project "Shop" + + Scenario: I visit notifications tab + When I visit profile notifications page + Then I should see global notifications settings diff --git a/features/profile/profile.feature b/features/profile/profile.feature index 95b85a9f911..53a93b0f908 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -16,6 +16,13 @@ Feature: Profile Then I change my password And I should be redirected to sign in page + Scenario: My password is expired + Given my password is expired + And I visit profile account page + Then I redirected to expired password page + And I submit new password + And I redirected to sign in page + Scenario: I unsuccessfully change my password Given I visit profile account page When I unsuccessfully change my password @@ -31,6 +38,11 @@ Feature: Profile When I visit profile history page Then I should see my activity + Scenario: I visit my user page + When I visit profile page + And I click on my profile picture + Then I should see my user page + @javascript Scenario: I change my application theme Given I visit profile design page diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index f33e4b9e369..48c217fbea7 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -52,48 +52,34 @@ Feature: Project active tab Then the active main tab should be Home And no other main tabs should be active - #Scenario: On Project Settings/Attachments - #Given I visit my project's home page - #And I click the "Attachments" tab - #Then the active sub tab should be Attachments - #And no other sub tabs should be active - #And the active main tab should be Home - - #Scenario: On Project Settings/Snippets - #Given I visit my project's home page - #And I click the "Snippets" tab - #Then the active sub tab should be Snippets - #And no other sub tabs should be active - #And the active main tab should be Home - # Sub Tabs: Settings Scenario: On Project Settings/Team Given I visit my project's settings page And I click the "Team" tab - Then the active sub tab should be Team - And no other sub tabs should be active + Then the active sub nav should be Team + And no other sub navs should be active And the active main tab should be Settings Scenario: On Project Settings/Edit Given I visit my project's settings page And I click the "Edit" tab - Then the active sub tab should be Edit - And no other sub tabs should be active + Then the active sub nav should be Edit + And no other sub navs should be active And the active main tab should be Settings Scenario: On Project Settings/Hooks Given I visit my project's settings page And I click the "Hooks" tab - Then the active sub tab should be Hooks - And no other sub tabs should be active + Then the active sub nav should be Hooks + And no other sub navs should be active And the active main tab should be Settings Scenario: On Project Settings/Deploy Keys Given I visit my project's settings page And I click the "Deploy Keys" tab - Then the active sub tab should be Deploy Keys - And no other sub tabs should be active + Then the active sub nav should be Deploy Keys + And no other sub navs should be active And the active main tab should be Settings # Sub Tabs: Commits diff --git a/features/project/team_management.feature b/features/project/team_management.feature index fc353424e36..e153978e043 100644 --- a/features/project/team_management.feature +++ b/features/project/team_management.feature @@ -31,6 +31,7 @@ Feature: Project Team management Scenario: Import team from another project Given I own project "Website" And "Mike" is "Website" reporter + When I visit project "Shop" team page And I click link "Import team from another project" - When I submit "Website" project for import team + And I submit "Website" project for import team Then I should see "Mike" in team list as "Reporter" diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb index d780d9c96d9..b4591f227e3 100644 --- a/features/steps/admin/admin_groups.rb +++ b/features/steps/admin/admin_groups.rb @@ -43,13 +43,22 @@ class AdminGroups < Spinach::FeatureSteps user = User.find_by_name("John") select2(user.id, from: "#user_ids", multiple: true) within "#new_team_member" do - select "Reporter", from: "project_access" + select "Reporter", from: "group_access" end - click_button "Add user to projects in group" + click_button "Add users into group" end Then 'I should see "John" in team list in every project as "Reporter"' do - user = User.find_by_name("John") + within ".group-users-list" do + page.should have_content "John" + page.should have_content "Reporter" + end + end + + step 'I should be all groups' do + Group.all.each do |group| + page.should have_content group.name + end end protected diff --git a/features/steps/admin/admin_teams.rb b/features/steps/admin/admin_teams.rb deleted file mode 100644 index 066fc3fa603..00000000000 --- a/features/steps/admin/admin_teams.rb +++ /dev/null @@ -1,236 +0,0 @@ -class AdminTeams < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedActiveTab - include SharedAdmin - - And 'I have own project' do - create :project - end - - And 'Create gitlab user "John"' do - @user = create(:user, name: "John") - end - - And 'I click new team link' do - click_link "New Team" - end - - And 'submit form with new team info' do - fill_in 'user_team_name', with: 'gitlab' - fill_in 'user_team_description', with: 'description' - click_button 'Create team' - end - - Then 'I should be redirected to team page' do - current_path.should == admin_team_path(UserTeam.last) - end - - And 'I should see newly created team' do - page.should have_content "Team: gitlab" - page.should have_content "description" - end - - When 'I visit admin teams page' do - visit admin_teams_path - end - - When 'I have clean "HardCoders" team' do - @team = create :user_team, name: "HardCoders", owner: current_user - end - - And 'I visit "HardCoders" team page' do - visit admin_team_path(UserTeam.find_by_name("HardCoders")) - end - - Then 'I should see only me in members table' do - members_list = find("#members_list .member") - members_list.should have_content(current_user.name) - members_list.should have_content(current_user.username) - end - - When 'I select user "John" from user list as "Developer"' do - @user ||= User.find_by_name("John") - within "#team_members" do - select "#{@user.name} (#{@user.username})", from: "user_ids" - select "Developer", from: "default_project_access" - end - end - - And 'submit form with new team member info' do - click_button 'add_members_to_team' - end - - Then 'I should see "John" in teams members list as "Developer"' do - @user ||= User.find_by_name("John") - find_in_list("#members_list .member", @user).must_equal true - end - - When 'I visit "John" user admin page' do - pending 'step not implemented' - end - - Then 'I should see "HardCoders" team in teams table' do - pending 'step not implemented' - end - - When 'I have "HardCoders" team with "John" member with "Developer" role' do - @team = create :user_team, name: "HardCoders", owner: current_user - @user ||= User.find_by_name("John") - @team.add_member(@user, UserTeam.access_roles["Developer"], group_admin: false) - end - - When 'I have "Shop" project' do - @project = create :project, name: "Shop" - end - - Then 'I should see empty projects table' do - page.should have_content "Projects (0)" - end - - When 'I select project "Shop" with max access "Reporter"' do - @project ||= Project.find_by_name("Shop") - within "#assign_projects" do - select @project.name, from: "project_ids" - select "Reporter", from: "greatest_project_access" - end - - end - - And 'submit form with new team project info' do - click_button 'assign_projects_to_team' - end - - Then 'I should see "Shop" project in projects list' do - project = Project.find_by_name("Shop") - find_in_list("#projects_list .project", project).must_equal true - end - - When 'I visit "Shop" project admin page' do - project = Project.find_by_name("Shop") - visit admin_project_path(project) - end - - And '"HardCoders" team assigned to "Shop" project with "Developer" max role access' do - @team = UserTeam.find_by_name("HardCoders") - @project = create :project, name: "Shop" - @team.assign_to_project(@project, UserTeam.access_roles["Developer"]) - end - - When 'I have gitlab user "Jimm"' do - create :user, name: "Jimm" - end - - Then 'I should see members table without "Jimm" member' do - user = User.find_by_name("Jimm") - find_in_list("#members_list .member", user).must_equal false - end - - When 'I select user "Jimm" ub team members list as "Master"' do - user = User.find_by_name("Jimm") - within "#team_members" do - select "#{user.name} (#{user.username})", from: "user_ids" - select "Developer", from: "default_project_access" - end - end - - Then 'I should see "Jimm" in teams members list as "Master"' do - user = User.find_by_name("Jimm") - find_in_list("#members_list .member", user).must_equal true - end - - Given 'I have users team "HardCoders"' do - @team = create :user_team, name: "HardCoders" - end - - And 'gitlab user "John" is a member "HardCoders" team' do - @team = UserTeam.find_by_name("HardCoders") - @user = User.find_by_name("John") - @user = create :user, name: "John" unless @user - @team.add_member(@user, UserTeam.access_roles["Master"], group_admin: false) - end - - And 'gitlab user "Jimm" is a member "HardCoders" team' do - @team = UserTeam.find_by_name("HardCoders") - @user = User.find_by_name("Jimm") - @user = create :user, name: "Jimm" unless @user - @team.add_member(@user, UserTeam.access_roles["Master"], group_admin: false) - end - - And '"HardCoders" team is assigned to "Shop" project' do - @team = UserTeam.find_by_name("HardCoders") - @project = create :project, name: "Shop" - @team.assign_to_project(@project, UserTeam.access_roles["Developer"]) - end - - When 'I visit "HardCoders" team admin page' do - visit admin_team_path(UserTeam.find_by_name("HardCoders")) - end - - Then 'I shoould see "John" in members list' do - user = User.find_by_name("John") - find_in_list("#members_list .member", user).must_equal true - end - - And 'I should see "Jimm" in members list' do - user = User.find_by_name("Jimm") - find_in_list("#members_list .member", user).must_equal true - end - - And 'I should see "Shop" in projects list' do - project = Project.find_by_name("Shop") - find_in_list("#projects_list .project", project).must_equal true - end - - When 'I click on remove "Jimm" user link' do - user = User.find_by_name("Jimm") - click_link "remove_member_#{user.id}" - end - - Then 'I should be redirected to "HardCoders" team admin page' do - current_path.should == admin_team_path(UserTeam.find_by_name("HardCoders")) - end - - And 'I should not to see "Jimm" user in members list' do - user = User.find_by_name("Jimm") - find_in_list("#members_list .member", user).must_equal false - end - - When 'I click on "Relegate" link on "Shop" project' do - project = Project.find_by_name("Shop") - click_link "relegate_project_#{project.id}" - end - - Then 'I should see projects liston team page without "Shop" project' do - project = Project.find_by_name("Shop") - find_in_list("#projects_list .project", project).must_equal false - end - - Then 'I should see "John" user with role "Reporter" in team table' do - user = User.find_by_name("John") - find_in_list(".team_members", user).must_equal true - end - - When 'I click to "Add members" link' do - click_link "Add members" - end - - When 'I click to "Add projects" link' do - click_link "Add projects" - end - - protected - - def current_team - @team ||= Team.first - end - - def find_in_list(selector, item) - members_list = all(selector) - entered = false - members_list.each do |member_item| - entered = true if member_item.has_content?(item.name) - end - entered - end -end diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index c6832056435..329571ac6ef 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -29,7 +29,7 @@ class Dashboard < Spinach::FeatureSteps Given 'user with name "John Doe" joined project "Shop"' do user = create(:user, {name: "John Doe"}) - project = Project.find_by_name "Shop" + project.team << [user, :master] Event.create( project: project, author_id: user.id, @@ -38,12 +38,11 @@ class Dashboard < Spinach::FeatureSteps end Then 'I should see "John Doe joined project at Shop" event' do - page.should have_content "John Doe joined project at Shop" + page.should have_content "John Doe joined project at #{project.name_with_namespace}" end And 'user with name "John Doe" left project "Shop"' do user = User.find_by_name "John Doe" - project = Project.find_by_name "Shop" Event.create( project: project, author_id: user.id, @@ -52,7 +51,7 @@ class Dashboard < Spinach::FeatureSteps end Then 'I should see "John Doe left project at Shop" event' do - page.should have_content "John Doe left project at Shop" + page.should have_content "John Doe left project at #{project.name_with_namespace}" end And 'I have group with projects' do @@ -83,4 +82,8 @@ class Dashboard < Spinach::FeatureSteps Then 'I should see 1 project at group list' do page.find('span.last_activity/span').should have_content('1') end + + def project + @project ||= Project.find_by_name "Shop" + end end diff --git a/features/steps/dashboard/dashboard_projects.rb b/features/steps/dashboard/dashboard_projects.rb index 670e25a97a4..85251565446 100644 --- a/features/steps/dashboard/dashboard_projects.rb +++ b/features/steps/dashboard/dashboard_projects.rb @@ -8,16 +8,4 @@ class DashboardProjects < Spinach::FeatureSteps page.should have_link project.name_with_namespace end end - - Given 'I search for "Sho"' do - fill_in "dashboard_projects_search", with: "Sho" - - within ".dashboard-search-filter" do - find('button').click - end - end - - Then 'I should see "Shop" project link' do - page.should have_link "Shop" - end end diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index 102bc440d82..a6b9aa606c6 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -39,11 +39,11 @@ class Groups < Spinach::FeatureSteps And 'I select user "John" from list with role "Reporter"' do user = User.find_by_name("John") - within "#new_team_member" do + within ".new_users_group" do select2(user.id, from: "#user_ids", multiple: true) - select "Reporter", from: "project_access" + select "Reporter", from: "group_access" end - click_button "Add" + click_button "Add users into group" end Then 'I should see user "John" in team list' do diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index c1fe00c8e65..5ff4e8af1cd 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -2,13 +2,13 @@ class Profile < Spinach::FeatureSteps include SharedAuthentication include SharedPaths - Then 'I should see my profile info' do + step 'I should see my profile info' do page.should have_content "Profile" page.should have_content @user.name page.should have_content @user.email end - Then 'I change my contact info' do + step 'I change my contact info' do fill_in "user_skype", with: "testskype" fill_in "user_linkedin", with: "testlinkedin" fill_in "user_twitter", with: "testtwitter" @@ -16,13 +16,13 @@ class Profile < Spinach::FeatureSteps @user.reload end - And 'I should see new contact info' do + step 'I should see new contact info' do @user.skype.should == 'testskype' @user.linkedin.should == 'testlinkedin' @user.twitter.should == 'testtwitter' end - Then 'I change my password' do + step 'I change my password' do within '.update-password' do fill_in "user_password", with: "222333" fill_in "user_password_confirmation", with: "222333" @@ -30,7 +30,7 @@ class Profile < Spinach::FeatureSteps end end - When 'I unsuccessfully change my password' do + step 'I unsuccessfully change my password' do within '.update-password' do fill_in "user_password", with: "password" fill_in "user_password_confirmation", with: "confirmation" @@ -38,52 +38,82 @@ class Profile < Spinach::FeatureSteps end end - Then "I should see a password error message" do + step "I should see a password error message" do page.should have_content "Password doesn't match confirmation" end - And 'I should be redirected to sign in page' do + step 'I should be redirected to sign in page' do current_path.should == new_user_session_path end - Then 'I reset my token' do + step 'I reset my token' do within '.update-token' do @old_token = @user.private_token click_button "Reset" end end - And 'I should see new token' do + step 'I should see new token' do find("#token").value.should_not == @old_token find("#token").value.should == @user.reload.private_token end - Given 'I have activity' do + step 'I have activity' do create(:closed_issue_event, author: current_user) end - Then 'I should see my activity' do + step 'I should see my activity' do page.should have_content "#{current_user.name} closed issue" end - When "I change my application theme" do + step "I change my application theme" do within '.application-theme' do choose "Violet" end end - When "I change my code preview theme" do + step "I change my code preview theme" do within '.code-preview-theme' do choose "Solarized dark" end end - Then "I should see the theme change immediately" do + step "I should see the theme change immediately" do page.should have_selector('body.ui_color') page.should_not have_selector('body.ui_basic') end - Then "I should receive feedback that the changes were saved" do + step "I should receive feedback that the changes were saved" do page.should have_content("Saved") end + + step 'my password is expired' do + current_user.update_attributes(password_expires_at: Time.now - 1.hour) + end + + step 'I redirected to expired password page' do + current_path.should == new_profile_password_path + end + + step 'I submit new password' do + fill_in :user_password, with: '12345678' + fill_in :user_password_confirmation, with: '12345678' + click_button "Set new password" + end + + step 'I redirected to sign in page' do + current_path.should == new_user_session_path + end + + step 'I click on my profile picture' do + click_link 'profile-pic' + end + + step 'I should see my user page' do + page.should have_content "User Activity" + + within '.navbar-gitlab' do + page.should have_content current_user.name + end + end end diff --git a/features/steps/profile/profile_notifications.rb b/features/steps/profile/profile_notifications.rb new file mode 100644 index 00000000000..54b02605689 --- /dev/null +++ b/features/steps/profile/profile_notifications.rb @@ -0,0 +1,13 @@ +class ProfileNotifications < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + + step 'I visit profile notifications page' do + visit profile_notifications_path + end + + step 'I should see global notifications settings' do + page.should have_content "Setup your notification level" + page.should have_content "Global setting" + end +end diff --git a/features/steps/profile/profile_ssh_keys.rb b/features/steps/profile/profile_ssh_keys.rb index a280ce6f89c..65bfc505d85 100644 --- a/features/steps/profile/profile_ssh_keys.rb +++ b/features/steps/profile/profile_ssh_keys.rb @@ -8,20 +8,20 @@ class ProfileSshKeys < Spinach::FeatureSteps end Given 'I click link "Add new"' do - click_link "Add new" + click_link "Add SSH Key" end And 'I submit new ssh key "Laptop"' do fill_in "key_title", with: "Laptop" fill_in "key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop" - click_button "Save" + click_button "Add key" end Then 'I should see new ssh key "Laptop"' do key = Key.find_by_title("Laptop") page.should have_content(key.title) page.should have_content(key.key) - current_path.should == key_path(key) + current_path.should == profile_key_path(key) end Given 'I click link "Work"' do @@ -33,7 +33,7 @@ class ProfileSshKeys < Spinach::FeatureSteps end Then 'I visit profile keys page' do - visit keys_path + visit profile_keys_path end And 'I should not see "Work" ssh key' do diff --git a/features/steps/project/project_active_tab.rb b/features/steps/project/project_active_tab.rb index 5170ab82e8a..e04a17168be 100644 --- a/features/steps/project/project_active_tab.rb +++ b/features/steps/project/project_active_tab.rb @@ -45,7 +45,7 @@ class ProjectActiveTab < Spinach::FeatureSteps # Sub Tabs: Home Given 'I click the "Team" tab' do - click_link('Project Members') + click_link('Members') end Given 'I click the "Attachments" tab' do @@ -68,32 +68,20 @@ class ProjectActiveTab < Spinach::FeatureSteps click_link('Deploy Keys') end - Then 'the active sub tab should be Show' do - ensure_active_sub_tab('Show') + Then 'the active sub nav should be Team' do + ensure_active_sub_nav('Members') end - Then 'the active sub tab should be Team' do - ensure_active_sub_tab('Project Members') + Then 'the active sub nav should be Edit' do + ensure_active_sub_nav('Edit Project') end - Then 'the active sub tab should be Attachments' do - ensure_active_sub_tab('Attachments') + Then 'the active sub nav should be Hooks' do + ensure_active_sub_nav('Web Hooks') end - Then 'the active sub tab should be Snippets' do - ensure_active_sub_tab('Snippets') - end - - Then 'the active sub tab should be Edit' do - ensure_active_sub_tab('Edit') - end - - Then 'the active sub tab should be Hooks' do - ensure_active_sub_tab('Web Hooks') - end - - Then 'the active sub tab should be Deploy Keys' do - ensure_active_sub_tab('Deploy Keys') + Then 'the active sub nav should be Deploy Keys' do + ensure_active_sub_nav('Deploy Keys') end # Sub Tabs: Commits diff --git a/features/steps/project/project_fork.rb b/features/steps/project/project_fork.rb index f3335deb279..775af0c5c58 100644 --- a/features/steps/project/project_fork.rb +++ b/features/steps/project/project_fork.rb @@ -10,7 +10,7 @@ class ForkProject < Spinach::FeatureSteps step 'I am a member of project "Shop"' do @project = Project.find_by_name "Shop" - @project ||= create(:project_with_code, name: "Shop") + @project ||= create(:project_with_code, name: "Shop", group: create(:group)) @project.team << [@user, :reporter] end @@ -27,4 +27,4 @@ class ForkProject < Spinach::FeatureSteps page.should have_content "Name has already been taken" end -end
\ No newline at end of file +end diff --git a/features/steps/project/project_team_management.rb b/features/steps/project/project_team_management.rb index ffd2aa24676..93ba1086f6e 100644 --- a/features/steps/project/project_team_management.rb +++ b/features/steps/project/project_team_management.rb @@ -30,26 +30,26 @@ class ProjectTeamManagement < Spinach::FeatureSteps end Then 'I should see "Mike" in team list as "Reporter"' do - within '.reporters' do + within ".access-reporter" do page.should have_content('Mike') end end Given 'I should see "Sam" in team list as "Developer"' do - within '.developers' do + within ".access-developer" do page.should have_content('Sam') end end And 'I change "Sam" role to "Reporter"' do user = User.find_by_name("Sam") - within ".user_#{user.id}" do + within "#user_#{user.id}" do select "Reporter", from: "team_member_project_access" end end And 'I should see "Sam" in team list as "Reporter"' do - within '.reporters' do + within ".access-reporter" do page.should have_content('Sam') end end @@ -79,7 +79,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps end Given 'I own project "Website"' do - @project = create(:project, name: "Website") + @project = create(:project, name: "Website", namespace: @user.namespace) @project.team << [@user, :master] end @@ -94,7 +94,8 @@ class ProjectTeamManagement < Spinach::FeatureSteps end When 'I submit "Website" project for import team' do - select 'Website', from: 'source_project_id' + project = Project.find_by_name("Website") + select project.name_with_namespace, from: 'source_project_id' click_button 'Import' end diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb index 617a077b914..d504fda3327 100644 --- a/features/steps/shared/active_tab.rb +++ b/features/steps/shared/active_tab.rb @@ -13,6 +13,10 @@ module SharedActiveTab page.find('div.content ul.nav-tabs li.active').should have_content(content) end + def ensure_active_sub_nav(content) + page.find('div.content ul.nav-stacked-menu li.active').should have_content(content) + end + And 'no other main tabs should be active' do page.should have_selector('.main-nav li.active', count: 1) end @@ -20,4 +24,8 @@ module SharedActiveTab And 'no other sub tabs should be active' do page.should have_selector('div.content ul.nav-tabs li.active', count: 1) end + + And 'no other sub navs should be active' do + page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1) + end end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 21b6159bce3..b2c23cf11c9 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -70,7 +70,7 @@ module SharedPaths end step 'I visit profile SSH keys page' do - visit keys_path + visit profile_keys_path end step 'I visit profile design page' do diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index b16032a8300..66553e1e089 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -3,14 +3,14 @@ module SharedProject # Create a project without caring about what it's called And "I own a project" do - @project = create(:project_with_code) + @project = create(:project_with_code, namespace: @user.namespace) @project.team << [@user, :master] end # Create a specific project called "Shop" And 'I own project "Shop"' do @project = Project.find_by_name "Shop" - @project ||= create(:project_with_code, name: "Shop") + @project ||= create(:project_with_code, name: "Shop", namespace: @user.namespace) @project.team << [@user, :master] end @@ -42,7 +42,7 @@ module SharedProject Then 'I should see project "Shop" activity feed' do project = Project.find_by_name("Shop") - page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}" + page.should have_content "#{@user.name} pushed new branch new_design at #{project.name_with_namespace}" end Then 'I should see project settings' do diff --git a/features/steps/userteams/userteams.rb b/features/steps/userteams/userteams.rb deleted file mode 100644 index b4b2fb66a50..00000000000 --- a/features/steps/userteams/userteams.rb +++ /dev/null @@ -1,241 +0,0 @@ -class Userteams < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - include Select2Helper - - When 'I do not have teams with me' do - UserTeam.with_member(current_user).destroy_all - end - - Then 'I should see dashboard page without teams info block' do - page.has_no_css?(".teams-box").must_equal true - end - - When 'I have teams with my membership' do - team = create :user_team, owner: current_user - team.add_member(current_user, UserTeam.access_roles["Master"], true) - end - - Then 'I should see dashboard page with teams information block' do - page.should have_css(".teams-box") - end - - When 'exist user teams' do - team = create :user_team - team.add_member(current_user, UserTeam.access_roles["Master"], true) - end - - And 'I click on "All teams" link' do - click_link("All Teams") - end - - Then 'I should see "All teams" page' do - current_path.should == teams_path - end - - And 'I should see exist teams in teams list' do - team = UserTeam.last - find_in_list(".teams_list tr", team).must_equal true - end - - When 'I click to "New team" link' do - click_link("New Team") - end - - And 'I submit form with new team info' do - fill_in 'name', with: 'gitlab' - - fill_in 'user_team_description', with: 'team description' - click_button 'Create team' - end - - And 'I should see newly created team' do - page.should have_content "gitlab" - page.should have_content "team description" - end - - Then 'I should be redirected to new team page' do - team = UserTeam.last - current_path.should == team_path(team) - end - - When 'I have teams with projects and members' do - team = create :user_team, owner: current_user - @project = create :project - team.add_member(current_user, UserTeam.access_roles["Master"], true) - team.assign_to_project(@project, UserTeam.access_roles["Master"]) - @event = create(:closed_issue_event, project: @project) - end - - When 'I visit team page' do - visit team_path(UserTeam.last) - end - - Then 'I should see projects list' do - within(".side .ui-box") do - page.should have_content(@project.name) - end - end - - And 'project from team has issues assigned to me' do - team = UserTeam.last - team.projects.each do |project| - project.issues << create(:issue, assignee: current_user) - end - end - - When 'I visit team issues page' do - team = UserTeam.last - visit issues_team_path(team) - end - - Then 'I should see issues from this team assigned to me' do - team = UserTeam.last - team.projects.each do |project| - project.issues.assigned_to(current_user).each do |issue| - page.should have_content issue.title - end - end - end - - Given 'I have team with projects and members' do - team = create :user_team, owner: current_user - project = create :project - user = create :user - team.add_member(current_user, UserTeam.access_roles["Master"], true) - team.add_member(user, UserTeam.access_roles["Developer"], false) - team.assign_to_project(project, UserTeam.access_roles["Master"]) - end - - Given 'project from team has issues assigned to teams members' do - team = UserTeam.last - team.projects.each do |project| - team.members.each do |member| - project.issues << create(:issue, assignee: member) - end - end - end - - Then 'I should see issues from this team assigned to teams members' do - team = UserTeam.last - team.projects.each do |project| - team.members.each do |member| - project.issues.assigned_to(member).each do |issue| - page.should have_content issue.title - end - end - end - end - - Given 'project from team has merge requests assigned to me' do - team = UserTeam.last - team.projects.each do |project| - create(:merge_request, assignee: current_user, project: project) - end - end - - When 'I visit team merge requests page' do - team = UserTeam.last - visit merge_requests_team_path(team) - end - - Then 'I should see merge requests from this team assigned to me' do - team = UserTeam.last - team.projects.each do |project| - project.merge_requests.each do |merge_request| - page.should have_content merge_request.title - end - end - end - - Given 'project from team has merge requests assigned to team members' do - team = UserTeam.last - team.projects.each do |project| - member = team.members.sample - create(:merge_request, assignee: member, project: project) - end - end - - Given 'I have new user "John"' do - create :user, name: "John" - end - - When 'I visit team people page' do - team = UserTeam.last - visit team_members_path(team) - end - - And 'I select user "John" from list with role "Reporter"' do - user = User.find_by_name("John") - select2(user.id, from: "#user_ids", multiple: true) - within "#team_members" do - select "Reporter", from: "default_project_access" - end - click_button "Add" - end - - Then 'I should see user "John" in team list' do - user = User.find_by_name("John") - team_members_list = find(".team-table") - team_members_list.should have_content user.name - end - - And 'I have my own project without teams' do - @project = create :project, namespace: current_user.namespace - end - - And 'I visit my team page' do - team = UserTeam.where(owner_id: current_user.id).last - visit team_path(team) - end - - When 'I click on link "Assign Project"' do - click_link "Assign Project" - end - - Then 'I should see form with my own project in available projects list' do - projects_select = find("#project_ids") - projects_select.should have_content(@project.name) - end - - When 'I submit form with selected project and max access' do - within "#assign_projects" do - select @project.name_with_namespace, from: "project_ids" - select "Reporter", from: "greatest_project_access" - end - click_button "Add" - end - - Then 'I should see my own project in team projects list' do - projects = find(".projects-table") - projects.should have_content(@project.name) - end - - When 'I click link "New Team Member"' do - click_link "New Team Member" - end - - protected - - def current_team - @user_team ||= UserTeam.first - end - - def project - current_team.projects.first - end - - def assigned_to_user key, user - project.send(key).where(assignee_id: user) - end - - def find_in_list(selector, item) - members_list = all(selector) - entered = false - members_list.each do |member_item| - entered = true if member_item.has_content?(item.name) - end - entered - end -end diff --git a/features/teams/team.feature b/features/teams/team.feature deleted file mode 100644 index ac34ed76f04..00000000000 --- a/features/teams/team.feature +++ /dev/null @@ -1,65 +0,0 @@ -Feature: UserTeams - Background: - Given I sign in as a user - And I own project "Shop" - And project "Shop" has push event - - Scenario: I should see teams info block - When I have teams with my membership - And I visit dashboard page - Then I should see dashboard page with teams information block - - Scenario: I should can create new team - When I have teams with my membership - And I visit dashboard page - When I click to "New team" link - And I submit form with new team info - Then I should be redirected to new team page - Then I should see newly created team - - Scenario: I should see team dashboard list - When I have teams with projects and members - When I visit team page - Then I should see projects list - - Scenario: I should see team issues list - Given I have team with projects and members - And project from team has issues assigned to me - When I visit team issues page - Then I should see issues from this team assigned to me - - Scenario: I should see teams members issues list - Given I have team with projects and members - Given project from team has issues assigned to teams members - When I visit team issues page - Then I should see issues from this team assigned to teams members - - Scenario: I should see team merge requests list - Given I have team with projects and members - Given project from team has merge requests assigned to me - When I visit team merge requests page - Then I should see merge requests from this team assigned to me - - Scenario: I should see teams members merge requests list - Given I have team with projects and members - Given project from team has merge requests assigned to team members - When I visit team merge requests page - Then I should see merge requests from this team assigned to me - - @javascript - Scenario: I should add user to projects in Team - Given I have team with projects and members - Given I have new user "John" - When I visit team people page - When I click link "New Team Member" - And I select user "John" from list with role "Reporter" - Then I should see user "John" in team list - - Scenario: I should assign my team to my own project - Given I have team with projects and members - And I have my own project without teams - And I visit my team page - When I click on link "Assign Project" - Then I should see form with my own project in available projects list - When I submit form with selected project and max access - Then I should see my own project in team projects list diff --git a/lib/api/api.rb b/lib/api/api.rb index 5d97d50cb82..c4c9f166db1 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -35,7 +35,6 @@ module API mount Notes mount Internal mount SystemHooks - mount UserTeams mount ProjectSnippets mount DeployKeys mount ProjectHooks diff --git a/lib/api/entities.rb b/lib/api/entities.rb index edc6302f021..f31050b008d 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -106,10 +106,6 @@ module API expose :id, :title, :key, :created_at end - class UserTeam < Grape::Entity - expose :id, :name, :path, :owner_id - end - class MergeRequest < Grape::Entity expose :id, :target_branch, :source_branch, :project_id, :title, :state expose :author, :assignee, using: Entities::UserBasic diff --git a/lib/api/user_teams.rb b/lib/api/user_teams.rb deleted file mode 100644 index 05aa72f0e92..00000000000 --- a/lib/api/user_teams.rb +++ /dev/null @@ -1,276 +0,0 @@ -module API - # user_teams API - class UserTeams < Grape::API - before { authenticate! } - - resource :user_teams do - helpers do - def handle_team_member_errors(errors) - if errors[:permission].any? - render_api_error!(errors[:permission], 422) - end - not_found! - end - - def validate_access_level?(level) - [UsersProject::GUEST, UsersProject::REPORTER, UsersProject::DEVELOPER, UsersProject::MASTER].include? level.to_i - end - end - - - # Get a user_teams list - # - # Example Request: - # GET /user_teams - get do - if current_user.admin - @user_teams = paginate UserTeam - else - @user_teams = paginate current_user.user_teams - end - present @user_teams, with: Entities::UserTeam - end - - - # Create user_team. Available only for admin - # - # Parameters: - # name (required) - The name of the user_team - # path (required) - The path of the user_team - # Example Request: - # POST /user_teams - post do - authenticated_as_admin! - required_attributes! [:name, :path] - - attrs = attributes_for_keys [:name, :path] - @user_team = UserTeam.new(attrs) - @user_team.owner = current_user - - if @user_team.save - present @user_team, with: Entities::UserTeam - else - not_found! - end - end - - - # Get a single user_team - # - # Parameters: - # id (required) - The ID of a user_team - # Example Request: - # GET /user_teams/:id - get ":id" do - @user_team = UserTeam.find(params[:id]) - if current_user.admin or current_user.user_teams.include? @user_team - present @user_team, with: Entities::UserTeam - else - not_found! - end - end - - - # Get user_team members - # - # Parameters: - # id (required) - The ID of a user_team - # Example Request: - # GET /user_teams/:id/members - get ":id/members" do - @user_team = UserTeam.find(params[:id]) - if current_user.admin or current_user.user_teams.include? @user_team - @members = paginate @user_team.members - present @members, with: Entities::TeamMember, user_team: @user_team - else - not_found! - end - end - - - # Add a new user_team member - # - # Parameters: - # id (required) - The ID of a user_team - # user_id (required) - The ID of a user - # access_level (required) - Project access level - # Example Request: - # POST /user_teams/:id/members - post ":id/members" do - authenticated_as_admin! - required_attributes! [:user_id, :access_level] - - if not validate_access_level?(params[:access_level]) - render_api_error!("Wrong access level", 422) - end - - @user_team = UserTeam.find(params[:id]) - if @user_team - team_member = @user_team.user_team_user_relationships.find_by_user_id(params[:user_id]) - # Not existing member - if team_member.nil? - @user_team.add_member(params[:user_id], params[:access_level], false) - team_member = @user_team.user_team_user_relationships.find_by_user_id(params[:user_id]) - - if team_member.nil? - render_api_error!("Error creating membership", 500) - else - @member = team_member.user - present @member, with: Entities::TeamMember, user_team: @user_team - end - else - render_api_error!("Already exists", 409) - end - else - not_found! - end - end - - - # Get a single team member from user_team - # - # Parameters: - # id (required) - The ID of a user_team - # user_id (required) - The ID of a team member - # Example Request: - # GET /user_teams/:id/members/:user_id - get ":id/members/:user_id" do - @user_team = UserTeam.find(params[:id]) - if current_user.admin or current_user.user_teams.include? @user_team - team_member = @user_team.user_team_user_relationships.find_by_user_id(params[:user_id]) - unless team_member.nil? - present team_member.user, with: Entities::TeamMember, user_team: @user_team - else - not_found! - end - else - not_found! - end - end - - # Remove a team member from user_team - # - # Parameters: - # id (required) - The ID of a user_team - # user_id (required) - The ID of a team member - # Example Request: - # DELETE /user_teams/:id/members/:user_id - delete ":id/members/:user_id" do - authenticated_as_admin! - - @user_team = UserTeam.find(params[:id]) - if @user_team - team_member = @user_team.user_team_user_relationships.find_by_user_id(params[:user_id]) - unless team_member.nil? - team_member.destroy - else - not_found! - end - else - not_found! - end - end - - - # Get to user_team assigned projects - # - # Parameters: - # id (required) - The ID of a user_team - # Example Request: - # GET /user_teams/:id/projects - get ":id/projects" do - @user_team = UserTeam.find(params[:id]) - if current_user.admin or current_user.user_teams.include? @user_team - @projects = paginate @user_team.projects - present @projects, with: Entities::TeamProject, user_team: @user_team - else - not_found! - end - end - - - # Add a new user_team project - # - # Parameters: - # id (required) - The ID of a user_team - # project_id (required) - The ID of a project - # greatest_access_level (required) - Project access level - # Example Request: - # POST /user_teams/:id/projects - post ":id/projects" do - authenticated_as_admin! - required_attributes! [:project_id, :greatest_access_level] - - if not validate_access_level?(params[:greatest_access_level]) - render_api_error!("Wrong greatest_access_level", 422) - end - - @user_team = UserTeam.find(params[:id]) - if @user_team - team_project = @user_team.user_team_project_relationships.find_by_project_id(params[:project_id]) - - # No existing project - if team_project.nil? - @user_team.assign_to_projects([params[:project_id]], params[:greatest_access_level]) - team_project = @user_team.user_team_project_relationships.find_by_project_id(params[:project_id]) - if team_project.nil? - render_api_error!("Error creating project assignment", 500) - else - @project = team_project.project - present @project, with: Entities::TeamProject, user_team: @user_team - end - else - render_api_error!("Already exists", 409) - end - else - not_found! - end - end - - # Show a single team project from user_team - # - # Parameters: - # id (required) - The ID of a user_team - # project_id (required) - The ID of a project assigned to the team - # Example Request: - # GET /user_teams/:id/projects/:project_id - get ":id/projects/:project_id" do - @user_team = UserTeam.find(params[:id]) - if current_user.admin or current_user.user_teams.include? @user_team - team_project = @user_team.user_team_project_relationships.find_by_project_id(params[:project_id]) - unless team_project.nil? - present team_project.project, with: Entities::TeamProject, user_team: @user_team - else - not_found! - end - else - not_found! - end - end - - # Remove a team project from user_team - # - # Parameters: - # id (required) - The ID of a user_team - # project_id (required) - The ID of a project assigned to the team - # Example Request: - # DELETE /user_teams/:id/projects/:project_id - delete ":id/projects/:project_id" do - authenticated_as_admin! - - @user_team = UserTeam.find(params[:id]) - if @user_team - team_project = @user_team.user_team_project_relationships.find_by_project_id(params[:project_id]) - unless team_project.nil? - team_project.destroy - else - not_found! - end - else - not_found! - end - end - - end - end -end diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb index 991648f3f79..8bced609e08 100644 --- a/lib/gitlab/backend/shell.rb +++ b/lib/gitlab/backend/shell.rb @@ -36,6 +36,18 @@ module Gitlab system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", "#{path}.git", "#{new_path}.git" end + # Update HEAD for repository + # + # path - project path with namespace + # branch - repository branch name + # + # Ex. + # update_repository_head("gitlab/gitlab-ci", "3-1-stable") + # + def update_repository_head(path, branch) + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", "#{path}.git", branch + end + # Fork repository to new namespace # # path - project path with namespace diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index cea026f6182..e9c4df220c9 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -166,7 +166,7 @@ module Gitlab end def reference_user(identifier) - if member = @project.users_projects.joins(:user).where(users: { username: identifier }).first + if member = @project.team_members.find { |user| user.username == identifier } link_to("@#{identifier}", user_path(identifier), html_options.merge(class: "gfm gfm-team_member #{html_options[:class]}")) if member end end diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb index 668de75f663..4c7be04246c 100644 --- a/lib/gitlab/satellite/satellite.rb +++ b/lib/gitlab/satellite/satellite.rb @@ -64,7 +64,8 @@ module Gitlab end def lock_file - Rails.root.join("tmp", "satellite_#{project.id}.lock") + create_locks_dir unless File.exists?(lock_files_dir) + File.join(lock_files_dir, "satellite_#{project.id}.lock") end def path @@ -114,6 +115,16 @@ module Gitlab def update_from_source! repo.git.fetch({timeout: true}, :origin) end + + # Create directory for stroing + # satellites lock files + def create_locks_dir + FileUtils.mkdir_p(lock_files_dir) + end + + def lock_files_dir + @lock_files_dir ||= File.join(Gitlab.config.satellites.path, "tmp") + end end end end diff --git a/lib/gitlab/theme.rb b/lib/gitlab/theme.rb index 7f833867e39..89604162304 100644 --- a/lib/gitlab/theme.rb +++ b/lib/gitlab/theme.rb @@ -1,12 +1,18 @@ module Gitlab class Theme + BASIC = 1 + MARS = 2 + MODERN = 3 + GRAY = 4 + COLOR = 5 + def self.css_class_by_id(id) themes = { - 1 => "ui_basic", - 2 => "ui_mars", - 3 => "ui_modern", - 4 => "ui_gray", - 5 => "ui_color" + BASIC => "ui_basic", + MARS => "ui_mars", + MODERN => "ui_modern", + GRAY => "ui_gray", + COLOR => "ui_color" } id ||= 1 diff --git a/lib/gitlab/user_team_manager.rb b/lib/gitlab/user_team_manager.rb deleted file mode 100644 index d5ec4ff6676..00000000000 --- a/lib/gitlab/user_team_manager.rb +++ /dev/null @@ -1,146 +0,0 @@ -# UserTeamManager class -# -# Used for manage User teams with project repositories -module Gitlab - class UserTeamManager - class << self - def assign(team, project, access) - project = Project.find(project) unless project.is_a? Project - searched_project = team.user_team_project_relationships.find_by_project_id(project.id) - - unless searched_project.present? - team.user_team_project_relationships.create(project_id: project.id, greatest_access: access) - update_team_users_access_in_project(team, project, :added) - end - end - - def resign(team, project) - project = Project.find(project) unless project.is_a? Project - - team.user_team_project_relationships.with_project(project).destroy_all - - update_team_users_access_in_project(team, project, :updated) - end - - def update_team_user_membership(team, member, options) - updates = {} - - if options[:default_projects_access].present? - default_projects_access = options[:default_projects_access].to_s - - if default_projects_access != team.default_projects_access(member).to_s - updates[:permission] = default_projects_access - end - end - - if options[:group_admin].present? - group_admin = options[:group_admin].to_s == "1" ? true : false - - if group_admin != team.admin?(member) - updates[:group_admin] = group_admin - end - end - - return true if updates.blank? - - user_team_relationship = team.user_team_user_relationships.find_by_user_id(member) - return false unless user_team_relationship.update_attributes(updates) - - rebuild_project_permissions_to_member(team, member) if updates[:permission] - - true - end - - def update_project_greates_access(team, project, permission) - project_relation = team.user_team_project_relationships.find_by_project_id(project) - if permission != team.max_project_access(project) - if project_relation.update_attributes(greatest_access: permission) - update_team_users_access_in_project(team, project, :updated) - true - else - false - end - else - true - end - end - - def rebuild_project_permissions_to_member(team, member) - team.projects.each do |project| - update_team_user_access_in_project(team, member, project, :updated) - end - end - - def update_team_users_access_in_project(team, project, action) - members = team.members - members.each do |member| - update_team_user_access_in_project(team, member, project, action) - end - end - - def update_team_user_access_in_project(team, user, project, action) - granted_access = max_teams_member_permission_in_project(user, project, action) - project_team_user = UsersProject.find_by_user_id_and_project_id(user.id, project.id) - - if granted_access.zero? - project_team_user.destroy if project_team_user.present? - return - end - - if project_team_user.present? - project_team_user.update_attributes(project_access: granted_access) - else - project.team << [user, granted_access] - end - end - - def max_teams_member_permission_in_project(user, project, action = nil, teams = nil) - result_access = 0 - - teams ||= project.user_teams.with_member(user) - - if action && (action == :added) - result_access = project.users_projects.with_user(user).first.project_access if project.users_projects.with_user(user).any? - end - - if teams.any? - teams.each do |team| - granted_access = max_team_member_permission_in_project(team, user, project) - result_access = [granted_access, result_access].max - end - end - result_access - end - - def max_team_member_permission_in_project(team, user, project) - member_access = team.default_projects_access(user) - team_access = team.user_team_project_relationships.find_by_project_id(project.id).greatest_access - - [team_access, member_access].min - end - - def add_member_into_team(team, user, access, admin) - user = User.find(user) unless user.is_a? User - - team.user_team_user_relationships.create(user_id: user.id, permission: access, group_admin: admin) - team.projects.each do |project| - update_team_user_access_in_project(team, user, project, :added) - end - end - - def remove_member_from_team(team, user) - user = User.find(user) unless user.is_a? User - - team.user_team_user_relationships.with_user(user).destroy_all - other_teams = [] - team.projects.each do |project| - other_teams << project.user_teams.with_member(user) - end - other_teams.uniq - unless other_teams.any? - UsersProject.in_projects(team.projects).with_user(user).destroy_all - end - end - end - end -end diff --git a/lib/support/init.d/gitlab_unicorn b/lib/support/init.d/gitlab_unicorn new file mode 100644 index 00000000000..219776c8684 --- /dev/null +++ b/lib/support/init.d/gitlab_unicorn @@ -0,0 +1,138 @@ +#! /bin/bash + +# GITLAB +# Maintainer: @randx +# App Version: 6.0 + +### BEGIN INIT INFO +# Provides: gitlab +# Required-Start: $local_fs $remote_fs $network $syslog redis-server +# Required-Stop: $local_fs $remote_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: GitLab git repository management +# Description: GitLab git repository management +### END INIT INFO + + +APP_ROOT="/home/git/gitlab" +APP_USER="git" +DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production" +PID_PATH="$APP_ROOT/tmp/pids" +SOCKET_PATH="$APP_ROOT/tmp/sockets" +WEB_SERVER_PID="$PID_PATH/unicorn.pid" +SIDEKIQ_PID="$PID_PATH/sidekiq.pid" +STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop" +START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start" +NAME="gitlab" +DESC="GitLab service" + +check_pid(){ + if [ -f $WEB_SERVER_PID ]; then + PID=`cat $WEB_SERVER_PID` + SPID=`cat $SIDEKIQ_PID` + STATUS=`ps aux | grep $PID | grep -v grep | wc -l` + else + STATUS=0 + PID=0 + fi +} + +execute() { + sudo -u $APP_USER -H bash -l -c "$1" +} + +start() { + cd $APP_ROOT + check_pid + if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then + # Program is running, exit with error code 1. + echo "Error! $DESC $NAME is currently running!" + exit 1 + else + if [ `whoami` = root ]; then + execute "rm -f $SOCKET_PATH/gitlab.socket" + execute "RAILS_ENV=production bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &" + execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" + echo "$DESC started" + fi + fi +} + +stop() { + cd $APP_ROOT + check_pid + if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then + ## Program is running, stop it. + kill -QUIT `cat $WEB_SERVER_PID` + execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" + rm "$WEB_SERVER_PID" >> /dev/null + echo "$DESC stopped" + else + ## Program is not running, exit with error. + echo "Error! $DESC not started!" + exit 1 + fi +} + +restart() { + cd $APP_ROOT + check_pid + if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then + echo "Restarting $DESC..." + kill -USR2 `cat $WEB_SERVER_PID` + execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" + if [ `whoami` = root ]; then + execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" + fi + echo "$DESC restarted." + else + echo "Error, $NAME not running!" + exit 1 + fi +} + +status() { + cd $APP_ROOT + check_pid + if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then + echo "$DESC / Puma with PID $PID is running." + echo "$DESC / Sidekiq with PID $SPID is running." + else + echo "$DESC is not running." + exit 1 + fi +} + +## Check to see if we are running as root first. +## Found at http://www.cyberciti.biz/tips/shell-root-user-check-script.html +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" + exit 1 +fi + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload|force-reload) + echo -n "Reloading $NAME configuration: " + kill -HUP `cat $PID` + echo "done." + ;; + status) + status + ;; + *) + echo "Usage: sudo service gitlab {start|stop|restart|reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/lib/tasks/migrate/migrate_global_projects.rake b/lib/tasks/migrate/migrate_global_projects.rake new file mode 100644 index 00000000000..2cf9c23fb80 --- /dev/null +++ b/lib/tasks/migrate/migrate_global_projects.rake @@ -0,0 +1,16 @@ +desc "GITLAB | Migrate Global Projects to Namespaces" +task migrate_global_projects: :environment do + puts "This will move all projects without namespace to owner namespace" + ask_to_continue + + Project.where(namespace_id: nil).find_each(batch_size: 20) do |project| + begin + project.transfer(project.owner.namespace) + print '.' + rescue => ex + puts ex.message + print 'F' + end + end +end + diff --git a/lib/tasks/migrate/migrate_groups.rake b/lib/tasks/migrate/migrate_groups.rake new file mode 100644 index 00000000000..153172dc90a --- /dev/null +++ b/lib/tasks/migrate/migrate_groups.rake @@ -0,0 +1,16 @@ +desc "GITLAB | Migrate Gropus to match v6.0" +task migrate_groups: :environment do + puts "This will add group owners to group membership" + ask_to_continue + + Group.find_each(batch_size: 20) do |group| + begin + group.send :add_owner + print '.' + rescue => ex + puts ex.message + print 'F' + end + end +end + diff --git a/lib/tasks/migrate/migrate_keys.rake b/lib/tasks/migrate/migrate_keys.rake new file mode 100644 index 00000000000..b13d984907b --- /dev/null +++ b/lib/tasks/migrate/migrate_keys.rake @@ -0,0 +1,15 @@ +desc "GITLAB | Migrate SSH Keys" +task migrate_keys: :environment do + puts "This will add fingerprint to ssh keys in db" + ask_to_continue + + Key.find_each(batch_size: 20) do |key| + if key.valid? && key.save + print '.' + else + print 'F' + end + end +end + + diff --git a/spec/controllers/blob_controller_spec.rb b/spec/controllers/blob_controller_spec.rb index fe113459470..05d16f35545 100644 --- a/spec/controllers/blob_controller_spec.rb +++ b/spec/controllers/blob_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe BlobController do +describe Projects::BlobController do let(:project) { create(:project_with_code) } let(:user) { create(:user) } diff --git a/spec/controllers/commit_controller_spec.rb b/spec/controllers/commit_controller_spec.rb index 5fffbf0e5f3..87c54143a05 100644 --- a/spec/controllers/commit_controller_spec.rb +++ b/spec/controllers/commit_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe CommitController do +describe Projects::CommitController do let(:project) { create(:project_with_code) } let(:user) { create(:user) } let(:commit) { project.repository.last_commit_for("master") } diff --git a/spec/controllers/commits_controller_spec.rb b/spec/controllers/commits_controller_spec.rb index ce4029173a5..c9931a19622 100644 --- a/spec/controllers/commits_controller_spec.rb +++ b/spec/controllers/commits_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe CommitsController do +describe Projects::CommitsController do let(:project) { create(:project_with_code) } let(:user) { create(:user) } diff --git a/spec/controllers/merge_requests_controller_spec.rb b/spec/controllers/merge_requests_controller_spec.rb index 796de23bfe3..51ba6ca5945 100644 --- a/spec/controllers/merge_requests_controller_spec.rb +++ b/spec/controllers/merge_requests_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MergeRequestsController do +describe Projects::MergeRequestsController do let(:project) { create(:project_with_code) } let(:user) { create(:user) } let(:merge_request) { create(:merge_request_with_diffs, project: project, target_branch: "bcf03b5d~3", source_branch: "bcf03b5d") } @@ -8,7 +8,7 @@ describe MergeRequestsController do before do sign_in(user) project.team << [user, :master] - MergeRequestsController.any_instance.stub(validates_merge_request: true) + Projects::MergeRequestsController.any_instance.stub(validates_merge_request: true) end describe "#show" do diff --git a/spec/controllers/tree_controller_spec.rb b/spec/controllers/tree_controller_spec.rb index f9fe4fe2010..3e41b406c4f 100644 --- a/spec/controllers/tree_controller_spec.rb +++ b/spec/controllers/tree_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe TreeController do +describe Projects::TreeController do let(:project) { create(:project_with_code) } let(:user) { create(:user) } diff --git a/spec/factories.rb b/spec/factories.rb index bd2ec6abf62..793bd2434e8 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -38,6 +38,13 @@ FactoryGirl.define do factory :project_with_code, parent: :project do path { 'gitlabhq' } + + after :create do |project| + repos_path = Rails.root.join('tmp', 'test-git-base-path') + seed_repo = Rails.root.join('tmp', 'repositories', 'gitlabhq') + target_repo = File.join(repos_path, project.path_with_namespace + '.git') + system("ln -s #{seed_repo} #{target_repo}") + end end factory :group do diff --git a/spec/factories/forked_project_links.rb b/spec/factories/forked_project_links.rb index 64bcdf09429..2f9b91acf2c 100644 --- a/spec/factories/forked_project_links.rb +++ b/spec/factories/forked_project_links.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: forked_project_links +# +# id :integer not null, primary key +# forked_to_project_id :integer not null +# forked_from_project_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do diff --git a/spec/factories/user_team_project_relationships.rb b/spec/factories/user_team_project_relationships.rb deleted file mode 100644 index e900d86c2e4..00000000000 --- a/spec/factories/user_team_project_relationships.rb +++ /dev/null @@ -1,21 +0,0 @@ -# == Schema Information -# -# Table name: user_team_project_relationships -# -# id :integer not null, primary key -# project_id :integer -# user_team_id :integer -# greatest_access :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -# Read about factories at https://github.com/thoughtbot/factory_girl - -FactoryGirl.define do - factory :user_team_project_relationship do - project - user_team - greatest_access { UsersProject::MASTER } - end -end diff --git a/spec/factories/user_team_user_relationships.rb b/spec/factories/user_team_user_relationships.rb deleted file mode 100644 index 8c729dd8751..00000000000 --- a/spec/factories/user_team_user_relationships.rb +++ /dev/null @@ -1,23 +0,0 @@ -# == Schema Information -# -# Table name: user_team_user_relationships -# -# id :integer not null, primary key -# user_id :integer -# user_team_id :integer -# group_admin :boolean -# permission :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -# Read about factories at https://github.com/thoughtbot/factory_girl - -FactoryGirl.define do - factory :user_team_user_relationship do - user - user_team - group_admin false - permission { UsersProject::MASTER } - end -end diff --git a/spec/factories/user_teams.rb b/spec/factories/user_teams.rb deleted file mode 100644 index 3aeea40a6c9..00000000000 --- a/spec/factories/user_teams.rb +++ /dev/null @@ -1,23 +0,0 @@ -# == Schema Information -# -# Table name: user_teams -# -# id :integer not null, primary key -# name :string(255) -# path :string(255) -# owner_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# description :string(255) default(""), not null -# - -# Read about factories at https://github.com/thoughtbot/factory_girl - -FactoryGirl.define do - factory :user_team do - sequence(:name) { |n| "team#{n}" } - sequence(:description) { |n| "team_description#{n}" } - path { name.downcase.gsub(/\s/, '_') } - owner - end -end diff --git a/spec/factories/users_groups.rb b/spec/factories/users_groups.rb new file mode 100644 index 00000000000..654bb2caee8 --- /dev/null +++ b/spec/factories/users_groups.rb @@ -0,0 +1,19 @@ +# == Schema Information +# +# Table name: users_groups +# +# id :integer not null, primary key +# group_access :integer not null +# group_id :integer not null +# user_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + +FactoryGirl.define do + factory :users_group do + group_access { UsersGroup::OWNER } + group + user + end +end diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index 15de101a17a..2aaa4e97340 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -109,18 +109,4 @@ describe "Admin::Users" do end end end - - describe "Add new project" do - before do - @new_project = create(:project) - visit admin_user_path(@user) - end - - it "should create new user" do - select @new_project.name, from: "project_ids" - expect { click_button "Add" }.to change { UsersProject.count }.by(1) - page.should have_content @new_project.name - current_path.should == admin_user_path(@user) - end - end end diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index 5ce4cae3551..3ca59da493b 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -2,8 +2,9 @@ require 'spec_helper' describe "Search" do before do + ActiveRecord::Base.observers.enable(:user_observer) login_as :user - @project = create(:project) + @project = create(:project, namespace: @user.namespace) @project.team << [@user, :reporter] visit search_path diff --git a/spec/features/security/profile_access_spec.rb b/spec/features/security/profile_access_spec.rb index f854f3fb066..52130b3f8c6 100644 --- a/spec/features/security/profile_access_spec.rb +++ b/spec/features/security/profile_access_spec.rb @@ -10,8 +10,8 @@ describe "Users Security" do it { new_user_session_path.should_not be_404_for :visitor } end - describe "GET /keys" do - subject { keys_path } + describe "GET /profile/keys" do + subject { profile_keys_path } it { should be_allowed_for @u1 } it { should be_allowed_for :admin } diff --git a/spec/lib/gitlab/user_team_manager_spec.rb b/spec/lib/gitlab/user_team_manager_spec.rb deleted file mode 100644 index 2ee3587b367..00000000000 --- a/spec/lib/gitlab/user_team_manager_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'spec_helper' - -describe Gitlab::UserTeamManager do - before do - @user = create :user - @project = create :project, creator: @user - - @master = create :user - @developer = create :user - @reporter = create :user - - @project.team << [@master, :master] - @project.team << [@developer, :developer] - @project.team << [@reporter, :reporter] - - @team = create :user_team, owner: @user - - @team.add_members([@master.id, @developer.id, @reporter.id], UsersProject::DEVELOPER, false) - end - - it "should assign team to project with correct permissions result" do - @team.assign_to_project(@project, UsersProject::MASTER) - - @project.users_projects.find_by_user_id(@master).project_access.should == UsersProject::MASTER - @project.users_projects.find_by_user_id(@developer).project_access.should == UsersProject::DEVELOPER - @project.users_projects.find_by_user_id(@reporter).project_access.should == UsersProject::DEVELOPER - end -end diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index d2e1e8a8743..e7e8bc5b028 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -86,7 +86,7 @@ describe Notify do end it 'includes a link to ssh keys page' do - should have_body_text /#{keys_path}/ + should have_body_text /#{profile_keys_path}/ end end @@ -218,6 +218,24 @@ describe Notify do end end + describe 'project was moved' do + let(:project) { create(:project) } + let(:user) { create(:user) } + subject { Notify.project_was_moved_email(project.id, user.id) } + + it 'has the correct subject' do + should have_subject /project was moved/ + end + + it 'contains name of project' do + should have_body_text /#{project.name_with_namespace}/ + end + + it 'contains new user role' do + should have_body_text /#{project.ssh_url_to_repo}/ + end + end + describe 'project access changed' do let(:project) { create(:project) } let(:user) { create(:user) } diff --git a/spec/models/deploy_key_spec.rb b/spec/models/deploy_key_spec.rb index 3658a6ff1d0..ec1f5d2c4e2 100644 --- a/spec/models/deploy_key_spec.rb +++ b/spec/models/deploy_key_spec.rb @@ -4,12 +4,12 @@ # # id :integer not null, primary key # user_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # key :text # title :string(255) # identifier :string(255) -# project_id :integer +# type :string(255) # require 'spec_helper' diff --git a/spec/models/deploy_keys_project_spec.rb b/spec/models/deploy_keys_project_spec.rb index bb62c48bbcc..aeec1713558 100644 --- a/spec/models/deploy_keys_project_spec.rb +++ b/spec/models/deploy_keys_project_spec.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: deploy_keys_projects +# +# id :integer not null, primary key +# deploy_key_id :integer not null +# project_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + require 'spec_helper' describe DeployKeysProject do diff --git a/spec/models/forked_project_link_spec.rb b/spec/models/forked_project_link_spec.rb index c362b21f088..5f25e2abd23 100644 --- a/spec/models/forked_project_link_spec.rb +++ b/spec/models/forked_project_link_spec.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: forked_project_links +# +# id :integer not null, primary key +# forked_to_project_id :integer not null +# forked_from_project_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + require 'spec_helper' describe ForkedProjectLink, "add link on fork" do diff --git a/spec/models/gitlab_ci_service_spec.rb b/spec/models/gitlab_ci_service_spec.rb index b86588af1ac..56efa9df457 100644 --- a/spec/models/gitlab_ci_service_spec.rb +++ b/spec/models/gitlab_ci_service_spec.rb @@ -11,6 +11,8 @@ # updated_at :datetime not null # active :boolean default(FALSE), not null # project_url :string(255) +# subdomain :string(255) +# room :string(255) # require 'spec_helper' diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 5d4674e3a9f..78c39548eb4 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -17,7 +17,11 @@ require 'spec_helper' describe Group do let!(:group) { create(:group) } - it { should have_many :projects } + describe "Associations" do + it { should have_many :projects } + it { should have_many :users_groups } + end + it { should validate_presence_of :name } it { should validate_uniqueness_of(:name) } it { should validate_presence_of :path } @@ -31,4 +35,11 @@ describe Group do describe :human_name do it { group.human_name.should == group.name } end + + describe :add_users do + let(:user) { create(:user) } + before { group.add_users([user.id], UsersGroup::MASTER) } + + it { group.users_groups.masters.map(&:user).should include(user) } + end end diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 1bc794dcd77..ed0a725add6 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -7,8 +7,8 @@ # assignee_id :integer # author_id :integer # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # position :integer default(0) # branch_name :string(255) # description :text diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index 9ccad18248c..6c06f5268b3 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -4,12 +4,12 @@ # # id :integer not null, primary key # user_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # key :text # title :string(255) # identifier :string(255) -# project_id :integer +# type :string(255) # require 'spec_helper' diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index a4660806cca..a0a43fbb815 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -9,8 +9,8 @@ # author_id :integer # assignee_id :integer # title :string(255) -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # st_commits :text(2147483647) # st_diffs :text(2147483647) # milestone_id :integer diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 52e24a78eb4..ba94f940dc8 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -6,8 +6,8 @@ # note :text # noteable_type :string(255) # author_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # project_id :integer # attachment :string(255) # line_code :string(255) diff --git a/spec/models/project_snippet_spec.rb b/spec/models/project_snippet_spec.rb index 716fd81c91b..42147179387 100644 --- a/spec/models/project_snippet_spec.rb +++ b/spec/models/project_snippet_spec.rb @@ -6,11 +6,13 @@ # title :string(255) # content :text # author_id :integer not null -# project_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# project_id :integer +# created_at :datetime +# updated_at :datetime # file_name :string(255) # expires_at :datetime +# private :boolean default(TRUE), not null +# type :string(255) # require 'spec_helper' diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 2e3870b1b65..0845d2edea3 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -6,8 +6,8 @@ # name :string(255) # path :string(255) # description :text -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # creator_id :integer # default_branch :string(255) # issues_enabled :boolean default(TRUE), not null @@ -20,6 +20,7 @@ # issues_tracker_id :string(255) # snippets_enabled :boolean default(TRUE), not null # last_activity_at :datetime +# imported :boolean default(FALSE), not null # require 'spec_helper' diff --git a/spec/models/service_hook_spec.rb b/spec/models/service_hook_spec.rb index 0b0262c97f1..e5ba59c0d65 100644 --- a/spec/models/service_hook_spec.rb +++ b/spec/models/service_hook_spec.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # url :string(255) # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # type :string(255) default("ProjectHook") # service_id :integer # diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index 1a58f680baf..55ef1914730 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -11,6 +11,8 @@ # updated_at :datetime not null # active :boolean default(FALSE), not null # project_url :string(255) +# subdomain :string(255) +# room :string(255) # require 'spec_helper' diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index 52355c38f0c..a77c594aaf1 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -6,11 +6,13 @@ # title :string(255) # content :text # author_id :integer not null -# project_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# project_id :integer +# created_at :datetime +# updated_at :datetime # file_name :string(255) # expires_at :datetime +# private :boolean default(TRUE), not null +# type :string(255) # require 'spec_helper' diff --git a/spec/models/system_hook_spec.rb b/spec/models/system_hook_spec.rb index a9ed6a5fa7c..7f11f9ec247 100644 --- a/spec/models/system_hook_spec.rb +++ b/spec/models/system_hook_spec.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # url :string(255) # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # type :string(255) default("ProjectHook") # service_id :integer # diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 4dd2048ccad..eb8ffa5aafe 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -4,7 +4,7 @@ # # id :integer not null, primary key # email :string(255) default(""), not null -# encrypted_password :string(255) default(""), not null +# encrypted_password :string(128) default(""), not null # reset_password_token :string(255) # reset_password_sent_at :datetime # remember_created_at :datetime @@ -13,8 +13,8 @@ # last_sign_in_at :datetime # current_sign_in_ip :string(255) # last_sign_in_ip :string(255) -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # name :string(255) # admin :boolean default(FALSE), not null # projects_limit :integer default(10) @@ -34,6 +34,8 @@ # state :string(255) # color_scheme_id :integer default(1), not null # notification_level :integer default(1), not null +# password_expires_at :datetime +# created_by_id :integer # require 'spec_helper' @@ -106,15 +108,11 @@ describe User do ActiveRecord::Base.observers.enable(:user_observer) @user = create :user @project = create :project, namespace: @user.namespace - @project_2 = create :project # Grant MASTER access to the user - @project_3 = create :project # Grant DEVELOPER access to the user - - UsersProject.add_users_into_projects( - [@project_2.id], [@user.id], UsersProject::MASTER - ) - UsersProject.add_users_into_projects( - [@project_3.id], [@user.id], UsersProject::DEVELOPER - ) + @project_2 = create :project, group: create(:group) # Grant MASTER access to the user + @project_3 = create :project, group: create(:group) # Grant DEVELOPER access to the user + + @project_2.team << [@user, :master] + @project_3.team << [@user, :developer] end it { @user.authorized_projects.should include(@project) } @@ -126,13 +124,6 @@ describe User do it { @user.personal_projects.should include(@project) } it { @user.personal_projects.should_not include(@project_2) } it { @user.personal_projects.should_not include(@project_3) } - - # master_projects doesn't check creator/namespace. - # In real case the users_projects relation will certainly be assigned - # when the project is created. - it { @user.master_projects.should_not include(@project) } - it { @user.master_projects.should include(@project_2) } - it { @user.master_projects.should_not include(@project_3) } end describe 'groups' do @@ -148,23 +139,6 @@ describe User do it { @user.owned_groups.should == [@group] } end - describe 'teams' do - before do - ActiveRecord::Base.observers.enable(:user_observer) - @admin = create :user, admin: true - @user1 = create :user - @user2 = create :user - @team = create :user_team, owner: @user1 - end - - it { @admin.authorized_teams.should == [@team] } - it { @user1.authorized_teams.should == [@team] } - it { @user2.authorized_teams.should be_empty } - it { @admin.should be_can(:manage_user_team, @team) } - it { @user1.should be_can(:manage_user_team, @team) } - it { @user2.should_not be_can(:manage_user_team, @team) } - end - describe 'namespaced' do before do ActiveRecord::Base.observers.enable(:user_observer) diff --git a/spec/models/user_team_project_relationship_spec.rb b/spec/models/user_team_project_relationship_spec.rb deleted file mode 100644 index 86150cf305f..00000000000 --- a/spec/models/user_team_project_relationship_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -# == Schema Information -# -# Table name: user_team_project_relationships -# -# id :integer not null, primary key -# project_id :integer -# user_team_id :integer -# greatest_access :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -require 'spec_helper' - -describe UserTeamProjectRelationship do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/user_team_spec.rb b/spec/models/user_team_spec.rb deleted file mode 100644 index d330bbf3e33..00000000000 --- a/spec/models/user_team_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# == Schema Information -# -# Table name: user_teams -# -# id :integer not null, primary key -# name :string(255) -# path :string(255) -# owner_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# description :string(255) default(""), not null -# - -require 'spec_helper' - -describe UserTeam do - let(:team) { FactoryGirl.create :user_team } - - context ".add_member" do - let(:user) { FactoryGirl.create :user } - - it "should work" do - team.add_member(user, UsersProject::DEVELOPER, false) - team.members.should include(user) - end - end - - context ".remove_member" do - let(:user) { FactoryGirl.create :user } - before { team.add_member(user, UsersProject::DEVELOPER, false) } - - it "should work" do - team.remove_member(user) - team.members.should_not include(user) - end - end -end diff --git a/spec/models/user_team_user_relationship_spec.rb b/spec/models/user_team_user_relationship_spec.rb deleted file mode 100644 index 981ad1e8873..00000000000 --- a/spec/models/user_team_user_relationship_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -# == Schema Information -# -# Table name: user_team_user_relationships -# -# id :integer not null, primary key -# user_id :integer -# user_team_id :integer -# group_admin :boolean -# permission :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -require 'spec_helper' - -describe UserTeamUserRelationship do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/users_group_spec.rb b/spec/models/users_group_spec.rb new file mode 100644 index 00000000000..4da31a55fcb --- /dev/null +++ b/spec/models/users_group_spec.rb @@ -0,0 +1,39 @@ +# == Schema Information +# +# Table name: users_groups +# +# id :integer not null, primary key +# group_access :integer not null +# group_id :integer not null +# user_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + +require 'spec_helper' + +describe UsersGroup do + describe "Associations" do + it { should belong_to(:group) } + it { should belong_to(:user) } + end + + describe "Mass assignment" do + it { should_not allow_mass_assignment_of(:group_id) } + end + + describe "Validation" do + let!(:users_group) { create(:users_group) } + + it { should validate_presence_of(:user_id) } + it { should validate_uniqueness_of(:user_id).scoped_to(:group_id).with_message(/already exists/) } + + it { should validate_presence_of(:group_id) } + it { should ensure_inclusion_of(:group_access).in_array(UsersGroup.group_access_roles.values) } + end + + describe "Delegate methods" do + it { should respond_to(:user_name) } + it { should respond_to(:user_email) } + end +end diff --git a/spec/models/users_project_spec.rb b/spec/models/users_project_spec.rb index e289a592b03..aa4b8cb449b 100644 --- a/spec/models/users_project_spec.rb +++ b/spec/models/users_project_spec.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # user_id :integer not null # project_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # project_access :integer default(0), not null # notification_level :integer default(3), not null # diff --git a/spec/models/web_hook_spec.rb b/spec/models/web_hook_spec.rb index 2d9301732dd..4f88ed849e0 100644 --- a/spec/models/web_hook_spec.rb +++ b/spec/models/web_hook_spec.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # url :string(255) # project_id :integer -# created_at :datetime not null -# updated_at :datetime not null +# created_at :datetime +# updated_at :datetime # type :string(255) default("ProjectHook") # service_id :integer # diff --git a/spec/observers/key_observer_spec.rb b/spec/observers/key_observer_spec.rb index 452844cbedd..b304bf1fcb7 100644 --- a/spec/observers/key_observer_spec.rb +++ b/spec/observers/key_observer_spec.rb @@ -7,10 +7,10 @@ describe KeyObserver do @observer = KeyObserver.instance end - context :after_save do + context :after_create do it do GitlabShellWorker.should_receive(:perform_async).with(:add_key, @key.shell_id, @key.key) - @observer.after_save(@key) + @observer.after_create(@key) end end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index a6612af83eb..300bff28871 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -8,7 +8,7 @@ describe API::API do let(:user2) { create(:user) } let(:user3) { create(:user) } let(:admin) { create(:admin) } - let!(:project) { create(:project_with_code, creator_id: user.id) } + let!(:project) { create(:project_with_code, creator_id: user.id, namespace: user.namespace) } let!(:hook) { create(:project_hook, project: project, url: "http://example.com") } let!(:snippet) { create(:project_snippet, author: user, project: project, title: 'example') } let!(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) } diff --git a/spec/requests/api/user_teams_spec.rb b/spec/requests/api/user_teams_spec.rb deleted file mode 100644 index 68f05b11a83..00000000000 --- a/spec/requests/api/user_teams_spec.rb +++ /dev/null @@ -1,360 +0,0 @@ -require 'spec_helper' - -describe API::API do - include ApiHelpers - - # Create test objects - let(:user1) { create(:user) } - let(:user2) { create(:user) } - let(:admin) { create(:admin) } - let!(:group1) { create(:group, owner: user1) } - let!(:group2) { create(:group, owner: user2) } - let(:user_team1) { create(:user_team, owner: user1) } - let(:user_team2) { create(:user_team, owner: user2) } - let!(:project1) { create(:project, creator_id: admin.id) } - let!(:project2) { create(:project, creator_id: admin.id) } - - - before { - # Add members to teams - user_team1.add_member(user1, UsersProject::MASTER, false) - user_team2.add_member(user2, UsersProject::MASTER, false) - - # Add projects to teams - user_team1.assign_to_projects([project1.id], UsersProject::MASTER) - user_team2.assign_to_projects([project2.id], UsersProject::MASTER) - - } - - describe "GET /user_teams" do - context "when unauthenticated" do - it "should return authentication error" do - get api("/user_teams") - response.status.should == 401 - end - end - - context "when authenticated as user" do - it "normal user: should return an array of user_teams of user1" do - get api("/user_teams", user1) - response.status.should == 200 - json_response.should be_an Array - json_response.length.should == 1 - json_response.first['name'].should == user_team1.name - end - end - - context "when authenticated as admin" do - it "admin: should return an array of all user_teams" do - get api("/user_teams", admin) - response.status.should == 200 - json_response.should be_an Array - json_response.length.should == 2 - end - end - end - - describe "GET /user_teams/:id" do - context "when authenticated as user" do - it "should return one of user1's user_teams" do - get api("/user_teams/#{user_team1.id}", user1) - response.status.should == 200 - json_response['name'] == user_team1.name - end - - it "should not return a non existing team" do - get api("/user_teams/1328", user1) - response.status.should == 404 - end - - it "should not return a user_team not attached to user1" do - get api("/user_teams/#{user_team2.id}", user1) - response.status.should == 404 - end - end - - context "when authenticated as admin" do - it "should return any existing user_team" do - get api("/user_teams/#{user_team2.id}", admin) - response.status.should == 200 - json_response['name'].should == user_team2.name - end - - it "should not return a non existing user_team" do - get api("/user_teams/1328", admin) - response.status.should == 404 - end - end - end - - describe "POST /user_teams" do - context "when authenticated as user" do - it "should not create user_team" do - count_before=UserTeam.count - post api("/user_teams", user1), attributes_for(:user_team) - response.status.should == 403 - UserTeam.count.should == count_before - end - end - - context "when authenticated as admin" do - it "should create user_team" do - count_before=UserTeam.count - post api("/user_teams", admin), attributes_for(:user_team) - response.status.should == 201 - UserTeam.count.should == count_before + 1 - end - - it "should not create user_team, duplicate" do - post api("/user_teams", admin), {:name => "Duplicate Test", :path => user_team2.path} - response.status.should == 404 - end - - it "should return 400 bad request error if name not given" do - post api("/user_teams", admin), {:path => user_team2.path} - response.status.should == 400 - end - - it "should return 400 bad request error if path not given" do - post api("/user_teams", admin), {:name => 'test'} - response.status.should == 400 - end - end - end - - # Members - - describe "GET /user_teams/:id/members" do - context "when authenticated as user" do - it "should return user1 as member of user1's user_teams" do - get api("/user_teams/#{user_team1.id}/members", user1) - response.status.should == 200 - json_response.first['name'].should == user1.name - json_response.first['access_level'].should == UsersProject::MASTER - end - end - - context "when authenticated as admin" do - it "should return member of any existing user_team" do - get api("/user_teams/#{user_team2.id}/members", admin) - response.status.should == 200 - json_response.first['name'].should == user2.name - json_response.first['access_level'].should == UsersProject::MASTER - end - end - end - - describe "POST /user_teams/:id/members" do - context "when authenticated as user" do - it "should not add user2 as member of user_team1" do - post api("/user_teams/#{user_team1.id}/members", user1), user_id: user2.id, access_level: UsersProject::MASTER - response.status.should == 403 - end - end - - context "when authenticated as admin" do - it "should return ok and add new member" do - count_before=user_team1.user_team_user_relationships.count - post api("/user_teams/#{user_team1.id}/members", admin), user_id: user2.id, access_level: UsersProject::MASTER - response.status.should == 201 - json_response['name'].should == user2.name - json_response['access_level'].should == UsersProject::MASTER - user_team1.user_team_user_relationships.count.should == count_before + 1 - end - it "should return ok if member already exists" do - post api("/user_teams/#{user_team2.id}/members", admin), user_id: user2.id, access_level: UsersProject::MASTER - response.status.should == 409 - end - it "should return a 400 error when user id is not given" do - post api("/user_teams/#{user_team2.id}/members", admin), access_level: UsersProject::MASTER - response.status.should == 400 - end - it "should return a 400 error when access level is not given" do - post api("/user_teams/#{user_team2.id}/members", admin), user_id: user2.id - response.status.should == 400 - end - - it "should return a 422 error when access level is not known" do - post api("/user_teams/#{user_team2.id}/members", admin), user_id: user1.id, access_level: 1234 - response.status.should == 422 - end - - end - end - - # Get single member - describe "GET /user_teams/:id/members/:user_id" do - context "when authenticated as member" do - it "should show user1's membership of user_team1" do - get api("/user_teams/#{user_team1.id}/members/#{user1.id}", user1) - response.status.should == 200 - json_response['name'].should == user1.name - json_response['access_level'].should == UsersProject::MASTER - end - it "should show that user2 is not member of user_team1" do - get api("/user_teams/#{user_team1.id}/members/#{user2.id}", user1) - response.status.should == 404 - end - end - - context "when authenticated as non-member" do - it "should not show user1's membership of user_team1" do - get api("/user_teams/#{user_team1.id}/members/#{user1.id}", user2) - response.status.should == 404 - end - end - - context "when authenticated as admin" do - it "should show user1's membership of user_team1" do - get api("/user_teams/#{user_team1.id}/members/#{user1.id}", admin) - response.status.should == 200 - json_response['name'].should == user1.name - json_response['access_level'].should == UsersProject::MASTER - end - it "should return a 404 error when user id is not known" do - get api("/user_teams/#{user_team2.id}/members/1328", admin) - response.status.should == 404 - end - end - end - - describe "DELETE /user_teams/:id/members/:user_id" do - context "when authenticated as user" do - it "should not delete user1's membership of user_team1" do - delete api("/user_teams/#{user_team1.id}/members/#{user1.id}", user1) - response.status.should == 403 - end - end - - context "when authenticated as admin" do - it "should delete user1's membership of user_team1" do - count_before=user_team1.user_team_user_relationships.count - delete api("/user_teams/#{user_team1.id}/members/#{user1.id}", admin) - response.status.should == 200 - user_team1.user_team_user_relationships.count.should == count_before - 1 - end - it "should return a 404 error when user id is not known" do - delete api("/user_teams/#{user_team2.id}/members/1328", admin) - response.status.should == 404 - end - end - end - - # Projects - - describe "GET /user_teams/:id/projects" do - context "when authenticated as user" do - it "should return project1 as assigned to user_team1 as member user1" do - get api("/user_teams/#{user_team1.id}/projects", user1) - response.status.should == 200 - json_response.first['name'].should == project1.name - json_response.length.should == user_team1.user_team_project_relationships.count - end - end - - context "when authenticated as admin" do - it "should return project2 as assigned to user_team2 as non-member, but admin" do - get api("/user_teams/#{user_team2.id}/projects", admin) - response.status.should == 200 - json_response.first['name'].should == project2.name - json_response.first['greatest_access_level'].should == UsersProject::MASTER - end - end - end - - describe "POST /user_teams/:id/projects" do - context "when authenticated as admin" do - it "should return ok and add new project" do - count_before=user_team1.user_team_project_relationships.count - post api("/user_teams/#{user_team1.id}/projects", admin), - project_id: project2.id, - greatest_access_level: UsersProject::MASTER - response.status.should == 201 - json_response['name'].should == project2.name - json_response['greatest_access_level'].should == UsersProject::MASTER - user_team1.user_team_project_relationships.count.should == count_before + 1 - end - it "should return ok if project already exists" do - post api("/user_teams/#{user_team2.id}/projects", admin), - project_id: project2.id, - greatest_access_level: UsersProject::MASTER - response.status.should == 409 - end - it "should return a 400 error when project id is not given" do - post api("/user_teams/#{user_team2.id}/projects", admin), greatest_access_level: UsersProject::MASTER - response.status.should == 400 - end - it "should return a 400 error when access level is not given" do - post api("/user_teams/#{user_team2.id}/projects", admin), project_id: project2.id - response.status.should == 400 - end - - it "should return a 422 error when access level is not known" do - post api("/user_teams/#{user_team2.id}/projects", admin), - project_id: project2.id, - greatest_access_level: 1234 - response.status.should == 422 - end - - end - end - - - describe "GET /user_teams/:id/projects/:project_id" do - context "when authenticated as member" do - it "should show project1's assignment to user_team1" do - get api("/user_teams/#{user_team1.id}/projects/#{project1.id}", user1) - response.status.should == 200 - json_response['name'].should == project1.name - json_response['greatest_access_level'].should == UsersProject::MASTER - end - it "should show project2's is not assigned to user_team1" do - get api("/user_teams/#{user_team1.id}/projects/#{project2.id}", user1) - response.status.should == 404 - end - end - - context "when authenticated as non-member" do - it "should not show project1's assignment to user_team1" do - get api("/user_teams/#{user_team1.id}/projects/#{project1.id}", user2) - response.status.should == 404 - end - end - - context "when authenticated as admin" do - it "should show project1's assignment to user_team1" do - get api("/user_teams/#{user_team1.id}/projects/#{project1.id}", admin) - response.status.should == 200 - json_response['name'].should == project1.name - json_response['greatest_access_level'].should == UsersProject::MASTER - end - it "should return a 404 error when project id is not known" do - get api("/user_teams/#{user_team2.id}/projects/1328", admin) - response.status.should == 404 - end - end - end - - describe "DELETE /user_teams/:id/projects/:project_id" do - context "when authenticated as user" do - it "should not delete project1's assignment to user_team2" do - delete api("/user_teams/#{user_team2.id}/projects/#{project1.id}", user1) - response.status.should == 403 - end - end - - context "when authenticated as admin" do - it "should delete project1's assignment to user_team1" do - count_before=user_team1.user_team_project_relationships.count - delete api("/user_teams/#{user_team1.id}/projects/#{project1.id}", admin) - response.status.should == 200 - user_team1.user_team_project_relationships.count.should == count_before - 1 - end - it "should return a 404 error when project id is not known" do - delete api("/user_teams/#{user_team2.id}/projects/1328", admin) - response.status.should == 404 - end - end - end - -end diff --git a/spec/routing/admin_routing_spec.rb b/spec/routing/admin_routing_spec.rb index 36b546fb077..bd76148043c 100644 --- a/spec/routing/admin_routing_spec.rb +++ b/spec/routing/admin_routing_spec.rb @@ -75,20 +75,10 @@ describe Admin::ProjectsController, "routing" do end end -# edit_admin_project_member GET /admin/projects/:project_id/members/:id/edit(.:format) admin/projects/members#edit {id: /[^\/]+/, project_id: /[^\/]+/} -# admin_project_member PUT /admin/projects/:project_id/members/:id(.:format) admin/projects/members#update {id: /[^\/]+/, project_id: /[^\/]+/} # DELETE /admin/projects/:project_id/members/:id(.:format) admin/projects/members#destroy {id: /[^\/]+/, project_id: /[^\/]+/} -describe Admin::Projects::MembersController, "routing" do - it "to #edit" do - get("/admin/projects/test/members/1/edit").should route_to('admin/projects/members#edit', project_id: 'test', id: '1') - end - - it "to #update" do - put("/admin/projects/test/members/1").should route_to('admin/projects/members#update', project_id: 'test', id: '1') - end - +describe Admin::MembersController, "routing" do it "to #destroy" do - delete("/admin/projects/test/members/1").should route_to('admin/projects/members#destroy', project_id: 'test', id: '1') + delete("/admin/projects/test/members/1").should route_to('admin/members#destroy', project_id: 'test', id: '1') end end diff --git a/spec/routing/notifications_routing_spec.rb b/spec/routing/notifications_routing_spec.rb index 6880d2819d1..112b825e023 100644 --- a/spec/routing/notifications_routing_spec.rb +++ b/spec/routing/notifications_routing_spec.rb @@ -1,13 +1,13 @@ require "spec_helper" -describe NotificationsController do +describe Profiles::NotificationsController do describe "routing" do it "routes to #show" do - get("/profile/notifications").should route_to("notifications#show") + get("/profile/notifications").should route_to("profiles/notifications#show") end it "routes to #update" do - put("/profile/notifications").should route_to("notifications#update") + put("/profile/notifications").should route_to("profiles/notifications#update") end end end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 0b6528bfc81..831e464f9cb 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -25,31 +25,31 @@ shared_examples "RESTful project resources" do let(:actions) { [:index, :create, :new, :edit, :show, :update, :destroy] } it "to #index" do - get("/gitlabhq/#{controller}").should route_to("#{controller}#index", project_id: 'gitlabhq') if actions.include?(:index) + get("/gitlabhq/#{controller}").should route_to("projects/#{controller}#index", project_id: 'gitlabhq') if actions.include?(:index) end it "to #create" do - post("/gitlabhq/#{controller}").should route_to("#{controller}#create", project_id: 'gitlabhq') if actions.include?(:create) + post("/gitlabhq/#{controller}").should route_to("projects/#{controller}#create", project_id: 'gitlabhq') if actions.include?(:create) end it "to #new" do - get("/gitlabhq/#{controller}/new").should route_to("#{controller}#new", project_id: 'gitlabhq') if actions.include?(:new) + get("/gitlabhq/#{controller}/new").should route_to("projects/#{controller}#new", project_id: 'gitlabhq') if actions.include?(:new) end it "to #edit" do - get("/gitlabhq/#{controller}/1/edit").should route_to("#{controller}#edit", project_id: 'gitlabhq', id: '1') if actions.include?(:edit) + get("/gitlabhq/#{controller}/1/edit").should route_to("projects/#{controller}#edit", project_id: 'gitlabhq', id: '1') if actions.include?(:edit) end it "to #show" do - get("/gitlabhq/#{controller}/1").should route_to("#{controller}#show", project_id: 'gitlabhq', id: '1') if actions.include?(:show) + get("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#show", project_id: 'gitlabhq', id: '1') if actions.include?(:show) end it "to #update" do - put("/gitlabhq/#{controller}/1").should route_to("#{controller}#update", project_id: 'gitlabhq', id: '1') if actions.include?(:update) + put("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#update", project_id: 'gitlabhq', id: '1') if actions.include?(:update) end it "to #destroy" do - delete("/gitlabhq/#{controller}/1").should route_to("#{controller}#destroy", project_id: 'gitlabhq', id: '1') if actions.include?(:destroy) + delete("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#destroy", project_id: 'gitlabhq', id: '1') if actions.include?(:destroy) end end @@ -76,7 +76,7 @@ describe ProjectsController, "routing" do end it "to #wall" do - get("/gitlabhq/wall").should route_to('walls#show', project_id: 'gitlabhq') + get("/gitlabhq/wall").should route_to('projects/walls#show', project_id: 'gitlabhq') end it "to #edit" do @@ -100,19 +100,19 @@ describe ProjectsController, "routing" do end end -# pages_project_wikis GET /:project_id/wikis/pages(.:format) wikis#pages -# history_project_wiki GET /:project_id/wikis/:id/history(.:format) wikis#history -# project_wikis POST /:project_id/wikis(.:format) wikis#create -# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) wikis#edit -# project_wiki GET /:project_id/wikis/:id(.:format) wikis#show -# DELETE /:project_id/wikis/:id(.:format) wikis#destroy -describe WikisController, "routing" do +# pages_project_wikis GET /:project_id/wikis/pages(.:format) projects/wikis#pages +# history_project_wiki GET /:project_id/wikis/:id/history(.:format) projects/wikis#history +# project_wikis POST /:project_id/wikis(.:format) projects/wikis#create +# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) projects/wikis#edit +# project_wiki GET /:project_id/wikis/:id(.:format) projects/wikis#show +# DELETE /:project_id/wikis/:id(.:format) projects/wikis#destroy +describe Projects::WikisController, "routing" do it "to #pages" do - get("/gitlabhq/wikis/pages").should route_to('wikis#pages', project_id: 'gitlabhq') + get("/gitlabhq/wikis/pages").should route_to('projects/wikis#pages', project_id: 'gitlabhq') end it "to #history" do - get("/gitlabhq/wikis/1/history").should route_to('wikis#history', project_id: 'gitlabhq', id: '1') + get("/gitlabhq/wikis/1/history").should route_to('projects/wikis#history', project_id: 'gitlabhq', id: '1') end it_behaves_like "RESTful project resources" do @@ -121,50 +121,25 @@ describe WikisController, "routing" do end end -# branches_project_repository GET /:project_id/repository/branches(.:format) repositories#branches -# tags_project_repository GET /:project_id/repository/tags(.:format) repositories#tags -# archive_project_repository GET /:project_id/repository/archive(.:format) repositories#archive -# project_repository POST /:project_id/repository(.:format) repositories#create -# new_project_repository GET /:project_id/repository/new(.:format) repositories#new -# edit_project_repository GET /:project_id/repository/edit(.:format) repositories#edit -# GET /:project_id/repository(.:format) repositories#show -# PUT /:project_id/repository(.:format) repositories#update -# DELETE /:project_id/repository(.:format) repositories#destroy -describe RepositoriesController, "routing" do +# branches_project_repository GET /:project_id/repository/branches(.:format) projects/repositories#branches +# tags_project_repository GET /:project_id/repository/tags(.:format) projects/repositories#tags +# archive_project_repository GET /:project_id/repository/archive(.:format) projects/repositories#archive +# edit_project_repository GET /:project_id/repository/edit(.:format) projects/repositories#edit +describe Projects::RepositoriesController, "routing" do it "to #branches" do - get("/gitlabhq/repository/branches").should route_to('repositories#branches', project_id: 'gitlabhq') + get("/gitlabhq/repository/branches").should route_to('projects/repositories#branches', project_id: 'gitlabhq') end it "to #tags" do - get("/gitlabhq/repository/tags").should route_to('repositories#tags', project_id: 'gitlabhq') + get("/gitlabhq/repository/tags").should route_to('projects/repositories#tags', project_id: 'gitlabhq') end it "to #archive" do - get("/gitlabhq/repository/archive").should route_to('repositories#archive', project_id: 'gitlabhq') - end - - it "to #create" do - post("/gitlabhq/repository").should route_to('repositories#create', project_id: 'gitlabhq') - end - - it "to #new" do - get("/gitlabhq/repository/new").should route_to('repositories#new', project_id: 'gitlabhq') - end - - it "to #edit" do - get("/gitlabhq/repository/edit").should route_to('repositories#edit', project_id: 'gitlabhq') + get("/gitlabhq/repository/archive").should route_to('projects/repositories#archive', project_id: 'gitlabhq') end it "to #show" do - get("/gitlabhq/repository").should route_to('repositories#show', project_id: 'gitlabhq') - end - - it "to #update" do - put("/gitlabhq/repository").should route_to('repositories#update', project_id: 'gitlabhq') - end - - it "to #destroy" do - delete("/gitlabhq/repository").should route_to('repositories#destroy', project_id: 'gitlabhq') + get("/gitlabhq/repository").should route_to('projects/repositories#show', project_id: 'gitlabhq') end end @@ -175,7 +150,7 @@ end # project_deploy_key GET /:project_id/deploy_keys/:id(.:format) deploy_keys#show # PUT /:project_id/deploy_keys/:id(.:format) deploy_keys#update # DELETE /:project_id/deploy_keys/:id(.:format) deploy_keys#destroy -describe DeployKeysController, "routing" do +describe Projects::DeployKeysController, "routing" do it_behaves_like "RESTful project resources" do let(:controller) { 'deploy_keys' } end @@ -184,7 +159,7 @@ end # project_protected_branches GET /:project_id/protected_branches(.:format) protected_branches#index # POST /:project_id/protected_branches(.:format) protected_branches#create # project_protected_branch DELETE /:project_id/protected_branches/:id(.:format) protected_branches#destroy -describe ProtectedBranchesController, "routing" do +describe Projects::ProtectedBranchesController, "routing" do it_behaves_like "RESTful project resources" do let(:actions) { [:index, :create, :destroy] } let(:controller) { 'protected_branches' } @@ -194,58 +169,58 @@ end # switch_project_refs GET /:project_id/refs/switch(.:format) refs#switch # logs_tree_project_ref GET /:project_id/refs/:id/logs_tree(.:format) refs#logs_tree # logs_file_project_ref GET /:project_id/refs/:id/logs_tree/:path(.:format) refs#logs_tree -describe RefsController, "routing" do +describe Projects::RefsController, "routing" do it "to #switch" do - get("/gitlabhq/refs/switch").should route_to('refs#switch', project_id: 'gitlabhq') + get("/gitlabhq/refs/switch").should route_to('projects/refs#switch', project_id: 'gitlabhq') end it "to #logs_tree" do - get("/gitlabhq/refs/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable') - get("/gitlabhq/refs/feature%2345/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45') - get("/gitlabhq/refs/feature%2B45/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45') - get("/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') - get("/gitlabhq/refs/feature%2345/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45', path: 'foo/bar/baz') - get("/gitlabhq/refs/feature%2B45/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45', path: 'foo/bar/baz') - get("/gitlab/gitlabhq/refs/stable/logs_tree/files.scss").should route_to('refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'files.scss') + get("/gitlabhq/refs/stable/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'stable') + get("/gitlabhq/refs/feature%2345/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45') + get("/gitlabhq/refs/feature%2B45/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45') + get("/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') + get("/gitlabhq/refs/feature%2345/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45', path: 'foo/bar/baz') + get("/gitlabhq/refs/feature%2B45/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45', path: 'foo/bar/baz') + get("/gitlab/gitlabhq/refs/stable/logs_tree/files.scss").should route_to('projects/refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'files.scss') end end -# diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) merge_requests#diffs -# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) merge_requests#automerge -# automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) merge_requests#automerge_check -# branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) merge_requests#branch_from -# branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) merge_requests#branch_to -# project_merge_requests GET /:project_id/merge_requests(.:format) merge_requests#index -# POST /:project_id/merge_requests(.:format) merge_requests#create -# new_project_merge_request GET /:project_id/merge_requests/new(.:format) merge_requests#new -# edit_project_merge_request GET /:project_id/merge_requests/:id/edit(.:format) merge_requests#edit -# project_merge_request GET /:project_id/merge_requests/:id(.:format) merge_requests#show -# PUT /:project_id/merge_requests/:id(.:format) merge_requests#update -# DELETE /:project_id/merge_requests/:id(.:format) merge_requests#destroy -describe MergeRequestsController, "routing" do +# diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) projects/merge_requests#diffs +# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) projects/merge_requests#automerge +# automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) projects/merge_requests#automerge_check +# branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) projects/merge_requests#branch_from +# branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) projects/merge_requests#branch_to +# project_merge_requests GET /:project_id/merge_requests(.:format) projects/merge_requests#index +# POST /:project_id/merge_requests(.:format) projects/merge_requests#create +# new_project_merge_request GET /:project_id/merge_requests/new(.:format) projects/merge_requests#new +# edit_project_merge_request GET /:project_id/merge_requests/:id/edit(.:format) projects/merge_requests#edit +# project_merge_request GET /:project_id/merge_requests/:id(.:format) projects/merge_requests#show +# PUT /:project_id/merge_requests/:id(.:format) projects/merge_requests#update +# DELETE /:project_id/merge_requests/:id(.:format) projects/merge_requests#destroy +describe Projects::MergeRequestsController, "routing" do it "to #diffs" do - get("/gitlabhq/merge_requests/1/diffs").should route_to('merge_requests#diffs', project_id: 'gitlabhq', id: '1') + get("/gitlabhq/merge_requests/1/diffs").should route_to('projects/merge_requests#diffs', project_id: 'gitlabhq', id: '1') end it "to #automerge" do - get("/gitlabhq/merge_requests/1/automerge").should route_to('merge_requests#automerge', project_id: 'gitlabhq', id: '1') + get("/gitlabhq/merge_requests/1/automerge").should route_to('projects/merge_requests#automerge', project_id: 'gitlabhq', id: '1') end it "to #automerge_check" do - get("/gitlabhq/merge_requests/1/automerge_check").should route_to('merge_requests#automerge_check', project_id: 'gitlabhq', id: '1') + get("/gitlabhq/merge_requests/1/automerge_check").should route_to('projects/merge_requests#automerge_check', project_id: 'gitlabhq', id: '1') end it "to #branch_from" do - get("/gitlabhq/merge_requests/branch_from").should route_to('merge_requests#branch_from', project_id: 'gitlabhq') + get("/gitlabhq/merge_requests/branch_from").should route_to('projects/merge_requests#branch_from', project_id: 'gitlabhq') end it "to #branch_to" do - get("/gitlabhq/merge_requests/branch_to").should route_to('merge_requests#branch_to', project_id: 'gitlabhq') + get("/gitlabhq/merge_requests/branch_to").should route_to('projects/merge_requests#branch_to', project_id: 'gitlabhq') end it "to #show" do - get("/gitlabhq/merge_requests/1.diff").should route_to('merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'diff') - get("/gitlabhq/merge_requests/1.patch").should route_to('merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'patch') + get("/gitlabhq/merge_requests/1.diff").should route_to('projects/merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'diff') + get("/gitlabhq/merge_requests/1.patch").should route_to('projects/merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'patch') end it_behaves_like "RESTful project resources" do @@ -300,9 +275,9 @@ end # project_hooks GET /:project_id/hooks(.:format) hooks#index # POST /:project_id/hooks(.:format) hooks#create # project_hook DELETE /:project_id/hooks/:id(.:format) hooks#destroy -describe HooksController, "routing" do +describe Projects::HooksController, "routing" do it "to #test" do - get("/gitlabhq/hooks/1/test").should route_to('hooks#test', project_id: 'gitlabhq', id: '1') + get("/gitlabhq/hooks/1/test").should route_to('projects/hooks#test', project_id: 'gitlabhq', id: '1') end it_behaves_like "RESTful project resources" do @@ -312,12 +287,12 @@ describe HooksController, "routing" do end # project_commit GET /:project_id/commit/:id(.:format) commit#show {id: /[[:alnum:]]{6,40}/, project_id: /[^\/]+/} -describe CommitController, "routing" do +describe Projects::CommitController, "routing" do it "to #show" do - get("/gitlabhq/commit/4246fb").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb') - get("/gitlabhq/commit/4246fb.diff").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'diff') - get("/gitlabhq/commit/4246fb.patch").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'patch') - get("/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') + get("/gitlabhq/commit/4246fb").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb') + get("/gitlabhq/commit/4246fb.diff").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'diff') + get("/gitlabhq/commit/4246fb.patch").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'patch') + get("/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') end end @@ -325,14 +300,14 @@ end # project_commits GET /:project_id/commits(.:format) commits#index # POST /:project_id/commits(.:format) commits#create # project_commit GET /:project_id/commits/:id(.:format) commits#show -describe CommitsController, "routing" do +describe Projects::CommitsController, "routing" do it_behaves_like "RESTful project resources" do let(:actions) { [:show] } let(:controller) { 'commits' } end it "to #show" do - get("/gitlab/gitlabhq/commits/master.atom").should route_to('commits#show', project_id: 'gitlab/gitlabhq', id: "master", format: "atom") + get("/gitlab/gitlabhq/commits/master.atom").should route_to('projects/commits#show', project_id: 'gitlab/gitlabhq', id: "master", format: "atom") end end @@ -343,7 +318,7 @@ end # project_team_member GET /:project_id/team_members/:id(.:format) team_members#show # PUT /:project_id/team_members/:id(.:format) team_members#update # DELETE /:project_id/team_members/:id(.:format) team_members#destroy -describe TeamMembersController, "routing" do +describe Projects::TeamMembersController, "routing" do it_behaves_like "RESTful project resources" do let(:actions) { [:new, :create, :update, :destroy] } let(:controller) { 'team_members' } @@ -357,7 +332,7 @@ end # project_milestone GET /:project_id/milestones/:id(.:format) milestones#show # PUT /:project_id/milestones/:id(.:format) milestones#update # DELETE /:project_id/milestones/:id(.:format) milestones#destroy -describe MilestonesController, "routing" do +describe Projects::MilestonesController, "routing" do it_behaves_like "RESTful project resources" do let(:controller) { 'milestones' } let(:actions) { [:index, :create, :new, :edit, :show, :update] } @@ -365,9 +340,9 @@ describe MilestonesController, "routing" do end # project_labels GET /:project_id/labels(.:format) labels#index -describe LabelsController, "routing" do +describe Projects::LabelsController, "routing" do it "to #index" do - get("/gitlabhq/labels").should route_to('labels#index', project_id: 'gitlabhq') + get("/gitlabhq/labels").should route_to('projects/labels#index', project_id: 'gitlabhq') end end @@ -381,9 +356,9 @@ end # project_issue GET /:project_id/issues/:id(.:format) issues#show # PUT /:project_id/issues/:id(.:format) issues#update # DELETE /:project_id/issues/:id(.:format) issues#destroy -describe IssuesController, "routing" do +describe Projects::IssuesController, "routing" do it "to #bulk_update" do - post("/gitlabhq/issues/bulk_update").should route_to('issues#bulk_update', project_id: 'gitlabhq') + post("/gitlabhq/issues/bulk_update").should route_to('projects/issues#bulk_update', project_id: 'gitlabhq') end it_behaves_like "RESTful project resources" do @@ -396,9 +371,9 @@ end # project_notes GET /:project_id/notes(.:format) notes#index # POST /:project_id/notes(.:format) notes#create # project_note DELETE /:project_id/notes/:id(.:format) notes#destroy -describe NotesController, "routing" do +describe Projects::NotesController, "routing" do it "to #preview" do - post("/gitlabhq/notes/preview").should route_to('notes#preview', project_id: 'gitlabhq') + post("/gitlabhq/notes/preview").should route_to('projects/notes#preview', project_id: 'gitlabhq') end it_behaves_like "RESTful project resources" do @@ -408,57 +383,57 @@ describe NotesController, "routing" do end # project_blame GET /:project_id/blame/:id(.:format) blame#show {id: /.+/, project_id: /[^\/]+/} -describe BlameController, "routing" do +describe Projects::BlameController, "routing" do it "to #show" do - get("/gitlabhq/blame/master/app/models/project.rb").should route_to('blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') - get("/gitlab/gitlabhq/blame/master/files.scss").should route_to('blame#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') + get("/gitlabhq/blame/master/app/models/project.rb").should route_to('projects/blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') + get("/gitlab/gitlabhq/blame/master/files.scss").should route_to('projects/blame#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') end end # project_blob GET /:project_id/blob/:id(.:format) blob#show {id: /.+/, project_id: /[^\/]+/} -describe BlobController, "routing" do +describe Projects::BlobController, "routing" do it "to #show" do - get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') - get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb') - get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') + get("/gitlabhq/blob/master/app/models/project.rb").should route_to('projects/blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') + get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('projects/blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb') + get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') end end # project_tree GET /:project_id/tree/:id(.:format) tree#show {id: /.+/, project_id: /[^\/]+/} -describe TreeController, "routing" do +describe Projects::TreeController, "routing" do it "to #show" do - get("/gitlabhq/tree/master/app/models/project.rb").should route_to('tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') - get("/gitlab/gitlabhq/tree/master/files.scss").should route_to('tree#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') + get("/gitlabhq/tree/master/app/models/project.rb").should route_to('projects/tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') + get("/gitlab/gitlabhq/tree/master/files.scss").should route_to('projects/tree#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') end end # project_compare_index GET /:project_id/compare(.:format) compare#index {id: /[^\/]+/, project_id: /[^\/]+/} # POST /:project_id/compare(.:format) compare#create {id: /[^\/]+/, project_id: /[^\/]+/} # project_compare /:project_id/compare/:from...:to(.:format) compare#show {from: /.+/, to: /.+/, id: /[^\/]+/, project_id: /[^\/]+/} -describe CompareController, "routing" do +describe Projects::CompareController, "routing" do it "to #index" do - get("/gitlabhq/compare").should route_to('compare#index', project_id: 'gitlabhq') + get("/gitlabhq/compare").should route_to('projects/compare#index', project_id: 'gitlabhq') end it "to #compare" do - post("/gitlabhq/compare").should route_to('compare#create', project_id: 'gitlabhq') + post("/gitlabhq/compare").should route_to('projects/compare#create', project_id: 'gitlabhq') end it "to #show" do - get("/gitlabhq/compare/master...stable").should route_to('compare#show', project_id: 'gitlabhq', from: 'master', to: 'stable') - get("/gitlabhq/compare/issue/1234...stable").should route_to('compare#show', project_id: 'gitlabhq', from: 'issue/1234', to: 'stable') + get("/gitlabhq/compare/master...stable").should route_to('projects/compare#show', project_id: 'gitlabhq', from: 'master', to: 'stable') + get("/gitlabhq/compare/issue/1234...stable").should route_to('projects/compare#show', project_id: 'gitlabhq', from: 'issue/1234', to: 'stable') end end -describe NetworkController, "routing" do +describe Projects::NetworkController, "routing" do it "to #show" do - get("/gitlabhq/network/master").should route_to('network#show', project_id: 'gitlabhq', id: 'master') - get("/gitlabhq/network/master.json").should route_to('network#show', project_id: 'gitlabhq', id: 'master', format: "json") + get("/gitlabhq/network/master").should route_to('projects/network#show', project_id: 'gitlabhq', id: 'master') + get("/gitlabhq/network/master.json").should route_to('projects/network#show', project_id: 'gitlabhq', id: 'master', format: "json") end end -describe GraphsController, "routing" do +describe Projects::GraphsController, "routing" do it "to #show" do - get("/gitlabhq/graphs/master").should route_to('graphs#show', project_id: 'gitlabhq', id: 'master') + get("/gitlabhq/graphs/master").should route_to('projects/graphs#show', project_id: 'gitlabhq', id: 'master') end end diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index aa3952f74b6..cc2a141c454 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -155,33 +155,33 @@ end # key GET /keys/:id(.:format) keys#show # PUT /keys/:id(.:format) keys#update # DELETE /keys/:id(.:format) keys#destroy -describe KeysController, "routing" do +describe Profiles::KeysController, "routing" do it "to #index" do - get("/keys").should route_to('keys#index') + get("/profile/keys").should route_to('profiles/keys#index') end it "to #create" do - post("/keys").should route_to('keys#create') + post("/profile/keys").should route_to('profiles/keys#create') end it "to #new" do - get("/keys/new").should route_to('keys#new') + get("/profile/keys/new").should route_to('profiles/keys#new') end it "to #edit" do - get("/keys/1/edit").should route_to('keys#edit', id: '1') + get("/profile/keys/1/edit").should route_to('profiles/keys#edit', id: '1') end it "to #show" do - get("/keys/1").should route_to('keys#show', id: '1') + get("/profile/keys/1").should route_to('profiles/keys#show', id: '1') end it "to #update" do - put("/keys/1").should route_to('keys#update', id: '1') + put("/profile/keys/1").should route_to('profiles/keys#update', id: '1') end it "to #destroy" do - delete("/keys/1").should route_to('keys#destroy', id: '1') + delete("/profile/keys/1").should route_to('profiles/keys#destroy', id: '1') end end diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb index d423ccf8a10..46794f48384 100644 --- a/spec/support/login_helpers.rb +++ b/spec/support/login_helpers.rb @@ -3,7 +3,10 @@ module LoginHelpers # # role - User role (e.g., :admin, :user) def login_as(role) - @user = create(role) + ActiveRecord::Base.observers.enable(:user_observer) do + @user = create(role) + end + login_with(@user) end diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index efc629e6478..3230301eead 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -42,6 +42,7 @@ module TestEnv add_repository: true, mv_repository: true, remove_repository: true, + update_repository_head: true, add_key: true, remove_key: true ) @@ -65,11 +66,6 @@ module TestEnv # Recreate tmp/test-git-base-path FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path - - # Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq - seed_repo = Rails.root.join('tmp', 'repositories', 'gitlabhq') - target_repo = File.join(repos_path, 'gitlabhq.git') - system("ln -s #{seed_repo} #{target_repo}") end def create_temp_repo(path) |