Commit fa7bd43ab9ac6e5885705aabc036660de5edbe1b

Authored by Dmitriy Zaporozhets
1 parent 94db8a1c

How to merge instructions

app/assets/images/Info-UI.PNG

800 Bytes | W: | H:

801 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/assets/javascripts/application.js
... ... @@ -11,6 +11,7 @@
11 11 //= require jquery.tagify
12 12 //= require jquery.cookie
13 13 //= require jquery.endless-scroll
  14 +//= require bootstrap-modal
14 15 //= require modernizr
15 16 //= require chosen
16 17 //= require raphael
... ...
app/assets/stylesheets/common.scss
... ... @@ -313,3 +313,12 @@ img.lil_av {
313 313 padding:10px 0;
314 314 padding-bottom:0;
315 315 }
  316 +
  317 +.info_link {
  318 + margin-right:5px;
  319 + float:left;
  320 +
  321 + img {
  322 + width:20px;
  323 + }
  324 +}
... ...
app/views/merge_requests/_how_to_merge.html.haml 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +%div#modal_merge_info.modal.hide
  2 + .modal-header
  3 + %a.close{:href => "#"} ×
  4 + %h3 How To Merge
  5 + .modal-body
  6 + %pre
  7 + :erb
  8 + git fetch origin
  9 + git checkout -b <%=@merge_request.source_branch%> origin/<%=@merge_request.source_branch%>
  10 + git checkout <%=@merge_request.target_branch%>
  11 + git merge <%=@merge_request.source_branch%>
  12 + git push origin <%=@merge_request.target_branch%>
  13 +
  14 +
  15 +:javascript
  16 + $(function(){
  17 + var modal = $('#modal_merge_info').modal({modal: true});
  18 + $('.info_link').bind("click", function(){
  19 + modal.show();
  20 + });
  21 + $('.modal-header .close').bind("click", function(){
  22 + modal.hide();
  23 + })
  24 + })
  25 +
... ...
app/views/merge_requests/show.html.haml
... ... @@ -22,12 +22,18 @@
22 22 .back_link
23 23 = link_to project_merge_requests_path(@project) do
24 24 &larr; To merge requests
  25 +
  26 +
25 27 %hr
26 28 - if @merge_request.closed
27 29 .alert-message.error Closed
28 30 - else
29   - .alert-message.success Open
  31 + .alert-message.success
  32 + = link_to "#", :class => "info_link", :title => "How To Merge" do
  33 + = image_tag "Info-UI.PNG"
  34 + Open
30 35  
  36 += render "merge_requests/how_to_merge"
