Skip to content

Comments

[4.0] Remove "bootstrap_size" field#18957

Closed
C-Lodder wants to merge 3 commits intojoomla:4.0-devfrom
C-Lodder:bs-size
Closed

[4.0] Remove "bootstrap_size" field#18957
C-Lodder wants to merge 3 commits intojoomla:4.0-devfrom
C-Lodder:bs-size

Conversation

@C-Lodder
Copy link
Member

@C-Lodder C-Lodder commented Dec 2, 2017

Pull Request for Issue #18866

Summary of Changes

This PR removed every reference to the bootstrap_size field for modules

$moduleTag = $params->get('module_tag', 'div');
$headerTag = htmlspecialchars($params->get('header_tag', 'h4'));
$headerClass = htmlspecialchars($params->get('header_class', ''));
$modulePos = $module->position;
Copy link
Contributor

Choose a reason for hiding this comment

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

Align =

$moduleTag = $params->get('module_tag', 'div');
$headerTag = htmlspecialchars($params->get('header_tag', 'h4'));
$headerClass = htmlspecialchars($params->get('header_class', ''));
$modulePos = $module->position;
Copy link
Contributor

Choose a reason for hiding this comment

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

Align =

$headerClass = ($headerClass) ? ' ' . htmlspecialchars($headerClass) : '';

echo '<div class="' . $moduleClass . '">';
echo '<div class="col-md-6">';
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to hardcode that class here? Wasn't the intent to be able to use the module class (suffix) parameter to set a width? If it's done like this, there will be no way to change the width.

Copy link
Member Author

@C-Lodder C-Lodder Dec 2, 2017

Choose a reason for hiding this comment

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

The module class suffix is for styling related classes, which should never be applied to grid related elements.

Incorrect:

.myclass {
  padding: 100px;
  margin: 20px;
  background: #000;
}

<div class="col-md-6 myclass">
</div>

Correct:

.myclass {
  padding: 100px;
  margin: 20px;
  background: #000;
}

<div class="col-md-6">
    <div class="myclass"></div>
</div>

Copy link
Member Author

@C-Lodder C-Lodder Dec 2, 2017

Choose a reason for hiding this comment

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

Our aim to deal with the widths for the cpanel modules will come at a later date (future PR)

Copy link
Contributor

Choose a reason for hiding this comment

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

You don't do any specific for the cpanel modules. You do something for any modules on any position and any templates or it is wrong.
I don't understand why you want to make a difference between grid and design. Both are CSS classes in the end. Btw, you forgot one option in your examples 😄

.myclass > div {
  padding: 100px;
  margin: 20px;
  background: #000;
}

<div class="col-md-6 myclass">
  <div>...</div>
</div>

The problem with the current module suffix code is that it is often applied both by the module chrome and the module itself, making the suffix appear twice and thus breaking a lot of CSS. But that is bad design in the module code, not a problem with the parameter itself 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

I purposely did use the CSS example you provided because the next child element may not be a <div>.

The modules in the FE template don't support the bootstrap widths anymore as the page structure is defined using css-grid.

If you assign 4 modules to the top-a position for example, they will be evenly divided into a 4 column grid. If you want to start adjusting page structures, then you need do this at template level, where it should be done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, stripping it out is fine. Don't get me wrong. But by hardcoding the class col-md-6 into the module chrome, you hardcode that chrome to always use 50% width. That's what I mean which is wrong. The chrome itself shouldn't apply width (grid) related formatting at all by itself.
That chrome isn't necessary restricted to the cpanel. It may for example as well be used by 3rd parties withing their backend if they use own module positions, or the user may apply the chrome to a module in another position.

So what speaks against removing the hardcoded col.md-6 here and add it to the modules that are shown? Or if you don't want to do that in each module, you can always do what we do today and set it in the cpanel layout as default value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Like I said, we'll deal with the module widths more appropriately once we've discussed the best solution internally. Of course I don't want to leave the col-md-6 hardcoded in there

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a PR open for module sizing... #18516

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep I saw that and it uses the module class parameter like I suggested to do here as well. That's why I'm confused.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not using bootstrap opens up some options. With no longer such a tight coupling to the markup we can use the module class field for both styling and layout. The downside been we have to custom write the CSS. We already do so with the likes of #18319.

