Permalink
Browse files

Remove batch_actions code not needed with bootstrap UI

  • Loading branch information...
1 parent de9b455 commit 2d1f931663064b5117da643a2bd0c73e297ed8b0 @macfanatic macfanatic committed Mar 26, 2013
@@ -1,105 +0,0 @@
-window.AA.DropdownMenu = class AA.DropdownMenu
-
- constructor: (@options, @element) ->
-
- @$element = $(@element)
-
- defaults = {
- fadeInDuration: 20,
- fadeOutDuration: 100,
- onClickActionItemCallback: null
- }
-
- @options = $.extend({}, defaults, options)
-
- @$menuButton = @$element.find(".dropdown_menu_button")
- @$menuList = @$element.find(".dropdown_menu_list_wrapper")
-
- @isOpen = false
-
- @_buildMenuList()
- @_bind()
-
- open: ->
- @isOpen = true
- @$menuList.fadeIn @options.fadeInDuration
-
- @_positionMenuList()
- @_positionNipple()
-
- return @
-
-
- close: ->
- @isOpen = false
- @$menuList.fadeOut this.options.fadeOutDuration
-
- return @
-
- destroy: ->
- @$element.unbind()
- @$element = null
-
- return @
-
- isDisabled: ->
- @$menuButton.hasClass("disabled")
-
- disable: ->
- @$menuButton.addClass("disabled")
-
- enable: ->
- @$menuButton.removeClass("disabled")
-
- option: (key, value) ->
- if $.isPlainObject(key)
- return @options = $.extend(true, @options, key)
-
- else if key?
- return @options[key]
-
- else
- return @options[key] = value
-
- # Private
-
- _buildMenuList: ->
- @$menuList.prepend("<div class=\"dropdown_menu_nipple\"></div>")
- @$menuList.hide()
-
- _bind: ->
- $("body").bind 'click', () =>
- if @isOpen is true
- @close()
-
- @$menuButton.bind 'click', () =>
- unless @isDisabled()
- if @isOpen is true
- @close()
- else
- @open()
-
- # Return false so that the event is stopped
- false
-
- _positionMenuList: ->
- centerOfButtonFromLeft = @$menuButton.position().left + @$menuButton.outerWidth() / 2
- centerOfmenuListFromLeft = @$menuList.outerWidth() / 2
- menuListLeftPos = centerOfButtonFromLeft - centerOfmenuListFromLeft
- @$menuList.css "left", menuListLeftPos
-
- _positionNipple: ->
- centerOfmenuListFromLeft = @$menuList.outerWidth() / 2
- bottomOfButtonFromTop = @$menuButton.position().top + @$menuButton.outerHeight() + 10
- @$menuList.css "top", bottomOfButtonFromTop
- $nipple = @$menuList.find(".dropdown_menu_nipple")
- centerOfnippleFromLeft = $nipple.outerWidth() / 2
- nippleLeftPos = centerOfmenuListFromLeft - centerOfnippleFromLeft
- $nipple.css "left", nippleLeftPos
-
-(($) ->
- $.widget.bridge 'aaDropdownMenu', AA.DropdownMenu
-
- $ ->
- $(".dropdown_menu").aaDropdownMenu()
-)(jQuery)
@@ -1,97 +0,0 @@
-
-window.AA.Popover = class AA.Popover
-
- constructor: (@options, @element) ->
-
- @$element = $(@element)
-
- defaults = {
- fadeInDuration: 20,
- fadeOutDuration: 100,
- autoOpen: true,
- pageWrapperElement: "#wrapper",
- onClickActionItemCallback: null
- }
-
- @options = $.extend({}, defaults, options)
-
- @$popover = null
- @isOpen = false
-
- if $(@$element.attr("href")).length > 0
- @$popover = $(@$element.attr("href"))
- else
- @$popover = @$element.next(".popover")
-
-
- @_buildPopover()
- @_bind()
-
- open: ->
- @isOpen = true
- @$popover.fadeIn @options.fadeInDuration
-
- @_positionPopover()
- @_positionNipple()
-
- return @
-
-
- close: ->
- @isOpen = false;
- @$popover.fadeOut this.options.fadeOutDuration;
-
- return @
-
- destroy: ->
- @$element.removeData('popover');
- @$element.unbind();
- @$element = null;
-
- return @
-
- option: ->
- # ??
-
- # Private
-
- _buildPopover: ->
- @$popover.prepend("<div class=\"popover_nipple\"></div>")
-
- @$popover.hide()
-
- @$popover.addClass "popover"
-
-
- _bind: ->
- $(@options.pageWrapperElement).bind 'click', (e) =>
- if @isOpen is true
- @close()
-
- if @options.autoOpen is true
- @$element.bind 'click', () =>
- if @isOpen is true
- @close()
- else
- @open()
-
- false
-
- _positionPopover: ->
- centerOfButtonFromLeft = @$element.offset().left + @$element.outerWidth() / 2
- centerOfPopoverFromLeft = @$popover.outerWidth() / 2
- popoverLeftPos = centerOfButtonFromLeft - centerOfPopoverFromLeft
- @$popover.css "left", popoverLeftPos
-
- _positionNipple: ->
- centerOfPopoverFromLeft = @$popover.outerWidth() / 2
- bottomOfButtonFromTop = @$element.offset().top + @$element.outerHeight() + 10
- @$popover.css "top", bottomOfButtonFromTop
- $nipple = @$popover.find(".popover_nipple")
- centerOfnippleFromLeft = $nipple.outerWidth() / 2
- nippleLeftPos = centerOfPopoverFromLeft - centerOfnippleFromLeft
- $nipple.css "left", nippleLeftPos
-
-(($) ->
- $.widget.bridge 'popover', AA.Popover
-)(jQuery)
@@ -8,9 +8,6 @@ $ ->
$('.clear_filters_btn').click ->
window.location.search = ''
- # Batch Actions dropdown
- $('.dropdown_button').popover()
-
# Filter form: don't send any inputs that are empty
$('#q_search').submit ->
$(@).find(':input[value=""]').attr 'disabled', 'disabled'

6 comments on commit 2d1f931

@macfanatic can you not do that here? It's not that simple; we have dangling Ruby code as well.

It would be better for posterity if #2021 was applied instead.

I'm working on getting AA switched to bootstrap, the ruby code on this feature branch has already been updated to output bootstrap specific HTML markup to work with the library. I don't see anything left behind here that isn't being used, per your comment.

Look again. There's Ruby code that isn't used that I removed in #2021.

Not sure what remaining Ruby code that you mention, the only Ruby code that I see you remove is the batch_actions_popover component, which is already removed in this branch anyway. Honestly not seeing anything that I've missed, but if you see it please let me know so I can take care of it, or leave it alone for you to remove in your PR.

Ah... When I went to check the files on this branch, GitHub must have switched me over to the master branch without me noticing.

Everything looks good. I'll close that PR.

Please sign in to comment.