Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beta test: added quick search box for customers, projects and activities #392

Merged
merged 32 commits into from
Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
49bc865
Added basic API endpoints using FOSRestBundle, JMSSerializer and Nelm…
kevinpapst Aug 8, 2018
ddef230
first draft on global activity
kevinpapst Aug 8, 2018
216defb
Merge branch 'master' into global-activity-api
kevinpapst Aug 8, 2018
9846ede
Merge branch 'master' into global-activity-api
kevinpapst Aug 17, 2018
79fd11b
Merge branch 'master' into global-activity-api
kevinpapst Aug 17, 2018
83f0ea9
Merge branch 'master' into global-activity-api
kevinpapst Aug 18, 2018
f06d89d
intermediate state
kevinpapst Aug 31, 2018
13e762c
Merge branch 'master' into global-activity-api
kevinpapst Sep 1, 2018
d8636e1
Merge branch 'master' into global-activity-api
kevinpapst Sep 21, 2018
546fb51
Merge branch 'master' into global-activity-api
kevinpapst Oct 13, 2018
9cbb0d7
Merge branch 'master' into global-activity-api
kevinpapst Oct 30, 2018
a76ea0b
further improvements for global activities
kevinpapst Nov 1, 2018
fa0d700
Merge branch 'master' into global-activity-api
kevinpapst Nov 1, 2018
298c2b3
further global activity improvements
kevinpapst Nov 3, 2018
9df3c85
Merge branch 'master' into global-activity-api
kevinpapst Nov 3, 2018
d2ac04e
fixed migration
kevinpapst Nov 3, 2018
05efb1e
fixed migration
kevinpapst Nov 3, 2018
a9f4198
migration update
kevinpapst Nov 3, 2018
0ac0167
migration update
kevinpapst Nov 3, 2018
fb1d395
added tests
kevinpapst Nov 3, 2018
a2246c2
added validation timesheet tests
kevinpapst Nov 3, 2018
ad14f7d
added further tests
kevinpapst Nov 3, 2018
8648286
improved migrations
kevinpapst Nov 3, 2018
b5795fe
do not allow null for required columns
kevinpapst Nov 3, 2018
ca40e51
fixed timesheet edit form
kevinpapst Nov 4, 2018
b70f060
fixed timesheet edit form
kevinpapst Nov 4, 2018
5674595
code style
kevinpapst Nov 4, 2018
7b347f9
Merge branch 'master' into global-activity-api
kevinpapst Nov 5, 2018
459cf4b
added beta test: selectpicker for searchable input types
kevinpapst Nov 6, 2018
77f6acc
added docu for beta test
kevinpapst Nov 6, 2018
956c477
Merge branch 'master' into search-input
kevinpapst Nov 6, 2018
84bc9be
added links to further docker images by the community
kevinpapst Nov 6, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/packages/kimai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ kimai:
# theme related settings, will be available as twig globals at "kimai_context.*"
# please see documentation at var/docs/theme.md
theme:
# BETA test: If you set this to 'selectpicker' the customer/project/activity select boxes will be transformed
# into a searchable and javascript enhanced input type
select_type: ~
# display a warning color if the user has at least X active recordings
active_warning: 3
# fallback color for all widgets that don't have a dedicated color
Expand Down
5 changes: 5 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ services:
tags:
- { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\FormType }

App\Form\Extension\EnhancedChoiceTypeExtension:
arguments: ["%kimai.theme.select_type%"]
tags:
- { name: form.type_extension, extended_type: Symfony\Bridge\Doctrine\Form\Type\EntityType }

# ================================================================================
# THEME
# ================================================================================
Expand Down
34 changes: 22 additions & 12 deletions src/DependencyInjection/AppExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,47 +35,57 @@ public function load(array $configs, ContainerBuilder $container)

$container->setParameter('kimai.languages', $config['languages']);
$container->setParameter('kimai.calendar', $config['calendar']);
$container->setParameter('kimai.theme', $config['theme']);
$container->setParameter('kimai.dashboard', $config['dashboard']);
$container->setParameter('kimai.widgets', $config['widgets']);
$container->setParameter('kimai.invoice.documents', $config['invoice']['documents']);
$container->setParameter('kimai.defaults', $config['defaults']);

$this->createUserParameter($config, $container);
$this->createTimesheetParameter($config, $container);
$this->createThemeParameter($config['theme'], $container);
$this->createUserParameter($config['user'], $container);
$this->createTimesheetParameter($config['timesheet'], $container);
}

/**
* @param array $config
* @param ContainerBuilder $container
*/
public function createUserParameter(array $config, ContainerBuilder $container)
protected function createThemeParameter(array $config, ContainerBuilder $container)
{
if (!$config['user']['registration']) {
$container->setParameter('kimai.theme', $config);
$container->setParameter('kimai.theme.select_type', $config['select_type']);
}

/**
* @param array $config
* @param ContainerBuilder $container
*/
protected function createUserParameter(array $config, ContainerBuilder $container)
{
if (!$config['registration']) {
$routes = $container->getParameter('admin_lte_theme.routes');
$routes['adminlte_registration'] = null;
$container->setParameter('admin_lte_theme.routes', $routes);
}

if (!$config['user']['password_reset']) {
if (!$config['password_reset']) {
$routes = $container->getParameter('admin_lte_theme.routes');
$routes['adminlte_password_reset'] = null;
$container->setParameter('admin_lte_theme.routes', $routes);
}

$container->setParameter('kimai.fosuser', $config['user']);
$container->setParameter('kimai.fosuser', $config);
}

/**
* @param array $config
* @param ContainerBuilder $container
*/
public function createTimesheetParameter(array $config, ContainerBuilder $container)
protected function createTimesheetParameter(array $config, ContainerBuilder $container)
{
$container->setParameter('kimai.timesheet.rates', $config['timesheet']['rates']);
$container->setParameter('kimai.timesheet.rounding', $config['timesheet']['rounding']);
$container->setParameter('kimai.timesheet.duration_only', $config['timesheet']['duration_only']);
$container->setParameter('kimai.timesheet.markdown', $config['timesheet']['markdown_content']);
$container->setParameter('kimai.timesheet.rates', $config['rates']);
$container->setParameter('kimai.timesheet.rounding', $config['rounding']);
$container->setParameter('kimai.timesheet.duration_only', $config['duration_only']);
$container->setParameter('kimai.timesheet.markdown', $config['markdown_content']);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ protected function getThemeNode()
->scalarNode('box_color')
->defaultValue('green')
->end()
->scalarNode('select_type')
->defaultNull()
->end()
->end()
;

Expand Down
65 changes: 65 additions & 0 deletions src/Form/Extension/EnhancedChoiceTypeExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace App\Form\Extension;

use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;

/**
* Converts normal select boxes into javascript enhanced versions.
*/
class EnhancedChoiceTypeExtension extends AbstractTypeExtension
{
public const TYPE_SELECTPICKER = 'selectpicker';

/**
* @var string|null
*/
protected $type = null;

/**
* @param null|string $type
*/
public function __construct(?string $type)
{
$this->type = $type;
}

/**
* @return string
*/
public function getExtendedType()
{
return EntityType::class;
}

/**
* @param FormView $view
* @param FormInterface $form
* @param array $options
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
if ($this->type !== self::TYPE_SELECTPICKER) {
return;
}

if (!isset($view->vars['attr'])) {
$view->vars['attr'] = [];
}

$view->vars['attr'] = array_merge(
$view->vars['attr'],
['class' => 'selectpicker', 'data-live-search' => true, 'data-width' => '100%']
);
}
}
2 changes: 1 addition & 1 deletion var/docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ They were built by the community, we do not support them - for question please a

- [dysonspherelab](https://hub.docker.com/r/dysonsphere/kimai2/) (for more infos [read this issue](https://github.com/kevinpapst/kimai2/issues/284))
- [felixhummel](https://github.com/felixhummel/kimai-in-docker/tree/kimai2)
- [Haidy777](https://github.com/Haidy777/kimai2/blob/docker/Dockerfile)
- [Haidy777](https://github.com/Haidy777/kimai2/blob/docker/Dockerfile) (for more infos [read this issue](https://github.com/kevinpapst/kimai2/pull/311))
53 changes: 23 additions & 30 deletions var/docs/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ All Kimai specific theme settings will be available in the twig templates with t
{{ kimai_context.box_color }}
```

## Searchable input types

The select boxes for customer, project and activity are by default the OS standard UI elements.
This might be a limit for users with a long list of active and non-hidden elements.

Therefor a test is currently running, which can be activated setting the the following configuration:

```yaml
kimai:
theme:
select_type: selectpicker
```

This will turn the select boxes into javascript elements with quick search option.

Why is this a beta test? It's not clear, if we keep on using this javascript library or activate it by default.
Therefor your feedback is highly welcome, please post your opinion at GitHub.

## Active entries warning

A small colored warning sign will be shown, if a user has more than 3 active timesheet entries.
Expand Down Expand Up @@ -61,39 +79,14 @@ with a pre-defined list of icon aliases to guarantee a consistent look.

The pre-defined icons aliases are:

- `activity`
- `admin`
- `calendar`
- `customer`
- `create`
- `dashboard`
- `delete`
- `download`
- `duration`
- `edit`
- `filter`
- `help`
- `invoice`
- `list`
- `logout`
- `manual`
- `money`
- `print`
- `project`
- `repeat`
- `start`
- `start-small`
- `stop`
- `stop-small`
- `timesheet`
- `trash`
- `user`
- `visibility`
`activity`, `admin`, `calendar`, `customer`, `create`,`dashboard`, `delete`, `download`, `duration`, `edit`, `filter`,
`help`, `invoice`, `list`, `logout`, `manual`, `money`, `print`, `project`, `repeat`, `start`, `start-small`, `stop`,
`stop-small`, `timesheet`, `trash`, `user`, `visibility`

The full list can be found in this [TwigExtension](https://github.com/kevinpapst/kimai2/blob/master/src/Twig/Extensions.php).

Icon aliases can be used by applying the `icon` filter, e.g.

```
<i class="{{ 'money'|icon }}"></i>
```