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:
- 4691 Bytes
1 | QuietLightwindow |
2 | ================ |
3 | |
4 | Makes it easy to include Lightwindow 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 'lightwindow/lightwindow' %> |
10 | <%= stylesheet_link_tag 'lightwindow/lightwindow' %> |
11 | |
12 | ...you instead do something like this: |
13 | |
14 | <%= include_lightwindow_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 Lightwindow facilities for that action's |
18 | view by making a call along the lines of: |
19 | |
20 | uses_lightwindow() |
21 | |
22 | ...around the same place it might declare "before_filter" items and the like. |
23 | The "uses_lightwindow" 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 Lightwindow to certain views, for example, to use Lightwindow |
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_lightwindow( :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_lightwindow" for the same actions in the same |
33 | controller. Since Lightwindow depends on Prototype, the default set of JS |
34 | inclusions will be used for Lightwindow. Calling "uses_prototype" as well as |
35 | "uses_lightwindow" will result in the same JS and CSS being included twice. |
36 | |
37 | Note that the plugin assumes your lightwindow.js file is in |
38 | "public/javascripts/lightwindow/lightwindow.js" and, similarly, that the CSS |
39 | file is in "public/stylesheets/lightwindow/lightwindow.css". You will probably |
40 | need to edit the CSS file to refer to images in the right place; it's up to |
41 | you where you put them ("public/images/lightwindow/*" is a logical choice, |
42 | with CSS referring to "../../images/lightwindow/*" rather than "/images/..." to |
43 | maintain position independence relative to the web server document root. You |
44 | may also find hard-coded image references in the Lightwindow JS source code - |
45 | since these will be taken as relative to the current page, you may be forced to |
46 | adjust them to assume a particular document root location (e.g. "/images/..."), |
47 | or perhaps replace the inline IMGs with something which gets an image from CSS. |
48 | |
49 | This plugin does not include Lightwindow components for installation. Download |
50 | these and install them manually as per your specific requirements. At the time |
51 | of writing, Lightwindow 2.0 is available at: |
52 | |
53 | http://stickmanlabs.com/lightwindow/ |
54 | |
55 | |
56 | Internationalisation |
57 | ==================== |
58 | |
59 | Rails 2.3 internationalisation is supported. Include tokens as follows in your |
60 | locale YAML file(s) - e.g. for English: |
61 | |
62 | en: |
63 | pond: |
64 | quiet_lightwindow: |
65 | close: "Close" |
66 | loading_or: "Loading or" |
67 | cancel: "cancel" |
68 | |
69 | If I18n features are missing or there are no translation strings available, the |
70 | default values shown above will be used instead. The following short script is |
71 | written out using the locale-specific, or default value strings: |
72 | |
73 | var lightwindow_i18n = { |
74 | close: "Close", |
75 | loading_or: "Loading or", |
76 | cancel: "cancel" |
77 | } |
78 | |
79 | You can then modify your version of lightwindow.js to read from this variable. |
80 | For example, in version 2.0 at around line 166-168ish there is a line of code |
81 | which takes part in constructing a string containing HTML data: |
82 | |
83 | '<a id="lightwindow_title_bar_close_link" >Close</a>'+ |
84 | |
85 | ...modify to read: |
86 | |
87 | '<a id="lightwindow_title_bar_close_link" >'+lightwindow_i18n.close+'</a>'+ |
88 | |
89 | At around line 216-218ish: |
90 | |
91 | '<span>Loading or <a href="javascript: myLightWindow.deactivate();">Cancel</a></span>'+ |
92 | |
93 | ...modify to read: |
94 | |
95 | '<span>'+lightwindow_i18n.loading_or+' <a href="javascript: myLightWindow.deactivate();">'+lightwindow_i18n.cancel+'</a></span>'+ |
96 | |
97 | The default Lightwindow next/previous indicator GIF images actually have the |
98 | words "NEXT" and "PREV" 'burned in' to them. The simplest solution is to change |
99 | these to some picture-based form (e.g. replacing the "NEXT" text with an arrow |
100 | pointing right and "PREV" with an arrow pointing left). |
101 | |
102 | |
103 | Heritage |
104 | ======== |
105 | |
106 | The plugin wrapper concept comes from larsklevan's "yui_editor" plugin: |
107 | |
108 | http://github.com/larsklevan/yui_editor/tree/master |
109 | |
110 | The QuietLightwindow plugin would not exist without this component. My thanks |
111 | go to the author for his hard work. |
112 | |
113 | |
114 | Installation |
115 | ============ |
116 | |
117 | script/plugin install [TBD] |
118 | |
119 | |
120 | Feedback |
121 | ======== |
122 | |
123 | Send feedback and questions to ahodgkin@rowing.org.uk |
124 | |
125 | Copyright (c) 2009 Hipposoft (Andrew Hodgkinson). |
126 | Released under the MIT license. |