@N6REJ
Copy link
Contributor

N6REJ commented Dec 2, 2017

removing the param I think is the wrong direction. The whole purpose was to give the user flexibility in sizing the module. Now you've not only removed that ability but forced them into a fixed state. i.e. we're back into 1.5 days.

@brianteeman
Copy link
Contributor

Please read all the comments @N6REJ

@C-Lodder
Copy link
Member Author

C-Lodder commented Dec 2, 2017

@N6REJ The page structure has absolutely no association with Bootstrap. We do NOT use Bootstrap column classes anymore for Cassiopeia. We are utilising CSS Grid which may be a "1.5 days" approach to you, but a 2017 approach to all UI developers

@N6REJ
Copy link
Contributor

N6REJ commented Dec 5, 2017

@C-Lodder you state that put yet you put the column class in!

<div class="col-md-6">
    <div class="myclass"></div>
</div>

I can only go by what you say/show/do.
While the name / function needs to be changed, the PURPOSE of it is valid.
grid does have column size & number ability just like bs does with col- so why not provide that ability EASILY.

@mbabker
Copy link
Contributor

mbabker commented Dec 6, 2017

The UI options are inherently limited without templates putting in their own parameters. Do we offer params mapping to just col-X or do we offer params for col-sm-X, col-md-X, col-lg-X, and col-xl-X as well? What if the UI framework used by the template doesn't use a markup driven grid like Bootstraps? What if its breakpoints don't align with those of Bootstrap (in terms of number and resolution)?

Long and short, the only reliable way to offer these sizing parameters is to continue to use HTML driven grids. Those have issues and limitations that are addressed by the newer CSS Grid implementations and it has been elected to focus on adapting our technology toward newer and preferred trends, not sticking to inherently broken and limited options.

@C-Lodder
Copy link
Member Author

C-Lodder commented Dec 6, 2017

@N6REJ - The backend and frontend templates are 2 completely different things. In the FE template we're using CSS grid for the page structure, whereas in Atum we're still using BS4.

you state that put yet you put the column class in!

As you can see by my actual code changes, I do not use col-md-6 in the Cassiopeia modChrome and clearly state in my comment above that I'm referring to Cassiopeia, not Atum.

@ghost
Copy link

ghost commented Dec 9, 2017

@C-Lodder can you please give Test Instructions in your first Comment so Tester are sure where to look?

@N6REJ
Copy link
Contributor

N6REJ commented Dec 9, 2017

@mbabker I see what you mean. Is there anyway to allow the flexibility of module size param and non-rigid classes also without resorting to forcing the users to create css sizing?

@C-Lodder
Copy link
Member Author

C-Lodder commented Dec 9, 2017

Franz, this is only to remove a parameter. Just a code revoew will do

@mbabker
Copy link
Contributor

mbabker commented Dec 9, 2017

Is there anyway to allow the flexibility of module size param and non-rigid classes also without resorting to forcing the users to create css sizing?

Templates use the existing plugin events to extend the module edit form then use their extended parameters in the module chrome. An option that has always existed so that there isn't a reliance on trying to map a select list offering a mapping to BS2 spanX classes to an inflexible grid system.

@Quy
Copy link
Contributor

Quy commented Dec 9, 2017

@N6REJ
Copy link
Contributor

N6REJ commented Dec 10, 2017

@mbabker

Templates use the existing plugin events to extend the module edit form then use their extended parameters in the module chrome

Anywhere explaining the details / how's of that anywhere?

@C-Lodder
Copy link
Member Author

@Quy done

@dgrammatiko
Copy link
Contributor

@wilsonge merge?

@C-Lodder C-Lodder closed this Feb 2, 2018
@C-Lodder C-Lodder deleted the bs-size branch February 10, 2018 11:55
@htmgarcia
Copy link
Contributor

@wilsonge @brianteeman are we removing the Bootstrap size parameter in modules? With the use of CSS Grid make no sense to keep a setting that is bootstrap related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants