summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-08-08 17:29:31 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-08-08 17:29:31 +0300
commit7fefb0397eea99910537541bbba70d0a68a44644 (patch)
treed55212a519b4db2d161c00361e70089d241f63f2 /app
parent02c3bb7a32058a355756f0f77b2b8208913205e5 (diff)
downloadgitlab-ce-7fefb0397eea99910537541bbba70d0a68a44644.tar.gz
Fix filter context. Dont duplicate target project name for MR
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/common.scss12
-rw-r--r--app/assets/stylesheets/gitlab_bootstrap/mixins.scss4
-rw-r--r--app/assets/stylesheets/sections/merge_requests.scss13
-rw-r--r--app/contexts/filter_context.rb2
-rw-r--r--app/models/concerns/issuable.rb1
-rw-r--r--app/models/issue.rb1
-rw-r--r--app/models/merge_request.rb2
-rw-r--r--app/views/projects/merge_requests/_merge_request.html.haml10
-rw-r--r--app/views/projects/merge_requests/show/_mr_title.html.haml6
9 files changed, 27 insertions, 24 deletions
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index ee6d5698e32..2ab3a1b3b52 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -364,18 +364,6 @@ img.emoji {
margin-bottom: 10px;
}
-.label-project {
- @include border-radius(4px);
- padding: 2px 4px;
- border: none;
- font-size: 14px;
- background: #474D57;
- color: #fff;
- font-family: $monospace_font;
- text-shadow: 0 1px 1px #111;
- font-weight: normal;
-}
-
.group-name {
font-size: 14px;
line-height: 24px;
diff --git a/app/assets/stylesheets/gitlab_bootstrap/mixins.scss b/app/assets/stylesheets/gitlab_bootstrap/mixins.scss
index 9ddaaf31c1c..8676cc624ce 100644
--- a/app/assets/stylesheets/gitlab_bootstrap/mixins.scss
+++ b/app/assets/stylesheets/gitlab_bootstrap/mixins.scss
@@ -17,6 +17,10 @@
border-radius: $radius;
}
+@mixin border-radius-left($radius) {
+ @include border-radius($radius 0 0 $radius)
+}
+
@mixin linear-gradient($from, $to) {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from($from), to($to));
background-image: -webkit-linear-gradient($from, $to);
diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss
index 083c330b1cd..9a8af301442 100644
--- a/app/assets/stylesheets/sections/merge_requests.scss
+++ b/app/assets/stylesheets/sections/merge_requests.scss
@@ -84,14 +84,23 @@
.label-branch {
@include border-radius(4px);
- padding: 2px 4px;
+ padding: 3px 4px;
border: none;
font-size: 14px;
background: #474D57;
color: #fff;
font-family: $monospace_font;
- text-shadow: 0 1px 1px #111;
font-weight: normal;
+ overflow: hidden;
+
+ .label-project {
+ @include border-radius-left(4px);
+ padding: 3px 4px;
+ background: #29A;
+ position: relative;
+ left: -4px;
+ letter-spacing: -1px;
+ }
}
.mr-list {
diff --git a/app/contexts/filter_context.rb b/app/contexts/filter_context.rb
index cd054e0c2c3..2607b12b4ae 100644
--- a/app/contexts/filter_context.rb
+++ b/app/contexts/filter_context.rb
@@ -12,7 +12,7 @@ class FilterContext
def apply_filter items
if params[:project_id].present?
- items = items.where(project_id: params[:project_id])
+ items = items.of_projects(params[:project_id])
end
if params[:search].present?
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 88de1a037aa..24818a927ed 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -21,6 +21,7 @@ module Issuable
scope :recent, -> { order("created_at DESC") }
scope :assigned, -> { where("assignee_id IS NOT NULL") }
scope :unassigned, -> { where("assignee_id IS NULL") }
+ scope :of_projects, ->(ids) { where(project_id: ids) }
delegate :name,
:email,
diff --git a/app/models/issue.rb b/app/models/issue.rb
index c171941928c..550041a0224 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -27,7 +27,6 @@ class Issue < ActiveRecord::Base
scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) }
scope :opened, -> { with_state(:opened) }
scope :closed, -> { with_state(:closed) }
- scope :by_project, ->(project_id) {where(project_id:project_id)}
attr_accessible :title, :assignee_id, :position, :description,
:milestone_id, :label_list, :author_id_of_changes,
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 9abdd41ec4e..b7df2e40a16 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -93,8 +93,8 @@ class MergeRequest < ActiveRecord::Base
scope :by_branch, ->(branch_name) { where("(source_branch LIKE :branch) OR (target_branch LIKE :branch)", branch: branch_name) }
scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) }
scope :by_milestone, ->(milestone) { where(milestone_id: milestone) }
- scope :by_project, ->(project_id) { where("source_project_id = :project_id OR target_project_id = :project_id", project_id: project_id) }
scope :in_projects, ->(project_ids) { where("source_project_id in (:project_ids) OR target_project_id in (:project_ids)", project_ids: project_ids) }
+ scope :of_projects, ->(ids) { where(target_project_id: ids) }
# Closed scope for merge request should return
# both merged and closed mr's
scope :closed, -> { with_states(:closed, :merged) }
diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml
index a10ed02a077..276436a9c8e 100644
--- a/app/views/projects/merge_requests/_merge_request.html.haml
+++ b/app/views/projects/merge_requests/_merge_request.html.haml
@@ -9,12 +9,14 @@
- else
%span.pull-right
- if merge_request.for_fork?
- = "#{merge_request.source_project.path_with_namespace}/#{merge_request.source_branch}"
- %i.icon-angle-right
- = "#{merge_request.target_project.path_with_namespace}/#{merge_request.target_branch}"
+ %span.light
+ = "#{merge_request.source_project.path_with_namespace}"
+ = "#{merge_request.source_branch}"
+ %i.icon-angle-right.light
+ = "#{merge_request.target_branch}"
- else
= "#{merge_request.source_branch}"
- %i.icon-angle-right
+ %i.icon-angle-right.light
= "#{merge_request.target_branch}"
.merge-request-info
- if merge_request.author
diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml
index e7838733af3..7dfc995121f 100644
--- a/app/views/projects/merge_requests/show/_mr_title.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_title.html.haml
@@ -2,10 +2,10 @@
= "Merge Request ##{@merge_request.id}:"
&nbsp;
-if @merge_request.for_fork?
- %span.label-project= truncate(@merge_request.source_project.path_with_namespace, length: 25)
- %span.label-branch= @merge_request.source_branch
+ %span.label-branch
+ %span.label-project= truncate(@merge_request.source_project.path_with_namespace, length: 25)
+ #{@merge_request.source_branch}
&rarr;
- %span.label-project= truncate(@merge_request.target_project.path_with_namespace, length: 25)
%span.label-branch= @merge_request.target_branch
- else
%span.label-branch= @merge_request.source_branch