xxqfamous / qrcode-rails Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/qrcode-rails
Automatically exported from code.google.com/p/qrcode-rails
I have created a qrcode gem that may well be useful to your project as it moves
the qrcode
generation back to the server and not on the client.
http://rubyforge.org/projects/rqrcode/
sudo yum install rqrcode
Best.
Duncan
Original issue reported on code.google.com by [email protected]
on 26 Feb 2008 at 8:35
Upon loading the JavaScript in a jQuery environment qrcode.rb calls Prototype.
replacing the Element.update line with this line will fix it.
$(text).appendTo('##{id}');
Original issue reported on code.google.com by [email protected]
on 4 Mar 2011 at 3:04
What steps will reproduce the problem?
1. Use XHTML (mime-type application/xhtml or xml).
Solution: put "/* <![CDATA */" and "/* ]]> */" around Javascript code to
make it compatible with both HTML and XHTML (and XML-like HTML5).
Original issue reported on code.google.com by [email protected]
on 16 Aug 2009 at 9:27
This issue is slightly connected to #2.
There's a line in lib/qrcode.rb:
qr.addData('#{url}');
There is a problem with user-specified data. URL must not be included here
lierally (as in example above), there must be escaping applied before
according to displayed document type. In HTML and XHTML the best is to use
.to_json that will change URL to appropiate Javascript object - string.
It will then be:
qr.addData(#{url.to_json});
It will ensure that user will not escape from string with characters like '
in URL.
In XHTML, if script is included inside CDATA section, there must be
additional escaping of ]]> to prevent user from escaping to HTML by
including "]]>" in his URL.
gsub(']]>', ']]>]]><![CDATA[')
This arises second problem: qrcode does not know if it should escape "]]>",
because it does not know if document is XHTML. There might be additional
parameter for this (don't check content-type, because it might be set by
user in after_filters). So in the end it might be:
def qrcode(url, size=2, level=4, id=nil, xhtml=false)
…
qr.addData (#{xhtml ? url.to_json.gsub(']]>', ']]>]]><![CDATA[') :
url.to_json});
(Notice that .to_json must be first before escaping ]]> sequences in XHTML).
Regards. :p
Original issue reported on code.google.com by [email protected]
on 16 Aug 2009 at 10:03
Rails 3 deprection of:
#ActionView::Helpers::AssetTagHelper::register_javascript_include_default('qrcod
e')
Should be changed to:
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :qrcode =>
["qrcode"]
Original issue reported on code.google.com by [email protected]
on 17 Mar 2011 at 6:18
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.