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

Why yii\grid\ActionColumn use TwitterBootstrap dependent markup #10712

Closed
eresik opened this issue Jan 30, 2016 · 21 comments
Closed

Why yii\grid\ActionColumn use TwitterBootstrap dependent markup #10712

eresik opened this issue Jan 30, 2016 · 21 comments
Labels
status:ready for adoption Feel free to implement this issue. type:enhancement

Comments

@eresik
Copy link

eresik commented Jan 30, 2016

yii\grid\ActionColumn use TwitterBootstrap dependent markup by default.

It's not very good.

It turns out that you are not using the bootstrap, and the module uses ActionColumn, you have to take advantage of dependency injection for that would see the standard actions buttons.

https://github.com/yiisoft/yii2/blob/master/framework/grid/ActionColumn.php#L143
https://github.com/yiisoft/yii2/blob/master/framework/grid/ActionColumn.php#L153
https://github.com/yiisoft/yii2/blob/master/framework/grid/ActionColumn.php#L165

@samdark
Copy link
Member

samdark commented Jan 30, 2016

What do you propose to use instead of it?

@SilverFire
Copy link
Member

I agree that it's not a good thing.
We can create an ActionColumn class in bootstrap extension and define those bootstrap-dependent buttons there.

@samdark
Copy link
Member

samdark commented Jan 30, 2016

@SilverFire OK but what do you propose to use for non-bootstrap buttons then? Also it would likely break existing apps.

@SilverFire SilverFire added this to the 2.1.x milestone Jan 30, 2016
@SilverFire SilverFire added the severity:BC breaking Either breaks backwards compatibility or fixed previously made breakage label Jan 30, 2016
@SilverFire
Copy link
Member

Anyway it's a BC breaking change that goes to 2.1.
Non-bootstrap buttons will look ugly :)

@dynasource
Copy link
Member

moving anything external out of the core software is always a good idea.
If you do it right, why would it break BC?

Why not compare icons with the logic behind translations.
Why not give create a default icon mapping and the user the option to customize/overwrite this "icon-mapping"

@samdark
Copy link
Member

samdark commented Feb 2, 2016

Because in existing apps bootstrap buttons would be replaced with something else on update.

@dynasource
Copy link
Member

it wouldnt if you make the icon mapping dependant on the version of TWBS

@samdark
Copy link
Member

samdark commented Feb 2, 2016

How's that?

@dynasource
Copy link
Member

you define:

  • a core Icon class
  • in every view, for every icon, you call this Icon class
  • based on the 'icon library', you define its root path
  • based on the version of this library, you define the path of the mapping file
  • with every update of the Icon library, you refer to the correct mapping.

@samdark
Copy link
Member

samdark commented Feb 2, 2016

OK. Two questions:

  1. What would it use if there's no bootstrap extension present?
  2. How not to break compatibility to for existing users with bootstrap extension used?

@dynasource
Copy link
Member

  1. if no icon library is used, the base Icon class wont render an Icon
  2. if you use TWBS for existing users
    /web/Icon.php
    /web/Icon::$libraryPath
    /web/Icon::$version
    /web/Icon::render('update')

and then a folder:
/web/icon/twbs/1_0.php
/web/icon/twbs/2_0.php
/web/icon/twbs/3_0.php

With ie. 2_0.php:

return [
'update'=>'glyphicon-ok-2'
]
With ie. 3_0.php:

return [
'update'=>'glyphicon-ok-circle'
]

@samdark
Copy link
Member

samdark commented Feb 2, 2016

How would Icon detect if twbs is installed?

@dynasource
Copy link
Member

well, you provide a default path for the mapping file in Icon, like:
'@vendor/yiisoft/yii2-bootstrap/mapping.php

If the file does not exist, nothing is rendered.

You have to put a default somewhere, as you want to have a default theme anyways.

@samdark
Copy link
Member

samdark commented Feb 2, 2016

So for all existing apps there will be a need to specify additional path else icons will disappear. That's what I call backwards compatibility break.

@dynasource
Copy link
Member

If people update to 2.0.7, they just like now:

  • have a default reference to glyphicons,
  • except this is done centrally customizable in /web/Icon.php by a connector-label, like 'update'
  • if TWBS is installed, the corresponding icon will be shown
  • if not installed, the connectorlabel will be shown
  • if you have your own library, create the mapping file and off you go.

Nobody would have to get any issue.

@samdark
Copy link
Member

samdark commented Feb 2, 2016

Yes, that would solve it.

@samdark samdark added severity:BC breaking Either breaks backwards compatibility or fixed previously made breakage and removed severity:BC breaking Either breaks backwards compatibility or fixed previously made breakage status:under discussion labels Feb 2, 2016
@samdark
Copy link
Member

samdark commented Feb 2, 2016

It's still BC breaking since the way of configuring it would change, right?

@dynasource
Copy link
Member

whether you are a hardcoding it in the view with names like 'glyphicons'
or using a mapping with 'connectors' wont change anything for current users, right?

@samdark
Copy link
Member

samdark commented Feb 2, 2016

Right.

@samdark samdark added status:ready for adoption Feel free to implement this issue. and removed severity:BC breaking Either breaks backwards compatibility or fixed previously made breakage labels Feb 2, 2016
@samdark samdark modified the milestones: 2.0.x, 2.1.x Feb 2, 2016
@dynasource
Copy link
Member

I have a solution ready. Will create a PR next week.

@samdark
Copy link
Member

samdark commented Jun 18, 2019

Won't be changed in 2.0.

@samdark samdark closed this as completed Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:enhancement
Projects
None yet
Development

No branches or pull requests

4 participants