[ 2 posts ]

Roberto

  • Username: gixerino75
  • Joined: Wed May 04, 2011 7:48 am
  • Posts: 5
  • Location: Rome
  • Offline
  • Profile

Portal drag: Check the contents with the click

Post Posted: Fri May 13, 2011 12:04 am
+0-
Hi,

I wanted to know if this example was drag the portal can view the contents of individual feeds at the click instead of drag and drop functionality with no loss of style.

What is a feasible or necessary to change a lot of code file portal.js?

Thanks

Roberto

  • Username: gixerino75
  • Joined: Wed May 04, 2011 7:48 am
  • Posts: 5
  • Location: Rome
  • Offline
  • Profile

Re: Portal drag: Check the contents with the click

Post Posted: Fri May 13, 2011 5:25 am
+0-
I try with this code:

//This creates the module, either from a drag event or from the cookie load
YUI().use('node', function(Y){
Y.one('#feeds ul').on('click', function(mod, data, dd) {
//var setupModDD = function(mod, data, dd) {
var node = mod;
//Listen for the click so we can react to the buttons
node.one('h2').on('click', _nodeClick);

//Remove the event's on the original drag instance
dd.detachAll('drag:start');
dd.detachAll('drag:end');
dd.detachAll('drag:drophit');

//It's a target
dd.set('target', true);
//Setup the handles
dd.addHandle('h2').addInvalid('a');
//Remove the mouse listeners on this node
dd._unprep();
//Update a new node
dd.set('node', mod);
//Reset the mouse handlers
dd._prep();

var myArticle = data.article;
var url = 'http:/'+'/pipes.yahooapis.com/pipes/pipe.run?_id=6b7b2c6a32f5a12e7259c36967052387&_render=json&url=http:/'+'/' + data.url;
//Start the XDR request
var id = Y.io(url, {
method: 'GET',
xdr: {
use:'flash'
},
//XDR Listeners
on: {
success: function(id, data) {
//On success get the feed data
var d = feeds[trans[id]],
//Node reference
inner = d.mod.one('div.inner'),
//Parse the JSON data
oRSS = Y.JSON.parse(data.responseText),
html = myArticle;

//Did we get data?
//if (oRSS && oRSS.count) {
//Walk the list and create the news list
// Y.each(oRSS.value.items, function(v, k) {
// if (k < 5) {
// html += '<li><a href="' + v.link + '" target="_blank">' + v.title + '</a>';
// }
//});
//}
//Set the innerHTML of the module
inner.set('innerHTML', '<ul>' + html + '</ul>');
if (Y.DD.DDM.activeDrag) {
//If we are still dragging, update the proxy element too..
var proxy_inner = Y.DD.DDM.activeDrag.get('dragNode').one('div.inner');
proxy_inner.set('innerHTML', '<ul>' + html + '</ul>');

}
},
failure: function(id, data) {
//Something failed..
var d = feeds[trans[id]],
//Node reference
inner = d.mod.one('div.inner'),
html = '<ul><li>Feed failed to load..</li></ul>';

inner.set('innerHTML', html);
if (Y.DD.DDM.activeDrag) {
//If we are still dragging, update the proxy element too..
var proxy_inner = Y.DD.DDM.activeDrag.get('dragNode').one('div.inner');
proxy_inner.set('innerHTML', html);

}
}
}
});
//Keep track of the transaction
feeds[data.id].trans = id;
feeds[data.id].mod = mod;
trans[id.id] = data.id;
// };
});
});
//Helper method to create the markup for the module..
var createMod = function(feed) {
var str = '<li class="item">' +
'<div class="mod" id="' + feed.id + 'LD">' +
'<h2><strong>' + feed.title + '</strong> <a title="minimize module" class="min" href="#"> </a>' +
'<a title="close module" class="close" href="#"></a></h2>' +
'<div class="inner"></div>' +
'</div>' +
'</li>';
//return Y.Node.create(str);
Y.one('#list1').append(str);


};

Unfortunately this does not show me anything.

Can you please give me some suggestions?

Thanks
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum