nail_polish 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +29 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/javascripts/nail_polish/app.js +58 -0
  6. data/app/assets/javascripts/nail_polish/events/flasher.js +17 -0
  7. data/app/assets/javascripts/nail_polish/events/redirector.js +3 -0
  8. data/app/assets/javascripts/nail_polish/events.js +28 -0
  9. data/app/assets/javascripts/nail_polish/nail_polish.js +25 -0
  10. data/app/assets/javascripts/nail_polish/overrides/auth_token_adder.js +44 -0
  11. data/app/assets/javascripts/nail_polish/overrides/for_backbone.js +14 -0
  12. data/app/assets/javascripts/nail_polish/overrides/function_bind.js +6 -0
  13. data/app/assets/javascripts/nail_polish/overrides/global_publisher_adder.js +28 -0
  14. data/app/assets/javascripts/nail_polish/presenter.js +43 -0
  15. data/app/assets/javascripts/nail_polish/presenters/collection.js +11 -0
  16. data/app/assets/javascripts/nail_polish/router.js +78 -0
  17. data/app/assets/javascripts/nail_polish/utils/text.js +36 -0
  18. data/app/assets/javascripts/nail_polish/view/parent_finder.js +46 -0
  19. data/app/assets/javascripts/nail_polish/view.js +80 -0
  20. data/app/assets/javascripts/nail_polish/widget/flash.js +36 -0
  21. data/app/assets/javascripts/nail_polish/widget/modal.js +40 -0
  22. data/app/assets/javascripts/nail_polish.js +21 -0
  23. data/app/assets/javascripts/nail_polish_legacy_base.js +2 -0
  24. data/app/assets/javascripts/nail_polish_modern_base.js +2 -0
  25. data/app/assets/javascripts/nail_polish_widgets.js +2 -0
  26. data/app/assets/javascripts/vendor/backbone.js +1571 -0
  27. data/app/assets/javascripts/vendor/jquery-1.8.3.js +9472 -0
  28. data/app/assets/javascripts/vendor/jquery.cookie.js +94 -0
  29. data/app/assets/javascripts/vendor/underscore.js +1200 -0
  30. data/app/assets/javascripts/vendor/zepto.cookie.js +22 -0
  31. data/app/assets/javascripts/vendor/zepto.js +1355 -0
  32. data/config/initializers/nail_polish.rb +1 -0
  33. data/config/routes.rb +2 -0
  34. data/lib/nail_polish/engine.rb +4 -0
  35. data/lib/nail_polish/version.rb +3 -0
  36. data/lib/nail_polish.rb +7 -0
  37. data/lib/tasks/nail_polish_tasks.rake +4 -0
  38. metadata +207 -0
@@ -0,0 +1,40 @@
1
+ NailPolish.Widget.Modal = NailPolish.View.extend({
2
+ parentSelector: '#overlay-container',
3
+ attachmentMethod: 'html',
4
+
5
+ events: function () {
6
+ _.extend(this.addListeners, {
7
+ 'click .close-modal': 'close'
8
+ });
9
+
10
+ return NailPolish.View.prototype.events.apply(this);
11
+ },
12
+
13
+ renderTemplate: function () {
14
+ // switch declared template into a partial for consistent usage
15
+ var template = HoganTemplates['modal'];
16
+ var partials = _.extend(this.partials(), {
17
+ modal_content: HoganTemplates[this.templateName]
18
+ });
19
+ var rendered = template.render(this.presenter(), partials);
20
+ this.$el.html(rendered);
21
+ },
22
+
23
+ render: function() {
24
+ NailPolish.View.prototype.render.apply(this);
25
+ this.addListenerForClose();
26
+ },
27
+
28
+ addListenerForClose: function() {
29
+ NailPolish.Events.subscribe('page:new', this.close, this);
30
+ },
31
+
32
+ close: function (e) {
33
+ NailPolish.Events.unsubscribe('page:new', this.close, this);
34
+ this.remove();
35
+ this.onClose()
36
+ },
37
+
38
+ onClose: function() {} // to be implemented by subclasses
39
+ });
40
+
@@ -0,0 +1,21 @@
1
+ //= require vendor/underscore
2
+ //= require vendor/backbone
3
+ //= require hogan
4
+ //
5
+ //= require nail_polish/nail_polish
6
+ //= require_tree ./nail_polish/utils
7
+ //= require nail_polish/overrides/function_bind
8
+ //= require nail_polish/overrides/auth_token_adder
9
+ //= require nail_polish/overrides/global_publisher_adder
10
+ //= require nail_polish/overrides/for_backbone
11
+ //
12
+ //= require nail_polish/events
13
+ //= require nail_polish/events/redirector
14
+ //= require nail_polish/events/flasher
15
+ //= require nail_polish/view
16
+ //= require nail_polish/view/parent_finder
17
+ //= require nail_polish/presenter
18
+ //= require_tree ./nail_polish/presenters
19
+ //= require nail_polish/router
20
+ //= require nail_polish/app
21
+
@@ -0,0 +1,2 @@
1
+ //= require vendor/jquery-1.8.3
2
+ //= require vendor/jquery.cookie
@@ -0,0 +1,2 @@
1
+ //= require vendor/zepto
2
+ //= require vendor/zepto.cookie
@@ -0,0 +1,2 @@
1
+ //= require nail_polish/widget/flash
2
+ //= require nail_polish/widget/modal