Commit c09d2336 authored by AlexDenisov's avatar AlexDenisov

Merge branch 'master' into fix_project_access_notification

parents e6ce4729 3c132f2e
v 2.9.1
- Fixed resque custom config init
v 2.9.0
- fixed inline notes bugs
- refactored rspecs
......@@ -9,8 +12,10 @@ v 2.9.0
- scss refactoring. gitlab_bootstrap/ dir
- fix git push http body bigger than 112k problem
- list of labels page under issues tab
- API for milestones
- API for milestones, keys
- restyled buttons
- OAuth
- Comment order changed
v 2.8.1
- ability to disable gravatars
......
......@@ -96,6 +96,7 @@ group :assets do
gem "therubyracer"
gem 'chosen-rails'
gem 'jquery-atwho-rails', '0.1.6'
gem "jquery-rails", "2.0.2"
gem "jquery-ui-rails", "0.5.0"
gem "modernizr", "2.5.3"
......
......@@ -199,6 +199,7 @@ GEM
httpauth (0.1)
i18n (0.6.1)
journey (1.0.4)
jquery-atwho-rails (0.1.6)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
......@@ -441,6 +442,7 @@ DEPENDENCIES
haml-rails
headless
httparty
jquery-atwho-rails (= 0.1.6)
jquery-rails (= 2.0.2)
jquery-ui-rails (= 0.5.0)
kaminari
......
......@@ -4,6 +4,7 @@
guard 'rspec', :version => 2, :all_on_start => false, :all_after_pass => false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^lib/api/(.+)\.rb$}) { |m| "spec/requests/api/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
......
......@@ -11,6 +11,7 @@
//= require jquery.endless-scroll
//= require jquery.highlight
//= require jquery.waitforimages
//= require jquery.atwho
//= require bootstrap
//= require modernizr
//= require chosen-jquery
......
......@@ -4,6 +4,7 @@
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require jquery.ui.all
*= require jquery.ui.aristo
*= require jquery.atwho
*= require chosen
*= require_self
*= require main
......
......@@ -185,36 +185,6 @@ span.update-author {
}
}
.event_label {
@extend .label;
background-color: #999;
&.pushed {
background-color: #4A97BD;
}
&.opened {
background-color: #469847;
}
&.closed {
background-color: #B94A48;
}
&.merged {
background-color: #2A2;
}
&.joined {
background-color: #1ca9dd;
}
&.left {
background-color: #888;
float:none;
}
}
form {
@extend .form-horizontal;
......@@ -355,41 +325,6 @@ p.time {
border:2px solid #ddd;
}
.event_feed {
min-height:40px;
border-bottom:1px solid #ddd;
.avatar {
width:32px;
}
.event_icon {
float:right;
margin-right:2px;
img {
width:20px;
}
}
ul {
margin-left:50px;
margin-bottom:5px;
.avatar {
width:24px;
}
}
padding: 15px 5px;
&:last-child { border:none }
.wll:hover { background:none }
.event_commits {
margin-top: 5px;
li.commit {
background: transparent;
padding:5px;
border:none;
}
}
}
.ico {
background: url("images.png") no-repeat -85px -77px;
......@@ -639,22 +574,6 @@ li.note {
background:#fff;
}
/**
* Push event widget
*
*/
.event_lp {
@extend .ui-box;
color:#777;
margin-bottom:20px;
padding:8px;
@include border-radius(4px);
min-height:22px;
.avatar {
width:24px;
}
}
.supp_diff_link,
.mr_show_all_commits {
......
/** LISTS **/
ul {
ul {
/**
* List li block element #1
*
......@@ -18,7 +18,7 @@ ul {
.author { color: #999; }
p {
padding-top:5px;
padding-top:5px;
margin:0;
color:#222;
img {
......
......@@ -143,6 +143,7 @@ $hover: #fdf5d9;
@import "sections/projects.scss";
@import "sections/merge_requests.scss";
@import "sections/graph.scss";
@import "sections/events.scss";
/**
* This scss file redefine chozen selectbox styles for
......
.commit-box {
@extend .main_box;
.commit-head {
.commit-head {
@extend .top_box_content;
.commit-title {
......@@ -29,11 +29,11 @@
.sha-block {
text-align:right;
&:first-child {
&:first-child {
padding-bottom:6px;
}
a {
a {
border-bottom: 1px solid #aaa;
margin-left: 9px;
}
......@@ -54,7 +54,7 @@
}
/**
*
*
* COMMIT SHOw
*
*/
......@@ -71,7 +71,7 @@
background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf);
span {
span {
font-size:14px;
}
}
......@@ -111,8 +111,8 @@
}
}
&.img_compared {
img {
&.img_compared {
img {
max-width:300px;
}
}
......@@ -120,12 +120,12 @@
}
.diff_file_content{
table {
table {
border:none;
margin:0px;
padding:0px;
tr {
td {
td {
font-size:12px;
}
}
......@@ -145,29 +145,29 @@
moz-user-select: none;
-khtml-user-select: none;
user-select: none;
a {
a {
float:left;
width:35px;
font-weight:normal;
color:#666;
&:hover {
&:hover {
text-decoration:underline;
}
}
}
.line_content {
white-space:pre;
.line_content {
white-space:pre;
height:14px;
margin:0px;
padding:0px;
border:none;
&.new {
&.new {
background: #CFD;
}
&.old {
&.old {
background: #FDD;
}
&.matched {
&.matched {
color:#ccc;
background:#fafafa;
}
......@@ -182,32 +182,32 @@
/** COMMIT ROW **/
.commit {
.commit {
@extend .wll;
.browse_code_link_holder {
.browse_code_link_holder {
@extend .span2;
float:right;
}
.committed_ago {
.committed_ago {
float:right;
@extend .cgray;
}
code {
code {
background:#FCEEC1;
color:$style_color;
}
.commit_short_id {
.commit_short_id {
float:left;
@extend .lined;
min-width:65px;
font-family: 'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono','lucida console',monospace;
}
.commit-author-name {
.commit-author-name {
color: #777;
}
}
......
/**
* Events labels
*
*/
.event_label {
&.pushed {
padding:0 2px;
@extend .alert;
@extend .alert-info;
}
&.opened {
padding:0 2px;
@extend .alert;
@extend .alert-success;
}
&.closed {
padding:0 2px;
@extend .alert;
@extend .alert-error;
}
&.merged {
padding:0 2px;
@extend .alert;
@extend .alert-success;
}
&.left,
&.joined {
padding:0 2px;
@extend .alert;
}
}
/**
* Dashboard events feed
*
*/
.event-item {
min-height:40px;
border-bottom:1px solid #eee;
.event-title {
color:#333;
font-weight: bold;
.author_name {
color:#333;
}
}
.event-body {
p {
color:#555;
}
.event-info {
color:#666;
}
}
.avatar {
width:32px;
}
.event_icon {
float: right;
border: 1px solid #EEE;
padding: 5px;
@include border-radius(5px);
background: #F9F9F9;
img {
width:20px;
}
}
ul {
margin-left:50px;
margin-bottom:5px;
.avatar {
width:18px;
margin-top:3px;
}
}
padding: 15px 5px;
&:last-child { border:none }
.wll:hover { background:none }
.event_commits {
margin-top: 5px;
li {
&.commit {
background: transparent;
padding:3px;
border:none;
font-size:12px;
}
&.commits-stat {
display: block;
margin-top: 5px;
}
}
}
}
/**
* Push event widget
*
*/
.event_lp {
@extend .ui-box;
color:#777;
margin-bottom:20px;
padding:8px;
@include border-radius(4px);
min-height:22px;
.avatar {
width:24px;
}
}
......@@ -43,7 +43,9 @@
padding: 8px 0;
overflow: hidden;
display: block;
position:relative;
img {float: left; margin-right: 10px;}
img.emoji {float:none;margin:0;}
.note-author cite{font-style: italic;}
p { color:$style_color; }
.note-author { color: $style_color;}
......@@ -55,7 +57,9 @@
.delete-note {
display:none;
float:right;
position:absolute;
right:0;
top:0;
}
&:hover {
......
......@@ -30,7 +30,7 @@ class Admin::UsersController < AdminController
def new
@admin_user = User.new(projects_limit: Gitlab.config.default_projects_limit)
@admin_user = User.new({ projects_limit: Gitlab.config.default_projects_limit }, as: :admin)
end
def edit
......@@ -60,7 +60,7 @@ class Admin::UsersController < AdminController
def create
admin = params[:user].delete("admin")
@admin_user = User.new(params[:user])
@admin_user = User.new(params[:user], as: :admin)
@admin_user.admin = (admin && admin.to_i > 0)
respond_to do |format|
......@@ -86,7 +86,7 @@ class Admin::UsersController < AdminController
@admin_user.admin = (admin && admin.to_i > 0)
respond_to do |format|
if @admin_user.update_attributes(params[:user])
if @admin_user.update_attributes(params[:user], as: :admin)
format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully updated.' }
format.json { head :ok }
else
......
......@@ -52,6 +52,7 @@ class CommitsController < ApplicationController
@commits = result[:commits]
@commit = result[:commit]
@diffs = result[:diffs]
@refs_are_same = result[:same]
@line_notes = []
@commits = CommitDecorator.decorate(@commits)
......
class HooksController < ApplicationController
before_filter :authenticate_user!
before_filter :project
layout "project"
......
class IssuesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
before_filter :issue, only: [:edit, :update, :destroy, :show]
......
class LabelsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
......
class MergeRequestsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
before_filter :merge_request, only: [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :raw]
......
class MilestonesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
before_filter :milestone, only: [:edit, :update, :destroy, :show]
......
class SnippetsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw]
layout "project"
......
......@@ -32,7 +32,11 @@ module TreeHelper
#
# Returns boolean
def markup?(filename)
filename.end_with?(*%w(.mdown .md .markdown .textile .rdoc .org .creole
.mediawiki .rst .asciidoc .pod))
filename.end_with?(*%w(.textile .rdoc .org .creole
.mediawiki .rst .asciidoc .pod))
end
def gitlab_markdown?(filename)
filename.end_with?(*%w(.mdown .md .markdown))
end
end
......@@ -82,20 +82,24 @@ class Commit
end
def compare(project, from, to)
first = project.commit(to.try(:strip))
last = project.commit(from.try(:strip))
result = {
commits: [],
diffs: [],
commit: nil
commit: nil,
same: false
}
return result unless from && to
first = project.commit(to.try(:strip))
last = project.commit(from.try(:strip))
if first && last
commits = [first, last].sort_by(&:created_at)
younger = commits.first
older = commits.last
result[:same] = (younger.id == older.id)
result[:commits] = project.repo.commits_between(younger.id, older.id).map {|c| Commit.new(c)}
result[:diffs] = project.repo.diff(younger.id, older.id) rescue []
result[:commit] = Commit.new(older)
......
......@@ -132,6 +132,7 @@ class Event < ActiveRecord::Base
end
end
delegate :name, :email, to: :author, prefix: true, allow_nil: true
delegate :title, to: :issue, prefix: true, allow_nil: true
delegate :title, to: :merge_request, prefix: true, allow_nil: true
......
......@@ -6,8 +6,9 @@ class User < ActiveRecord::Base
:recoverable, :rememberable, :trackable, :validatable, :omniauthable
attr_accessible :email, :password, :password_confirmation, :remember_me, :bio,
:name, :projects_limit, :skype, :linkedin, :twitter, :dark_scheme,
:theme_id, :force_random_password, :extern_uid, :provider
:name, :skype, :linkedin, :twitter, :dark_scheme,
:theme_id, :force_random_password, :extern_uid, :provider, :as => [:default, :admin]
attr_accessible :projects_limit, :as => :admin
attr_accessor :force_random_password
......
......@@ -79,6 +79,14 @@ module Repository
@heads ||= repo.heads
end
def branches_names
heads.map(&:name)
end
def ref_names
[branches_names + tags].flatten
end
def tree(fcommit, path = nil)
fcommit = commit if fcommit == :head
tree = fcommit.tree
......
= render "head"
%h3
%h3.page_title
Compare View
%hr
%div
%p
%p.slead
Fill input field with commit id like
%code '4eedf23'
%code.label_branch 4eedf23
or branch/tag name like
%code master
&amp; press compare button for commits list, code diff.
%code.label_branch master
and press compare button for commits list, code diff.
%br
......@@ -19,22 +19,24 @@
= text_field_tag :from, params[:from], placeholder: "master", class: "xlarge"
= "..."
= text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge"
- if @refs_are_same
.alert
%span Refs are the same
.actions
= submit_tag "Compare", class: "btn primary"
= submit_tag "Compare", class: "btn primary wide commits-compare-btn"
- unless @commits.empty?
- if @commits.present?
%div.ui-box
%h5.small Commits (#{@commits.count})
%ul.unstyled= render @commits
- unless @diffs.empty?
%h4 Diff
= render "commits/diffs", diffs: @diffs
- unless @diffs.empty?
%h4 Diff
= render "commits/diffs", diffs: @diffs
:javascript
$(function() {
var availableTags = #{@project.heads.map(&:name).to_json};
var availableTags = #{@project.ref_names.to_json};
$("#from").autocomplete({
source: availableTags,
......@@ -45,5 +47,7 @@
source: availableTags,
minLength: 1
});
disableButtonIfEmptyField('#to', '.commits-compare-btn');
});
......@@ -2,7 +2,7 @@
%li.commit
%p
= link_to commit.short_id(8), project_commit_path(project, id: commit.id), class: "commit_short_id"
%strong.cdark= commit.author_name
%span= commit.author_name
&ndash;
= image_tag gravatar_icon(commit.author_email), class: "avatar", width: 16
= gfm escape_once(truncate(commit.title, length: 50)) rescue "--broken encoding"
- if event.allowed?
- if event.issue?