From 4e00330bb0361f102bbdf9f969273b919040f8a5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 Dec 2011 10:07:52 +0200 Subject: [PATCH] merge request js/css rewrite --- app/assets/images/.directory | 2 +- app/assets/javascripts/merge_requests.js | 36 ++++++++++++ app/assets/stylesheets/projects.css.scss | 58 +++++++------------ app/views/merge_requests/show.html.haml | 26 +++++---- .../stylesheets/jquery-ui/jquery-ui.css | 2 +- 5 files changed, 75 insertions(+), 49 deletions(-) diff --git a/app/assets/images/.directory b/app/assets/images/.directory index d6f1a908..3a654936 100644 --- a/app/assets/images/.directory +++ b/app/assets/images/.directory @@ -1,4 +1,4 @@ [Dolphin] ShowPreview=true -Timestamp=2011,10,28,13,16,25 +Timestamp=2011,12,12,23,25,14 Version=2 diff --git a/app/assets/javascripts/merge_requests.js b/app/assets/javascripts/merge_requests.js index e69de29b..d50cb5b5 100644 --- a/app/assets/javascripts/merge_requests.js +++ b/app/assets/javascripts/merge_requests.js @@ -0,0 +1,36 @@ +var MergeRequest = { + diff_loaded: false, + commits_loaded: false, + + init: + function() { + $(".merge-tabs a").live("click", function() { + $(".merge-tabs a").removeClass("active"); + $(this).addClass("active"); + }); + + $(".merge-tabs a.merge-commits-tab").live("click", function() { + if(MergeRequest.commits_loaded) { + $(".merge-request-commits").show(); + } else { + MergeRequest.loadCommits(); + } + }); + }, + + loadCommits: + function() { + $(".dashboard-loader").show(); + $.ajax({ + type: "GET", + url: location.href + "/commits", + complete: function(){ + MergeRequest.commits_loaded = true; + $(".dashboard-loader").hide()}, + dataType: "script"}); + }, + + loadDiff: + function() { + } +} diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index f923deb2..a99333a6 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -438,42 +438,6 @@ body.project-page table.no-borders td{ border:none; } -#gitlab-tabs { - .ui-tabs-nav { - border-bottom: 1px solid #DEDFE1; - - li { - background: none; - border:none; - font-size: 16px; - margin: 0; - padding: 0; - - a { - margin: 0; - padding: 10px 16px; - width:150px; - } - - &.ui-tabs-selected { - background-image: -webkit-gradient(linear, 0 0, 0 26, color-stop(0.076, #fefefe), to(#F6F7F8)); - background-image: -webkit-linear-gradient(#fefefe 7.6%, #F6F7F8); - background-image: -moz-linear-gradient(#fefefe 7.6%, #F6F7F8); - background-image: -o-linear-gradient(#fefefe 7.6%, #F6F7F8); - font-weight: bold; - border:1px solid #DEDFE1; - border-bottom: 1px solid #DEDFE1; - -webkit-border-top-left-radius: 5px; - -webkit-border-top-right-radius: 5px; - -moz-border-radius-topleft: 5px; - -moz-border-radius-topright: 5px; - border-top-left-radius: 5px; - border-top-right-radius: 5px; - } - } - } -} - .ajax-tab-loading { padding:40px; display:none; @@ -587,3 +551,25 @@ h4.middle-panel { margin-right:30px; display:none; } + +ul.merge-tabs { + margin: 0; + border: 1px solid #ccc; + padding: 10px; + font-size: 11px; + font-weight: bold; text-transform: uppercase; + background: #F7F7F7; + margin-bottom:20px; + + a { + margin-right:5px; + @include round-borders-all(4px); + border: 1px solid #ddd; + background:none; + padding: 4px 10px; + + &.active { + background: #eaeaea; + } + } +} diff --git a/app/views/merge_requests/show.html.haml b/app/views/merge_requests/show.html.haml index 96afb47a..5952b496 100644 --- a/app/views/merge_requests/show.html.haml +++ b/app/views/merge_requests/show.html.haml @@ -40,20 +40,24 @@ %br %br -#gitlab-tabs - %ul - %li= link_to "Notes", "#merge-notes" - %li= link_to "Commits", commits_project_merge_request_path(@project, @merge_request) - %li= link_to "Diff", diffs_project_merge_request_path(@project, @merge_request) +%ul.merge-tabs + = link_to "Notes", "#", :class => "merge-notes-tab" + = link_to "Commits","#", "data-url" => commits_project_merge_request_path(@project, @merge_request), :class => "merge-commits-tab" + = link_to "Diff", diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab" + %img{:src => "/assets/ajax-loader-facebook.gif", :class => "dashboard-loader"} - #merge-notes - .issue_notes= render "notes/notes" - .loading{ :style => "display:none;"} - %center= image_tag "ajax-loader.gif" - .clear +.merge-request-notes + .issue_notes= render "notes/notes" + .loading{ :style => "display:none;"} + %center= image_tag "ajax-loader.gif" + .clear + +.merge-request-commits + +.merge-request-diffs :javascript $(function(){ - $("#gitlab-tabs").tabs(); + MergeRequest.init(); }) diff --git a/vendor/assets/stylesheets/jquery-ui/jquery-ui.css b/vendor/assets/stylesheets/jquery-ui/jquery-ui.css index 357df7ab..acfa4f25 100644 --- a/vendor/assets/stylesheets/jquery-ui/jquery-ui.css +++ b/vendor/assets/stylesheets/jquery-ui/jquery-ui.css @@ -1,5 +1,5 @@ /* - * jQuery UI CSS Framework 1.8.16 + * jQuery UI CSS Framework 1.8.16 Patched for GitLab HQ * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses.