diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js deleted file mode 100644 index f69b750..0000000 --- a/app/assets/javascripts/application.js +++ /dev/null @@ -1,33 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery.ui.all -//= require jquery_ujs -//= require jquery.cookie -//= require jquery.endless-scroll -//= require jquery.highlight -//= require jquery.history -//= require jquery.waitforimages -//= require jquery.atwho -//= require jquery.scrollto -//= require jquery.blockUI -//= require turbolinks -//= require jquery.turbolinks -//= require bootstrap -//= require modernizr -//= require select2 -//= require raphael -//= require g.raphael-min -//= require g.bar-min -//= require branch-graph -//= require highlightjs.min -//= require ace/ace -//= require_tree . -//= require d3 -//= require underscore -//= require nprogress -//= require nprogress-turbolinks diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee new file mode 100644 index 0000000..5042221 --- /dev/null +++ b/app/assets/javascripts/application.js.coffee @@ -0,0 +1,154 @@ +# This is a manifest file that'll be compiled into including all the files listed below. +# Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +# be included in the compiled file accessible from http://example.com/assets/application.js +# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +# the compiled file. +# +#= require jquery +#= require jquery.ui.all +#= require jquery_ujs +#= require jquery.cookie +#= require jquery.endless-scroll +#= require jquery.highlight +#= require jquery.history +#= require jquery.waitforimages +#= require jquery.atwho +#= require jquery.scrollto +#= require jquery.blockUI +#= require turbolinks +#= require jquery.turbolinks +#= require bootstrap +#= require modernizr +#= require select2 +#= require raphael +#= require g.raphael-min +#= require g.bar-min +#= require branch-graph +#= require highlightjs.min +#= require ace/ace +#= require d3 +#= require underscore +#= require nprogress +#= require nprogress-turbolinks +#= require_tree . + +window.slugify = (text) -> + text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase() + +window.ajaxGet = (url) -> + $.ajax({type: "GET", url: url, dataType: "script"}) + +window.showAndHide = (selector) -> + +window.errorMessage = (message) -> + ehtml = $("
")
+ ehtml.addClass("error_message")
+ ehtml.html(message)
+ ehtml
+
+window.split = (val) ->
+ return val.split( /,\s*/ )
+
+window.extractLast = (term) ->
+ return split( term ).pop()
+
+# Disable button if text field is empty
+window.disableButtonIfEmptyField = (field_selector, button_selector) ->
+ field = $(field_selector)
+ closest_submit = field.closest("form").find(button_selector)
+
+ closest_submit.disable() if field.val() is ""
+
+ field.on "input", ->
+ if $(@).val() is ""
+ closest_submit.disable()
+ else
+ closest_submit.enable()
+
+window.sanitize = (str) ->
+ return str.replace(/<(?:.|\n)*?>/gm, '')
+
+window.linkify = (str) ->
+ exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
+ return str.replace(exp,"$1")
+
+window.simpleFormat = (str) ->
+ linkify(sanitize(str).replace(/\n/g, '
'))
+
+window.unbindEvents = ->
+ $(document).unbind('scroll')
+ $(document).off('scroll')
+
+document.addEventListener("page:fetch", unbindEvents)
+
+$ ->
+ # Click a .one_click_select field, select the contents
+ $(".one_click_select").on 'click', -> $(@).select()
+
+ $('.remove-row').bind 'ajax:success', ->
+ $(this).closest('li').fadeOut()
+
+ # Initialize select2 selects
+ $('select.select2').select2(width: 'resolve', dropdownAutoWidth: true)
+
+ # Initialize tooltips
+ $('.has_tooltip').tooltip()
+
+ # Bottom tooltip
+ $('.has_bottom_tooltip').tooltip(placement: 'bottom')
+
+ # Form submitter
+ $('.trigger-submit').on 'change', ->
+ $(@).parents('form').submit()
+
+ $("abbr.timeago").timeago()
+ $('.js-timeago').timeago()
+
+ # Flash
+ if (flash = $(".flash-container")).length > 0
+ flash.click -> $(@).fadeOut()
+ flash.show()
+ setTimeout (-> flash.fadeOut()), 5000
+
+ # Disable form buttons while a form is submitting
+ $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
+ buttons = $('[type="submit"]', @)
+
+ switch e.type
+ when 'ajax:beforeSend', 'submit'
+ buttons.disable()
+ else
+ buttons.enable()
+
+ # Show/Hide the profile menu when hovering the account box
+ $('.account-box').hover -> $(@).toggleClass('hover')
+
+ # Focus search field by pressing 's' key
+ $(document).keypress (e) ->
+ # Don't do anything if typing in an input
+ return if $(e.target).is(":input")
+
+ switch e.which
+ when 115
+ $("#search").focus()
+ e.preventDefault()
+ when 63
+ new Shortcuts()
+ e.preventDefault()
+
+
+ # Commit show suppressed diff
+ $(".diff-content").on "click", ".supp_diff_link", ->
+ $(@).next('table').show()
+ $(@).remove()
+
+(($) ->
+ # Disable an element and add the 'disabled' Bootstrap class
+ $.fn.extend disable: ->
+ $(@).attr('disabled', 'disabled').addClass('disabled')
+
+ # Enable an element and remove the 'disabled' Bootstrap class
+ $.fn.extend enable: ->
+ $(@).removeAttr('disabled').removeClass('disabled')
+
+)(jQuery)
diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee
deleted file mode 100644
index 89f6a54..0000000
--- a/app/assets/javascripts/main.js.coffee
+++ /dev/null
@@ -1,120 +0,0 @@
-window.slugify = (text) ->
- text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase()
-
-window.ajaxGet = (url) ->
- $.ajax({type: "GET", url: url, dataType: "script"})
-
-window.showAndHide = (selector) ->
-
-window.errorMessage = (message) ->
- ehtml = $("
")
- ehtml.addClass("error_message")
- ehtml.html(message)
- ehtml
-
-window.split = (val) ->
- return val.split( /,\s*/ )
-
-window.extractLast = (term) ->
- return split( term ).pop()
-
-# Disable button if text field is empty
-window.disableButtonIfEmptyField = (field_selector, button_selector) ->
- field = $(field_selector)
- closest_submit = field.closest("form").find(button_selector)
-
- closest_submit.disable() if field.val() is ""
-
- field.on "input", ->
- if $(@).val() is ""
- closest_submit.disable()
- else
- closest_submit.enable()
-
-window.sanitize = (str) ->
- return str.replace(/<(?:.|\n)*?>/gm, '')
-
-window.linkify = (str) ->
- exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
- return str.replace(exp,"$1")
-
-window.simpleFormat = (str) ->
- linkify(sanitize(str).replace(/\n/g, '
'))
-
-window.unbindEvents = ->
- $(document).unbind('scroll')
- $(document).off('scroll')
-
-document.addEventListener("page:fetch", unbindEvents)
-
-$ ->
- # Click a .one_click_select field, select the contents
- $(".one_click_select").on 'click', -> $(@).select()
-
- $('.remove-row').bind 'ajax:success', ->
- $(this).closest('li').fadeOut()
-
- # Initialize select2 selects
- $('select.select2').select2(width: 'resolve', dropdownAutoWidth: true)
-
- # Initialize tooltips
- $('.has_tooltip').tooltip()
-
- # Bottom tooltip
- $('.has_bottom_tooltip').tooltip(placement: 'bottom')
-
- # Form submitter
- $('.trigger-submit').on 'change', ->
- $(@).parents('form').submit()
-
- $("abbr.timeago").timeago()
- $('.js-timeago').timeago()
-
- # Flash
- if (flash = $(".flash-container")).length > 0
- flash.click -> $(@).fadeOut()
- flash.show()
- setTimeout (-> flash.fadeOut()), 5000
-
- # Disable form buttons while a form is submitting
- $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
- buttons = $('[type="submit"]', @)
-
- switch e.type
- when 'ajax:beforeSend', 'submit'
- buttons.disable()
- else
- buttons.enable()
-
- # Show/Hide the profile menu when hovering the account box
- $('.account-box').hover -> $(@).toggleClass('hover')
-
- # Focus search field by pressing 's' key
- $(document).keypress (e) ->
- # Don't do anything if typing in an input
- return if $(e.target).is(":input")
-
- switch e.which
- when 115
- $("#search").focus()
- e.preventDefault()
- when 63
- new Shortcuts()
- e.preventDefault()
-
-
- # Commit show suppressed diff
- $(".diff-content").on "click", ".supp_diff_link", ->
- $(@).next('table').show()
- $(@).remove()
-
-(($) ->
- # Disable an element and add the 'disabled' Bootstrap class
- $.fn.extend disable: ->
- $(@).attr('disabled', 'disabled').addClass('disabled')
-
- # Enable an element and remove the 'disabled' Bootstrap class
- $.fn.extend enable: ->
- $(@).removeAttr('disabled').removeClass('disabled')
-
-)(jQuery)
--
libgit2 0.21.2