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

Fix #14: Use ul and li tags for the default layout of the ListView #210

Merged
merged 14 commits into from
Sep 9, 2024

Conversation

glpzzz
Copy link
Contributor

@glpzzz glpzzz commented Sep 7, 2024

Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️

As per commented on #14, ul and li tags are used for the default layout of the ListView.

Copy link

codecov bot commented Sep 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.07%. Comparing base (1fb609b) to head (44cd130).
Report is 22 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #210      +/-   ##
============================================
+ Coverage     64.66%   68.07%   +3.41%     
- Complexity      558      569      +11     
============================================
  Files            46       45       -1     
  Lines          1862     1848      -14     
============================================
+ Hits           1204     1258      +54     
+ Misses          658      590      -68     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@glpzzz
Copy link
Contributor Author

glpzzz commented Sep 7, 2024

Are the missing quotes a desired thing on

This expected output for the test is the result of rendering https://github.com/yiisoft/yii-dataview/blob/848da41ead3407cea7a3647e8db66058d9a33708/tests/Support/view/_listviewparams.php which don't have the quotes.

@glpzzz glpzzz marked this pull request as draft September 7, 2024 05:59
@glpzzz
Copy link
Contributor Author

glpzzz commented Sep 7, 2024

WIP: Need to make the LI tag also configurable for the renderItem() method

@@ -76,12 +80,14 @@ public function testItemViewAsString(): void
Assert::equalsWithoutLE(
<<<HTML
<div>
<div>
<ul>
<li>
<div>Id: 1</div><div>Name: John</div><div>Age: 20</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think <span> is more suitable here considering <li>.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to separate items somehow. With div is break line.

src/ListView.php Outdated
}

return Div::tag()
return Li::tag()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Item tag should be customizeable also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm working on it

@glpzzz glpzzz marked this pull request as ready for review September 7, 2024 16:12
@glpzzz
Copy link
Contributor Author

glpzzz commented Sep 7, 2024

@samdark @vjik what do you think about allowing ListView::itemViewAttributes() to also accept a Closure so the li (or other item tag) could be customized according to the specific item?

@samdark
Copy link
Member

samdark commented Sep 7, 2024

@glpzzz sounds like a good idea.

@vjik
Copy link
Member

vjik commented Sep 8, 2024

@samdark @vjik what do you think about allowing ListView::itemViewAttributes() to also accept a Closure so the li (or other item tag) could be customized according to the specific item?

I agree with @samdark. See as example:

private function prepareBodyAttributes(array $attributes, DataContext $context): array

Suggest implement it in separate PR only.

src/ListView.php Outdated Show resolved Hide resolved
Tests also modified. The extra \n is not a problem and expected.
@samdark samdark changed the title Use ul and li tags for the default layout of the ListView. Fix #14: Use ul and li tags for the default layout of the ListView Sep 9, 2024
@samdark samdark merged commit b504e0c into yiisoft:master Sep 9, 2024
17 checks passed
@samdark
Copy link
Member

samdark commented Sep 9, 2024

👍

@glpzzz glpzzz deleted the 14-listview-and-semantics branch September 9, 2024 18:30
@glpzzz glpzzz restored the 14-listview-and-semantics branch September 9, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants