Skip to content

Commit

Permalink
Merge pull request #96 from mstenquist/allow_multiple_content_classes
Browse files Browse the repository at this point in the history
Allow multiple content classes
  • Loading branch information
adamschwartz committed Jan 5, 2015
2 parents 5645d38 + 1e5cbe5 commit 741fcac
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion coffee/vex.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ vexFactory = ($) ->

return options.$vexContent # For chaining

getSelectorFromBaseClass: (baseClass) ->
return ".#{baseClass.split(' ').join('.')}"

getAllVexes: ->
return $(""".#{vex.baseClassNames.vex}:not(".#{vex.baseClassNames.closing}") .#{vex.baseClassNames.content}""")
return $(""".#{vex.baseClassNames.vex}:not(".#{vex.baseClassNames.closing}") #{vex.getSelectorFromBaseClass(vex.baseClassNames.content)}""")

getVexByID: (id) ->
return vex.getAllVexes().filter(-> $(@).data().vex.id is id)
Expand Down
2 changes: 1 addition & 1 deletion coffee/vex.dialog.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ vexDialogFactory = ($, vex) ->
$button = $("""<button type="#{button.type}"></button>""")
.text(button.text)
.addClass(button.className + ' vex-dialog-button ' + (if index is 0 then 'vex-first ' else '') + (if index is buttons.length - 1 then 'vex-last ' else ''))
.bind('click.vex', (e) -> button.click($(@).parents(".#{vex.baseClassNames.content}"), e) if button.click)
.bind('click.vex', (e) -> button.click($(@).parents(vex.getSelectorFromBaseClass(vex.baseClassNames.content)), e) if button.click)

$button.appendTo $buttons

Expand Down
2 changes: 1 addition & 1 deletion js/vex.combined.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/vex.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
var $button;
$button = $("<button type=\"" + button.type + "\"></button>").text(button.text).addClass(button.className + ' vex-dialog-button ' + (index === 0 ? 'vex-first ' : '') + (index === buttons.length - 1 ? 'vex-last ' : '')).bind('click.vex', function(e) {
if (button.click) {
return button.click($(this).parents("." + vex.baseClassNames.content), e);
return button.click($(this).parents(vex.getSelectorFromBaseClass(vex.baseClassNames.content)), e);
}
});
return $button.appendTo($buttons);
Expand Down
Loading

0 comments on commit 741fcac

Please sign in to comment.