31 37  
32 38 %div.well
33 39 %div
... ...
vendor/assets/javascripts/bootstrap-modal.js 0 → 100644
... ... @@ -0,0 +1,260 @@
  1 +/* =========================================================
  2 + * bootstrap-modal.js v1.4.0
  3 + * http://twitter.github.com/bootstrap/javascript.html#modal
  4 + * =========================================================
  5 + * Copyright 2011 Twitter, Inc.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + * ========================================================= */
  19 +
  20 +
  21 +!function( $ ){
  22 +
  23 + "use strict"
  24 +
  25 + /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
  26 + * ======================================================= */
  27 +
  28 + var transitionEnd
  29 +
  30 + $(document).ready(function () {
  31 +
  32 + $.support.transition = (function () {
  33 + var thisBody = document.body || document.documentElement
  34 + , thisStyle = thisBody.style
  35 + , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
  36 + return support
  37 + })()
  38 +
  39 + // set CSS transition event type
  40 + if ( $.support.transition ) {
  41 + transitionEnd = "TransitionEnd"
  42 + if ( $.browser.webkit ) {
  43 + transitionEnd = "webkitTransitionEnd"
  44 + } else if ( $.browser.mozilla ) {
  45 + transitionEnd = "transitionend"
  46 + } else if ( $.browser.opera ) {
  47 + transitionEnd = "oTransitionEnd"
  48 + }
  49 + }
  50 +
  51 + })
  52 +
  53 +
  54 + /* MODAL PUBLIC CLASS DEFINITION
  55 + * ============================= */
  56 +
  57 + var Modal = function ( content, options ) {
  58 + this.settings = $.extend({}, $.fn.modal.defaults, options)
  59 + this.$element = $(content)
  60 + .delegate('.close', 'click.modal', $.proxy(this.hide, this))
  61 +
  62 + if ( this.settings.show ) {
  63 + this.show()
  64 + }
  65 +
  66 + return this
  67 + }
  68 +
  69 + Modal.prototype = {
  70 +
  71 + toggle: function () {
  72 + return this[!this.isShown ? 'show' : 'hide']()
  73 + }
  74 +
  75 + , show: function () {
  76 + var that = this
  77 + this.isShown = true
  78 + this.$element.trigger('show')
  79 +
  80 + escape.call(this)
  81 + backdrop.call(this, function () {
  82 + var transition = $.support.transition && that.$element.hasClass('fade')
  83 +
  84 + that.$element
  85 + .appendTo(document.body)
  86 + .show()
  87 +
  88 + if (transition) {
  89 + that.$element[0].offsetWidth // force reflow
  90 + }
  91 +
  92 + that.$element.addClass('in')
  93 +
  94 + transition ?
  95 + that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
  96 + that.$element.trigger('shown')
  97 +
  98 + })
  99 +
  100 + return this
  101 + }
  102 +
  103 + , hide: function (e) {
  104 + e && e.preventDefault()
  105 +
  106 + if ( !this.isShown ) {
  107 + return this
  108 + }
  109 +
  110 + var that = this
  111 + this.isShown = false
  112 +
  113 + escape.call(this)
  114 +
  115 + this.$element
  116 + .trigger('hide')
  117 + .removeClass('in')
  118 +
  119 + $.support.transition && this.$element.hasClass('fade') ?
  120 + hideWithTransition.call(this) :
  121 + hideModal.call(this)
  122 +
  123 + return this
  124 + }
  125 +
  126 + }
  127 +
  128 +
  129 + /* MODAL PRIVATE METHODS
  130 + * ===================== */
  131 +
  132 + function hideWithTransition() {
  133 + // firefox drops transitionEnd events :{o
  134 + var that = this
  135 + , timeout = setTimeout(function () {
  136 + that.$element.unbind(transitionEnd)
  137 + hideModal.call(that)
  138 + }, 500)
  139 +
  140 + this.$element.one(transitionEnd, function () {
  141 + clearTimeout(timeout)
  142 + hideModal.call(that)
  143 + })
  144 + }
  145 +
  146 + function hideModal (that) {
  147 + this.$element
  148 + .hide()
  149 + .trigger('hidden')
  150 +
  151 + backdrop.call(this)
  152 + }
  153 +
  154 + function backdrop ( callback ) {
  155 + var that = this
  156 + , animate = this.$element.hasClass('fade') ? 'fade' : ''
  157 + if ( this.isShown && this.settings.backdrop ) {
  158 + var doAnimate = $.support.transition && animate
  159 +
  160 + this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
  161 + .appendTo(document.body)
  162 +
  163 + if ( this.settings.backdrop != 'static' ) {
  164 + this.$backdrop.click($.proxy(this.hide, this))
  165 + }
  166 +
  167 + if ( doAnimate ) {
  168 + this.$backdrop[0].offsetWidth // force reflow
  169 + }
  170 +
  171 + this.$backdrop.addClass('in')
  172 +
  173 + doAnimate ?
  174 + this.$backdrop.one(transitionEnd, callback) :
  175 + callback()
  176 +
  177 + } else if ( !this.isShown && this.$backdrop ) {
  178 + this.$backdrop.removeClass('in')
  179 +
  180 + $.support.transition && this.$element.hasClass('fade')?
  181 + this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
  182 + removeBackdrop.call(this)
  183 +
  184 + } else if ( callback ) {
  185 + callback()
  186 + }
  187 + }
  188 +
  189 + function removeBackdrop() {
  190 + this.$backdrop.remove()
  191 + this.$backdrop = null
  192 + }
  193 +
  194 + function escape() {
  195 + var that = this
  196 + if ( this.isShown && this.settings.keyboard ) {
  197 + $(document).bind('keyup.modal', function ( e ) {
  198 + if ( e.which == 27 ) {
  199 + that.hide()
  200 + }
  201 + })
  202 + } else if ( !this.isShown ) {
  203 + $(document).unbind('keyup.modal')
  204 + }
  205 + }
  206 +
  207 +
  208 + /* MODAL PLUGIN DEFINITION
  209 + * ======================= */
  210 +
  211 + $.fn.modal = function ( options ) {
  212 + var modal = this.data('modal')
  213 +
  214 + if (!modal) {
  215 +
  216 + if (typeof options == 'string') {
  217 + options = {
  218 + show: /show|toggle/.test(options)
  219 + }
  220 + }
  221 +
  222 + return this.each(function () {
  223 + $(this).data('modal', new Modal(this, options))
  224 + })
  225 + }
  226 +
  227 + if ( options === true ) {
  228 + return modal
  229 + }
  230 +
  231 + if ( typeof options == 'string' ) {
  232 + modal[options]()
  233 + } else if ( modal ) {
  234 + modal.toggle()
  235 + }
  236 +
  237 + return this
  238 + }
  239 +
  240 + $.fn.modal.Modal = Modal
  241 +
  242 + $.fn.modal.defaults = {
  243 + backdrop: false
  244 + , keyboard: false
  245 + , show: false
  246 + }
  247 +
  248 +
  249 + /* MODAL DATA- IMPLEMENTATION
  250 + * ========================== */
  251 +
  252 + $(document).ready(function () {
  253 + $('body').delegate('[data-controls-modal]', 'click', function (e) {
  254 + e.preventDefault()
  255 + var $this = $(this).data('show', true)
  256 + $('#' + $this.attr('data-controls-modal')).modal( $this.data() )
  257 + })
  258 + })
  259 +
  260 +}( window.jQuery || window.ender );
