Fixed : Widget FORM and Modal issues

Added : Loader on widget create function
This commit is contained in:
Arslan Hassan 2012-05-07 10:21:36 +00:00
parent 63d1f84eb2
commit 9b52663d32
6 changed files with 28 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -4,6 +4,7 @@
amplify.request.define( "update-sidebar", "ajax", {
url: ajaxURL+"/widgets.php",
type: "POST",
dataType: "json",
decoder: function( data, status, xhr, success, error ) {
if ( status === "success" ) {
success( data );

View file

@ -35,7 +35,9 @@ function createWidget($widgetId,$sideBarId)
var $newWidget = '<div class="widget-bar" id="'+$widgetId+'-'+$sideBarId+'" >';
$newWidget += '<div class="btn-group">';
$newWidget += '<span class="btn widget-btn-long">';
$newWidget += '<span class="btn widget-btn-long relative">';
$newWidget += '<img src="'+imageurl+'/loaders/1.gif"';
$newWidget += 'class="loader absolute" style="left:5px"/>';
$newWidget += $widgetTitle+'</span>';
$newWidget += '<button class="btn dropdown-toggle"';
$newWidget += ' data-toggle="modal" ';
@ -44,7 +46,7 @@ function createWidget($widgetId,$sideBarId)
$newWidget += '</div>';
$newWidget += '<input type="hidden" name="widgets[]" value="'+$widgetId+'"/>';
$newWidget += '</div>';
/*Widget Modal
var WidgetModal = '<div class="modal hide fade"';
@ -55,10 +57,10 @@ function createWidget($widgetId,$sideBarId)
//Append widget...*/
$widgetList.append($newWidget);
saveAndFetch($sideBarId,$widgetId);
var WidgetModal = saveAndFetch($sideBarId,$widgetId);
$('#modal-forms-'+$sideBarId).append(WidgetModal);
return true;
}
@ -86,7 +88,8 @@ function saveAndFetch($Id,$widgetId)
FormData = FormData + '&mode=update-sidebar&fetch-widget='+$widgetId;
amplify.request("update-sidebar",FormData,
function(data){
return data;
$('#modal-forms-'+$Id).append(data.data);
$('#'+$widgetId+'-'+$Id+' .loader' ).hide();
}
);
}
@ -123,5 +126,6 @@ function deleteWidget($widgetId,$sidebarId){
{
$('#'+$widgetId+'-'+$sidebarId).remove();
saveSidebar($sidebarId);
$('#'+$widgetId+'-'+$sidebarId+'-modal').modal('hide').remove();
}
}

View file

@ -73,7 +73,9 @@ pane of the sidebar you want to add to.
{assign var=theWidget value=get_widget_details($theWidget.id,$sidebar.id)}
<div class="widget-bar" id="{$theWidget.id}-{$sidebar.id}">
<div class="btn-group">
<span class="btn widget-btn-long">
<span class="btn widget-btn-long relative">
<img src="{$imageurl}/loaders/1.gif" class="loader absolute"
style="left:5px; display: none"/>
{if $theWidget.configs.title}
{$theWidget.configs.title}
{else}

View file

@ -1,3 +1,16 @@
.inlineblock{display: inline-block}
.inline{display:inline}
.block{display: block}
.display-none{display: none}
.relative {position: relative}
.absolute {position: absolute}
.bottom{bottom:0px}
.top{top:0px}
.left{left:0px}
.right{right:0px}
.sidebar-nav{
padding: 9px 0px;
}

View file

@ -91,7 +91,7 @@ function sidebar($place=NULL,$echo=true)
* check if there is a siderbar or not
* @todo Write documentation
*/
function has_sidebar($palce)
function has_sidebar($place)
{
global $Cbucket;
$sidebar = $Cbucket->sidebars[$place];