Salsa Developers' Blog
Python LinkedHashSet + LRU
Submitted Mon Feb 22 2010 16:47:00 GMT-0500 (EST)Jesse created a very simple LinkedHashSet in python
Read more (59 comments)
HTML Helpers
Submitted Tue Feb 02 2010 16:24:14 GMT-0500 (EST)Salsa is about making things easy, and SalsaScript aims for the same. Below are two simple functions to make generating smart HTML easier.
Help.qtip(text)
Making intuitive user-interfaces is tough, and there will always be some users that just say, "???". Well now you can respond with your own . Help.qtip produces a question with an answer, using html, javascript, and css. Clicking on the
produces a mini-window in the page, with the text passed to qtip.
Library: /salsa/common/forms/Help.sjs
Example:
Source:
<?@include '/salsa/common/publish/Publish.sjs' ?>
<?@include '/salsa/common/forms/Help.sjs' ?>
<button id="customizeMessageButton" onclick="return false;" >Customize Message</button>
<?= Help.qtip("Feed messages let supporters push notices about their actions
to their social networks like Facebook and Twitter. To use them, set the
\\'Redirect to\\' field above to the tell-friends page: <tt>" +
Publish.getRootURL('absolute') +
"p/salsa/feed/common/public/tellfriends</tt>.") ?>
ImageHelper.getImage(path, alt, options)
The Graphics.getImageUrl function is great, when the image is already in salsa. Often, though, users will want to mix external images with internal ones, and have pages work seamlessly. Well, now they can! getImage produces an image tag, and more, using the same arguments as Graphics.getImageUrl. If the image provided is in salsa, it uses Graphics.getImageUrl to access a scaled version. If it's an image at an external URL, getImage produces a block of javascript catered to the options specified, which will dynamically resize the image in the place.
Library: /salsa/common/forms/ImageHelper.sjs
Example:
Source:
<ul>
<? for (var ii = 0; ii < videos.length; ii++) { ?>
<li class="video">
<div class="thumbnail-cell">
<a href="<?= videos[ii].URL ?>">
<? ImageHelper.getImage(videos[ii].image_URL, videos[ii].Name,
{width: 60, type: 'le'}) ?>
</a>
</div>
<div class="title-cell">
<a href="<?= videos[ii].URL ?>"><?=videos[ii].Name ?></a>
</div>
</li>
<? } ?>
</ul>
Read more (1 comment)
Welcome!
Submitted Tue Feb 02 2010 13:24:32 GMT-0500 (EST) by PerryWelcome to our Salsa Developers' Blog. The goal of this blog is to keep all salsa developers up-to-date with updates, upgrades, and additions to the salsa framework, from back-end java to 3rd party integration packages.
Read more (22 comments)
developers [at] salsalabs [dot] com