Rspec test repo replaced.\nMerge Requests improved
This commit is contained in:
parent
781f5aa6fb
commit
3676838dc9
18 changed files with 90 additions and 41 deletions
|
@ -531,7 +531,7 @@ table a code {
|
|||
|
||||
/** FLASH message **/
|
||||
#flash_container {
|
||||
height:45px;
|
||||
height:50px;
|
||||
position:fixed;
|
||||
z-index:10001;
|
||||
top:0px;
|
||||
|
@ -540,7 +540,7 @@ table a code {
|
|||
overflow:hidden;
|
||||
background:white;
|
||||
cursor:pointer;
|
||||
border-bottom:1px solid #777;
|
||||
border-bottom:1px solid #ccc;
|
||||
|
||||
h4 {
|
||||
color:#444;
|
||||
|
@ -901,3 +901,23 @@ p.time {
|
|||
margin:2px;
|
||||
}
|
||||
}
|
||||
|
||||
.mr_source_commit ,
|
||||
.mr_target_commit {
|
||||
.commit {
|
||||
list-style:none;
|
||||
margin-top:10px;
|
||||
&:hover {
|
||||
background:none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.prettyprint {
|
||||
background-color: #fefbf3;
|
||||
padding: 9px;
|
||||
border: 1px solid rgba(0,0,0,.2);
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
||||
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
||||
}
|
||||
|
|
|
@ -106,6 +106,14 @@ class MergeRequestsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def branch_from
|
||||
@commit = project.commit(params[:ref])
|
||||
end
|
||||
|
||||
def branch_to
|
||||
@commit = project.commit(params[:ref])
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def merge_request
|
||||
|
|
|
@ -12,6 +12,7 @@ class MergeRequest < ActiveRecord::Base
|
|||
validates_presence_of :author_id
|
||||
validates_presence_of :source_branch
|
||||
validates_presence_of :target_branch
|
||||
validate :validate_branches
|
||||
|
||||
delegate :name,
|
||||
:email,
|
||||
|
@ -31,6 +32,13 @@ class MergeRequest < ActiveRecord::Base
|
|||
scope :closed, where(:closed => true)
|
||||
scope :assigned, lambda { |u| where(:assignee_id => u.id)}
|
||||
|
||||
|
||||
def validate_branches
|
||||
if target_branch == source_branch
|
||||
errors.add :base, "You can not use same branch for source and target branches"
|
||||
end
|
||||
end
|
||||
|
||||
def new?
|
||||
today? && created_at == updated_at
|
||||
end
|
||||
|
|
|
@ -10,10 +10,14 @@
|
|||
.input= f.text_area :title, :class => "xxlarge", :maxlength => 255, :rows => 5
|
||||
.clearfix
|
||||
= f.label :source_branch, "From"
|
||||
.input= f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px")
|
||||
.input
|
||||
= f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px")
|
||||
.mr_source_commit
|
||||
.clearfix
|
||||
= f.label :target_branch, "To"
|
||||
.input= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px")
|
||||
.input
|
||||
= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px")
|
||||
.mr_target_commit
|
||||
.clearfix
|
||||
= f.label :assignee_id, "Assign to"
|
||||
.input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px")
|
||||
|
@ -34,5 +38,15 @@
|
|||
$('select#merge_request_assignee_id').chosen();
|
||||
$('select#merge_request_source_branch').chosen();
|
||||
$('select#merge_request_target_branch').chosen();
|
||||
|
||||
|
||||
|
||||
$("#merge_request_source_branch").live("change", function() {
|
||||
$.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() });
|
||||
});
|
||||
|
||||
$("#merge_request_target_branch").live("change", function() {
|
||||
$.get("#{branch_to_project_merge_requests_path(@project)}", {ref: $(this).val() });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
2
app/views/merge_requests/branch_from.js.haml
Normal file
2
app/views/merge_requests/branch_from.js.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
:plain
|
||||
$(".mr_source_commit").html("#{escape_javascript(render 'commits/commit', :commit => @commit)}");
|
3
app/views/merge_requests/branch_to.js.haml
Normal file
3
app/views/merge_requests/branch_to.js.haml
Normal file
|
@ -0,0 +1,3 @@
|
|||
:plain
|
||||
$(".mr_target_commit").html("#{escape_javascript(render 'commits/commit', :commit => @commit)}");
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue