Assembla home | Assembla project page
 

Changeset 135

Show
Ignore:
Timestamp:
07/23/07 16:24:02 (1 year ago)
Author:
digitalspaghetti
Message:

Improved JQAbility and Views

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branch/controllers/pages_controller.php

    r119 r135  
    8989                        $this->Page->create(); 
    9090                        if($this->Page->save($this->data)) { 
    91                                 $this->Session->setFlash('The Page has been saved'); 
    92                                 $this->redirect(array('action'=>'index'), null, true); 
     91                                if ($this->isAjax) { 
     92                                        $this->redirect(array('action'=>'home#remote-tab-1'),null, true); 
     93                                } else { 
     94                                        $this->Session->setFlash('The Page has been saved'); 
     95                                        $this->redirect(array('home'), null, true); 
     96                                } 
    9397                        } else { 
    9498                                $this->Session->setFlash('The Page could not be saved. Please, try again.'); 
     
    107111                        $this->cleanUpFields(); 
    108112                        if($this->Page->save($this->data)) { 
    109                                 $this->Session->setFlash('The Page saved'); 
    110                                 $this->redirect(array('action'=>'index'), null, true); 
     113                                if ($this->isAjax) { 
     114                                        $this->redirect('#remote-tab-1'); 
     115                                } else { 
     116                                        $this->Session->setFlash('The Page has been saved'); 
     117                                        $this->redirect(array('action'=>'home'), null, true); 
     118                                } 
    111119                        } else { 
    112120                                $this->Session->setFlash('The Page could not be saved. Please, try again.'); 
     
    126134                } 
    127135                if($this->Page->del($id)) { 
    128                         $this->Session->setFlash('Page #'.$id.' deleted'); 
    129                         $this->redirect(array('action'=>'index'), null, true); 
     136                        if ($this->isAjax) { 
     137                                $this->redirect('#remote-tab-1'); 
     138                        } else { 
     139                                $this->Session->setFlash('Page #'.$id.' deleted'); 
     140                                $this->redirect(array('action'=>'home'), null, true); 
     141                        } 
    130142                } 
    131143        } 
  • branch/controllers/posts_controller.php

    r131 r135  
    150150                        $this->Post->create(); 
    151151                        if($this->Post->save($this->data)) { 
    152                                 $this->Session->setFlash('The Post has been saved'); 
    153                                 $this->redirect(array('action'=>'home'), null, true); 
     152                                if ($this->isAjax) { 
     153                                        $this->redirect(array('action' => 'home#remote-tab-1'),null, true); 
     154                                } else { 
     155                                        $this->Session->setFlash('The Post has been saved'); 
     156                                        $this->redirect(array('action'=>'home'), null, true); 
     157                                } 
    154158                        } else { 
    155159                                $this->Session->setFlash('The Post could not be saved. Please, try again.'); 
     
    169173                        $this->cleanUpFields(); 
    170174                        if($this->Post->save($this->data)) { 
    171                                 $this->Session->setFlash('The Post saved'); 
    172                                 $this->redirect(array('action'=>'home'), null, true); 
     175                                if ($this->isAjax) { 
     176                                        $this->redirect('#remote-tab-1'); 
     177                                } else { 
     178                                        $this->Session->setFlash('The Post has been saved'); 
     179                                        $this->redirect(array('action'=>'home'), null, true); 
     180                                } 
    173181                        } else { 
    174182                                $this->Session->setFlash('The Post could not be saved. Please, try again.'); 
     
    189197                } 
    190198                if($this->Post->del($id)) { 
    191                         $this->Session->setFlash('Post #'.$id.' deleted'); 
    192                         $this->redirect(array('action'=>'index'), null, true); 
     199                        if ($this->isAjax) { 
     200                                $this->redirect('#remote-tab-1'); 
     201                        } else { 
     202                                $this->Session->setFlash('Post #'.$id.' deleted'); 
     203                                $this->redirect(array('action'=>'home'), null, true); 
     204                        } 
    193205                } 
    194206        } 
  • branch/views/elements/js_include.ctp

    r128 r135  
    1717<?php e($javascript->link('jquery.ability'));?> 
    1818<?php e($javascript->link('jquery.passstrength'));?> 
     19<?php e($javascript->link('ui'));?> 
     20<?php e($javascript->link('ui.mouse'));?> 
     21<?php e($javascript->link('ui.drag'));?> 
     22<?php e($javascript->link('ui.drag.ext'));?> 
    1923<!-- WymEditor JavaScript--> 
    2024<?php e($javascript->link('wymeditor/jquery.wymeditor'));?> 
  • branch/views/pages/admin_index.ctp

    r119 r135  
    2727                                <?php echo $html->link('View', array('action'=>'view', $page['Page']['id'])); ?> 
    2828                                <?php echo $html->link('Edit', array('action'=>'edit', $page['Page']['id'])); ?> 
    29                                 <?php echo $html->link('Delete', array('action'=>'delete', $page['Page']['id']), null, 'Are you sure you want to delete #' . $page['Page']['id']); ?> 
     29                                <?php echo $html->link('Delete', array('action'=>'delete', $page['Page']['id']), array('class'=>'delete', 'id'=> $page['Page']['id']), null); ?> 
    3030                        </td> 
    3131                </tr> 
  • branch/webroot/css/jquery.ability.css

    r133 r135  
     1span.ahide { 
     2        padding:0 5px; 
     3        width:16px; 
     4        height:16px; 
     5        background: url('../img/arrow_up.gif') no-repeat; 
     6        color: transparent; 
     7} 
     8 
     9span.ashow { 
     10        padding:0 5px; 
     11        width:16px; 
     12        height:16px; 
     13        background: url('../img/arrow_down.gif') no-repeat; 
     14        color: transparent; 
     15} 
     16 
     17div.ability { 
     18        width:30%; 
     19        border:1px solid #fff; 
     20} 
     21 
     22span.adesc {float:left;} 
     23 
     24span.aheader { 
     25        border-bottom:1px solid #fff;    
     26} 
     27 
     28span.aheader:hover { 
     29        cursor:hand; 
     30} 
     31 
    132ul.fontsize, ul.switcher { 
    233        margin-right:20px; 
  • branch/webroot/js/jquery.ability.js

    r134 r135  
    55 *  
    66 * === Changelog === 
     7 * Version 1.1 (23/07/2007) 
     8 * Added additional options: 
     9 *      + Added event that triggers plugin (i.e. click, mouseover) 
     10 *      + Added name of plugin that user can change 
     11 * Cleaned up ability box creation code 
     12 * Added Show/Hide button. 
     13 *  
    714 * Version 1.0 (20/07/2007) 
    815 * Initial version. 
     
    5966         */ 
    6067                ability: function(settings) { 
    61                         var version = "0.1"; 
     68                        var version = "1.1"; 
    6269                        /* Default Settings*/    
    6370                        settings = jQuery.extend({ 
     
    6875                                styledir: "/css/", 
    6976                                savecookie: true, 
    70                                 defaultcss: 'default.css' 
     77                                defaultcss: 'default.css', 
     78                                defaultbehaviour: "click", 
     79                                header: "Accessibility Widget" 
    7180                        },settings); 
    7281                 
    7382                        return this.each(function(){ 
    74                                 controlbox = this; 
    75                                  
    76                                 var output = '<div class="ability">'
     83                                var controlbox = this; 
     84                                var curstyle = jQuery.cookie('style'); 
     85                                var curtextsize = jQuery.cookie('textsize')
    7786                                var breakline = '<br style="clear:both;" />'; 
    7887                                 
    79                                 var curstyle = jQuery.cookie('style'); 
    80                                 var curtextsize = jQuery.cookie('textsize'); 
     88                                jQuery(controlbox).append('<span id="hider" class="ahide" title="Hide ' + settings.header + '">&nbsp;</span>'); 
     89                                jQuery(controlbox).append('<span class="aheader">' + settings.header + '</span>'); 
     90                                jQuery(controlbox).append('<div class="ability"></div>')                                 
    8191                                 
    8292                                if (settings.textsizer == true) { 
    8393                                        if (curtextsize) { jQuery('body').removeClass().addClass(curtextsize); } 
    84                                         var textsizer = '<ul class="fontsize"><li>Text Size:</li>'; 
     94                                        var textsizer = '<span class="adesc">Text Size:</span> <ul class="fontsize">'; 
    8595                                        for (var i=0, len = settings.textsizeclasses.length; i < len; i++) { 
    8696                                                textsizer += '<li><a href="#" class="btn-' + settings.textsizeclasses[i] + '" rel="' + settings.textsizeclasses[i] + '">' + settings.textsizeclasses[i].toUpperCase() + '</a></li>' 
    8797                                        } 
    8898                                        textsizer += '</ul>'; 
    89                                         output += textsizer + breakline
     99                                        jQuery("div.ability").append(textsizer + breakline)
    90100                                } 
    91101                                 
    92102                                if (settings.switcher == true) { 
    93103                                        if (curstyle) { switchStyleSheet(curstyle, settings); } 
    94                                         var switcher = '<ul class="switcher"><li>Style Sheet:</li>'; 
     104                                        var switcher = '<span class="adesc">Style Sheet:</span> <ul class="switcher">'; 
    95105                                        for (var i=0, len = settings.switcherstyles.length; i < len; i++) { 
    96106                                                var brokenstring=settings.switcherstyles[i].split("."); 
    97                                                 switcher += '<li><a href="#" rel="' + settings.switcherstyles[i] + '">' + brokenstring[0].toUpperCase() + '</a></li>' 
     107                                                switcher += '<li><a href="#" class="btn-' + brokenstring[0] + '" rel="' + settings.switcherstyles[i] + '">' + brokenstring[0].toUpperCase() + '</a></li>' 
    98108                                        } 
    99109                                        switcher += '</ul>'; 
    100                                         output += switcher + breakline 
     110                                        jQuery("div.ability").append(switcher + breakline); 
    101111                                } 
    102                                 output += '<a href="#" class="reset">Reset</a></div>'; 
    103112                                 
    104                                 jQuery(controlbox).html(output); 
    105                                  
    106                                 jQuery('ul.fontsize li a').hover(function(){ 
     113                                jQuery("div.ability").append('<a href="#" class="reset">Reset Styles</a>'); 
     114 
     115                                jQuery('ul.fontsize li a').bind(settings.defaultbehaviour,function(){ 
    107116                                                switchTextSize(jQuery(this).attr('rel'), settings, this); 
    108117                                                return false; 
    109118                                }); 
    110                                 jQuery('ul.switcher li a').hover(function(){ 
     119                                jQuery('ul.switcher li a').bind(settings.defaultbehaviour,function(){ 
    111120                                        switchStyleSheet(jQuery(this).attr('rel'), settings, this); 
    112121                                        return false; 
    113122                                }); 
    114                                 jQuery('a.reset').hover(function(){ 
     123                                jQuery('a.reset').bind(settings.defaultbehaviour,function(){ 
    115124                                        reset(settings); 
    116125                                        return false; 
    117126                                }); 
    118127                                 
     128                                jQuery('span#hider').toggle( 
     129                                        function(){ 
     130                                                jQuery(this).removeClass().addClass('ashow').attr('title', 'Show ' + settings.header); 
     131                                                jQuery('div.ability').slideUp('slow'); 
     132                                                jQuery.cookie('showability', false, 365); 
     133                                        }, 
     134                                        function(){ 
     135                                                jQuery(this).removeClass().addClass('ahide').attr('title', 'Hide ' + settings.header); 
     136                                                jQuery('div.ability').slideDown('slow'); 
     137                                                jQuery.cookie('showability', true, 365); 
     138                                }); 
    119139                        }); 
    120140                } 
  • branch/webroot/js/webrocket.js

    r132 r135  
    7272       } 
    7373       return false; 
    74 }); 
     74       }); 
    7575         
    7676        $j('tr:odd').addClass("odd"); 
     77         
     78        $j('div#accessibility').draggable({handle: "span.aheader", containment: "document", opacity: 0.4 ,revert: false}); 
     79         
    7780});