Skip to content

Commit 1af433c

Browse files
author
Luca Guidi
committed
Initial import
1 parent e5ca279 commit 1af433c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3434
-0
lines changed

Diff for: MIT-LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2007 Luca Guidi
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Diff for: README

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
ClickToGlobalize
2+
=================
3+
4+
ClickToGlobalize is an extension for Globalize plugin, it allows to edit in
5+
place globalized labels. With this plugin you don't have to create a
6+
globalization back-end, but just edit your interface in place!!
7+
8+
If you have a previous globalization experience, you probably noticed that the
9+
main problem of dedicated back-ends is the lack of the context where the
10+
string will be placed in. It isn't a trivial issue: you'll never know if the
11+
meaning of your string is harmonious with other labels and how your string will
12+
be rendered, until the page load.
13+
14+
Now you can forget this issues, you can directly globalize in place!!
15+
16+
Check for news and tutorials at the project home page[http://www.lucaguidi.com/pages/click-to-globalize].
17+
18+
Getting Started
19+
===============
20+
21+
1. Install Globalize[http://www.globalize-rails.org/].
22+
23+
2. Install Click To Globalize:
24+
$ ./scripts/plugin install http://dev.23labs.net/svn/rails/plugins/click_to_globalize/trunk
25+
26+
3. Add at the end of your layout the following code:
27+
<%= click_to_globalize -%>
28+
29+
4. Put in your view:
30+
<%= 'hello_world'.t %>
31+
32+
5. Start your server and click to globalize.
33+
34+
Prerequisites
35+
=============
36+
37+
* Globalize plugin: www.globalize-rails.org.
38+
39+
* RedCloth gem (optional) for textile formatting.
40+
41+
* BlueCloth gem (optional) for markdown formatting.
42+
43+
Install
44+
=======
45+
46+
1. Install Globalize, if you don't already done.
47+
48+
2. Install Click To Globalize:
49+
Rails 2.0
50+
$ ./scripts/plugin install http://dev.23labs.net/svn/rails/plugins/click_to_globalize/trunk
51+
Rails 1.2.x
52+
$ ./scripts/plugin install http://dev.23labs.net/svn/rails/plugins/click_to_globalize/branches/for-1.2.x
53+
54+
3. Run the setup task:
55+
$ rake click:setup
56+
57+
4. Run the tests (optional):
58+
$ rake click:test
59+
60+
5. Choose your languages, they will be used to create a picker menu.
61+
class ApplicationController < ActionController::Base
62+
self.languages = { :english => 'en-US', :italian => 'it-IT' }
63+
end
64+
65+
6. If you like to use wiki-formatting styles, you could use textile (RedCloth)
66+
or markdown (BlueCloth).
67+
class ApplicationController < ActionController::Base
68+
self.formatting :textile
69+
end
70+
71+
7. Personalize the access to the globalization features, overriding #globalize:
72+
class ApplicationController < ActionController::Base
73+
def globalize?
74+
current_user.admin?
75+
end
76+
end
77+
78+
NOTE: #globalize? is method to turn on/off all the Click to Globalize features.
79+
NOTE: self.globalize? has been deprecated in favor of globalize?.
80+
81+
8. Add at the end of your layout the following code:
82+
<%= click_to_globalize -%>
83+
84+
Uninstall
85+
=========
86+
87+
1. $ ./script/plugin remove click_to_globalize
88+
89+
Features
90+
========
91+
92+
* In place editing for each globalized string.
93+
94+
* Easy and painless plug-in/plug-out process.
95+
96+
* Unobtrusive Javascripts.
97+
98+
* Textile and Markdown support.
99+
100+
* Auto transformation from input text to textarea for long strings.
101+
102+
Common Issues
103+
=============
104+
105+
* Since the Globalize plugin creates folders like 'for-1.2', be sure to rename
106+
the folder to 'globalize'.
107+
108+
* Due to unobtrusive nature of the plugin, each page is parsed by javascript
109+
to find the right element and bind to it an Ajax.InPlaceEditor.
110+
Be sure your (X)HTML is wellformed.
111+
112+
NOTE: If you use the Rails scaffold system, Click To Globalize
113+
doesn't works. Cleanup the code before to use.
114+
115+
* If you use a wiki-formatting style it could be advisable to use #h to avoid
116+
security problems (i.e. XSS).
117+
<%= textilize(h('some_text'.t)) %>
118+
119+
Contribute
120+
==========
121+
122+
* Check out the code and test it:
123+
$ svn co http://dev.23labs.net/svn/rails/plugins/click_to_globalize/trunk
124+
$ rake click:test
125+
126+
* Create a ticket to: http://dev.23labs.net/rails/trac.cgi
127+
128+
* Create a patch and add as attachement to the ticket.
129+
130+
Credits
131+
=======
132+
133+
Javascript tests are based on Prototype[http://prototypejs.org] test libs.
134+
135+
136+
137+
Copyright (c) 2007-2008 Luca Guidi - http://23labs.net, released under the MIT license

Diff for: init.rb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Force Globalize loading.
2+
if Rails::VERSION::STRING.match /^1\.2+/
3+
load_plugin(File.join(RAILS_ROOT, 'vendor', 'plugins', 'globalize'))
4+
else
5+
# Specify the plugins loading order: Click To Globalize should be the last one.
6+
plugins = (Dir["#{config.plugin_paths}/*"] - [ File.dirname(__FILE__) ]).map { |plugin| plugin.split(File::SEPARATOR).last}
7+
Rails::Initializer.run { |config| config.plugins = plugins }
8+
end
9+
10+
require 'click_to_globalize'

Diff for: install.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
puts "Click To Globalize was correctly downloaded.\n"+
2+
"To complete the installation run:\n"+
3+
"\trake click:setup\n\n"

0 commit comments

Comments
 (0)