Commit 815e9aa2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into haynes/gitlab-ce-commit_calendar

parents 792ced2f 2149f8b5
...@@ -173,7 +173,7 @@ gem 'ace-rails-ap' ...@@ -173,7 +173,7 @@ gem 'ace-rails-ap'
gem 'mousetrap-rails' gem 'mousetrap-rails'
# Semantic UI Sass for Sidebar # Semantic UI Sass for Sidebar
gem 'semantic-ui-sass', '~> 0.16.1.0' gem 'semantic-ui-sass', '~> 1.8.0'
gem "sass-rails", '~> 4.0.2' gem "sass-rails", '~> 4.0.2'
gem "coffee-rails" gem "coffee-rails"
......
...@@ -491,7 +491,7 @@ GEM ...@@ -491,7 +491,7 @@ GEM
activesupport (>= 3.1, < 4.2) activesupport (>= 3.1, < 4.2)
select2-rails (3.5.2) select2-rails (3.5.2)
thor (~> 0.14) thor (~> 0.14)
semantic-ui-sass (0.16.1.0) semantic-ui-sass (1.8.0.0)
sass (~> 3.2) sass (~> 3.2)
settingslogic (2.0.9) settingslogic (2.0.9)
sexp_processor (4.4.0) sexp_processor (4.4.0)
...@@ -717,7 +717,7 @@ DEPENDENCIES ...@@ -717,7 +717,7 @@ DEPENDENCIES
sdoc sdoc
seed-fu seed-fu
select2-rails select2-rails
semantic-ui-sass (~> 0.16.1.0) semantic-ui-sass (~> 1.8.0)
settingslogic settingslogic
shoulda-matchers (~> 2.1.0) shoulda-matchers (~> 2.1.0)
sidekiq (~> 3.3) sidekiq (~> 3.3)
......
/* /*
* Twitter bootstrap with GitLab customizations/additions * Twitter bootstrap with GitLab customizations/additions
* *
* Some unused bootstrap compontents like panels are not included.
* Other components like tabs are modified to GitLab style.
*
*/ */
$font-size-base: 13px !default; $font-size-base: 13px !default;
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
} }
@mixin panel-colored { @mixin panel-colored {
border: none; border: 1px solid #EEE;
background: $box_bg; background: $box_bg;
@include box-shadow(0 1px 1px rgba(0, 0, 0, 0.09)); @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.09));
......
...@@ -181,7 +181,7 @@ class ApplicationController < ActionController::Base ...@@ -181,7 +181,7 @@ class ApplicationController < ActionController::Base
end end
def add_gon_variables def add_gon_variables
gon.default_issues_tracker = Project.issues_tracker.default_value gon.default_issues_tracker = Project.new.default_issue_tracker.to_param
gon.api_version = API::API.version gon.api_version = API::API.version
gon.relative_url_root = Gitlab.config.gitlab.relative_url_root gon.relative_url_root = Gitlab.config.gitlab.relative_url_root
gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
......
...@@ -9,7 +9,7 @@ class Projects::ServicesController < Projects::ApplicationController ...@@ -9,7 +9,7 @@ class Projects::ServicesController < Projects::ApplicationController
def index def index
@project.build_missing_services @project.build_missing_services
@services = @project.services.reload @services = @project.services.visible.reload
end end
def edit def edit
...@@ -17,9 +17,6 @@ class Projects::ServicesController < Projects::ApplicationController ...@@ -17,9 +17,6 @@ class Projects::ServicesController < Projects::ApplicationController
def update def update
if @service.update_attributes(service_params) if @service.update_attributes(service_params)
if @service.activated? && @service.issue_tracker?
@project.update_attributes(issues_tracker: @service.to_param)
end
redirect_to edit_project_service_path(@project, @service.to_param), redirect_to edit_project_service_path(@project, @service.to_param),
notice: 'Successfully updated.' notice: 'Successfully updated.'
else else
......
...@@ -16,32 +16,19 @@ module IssuesHelper ...@@ -16,32 +16,19 @@ module IssuesHelper
def url_for_project_issues(project = @project) def url_for_project_issues(project = @project)
return '' if project.nil? return '' if project.nil?
if project.default_issues_tracker? project.issues_tracker.project_url
project_issues_path(project)
else
project.external_issue_tracker.project_url
end
end end
def url_for_new_issue(project = @project) def url_for_new_issue(project = @project)
return '' if project.nil? return '' if project.nil?
if project.default_issues_tracker? project.issues_tracker.new_issue_url
url = new_project_issue_path project_id: project
else
project.external_issue_tracker.new_issue_url
end
end end
def url_for_issue(issue_iid, project = @project) def url_for_issue(issue_iid, project = @project)
return '' if project.nil? return '' if project.nil?
if project.default_issues_tracker? project.issues_tracker.issue_url(issue_iid)
url = project_issue_url project_id: project, id: issue_iid
else
url = project.external_issue_tracker.issues_url
url.gsub(':id', issue_iid.to_s)
end
end end
def title_for_issue(issue_iid, project = @project) def title_for_issue(issue_iid, project = @project)
......
...@@ -77,6 +77,7 @@ class Project < ActiveRecord::Base ...@@ -77,6 +77,7 @@ class Project < ActiveRecord::Base
has_one :jira_service, dependent: :destroy has_one :jira_service, dependent: :destroy
has_one :redmine_service, dependent: :destroy has_one :redmine_service, dependent: :destroy
has_one :custom_issue_tracker_service, dependent: :destroy has_one :custom_issue_tracker_service, dependent: :destroy
has_one :gitlab_issue_tracker_service, dependent: :destroy
has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id" has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id"
...@@ -149,8 +150,6 @@ class Project < ActiveRecord::Base ...@@ -149,8 +150,6 @@ class Project < ActiveRecord::Base
scope :public_and_internal_only, -> { where(visibility_level: Project.public_and_internal_levels) } scope :public_and_internal_only, -> { where(visibility_level: Project.public_and_internal_levels) }
scope :non_archived, -> { where(archived: false) } scope :non_archived, -> { where(archived: false) }
enumerize :issues_tracker, in: (Service.issue_tracker_service_list).append(:gitlab), default: :gitlab
state_machine :import_status, initial: :none do state_machine :import_status, initial: :none do
event :import_start do event :import_start do
transition [:none, :finished] => :started transition [:none, :finished] => :started
...@@ -317,19 +316,28 @@ class Project < ActiveRecord::Base ...@@ -317,19 +316,28 @@ class Project < ActiveRecord::Base
end end
end end
def default_issue_tracker
gitlab_issue_tracker_service ||= create_gitlab_issue_tracker_service
end
def issues_tracker
if external_issue_tracker
external_issue_tracker
else
default_issue_tracker
end
end
def default_issues_tracker? def default_issues_tracker?
if external_issue_tracker if external_issue_tracker
false false
else else
unless self.issues_tracker == Project.issues_tracker.default_value
self.update_attributes(issues_tracker: Project.issues_tracker.default_value)
end
true true
end end
end end
def external_issues_trackers def external_issues_trackers
services.select { |service| service.issue_tracker? } services.select(&:issue_tracker?).reject(&:default?)
end end
def external_issue_tracker def external_issue_tracker
......
class GitlabIssueTrackerService < IssueTrackerService
include Rails.application.routes.url_helpers
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
def default?
true
end
def to_param
'gitlab'
end
def project_url
project_issues_path(project)
end
def new_issue_url
new_project_issue_path project_id: project
end
def issue_url(iid)
"#{Gitlab.config.gitlab.url}#{project_issue_path(project_id: project, id: iid)}"
end
end
...@@ -6,6 +6,10 @@ class IssueTrackerService < Service ...@@ -6,6 +6,10 @@ class IssueTrackerService < Service
:issue_tracker :issue_tracker
end end
def default?
false
end
def project_url def project_url
# implement inside child # implement inside child
end end
...@@ -18,6 +22,10 @@ class IssueTrackerService < Service ...@@ -18,6 +22,10 @@ class IssueTrackerService < Service
# implement inside child # implement inside child
end end
def issue_url(iid)
self.issues_url.gsub(':id', iid.to_s)
end
def fields def fields
[ [
{ type: 'text', name: 'description', placeholder: description }, { type: 'text', name: 'description', placeholder: description },
......
...@@ -26,6 +26,8 @@ class Service < ActiveRecord::Base ...@@ -26,6 +26,8 @@ class Service < ActiveRecord::Base
validates :project_id, presence: true validates :project_id, presence: true
scope :visible, -> { where.not(type: 'GitlabIssueTrackerService') }
def activated? def activated?
active active
end end
......
...@@ -153,9 +153,9 @@ production: &base ...@@ -153,9 +153,9 @@ production: &base
label: 'LDAP' label: 'LDAP'
host: '_your_ldap_server' host: '_your_ldap_server'
port: 636 port: 389
uid: 'sAMAccountName' uid: 'sAMAccountName'
method: 'ssl' # "tls" or "ssl" or "plain" method: 'plain' # "tls" or "ssl" or "plain"
bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
password: '_the_password_of_the_bind_user' password: '_the_password_of_the_bind_user'
......
...@@ -29,9 +29,9 @@ main: # 'main' is the GitLab 'provider ID' of this LDAP server ...@@ -29,9 +29,9 @@ main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP' label: 'LDAP'
host: '_your_ldap_server' host: '_your_ldap_server'
port: 636 port: 389
uid: 'sAMAccountName' uid: 'sAMAccountName'
method: 'ssl' # "tls" or "ssl" or "plain" method: 'plain' # "tls" or "ssl" or "plain"
bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
password: '_the_password_of_the_bind_user' password: '_the_password_of_the_bind_user'
...@@ -76,6 +76,9 @@ main: # 'main' is the GitLab 'provider ID' of this LDAP server ...@@ -76,6 +76,9 @@ main: # 'main' is the GitLab 'provider ID' of this LDAP server
EOS EOS
``` ```
If you are getting 'Connection Refused' errors when trying to connect to the LDAP server please double-check the LDAP `port` and `method` settings used by GitLab.
Common combinations are `method: 'plain'` and `port: 389`, OR `method: 'ssl'` and `port: 636`.
If you are using a GitLab installation from source you can find the LDAP settings in `/home/git/gitlab/config/gitlab.yml`: If you are using a GitLab installation from source you can find the LDAP settings in `/home/git/gitlab/config/gitlab.yml`:
``` ```
......
...@@ -73,7 +73,7 @@ module Gitlab ...@@ -73,7 +73,7 @@ module Gitlab
changes = changes.lines if changes.kind_of?(String) changes = changes.lines if changes.kind_of?(String)
# Iterate over all changes to find if user allowed all of them to be applied # Iterate over all changes to find if user allowed all of them to be applied
changes.each do |change| changes.map(&:strip).reject(&:blank?).each do |change|
status = change_access_check(user, project, change) status = change_access_check(user, project, change)
unless status.allowed? unless status.allowed?
# If user does not have access to make at least one change - cancel all push # If user does not have access to make at least one change - cancel all push
......
...@@ -23,6 +23,7 @@ describe GitlabMarkdownHelper do ...@@ -23,6 +23,7 @@ describe GitlabMarkdownHelper do
@project = project @project = project
@ref = 'markdown' @ref = 'markdown'
@repository = project.repository @repository = project.repository
@request.host = Gitlab.config.gitlab.host
end end
describe "#gfm" do describe "#gfm" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment