Prototype Portal Class #2

September 4th, 2007

I have added a new option to prototype portal window class to be able to have multiple portals on the same page. The new option is accept, based on accept option of Droppable. So you can do something like this;

   1  var  portal = new Xilinus.Portal("#page2 div", { accept:"portal1"});
   2  var  portal = new Xilinus.Portal("#page2 div", { accept:"portal2"});
for having to portal in the same window. With a new HTML file:
   1    <div id="page1">
   2        <div id="widget_col_0"></div>
   3        <div id="widget_col_1"></div>
   4        <div id="widget_col_2"></div>
   5   </div>       
   6    <div id="page2">
   7        <div id="widget_col_3"></div>
   8        <div id="widget_col_4"></div>
   9   </div>    
I have added a new sample file. you can give it a try. I have updated widget.js javascript file or check out code from svn: svn co http://svn.itseb.com/public/prototype-portal/trunk prototype-portal

10 Responses to “Prototype Portal Class #2”

  1. Marc Says:

    Fantastic, thanks Seb!

  2. Shrike Says:

    Great work, thank you.

    Do you have any plans on adding setContent for elements on page (add hidden divs as content to widgets) or URLS for Ajax content fetching?

    Also a way to name the widgets to make portal.serialize() be more useful would be great =)

  3. Greg Says:

    Brief question: I noticed that the getTitle(), getFooter(), and getContent() methods all take a “title” parameter, but don’t do anything with it. Is there a plan to do something with this parameter in the future, or is it safe to ignore it (I’ve just been passing in ””)?

  4. TBS Says:

    Hello… How i can add a new widget :(

  5. stailer Says:

    c’est vraiment bien, une excellente classe de départ

  6. Rob Says:

    Great work seb! Just a couple of things required to make it totally usefull are; ability to save widget positions and the ability to add/remove widgets (and save this info). :)

  7. Jim Says:

    How can i get the position of the block after it’s moved ? (or for all blocks) I’m talking about something like: block1=column 2, row 3 block2=column 1, row 1 block3=column 3, row 4 etc

  8. Xavier Says:

    I have a patch for the first lines the Portal.remove function (in portal.js), because it was not removing the widget internally, and serialize was always returning the same string (with the removed widget inside)

    remove: function(widget) { // Remove from the list this._widgets = this._widgets.reject(function(w) { return w._id widget._id; }); this._columns.each(function(column) { column.immediateDescendants().collect(function(element) { if (element.id widget._id) Element.remove(element); }); });

  9. seb Says:

    @Xavier: Thanks a lot for the bug report, I have done something that works also with effects, just update your project, it’s commited in the trunk.

  10. Wayne Says:

    Hi Seb,

    Thanks for this very nice stuff.

    I’m new to RoR and trying to use it to develop a web portal, like iGoogle or NetVibes. It’s merely for personal interests so I’m learning to adapt your Prototype Portal class to build the website. A couple of questions for you, 1. Would that be possible to render an external file to display on any particular Widget? Currently the program uses JS variables to store contents for the Widgets, including the title and main contents. The reason I’m thinking to use the Widget to display enternal file is to allow user ADD their own Widget, which can be a very simple HTML file contains text and images perhaps some JS and so on.

    2. Further, if there’s a possibility for q1, how can I implement the ‘Edit’ function for those external files/pages? Currently the program only has ‘Delete’ function implemented. I have seen your previous comments in relation to how to get the ‘Edit’ button to work. But what if those contents are from external files rather than the vars stated inside the JScript?

    Looking forward to your response.

    Cheers, Wayne

Sorry, comments are closed for this article.