Skip to content

Commit

Permalink
Textify and fix columns at the same time.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianMayer committed Feb 8, 2015
1 parent c474712 commit d052bb7
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions src/plugins/strftime/structure_plugin.js
Expand Up @@ -29,24 +29,24 @@ define( ['structure_custom', 'css!plugins/strftime/strftime' ], function( VisuDe
var $p = $(page);
var id = "strftime_" + uniqid();

var ret_val = $('<div class="widget clearfix text strftime"/>');
var classes = 'widget clearfix text strftime';
if ($p.attr('class')) {
ret_val.addClass('custom_'+$p.attr('class'));
classes += ' custom_'+$p.attr('class');
}
classes += templateEngine.design.setWidgetLayout( $p, path );
var ret_val = '<div class="'+ classes + '">';

templateEngine.design.setWidgetLayout(ret_val, $p, path);
var actor = $('<div id="' + id + '" class="strftime_value"></div>');
ret_val.append(actor);
ret_val += '<div id="' + id + '" class="strftime_value"></div>';

actor.data({
var data = templateEngine.widgetDataInsert( path, {
'locale' : $p.attr('lang'),
'format' : $p.attr('format') || '%c'
});
} );

elements[id] = actor;
elements[id] = path;
startTimer();

return ret_val;
return ret_val + '</div>';
}
});

Expand All @@ -61,9 +61,19 @@ define( ['structure_custom', 'css!plugins/strftime/strftime' ], function( VisuDe
if (!timerStarted) {
var f = function() {
var d = new Date();
$.each(elements, function(index, actor) {
d.locale = actor.data('locale');
actor.html(d.strftime(actor.data('format')));
$.each(elements, function(index, path ) {
var data = templateEngine.widgetDataGet( path );
d.locale = data.locale;
if( undefined === data.actor )
{
data.actor = $('#' + index );
if( 0 === data.actor.length )
{
data.actor = undefined;
return;
}
}
data.actor.html(d.strftime( data.format ));
});
window.setTimeout(f, 1000);
};
Expand Down

0 comments on commit d052bb7

Please sign in to comment.