8000 Refactor media shapes and correct formatting in views by deanmarcussen · Pull Request #6676 · OrchardCMS/OrchardCore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactor media shapes and correct formatting in views #6676

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

Merged
merged 2 commits into from
Jul 22, 2020

Conversation

deanmarcussen
Copy link
Member

Fixes issues with #6172

/cc @PiemP

Copy link
Member Author
@deanmarcussen deanmarcussen left a comment

Choose a reason for hiding this comment

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

@PiemP some clean up (I should have caught it better on the review)

You just need to be careful when you are reformatting views as well.

I find it helps to look at the files changed in github here after submitting them, and then when you see you have added something that is unecesary it is easier to remove.

@@ -38,7 +37,6 @@
using OrchardCore.Media.Shortcodes;
using OrchardCore.Media.Services;
using OrchardCore.Media.Settings;
using OrchardCore.Media.Shape;
Copy link
Member Author

Choose a reason for hiding this comment

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

removed extra usings added for no need


<script asp-src="~/OrchardCore.Media/Scripts/media.js" asp-name="media" at="Foot" depends-on="admin, vuejs, sortable, vuedraggable"></script>
<style asp-src="~/OrchardCore.Media/Styles/media.min.css" debug-src="~/OrchardCore.Media/Styles/media.css"></style>
Copy link
Member Author

Choose a reason for hiding this comment

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

returned this to the view it belongs to.
the resource manager handles multiple script inclusions by design, so you don't need to add a wrapper to get this on the page only once.

@@ -3,54 +3,52 @@
@using OrchardCore.ContentManagement.Metadata.Models

@{
var settings = Model.PartFieldDefinition.GetSettings<MediaFieldSettings>();
var settings = Model.PartFieldDefinition.GetSettings<MediaFieldSettings>();
Copy link
Member Author

Choose a reason for hiding this comment

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

returned all the formatting in this view to good styling

@@ -0,0 +1,12 @@
@if (!Context.Items.ContainsKey("MediaFieldEditLocalization"))
{
@* Insert only once per request *@
Copy link
Member Author

Choose a reason for hiding this comment

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

this was all you needed to do to resolve the issue with multiple ids in the dom.

We use the shapes technique in the other modules, so that the media feature can be disabled, and the shapes will not load a modal for the media app (which is disabled)

What you did here was add a shape wrapper in the media module, which required that the media module was active (so was unecesary)

@PiemP
Copy link
Contributor
PiemP commented Jul 15, 2020

understand... thanks @deanmarcussen... more easy to do than to explain

@sebastienros
Copy link
Member

Thanks. So we didn't need custom shapes, my assumptions were right?

@deanmarcussen
Copy link
Member Author

Thanks. So we didn't need custom shapes, my assumptions were right?

Yes, the assumptions are correct.

We still need all the shape wrappers for the HtmlField as they are used to prevent the HtmlField / HtmlBody adding a wrapper if the Media feature is disabled. So as no to depend on the Media feature, and require it, in order to have an HtmlField (at least this is my assumption).

That being said, it would be good to rationalize some of these models / trumbowyg scripts at some point, when I have time, as there is much duplicate code between them, creating confusion, and extra checks in scripts, for no particular need.

Using the wrappers there also defeats the purpose of being able to easily add an editor more, because you also need to add a shape wrapper to make it work. There is probably a simpler way, but for another pr

@agriffard agriffard merged commit 04235e8 into dev Jul 22, 2020
@delete-merged-branch delete-merged-branch bot deleted the deanmarcussen/media-refactor branch July 22, 2020 11:04
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.

4 participants
0