• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

contributte / datagrid / 8685602316

13 Mar 2024 12:24PM UTC coverage: 34.102%. Remained the same
8685602316

push

github

web-flow
[7.x] Next (#1060)

* PHP 8.0

* Translator: switch from ITranslator to Translator (#973)

* [7.x] Bootstrap 5 + PHP 8 + vanilla javascript (#1021)

* Bootstrap 5

* Bootstrap 5 (docs)

* Bootstrap 5

* form-control -> form-select

* Bump bootstrap-select for Bootstrap 5 support

* Removed `input-sm` from Bootstrap 3

See https://getbootstrap.com/docs/4.0/migration/#forms-1

* Bootstrap 5: When selectpicker, replace form-select classes with form-control and refresh it

* Hide `underline` also for `dropdown-item`. And merged into one CSS rule.

* Update the filterMultiSelect initialization

* Text-align: left -> start

Co-authored-by: Radim Vaculík <radim.vaculik@gmail.com>
Co-authored-by: Jaroslav Líbal <jaroslav.libal@neatous.cz>

* [7.x] phpstan-deprecation-rules (#1061)

* Fix sort

* Add method for setting custom Action href, v6.x (#853)

* [7.x] Nextras ORM 4 support, closes #984

* Fix ElasticsearchDataSource.php data source (#1041)

* Error: Typed property Ublaboo\DataGrid\InlineEdit\InlineEdit::$itemID must not be accessed before initialization

* composer: allow-plugins: php-http/discovery

* ItemDetailForm: $httpPost: Typed property must not be accessed...

* phpstan: revert  --memory-limit=4G

* NetteDatabaseSelectionHelper: Context -> Explorer, getSupplementalDriver -> getDriver

* Update README.md

* Templates: fix variables

* data-bs-toggle attribute for multiaction button (#1072)

* dependabot.yml (#1078)

* Allow nette/utils:4.0 (#1077)

* Add onColumnShow and onColumnHide event methods (#1076)

* Add onColumnShow and onColumnHide event methods

* Add native type array

* Removed duplicity

* Return value of BackedEnum when reading Doctrine entity property. (#1081)

* Return value of BackedEnum when reading array value (#1083)

* Added method to check if filter is on default values; Closes #1082 (#1084)

* ublaboo -> contributte (#1067) (#1075)

* Delete depe... (continued)

117 of 435 new or added lines in 54 files covered. (26.9%)

1455 existing lines in 67 files now uncovered.

1124 of 3296 relevant lines covered (34.1%)

0.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.83
/src/Status/Option.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Datagrid\Status;
4

5
use Contributte\Datagrid\Column\Action\Confirmation\CallbackConfirmation;
6
use Contributte\Datagrid\Column\Action\Confirmation\IConfirmation;
7
use Contributte\Datagrid\Column\Action\Confirmation\StringConfirmation;
8
use Contributte\Datagrid\Column\ColumnStatus;
9
use Contributte\Datagrid\Datagrid;
10
use Contributte\Datagrid\Exception\DatagridException;
11
use Contributte\Datagrid\Row;
12

13
class Option
14
{
15

16
        protected ?string $title = null;
17

18
        protected string $class = 'btn-success';
19

20
        protected string $classSecondary = 'btn btn-xs';
21

22
        protected string $classInDropdown = 'ajax dropdown-item';
23

24
        protected ?string $icon = null;
25

26
        protected ?string $iconSecondary = null;
27

28
        protected ?IConfirmation $confirmation = null;
29

30
        public function __construct(private Datagrid $grid, protected ColumnStatus $columnStatus, protected mixed $value, protected string $text)
1✔
31
        {
32
        }
1✔
33

34
        public function getValue(): mixed
35
        {
36
                return $this->value;
1✔
37
        }
38

39
        public function endOption(): ColumnStatus
40
        {
41
                return $this->columnStatus;
1✔
42
        }
43

44
        /**
45
         * @return static
46
         */
47
        public function setTitle(string $title): self
48
        {
49
                $this->title = $title;
×
50

UNCOV
51
                return $this;
×
52
        }
53

54
        public function getTitle(): ?string
55
        {
UNCOV
56
                return $this->title;
×
57
        }
58

59
        /**
60
         * @return static
61
         */
62
        public function setClass(string $class, ?string $classSecondary = null): self
1✔
63
        {
64
                $this->class = $class;
1✔
65

66
                if ($classSecondary !== null) {
1✔
UNCOV
67
                        $this->classSecondary = $classSecondary;
×
68
                }
69

70
                return $this;
1✔
71
        }
72

73
        public function getClass(): ?string
74
        {
UNCOV
75
                return $this->class;
×
76
        }
77

78
        /**
79
         * @return static
80
         */
81
        public function setClassSecondary(string $classSecondary): self
82
        {
UNCOV
83
                $this->classSecondary = $classSecondary;
×
84

UNCOV
85
                return $this;
×
86
        }
87

88
        public function getClassSecondary(): string
89
        {
UNCOV
90
                return $this->classSecondary;
×
91
        }
92

93
        /**
94
         * @return static
95
         */
96
        public function setClassInDropdown(string $classInDropdown): self
97
        {
98
                $this->classInDropdown = $classInDropdown;
×
99

UNCOV
100
                return $this;
×
101
        }
102

103
        public function getClassInDropdown(): string
104
        {
UNCOV
105
                return $this->classInDropdown;
×
106
        }
107

108
        /**
109
         * @return static
110
         */
111
        public function setIcon(string $icon): self
1✔
112
        {
113
                $this->icon = $icon;
1✔
114

115
                return $this;
1✔
116
        }
117

118
        public function getIcon(): ?string
119
        {
UNCOV
120
                return $this->icon;
×
121
        }
122

123
        /**
124
         * @return static
125
         */
126
        public function setIconSecondary(string $iconSecondary): self
127
        {
UNCOV
128
                $this->iconSecondary = $iconSecondary;
×
129

UNCOV
130
                return $this;
×
131
        }
132

133
        public function getIconSecondary(): ?string
134
        {
UNCOV
135
                return $this->iconSecondary;
×
136
        }
137

138
        public function getText(): string
139
        {
UNCOV
140
                return $this->text;
×
141
        }
142

143
        /**
144
         * @return static
145
         */
146
        public function setConfirmation(IConfirmation $confirmation): self
147
        {
UNCOV
148
                $this->confirmation = $confirmation;
×
149

UNCOV
150
                return $this;
×
151
        }
152

153
        public function getConfirmationDialog(Row $row): ?string
154
        {
UNCOV
155
                if ($this->confirmation === null) {
×
UNCOV
156
                        return null;
×
157
                }
158

UNCOV
159
                if ($this->confirmation instanceof CallbackConfirmation) {
×
UNCOV
160
                        return ($this->confirmation->getCallback())($row->getItem());
×
161
                }
162

UNCOV
163
                if ($this->confirmation instanceof StringConfirmation) {
×
UNCOV
164
                        $question = $this->grid->getTranslator()->translate($this->confirmation->getQuestion());
×
165

UNCOV
166
                        if ($this->confirmation->getPlaceholderName() === null) {
×
UNCOV
167
                                return $question;
×
168
                        }
169

UNCOV
170
                        return str_replace(
×
UNCOV
171
                                '%s',
×
UNCOV
172
                                $row->getValue($this->confirmation->getPlaceholderName()),
×
173
                                $question
174
                        );
175
                }
176

NEW
177
                throw new DatagridException('Unsupported confirmation');
×
178
        }
179

180
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc