Skip to content

Commit

Permalink
Merge pull request #27 from storypioneers/develop
Browse files Browse the repository at this point in the history
Merge 1.4.2
  • Loading branch information
JonasDoebertin committed Aug 14, 2015
2 parents d548959 + 90e4d99 commit fb69a8e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
10 changes: 6 additions & 4 deletions PLUGIN_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ If you are an advanced user and know your way around Git and you already use Git

```bash
$ cd your/project/root
$ git submodule add git@github.com:storypioneers/kirby-selector.git site/fields/selector
$ git submodule add https://github.com/storypioneers/kirby-selector.git site/fields/selector
```

Updating all your Git submodules (eg. the Kirby core modules and any extensions added as submodules) to their latest version, all you need to do is to run these two Git commands.
Updating all your Git submodules (eg. the Kirby core modules and any extensions added as submodules) to their latest version, all you need to do is to run these few Git commands:

```bash
$ cd your/project/root
$ git submodule foreach --recursive git checkout master
$ git submodule foreach --recursive git pull
$ git submodule foreach git checkout master
$ git submodule foreach git pull
$ git commit -a -m "Update submodules"
$ git submodule update --init --recursive
```

## Usage
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ If you are an advanced user and know your way around Git and you already use Git

```bash
$ cd your/project/root
$ git submodule add git@github.com:storypioneers/kirby-selector.git site/fields/selector
$ git submodule add https://github.com/storypioneers/kirby-selector.git site/fields/selector
```

Updating all your Git submodules (eg. the Kirby core modules and any extensions added as submodules) to their latest version, all you need to do is to run these two Git commands.
Updating all your Git submodules (eg. the Kirby core modules and any extensions added as submodules) to their latest version, all you need to do is to run these few Git commands:

```bash
$ cd your/project/root
$ git submodule foreach --recursive git checkout master
$ git submodule foreach --recursive git pull
$ git submodule foreach git checkout master
$ git submodule foreach git pull
$ git commit -a -m "Update submodules"
$ git submodule update --init --recursive
```

## Usage
Expand Down
10 changes: 6 additions & 4 deletions assets/js/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ Selector = (function($, $field) {
var height = self.size * self.$items.first().height() + (self.size - 1) + 4;

// Apply height and overflow styles to box
self.$field.find('.input-with-items').css({
maxHeight: height,
overflowY: 'scroll'
});
if (self.$items.length > 0) {
self.$field.find('.input-with-items').css({
maxHeight: height,
overflowY: 'scroll'
});
}
};

/**
Expand Down
20 changes: 18 additions & 2 deletions selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Selector
* Kirby Fileselect Field for Kirby 2
*
* @version 1.4.1
* @version 1.4.2
* @author Jonas Döbertin <[email protected]>
* for digital storytelling pioneers <[email protected]>
* @copyright digital storytelling pioneers <[email protected]>
Expand Down Expand Up @@ -334,7 +334,7 @@ public function files()

$files = $files->sortBy($this->sort, ($this->flip) ? 'desc' : 'asc')
->filter(function ($file) use ($field) {
return $field->includeAllFiles() or in_array($file->type(), $field->types);
return $field->includeAllFiles() or in_array($file->type(), $field->types());
});

/**
Expand Down Expand Up @@ -410,4 +410,20 @@ public function isRegExp($string)
{
return !(@preg_match($string, null) === false);
}

/**
* Return type filter array.
*
* FIX: This function is required since we create a new variable containing
* a reference to `$this` to overcome the unavailability of `$this within
* closures in PHP < 5.4.0 by passing this new reference with the "use"
* language construct in the `files()` function.
*
* @since 1.4.2
* @return array
*/
public function types()
{
return $this->types;
}
}

0 comments on commit fb69a8e

Please sign in to comment.