Commit 46549992 authored by Marin Jankovski's avatar Marin Jankovski

Merge branch 'master' into relative_links_in_documentation

parents 5b23a7bb e8d1e827
...@@ -13,6 +13,7 @@ v 6.2.0 ...@@ -13,6 +13,7 @@ v 6.2.0
- Rake tasks for web hooks management (Jonhnny Weslley) - Rake tasks for web hooks management (Jonhnny Weslley)
- Extended User API to expose admin and can_create_group for user creation/updating (Boyan Tabakov) - Extended User API to expose admin and can_create_group for user creation/updating (Boyan Tabakov)
- API: Remove group - API: Remove group
- Avatar upload on profile page with a maximum of 200KB (Steven Thonus)
v 6.1.0 v 6.1.0
- Project specific IDs for issues, mr, milestones - Project specific IDs for issues, mr, milestones
......
...@@ -16,6 +16,7 @@ gem "pg", group: :postgres ...@@ -16,6 +16,7 @@ gem "pg", group: :postgres
# Auth # Auth
gem "devise", '~> 2.2' gem "devise", '~> 2.2'
gem "devise-async"
gem 'omniauth', "~> 1.1.3" gem 'omniauth', "~> 1.1.3"
gem 'omniauth-google-oauth2' gem 'omniauth-google-oauth2'
gem 'omniauth-twitter' gem 'omniauth-twitter'
......
...@@ -106,6 +106,8 @@ GEM ...@@ -106,6 +106,8 @@ GEM
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (~> 3.1) railties (~> 3.1)
warden (~> 1.2.1) warden (~> 1.2.1)
devise-async (0.8.0)
devise (>= 2.2, < 3.2)
diff-lcs (1.2.4) diff-lcs (1.2.4)
dotenv (0.8.0) dotenv (0.8.0)
email_spec (1.4.0) email_spec (1.4.0)
...@@ -564,6 +566,7 @@ DEPENDENCIES ...@@ -564,6 +566,7 @@ DEPENDENCIES
d3_rails (~> 3.1.4) d3_rails (~> 3.1.4)
database_cleaner database_cleaner
devise (~> 2.2) devise (~> 2.2)
devise-async
email_spec email_spec
enumerize enumerize
factory_girl_rails factory_girl_rails
......
...@@ -16,3 +16,13 @@ $ -> ...@@ -16,3 +16,13 @@ $ ->
$('.update-notifications').on 'ajax:complete', -> $('.update-notifications').on 'ajax:complete', ->
$(this).find('.btn-save').enableButton() $(this).find('.btn-save').enableButton()
$('.js-choose-user-avatar-button').bind "click", ->
form = $(this).closest("form")
form.find(".js-user-avatar-input").click()
$('.js-user-avatar-input').bind "change", ->
form = $(this).closest("form")
filename = $(this).val().replace(/^.*[\\\/]/, '')
form.find(".js-avatar-filename").text(filename)
$ -> $ ->
userFormatResult = (user) -> userFormatResult = (user) ->
if user.avatar
avatar = user.avatar.url
else
avatar = gon.gravatar_url avatar = gon.gravatar_url
avatar = avatar.replace('%{hash}', md5(user.email)) avatar = avatar.replace('%{hash}', md5(user.email))
avatar = avatar.replace('%{size}', '24') avatar = avatar.replace('%{size}', '24')
markup = "<div class='user-result'>" markup = "<div class='user-result'>"
markup += "<div class='user-image'><img class='avatar s24' src='" + avatar + "'></div>" markup += "<div class='user-image'><img class='avatar s24' src='" + avatar + "'></div>"
markup += "<div class='user-name'>" + user.name + "</div>" markup += "<div class='user-name'>" + user.name + "</div>"
......
...@@ -270,27 +270,6 @@ li.note { ...@@ -270,27 +270,6 @@ li.note {
} }
} }
.oauth_select_holder {
padding: 20px;
img {
padding: 5px;
margin-right: 10px;
}
.active {
img {
border: 1px solid #ccc;
background: $hover;
@include border-radius(5px);
}
}
}
.btn-build-token {
float: left;
padding: 6px 20px;
margin-right: 12px;
}
.gitlab-promo { .gitlab-promo {
a { a {
color: #aaa; color: #aaa;
......
...@@ -19,4 +19,5 @@ ...@@ -19,4 +19,5 @@
&.s32 { width: 32px; height: 32px; margin-right: 10px; } &.s32 { width: 32px; height: 32px; margin-right: 10px; }
&.s60 { width: 60px; height: 60px; margin-right: 12px; } &.s60 { width: 60px; height: 60px; margin-right: 12px; }
&.s90 { width: 90px; height: 90px; margin-right: 15px; } &.s90 { width: 90px; height: 90px; margin-right: 15px; }
&.s160 { width: 160px; height: 160px; margin-right: 20px; }
} }
...@@ -4,3 +4,41 @@ ...@@ -4,3 +4,41 @@
margin-bottom: 0; margin-bottom: 0;
} }
} }
.account-page {
fieldset {
margin-bottom: 15px;
border-bottom: 1px dashed #ddd;
padding-bottom: 15px;
&:last-child {
border: none;
}
legend {
border: none;
margin: 0;
}
}
}
.oauth_select_holder {
img {
padding: 2px;
margin-right: 10px;
}
.active {
img {
border: 1px solid #4BD;
background: $hover;
@include border-radius(5px);
}
}
}
.btn-build-token {
float: left;
padding: 6px 20px;
margin-right: 12px;
}
class Profiles::AccountsController < ApplicationController
layout "profile"
def show
@user = current_user
end
end
class Profiles::PasswordsController < ApplicationController class Profiles::PasswordsController < ApplicationController
layout 'navless' layout :determine_layout
skip_before_filter :check_password_expiration skip_before_filter :check_password_expiration, only: [:new, :create]
before_filter :set_user before_filter :set_user
before_filter :set_title before_filter :set_title
before_filter :authorize_change_password!
def new def new
end end
...@@ -26,6 +27,32 @@ class Profiles::PasswordsController < ApplicationController ...@@ -26,6 +27,32 @@ class Profiles::PasswordsController < ApplicationController
end end
end end
def edit
end
def update
password_attributes = params[:user].select do |key, value|
%w(password password_confirmation).include?(key.to_s)
end
unless @user.valid_password?(params[:user][:current_password])
redirect_to edit_profile_password_path, alert: 'You must provide a valid current password'
return
end
if @user.update_attributes(password_attributes)
flash[:notice] = "Password was successfully updated. Please login with it"
redirect_to new_user_session_path
else
render 'edit'
end
end
def reset
current_user.send_reset_password_instructions
redirect_to edit_profile_password_path, notice: 'We sent you an email with reset password instructions'
end
private private
def set_user def set_user
...@@ -35,4 +62,16 @@ class Profiles::PasswordsController < ApplicationController ...@@ -35,4 +62,16 @@ class Profiles::PasswordsController < ApplicationController
def set_title def set_title
@title = "New password" @title = "New password"
end end
def determine_layout
if [:new, :create].include?(action_name.to_sym)
'navless'
else
'profile'
end
end
def authorize_change_password!
return render_404 if @user.ldap_user?
end
end end
...@@ -2,7 +2,6 @@ class ProfilesController < ApplicationController ...@@ -2,7 +2,6 @@ class ProfilesController < ApplicationController
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
before_filter :user before_filter :user
before_filter :authorize_change_password!, only: :update_password
before_filter :authorize_change_username!, only: :update_username before_filter :authorize_change_username!, only: :update_username
layout 'profile' layout 'profile'
...@@ -13,9 +12,6 @@ class ProfilesController < ApplicationController ...@@ -13,9 +12,6 @@ class ProfilesController < ApplicationController
def design def design
end end
def account
end
def update def update
if @user.update_attributes(params[:user]) if @user.update_attributes(params[:user])
flash[:notice] = "Profile was successfully updated" flash[:notice] = "Profile was successfully updated"
...@@ -29,33 +25,12 @@ class ProfilesController < ApplicationController ...@@ -29,33 +25,12 @@ class ProfilesController < ApplicationController
end end
end end
def token
end
def update_password
password_attributes = params[:user].select do |key, value|
%w(password password_confirmation).include?(key.to_s)
end
unless @user.valid_password?(params[:user][:current_password])
redirect_to account_profile_path, alert: 'You must provide a valid current password'
return
end
if @user.update_attributes(password_attributes)
flash[:notice] = "Password was successfully updated. Please login with it"
redirect_to new_user_session_path
else
render 'account'
end
end
def reset_private_token def reset_private_token
if current_user.reset_authentication_token! if current_user.reset_authentication_token!
flash[:notice] = "Token was successfully updated" flash[:notice] = "Token was successfully updated"
end end
redirect_to account_profile_path redirect_to profile_account_path
end end
def history def history
...@@ -76,10 +51,6 @@ class ProfilesController < ApplicationController ...@@ -76,10 +51,6 @@ class ProfilesController < ApplicationController
@user = current_user @user = current_user
end end
def authorize_change_password!
return render_404 if @user.ldap_user?
end
def authorize_change_username! def authorize_change_username!
return render_404 unless @user.can_change_username? return render_404 unless @user.can_change_username?
end end
......
...@@ -49,6 +49,15 @@ module ApplicationHelper ...@@ -49,6 +49,15 @@ module ApplicationHelper
args.any? { |v| v.to_s.downcase == action_name } args.any? { |v| v.to_s.downcase == action_name }
end end
def avatar_icon(user_email = '', size = nil)
user = User.find_by_email(user_email)
if user && user.avatar.present?
user.avatar.url
else
gravatar_icon(user_email, size)
end
end
def gravatar_icon(user_email = '', size = nil) def gravatar_icon(user_email = '', size = nil)
size = 40 if size.nil? || size <= 0 size = 40 if size.nil? || size <= 0
......
...@@ -108,7 +108,7 @@ module CommitsHelper ...@@ -108,7 +108,7 @@ module CommitsHelper
source_name = commit.send "#{options[:source]}_name".to_sym source_name = commit.send "#{options[:source]}_name".to_sym
source_email = commit.send "#{options[:source]}_email".to_sym source_email = commit.send "#{options[:source]}_email".to_sym
text = if options[:avatar] text = if options[:avatar]
avatar = image_tag(gravatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "") avatar = image_tag(avatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "")
%Q{#{avatar} <span class="commit-#{options[:source]}-name">#{source_name}</span>} %Q{#{avatar} <span class="commit-#{options[:source]}-name">#{source_name}</span>}
else else
source_name source_name
......
...@@ -5,10 +5,10 @@ module ProjectsHelper ...@@ -5,10 +5,10 @@ module ProjectsHelper
def link_to_project project def link_to_project project
link_to project do link_to project do
title = content_tag(:strong, project.name) title = content_tag(:span, project.name, class: 'projet-name')
if project.namespace if project.namespace
namespace = content_tag(:span, "#{project.namespace.human_name} / ", class: 'tiny') namespace = content_tag(:span, "#{project.namespace.human_name} / ", class: 'namespace-name')
title = namespace + title title = namespace + title
end end
...@@ -25,7 +25,7 @@ module ProjectsHelper ...@@ -25,7 +25,7 @@ module ProjectsHelper
author_html = "" author_html = ""
# Build avatar image tag # Build avatar image tag
author_html << image_tag(gravatar_icon(author.try(:email), opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt:'') if opts[:avatar] author_html << image_tag(avatar_icon(author.try(:email), opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt:'') if opts[:avatar]
# Build name span tag # Build name span tag
author_html << content_tag(:span, sanitize(author.name), class: 'author') if opts[:name] author_html << content_tag(:span, sanitize(author.name), class: 'author') if opts[:name]
...@@ -80,6 +80,18 @@ module ProjectsHelper ...@@ -80,6 +80,18 @@ module ProjectsHelper
@project.milestones.active.order("id desc").all @project.milestones.active.order("id desc").all
end end
def project_issues_trackers
values = Project.issues_tracker.values.map do |tracker_key|
if tracker_key.to_sym == :gitlab
['GitLab', tracker_key]
else
[Gitlab.config.issues_tracker[tracker_key]['title'] || tracker_key, tracker_key]
end
end
options_for_select(values)
end
private private
def get_project_nav_tabs(project, current_user) def get_project_nav_tabs(project, current_user)
...@@ -119,4 +131,13 @@ module ProjectsHelper ...@@ -119,4 +131,13 @@ module ProjectsHelper
"your@email.com" "your@email.com"
end end
end end
def repository_size
"#{@project.repository.size} MB"
rescue
# In order to prevent 500 error
# when application cannot allocate memory
# to calculate repo size - just show 'Unknown'
'unknown'
end
end end
...@@ -38,13 +38,16 @@ ...@@ -38,13 +38,16 @@
# created_by_id :integer # created_by_id :integer
# #
require 'carrierwave/orm/activerecord'
require 'file_size_validator'
class User < ActiveRecord::Base class User < ActiveRecord::Base
devise :database_authenticatable, :token_authenticatable, :lockable, devise :database_authenticatable, :token_authenticatable, :lockable, :async,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable, :registerable :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :registerable
attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
:skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password, :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password,
:extern_uid, :provider, :password_expires_at, :extern_uid, :provider, :password_expires_at, :avatar,
as: [:default, :admin] as: [:default, :admin]
attr_accessible :projects_limit, :can_create_group, attr_accessible :projects_limit, :can_create_group,
...@@ -113,6 +116,8 @@ class User < ActiveRecord::Base ...@@ -113,6 +116,8 @@ class User < ActiveRecord::Base
validate :namespace_uniq, if: ->(user) { user.username_changed? } validate :namespace_uniq, if: ->(user) { user.username_changed? }
validates :avatar, file_size: { maximum: 100.kilobytes.to_i }
before_validation :generate_password, on: :create before_validation :generate_password, on: :create
before_validation :sanitize_attrs before_validation :sanitize_attrs
...@@ -150,6 +155,8 @@ class User < ActiveRecord::Base ...@@ -150,6 +155,8 @@ class User < ActiveRecord::Base
end end
end end
mount_uploader :avatar, AttachmentUploader
# Scopes # Scopes
scope :admins, -> { where(admin: true) } scope :admins, -> { where(admin: true) }
scope :blocked, -> { with_state(:blocked) } scope :blocked, -> { with_state(:blocked) }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
.title .title
Account: Account:
.pull-right .pull-right
= image_tag gravatar_icon(@user.email, 32), class: "avatar s32" = image_tag avatar_icon(@user.email, 32), class: "avatar s32"
%ul.well-list %ul.well-list
%li %li
%span.light Name: %span.light Name:
...@@ -117,11 +117,7 @@ ...@@ -117,11 +117,7 @@
- tm = project.team.find_tm(@user.id) - tm = project.team.find_tm(@user.id)
%li.users_project %li.users_project
= link_to admin_project_path(project), class: dom_class(project) do = link_to admin_project_path(project), class: dom_class(project) do
- if project.namespace = project.name_with_namespace
= project.namespace.human_name
\/
%strong.well-title
= truncate(project.name, length: 45)
- if tm - if tm
.pull-right .pull-right
......
...@@ -12,7 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear ...@@ -12,7 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
xml.link :href => project_issue_url(issue.project, issue) xml.link :href => project_issue_url(issue.project, issue)
xml.title truncate(issue.title, :length => 80) xml.title truncate(issue.title, :length => 80)
xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ")
xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(issue.author_email) xml.media :thumbnail, :width => "40", :height => "40", :url => avatar_icon(issue.author_email)
xml.author do |author| xml.author do |author|
xml.name issue.author_name xml.name issue.author_name
xml.email issue.author_email xml.email issue.author_email
......
...@@ -17,7 +17,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear ...@@ -17,7 +17,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
xml.link :href => event_link xml.link :href => event_link
xml.title truncate(event_title, :length => 80) xml.title truncate(event_title, :length => 80)
xml.updated event.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") 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.media :thumbnail, :width => "40", :height => "40", :url => avatar_icon(event.author_email)
xml.author do |author| xml.author do |author|
xml.name event.author_name xml.name event.author_name
xml.email event.author_email xml.email event.author_email
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#{time_ago_in_words(event.created_at)} ago. #{time_ago_in_words(event.created_at)} ago.
= cache event do = cache event do
= image_tag gravatar_icon(event.author_email), class: "avatar s24", alt:'' = image_tag avatar_icon(event.author_email), class: "avatar s24", alt:''
- if event.push? - if event.push?
= render "events/event/push", event: event = render "events/event/push", event: event
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
= link_to project_commits_path(event.project, event.ref_name) do = link_to project_commits_path(event.project, event.ref_name) do
%strong= truncate(event.ref_name, length: 30) %strong= truncate(event.ref_name, length: 30)
at at
%strong= link_to_project event.project = link_to_project event.project
- if event.push_with_commits? - if event.push_with_commits?
- project = event.project - project = event.project
......
...@@ -12,7 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear ...@@ -12,7 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
xml.link :href => project_issue_url(issue.project, issue) xml.link :href => project_issue_url(issue.project, issue)
xml.title truncate(issue.title, :length => 80) xml.title truncate(issue.title, :length => 80)
xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ")
xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(issue.author_email) xml.media :thumbnail, :width => "40", :height => "40", :url => avatar_icon(issue.author_email)
xml.author do |author| xml.author do |author|
xml.name issue.author_name xml.name issue.author_name
xml.email issue.author_email xml.email issue.author_email
......
...@@ -16,7 +16,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear ...@@ -16,7 +16,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
xml.link :href => event_link xml.link :href => event_link
xml.title truncate(event_title, :length => 80) xml.title truncate(event_title, :length => 80)
xml.updated event.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") 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.media :thumbnail, :width => "40", :height => "40", :url => avatar_icon(event.author_email)
xml.author do |author| xml.author do |author|
xml.name event.author_name xml.name event.author_name
xml.email event.author_email xml.email event.author_email
......
...@@ -37,4 +37,4 @@ ...@@ -37,4 +37,4 @@
%i.icon-signout %i.icon-signout
%li %li
= link_to current_user, class: "profile-pic", id: 'profile-pic' do = link_to current_user, class: "profile-pic", id: 'profile-pic' do
= image_tag gravatar_icon(current_user.email, 26), alt: '' = image_tag avatar_icon(current_user.email, 26), alt: ''
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= link_to profile_path, title: "Profile" do = link_to profile_path, title: "Profile" do
%i.icon-home %i.icon-home
= nav_link(path: 'profiles#account') do = nav_link(controller: :accounts) do
= link_to "Account", account_profile_path = link_to "Account", profile_account_path
- unless current_user.ldap_user?
= nav_link(controller: :passwords) do
= link_to "Password", edit_profile_password_path
= nav_link(controller: :notifications) do = nav_link(controller: :notifications) do
= link_to "Notifications", profile_notifications_path = link_to "Notifications", profile_notifications_path
= nav_link(controller: :keys) do = nav_link(controller: :keys) do
......
%h3.page-title
Account settings
%p.light
You can change your password, username and private token here.
- if current_user.ldap_user?
Some options are unavailable for LDAP accounts
%hr
.row
.span2
%ul.nav.nav-pills.nav-stacked.nav-stacked-menu
%li.active
= link_to '#tab-token', 'data-toggle' => 'tab' do
Private Token
%li
= link_to '#tab-password', 'data-toggle' => 'tab' do
Password
- if show_profile_social_tab?
%li
= link_to '#tab-social', 'data-toggle' => 'tab' do
Social Accounts
- if show_profile_username_tab?
%li
= link_to '#tab-username', 'data-toggle' => 'tab' do
Change Username
- if show_profile_remove_tab?
%li
= link_to '#tab-remove', 'data-toggle' => 'tab' do
Remove Account
.span10
.tab-content
.tab-pane.active#tab-token
%fieldset.update-token
%legend
Private token
%span.cred.pull-right
keep it secret!
%div
= form_for @user, url: reset_private_token_profile_path, method: :put do |f|
.data
%p.slead
Your private token is used to access application resources without authentication.
%br
It can be used for atom feeds or the API.
%p.cgray
- if current_user.private_token
= text_field_tag "token", current_user.private_token, class: "input-xxlarge large_text input-xpadding"
= f.submit 'Reset', confirm: "Are you sure?", class: "btn btn-primary btn-build-token"
- else
%span You don`t have one yet. Click generate to fix it.
= f.submit 'Generate', class: "btn success btn-build-token"
.tab-pane#tab-password
%fieldset.update-password
%legend Password
- if current_user.ldap_user?
%h3.nothing_here_message Not available for LDAP user
- else
= form_for @user, url: update_password_profile_path, method: :put do |f|
%div
%p.slead
You must provide current password in order to change it.
%br
After a successful password update you will be redirected to login page where you should login with your new password
-if @user.errors.any?
.alert.alert-error
%ul
- @user.errors.full_messages.each do |msg|
%li= msg
.control-group
= f.label :current_password, class: 'cgreen'
.controls= f.password_field :current_password, required: true
.control-group
= f.label :password, 'New password'
.controls= f.password_field :password, required: true
.control-group
= f.label :password_confirmation
.controls
= f.password_field :password_confirmation, required: true
.control-group
.controls
= f.submit 'Save password', class: "btn btn-save"
- if show_profile_social_tab?
.tab-pane#tab-social
%fieldset
%legend Social Accounts
.oauth_select_holder
%p.hint Tip: 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)
- if show_profile_username_tab?
.tab-pane#tab-username
%fieldset.update-username
%legend
Username
%small.cred.pull-right
Changing your username can have unintended side effects!
= form_for @user, url: update_username_profile_path, method: :put, remote: true do |f|
%div
.control-group
= f.label :username
.controls
= f.text_field :username, required: true
&nbsp;
%span.loading-gif.hide= image_tag "ajax_loader.gif"
%span.update-success.cgreen.hide
%i.icon-ok
Saved
%span.update-failed.cred.hide
%i.icon-remove
Failed
%ul.cred
%li This will change the web URL for personal projects.
%li This will change the git path to repositories for personal projects.
.controls
= f.submit 'Save username', class: "btn btn-save"
- if show_profile_remove_tab?
.tab-pane#tab-remove
%fieldset.remove-account
%legend
Remove account
%div
%p Deleting an account has the following effects:
%ul
%li All user content like authored issues, snippets, comments will be removed
- rp = current_user.personal_projects.count
- unless rp.zero?
%li #{pluralize rp, 'personal project'} will be removed and cannot be restored
- if current_user.solo_owned_groups.present?
%li
Next groups will be abandoned. You should transfer or remove them:
%strong #{current_user.solo_owned_groups.map(&:name).join(', ')}
= link_to 'Delete account', user_registration_path, confirm: "REMOVE #{current_user.name}? Are you sure?", method: :delete, class: "btn btn-remove"
%h3.page-title
Account settings
%p.light
You can change your username and private token here.
- if current_user.ldap_user?
Some options are unavailable for LDAP accounts
%hr
.account-page
%fieldset.update-token
%legend
Private token
%div
= form_for @user, url: reset_private_token_profile_path, method: :put do |f|
.data
%p
Your private token is used to access application resources without authentication.
%br
It can be used for atom feeds or the API.
%span.cred
Keep it secret!
%p.cgray
- if current_user.private_token
= text_field_tag "token", current_user.private_token, class: "input-xlarge input-xpadding pull-left"
= f.submit 'Reset', confirm: "Are you sure?", class: "btn btn-primary btn-build-token prepend-left-10"
- else
%span You don`t have one yet. Click generate to fix it.
= f.submit 'Generate', class: "btn success btn-build-token"
- if show_profile_social_tab?
%fieldset
%legend Social Accounts
.oauth_select_holder.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)
- if show_profile_username_tab?
%fieldset.update-username
%legend
Username
= form_for @user, url: update_username_profile_path, method: :put, remote: true do |f|
%p
Changing your username will change path to all personl projects!
%div
= f.text_field :username, required: true, class: 'input-xlarge input-xpadding'
&nbsp;
%span.loading-gif.hide= image_tag "ajax_loader.gif"
%p.light
= user_url(@user)
%div
= f.submit 'Save username', class: "btn btn-save"
- if show_profile_remove_tab?
%fieldset.remove-account
%legend
Remove account
%div
%p Deleting an account has the following effects:
%ul
%li All user content like authored issues, snippets, comments will be removed
- rp = current_user.personal_projects.count
- unless rp.zero?
%li #{pluralize rp, 'personal project'} will be removed and cannot be restored
- if current_user.solo_owned_groups.present?
%li
Next groups will be abandoned. You should transfer or remove them:
%strong #{current_user.solo_owned_groups.map(&:name).join(', ')}
= link_to 'Delete account', user_registration_path, confirm: "REMOVE #{current_user.name}? Are you sure?", method: :delete, class: "btn btn-remove"
%h3.page-title Password
%p.light
Change your password or recover your current one.
%hr
.update-password
= form_for @user, url: profile_password_path, method: :put do |f|
%div
%p.slead
You must provide current password in order to change it.
%br
After a successful password update you will be redirected to login page where you should login with your new password
-if @user.errors.any?
.alert.alert-error
%ul
- @user.errors.full_messages.each do |msg|
%li= msg
.control-group
= f.label :current_password
.controls
= f.password_field :current_password, required: true
%div
= link_to "Forgot your password?", reset_profile_password_path, method: :put
.control-group
= f.label :password, 'New password'
.controls= f.password_field :password, required: true
.control-group
= f.label :password_confirmation
.controls
= f.password_field :password_confirmation, required: true
.form-actions
= f.submit 'Save password', class: "btn btn-save"
= image_tag gravatar_icon(@user.email, 60), alt: '', class: 'avatar s60'
%h3.page-title %h3.page-title
= @user.name Profile settings
%br %p.light
%small This information appears on your profile.
= @user.email - if current_user.ldap_user?
Some options are unavailable for LDAP accounts
.pull-right
= link_to destroy_user_session_path, class: "logout", method: :delete do
%small
%i.icon-signout
Logout
%hr %hr
= form_for @user, url: profile_path, method: :put, html: { class: "edit_user form-horizontal" } do |f|
= form_for @user, url: profile_path, method: :put, html: { multipart: true, class: "edit_user form-horizontal" } do |f|
-if @user.errors.any? -if @user.errors.any?
%div.alert.alert-error %div.alert.alert-error
%ul %ul
...@@ -29,7 +25,7 @@ ...@@ -29,7 +25,7 @@
= f.label :email, class: "control-label" = f.label :email, class: "control-label"
.controls .controls
= f.text_field :email, class: "input-xlarge", required: true = f.text_field :email, class: "input-xlarge", required: true
%span.help-block We also use email for avatar detection. %span.help-block We also use email for avatar detection if no avatar is uploaded.
.control-group .control-group
= f.label :skype, class: "control-label" = f.label :skype, class: "control-label"
.controls= f.text_field :skype, class: "input-xlarge" .controls= f.text_field :skype, class: "input-xlarge"
...@@ -46,45 +42,23 @@ ...@@ -46,45 +42,23 @@
%span.help-block Tell us about yourself in fewer than 250 characters. %span.help-block Tell us about yourself in fewer than 250 characters.
.span5.pull-right .span5.pull-right
%fieldset.tips .light-well
%legend Tips: = image_tag avatar_icon(@user.email, 160), alt: '', class: 'avatar s160'
%ul
%li
%p You can change your password on the Account page
- if Gitlab.config.gravatar.enabled
%li
%p You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"}
- if Gitlab.config.omniauth.enabled && @user.provider?
%li
%p
You can login through #{@user.provider.titleize}!
= link_to "click here to change", account_profile_path
- if current_user.can_create_group?
%li
%p
Need a group for several dependent projects?
= link_to new_group_path, class: "btn btn-tiny" do
Create a group
- unless current_user.projects_limit_left > 100
%fieldset
%legend
Personal projects:
%small.pull-right
%span= current_user.personal_projects.count
of
%span= current_user.projects_limit
.padded
.progress
.bar{style: "width: #{current_user.projects_limit_percent}%;"}
%fieldset .clearfix
%legend .profile-avatar-form-option
SSH public keys: %p.light
%span.pull-right You can upload an avatar here
= link_to pluralize(current_user.keys.count, 'key'), profile_keys_path %br
.padded or change it at #{link_to "gravatar.com", "http://gravatar.com"}
= link_to "Add Public Key", new_profile_key_path, class: "btn btn-small" %hr
%a.choose-btn.btn.btn-small.js-choose-user-avatar-button
%i.icon-paper-clip
%span Choose File ...
&nbsp;
%span.file_name.js-avatar-filename File name...
= f.file_field :avatar, class: "js-user-avatar-input hide"
%span.help-block The maximum file size allowed is 200KB.
.form-actions .form-actions
= f.submit 'Save changes', class: "btn btn-save" = f.submit 'Save changes', class: "btn btn-save"
- if @user.valid? - if @user.valid?
:plain :plain
$('.update-username .update-success').show(); new Flash("Username sucessfully changed", "notice")
- else - else
:plain :plain
$('.update-username .update-failed').show(); new Flash("Username change failed - #{@user.errors.full_messages.first}", "alert")
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
%p %p
= link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do
= commit.short_id = commit.short_id
= image_tag gravatar_icon(commit.author_email), class: "avatar s16", alt: '' = image_tag avatar_icon(commit.author_email), class: "avatar s16", alt: ''
%span.light %span.light
= gfm escape_once(truncate(commit.title, length: 40)) = gfm escape_once(truncate(commit.title, length: 40))
%span %span
......
...@@ -12,7 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear ...@@ -12,7 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
xml.link :href => project_commit_url(@project, :id => commit.id) xml.link :href => project_commit_url(@project, :id => commit.id)
xml.title truncate(commit.title, :length => 80) xml.title truncate(commit.title, :length => 80)
xml.updated commit.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ") xml.updated commit.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ")
xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(commit.author_email) xml.media :thumbnail, :width => "40", :height => "40", :url => avatar_icon(commit.author_email)
xml.author do |author| xml.author do |author|
xml.name commit.author_name xml.name commit.author_name
xml.email commit.author_email xml.email commit.author_email
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
- if Project.issues_tracker.values.count > 1 - if Project.issues_tracker.values.count > 1
.control-group .control-group
= f.label :issues_tracker, "Issues tracker", class: 'control-label' = f.label :issues_tracker, "Issues tracker", class: 'control-label'
.controls= f.select(:issues_tracker, Project.issues_tracker.values, {}, { disabled: !@project.issues_enabled }) .controls= f.select(:issues_tracker, project_issues_trackers, {}, { disabled: !@project.issues_enabled })
.control-group .control-group
= f.label :issues_tracker_id, "Project name or id in issues tracker", class: 'control-label' = f.label :issues_tracker_id, "Project name or id in issues tracker", class: 'control-label'
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
- @project.team.members.sort_by(&:name).each do |user| - @project.team.members.sort_by(&:name).each do |user|
%li %li
= link_to project_filter_path(assignee_id: user.id) do = link_to project_filter_path(assignee_id: user.id) do
= image_tag gravatar_icon(user.email), class: "avatar s16", alt: '' = image_tag avatar_icon(user.email), class: "avatar s16", alt: ''
= user.name = user.name
.dropdown.inline.prepend-left-10 .dropdown.inline.prepend-left-10
......
...@@ -12,7 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear ...@@ -12,7 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
xml.link :href => project_issue_url(@project, issue) xml.link :href => project_issue_url(@project, issue)
xml.title truncate(issue.title, :length => 80) xml.title truncate(issue.title, :length => 80)
xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ")
xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(issue.author_email) xml.media :thumbnail, :width => "40", :height => "40", :url => avatar_icon(issue.author_email)
xml.author do |author| xml.author do |author|
xml.name issue.author_name xml.name issue.author_name
xml.email issue.author_email xml.email issue.author_email
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
- @project.team.members.sort_by(&:name).each do |user| - @project.team.members.sort_by(&:name).each do |user|
%li %li
= link_to project_filter_path(assignee_id: user.id) do = link_to project_filter_path(assignee_id: user.id) do
= image_tag gravatar_icon(user.email), class: "avatar s16", alt: '' = image_tag avatar_icon(user.email), class: "avatar s16", alt: ''
= user.name = user.name
.dropdown.inline.prepend-left-10 .dropdown.inline.prepend-left-10
......
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
= link_to_gfm truncate(issue.title, length: 40), [@project, issue] = link_to_gfm truncate(issue.title, length: 40), [@project, issue]
- if issue.assignee - if issue.assignee
.pull-right .pull-right
= image_tag gravatar_icon(issue.assignee.email, 16), class: "avatar s16" = image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16"
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
- @users.each do |user| - @users.each do |user|
%li %li
= link_to user, title: user.name, class: "dark" do = link_to user, title: user.name, class: "dark" do
= image_tag gravatar_icon(user.email, 32), class: "avatar s32" = image_tag avatar_icon(user.email, 32), class: "avatar s32"
%strong= truncate(user.name, lenght: 40) %strong= truncate(user.name, lenght: 40)
%br %br
%small.cgray= user.username %small.cgray= user.username
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
author: { author: {
name: c.author_name, name: c.author_name,
email: c.author_email, email: c.author_email,
icon: gravatar_icon(c.author_email, 20) icon: avatar_icon(c.author_email, 20)
}, },
time: c.time, time: c.time,
space: c.spaces.first, space: c.spaces.first,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= link_to "javascript:;", class: "js-details-target turn-off js-toggler-target" do = link_to "javascript:;", class: "js-details-target turn-off js-toggler-target" do
%i.icon-eye-open %i.icon-eye-open
Show discussion Show discussion
= image_tag gravatar_icon(note.author_email), class: "avatar s32" = image_tag avatar_icon(note.author_email), class: "avatar s32"
%div %div
= link_to_member(@project, note.author, avatar: false) = link_to_member(@project, note.author, avatar: false)
- if note.for_merge_request? - if note.for_merge_request?
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
= 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 = 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 %i.icon-trash.cred
Remove Remove
= image_tag gravatar_icon(note.author_email), class: "avatar s32" = image_tag avatar_icon(note.author_email), class: "avatar s32"
= link_to_member(@project, note.author, avatar: false) = link_to_member(@project, note.author, avatar: false)
%span.note-last-update %span.note-last-update
= note_timestamp(note) = note_timestamp(note)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
%div %div
= link_to project_commits_path(@project, commit.id) do = link_to project_commits_path(@project, commit.id) do
%code= commit.short_id %code= commit.short_id
= image_tag gravatar_icon(commit.author_email), class: "", width: 16, alt: '' = image_tag avatar_icon(commit.author_email), class: "", width: 16, alt: ''
= gfm escape_once(truncate(commit.title, length: 40)) = gfm escape_once(truncate(commit.title, length: 40))
%td %td
%span.pull-right.cgray %span.pull-right.cgray
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
%ol.styled %ol.styled
- @stats.authors[0...50].each do |author| - @stats.authors[0...50].each do |author|
%li %li
= image_tag gravatar_icon(author.email, 16), class: 'avatar s16', alt: '' = image_tag avatar_icon(author.email, 16), class: 'avatar s16', alt: ''
= author.name = author.name
%small.light= author.email %small.light= author.email
.pull-right .pull-right
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%p %p
%p %p
%span.light Repo size is %span.light Repo size is
#{@project.repository.size} MB = repository_size
%p %p
%span.light Created at %span.light Created at
#{@project.created_at.stamp('Aug 22, 2013')} #{@project.created_at.stamp('Aug 22, 2013')}
......
...@@ -16,6 +16,6 @@ ...@@ -16,6 +16,6 @@
= "##{snippet.id}" = "##{snippet.id}"
%span %span
by by
= image_tag gravatar_icon(snippet.author_email), class: "avatar avatar-inline s16" = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16"
= snippet.author_name = snippet.author_name
%span.light #{time_ago_in_words(snippet.created_at)} ago %span.light #{time_ago_in_words(snippet.created_at)} ago
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
= "##{@snippet.id}" = "##{@snippet.id}"
%span.light %span.light
by by
= image_tag gravatar_icon(@snippet.author_email), class: "avatar avatar-inline s16" = image_tag avatar_icon(@snippet.author_email), class: "avatar avatar-inline s16"
= @snippet.author_name = @snippet.author_name
%div= render 'projects/snippets/blob' %div= render 'projects/snippets/blob'
%div#notes= render "projects/notes/notes_with_form" %div#notes= render "projects/notes/notes_with_form"
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
&nbsp; &nbsp;
= 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 = 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 %i.icon-minus.icon-white
= image_tag gravatar_icon(user.email, 32), class: "avatar s32" = image_tag avatar_icon(user.email, 32), class: "avatar s32"
%p %p
%strong= user.name %strong= user.name
%span.cgray= user.username %span.cgray= user.username
......
...@@ -18,6 +18,6 @@ ...@@ -18,6 +18,6 @@
%span %span
by by
= link_to user_snippets_path(snippet.author) do = link_to user_snippets_path(snippet.author) do
= image_tag gravatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: '' = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: ''
= snippet.author_name = snippet.author_name
%span.light #{time_ago_in_words(snippet.created_at)} ago %span.light #{time_ago_in_words(snippet.created_at)} ago
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%span.light %span.light
by by
= link_to user_snippets_path(@snippet.author) do = link_to user_snippets_path(@snippet.author) do
= image_tag gravatar_icon(@snippet.author_email), class: "avatar avatar-inline s16" = image_tag avatar_icon(@snippet.author_email), class: "avatar avatar-inline s16"
= @snippet.author_name = @snippet.author_name
.back-link .back-link
......
%h3.page-title %h3.page-title
= image_tag gravatar_icon(@user.email), class: "avatar s24" = image_tag avatar_icon(@user.email), class: "avatar s24"
= @user.name = @user.name
%span %span
\/ \/
......
...@@ -3,9 +3,4 @@ ...@@ -3,9 +3,4 @@
%ul.well-list %ul.well-list
- @projects.each do |project| - @projects.each do |project|
%li %li
= link_to project_path(project), class: dom_class(project) do = link_to_project project
- if project.namespace
= project.namespace.human_name
\/
%strong.well-title
= truncate(project.name, length: 45)
.row .row
.span8 .span8
%h3.page-title %h3.page-title
= image_tag gravatar_icon(@user.email, 90), class: "avatar s90", alt: '' = image_tag avatar_icon(@user.email, 90), class: "avatar s90", alt: ''
= @user.name = @user.name
- if @user == current_user - if @user == current_user
.pull-right .pull-right
......
- user = member.user - user = member.user
- return unless user - return unless user
%li{class: "#{dom_class(member)} js-toggle-container", id: dom_id(member)} %li{class: "#{dom_class(member)} js-toggle-container", id: dom_id(member)}
= image_tag gravatar_icon(user.email, 16), class: "avatar s16" = image_tag avatar_icon(user.email, 16), class: "avatar s16"
%strong= user.name %strong= user.name
%span.cgray= user.username %span.cgray= user.username
- if user == current_user - if user == current_user
......
...@@ -73,6 +73,7 @@ production: &base ...@@ -73,6 +73,7 @@ production: &base
## External issues trackers ## External issues trackers
issues_tracker: issues_tracker:
# redmine: # redmine:
# title: "Redmine"
# ## If not nil, link 'Issues' on project page will be replaced with this # ## If not nil, link 'Issues' on project page will be replaced with this
# ## Use placeholders: # ## Use placeholders:
# ## :project_id - GitLab project identifier # ## :project_id - GitLab project identifier
...@@ -93,6 +94,7 @@ production: &base ...@@ -93,6 +94,7 @@ production: &base
# new_issue_url: "http://redmine.sample/projects/:issues_tracker_id/issues/new" # new_issue_url: "http://redmine.sample/projects/:issues_tracker_id/issues/new"
# #
# jira: # jira:
# title: "Atlassian Jira"
# project_url: "http://jira.sample/issues/?jql=project=:issues_tracker_id" # project_url: "http://jira.sample/issues/?jql=project=:issues_tracker_id"
# issues_url: "http://jira.sample/browse/:id" # issues_url: "http://jira.sample/browse/:id"
# new_issue_url: "http://jira.sample/secure/CreateIssue.jspa" # new_issue_url: "http://jira.sample/secure/CreateIssue.jspa"
...@@ -206,6 +208,7 @@ test: ...@@ -206,6 +208,7 @@ test:
<<: *base <<: *base
issues_tracker: issues_tracker:
redmine: redmine:
title: "Redmine"
project_url: "http://redmine/projects/:issues_tracker_id" project_url: "http://redmine/projects/:issues_tracker_id"
issues_url: "http://redmine/:project_id/:issues_tracker_id/:id" issues_url: "http://redmine/:project_id/:issues_tracker_id/:id"
new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new" new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new"
......
Devise::Async.backend = :sidekiq
...@@ -99,19 +99,21 @@ Gitlab::Application.routes.draw do ...@@ -99,19 +99,21 @@ Gitlab::Application.routes.draw do
# #
resource :profile, only: [:show, :update] do resource :profile, only: [:show, :update] do
member do member do
get :account
get :history get :history
get :token
get :design get :design
put :update_password
put :reset_private_token put :reset_private_token
put :update_username put :update_username
end end
scope module: :profiles do scope module: :profiles do
resource :account, only: [:show, :update]
resource :notifications, only: [:show, :update] resource :notifications, only: [:show, :update]
resource :password, only: [:new, :create] resource :password, only: [:new, :create, :edit, :update] do
member do
put :reset
end
end
resources :keys resources :keys
resources :groups, only: [:index] do resources :groups, only: [:index] do
member do member do
......
class AddAvatarToUsers < ActiveRecord::Migration
def change
add_column :users, :avatar, :string
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130926081215) do ActiveRecord::Schema.define(:version => 20131005191208) do
create_table "deploy_keys_projects", :force => true do |t| create_table "deploy_keys_projects", :force => true do |t|
t.integer "deploy_key_id", :null => false t.integer "deploy_key_id", :null => false
...@@ -283,6 +283,7 @@ ActiveRecord::Schema.define(:version => 20130926081215) do ...@@ -283,6 +283,7 @@ ActiveRecord::Schema.define(:version => 20130926081215) do
t.integer "notification_level", :default => 1, :null => false t.integer "notification_level", :default => 1, :null => false
t.datetime "password_expires_at" t.datetime "password_expires_at"
t.integer "created_by_id" t.integer "created_by_id"
t.string "avatar"
end end
add_index "users", ["admin"], :name => "index_users_on_admin" add_index "users", ["admin"], :name => "index_users_on_admin"
......
...@@ -244,6 +244,18 @@ Parameters: ...@@ -244,6 +244,18 @@ Parameters:
+ `public` (optional) + `public` (optional)
## Remove project
Removes project with all resources(issues, merge requests etc)
```
DELETE /projects/:id
```
Parameters:
+ `id` (required) - The ID of a project
## Team members ## Team members
......
...@@ -63,7 +63,7 @@ Make sure you have the right version of Python installed. ...@@ -63,7 +63,7 @@ Make sure you have the right version of Python installed.
python --version python --version
# If it's Python 3 you might need to install Python 2 separately # If it's Python 3 you might need to install Python 2 separately
sudo apt-get install python2.7 sudo apt-get install -y python2.7
# Make sure you can access Python via python2 # Make sure you can access Python via python2
python2 --version python2 --version
...@@ -72,7 +72,7 @@ Make sure you have the right version of Python installed. ...@@ -72,7 +72,7 @@ Make sure you have the right version of Python installed.
sudo ln -s /usr/bin/python /usr/bin/python2 sudo ln -s /usr/bin/python /usr/bin/python2
# For reStructuredText markup language support install required package: # For reStructuredText markup language support install required package:
sudo apt-get install python-docutils sudo apt-get install -y python-docutils
**Note:** In order to receive mail notifications, make sure to install a **Note:** In order to receive mail notifications, make sure to install a
mail server. By default, Debian is shipped with exim4 whereas Ubuntu mail server. By default, Debian is shipped with exim4 whereas Ubuntu
......
...@@ -12,26 +12,31 @@ Feature: Profile ...@@ -12,26 +12,31 @@ Feature: Profile
And I should see new contact info And I should see new contact info
Scenario: I change my password without old one Scenario: I change my password without old one
Given I visit profile account page Given I visit profile password page
When I try change my password w/o old one When I try change my password w/o old one
Then I should see a missing password error message Then I should see a missing password error message
And I should be redirected to account page And I should be redirected to password page
Scenario: I change my password Scenario: I change my password
Given I visit profile account page Given I visit profile password page
Then I change my password Then I change my password
And I should be redirected to sign in page And I should be redirected to sign in page
Scenario: I edit my avatar
Given I visit profile page
Then I change my avatar
And I should see new avatar
Scenario: My password is expired Scenario: My password is expired
Given my password is expired Given my password is expired
And I am not an ldap user And I am not an ldap user
And I visit profile account page Given I visit profile password page
Then I redirected to expired password page Then I redirected to expired password page
And I submit new password And I submit new password
And I redirected to sign in page And I redirected to sign in page
Scenario: I unsuccessfully change my password Scenario: I unsuccessfully change my password
Given I visit profile account page Given I visit profile password page
When I unsuccessfully change my password When I unsuccessfully change my password
Then I should see a password error message Then I should see a password error message
......
...@@ -3,9 +3,7 @@ class Profile < Spinach::FeatureSteps ...@@ -3,9 +3,7 @@ class Profile < Spinach::FeatureSteps
include SharedPaths include SharedPaths
step 'I should see my profile info' do step 'I should see my profile info' do
page.should have_content "Profile" page.should have_content "Profile settings"
page.should have_content @user.name
page.should have_content @user.email
end end
step 'I change my contact info' do step 'I change my contact info' do
...@@ -22,6 +20,17 @@ class Profile < Spinach::FeatureSteps ...@@ -22,6 +20,17 @@ class Profile < Spinach::FeatureSteps
@user.twitter.should == 'testtwitter' @user.twitter.should == 'testtwitter'
end end
step 'I change my avatar' do
attach_file(:user_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
click_button "Save changes"
@user.reload
end
step 'I should see new avatar' do
@user.avatar.should be_instance_of AttachmentUploader
@user.avatar.url.should == "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png"
end
step 'I try change my password w/o old one' do step 'I try change my password w/o old one' do
within '.update-password' do within '.update-password' do
fill_in "user_password", with: "222333" fill_in "user_password", with: "222333"
...@@ -124,8 +133,12 @@ class Profile < Spinach::FeatureSteps ...@@ -124,8 +133,12 @@ class Profile < Spinach::FeatureSteps
current_path.should == new_user_session_path current_path.should == new_user_session_path
end end
step 'I should be redirected to password page' do
current_path.should == edit_profile_password_path
end
step 'I should be redirected to account page' do step 'I should be redirected to account page' do
current_path.should == account_profile_path current_path.should == profile_account_path
end end
step 'I click on my profile picture' do step 'I click on my profile picture' do
......
...@@ -65,8 +65,12 @@ module SharedPaths ...@@ -65,8 +65,12 @@ module SharedPaths
visit profile_path visit profile_path
end end
step 'I visit profile password page' do
visit edit_profile_password_path
end
step 'I visit profile account page' do step 'I visit profile account page' do
visit account_profile_path visit profile_account_path
end end
step 'I visit profile SSH keys page' do step 'I visit profile SSH keys page' do
......
...@@ -66,7 +66,6 @@ module API ...@@ -66,7 +66,6 @@ module API
present group, with: Entities::GroupDetail present group, with: Entities::GroupDetail
end end
# Remove group # Remove group
# #
# Parameters: # Parameters:
......
...@@ -129,6 +129,16 @@ module API ...@@ -129,6 +129,16 @@ module API
end end
end end
# Remove project
#
# Parameters:
# id (required) - The ID of a project
# Example Request:
# DELETE /projects/:id
delete ":id" do
authorize! :remove_project, user_project
user_project.destroy
end
# Mark this project as forked from another # Mark this project as forked from another
# #
......
...@@ -216,12 +216,6 @@ describe "On a merge request diff", js: true, focus: true do ...@@ -216,12 +216,6 @@ describe "On a merge request diff", js: true, focus: true do
end end
end end
it do
within("tr[id='342e16cbbd482ac2047dc679b2749d248cc1428f_18_17'] + .js-temp-notes-holder") do
should have_no_css(".js-temp-notes-holder")
end
end
it 'should be added as discussion' do it 'should be added as discussion' do
should have_content("Another comment on line 17") should have_content("Another comment on line 17")
should have_css(".notes_holder") should have_css(".notes_holder")
......
...@@ -12,7 +12,7 @@ describe "Profile account page" do ...@@ -12,7 +12,7 @@ describe "Profile account page" do
describe "when signup is enabled" do describe "when signup is enabled" do
before do before do
Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
visit account_profile_path visit profile_account_path
end end
it { page.should have_content("Remove account") } it { page.should have_content("Remove account") }
...@@ -26,12 +26,12 @@ describe "Profile account page" do ...@@ -26,12 +26,12 @@ describe "Profile account page" do
describe "when signup is disabled" do describe "when signup is disabled" do
before do before do
Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) Gitlab.config.gitlab.stub(:signup_enabled).and_return(false)
visit account_profile_path visit profile_account_path
end end
it "should not have option to remove account" do it "should not have option to remove account" do
page.should_not have_content("Remove account") page.should_not have_content("Remove account")
current_path.should == account_profile_path current_path.should == profile_account_path
end end
end end
end end
...@@ -29,7 +29,7 @@ describe "Users Security" do ...@@ -29,7 +29,7 @@ describe "Users Security" do
end end
describe "GET /profile/account" do describe "GET /profile/account" do
subject { account_profile_path } subject { profile_account_path }
it { should be_allowed_for @u1 } it { should be_allowed_for @u1 }
it { should be_allowed_for :admin } it { should be_allowed_for :admin }
......
...@@ -39,6 +39,24 @@ describe ApplicationHelper do ...@@ -39,6 +39,24 @@ describe ApplicationHelper do
end end
end end
describe "avatar_icon" do
avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png')
it "should return an url for the avatar" do
user = create(:user)
user.avatar = File.open(avatar_file_path)
user.save!
avatar_icon(user.email).to_s.should == "/uploads/user/avatar/#{ user.id }/gitlab_logo.png"
end
it "should call gravatar_icon when no avatar is present" do
user = create(:user)
user.save!
stub!(:gravatar_icon).and_return('gravatar_method_called')
avatar_icon(user.email).to_s.should == "gravatar_method_called"
end
end
describe "gravatar_icon" do describe "gravatar_icon" do
let(:user_email) { 'user@email.com' } let(:user_email) { 'user@email.com' }
......
require 'spec_helper'
describe ProjectsHelper do
describe '#project_issues_trackers' do
it "returns the correct issues trackers available" do
project_issues_trackers.should ==
"<option value=\"redmine\">Redmine</option>\n" \
"<option value=\"gitlab\">GitLab</option>"
end
end
end
...@@ -730,4 +730,42 @@ describe API::API do ...@@ -730,4 +730,42 @@ describe API::API do
end end
end end
end end
describe "DELETE /projects/:id" do
context "when authenticated as user" do
it "should remove project" do
delete api("/projects/#{project.id}", user)
response.status.should == 200
end
it "should not remove a project if not an owner" do
user3 = create(:user)
project.team << [user3, :developer]
delete api("/projects/#{project.id}", user3)
response.status.should == 403
end
it "should not remove a non existing project" do
delete api("/projects/1328", user)
response.status.should == 404
end
it "should not remove a project not attached to user" do
delete api("/projects/#{project.id}", user2)
response.status.should == 404
end
end
context "when authenticated as admin" do
it "should remove any existing project" do
delete api("/projects/#{project.id}", admin)
response.status.should == 200
end
it "should not remove a non existing project" do
delete api("/projects/1328", admin)
response.status.should == 404
end
end
end
end end
...@@ -128,7 +128,7 @@ end ...@@ -128,7 +128,7 @@ end
# profile_update PUT /profile/update(.:format) profile#update # profile_update PUT /profile/update(.:format) profile#update
describe ProfilesController, "routing" do describe ProfilesController, "routing" do
it "to #account" do it "to #account" do
get("/profile/account").should route_to('profiles#account') get("/profile/account").should route_to('profiles/accounts#show')
end end
it "to #history" do it "to #history" 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