Changeset 135
- Timestamp:
- 07/23/07 16:24:02 (1 year ago)
- Files:
-
- branch/controllers/pages_controller.php (modified) (3 diffs)
- branch/controllers/posts_controller.php (modified) (3 diffs)
- branch/views/elements/js_include.ctp (modified) (1 diff)
- branch/views/pages/admin_index.ctp (modified) (1 diff)
- branch/webroot/css/jquery.ability.css (modified) (1 diff)
- branch/webroot/img/arrow_down.gif (added)
- branch/webroot/img/arrow_up.gif (added)
- branch/webroot/js/jquery.ability.js (modified) (3 diffs)
- branch/webroot/js/ui.drag.ext.js (added)
- branch/webroot/js/ui.drag.js (added)
- branch/webroot/js/ui.js (added)
- branch/webroot/js/webrocket.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branch/controllers/pages_controller.php
r119 r135 89 89 $this->Page->create(); 90 90 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 } 93 97 } else { 94 98 $this->Session->setFlash('The Page could not be saved. Please, try again.'); … … 107 111 $this->cleanUpFields(); 108 112 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 } 111 119 } else { 112 120 $this->Session->setFlash('The Page could not be saved. Please, try again.'); … … 126 134 } 127 135 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 } 130 142 } 131 143 } branch/controllers/posts_controller.php
r131 r135 150 150 $this->Post->create(); 151 151 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 } 154 158 } else { 155 159 $this->Session->setFlash('The Post could not be saved. Please, try again.'); … … 169 173 $this->cleanUpFields(); 170 174 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 } 173 181 } else { 174 182 $this->Session->setFlash('The Post could not be saved. Please, try again.'); … … 189 197 } 190 198 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 } 193 205 } 194 206 } branch/views/elements/js_include.ctp
r128 r135 17 17 <?php e($javascript->link('jquery.ability'));?> 18 18 <?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'));?> 19 23 <!-- WymEditor JavaScript--> 20 24 <?php e($javascript->link('wymeditor/jquery.wymeditor'));?> branch/views/pages/admin_index.ctp
r119 r135 27 27 <?php echo $html->link('View', array('action'=>'view', $page['Page']['id'])); ?> 28 28 <?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); ?> 30 30 </td> 31 31 </tr> branch/webroot/css/jquery.ability.css
r133 r135 1 span.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 9 span.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 17 div.ability { 18 width:30%; 19 border:1px solid #fff; 20 } 21 22 span.adesc {float:left;} 23 24 span.aheader { 25 border-bottom:1px solid #fff; 26 } 27 28 span.aheader:hover { 29 cursor:hand; 30 } 31 1 32 ul.fontsize, ul.switcher { 2 33 margin-right:20px; branch/webroot/js/jquery.ability.js
r134 r135 5 5 * 6 6 * === 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 * 7 14 * Version 1.0 (20/07/2007) 8 15 * Initial version. … … 59 66 */ 60 67 ability: function(settings) { 61 var version = " 0.1";68 var version = "1.1"; 62 69 /* Default Settings*/ 63 70 settings = jQuery.extend({ … … 68 75 styledir: "/css/", 69 76 savecookie: true, 70 defaultcss: 'default.css' 77 defaultcss: 'default.css', 78 defaultbehaviour: "click", 79 header: "Accessibility Widget" 71 80 },settings); 72 81 73 82 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'); 77 86 var breakline = '<br style="clear:both;" />'; 78 87 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 + '"> </span>'); 89 jQuery(controlbox).append('<span class="aheader">' + settings.header + '</span>'); 90 jQuery(controlbox).append('<div class="ability"></div>') 81 91 82 92 if (settings.textsizer == true) { 83 93 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">'; 85 95 for (var i=0, len = settings.textsizeclasses.length; i < len; i++) { 86 96 textsizer += '<li><a href="#" class="btn-' + settings.textsizeclasses[i] + '" rel="' + settings.textsizeclasses[i] + '">' + settings.textsizeclasses[i].toUpperCase() + '</a></li>' 87 97 } 88 98 textsizer += '</ul>'; 89 output += textsizer + breakline;99 jQuery("div.ability").append(textsizer + breakline); 90 100 } 91 101 92 102 if (settings.switcher == true) { 93 103 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">'; 95 105 for (var i=0, len = settings.switcherstyles.length; i < len; i++) { 96 106 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>' 98 108 } 99 109 switcher += '</ul>'; 100 output += switcher + breakline110 jQuery("div.ability").append(switcher + breakline); 101 111 } 102 output += '<a href="#" class="reset">Reset</a></div>';103 112 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(){ 107 116 switchTextSize(jQuery(this).attr('rel'), settings, this); 108 117 return false; 109 118 }); 110 jQuery('ul.switcher li a'). hover(function(){119 jQuery('ul.switcher li a').bind(settings.defaultbehaviour,function(){ 111 120 switchStyleSheet(jQuery(this).attr('rel'), settings, this); 112 121 return false; 113 122 }); 114 jQuery('a.reset'). hover(function(){123 jQuery('a.reset').bind(settings.defaultbehaviour,function(){ 115 124 reset(settings); 116 125 return false; 117 126 }); 118 127 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 }); 119 139 }); 120 140 } branch/webroot/js/webrocket.js
r132 r135 72 72 } 73 73 return false; 74 });74 }); 75 75 76 76 $j('tr:odd').addClass("odd"); 77 78 $j('div#accessibility').draggable({handle: "span.aheader", containment: "document", opacity: 0.4 ,revert: false}); 79 77 80 });