Skip to content

Commit

Permalink
Merge pull request #68 from awkward/1.1.4
Browse files Browse the repository at this point in the history
1.1.4
  • Loading branch information
davidvanleeuwen committed Mar 25, 2015
2 parents bad4c02 + bb0bc50 commit 654b297
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 34 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2014 Awkward and other contributors
Copyright 2015 Awkward and other contributors
http://madeawkward.com/

Permission is hereby granted, free of charge, to any person obtaining
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ For a complete overview of the documentation visit: [http://awkward.github.io/ba

#### Bundled version
If you're using Backbone and Marionette.
* [backbone.modal-bundled-min.js](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.3/backbone.modal-bundled-min.js)
* [backbone.modal-bundled-min.js](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.4/backbone.modal-bundled-min.js)

#### Backbone.Modals.js and Backbone.Marionette.Modals.js separate
If you just want to use the Backbone version without Marionette.
* [backbone.modal-min.js](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.3/backbone.modal-min.js)
* [backbone.marionette.modals-min.js](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.3/backbone.marionette.modals-min.js)
* [backbone.modal-min.js](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.4/backbone.modal-min.js)
* [backbone.marionette.modals-min.js](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.4/backbone.marionette.modals-min.js)

#### CSS files
There's default style, and you can use our theme to make things look pretty.
* [backbone.modal.css](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.3/backbone.modal.css)
* [backbone.modal.theme.css](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.3/backbone.modal.theme.css)
* [backbone.modal.css](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.4/backbone.modal.css)
* [backbone.modal.theme.css](https://raw.githubusercontent.com/awkward/backbone.modal/v1.1.4/backbone.modal.theme.css)

### How to contribute

Expand All @@ -34,6 +34,6 @@ When you run the project by doing `grunt watch`. This will watch the tests, src

### Legal stuff (MIT License)

Copyright (c) 2014 Awkward.
Copyright (c) 2015 Awkward.

Distributed under MIT license.
2 changes: 1 addition & 1 deletion backbone.modal-bundled-min.js

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions backbone.modal-bundled.js

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

2 changes: 1 addition & 1 deletion backbone.modal-min.js

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions backbone.modal.js

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

6 changes: 3 additions & 3 deletions examples/1_single_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

<title>Single view modal</title>

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>

<!-- Adding Backbone.Modal extension here -->
<link type="text/css" rel="stylesheet" href="/backbone.modal.css">
Expand Down
6 changes: 3 additions & 3 deletions examples/2_tab_based.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

<title>Tab based modal</title>

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>

<!-- Adding Backbone.Modal extension here -->
<link type="text/css" rel="stylesheet" href="/backbone.modal.css">
Expand Down
8 changes: 4 additions & 4 deletions examples/3_stacked_modal_with_marionette.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

<title>Stacked modal with Marionette</title>

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.marionette/2.2.1/backbone.marionette.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.marionette/2.4.1/backbone.marionette.js"></script>

<!-- Adding Backbone.Modal extension here -->
<link type="text/css" rel="stylesheet" href="/backbone.modal.css">
Expand Down
6 changes: 3 additions & 3 deletions examples/4_wizard.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

<title>Wizard modal</title>

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>

<!-- Adding Backbone.Modal extension here -->
<link type="text/css" rel="stylesheet" href="/backbone.modal.css">
Expand Down
6 changes: 3 additions & 3 deletions examples/scripts/3-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
require.config({
baseUrl: '../../',
paths: {
jquery: 'http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min',
underscore: 'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore',
jquery: 'http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min',
underscore: 'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore',
backbone: 'http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone',
'backbone.marionette': 'http://cdnjs.cloudflare.com/ajax/libs/backbone.marionette/2.2.2/backbone.marionette'
'backbone.marionette': 'http://cdnjs.cloudflare.com/ajax/libs/backbone.marionette/2.4.1/backbone.marionette'
}
});

Expand Down
13 changes: 10 additions & 3 deletions src/backbone.modal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
if @keyControl
# global events for key and click outside the modal
Backbone.$('body').on('keyup.bbm', @checkKey)
Backbone.$('body').on('mouseup.bbm', @clickOutside)
Backbone.$('body').on('mouseup.bbm', @clickOutsideElement)
Backbone.$('body').on('click.bbm', @clickOutside)

@modalEl.css(opacity: 1).addClass("#{@prefix}-modal--open")
@onShow?()
Expand Down Expand Up @@ -140,8 +141,11 @@
when 27 then @triggerCancel(e)
when 13 then @triggerSubmit(e)

# check if the element on mouseup is not the modal itself
clickOutside: (e) =>
@triggerCancel() if Backbone.$(e.target).hasClass("#{@prefix}-wrapper") and @active
@triggerCancel() if @outsideElement.hasClass("#{@prefix}-wrapper") and @active

clickOutsideElement: (e) => @outsideElement = Backbone.$(e.target)

buildTemplate: (template, data) ->
if typeof template is 'function'
Expand Down Expand Up @@ -232,6 +236,8 @@
triggerSubmit: (e) =>
e?.preventDefault()

return if Backbone.$(e.target).is('textarea')

return if @beforeSubmit() is false if @beforeSubmit
return if @currentView.beforeSubmit() is false if @currentView and @currentView.beforeSubmit

Expand All @@ -258,7 +264,8 @@

destroy: ->
Backbone.$('body').off('keyup.bbm', @checkKey)
Backbone.$('body').off('mouseup.bbm', @clickOutside)
Backbone.$('body').off('mouseup.bbm', @clickOutsideElement)
Backbone.$('body').off('click.bbm', @clickOutside)

Backbone.$('tester').remove()

Expand Down

0 comments on commit 654b297

Please sign in to comment.