Salsa Developers' Blog

Python LinkedHashSet + LRU

 Jesse created a very simple LinkedHashSet in python

Read more (61 comments)

HTML Helpers

Salsa is about making things easy, and SalsaScript aims for the same.  Below are two simple functions to make generating smart HTML easier.


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

showing Help.qtip

<?@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

Add an image

View an image

    <? 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'}) ?>
      <div class="title-cell">
        <a href="<?= videos[ii].URL ?>"><?=videos[ii].Name ?></a>
    <? } ?>

Read more (1 comment)


by Perry

Welcome 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