Changeset 677903
- Timestamp:
- 03/08/2013 04:56:56 AM (13 years ago)
- Location:
- post-thumbnail-editor/trunk
- Files:
-
- 3 added
- 7 edited
-
README.txt (modified) (1 diff)
-
html/pte.php (modified) (3 diffs)
-
i18n/post-thumbnail-editor.pot (modified) (3 diffs)
-
js-build/main.js (modified) (5 diffs)
-
js-build/main.js.gz (modified) (previous)
-
js/controllers/PteCtrl.coffee (modified) (3 diffs)
-
js/controllers/TableCtrl.coffee (modified) (2 diffs)
-
js/snippets (added)
-
js/snippets/admin.coffee (added)
-
js/snippets/media.coffee (added)
Legend:
- Unmodified
- Added
- Removed
-
post-thumbnail-editor/trunk/README.txt
r677349 r677903 6 6 Tested up to: 3.5 7 7 Stable tag: trunk 8 License: GPLv2 8 9 9 10 Fed up with the lack of automated tools to properly crop and scale post thumbnails? Maybe this plugin can help. -
post-thumbnail-editor/trunk/html/pte.php
r677349 r677903 22 22 color: #444444; 23 23 } 24 #aspect-ratio-selector a, 24 25 .nav-tab-wrapper a { 25 26 cursor: pointer; … … 70 71 margin: 1px 0 0; 71 72 } 73 74 #aspect-ratio-selector { 75 margin-top: 20px; 76 font-size: 1.3em; 77 } 78 72 79 .info-message { 73 80 background-color: #ddddff; … … 266 273 </tbody> 267 274 </table> 275 <div id="aspect-ratio-selector"> 276 <?php _e( "These thumbnails have an aspect ratio set:", PTE_DOMAIN ); ?> 277 <ul> 278 <li ng-repeat="aspectRatio in aspectRatios | orderBy:size"> 279 <a ng-click="selectAspectRatio(aspectRatio)" ng-href=""> 280 <i class="icon-ok"></i> 281 {{ aspectRatio.thumbnails.toString().replace(",",", ") }}</a></li> 282 </ul> 283 </div> 268 284 </div> 269 285 </div> -
post-thumbnail-editor/trunk/i18n/post-thumbnail-editor.pot
r677349 r677903 5 5 "Project-Id-Version: Post Thumbnail Editor 2.0.0-beta\n" 6 6 "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n" 7 "POT-Creation-Date: 2013-03-0 7 07:52:46+00:00\n"7 "POT-Creation-Date: 2013-03-08 04:51:59+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=UTF-8\n" … … 15 15 #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 2.0.0-beta) #-#-#-#-# 16 16 #. Plugin Name of the plugin/theme 17 #: html/pte.php:1 59php/options.php:55 post-thumbnail-editor.php:10717 #: html/pte.php:166 php/options.php:55 post-thumbnail-editor.php:107 18 18 #: post-thumbnail-editor.php:207 post-thumbnail-editor.php:208 19 19 #: post-thumbnail-editor.php:216 post-thumbnail-editor.php:217 … … 21 21 msgstr "" 22 22 23 #: html/pte.php:16 023 #: html/pte.php:167 24 24 msgid "crop and resize" 25 25 msgstr "" 26 26 27 #: html/pte.php:1 64 html/pte.php:19927 #: html/pte.php:171 html/pte.php:206 28 28 msgid "Crop" 29 29 msgstr "" 30 30 31 #: html/pte.php:1 6531 #: html/pte.php:172 32 32 msgid "View" 33 33 msgstr "" 34 34 35 #: html/pte.php: 19435 #: html/pte.php:201 36 36 msgid "Options" 37 37 msgstr "" 38 38 39 #: html/pte.php:2 0739 #: html/pte.php:214 40 40 msgid "Aspect Ratio" 41 41 msgstr "" 42 42 43 #: html/pte.php:2 0843 #: html/pte.php:215 44 44 msgid "width/height" 45 45 msgstr "" 46 46 47 #: html/pte.php:22 2php/options.php:37 post-thumbnail-editor.php:17847 #: html/pte.php:229 php/options.php:37 post-thumbnail-editor.php:178 48 48 msgid "Thumbnails" 49 49 msgstr "" 50 50 51 #: html/pte.php:2 2851 #: html/pte.php:235 52 52 msgid "Save all" 53 53 msgstr "" 54 54 55 #: html/pte.php:2 3355 #: html/pte.php:240 56 56 msgid "Reset all" 57 57 msgstr "" 58 58 59 #: html/pte.php:2 3759 #: html/pte.php:244 60 60 msgid "View all/modified" 61 61 msgstr "" 62 62 63 #: html/pte.php:2 5663 #: html/pte.php:263 64 64 msgid "Save" 65 65 msgstr "" 66 66 67 #: html/pte.php:2 5967 #: html/pte.php:266 68 68 msgid "Reset" 69 69 msgstr "" 70 70 71 #: html/pte.php:26 271 #: html/pte.php:269 72 72 msgid "Compare/View" 73 73 msgstr "" 74 74 75 #: html/pte.php:285 75 #: html/pte.php:276 76 msgid "These thumbnails have an aspect ratio set:" 77 msgstr "" 78 79 #: html/pte.php:301 76 80 msgid "Original" 77 81 msgstr "" 78 82 79 #: html/pte.php: 29283 #: html/pte.php:308 80 84 msgid "No image has been generated yet for image: " 81 85 msgstr "" 82 86 83 #: html/pte.php: 29987 #: html/pte.php:315 84 88 msgid "Proposed" 85 89 msgstr "" -
post-thumbnail-editor/trunk/js-build/main.js
r677349 r677903 267 267 */ 268 268 269 var deleteTemp, id, nonces;269 var addToAspectRatios, deleteTemp, id, nonces; 270 270 $scope.page = { 271 271 crop: true, … … 437 437 }); 438 438 /* 439 # Allow selecting based on the aspect ratio 440 */ 441 442 $scope.aspectRatios = []; 443 addToAspectRatios = function(thumb) { 444 var ar, aspectRatio, _i, _len, _ref; 445 ar = thumb.width / thumb.height; 446 if ((ar == null) || ar === Infinity) { 447 return; 448 } 449 if (!thumb.crop || +thumb.crop < 1) { 450 return; 451 } 452 _ref = $scope.aspectRatios; 453 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 454 aspectRatio = _ref[_i]; 455 if (aspectRatio.size === ar) { 456 aspectRatio.thumbnails.push(thumb.name); 457 return; 458 } 459 } 460 $scope.aspectRatios.push({ 461 size: ar, 462 thumbnails: [thumb.name] 463 }); 464 }; 465 /* 439 466 # Initialization 440 467 */ … … 463 490 angular.forEach($scope.thumbnailObject, function(thumb, name) { 464 491 thumb.name = name; 465 return this.push(thumb); 466 }, $scope.thumbnails); 492 this.thumbnails.push(thumb); 493 addToAspectRatios(thumb); 494 }, $scope); 467 495 }); 468 496 $scope.anyProposed = function() { … … 485 513 486 514 (function() { 487 488 define('cs!controllers/TableCtrl',['cs!apps/pteApp'], function(app) { 515 var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; 516 517 define('cs!controllers/TableCtrl',['angular', 'cs!apps/pteApp'], function(angular, app) { 489 518 app.controller("TableCtrl", [ 490 519 '$scope', function($scope) { … … 515 544 thumbnail.selected = $scope.tableSelector; 516 545 } 546 $scope.updateSelected(); 547 }; 548 /* 549 # Toggle the thumbnails based on their aspectRatio 550 # 551 # If there are multiple thumbnails, use the value of the first thumbnail.selected 552 # to determine the rest. 553 */ 554 555 $scope.selectAspectRatio = function(ar) { 556 var selectVal; 557 if (typeof event !== "undefined" && event !== null) { 558 if (typeof event.stopPropagation === "function") { 559 event.stopPropagation(); 560 } 561 } 562 selectVal = null; 563 angular.forEach($scope.thumbnails, function(thumb) { 564 var _ref; 565 if (_ref = thumb.name, __indexOf.call(ar.thumbnails, _ref) >= 0) { 566 if (selectVal == null) { 567 selectVal = (thumb.selected != null) && thumb.selected ? false : true; 568 } 569 thumb.selected = selectVal; 570 } 571 }); 517 572 $scope.updateSelected(); 518 573 }; -
post-thumbnail-editor/trunk/js/controllers/PteCtrl.coffee
r677349 r677903 143 143 return 144 144 145 146 ### 147 # Allow selecting based on the aspect ratio 148 ### 149 $scope.aspectRatios = [] 150 addToAspectRatios = (thumb) -> 151 ar = thumb.width/thumb.height 152 153 # Check for valid AspectRatio 154 if !ar? or ar is Infinity 155 return 156 157 if !thumb.crop or +thumb.crop < 1 158 return 159 160 for aspectRatio in $scope.aspectRatios 161 if aspectRatio.size is ar 162 aspectRatio.thumbnails.push thumb.name 163 return 164 $scope.aspectRatios.push 165 size: ar 166 thumbnails: [thumb.name] 167 return 168 169 145 170 ### 146 171 # Initialization … … 165 190 166 191 $scope.thumbnails = [] 167 168 192 $scope.thumbnailObject = $scope.thumbnailResource.get {id: id}, -> 169 193 angular.forEach $scope.thumbnailObject, (thumb, name) -> 170 194 thumb.name = name 171 this.push thumb 172 , $scope.thumbnails 195 @thumbnails.push thumb 196 addToAspectRatios thumb 197 return 198 , $scope 173 199 return 174 200 … … 182 208 ] 183 209 return app 184 185 -
post-thumbnail-editor/trunk/js/controllers/TableCtrl.coffee
r677349 r677903 1 1 define [ 2 'angular' 2 3 'cs!apps/pteApp' 3 ], (a pp) ->4 ], (angular, app) -> 4 5 app.controller "TableCtrl", ['$scope', ($scope) -> 5 6 ### … … 29 30 return 30 31 32 ### 33 # Toggle the thumbnails based on their aspectRatio 34 # 35 # If there are multiple thumbnails, use the value of the first thumbnail.selected 36 # to determine the rest. 37 ### 38 $scope.selectAspectRatio = (ar) -> 39 event?.stopPropagation?() 40 selectVal = null 41 angular.forEach $scope.thumbnails, (thumb) -> 42 if thumb.name in ar.thumbnails 43 if not selectVal? 44 selectVal = if thumb.selected? and thumb.selected then false else true 45 thumb.selected = selectVal 46 return 47 $scope.updateSelected() 48 return 49 31 50 return 32 51 ]
Note: See TracChangeset
for help on using the changeset viewer.