Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 390
- Log:
Initial import of Canvass, a donations-based poll application.
- Author:
- rool
- Date:
- Mon Mar 21 14:58:04 +0000 2011
- Size:
- 3424 Bytes
1 | QuietLightbox |
2 | ============= |
3 | |
4 | Makes it easy to include Leightbox only when you want it while still having |
5 | an application-global layout. That is, rather than using something like the |
6 | following in a "layouts/application.html.erb" file: |
7 | |
8 | <%= javascript_include_tag :defaults %> |
9 | <%= javascript_include_tag 'leightbox/leightbox' %> |
10 | <%= stylesheet_link_tag 'leightbox/leightbox' %> |
11 | |
12 | ...you instead do something like this: |
13 | |
14 | <%= include_leightbox_if_used %> |
15 | |
16 | ...and JS plus CSS links will only be output if a Controller handling the |
17 | current action has said that it wants Leightbox facilities for that action's |
18 | view by making a call along the lines of: |
19 | |
20 | uses_leightbox() |
21 | |
22 | ...around the same place it might declare "before_filter" items and the like. |
23 | The "uses_leightbox" method takes a hash of options which are passed straight |
24 | through to the Rails "before_filter" API allowing the Controller to further |
25 | refine its use of Leightbox to certain views, for example, to use Leightbox |
26 | in an "edit" action (and in a related "update" action in case an update fails |
27 | and re-renders the "edit" view): |
28 | |
29 | uses_leightbox( :only => [ :edit, :update ] ) |
30 | |
31 | If you also use the "quiet_prototype" plugin, then note that you should not use |
32 | both "uses_prototype" and "uses_leightbox" for the same actions in the same |
33 | controller. Since Leightbox depends on Prototype, the default set of JS |
34 | inclusions will be used for Leightbox. Calling "uses_prototype" as well as |
35 | "uses_leightbox" will result in the same JS and CSS being included twice. |
36 | |
37 | This plugin does not include Leightbox components for installation. Download |
38 | these and install them per your specific requirements. At the time of writing, |
39 | Leightbox is available from: |
40 | |
41 | http://www.eight.nl/static/files/leightbox/ |
42 | |
43 | Copy "scripts/lightbox.js" into the public Javascript folder, as "leightbox.js" |
44 | inside a folder "leightbox.js" (hence, "javascripts/leightbox/leightbox.js"). |
45 | Similarly, copy the stylesheet as "leightbox/leightbox.css" into the public |
46 | stylesheets folder. |
47 | |
48 | |
49 | Useful patch |
50 | ============ |
51 | |
52 | To allow ESCape to close a Leightbox popup, modify the Leightbox JS file as |
53 | follows. |
54 | |
55 | * Add this in the "initialize" function (anywhere will do); |
56 | |
57 | this.keyHandler = this.deactivateKey.bindAsEventListener(this); |
58 | |
59 | * In the "displayLightbox" function, replace this single line: |
60 | |
61 | if(display != 'none') this.actions(); |
62 | |
63 | ...with this set of lines: |
64 | |
65 | if(display != 'none'){ |
66 | this.actions(); |
67 | Event.observe(window, 'keydown', this.keyHandler); |
68 | }else{ |
69 | Event.stopObserving(window, 'keydown', this.keyHandler); |
70 | } |
71 | |
72 | * Finally, add this new function somewhere in the class definition - e.g. just |
73 | above the definition of "deactivate": |
74 | |
75 | deactivateKey: function(event){ |
76 | if (event.keyCode == 27){ |
77 | this.deactivate(); |
78 | Event.stop(event); |
79 | } |
80 | }, |
81 | |
82 | Note the trailing comma at the end of the function definition which is |
83 | required if another item definition follows (JavaScript required syntax). |
84 | |
85 | |
86 | Heritage |
87 | ======== |
88 | |
89 | The plugin wrapper concept comes from larsklevan's "yui_editor" plugin: |
90 | |
91 | http://github.com/larsklevan/yui_editor/tree/master |
92 | |
93 | The QuietLeightbox plugin would not exist without this component. My thanks |
94 | go to the author for his hard work. |
95 | |
96 | |
97 | Installation |
98 | ============ |
99 | |
100 | script/plugin install [TBD] |
101 | |
102 | |
103 | Feedback |
104 | ======== |
105 | |
106 | Send feedback and questions to ahodgkin@rowing.org.uk |
107 | |
108 | Copyright (c) 2009 Hipposoft (Andrew Hodgkinson). |
109 | Released under the MIT license. |