From fa7bd43ab9ac6e5885705aabc036660de5edbe1b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 18 Feb 2012 14:43:35 +0200 Subject: [PATCH] How to merge instructions --- app/assets/images/Info-UI.PNG | Bin 800 -> 801 bytes app/assets/javascripts/application.js | 1 + app/assets/stylesheets/common.scss | 9 + .../merge_requests/_how_to_merge.html.haml | 25 ++ app/views/merge_requests/show.html.haml | 8 +- vendor/assets/javascripts/bootstrap-modal.js | 260 ++++++++++++++++++ .../assets/javascripts/bootstrap-popover.js | 86 ++++++ 7 files changed, 388 insertions(+), 1 deletion(-) create mode 100644 app/views/merge_requests/_how_to_merge.html.haml create mode 100644 vendor/assets/javascripts/bootstrap-modal.js create mode 100644 vendor/assets/javascripts/bootstrap-popover.js diff --git a/app/assets/images/Info-UI.PNG b/app/assets/images/Info-UI.PNG index 92795486913988cb56cc2596769ac6c397d0bd1d..7f48ed8d3f16541788d6d2c2117b6ac4afa7bb37 100644 GIT binary patch delta 696 zcmZ3$wvcT?JTH?Fj|kt(FFUs}Ffc8gm?KrMytd`e7c;?1vxzK;0*%uD8^i=za-*d# znoTitdK(q-oh{FcMKQyC!3;s&rVK@o6PMe!w-(1;f4%p6>}tk? zo?+-#s^1j)L?ks|=y)N+PUby~^HLoyHT}4fS0g=xJuS49OTn+LBtn zk!it;YJCGnot3XPe6N$Aar$eD)QtbM&FHH>8w zSB&t)_0Q}%&xAFsWmZ<&BzXK|+{-l|`5X3eHPvt^q;=OH@M@fIyg~7SV8i!$Cp2v4 zz4V;PyDCfh^KXrUMMtjRyssN7%a!R$kT zOI_5@zAGLA4r;ZZu*^Bt zxYYDl_>=!JF3S#W>%CO6evi^8)*V@@XU_Fmv;1W~QN!RliRJy@`Oc3l_*Vb1nQ+6d z(6m$FPg#SwlF`(9-qI-ttNkab-1sHSIFI3emcf}+DSOGhN%cjcX*u4jGv7A{Dm&Ln zi1*ZnLU|?Wi@O1Ta JS?83{1OSj?KS=-p delta 695 zcmZ3;wt#IyJTIe=FpuUudoD=^2BrlQbEN7$wH3|x`nt@EbP;NCWXb!(9OWXgB{$RM zcEBx;t=Wmi`45)42sB;mlDw$YA=cDlQ(F;j@w{~Jz3Tg0r37lG&-{FL=FexdAD@Vv zq|(#d%c!6vXuvRsWgUZfLtOD)20Nzt4ZfkdtrZK3-3;72J5NX^$n0Q`S$1bzgZTlT z4J%gFN4xq3ep4%yVV|)3K=gx3HWl3t|F_4=8!8jRT-qAWMY1K?>l=AJ)Svl z%FP8GCPw@Fnbf^%=Kj4aHu0fD8{^`F(8r8<4E$@DmN%v!_^5YsF6%6%M{_O~?)5&P zzaZ7~EA#FH+y1`ab>!HAwQasOqCU(Oyk{h5OFgsZvRSyhm#LO_vgodqGSLj?{*bTB zr@r^-Wnt`Nv<-Bt-@QWOOz{B`gGoQ{1uGxCP%M6R$F9>XUy3b?BROwb_#BA8m6sB9 zzxUSvq-+Q4O|_f8%5TzpeV*w;SA*|u^(!GSciAa^tPH)|mt%bHM$eS5>7o_vHRo#L zH_C2_TH1f0h&|MW&8Jh{>)9jG5BJiPUc}z+xUyx(AKu#smaIDW_O^SynydGLl`;`g zi|bwg>4%hR<=ocr{eEios`!TNutRU&>~Owd-*AR~f{N#dd;cv}`W|mMb)LENt#J5c zj)VE^6)RT-|GXaHF1hEsif7Z>`+^TNKdfat9JB1> "#"} × + %h3 How To Merge + .modal-body + %pre + :erb + git fetch origin + git checkout -b <%=@merge_request.source_branch%> origin/<%=@merge_request.source_branch%> + git checkout <%=@merge_request.target_branch%> + git merge <%=@merge_request.source_branch%> + git push origin <%=@merge_request.target_branch%> + + +:javascript + $(function(){ + var modal = $('#modal_merge_info').modal({modal: true}); + $('.info_link').bind("click", function(){ + modal.show(); + }); + $('.modal-header .close').bind("click", function(){ + modal.hide(); + }) + }) + diff --git a/app/views/merge_requests/show.html.haml b/app/views/merge_requests/show.html.haml index b270175d105..dd3fc7c608b 100644 --- a/app/views/merge_requests/show.html.haml +++ b/app/views/merge_requests/show.html.haml @@ -22,12 +22,18 @@ .back_link = link_to project_merge_requests_path(@project) do ← To merge requests + + %hr - if @merge_request.closed .alert-message.error Closed - else - .alert-message.success Open + .alert-message.success + = link_to "#", :class => "info_link", :title => "How To Merge" do + = image_tag "Info-UI.PNG" + Open += render "merge_requests/how_to_merge" %div.well %div diff --git a/vendor/assets/javascripts/bootstrap-modal.js b/vendor/assets/javascripts/bootstrap-modal.js new file mode 100644 index 00000000000..b328217f813 --- /dev/null +++ b/vendor/assets/javascripts/bootstrap-modal.js @@ -0,0 +1,260 @@ +/* ========================================================= + * bootstrap-modal.js v1.4.0 + * http://twitter.github.com/bootstrap/javascript.html#modal + * ========================================================= + * Copyright 2011 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + + +!function( $ ){ + + "use strict" + + /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) + * ======================================================= */ + + var transitionEnd + + $(document).ready(function () { + + $.support.transition = (function () { + var thisBody = document.body || document.documentElement + , thisStyle = thisBody.style + , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined + return support + })() + + // set CSS transition event type + if ( $.support.transition ) { + transitionEnd = "TransitionEnd" + if ( $.browser.webkit ) { + transitionEnd = "webkitTransitionEnd" + } else if ( $.browser.mozilla ) { + transitionEnd = "transitionend" + } else if ( $.browser.opera ) { + transitionEnd = "oTransitionEnd" + } + } + + }) + + + /* MODAL PUBLIC CLASS DEFINITION + * ============================= */ + + var Modal = function ( content, options ) { + this.settings = $.extend({}, $.fn.modal.defaults, options) + this.$element = $(content) + .delegate('.close', 'click.modal', $.proxy(this.hide, this)) + + if ( this.settings.show ) { + this.show() + } + + return this + } + + Modal.prototype = { + + toggle: function () { + return this[!this.isShown ? 'show' : 'hide']() + } + + , show: function () { + var that = this + this.isShown = true + this.$element.trigger('show') + + escape.call(this) + backdrop.call(this, function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + that.$element + .appendTo(document.body) + .show() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element.addClass('in') + + transition ? + that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') + + }) + + return this + } + + , hide: function (e) { + e && e.preventDefault() + + if ( !this.isShown ) { + return this + } + + var that = this + this.isShown = false + + escape.call(this) + + this.$element + .trigger('hide') + .removeClass('in') + + $.support.transition && this.$element.hasClass('fade') ? + hideWithTransition.call(this) : + hideModal.call(this) + + return this + } + + } + + + /* MODAL PRIVATE METHODS + * ===================== */ + + function hideWithTransition() { + // firefox drops transitionEnd events :{o + var that = this + , timeout = setTimeout(function () { + that.$element.unbind(transitionEnd) + hideModal.call(that) + }, 500) + + this.$element.one(transitionEnd, function () { + clearTimeout(timeout) + hideModal.call(that) + }) + } + + function hideModal (that) { + this.$element + .hide() + .trigger('hidden') + + backdrop.call(this) + } + + function backdrop ( callback ) { + var that = this + , animate = this.$element.hasClass('fade') ? 'fade' : '' + if ( this.isShown && this.settings.backdrop ) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $('