summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorVinnie Okada <vokada@mrvinn.com>2015-03-22 21:50:28 -0600
committerVinnie Okada <vokada@mrvinn.com>2015-03-22 21:50:28 -0600
commit637ca0b388382112850fd3052a961bb07db34d14 (patch)
tree15f8abdad066ffcda26a49e645d8f8aee4571002 /app
parenta7afc0634240f5cddb6c6e1bf1f9fcf4374b852e (diff)
parentbc4e25189805879490555ef2782193470f4fe295 (diff)
downloadgitlab-ce-637ca0b388382112850fd3052a961bb07db34d14.tar.gz
Merge branch 'master' into markdown-tags
Diffstat (limited to 'app')
-rw-r--r--app/assets/images/authbuttons/bitbucket_32.pngbin2713 -> 0 bytes
-rw-r--r--app/assets/images/authbuttons/github_32.pngbin1822 -> 0 bytes
-rw-r--r--app/assets/images/authbuttons/gitlab_32.pngbin1039 -> 0 bytes
-rw-r--r--app/assets/images/authbuttons/gitlab_64.pngbin3013 -> 6559 bytes
-rw-r--r--app/assets/images/authbuttons/google_32.pngbin1501 -> 0 bytes
-rw-r--r--app/assets/images/authbuttons/twitter_32.pngbin1311 -> 0 bytes
-rw-r--r--app/assets/stylesheets/base/gl_bootstrap.scss2
-rw-r--r--app/assets/stylesheets/generic/forms.scss4
-rw-r--r--app/assets/stylesheets/pages/login.scss9
-rw-r--r--app/assets/stylesheets/pages/profile.scss40
-rw-r--r--app/assets/stylesheets/print.scss4
-rw-r--r--app/controllers/profiles/accounts_controller.rb6
-rw-r--r--app/helpers/application_helper.rb6
-rw-r--r--app/helpers/oauth_helper.rb11
-rw-r--r--app/helpers/profile_helper.rb6
-rw-r--r--app/models/project_wiki.rb2
-rw-r--r--app/models/repository.rb39
-rw-r--r--app/models/wiki_page.rb3
-rw-r--r--app/services/create_tag_service.rb3
-rw-r--r--app/services/git_push_service.rb60
-rw-r--r--app/services/git_tag_push_service.rb18
-rw-r--r--app/views/devise/shared/_omniauth_box.html.haml2
-rw-r--r--app/views/profiles/accounts/show.html.haml21
-rw-r--r--app/views/projects/new.html.haml6
24 files changed, 147 insertions, 95 deletions
diff --git a/app/assets/images/authbuttons/bitbucket_32.png b/app/assets/images/authbuttons/bitbucket_32.png
deleted file mode 100644
index 27702eb973d..00000000000
--- a/app/assets/images/authbuttons/bitbucket_32.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/authbuttons/github_32.png b/app/assets/images/authbuttons/github_32.png
deleted file mode 100644
index 0445b567bbc..00000000000
--- a/app/assets/images/authbuttons/github_32.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/authbuttons/gitlab_32.png b/app/assets/images/authbuttons/gitlab_32.png
deleted file mode 100644
index f3b78cb6efb..00000000000
--- a/app/assets/images/authbuttons/gitlab_32.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/authbuttons/gitlab_64.png b/app/assets/images/authbuttons/gitlab_64.png
index ff2945fe89e..31281a19444 100644
--- a/app/assets/images/authbuttons/gitlab_64.png
+++ b/app/assets/images/authbuttons/gitlab_64.png
Binary files differ
diff --git a/app/assets/images/authbuttons/google_32.png b/app/assets/images/authbuttons/google_32.png
deleted file mode 100644
index b03c3ec5207..00000000000
--- a/app/assets/images/authbuttons/google_32.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/authbuttons/twitter_32.png b/app/assets/images/authbuttons/twitter_32.png
deleted file mode 100644
index a3d4964f40f..00000000000
--- a/app/assets/images/authbuttons/twitter_32.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/stylesheets/base/gl_bootstrap.scss b/app/assets/stylesheets/base/gl_bootstrap.scss
index 82c51cf4852..e176cce5c69 100644
--- a/app/assets/stylesheets/base/gl_bootstrap.scss
+++ b/app/assets/stylesheets/base/gl_bootstrap.scss
@@ -152,6 +152,8 @@
*/
.panel {
.panel-heading {
+ font-weight: bold;
+
.panel-head-actions {
position: relative;
top: -5px;
diff --git a/app/assets/stylesheets/generic/forms.scss b/app/assets/stylesheets/generic/forms.scss
index 31fe5a03f37..266041403e0 100644
--- a/app/assets/stylesheets/generic/forms.scss
+++ b/app/assets/stylesheets/generic/forms.scss
@@ -15,10 +15,6 @@ input[type='text'].danger {
text-shadow: 0 1px 1px #fff
}
-fieldset legend {
- font-size: 16px;
-}
-
.datetime-controls {
select {
width: 100px;
diff --git a/app/assets/stylesheets/pages/login.scss b/app/assets/stylesheets/pages/login.scss
index d366300511e..83b866c3a64 100644
--- a/app/assets/stylesheets/pages/login.scss
+++ b/app/assets/stylesheets/pages/login.scss
@@ -113,3 +113,12 @@
}
}
}
+
+.oauth-image-link {
+ margin-right: 10px;
+
+ img {
+ width: 32px;
+ height: 32px;
+ }
+}
diff --git a/app/assets/stylesheets/pages/profile.scss b/app/assets/stylesheets/pages/profile.scss
index fbe71a5b5ad..65655d4bfa3 100644
--- a/app/assets/stylesheets/pages/profile.scss
+++ b/app/assets/stylesheets/pages/profile.scss
@@ -1,31 +1,7 @@
.account-page {
fieldset {
margin-bottom: 15px;
- border-bottom: 1px dashed #ddd;
padding-bottom: 15px;
-
- &:last-child {
- border: none;
- }
-
- legend {
- border: none;
- margin-bottom: 10px;
- }
- }
-}
-
-.oauth_select_holder {
- img {
- padding: 2px;
- margin-right: 10px;
- }
- .active {
- img {
- border: 1px solid #4BD;
- background: $hover;
- @include border-radius(5px);
- }
}
}
@@ -101,3 +77,19 @@
}
}
}
+
+.oauth-buttons {
+ .btn-group {
+ margin-right: 10px;
+ }
+
+ .btn {
+ line-height: 36px;
+ height: 56px;
+
+ img {
+ width: 32px;
+ height: 32px;
+ }
+ }
+}
diff --git a/app/assets/stylesheets/print.scss b/app/assets/stylesheets/print.scss
index 42dbf4d6ef3..1be0551ad3b 100644
--- a/app/assets/stylesheets/print.scss
+++ b/app/assets/stylesheets/print.scss
@@ -11,3 +11,7 @@ header, nav, nav.main-nav, nav.navbar-collapse, nav.navbar-collapse.collapse {di
.wiki h1 {font-size: 30px;}
.wiki h2 {font-size: 22px;}
.wiki h3 {font-size: 18px; font-weight: bold; }
+
+.sidebar-wrapper { display: none; }
+.nav { display: none; }
+.btn { display: none; }
diff --git a/app/controllers/profiles/accounts_controller.rb b/app/controllers/profiles/accounts_controller.rb
index fe121691a10..9bd34fe2261 100644
--- a/app/controllers/profiles/accounts_controller.rb
+++ b/app/controllers/profiles/accounts_controller.rb
@@ -4,4 +4,10 @@ class Profiles::AccountsController < ApplicationController
def show
@user = current_user
end
+
+ def unlink
+ provider = params[:provider]
+ current_user.identities.find_by(provider: provider).destroy
+ redirect_to profile_account_path
+ end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8ed6d59c20d..38b5fc4a011 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -174,16 +174,10 @@ module ApplicationHelper
Digest::SHA1.hexdigest string
end
- def authbutton(provider, size = 64)
- file_name = "#{provider.to_s.split('_').first}_#{size}.png"
- image_tag(image_path("authbuttons/#{file_name}"), alt: "Sign in with #{provider.to_s.titleize}")
- end
-
def simple_sanitize(str)
sanitize(str, tags: %w(a span))
end
-
def body_data_page
path = controller.controller_path.split('/')
namespace = path.first if path.second
diff --git a/app/helpers/oauth_helper.rb b/app/helpers/oauth_helper.rb
index 1a0ad17b607..997b91de077 100644
--- a/app/helpers/oauth_helper.rb
+++ b/app/helpers/oauth_helper.rb
@@ -20,6 +20,15 @@ module OauthHelper
def additional_providers
enabled_oauth_providers.reject{|provider| provider.to_s.starts_with?('ldap')}
end
-
+
+ def oauth_image_tag(provider, size = 64)
+ file_name = "#{provider.to_s.split('_').first}_#{size}.png"
+ image_tag(image_path("authbuttons/#{file_name}"), alt: "Sign in with #{provider.to_s.titleize}")
+ end
+
+ def oauth_active?(provider)
+ current_user.identities.exists?(provider: provider.to_s)
+ end
+
extend self
end
diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb
index 9e37e44732a..780c7cd5133 100644
--- a/app/helpers/profile_helper.rb
+++ b/app/helpers/profile_helper.rb
@@ -1,10 +1,4 @@
module ProfileHelper
- def oauth_active_class(provider)
- if current_user.identities.exists?(provider: provider.to_s)
- 'active'
- end
- end
-
def show_profile_username_tab?
current_user.can_change_username?
end
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index 55438bee245..772c868d9cd 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -104,7 +104,7 @@ class ProjectWiki
def page_title_and_dir(title)
title_array = title.split("/")
title = title_array.pop
- [title.gsub(/\.[^.]*$/, ""), title_array.join("/")]
+ [title, title_array.join("/")]
end
def search_files(query)
diff --git a/app/models/repository.rb b/app/models/repository.rb
index c6eaa485b8a..082ad7a0c6a 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -62,24 +62,28 @@ class Repository
def add_branch(branch_name, ref)
cache.expire(:branch_names)
+ @branches = nil
gitlab_shell.add_branch(path_with_namespace, branch_name, ref)
end
def add_tag(tag_name, ref, message = nil)
cache.expire(:tag_names)
+ @tags = nil
gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message)
end
def rm_branch(branch_name)
cache.expire(:branch_names)
+ @branches = nil
gitlab_shell.rm_branch(path_with_namespace, branch_name)
end
def rm_tag(tag_name)
cache.expire(:tag_names)
+ @tags = nil
gitlab_shell.rm_tag(path_with_namespace, tag_name)
end
@@ -180,8 +184,17 @@ class Repository
end
end
+ def lookup_cache
+ @lookup_cache ||= {}
+ end
+
def method_missing(m, *args, &block)
- raw_repository.send(m, *args, &block)
+ if m == :lookup && !block_given?
+ lookup_cache[m] ||= {}
+ lookup_cache[m][args.join(":")] ||= raw_repository.send(m, *args, &block)
+ else
+ raw_repository.send(m, *args, &block)
+ end
end
def respond_to?(method)
@@ -235,12 +248,20 @@ class Repository
end
def head_commit
- commit(self.root_ref)
+ @head_commit ||= commit(self.root_ref)
+ end
+
+ def head_tree
+ @head_tree ||= Tree.new(self, head_commit.sha, nil)
end
def tree(sha = :head, path = nil)
if sha == :head
- sha = head_commit.sha
+ if path.nil?
+ return head_tree
+ else
+ sha = head_commit.sha
+ end
end
Tree.new(self, sha, path)
@@ -368,6 +389,18 @@ class Repository
end
end
+ def branches
+ @branches ||= raw_repository.branches
+ end
+
+ def tags
+ @tags ||= raw_repository.tags
+ end
+
+ def root_ref
+ @root_ref ||= raw_repository.root_ref
+ end
+
private
def cache
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index 32981a0e664..e9413c34bae 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -179,7 +179,8 @@ class WikiPage
if valid? && project_wiki.send(method, *args)
page_details = if method == :update_page
- @page.path
+ # Use url_path instead of path to omit format extension
+ @page.url_path
else
title
end
diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb
index af4b537cb93..4115d689925 100644
--- a/app/services/create_tag_service.rb
+++ b/app/services/create_tag_service.rb
@@ -40,7 +40,8 @@ class CreateTagService < BaseService
end
def create_push_data(project, user, tag)
+ commits = [project.repository.commit(tag.target)].compact
Gitlab::PushDataBuilder.
- build(project, user, Gitlab::Git::BLANK_SHA, tag.target, "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}", [])
+ build(project, user, Gitlab::Git::BLANK_SHA, tag.target, "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}", commits, tag.message)
end
end
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index a0da07f5c90..1f0b29dff5e 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -23,42 +23,40 @@ class GitPushService
project.repository.expire_cache
project.update_repository_size
- if push_to_branch?(ref)
- if push_remove_branch?(ref, newrev)
- @push_commits = []
- elsif push_to_new_branch?(ref, oldrev)
- # Re-find the pushed commits.
- if is_default_branch?(ref)
- # Initial push to the default branch. Take the full history of that branch as "newly pushed".
- @push_commits = project.repository.commits(newrev)
-
- # Set protection on the default branch if configured
- if (current_application_settings.default_branch_protection != PROTECTION_NONE)
- developers_can_push = current_application_settings.default_branch_protection == PROTECTION_DEV_CAN_PUSH ? true : false
- project.protected_branches.create({ name: project.default_branch, developers_can_push: developers_can_push })
- end
- else
- # Use the pushed commits that aren't reachable by the default branch
- # as a heuristic. This may include more commits than are actually pushed, but
- # that shouldn't matter because we check for existing cross-references later.
- @push_commits = project.repository.commits_between(project.default_branch, newrev)
-
- # don't process commits for the initial push to the default branch
- process_commit_messages(ref)
+ if push_remove_branch?(ref, newrev)
+ @push_commits = []
+ elsif push_to_new_branch?(ref, oldrev)
+ # Re-find the pushed commits.
+ if is_default_branch?(ref)
+ # Initial push to the default branch. Take the full history of that branch as "newly pushed".
+ @push_commits = project.repository.commits(newrev)
+
+ # Set protection on the default branch if configured
+ if (current_application_settings.default_branch_protection != PROTECTION_NONE)
+ developers_can_push = current_application_settings.default_branch_protection == PROTECTION_DEV_CAN_PUSH ? true : false
+ project.protected_branches.create({ name: project.default_branch, developers_can_push: developers_can_push })
end
- elsif push_to_existing_branch?(ref, oldrev)
- # Collect data for this git push
- @push_commits = project.repository.commits_between(oldrev, newrev)
- project.update_merge_requests(oldrev, newrev, ref, @user)
+ else
+ # Use the pushed commits that aren't reachable by the default branch
+ # as a heuristic. This may include more commits than are actually pushed, but
+ # that shouldn't matter because we check for existing cross-references later.
+ @push_commits = project.repository.commits_between(project.default_branch, newrev)
+
+ # don't process commits for the initial push to the default branch
process_commit_messages(ref)
end
+ elsif push_to_existing_branch?(ref, oldrev)
+ # Collect data for this git push
+ @push_commits = project.repository.commits_between(oldrev, newrev)
+ project.update_merge_requests(oldrev, newrev, ref, @user)
+ process_commit_messages(ref)
+ end
- @push_data = build_push_data(oldrev, newrev, ref)
+ @push_data = build_push_data(oldrev, newrev, ref)
- EventCreateService.new.push(project, user, @push_data)
- project.execute_hooks(@push_data.dup, :push_hooks)
- project.execute_services(@push_data.dup, :push_hooks)
- end
+ EventCreateService.new.push(project, user, @push_data)
+ project.execute_hooks(@push_data.dup, :push_hooks)
+ project.execute_services(@push_data.dup, :push_hooks)
end
protected
diff --git a/app/services/git_tag_push_service.rb b/app/services/git_tag_push_service.rb
index 0d8e6e85e47..bf203bbd692 100644
--- a/app/services/git_tag_push_service.rb
+++ b/app/services/git_tag_push_service.rb
@@ -3,7 +3,7 @@ class GitTagPushService
def execute(project, user, oldrev, newrev, ref)
@project, @user = project, user
-
+
@push_data = build_push_data(oldrev, newrev, ref)
EventCreateService.new.push(project, user, @push_data)
@@ -18,6 +18,20 @@ class GitTagPushService
private
def build_push_data(oldrev, newrev, ref)
- Gitlab::PushDataBuilder.build(project, user, oldrev, newrev, ref, [])
+ commits = []
+ message = nil
+
+ if !Gitlab::Git.blank_ref?(newrev)
+ tag_name = Gitlab::Git.ref_name(ref)
+ tag = project.repository.find_tag(tag_name)
+ if tag && tag.target == newrev
+ commit = project.repository.commit(tag.target)
+ commits = [commit].compact
+ message = tag.message
+ end
+ end
+
+ Gitlab::PushDataBuilder.
+ build(project, user, oldrev, newrev, ref, commits, message)
end
end
diff --git a/app/views/devise/shared/_omniauth_box.html.haml b/app/views/devise/shared/_omniauth_box.html.haml
index 4cd1c303b22..b647b906b71 100644
--- a/app/views/devise/shared/_omniauth_box.html.haml
+++ b/app/views/devise/shared/_omniauth_box.html.haml
@@ -5,6 +5,6 @@
- providers.each do |provider|
%span.light
- if default_providers.include?(provider)
- = link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider)
+ = link_to oauth_image_tag(provider), omniauth_authorize_path(resource_name, provider), class: 'oauth-image-link'
- else
= link_to provider.to_s.titleize, omniauth_authorize_path(resource_name, provider), class: "btn"
diff --git a/app/views/profiles/accounts/show.html.haml b/app/views/profiles/accounts/show.html.haml
index 6bafcb56551..5bffb4acc1d 100644
--- a/app/views/profiles/accounts/show.html.haml
+++ b/app/views/profiles/accounts/show.html.haml
@@ -1,11 +1,6 @@
-%h3.page-title
- Account Settings
-%p.light
- You can change your username and private token here.
- - if current_user.ldap_user?
+- if current_user.ldap_user?
+ .alert.alert-info
Some options are unavailable for LDAP accounts
-%hr
-
.account-page
%fieldset.update-token
@@ -33,12 +28,16 @@
- if show_profile_social_tab?
%fieldset
- %legend Social Accounts
- .oauth_select_holder.append-bottom-10
+ %legend Connected Accounts
+ .oauth-buttons.append-bottom-10
%p Click on icon to activate signin with one of the following services
- enabled_social_providers.each do |provider|
- %span{class: oauth_active_class(provider) }
- = link_to authbutton(provider, 32), omniauth_authorize_path(User, provider)
+ .btn-group
+ = link_to oauth_image_tag(provider), omniauth_authorize_path(User, provider),
+ class: "btn btn-lg #{'active' if oauth_active?(provider)}"
+ - if oauth_active?(provider)
+ = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do
+ %i.fa.fa-close
- if show_profile_username_tab?
%fieldset.update-username
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index 173a3080b31..9687c8ad87c 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -74,9 +74,9 @@
= f.text_field :import_url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git'
.alert.alert-info.prepend-top-10
%ul
- %li
+ %li
The repository must be accessible over HTTP(S). If it is not publicly accessible, you can add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>.
- %li
+ %li
The import will time out after 4 minutes. For big repositories, use a clone/push combination.
%li
To migrate an SVN repository, check out #{link_to "this document", "http://doc.gitlab.com/ce/workflow/migrating_from_svn.html"}.
@@ -112,6 +112,6 @@
$ ->
$('.how_to_import_link').bind 'click', (e) ->
e.preventDefault()
- import_modal = $(this).parent().find(".modal").show()
+ import_modal = $(this).next(".modal").show()
$('.modal-header .close').bind 'click', ->
$(".modal").hide()