Plugin Directory

Changeset 677903


Ignore:
Timestamp:
03/08/2013 04:56:56 AM (13 years ago)
Author:
sewpafly
Message:

2.0.0-beta-1

Location:
post-thumbnail-editor/trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • post-thumbnail-editor/trunk/README.txt

    r677349 r677903  
    66Tested up to: 3.5
    77Stable tag: trunk
     8License: GPLv2
    89
    910Fed 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  
    2222      color: #444444;
    2323   }
     24   #aspect-ratio-selector a,
    2425   .nav-tab-wrapper a {
    2526      cursor: pointer;
     
    7071      margin: 1px 0 0;
    7172   }
     73
     74   #aspect-ratio-selector {
     75      margin-top: 20px;
     76      font-size: 1.3em;
     77   }
     78
    7279   .info-message {
    7380      background-color: #ddddff;
     
    266273                  </tbody>
    267274               </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>
    268284            </div>
    269285            </div>
  • post-thumbnail-editor/trunk/i18n/post-thumbnail-editor.pot

    r677349 r677903  
    55"Project-Id-Version: Post Thumbnail Editor 2.0.0-beta\n"
    66"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n"
    7 "POT-Creation-Date: 2013-03-07 07:52:46+00:00\n"
     7"POT-Creation-Date: 2013-03-08 04:51:59+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=UTF-8\n"
     
    1515#. #-#-#-#-#  post-thumbnail-editor.pot (Post Thumbnail Editor 2.0.0-beta)  #-#-#-#-#
    1616#. Plugin Name of the plugin/theme
    17 #: html/pte.php:159 php/options.php:55 post-thumbnail-editor.php:107
     17#: html/pte.php:166 php/options.php:55 post-thumbnail-editor.php:107
    1818#: post-thumbnail-editor.php:207 post-thumbnail-editor.php:208
    1919#: post-thumbnail-editor.php:216 post-thumbnail-editor.php:217
     
    2121msgstr ""
    2222
    23 #: html/pte.php:160
     23#: html/pte.php:167
    2424msgid "crop and resize"
    2525msgstr ""
    2626
    27 #: html/pte.php:164 html/pte.php:199
     27#: html/pte.php:171 html/pte.php:206
    2828msgid "Crop"
    2929msgstr ""
    3030
    31 #: html/pte.php:165
     31#: html/pte.php:172
    3232msgid "View"
    3333msgstr ""
    3434
    35 #: html/pte.php:194
     35#: html/pte.php:201
    3636msgid "Options"
    3737msgstr ""
    3838
    39 #: html/pte.php:207
     39#: html/pte.php:214
    4040msgid "Aspect Ratio"
    4141msgstr ""
    4242
    43 #: html/pte.php:208
     43#: html/pte.php:215
    4444msgid "width/height"
    4545msgstr ""
    4646
    47 #: html/pte.php:222 php/options.php:37 post-thumbnail-editor.php:178
     47#: html/pte.php:229 php/options.php:37 post-thumbnail-editor.php:178
    4848msgid "Thumbnails"
    4949msgstr ""
    5050
    51 #: html/pte.php:228
     51#: html/pte.php:235
    5252msgid "Save all"
    5353msgstr ""
    5454
    55 #: html/pte.php:233
     55#: html/pte.php:240
    5656msgid "Reset all"
    5757msgstr ""
    5858
    59 #: html/pte.php:237
     59#: html/pte.php:244
    6060msgid "View all/modified"
    6161msgstr ""
    6262
    63 #: html/pte.php:256
     63#: html/pte.php:263
    6464msgid "Save"
    6565msgstr ""
    6666
    67 #: html/pte.php:259
     67#: html/pte.php:266
    6868msgid "Reset"
    6969msgstr ""
    7070
    71 #: html/pte.php:262
     71#: html/pte.php:269
    7272msgid "Compare/View"
    7373msgstr ""
    7474
    75 #: html/pte.php:285
     75#: html/pte.php:276
     76msgid "These thumbnails have an aspect ratio set:"
     77msgstr ""
     78
     79#: html/pte.php:301
    7680msgid "Original"
    7781msgstr ""
    7882
    79 #: html/pte.php:292
     83#: html/pte.php:308
    8084msgid "No image has been generated yet for image: "
    8185msgstr ""
    8286
    83 #: html/pte.php:299
     87#: html/pte.php:315
    8488msgid "Proposed"
    8589msgstr ""
  • post-thumbnail-editor/trunk/js-build/main.js

    r677349 r677903  
    267267        */
    268268
    269         var deleteTemp, id, nonces;
     269        var addToAspectRatios, deleteTemp, id, nonces;
    270270        $scope.page = {
    271271          crop: true,
     
    437437        });
    438438        /*
     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        /*
    439466        # Initialization
    440467        */
     
    463490          angular.forEach($scope.thumbnailObject, function(thumb, name) {
    464491            thumb.name = name;
    465             return this.push(thumb);
    466           }, $scope.thumbnails);
     492            this.thumbnails.push(thumb);
     493            addToAspectRatios(thumb);
     494          }, $scope);
    467495        });
    468496        $scope.anyProposed = function() {
     
    485513
    486514(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) {
    489518    app.controller("TableCtrl", [
    490519      '$scope', function($scope) {
     
    515544            thumbnail.selected = $scope.tableSelector;
    516545          }
     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          });
    517572          $scope.updateSelected();
    518573        };
  • post-thumbnail-editor/trunk/js/controllers/PteCtrl.coffee

    r677349 r677903  
    143143         return
    144144
     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
    145170      ###
    146171      # Initialization
     
    165190
    166191      $scope.thumbnails = []
    167 
    168192      $scope.thumbnailObject = $scope.thumbnailResource.get {id: id}, ->
    169193         angular.forEach $scope.thumbnailObject, (thumb, name) ->
    170194            thumb.name = name
    171             this.push thumb
    172          , $scope.thumbnails
     195            @thumbnails.push thumb
     196            addToAspectRatios thumb
     197            return
     198         , $scope
    173199         return
    174200
     
    182208   ]
    183209   return app
    184 
    185 
  • post-thumbnail-editor/trunk/js/controllers/TableCtrl.coffee

    r677349 r677903  
    11define [
     2   'angular'
    23   'cs!apps/pteApp'
    3 ], (app) ->
     4], (angular, app) ->
    45   app.controller "TableCtrl", ['$scope', ($scope) ->
    56      ###
     
    2930         return
    3031
     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
    3150      return
    3251   ]
Note: See TracChangeset for help on using the changeset viewer.