diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-01-28 01:00:04 +0300 |
---|---|---|
committer | Rubén Dávila <rdavila84@gmail.com> | 2016-02-03 01:46:21 +0300 |
commit | 2ac744e9d9986f6ddf14e5d016a4a9ae9b38af85 (patch) | |
tree | a45e04e0aee9942bd6c87284a47c91cd22d0e6ed | |
parent | 7ecd30a840fb00f7a3831adba5349cb89ecfb104 (diff) |
Show buttons based on current tab.
-rw-r--r-- | app/assets/javascripts/milestone.js.coffee | 10 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/milestone.scss | 2 | ||||
-rw-r--r-- | app/views/projects/milestones/show.html.haml | 38 |
3 files changed, 25 insertions, 25 deletions
diff --git a/app/assets/javascripts/milestone.js.coffee b/app/assets/javascripts/milestone.js.coffee index d644d50b669..31f6c6d3d47 100644 --- a/app/assets/javascripts/milestone.js.coffee +++ b/app/assets/javascripts/milestone.js.coffee @@ -64,6 +64,7 @@ class @Milestone constructor: -> @bindIssuesSorting() @bindMergeRequestSorting() + @bindTabsSwitching bindIssuesSorting: -> $("#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed").sortable( @@ -122,3 +123,12 @@ class @Milestone Milestone.updateMergeRequest(ui.item, merge_request_url, data) ).disableSelection() + + bindMergeRequestSorting: -> + $('a[data-toggle="tab"]').on 'show.bs.tab', (e) -> + currentTabClass = $(e.target).data('show') + previousTabClass = $(e.relatedTarget).data('show') + + $(previousTabClass).hide() + $(currentTabClass).removeClass('hidden') + $(currentTabClass).show() diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index 55d09ca8efe..f3ff00855c6 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -29,7 +29,7 @@ li.milestone { } .milestone-summary { - margin-bottom: 15px; + margin-bottom: 25px; } .milestone-stat { diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index a9cf7e96359..460950d59d7 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -63,16 +63,26 @@ %span.time-elapsed %strong== #{@milestone.percent_time_used}% time elapsed - %span.pull-right= @milestone.expires_at + %span.pull-right.tab-issues-buttons.tab-labels-buttons + - if can?(current_user, :create_issue, @project) + = link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { milestone_id: @milestone.id }), class: "btn btn-grouped", title: "New Issue" do + %i.fa.fa-plus + New Issue + - if can?(current_user, :read_issue, @project) + = link_to 'Browse Issues', namespace_project_issues_path(@milestone.project.namespace, @milestone.project, milestone_title: @milestone.title), class: "btn btn-grouped" + %span.pull-right.tab-merge-requests-buttons.hidden + - if can?(current_user, :read_merge_request, @project) + = link_to 'Browse Merge Requests', namespace_project_merge_requests_path(@milestone.project.namespace, @milestone.project, milestone_title: @milestone.title), class: "btn btn-grouped" + = milestone_progress_bar(@milestone) %ul.nav-links.no-top.no-bottom %li.active - = link_to '#tab-issues', 'data-toggle' => 'tab' do + = link_to '#tab-issues', 'data-toggle' => 'tab', 'data-show' => '.tab-issues-buttons' do Issues %span.badge= @issues.count %li - = link_to '#tab-merge-requests', 'data-toggle' => 'tab' do + = link_to '#tab-merge-requests', 'data-toggle' => 'tab', 'data-show' => '.tab-merge-requests-buttons' do Merge Requests %span.badge= @merge_requests.count %li @@ -80,24 +90,12 @@ Participants %span.badge= @users.count %li - = link_to '#tab-labels', 'data-toggle' => 'tab' do + = link_to '#tab-labels', 'data-toggle' => 'tab', 'data-show' => '.tab-issues-buttons' do Labels %span.badge= @labels.count .tab-content .tab-pane.active#tab-issues - .content-block.oneline-block - .controls - - if can?(current_user, :create_issue, @project) - = link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { milestone_id: @milestone.id }), class: "btn btn-grouped", title: "New Issue" do - %i.fa.fa-plus - New Issue - - if can?(current_user, :read_issue, @project) - = link_to 'Browse Issues', namespace_project_issues_path(@milestone.project.namespace, @milestone.project, milestone_title: @milestone.title), class: "btn btn-grouped" - - .oneline - All issues in this milestone - .row.prepend-top-default .col-md-4 = render('issues', title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned, id: 'unassigned') @@ -107,14 +105,6 @@ = render('issues', title: 'Completed Issues (closed)', issues: @issues.closed, id: 'closed') .tab-pane#tab-merge-requests - .content-block.oneline-block - .controls - - if can?(current_user, :read_merge_request, @project) - = link_to 'Browse Merge Requests', namespace_project_merge_requests_path(@milestone.project.namespace, @milestone.project, milestone_title: @milestone.title), class: "btn btn-grouped" - - .oneline - All merge requests in this milestone - .row.prepend-top-default .col-md-3 = render('merge_requests', title: 'Work in progress (open and unassigned)', merge_requests: @merge_requests.opened.unassigned, id: 'unassigned') |