nail_polish 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7942b77d9c027c55a16d69d19e1d9621e96668ce
4
- data.tar.gz: 1a0103189b1c0400b2a4187ff8c5e99c339ac16c
3
+ metadata.gz: dabaa91a6211c871b5dcccf0d4a79acd92c88e0c
4
+ data.tar.gz: 9a569ffeacf3a950aab6cd40152b5a16469156a1
5
5
  SHA512:
6
- metadata.gz: e656e2cc235d269bb5b08a4d61b92f353c21d71da55782a714576ed900b8087dc1f46154b5bb01cca981bfa7240ea8c1906d0cfdef5b49d475be30893aa4daab
7
- data.tar.gz: 5eae2ecdf00aa5c1a839179691c0cddb164711dce1b2eae4a0e480e8bd62fd27f7e9647cdfb4b7e9d8b8a48b859f7a2919bb84e6bdd0c8e7f175c277af8cecec
6
+ metadata.gz: 17d5e8ca3bf3094b515e5a6687e6e3935da1735a53900952b07b58eafdcb10851cef16a5b127965a6f57bfbca5dab49fd9e5e26c4cefb5930cbab1271cdc3b02
7
+ data.tar.gz: 10b9242ce3a4f47a846682987159ae020912e6b7399cd6c1802445c61fd42e09c077c45104edb4c37abf2ac901bc72a6be8cf866ec3959cf8a99c86a4961f430
@@ -0,0 +1,6 @@
1
+ <div class='overlay'>
2
+ <div class='modal l-modal'>
3
+ {{>modal_content}}
4
+ </div>
5
+ </div>
6
+
@@ -2,26 +2,28 @@ NailPolish.Widget.Modal = NailPolish.View.extend({
2
2
  parent: 'body',
3
3
  parentSelector: '#overlay-container',
4
4
  attachmentMethod: 'html',
5
+ baseModalTemplateName: "nail_polish/templates/modal",
6
+ overlaySelector: "#overlay",
5
7
 
6
8
  events: function () {
7
9
  _.extend(this.addListeners, {
8
10
  'click .close-modal': 'close',
9
- 'click .cancel-link a': 'close',
10
- 'click #overlay': 'verifyTargetAndClose'
11
+ 'click .cancel-link a': 'close'
11
12
  });
12
13
 
14
+ this.addListeners["click " + this.overlaySelector] = "verifyTargetAndClose";
13
15
  return NailPolish.View.prototype.events.apply(this);
14
16
  },
15
17
 
16
18
  verifyTargetAndClose: function (e) {
17
- if($(e.target).is('#overlay')) {
19
+ if($(e.target).is(this.overlaySelector)) {
18
20
  this.close();
19
21
  }
20
22
  },
21
23
 
22
24
  renderTemplate: function () {
23
25
  // switch declared template into a partial for consistent usage
24
- var template = HoganTemplates['nail_polish/templates/modal'];
26
+ var template = HoganTemplates[this.baseModalTemplateName];
25
27
  var partials = _.extend(this.partials(), {
26
28
  modal_content: HoganTemplates[this.templateName]
27
29
  });
@@ -45,7 +47,8 @@ NailPolish.Widget.Modal = NailPolish.View.extend({
45
47
  e.preventDefault(); // This is necessary to prevent clicking on elements behind the modal
46
48
  }
47
49
  NailPolish.Events.unsubscribe('page:new', this.close, this);
48
- $('body').removeClass('no-scroll');
50
+
51
+ this.unfreezeBody();
49
52
  this.remove();
50
53
  this.onClose();
51
54
  },
@@ -66,5 +69,9 @@ NailPolish.Widget.Modal = NailPolish.View.extend({
66
69
 
67
70
  freezeBody: function() {
68
71
  $('body').addClass('no-scroll');
72
+ },
73
+
74
+ unfreezeBody: function() {
75
+ $('body').removeClass('no-scroll');
69
76
  }
70
77
  });
@@ -0,0 +1,24 @@
1
+ NailPolish.Widget.StackableModal = NailPolish.Widget.Modal.extend({
2
+ parentSelector: "#stackable-overlay-container",
3
+ attachmentMethod: "append",
4
+ baseModalTemplateName: "nail_polish/templates/stackable_modal",
5
+ overlaySelector: ".overlay",
6
+
7
+ render: function() {
8
+ NailPolish.Widget.Modal.prototype.render.apply(this);
9
+ NailPolish.Widget.StackableModal.stackedModalsCount += 1;
10
+ },
11
+
12
+ close: function (e) {
13
+ NailPolish.Widget.StackableModal.stackedModalsCount -= 1;
14
+ NailPolish.Widget.Modal.prototype.close.apply(this);
15
+ },
16
+
17
+ unfreezeBody: function() {
18
+ if (NailPolish.Widget.StackableModal.stackedModalsCount === 0) {
19
+ NailPolish.Widget.Modal.prototype.unfreezeBody.apply(this);
20
+ }
21
+ }
22
+ });
23
+
24
+ NailPolish.Widget.StackableModal.stackedModalsCount = 0;
@@ -1,4 +1,5 @@
1
1
  //= require nail_polish/widget/flash
2
2
  //= require nail_polish/widget/modal
3
+ //= require nail_polish/widget/stackable_modal
3
4
  //= require nail_polish/widget/dropdown
4
5
  //= require nail_polish/widget/menu
@@ -13,6 +13,18 @@ body {
13
13
  background: transparent image-url('nail_polish/backgrounds/black-0_5.png') repeat;
14
14
  }
15
15
 
16
+ #stackable-overlay-container {
17
+ .overlay {
18
+ position: fixed;
19
+ overflow-y: scroll;
20
+ top: 0;
21
+ bottom: 0;
22
+ left: 0;
23
+ right: 0;
24
+ background: transparent url('nail_polish/backgrounds/black-0_5.png') repeat;
25
+ }
26
+ }
27
+
16
28
  #page {
17
29
  background: $light-color image-url('nail_polish/backgrounds/light_bg.png') repeat;
18
30
 
@@ -2,7 +2,6 @@
2
2
  margin: $spacing auto;
3
3
  max-width: 300px;
4
4
  position: relative;
5
- z-index: 10100;
6
5
 
7
6
  @include border-radius;
8
7
 
@@ -17,6 +16,7 @@
17
16
 
18
17
  .close-icon {
19
18
  background: transparent image-url('nail_polish/elements/close_icon.png') no-repeat;
19
+ cursor: pointer;
20
20
  margin-top: $spacing;
21
21
  height: 15px;
22
22
  width: 15px;
@@ -1,3 +1,3 @@
1
1
  module NailPolish
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nail_polish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kane Baccigalupi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-10 00:00:00.000000000 Z
13
+ date: 2014-09-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -191,6 +191,7 @@ files:
191
191
  - app/assets/javascripts/nail_polish/templates/dropdown.mustache
192
192
  - app/assets/javascripts/nail_polish/templates/menu.mustache
193
193
  - app/assets/javascripts/nail_polish/templates/modal.mustache
194
+ - app/assets/javascripts/nail_polish/templates/stackable_modal.mustache
194
195
  - app/assets/javascripts/nail_polish/utils/subview_manager.js
195
196
  - app/assets/javascripts/nail_polish/utils/text.js
196
197
  - app/assets/javascripts/nail_polish/validator.js
@@ -201,6 +202,7 @@ files:
201
202
  - app/assets/javascripts/nail_polish/widget/flash.js
202
203
  - app/assets/javascripts/nail_polish/widget/menu.js
203
204
  - app/assets/javascripts/nail_polish/widget/modal.js
205
+ - app/assets/javascripts/nail_polish/widget/stackable_modal.js
204
206
  - app/assets/javascripts/nail_polish.js
205
207
  - app/assets/javascripts/nail_polish_legacy_base.js
206
208
  - app/assets/javascripts/nail_polish_modern_base.js