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

Tab support for admin / content edit #3626

Merged
merged 10 commits into from
May 27, 2019
Merged

Conversation

deanmarcussen
Copy link
Member

This adds support for Tabs in the Admin - adapted from O1

Covers issues from SEO module #3214 , and also wanted for Sitemaps #3229, and original issue #1822

Validation remains outside the tabs

example-tabs

I also tweaked the CodeMirror sass to fix #3625

I included the content item id in the tab-pane id, to allow for multiple tab-groups to be rendered if this gets reused to move anything else into tabs (personally I'd love to see the different content localizations in tabs so you could flick between them when editing, but that's a whole nother piece of work!)

Styling is an extension of bootstrap tabs, so works with rtl.

In the example image above I've just used a placement.json file in the admin theme to move the TitlePart to create the second tab. As per O1 if there are no tabs the editor does not display the tab dialog, or wrap the content in a border.

Test placement.json file

{
  "TitlePart_Edit": [
    {
      "place": "Parts#Seo:0"
    }
  ]
}

Note : Not sure about the use of the localized string checks that I bought over from O1. Might make more sense to just wrap @tabname in a T(@tabName) - open to suggestions :)

@sebastienros
Copy link
Member

We need a way to expose metadata in a file to describe new localized entries.
@lukaskabrt an idea about how we could do that? I am think of a custom extension to define strings that are localized, and their context. Even if it's in the standard pot format.

@lukaskabrt
Copy link
Contributor

I think this is quite similar to the dynamic content localization described in #3607.

My idea is to define a provider, that return all localizable strings from the specific feature. We can call these providers at runtime and export all strings to a POT file. User provides translated PO files and either deploy them alongside other PO files or we might add another ITranslationProvider and let users import translation to the database. For rendering localizable strings we can use IStringLocalizer. I think it fits nicely into the existing infrastructure.

public class LocalizableString {
    public string Text { get; set; }
    public string Context { get; set; }
}

public interface ILocalizableStringProvider {
    IEnumerable<LocalizableString> Get();
}

There might be several providers e.g.

public class ZonesLocalizableStringProvider : ILocalizableStringProvider {
    // load all zone names
}

public class ContentDefinitionLocalizableStringProvider : ILocalizableStringProvider {
    // load all content type names and filed names
}

@scleaver
Copy link
Contributor

Thanks for this @deanmarcussen

@deanmarcussen
Copy link
Member Author

@sebastienros Not particularly responsive! Bootstrap nav-tabs just flex-wrap by default.

I've made them flex-column at sm so looks like this
tabs-column

They could go into a collapse if there were a lot of them (> 5) perhaps

Note - should do something with the actions buttons at sm as well!

# Conflicts:
#	src/OrchardCore.Themes/TheAdmin/wwwroot/Styles/TheAdmin.css
#	src/OrchardCore.Themes/TheAdmin/wwwroot/Styles/TheAdmin.min.css
@deanmarcussen
Copy link
Member Author

@sebastienros What would you like me to do with this, regarding localization?

Remove references to LocalizedString until metadata localization is resolved and add support for localization later, or just leave this on hold and return to after more localization?

@sebastienros
Copy link
Member

Don't localize any dynamic value until we have solved it.

@sebastienros sebastienros merged commit 3a4333d into OrchardCMS:dev May 27, 2019
@deanmarcussen deanmarcussen deleted the tabs branch July 7, 2019 14:33
scleaver pushed a commit to scleaver/OrchardCore that referenced this pull request Aug 22, 2019
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.

Codemirror border should use normal admin grey
4 participants