... ...
vendor/assets/javascripts/bootstrap-popover.js 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +/* ===========================================================
  2 + * bootstrap-popover.js v1.4.0
  3 + * http://twitter.github.com/bootstrap/javascript.html#popover
  4 + * ===========================================================
  5 + * Copyright 2011 Twitter, Inc.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + * =========================================================== */
  19 +
  20 +
  21 +!function( $ ) {
  22 +
  23 + "use strict"
  24 +
  25 + var Popover = function ( element, options ) {
  26 + this.$element = $(element)
  27 + this.options = options
  28 + this.enabled = true
  29 + this.fixTitle()
  30 + }
  31 +
  32 + /* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
  33 + ========================================= */
  34 +
  35 + Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
  36 +
  37 + setContent: function () {
  38 + var $tip = this.tip()
  39 + $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
  40 + $tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
  41 + $tip[0].className = 'popover'
  42 + }
  43 +
  44 + , hasContent: function () {
  45 + return this.getTitle() || this.getContent()
  46 + }
  47 +
  48 + , getContent: function () {
  49 + var content
  50 + , $e = this.$element
  51 + , o = this.options
  52 +
  53 + if (typeof this.options.content == 'string') {
  54 + content = this.options.content
  55 + } else if (typeof this.options.content == 'function') {
  56 + content = this.options.content.call(this.$element[0])
  57 + }
  58 + return content
  59 + }
  60 +
  61 + , tip: function() {
  62 + if (!this.$tip) {
  63 + this.$tip = $('<div class="popover" />')
  64 + .html(this.options.template)
  65 + }
  66 + return this.$tip
  67 + }
  68 +
  69 + })
  70 +
  71 +
  72 + /* POPOVER PLUGIN DEFINITION
  73 + * ======================= */
  74 +
  75 + $.fn.popover = function (options) {
  76 + if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
  77 + $.fn.twipsy.initWith.call(this, options, Popover, 'popover')
  78 + return this
  79 + }
  80 +
  81 + $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
  82 + placement: 'right'
  83 + , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
  84 + })
  85 +
  86 +}( window.jQuery || window.ender );
0 87 \ No newline at end of file
... ...