summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/dashboard.js.coffee2
-rw-r--r--app/assets/javascripts/main.js.coffee7
-rw-r--r--app/assets/javascripts/pager.js.coffee1
-rw-r--r--app/assets/javascripts/wall.js.coffee4
-rw-r--r--app/assets/stylesheets/gitlab_bootstrap/files.scss9
-rw-r--r--app/assets/stylesheets/gitlab_bootstrap/typography.scss4
-rw-r--r--app/assets/stylesheets/sections/events.scss7
-rw-r--r--app/assets/stylesheets/sections/graph.scss1
-rw-r--r--app/controllers/admin/background_jobs_controller.rb4
-rw-r--r--app/controllers/admin/dashboard_controller.rb3
-rw-r--r--app/controllers/admin/resque_controller.rb4
-rw-r--r--app/controllers/admin/users_controller.rb2
-rw-r--r--app/controllers/application_controller.rb6
-rw-r--r--app/controllers/profiles_controller.rb15
-rw-r--r--app/controllers/projects_controller.rb4
-rw-r--r--app/controllers/registrations_controller.rb3
-rw-r--r--app/controllers/services_controller.rb19
-rw-r--r--app/helpers/application_helper.rb7
-rw-r--r--app/helpers/oauth_helper.rb19
-rw-r--r--app/helpers/projects_helper.rb4
-rw-r--r--app/helpers/tree_helper.rb4
-rw-r--r--app/helpers/user_teams_helper.rb1
-rw-r--r--app/models/campfire_service.rb76
-rw-r--r--app/models/gitlab_ci_service.rb19
-rw-r--r--app/models/hipchat_service.rb73
-rw-r--r--app/models/merge_request.rb20
-rw-r--r--app/models/project.rb41
-rw-r--r--app/models/service.rb23
-rw-r--r--app/models/user.rb12
-rw-r--r--app/observers/project_observer.rb1
-rw-r--r--app/services/system_hooks_service.rb1
-rw-r--r--app/views/admin/background_jobs/show.html.haml (renamed from app/views/admin/resque/show.html.haml)0
-rw-r--r--app/views/admin/dashboard/index.html.haml16
-rw-r--r--app/views/admin/projects/index.html.haml2
-rw-r--r--app/views/dashboard/projects.html.haml2
-rw-r--r--app/views/deploy_keys/_deploy_key.html.haml4
-rw-r--r--app/views/deploy_keys/index.html.haml2
-rw-r--r--app/views/devise/sessions/_new_base.html.haml13
-rw-r--r--app/views/devise/sessions/_new_ldap.html.haml28
-rw-r--r--app/views/devise/sessions/_oauth_providers.html.haml10
-rw-r--r--app/views/devise/sessions/new.html.haml59
-rw-r--r--app/views/edit_tree/show.html.haml4
-rw-r--r--app/views/groups/edit.html.haml2
-rw-r--r--app/views/help/index.html.haml2
-rw-r--r--app/views/issues/_form.html.haml60
-rw-r--r--app/views/layouts/_google_analytics.html.haml2
-rw-r--r--app/views/layouts/_head.html.haml2
-rw-r--r--app/views/layouts/nav/_admin.html.haml4
-rw-r--r--app/views/merge_requests/show/_diffs.html.haml2
-rw-r--r--app/views/milestones/index.html.haml8
-rw-r--r--app/views/notify/new_user_email.html.haml4
-rw-r--r--app/views/notify/new_user_email.text.erb2
-rw-r--r--app/views/profiles/account.html.haml63
-rw-r--r--app/views/projects/edit.html.haml22
-rw-r--r--app/views/projects/empty.html.haml2
-rw-r--r--app/views/projects/show.html.haml2
-rw-r--r--app/views/protected_branches/index.html.haml2
-rw-r--r--app/views/services/_form.html.haml48
-rw-r--r--app/views/services/_gitlab_ci.html.haml46
-rw-r--r--app/views/services/edit.html.haml2
-rw-r--r--app/views/services/index.html.haml38
-rw-r--r--app/views/snippets/_form.html.haml2
62 files changed, 591 insertions, 260 deletions
diff --git a/app/assets/javascripts/dashboard.js.coffee b/app/assets/javascripts/dashboard.js.coffee
index 9beca261467..c2fb95ca635 100644
--- a/app/assets/javascripts/dashboard.js.coffee
+++ b/app/assets/javascripts/dashboard.js.coffee
@@ -27,7 +27,7 @@ class Dashboard
else
event_filters.splice index, 1
- $.cookie "event_filter", event_filters.join(",")
+ $.cookie "event_filter", event_filters.join(","), { path: '/' }
initSidebarTab: ->
key = "dashboard_sidebar_filter"
diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee
index 45ef44fcc04..fd7e296efde 100644
--- a/app/assets/javascripts/main.js.coffee
+++ b/app/assets/javascripts/main.js.coffee
@@ -41,13 +41,20 @@ window.linkify = (str) ->
exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
return str.replace(exp,"<a href='$1'>$1</a>")
+window.simpleFormat = (str) ->
+ linkify(sanitize(str).replace(/\n/g, '<br />'))
+
window.startSpinner = ->
$('.turbolink-spinner').fadeIn()
window.stopSpinner = ->
$('.turbolink-spinner').fadeOut()
+window.stopEndlessScroll = ->
+ $(document).unbind('scroll')
+
document.addEventListener("page:fetch", startSpinner)
+document.addEventListener("page:fetch", stopEndlessScroll)
document.addEventListener("page:receive", stopSpinner)
$ ->
diff --git a/app/assets/javascripts/pager.js.coffee b/app/assets/javascripts/pager.js.coffee
index 5f606acdf9c..5bd11d273a7 100644
--- a/app/assets/javascripts/pager.js.coffee
+++ b/app/assets/javascripts/pager.js.coffee
@@ -30,6 +30,7 @@
@disable = true
initLoadMore: ->
+ $(document).unbind('scroll')
$(document).endlessScroll
bottomPixels: 400
fireDelay: 1000
diff --git a/app/assets/javascripts/wall.js.coffee b/app/assets/javascripts/wall.js.coffee
index c8fc960e174..4f71e6e0c35 100644
--- a/app/assets/javascripts/wall.js.coffee
+++ b/app/assets/javascripts/wall.js.coffee
@@ -60,8 +60,8 @@ class Wall
renderNote: (note) ->
template = @noteTemplate()
template = template.replace('{{author_name}}', note.author.name)
- template = template.replace('{{created_at}}', note.created_at)
- template = template.replace('{{text}}', linkify(sanitize(note.body)))
+ template = template.replace(/{{created_at}}/g, note.created_at)
+ template = template.replace('{{text}}', simpleFormat(note.body))
if note.attachment
file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>'
diff --git a/app/assets/stylesheets/gitlab_bootstrap/files.scss b/app/assets/stylesheets/gitlab_bootstrap/files.scss
index d0bf3bdd6d3..78a3f0b810d 100644
--- a/app/assets/stylesheets/gitlab_bootstrap/files.scss
+++ b/app/assets/stylesheets/gitlab_bootstrap/files.scss
@@ -49,6 +49,15 @@
&.wiki {
padding: 20px;
font-size: 13px;
+
+ .highlight {
+ margin-bottom: 9px;
+ @include border-radius(4px);
+
+ > pre {
+ margin: 0;
+ }
+ }
}
&.blob_file {
diff --git a/app/assets/stylesheets/gitlab_bootstrap/typography.scss b/app/assets/stylesheets/gitlab_bootstrap/typography.scss
index 1f0c4802318..ab14624186d 100644
--- a/app/assets/stylesheets/gitlab_bootstrap/typography.scss
+++ b/app/assets/stylesheets/gitlab_bootstrap/typography.scss
@@ -41,6 +41,10 @@ a {
color: $primary_color;
}
+ &:focus {
+ text-decoration: underline;
+ }
+
&.btn {
color: $style_color;
&:hover {
diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss
index 40f35b65da6..e8680dde507 100644
--- a/app/assets/stylesheets/sections/events.scss
+++ b/app/assets/stylesheets/sections/events.scss
@@ -53,6 +53,13 @@
margin-top: 5px;
margin-left: 40px;
+ pre {
+ border: none;
+ background: #f9f9f9;
+ border-radius: 0;
+ color: #555;
+ }
+
.note-file-attach {
.note-image-attach {
margin-top: 4px;
diff --git a/app/assets/stylesheets/sections/graph.scss b/app/assets/stylesheets/sections/graph.scss
index 58c2c203219..9be4cb788c1 100644
--- a/app/assets/stylesheets/sections/graph.scss
+++ b/app/assets/stylesheets/sections/graph.scss
@@ -11,7 +11,6 @@
.graph {
background: #f1f1f1;
- cursor: move;
height: 500px;
overflow-y: scroll;
overflow-x: hidden;
diff --git a/app/controllers/admin/background_jobs_controller.rb b/app/controllers/admin/background_jobs_controller.rb
new file mode 100644
index 00000000000..994e707965a
--- /dev/null
+++ b/app/controllers/admin/background_jobs_controller.rb
@@ -0,0 +1,4 @@
+class Admin::BackgroundJobsController < Admin::ApplicationController
+ def show
+ end
+end
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb
index 3c27b86180b..3c80b6503fa 100644
--- a/app/controllers/admin/dashboard_controller.rb
+++ b/app/controllers/admin/dashboard_controller.rb
@@ -2,8 +2,5 @@ class Admin::DashboardController < Admin::ApplicationController
def index
@projects = Project.order("created_at DESC").limit(10)
@users = User.order("created_at DESC").limit(10)
-
- rescue Redis::InheritedError
- @resque_accessible = false
end
end
diff --git a/app/controllers/admin/resque_controller.rb b/app/controllers/admin/resque_controller.rb
deleted file mode 100644
index 7d489ab4876..00000000000
--- a/app/controllers/admin/resque_controller.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class Admin::ResqueController < Admin::ApplicationController
- def show
- end
-end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 3075e7502f3..185ad181b2a 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -29,7 +29,7 @@ class Admin::UsersController < Admin::ApplicationController
def new
- @admin_user = User.new({ projects_limit: Gitlab.config.gitlab.default_projects_limit }, as: :admin)
+ @admin_user = User.new.with_defaults
end
def edit
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index dfc1fdcee8a..9bb86b80d1e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -32,7 +32,7 @@ class ApplicationController < ActionController::Base
def reject_blocked!
if current_user && current_user.blocked?
sign_out current_user
- flash[:alert] = "Your account is blocked. Retry when an admin unblock it."
+ flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it."
redirect_to new_user_session_path
end
end
@@ -40,7 +40,7 @@ class ApplicationController < ActionController::Base
def after_sign_in_path_for resource
if resource.is_a?(User) && resource.respond_to?(:blocked?) && resource.blocked?
sign_out resource
- flash[:alert] = "Your account is blocked. Retry when an admin unblock it."
+ flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it."
new_user_session_path
else
super
@@ -69,7 +69,7 @@ class ApplicationController < ActionController::Base
@project
else
@project = nil
- render_404
+ render_404 and return
end
end
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index f0d69f11184..686edd8af80 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -2,6 +2,9 @@ class ProfilesController < ApplicationController
include ActionView::Helpers::SanitizeHelper
before_filter :user
+ before_filter :authorize_change_password!, only: :update_password
+ before_filter :authorize_change_username!, only: :update_username
+
layout 'profile'
def show
@@ -53,9 +56,7 @@ class ProfilesController < ApplicationController
end
def update_username
- if @user.can_change_username?
- @user.update_attributes(username: params[:user][:username])
- end
+ @user.update_attributes(username: params[:user][:username])
respond_to do |format|
format.js
@@ -80,4 +81,12 @@ class ProfilesController < ApplicationController
user_attributes
end
+
+ def authorize_change_password!
+ return render_404 if @user.ldap_user?
+ end
+
+ def authorize_change_username!
+ return render_404 unless @user.can_change_username?
+ end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 0e05213b797..e202ed3234e 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -33,12 +33,12 @@ class ProjectsController < ProjectResourceController
end
def update
- status = ::Projects::UpdateContext.new(project, current_user, params).execute
+ status = ::Projects::UpdateContext.new(@project, current_user, params).execute
respond_to do |format|
if status
flash[:notice] = 'Project was successfully updated.'
- format.html { redirect_to edit_project_path(project), notice: 'Project was successfully updated.' }
+ format.html { redirect_to edit_project_path(@project), notice: 'Project was successfully updated.' }
format.js
else
format.html { render action: "edit" }
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 507a5c206c6..194dfcd4122 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -16,8 +16,7 @@ class RegistrationsController < Devise::RegistrationsController
def build_resource(hash=nil)
super
- self.resource.projects_limit = Gitlab.config.gitlab.default_projects_limit
- self.resource
+ self.resource.with_defaults
end
private
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb
index 25a06501e07..fcfc4c84a91 100644
--- a/app/controllers/services_controller.rb
+++ b/app/controllers/services_controller.rb
@@ -1,25 +1,21 @@
class ServicesController < ProjectResourceController
# Authorize
before_filter :authorize_admin_project!
+ before_filter :service, only: [:edit, :update, :test]
respond_to :html
def index
- @gitlab_ci_service = @project.gitlab_ci_service
+ @project.build_missing_services
+ @services = @project.services.reload
end
def edit
- @service = @project.gitlab_ci_service
-
- # Create if missing
- @service = @project.create_gitlab_ci_service unless @service
end
def update
- @service = @project.gitlab_ci_service
-
if @service.update_attributes(params[:service])
- redirect_to edit_project_service_path(@project, :gitlab_ci)
+ redirect_to edit_project_service_path(@project, @service.to_param)
else
render 'edit'
end
@@ -28,9 +24,14 @@ class ServicesController < ProjectResourceController
def test
data = GitPushService.new.sample_data(project, current_user)
- @service = project.gitlab_ci_service
@service.execute(data)
redirect_to :back
end
+
+ private
+
+ def service
+ @service ||= @project.services.find { |service| service.to_param == params[:id] }
+ end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ef90a8877ee..4c0bbf813bd 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -119,15 +119,14 @@ module ApplicationHelper
Emoji.names.to_s
end
- def ldap_enable?
- Devise.omniauth_providers.include?(:ldap)
- end
-
def app_theme
Gitlab::Theme.css_class_by_id(current_user.try(:theme_id))
end
def user_color_scheme_class
+ # in case we dont have current_user (ex. in mailer)
+ return 1 unless defined?(current_user)
+
case current_user.color_scheme_id
when 1 then 'white'
when 2 then 'black'
diff --git a/app/helpers/oauth_helper.rb b/app/helpers/oauth_helper.rb
new file mode 100644
index 00000000000..c0177dacbf8
--- /dev/null
+++ b/app/helpers/oauth_helper.rb
@@ -0,0 +1,19 @@
+module OauthHelper
+ def ldap_enabled?
+ Devise.omniauth_providers.include?(:ldap)
+ end
+
+ def default_providers
+ [:twitter, :github, :google_oauth2, :ldap]
+ end
+
+ def enabled_oauth_providers
+ Devise.omniauth_providers
+ end
+
+ def enabled_social_providers
+ enabled_oauth_providers.select do |name|
+ [:twitter, :github, :google_oauth2].include?(name.to_sym)
+ end
+ end
+end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 1db8b7c689c..9b142714980 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -44,4 +44,8 @@ module ProjectsHelper
project.name
end
end
+
+ def remove_project_message(project)
+ "You are going to remove #{project.name_with_namespace}.\n Removed project CANNOT be restored!\n Are you ABSOLUTELY sure?"
+ end
end
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index 1f764ea1038..a8491dfe3ba 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -85,4 +85,8 @@ module TreeHelper
file = File.join(tree.path, "..")
tree_join(tree.ref, file)
end
+
+ def leave_edit_message
+ "Leave edit mode?\nAll unsaved changes will be lost."
+ end
end
diff --git a/app/helpers/user_teams_helper.rb b/app/helpers/user_teams_helper.rb
index 2055bb3c8bc..8603ee434a8 100644
--- a/app/helpers/user_teams_helper.rb
+++ b/app/helpers/user_teams_helper.rb
@@ -22,5 +22,4 @@ module UserTeamsHelper
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/models/campfire_service.rb b/app/models/campfire_service.rb
new file mode 100644
index 00000000000..6450ffe7318
--- /dev/null
+++ b/app/models/campfire_service.rb
@@ -0,0 +1,76 @@
+# == Schema Information
+#
+# Table name: services
+#
+# id :integer not null, primary key
+# type :string(255)
+# title :string(255)
+# token :string(255)
+# project_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# active :boolean default(FALSE), not null
+# project_url :string(255)
+#
+
+class CampfireService < Service
+ attr_accessible :subdomain, :room
+
+ validates :token, presence: true, if: :activated?
+
+ def title
+ 'Campfire'
+ end
+
+ def description
+ 'Simple web-based real-time group chat'
+ end
+
+ def to_param
+ 'campfire'
+ end
+
+ def fields
+ [
+ { type: 'text', name: 'token', placeholder: '' },
+ { type: 'text', name: 'subdomain', placeholder: '' },
+ { type: 'text', name: 'room', placeholder: '' }
+ ]
+ end
+
+ def execute(push_data)
+ room = gate.find_room_by_name(self.room)
+ return true unless room
+
+ message = build_message(push_data)
+
+ room.speak(message)
+ end
+
+ private
+
+ def gate
+ @gate ||= Tinder::Campfire.new(subdomain, token: token)
+ end
+
+ def build_message(push)
+ ref = push[:ref].gsub("refs/heads/", "")
+ before = push[:before]
+ after = push[:after]
+
+ message = ""
+ message << "[#{project.name_with_namespace}] "
+ message << "#{push[:user_name]} "
+
+ if before =~ /000000/
+ message << "pushed new branch #{ref} \n"
+ elsif after =~ /000000/
+ message << "removed branch #{ref} \n"
+ else
+ message << "pushed #{push[:total_commits_count]} commits to #{ref}. "
+ message << "#{project.web_url}/compare/#{before}...#{after}"
+ end
+
+ message
+ end
+end
diff --git a/app/models/gitlab_ci_service.rb b/app/models/gitlab_ci_service.rb
index 9b1c707a6c9..bdbe7724be0 100644
--- a/app/models/gitlab_ci_service.rb
+++ b/app/models/gitlab_ci_service.rb
@@ -54,4 +54,23 @@ class GitlabCiService < Service
def status_img_path
project_url + "/status.png?ref=" + project.default_branch
end
+
+ def title
+ 'GitLab CI'
+ end
+
+ def description
+ 'Continuous integration server from GitLab'
+ end
+
+ def to_param
+ 'gitlab_ci'
+ end
+
+ def fields
+ [
+ { type: 'text', name: 'token', placeholder: 'GitLab CI project specific token' },
+ { type: 'text', name: 'project_url', placeholder: 'http://ci.gitlabhq.com/projects/3'}
+ ]
+ end
end
diff --git a/app/models/hipchat_service.rb b/app/models/hipchat_service.rb
new file mode 100644
index 00000000000..13429fa83b4
--- /dev/null
+++ b/app/models/hipchat_service.rb
@@ -0,0 +1,73 @@
+# == Schema Information
+#
+# Table name: services
+#
+# id :integer not null, primary key
+# type :string(255)
+# title :string(255)
+# token :string(255)
+# project_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# active :boolean default(FALSE), not null
+# project_url :string(255)
+#
+
+class HipchatService < Service
+ attr_accessible :room
+
+ validates :token, presence: true, if: :activated?
+
+ def title
+ 'Hipchat'
+ end
+
+ def description
+ 'Simple web-based real-time group chat'
+ end
+
+ def to_param
+ 'hipchat'
+ end
+
+ def fields
+ [
+ { type: 'text', name: 'token', placeholder: '' },
+ { type: 'text', name: 'room', placeholder: '' }
+ ]
+ end
+
+ def execute(push_data)
+ gate[room].send('Gitlab', create_message(push_data))
+ end
+
+ private
+
+ def gate
+ @gate ||= HipChat::Client.new(token)
+ end
+
+ def create_message(push)
+ ref = push[:ref].gsub("refs/heads/", "")
+ before = push[:before]
+ after = push[:after]
+
+ message = ""
+ message << "#{push[:user_name]} "
+ if before =~ /000000/
+ message << "pushed new branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> to <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a>\n"
+ elsif after =~ /000000/
+ message << "removed branch #{ref} from <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> \n"
+ else
+ message << "#pushed to branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> "
+ message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> "
+ message << "(<a href=\"#{project.web_url}/compare/#{before}...#{after}\">Compare changes</a>)"
+ for commit in push[:commits] do
+ message << "<br /> - #{commit[:message]} (<a href=\"#{commit[:url]}\">#{commit[:id][0..5]}</a>)"
+ end
+ end
+
+ message
+ end
+
+end \ No newline at end of file
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index c1b4d4e0760..b2ad1b76f1f 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -118,7 +118,7 @@ class MergeRequest < ActiveRecord::Base
end
def broken_diffs?
- diffs == [Gitlab::Git::Diff::BROKEN_DIFF]
+ diffs == broken_diffs
end
def valid_diffs?
@@ -214,10 +214,22 @@ class MergeRequest < ActiveRecord::Base
end
def dump_diffs(diffs)
- diffs.map(&:to_hash)
+ if diffs == broken_diffs
+ broken_diffs
+ elsif diffs.respond_to?(:map)
+ diffs.map(&:to_hash)
+ end
+ end
+
+ def load_diffs(raw)
+ if raw == broken_diffs
+ broken_diffs
+ elsif raw.respond_to?(:map)
+ raw.map { |hash| Gitlab::Git::Diff.new(hash) }
+ end
end
- def load_diffs(array)
- array.map { |hash| Gitlab::Git::Diff.new(hash) }
+ def broken_diffs
+ [Gitlab::Git::Diff::BROKEN_DIFF]
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index bd33e3a4c13..9147aed3d40 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -45,9 +45,12 @@ class Project < ActiveRecord::Base
has_one :last_event, class_name: 'Event', order: 'events.created_at DESC', foreign_key: 'project_id'
has_one :gitlab_ci_service, dependent: :destroy
+ has_one :campfire_service, dependent: :destroy
+ has_one :hipchat_service, dependent: :destroy
has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id"
has_one :forked_from_project, through: :forked_project_link
+ has_many :services, dependent: :destroy
has_many :events, dependent: :destroy
has_many :merge_requests, dependent: :destroy
has_many :issues, dependent: :destroy, order: "state DESC, created_at DESC"
@@ -223,8 +226,18 @@ class Project < ActiveRecord::Base
self.issues_enabled && !self.used_default_issues_tracker?
end
- def services
- [gitlab_ci_service].compact
+ def build_missing_services
+ available_services_names.each do |service_name|
+ service = services.find { |service| service.to_param == service_name }
+
+ # If service is available but missing in db
+ # we should create an instance. Ex `create_gitlab_ci_service`
+ service = self.send :"create_#{service_name}_service" if service.nil?
+ end
+ end
+
+ def available_services_names
+ %w(gitlab_ci campfire hipchat)
end
def gitlab_ci?
@@ -410,4 +423,28 @@ class Project < ActiveRecord::Base
def forked?
!(forked_project_link.nil? || forked_project_link.forked_from_project.nil?)
end
+
+ def rename_repo
+ old_path_with_namespace = File.join(namespace_dir, path_was)
+ new_path_with_namespace = File.join(namespace_dir, path)
+
+ if gitlab_shell.mv_repository(old_path_with_namespace, new_path_with_namespace)
+ # If repository moved successfully we need to remove old satellite
+ # and send update instructions to users.
+ # However we cannot allow rollback since we moved repository
+ # So we basically we mute exceptions in next actions
+ begin
+ gitlab_shell.rm_satellites(old_path_with_namespace)
+ send_move_instructions
+ rescue
+ # Returning false does not rolback after_* transaction but gives
+ # us information about failing some of tasks
+ false
+ end
+ else
+ # if we cannot move namespace directory we should rollback
+ # db changes in order to prevent out of sync between db and fs
+ raise Exception.new('repository cannot be renamed')
+ end
+ end
end
diff --git a/app/models/service.rb b/app/models/service.rb
index d3486d29200..3e945aa898c 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -13,6 +13,8 @@
# project_url :string(255)
#
+# To add new service you should build a class inherited from Service
+# and implement a set of methods
class Service < ActiveRecord::Base
attr_accessible :title, :token, :type, :active
@@ -24,4 +26,25 @@ class Service < ActiveRecord::Base
def activated?
active
end
+
+ def title
+ # implement inside child
+ end
+
+ def description
+ # implement inside child
+ end
+
+ def to_param
+ # implement inside child
+ end
+
+ def fields
+ # implement inside child
+ []
+ end
+
+ def execute
+ # implement inside child
+ end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 55aa5b563c5..c6dd0868ba7 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -196,6 +196,14 @@ class User < ActiveRecord::Base
username
end
+ def with_defaults
+ tap do |u|
+ 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
+ end
+ end
+
def notification
@notification ||= Notification.new(self)
end
@@ -340,4 +348,8 @@ class User < ActiveRecord::Base
nil
end
end
+
+ def ldap_user?
+ extern_uid && provider == 'ldap'
+ end
end
diff --git a/app/observers/project_observer.rb b/app/observers/project_observer.rb
index de9edf41c6d..dda7be625da 100644
--- a/app/observers/project_observer.rb
+++ b/app/observers/project_observer.rb
@@ -12,6 +12,7 @@ class ProjectObserver < BaseObserver
def after_update(project)
project.send_move_instructions if project.namespace_id_changed?
+ project.rename_repo if project.path_changed?
end
def after_destroy(project)
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb
index 132bb14a675..a52d13d5237 100644
--- a/app/services/system_hooks_service.rb
+++ b/app/services/system_hooks_service.rb
@@ -26,6 +26,7 @@ class SystemHooksService
data.merge!({
name: model.name,
path: model.path,
+ path_with_namespace: model.path_with_namespace,
project_id: model.id,
owner_name: model.owner.name,
owner_email: model.owner.email
diff --git a/app/views/admin/resque/show.html.haml b/app/views/admin/background_jobs/show.html.haml
index 499738f9a06..499738f9a06 100644
--- a/app/views/admin/resque/show.html.haml
+++ b/app/views/admin/background_jobs/show.html.haml
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml
index 46a876294ce..d3c938bb8f2 100644
--- a/app/views/admin/dashboard/index.html.haml
+++ b/app/views/admin/dashboard/index.html.haml
@@ -9,20 +9,20 @@
= link_to 'New Project', new_project_path, class: "btn btn-small"
.span4
.ui-box
- %h5.title Groups
- .data.padded
- = link_to admin_groups_path do
- %h1= Group.count
- %hr
- = link_to 'New Group', new_admin_group_path, class: "btn btn-small"
- .span4
- .ui-box
%h5.title Users
.data.padded
= link_to admin_users_path do
%h1= User.count
%hr
= link_to 'New User', new_admin_user_path, class: "btn btn-small"
+ .span4
+ .ui-box
+ %h5.title Groups
+ .data.padded
+ = link_to admin_groups_path do
+ %h1= Group.count
+ %hr
+ = link_to 'New Group', new_admin_group_path, class: "btn btn-small"
.row
.span4
diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml
index aa006dfc997..59831d83cc2 100644
--- a/app/views/admin/projects/index.html.haml
+++ b/app/views/admin/projects/index.html.haml
@@ -53,7 +53,7 @@
= link_to project.name_with_namespace, [:admin, project]
.pull-right
= link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
- = link_to 'Destroy', [project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
+ = link_to 'Destroy', [project], confirm: remove_project_message(project), method: :delete, class: "btn btn-small btn-remove"
- if @projects.blank?
%p.nothing_here_message 0 projects matches
= paginate @projects, theme: "gitlab"
diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml
index 2a0514639d5..9b16db340b2 100644
--- a/app/views/dashboard/projects.html.haml
+++ b/app/views/dashboard/projects.html.haml
@@ -45,7 +45,7 @@
= 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
diff --git a/app/views/deploy_keys/_deploy_key.html.haml b/app/views/deploy_keys/_deploy_key.html.haml
index 274015cb529..45f80ecd556 100644
--- a/app/views/deploy_keys/_deploy_key.html.haml
+++ b/app/views/deploy_keys/_deploy_key.html.haml
@@ -10,10 +10,10 @@
%i.icon-off
Disable
- else
- = link_to 'Remove', project_deploy_key_path(@project, deploy_key), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove delete-key btn-small pull-right"
+ = link_to 'Remove', project_deploy_key_path(@project, deploy_key), confirm: 'You are going to remove deploy key. Are you sure?', method: :delete, class: "btn btn-remove delete-key btn-small pull-right"
- = link_to project_deploy_key_path(@project, deploy_key) do
+ = link_to project_deploy_key_path(deploy_key.projects.include?(@project) ? @project : deploy_key.projects.first, deploy_key) do
%i.icon-key
%strong= deploy_key.title
diff --git a/app/views/deploy_keys/index.html.haml b/app/views/deploy_keys/index.html.haml
index 9e136a6b6ba..7801302d3f4 100644
--- a/app/views/deploy_keys/index.html.haml
+++ b/app/views/deploy_keys/index.html.haml
@@ -29,4 +29,4 @@
= render @available_keys
- if @available_keys.blank?
.light-well
- %p.nothing_here_message All deploy keys from projects you can manage will be displayed here
+ %p.nothing_here_message All deploy keys created in projects you own will be displayed here
diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml
new file mode 100644
index 00000000000..1ca43d5dd08
--- /dev/null
+++ b/app/views/devise/sessions/_new_base.html.haml
@@ -0,0 +1,13 @@
+= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
+ = f.text_field :login, class: "text top", placeholder: "Username or Email", autofocus: "autofocus"
+ = f.password_field :password, class: "text bottom", placeholder: "Password"
+ - if devise_mapping.rememberable?
+ .clearfix.inputs-list
+ %label.checkbox.remember_me{for: "user_remember_me"}
+ = f.check_box :remember_me
+ %span Remember me
+ = f.submit "Sign in", class: "btn-create btn"
+ .pull-right
+ = link_to "Forgot your password?", new_password_path(resource_name), class: "btn"
+
+
diff --git a/app/views/devise/sessions/_new_ldap.html.haml b/app/views/devise/sessions/_new_ldap.html.haml
index 29ba9c1e99c..575d33949b6 100644
--- a/app/views/devise/sessions/_new_ldap.html.haml
+++ b/app/views/devise/sessions/_new_ldap.html.haml
@@ -1,29 +1,5 @@
-= form_tag(user_omniauth_callback_path(:ldap), class: "login-box", id: 'new_ldap_user' ) do
- = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo"
+= form_tag(user_omniauth_callback_path(:ldap), id: 'new_ldap_user' ) do
= text_field_tag :username, nil, {class: "text top", placeholder: "LDAP Login", autofocus: "autofocus"}
= password_field_tag :password, nil, {class: "text bottom", placeholder: "Password"}
%br/
- = submit_tag "LDAP Sign in", class: "btn-primary btn"
- - if devise_mapping.omniauthable?
- - (resource_class.omniauth_providers - [:ldap]).each do |provider|
- %hr/
- = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), class: "btn btn-primary"
- %br/
- %hr/
- %a#other_form_toggle{href: "#", onclick: "javascript:$('#new_user').toggle();"} Other Sign in
- :javascript
- $(function() {
- $('#new_user').toggle();
- });
-= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "login-box" }) do |f|
- = f.text_field :login, class: "text top", placeholder: "Username or Email", autofocus: "autofocus"
- = f.password_field :password, class: "text bottom", placeholder: "Password"
- - if devise_mapping.rememberable?
- .clearfix.inputs-list
- %label.checkbox.remember_me{for: "user_remember_me"}
- = f.check_box :remember_me
- %span Remember me
- %br/
- = f.submit "Sign in", class: "btn-primary btn"
- .pull-right
- = render partial: "devise/shared/links"
+ = submit_tag "LDAP Sign in", class: "btn-create btn"
diff --git a/app/views/devise/sessions/_oauth_providers.html.haml b/app/views/devise/sessions/_oauth_providers.html.haml
new file mode 100644
index 00000000000..710a5d52514
--- /dev/null
+++ b/app/views/devise/sessions/_oauth_providers.html.haml
@@ -0,0 +1,10 @@
+- if enabled_oauth_providers.present?
+ %hr
+ %div{:'data-no-turbolink' => 'data-no-turbolink'}
+ %span Sign in with: &nbsp;
+ - (enabled_oauth_providers - [:ldap]).each do |provider|
+ %span
+ - if default_providers.include?(provider)
+ = link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider)
+ - else
+ = link_to provider.to_s.titleize, omniauth_authorize_path(resource_name, provider), class: "btn"
diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml
index baa232350a5..8b71ebed5f4 100644
--- a/app/views/devise/sessions/new.html.haml
+++ b/app/views/devise/sessions/new.html.haml
@@ -1,32 +1,31 @@
-- if ldap_enable?
- = render partial: 'devise/sessions/new_ldap'
-- else
- = form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "login-box" }) do |f|
- = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo"
- = f.text_field :login, class: "text top", placeholder: "Username or Email", autofocus: "autofocus"
- = f.password_field :password, class: "text bottom", placeholder: "Password"
- - if devise_mapping.rememberable?
- .clearfix.inputs-list
- %label.checkbox.remember_me{for: "user_remember_me"}
- = f.check_box :remember_me
- %span Remember me
- %br/
- = f.submit "Sign in", class: "btn-create btn"
- .pull-right
- = link_to "Forgot your password?", new_password_path(resource_name), class: "btn"
- %br/
- - if Gitlab.config.gitlab.signup_enabled
- %hr/
+.login-box
+ = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo"
+
+ - 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'
+ .tab-content
+ %div#tab-ldap.tab-pane.active
+ = render partial: 'devise/sessions/new_ldap'
+ %div#tab-signin.tab-pane
+ = render partial: 'devise/sessions/new_base'
+
+ - else
+ = render partial: 'devise/sessions/new_base'
+
+
+ = render 'devise/sessions/oauth_providers' if devise_mapping.omniauthable?
+
+ - if Gitlab.config.gitlab.signup_enabled
+ %hr
+ %div
Don't have an account?
- = link_to "Sign up", new_registration_path(resource_name)
- - if devise_mapping.omniauthable? && resource_class.omniauth_providers.present?
- %hr
- %div
- %span Sign in with: &nbsp;
- - resource_class.omniauth_providers.each do |provider|
- %span
- = link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider)
+ %strong
+ = link_to "Sign up", new_registration_path(resource_name)
- - if extra_config.has_key?('sign_in_text')
- %hr
- = markdown(extra_config.sign_in_text)
+ - if extra_config.has_key?('sign_in_text')
+ %hr
+ = markdown(extra_config.sign_in_text)
diff --git a/app/views/edit_tree/show.html.haml b/app/views/edit_tree/show.html.haml
index 509205436ea..17d813ce75e 100644
--- a/app/views/edit_tree/show.html.haml
+++ b/app/views/edit_tree/show.html.haml
@@ -10,7 +10,7 @@
%strong= @ref
%span.options
.btn-group.tree-btn-group
- = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: "Are you sure?"
+ = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: leave_edit_message
.file_content.code
%pre#editor= @blob.data
@@ -27,7 +27,7 @@
.message
to branch
%strong= @ref
- = link_to "Cancel", project_tree_path(@project, @id), class: "btn btn-cancel", confirm: "Are you sure?"
+ = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-cancel", confirm: leave_edit_message
:javascript
ace.config.set("modePath", "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict")
diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml
index eb4f324b358..0f8c140c067 100644
--- a/app/views/groups/edit.html.haml
+++ b/app/views/groups/edit.html.haml
@@ -26,7 +26,7 @@
.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.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
+ = 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
diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml
index 7bda5cb6027..1685c6eec53 100644
--- a/app/views/help/index.html.haml
+++ b/app/views/help/index.html.haml
@@ -27,6 +27,8 @@
%li
Ask in our
= link_to "support forum", "https://groups.google.com/forum/#!forum/gitlabhq"
+ or on
+ = link_to "Stack Overflow", "http://stackoverflow.com/questions/tagged/gitlab"
%li
Browse our
= link_to "issue tracker", "https://github.com/gitlabhq/gitlabhq/issues"
diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml
index b32d9192afc..2bb5e6ca5ac 100644
--- a/app/views/issues/_form.html.haml
+++ b/app/views/issues/_form.html.haml
@@ -19,7 +19,9 @@
= 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 a user" }, {class: 'chosen'})
+ .input
+ = f.select(:assignee_id, @project.users.alphabetically.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'})
+ = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
.issue_milestone.pull-left
= f.label :milestone_id do
%i.icon-time
@@ -55,31 +57,33 @@
:javascript
- $(function(){
- $("#issue_label_list")
- .bind( "keydown", function( event ) {
- if ( event.keyCode === $.ui.keyCode.TAB &&
- $( this ).data( "autocomplete" ).menu.active ) {
- event.preventDefault();
- }
- })
- .autocomplete({
- minLength: 0,
- source: function( request, response ) {
- response( $.ui.autocomplete.filter(
- #{raw labels_autocomplete_source}, extractLast( request.term ) ) );
- },
- focus: function() {
- return false;
- },
- select: function(event, ui) {
- var terms = split( this.value );
- terms.pop();
- terms.push( ui.item.value );
- terms.push( "" );
- this.value = terms.join( ", " );
- return false;
- }
- });
- });
+ $("#issue_label_list")
+ .bind( "keydown", function( event ) {
+ if ( event.keyCode === $.ui.keyCode.TAB &&
+ $( this ).data( "autocomplete" ).menu.active ) {
+ event.preventDefault();
+ }
+ })
+ .autocomplete({
+ minLength: 0,
+ source: function( request, response ) {
+ response( $.ui.autocomplete.filter(
+ #{raw labels_autocomplete_source}, extractLast( request.term ) ) );
+ },
+ focus: function() {
+ return false;
+ },
+ select: function(event, ui) {
+ var terms = split( this.value );
+ terms.pop();
+ terms.push( ui.item.value );
+ terms.push( "" );
+ this.value = terms.join( ", " );
+ return false;
+ }
+ });
+ $('.assign-to-me-link').on('click', function(e){
+ $('#issue_assignee_id').val("#{current_user.id}").trigger("liszt:updated");
+ e.preventDefault();
+ });
diff --git a/app/views/layouts/_google_analytics.html.haml b/app/views/layouts/_google_analytics.html.haml
index 1452651e1c0..81e03c7eff2 100644
--- a/app/views/layouts/_google_analytics.html.haml
+++ b/app/views/layouts/_google_analytics.html.haml
@@ -1,6 +1,6 @@
:javascript
var _gaq = _gaq || [];
- _gaq.push(['_setAccount', '#{gitlab_config.google_analytics_id}']);
+ _gaq.push(['_setAccount', '#{extra_config.google_analytics_id}']);
_gaq.push(['_trackPageview']);
(function() {
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index 637b2987ff8..0775abea3dd 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -9,7 +9,7 @@
= csrf_meta_tags
= include_gon
- = render 'layouts/google_analytics' if gitlab_config.has_key?('google_analytics_id')
+ = render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id')
-# Atom feed
- if current_user
diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml
index ca77c26e23d..e9ca29ea3be 100644
--- a/app/views/layouts/nav/_admin.html.haml
+++ b/app/views/layouts/nav/_admin.html.haml
@@ -14,6 +14,6 @@
= link_to "Logs", admin_logs_path
= nav_link(controller: :hooks) do
= link_to "Hooks", admin_hooks_path
- = nav_link(controller: :resque) do
- = link_to "Background Jobs", admin_resque_path
+ = nav_link(controller: :background_jobs) do
+ = link_to "Background Jobs", admin_background_jobs_path
diff --git a/app/views/merge_requests/show/_diffs.html.haml b/app/views/merge_requests/show/_diffs.html.haml
index 0807454c4b0..033d66a4ad4 100644
--- a/app/views/merge_requests/show/_diffs.html.haml
+++ b/app/views/merge_requests/show/_diffs.html.haml
@@ -4,7 +4,7 @@
%h4.nothing_here_message
Can't load diff.
You can
- = link_to "download it", project_merge_request_path(@project, @merge_request), format: :diff, class: "vlink"
+ = link_to "download it", project_merge_request_path(@project, @merge_request, format: :diff), class: "vlink"
instead.
- else
%h4.nothing_here_message Nothing to merge
diff --git a/app/views/milestones/index.html.haml b/app/views/milestones/index.html.haml
index 89892cd23f1..fb7cbc41edf 100644
--- a/app/views/milestones/index.html.haml
+++ b/app/views/milestones/index.html.haml
@@ -21,12 +21,12 @@
= link_to project_milestones_path(@project, f: "all") do
All
.span9
- %div.ui-box
+ .ui-box
%ul.well-list
= render @milestones
- - if @milestones.present?
- %li.bottom= paginate @milestones, theme: "gitlab"
- - else
+ - if @milestones.blank?
%li
%h3.nothing_here_message Nothing to show here
+
+ = paginate @milestones, theme: "gitlab"
diff --git a/app/views/notify/new_user_email.html.haml b/app/views/notify/new_user_email.html.haml
index 4ad3f201495..9804fbdd51e 100644
--- a/app/views/notify/new_user_email.html.haml
+++ b/app/views/notify/new_user_email.html.haml
@@ -12,5 +12,9 @@
- unless Gitlab.config.gitlab.signup_enabled
password..................................
%code= @password
+
+%p
+ Please change your password immediately after login.
+
%p
= link_to "Click here to login", root_url
diff --git a/app/views/notify/new_user_email.text.erb b/app/views/notify/new_user_email.text.erb
index 181ed2d2a49..777930a2803 100644
--- a/app/views/notify/new_user_email.text.erb
+++ b/app/views/notify/new_user_email.text.erb
@@ -7,4 +7,6 @@ login.................. <%= @user.email %>
password............... <%= @password %>
<% end %>
+Please change your password immediately after login.
+
Click here to login: <%= url_for(root_url) %>
diff --git a/app/views/profiles/account.html.haml b/app/views/profiles/account.html.haml
index 16d26c0d8e1..09d9ec10e81 100644
--- a/app/views/profiles/account.html.haml
+++ b/app/views/profiles/account.html.haml
@@ -1,11 +1,35 @@
-- if Gitlab.config.omniauth.enabled
- %fieldset
- %legend Social Accounts
- .oauth_select_holder
- %p.hint Tip: Click on icon to activate sigin with one of the following services
- - User.omniauth_providers.each do |provider|
- %span{class: oauth_active_class(provider) }
- = link_to authbutton(provider, 32), omniauth_authorize_path(User, provider)
+- unless current_user.ldap_user?
+ - if Gitlab.config.omniauth.enabled
+ %fieldset
+ %legend Social Accounts
+ .oauth_select_holder
+ %p.hint Tip: Click on icon to activate sigin 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)
+
+
+ %fieldset.update-password
+ %legend Password
+ = form_for @user, url: update_password_profile_path, method: :put do |f|
+ .padded
+ %p.slead After successful password update you will be redirected to login page where you should login with new password
+ -if @user.errors.any?
+ .alert.alert-error
+ %ul
+ - @user.errors.full_messages.each do |msg|
+ %li= msg
+
+ .clearfix
+ = f.label :password
+ .input= f.password_field :password, required: true
+ .clearfix
+ = f.label :password_confirmation
+ .input
+ = f.password_field :password_confirmation, required: true
+ .clearfix
+ .input
+ = f.submit 'Save password', class: "btn btn-save"
@@ -29,29 +53,6 @@
%span You don`t have one yet. Click generate to fix it.
= f.submit 'Generate', class: "btn success btn-build-token"
-%fieldset.update-password
- %legend Password
- = form_for @user, url: update_password_profile_path, method: :put do |f|
- .padded
- %p.slead After successful password update you will be redirected to login page where you should login with new password
- -if @user.errors.any?
- .alert.alert-error
- %ul
- - @user.errors.full_messages.each do |msg|
- %li= msg
-
- .clearfix
- = f.label :password
- .input= f.password_field :password, required: true
- .clearfix
- = f.label :password_confirmation
- .input
- = f.password_field :password_confirmation, required: true
- .clearfix
- .input
- = f.submit 'Save password', class: "btn btn-save"
-
-
- if current_user.can_change_username?
%fieldset.update-username
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index dd087100e4c..bec64bf6c58 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -11,6 +11,8 @@
%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'
@@ -137,6 +139,24 @@
- 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
@@ -147,7 +167,7 @@
%p
%strong Removed project can not be restored!
- = link_to 'Remove project', @project, confirm: 'Removed project can not be restored! Are you sure?', method: :delete, class: "btn btn-remove btn-small"
+ = 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
diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml
index b1795b301b0..56dbbf0755e 100644
--- a/app/views/projects/empty.html.haml
+++ b/app/views/projects/empty.html.haml
@@ -31,4 +31,4 @@
- if can? current_user, :remove_project, @project
.prepend-top-20
- = link_to 'Remove project', @project, confirm: 'Are you sure?', method: :delete, class: "btn btn-remove pull-right"
+ = link_to 'Remove project', @project, confirm: remove_project_message(@project), method: :delete, class: "btn btn-remove pull-right"
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 8a095130159..b2e9fd8431a 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -38,7 +38,7 @@
%hr
%p
%p Repo Size: #{@project.repository.size} MB
- %p Created at: #{@project.created_at.stamp('Aug 22, 2013')}
+ %p Created on: #{@project.created_at.stamp('Aug 22, 2013')}
%p Owner: #{link_to @project.owner_name, @project.owner}
- if @project.forked_from_project
%p
diff --git a/app/views/protected_branches/index.html.haml b/app/views/protected_branches/index.html.haml
index 15644de552f..a338344c52d 100644
--- a/app/views/protected_branches/index.html.haml
+++ b/app/views/protected_branches/index.html.haml
@@ -51,4 +51,4 @@
(branch was removed from repository)
%td
- if can? current_user, :admin_project, @project
- = link_to 'Unprotect', [@project, branch], confirm: 'Are you sure?', method: :delete, class: "btn btn-remove btn-small"
+ = link_to 'Unprotect', [@project, branch], confirm: 'Branch will be writable for developers. Are you sure?', method: :delete, class: "btn btn-remove btn-small"
diff --git a/app/views/services/_form.html.haml b/app/views/services/_form.html.haml
new file mode 100644
index 00000000000..ff6769531c4
--- /dev/null
+++ b/app/views/services/_form.html.haml
@@ -0,0 +1,48 @@
+%h3.page_title
+ - if @service.activated?
+ %span.cgreen
+ %i.icon-circle
+ - else
+ %span.cgray
+ %i.icon-circle-blank
+ = @service.title
+
+%p= @service.description
+
+.back_link
+ = link_to project_services_path(@project) do
+ &larr; to services
+
+%hr
+
+= form_for(@service, as: :service, url: project_service_path(@project, @service.to_param), method: :put) do |f|
+ - if @service.errors.any?
+ .alert.alert-error
+ %ul
+ - @service.errors.full_messages.each do |msg|
+ %li= msg
+
+
+ .control-group
+ = f.label :active, "Active", class: "control-label"
+ .controls
+ = f.check_box :active
+
+ - @service.fields.each do |field|
+ - name = field[:name]
+ - type = field[:type]
+ - placeholder = field[:placeholder]
+
+ .control-group
+ = f.label name, class: "control-label"
+ .controls
+ - if type == 'text'
+ = f.text_field name, class: "input-xlarge", placeholder: placeholder
+ - elsif type == 'checkbox'
+ = f.check_box name
+
+ .form-actions
+ = f.submit 'Save', class: 'btn btn-save'
+ &nbsp;
+ - if @service.valid? && @service.activated?
+ = link_to 'Test settings', test_project_service_path(@project, @service.to_param), class: 'btn btn-small'
diff --git a/app/views/services/_gitlab_ci.html.haml b/app/views/services/_gitlab_ci.html.haml
deleted file mode 100644
index dfde643849e..00000000000
--- a/app/views/services/_gitlab_ci.html.haml
+++ /dev/null
@@ -1,46 +0,0 @@
-%h3.page_title
- GitLab CI
- %small Continuous integration server from GitLab
- .pull-right
- - if @service.active
- %small.cgreen Enabled
- - else
- %small.cgray Disabled
-
-
-
-.back_link
- = link_to project_services_path(@project) do
- &larr; to services
-
-%hr
-= form_for(@service, :as => :service, :url => project_service_path(@project, :gitlab_ci), :method => :put) do |f|
- - if @service.errors.any?
- .alert.alert-error
- %ul
- - @service.errors.full_messages.each do |msg|
- %li= msg
-
-
- .control-group
- = f.label :active, "Active", class: "control-label"
- .controls
- = f.check_box :active
-
- .control-group
- = f.label :project_url, "Project URL", class: "control-label"
- .controls
- = f.text_field :project_url, class: "input-xlarge", placeholder: "http://ci.gitlabhq.com/projects/3"
-
- .control-group
- = f.label :token, class: "control-label" do
- CI Project token
- .controls
- = f.text_field :token, class: "input-xlarge", placeholder: "GitLab CI project specific token"
-
-
- .form-actions
- = f.submit 'Save', class: 'btn btn-save'
- &nbsp;
- - if @service.valid? && @service.active
- = link_to 'Test settings', test_project_service_path(@project), class: 'btn btn-small'
diff --git a/app/views/services/edit.html.haml b/app/views/services/edit.html.haml
index 0c63a7ed58c..d4bc9e41c27 100644
--- a/app/views/services/edit.html.haml
+++ b/app/views/services/edit.html.haml
@@ -1,3 +1,3 @@
= render "projects/settings_nav"
-= render 'gitlab_ci'
+= render 'form'
diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml
index eb2f8d0ca1c..bd52948a6fd 100644
--- a/app/views/services/index.html.haml
+++ b/app/views/services/index.html.haml
@@ -3,30 +3,16 @@
%h3.page_title Services
%br
-%ul.ui-box.well-list
- %li
- %h4.cgreen
- = link_to edit_project_service_path(@project, :gitlab_ci) do
- GitLab CI
- %small Continuous integration server from GitLab
- .pull-right
- - if @gitlab_ci_service.try(:active)
- %small.cgreen
- %i.icon-ok
- Enabled
+%ul.bordered-list
+ - @services.each do |service|
+ %li
+ %h4
+ - if service.activated?
+ %span.cgreen
+ %i.icon-circle
- else
- %small.cgray
- %i.icon-off
- Disabled
- %li.disabled
- %h4
- Jenkins CI
- %small An extendable open source continuous integration server
- .pull-right
- %small Not implemented yet
- %li.disabled
- %h4
- Campfire
- %small Web-based group chat tool
- .pull-right
- %small Not implemented yet
+ %span.cgray
+ %i.icon-circle-blank
+ = link_to edit_project_service_path(@project, service.to_param) do
+ = service.title
+ %p= service.description
diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml
index 77162cdcde3..993a20058c6 100644
--- a/app/views/snippets/_form.html.haml
+++ b/app/views/snippets/_form.html.haml
@@ -30,7 +30,7 @@
= f.submit 'Save', class: "btn-save btn"
= link_to "Cancel", project_snippets_path(@project), class: " btn"
- unless @snippet.new_record?
- .pull-right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}"
+ .pull-right= link_to 'Destroy', [@project, @snippet], confirm: 'Removed snippet cannot be restored! Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}"
:javascript