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

add country flag icons #140

Closed
1letter opened this issue Mar 29, 2021 · 5 comments
Closed

add country flag icons #140

1letter opened this issue Mar 29, 2021 · 5 comments
Labels
04 type: enhancement New feature or request 05 type: question Further information is requested 22 status: in-progress

Comments

@1letter
Copy link
Contributor

1letter commented Mar 29, 2021

@1letter
Copy link
Contributor Author

1letter commented Mar 29, 2021

I have some question of understanding and a need a little bi help.

my goal: register many icon flags in svg format in this package

what i see if i look in the package, e.g. the registering of bootstrap icons, especially the "bookmarks.svg"

in the default profile, there is a registry record for the icon
in the default profile live this record:

  <record name="plone.icon.bookmarks">
    <field type="plone.registry.field.TextLine">
      <title>Bootstrap Icon bookmarks</title>
    </field>
    <value key="resource">++plone++bootstrap-icons/bookmarks.svg</value>
  </record>

in the upgrade profile with id 11 live this record:

  <record name="plone.staticresources.icon.bookmarks">
    <field type="plone.registry.field.TextLine">
      <title>Bootstrap Icon bookmarks</title>
    </field>
    <value key="resource">++plone++static/components/bootstrap-icons/icons/bookmarks.svg</value>
  </record>

that is what i done until now:

  • add new icon resources to components in a separate directory
  • add for all new svg resources a record entry in a default/registry/icons_country_flags.xml

which next steps should i do on my local dev-branch ?

  • add an upgradestep (for all existing plone installations) in upgrades/2xx with the same content of default/registry/icons_country_flags.xml ?
  • is it enough to register records with the name <record name="plone.icon.flag-xyz"> or is a record needed with name <record name="plone.staticresources.icon.flag-xyz"> ?

I hope someone can clarify my questions.

@1letter 1letter added the 05 type: question Further information is requested label Mar 29, 2021
@agitator
Copy link
Member

it should be ++plone++bootstrap-icons/bookmarks.svg as resource url
not sure at the moment why the upgrade profile is different than that.

register the resources, would do it like this

  <plone:static
    directory="static/components/..."
    type="plone"
    name="country-flags"
    />

components directory only has packages that are installed via package.json - have you decided which npm package we will use?

registration should go in to an icons_country_flags.xml

if you look at https://github.com/plone/plone.staticresources/blob/master/src/plone/staticresources/profiles/default/registry/icons_contenttype.xml

  <record name="plone.icon.contenttype">
    <field type="plone.registry.field.TextLine">
      <title>Plone Contenttype</title>
    </field>
    <value key="resource">++plone++bootstrap-icons/file.svg</value>
  </record>

  <record name="plone.icon.contenttype/event">
    <field type="plone.registry.field.TextLine">
      <title>Plone Event</title>
    </field>
    <value key="resource">++plone++bootstrap-icons/calendar-event.svg</value>
  </record>

The /in the name allows the resolver to fall back to a default icon if a specific icon does not exist.
So the flags can be registered with a name like name="plone.icon.flag/de"

Upgrade step will be needed for all changes to the icons.

I won't have much more time today but will be around tomorrow for the sprint.

@1letter
Copy link
Contributor Author

1letter commented Mar 30, 2021

I have a locally a working branch with svg files. 4 packages are involved. i have to clean it up.

@1letter
Copy link
Contributor Author

1letter commented Apr 7, 2021

I would add a npm package via yarn. What i did in the plone.staticresources root folder:

> yarn add svg-country-flags
yarn add v1.22.5
[1/4] Resolving packages...
warning Resolution field "backbone@1.1.2" is incompatible with requested version "backbone@~0.9.2"
warning Resolution field "underscore@1.9.1" is incompatible with requested version "underscore@1.3.3"
warning Resolution field "jquery@3.5.1" is incompatible with requested version "jquery@3.5.0"
[2/4] Fetching packages...
error https://github.com/DataTables/Dist-DataTables.git: Extracting tar content of undefined failed, the file appears to be corrupt: "Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

What i did wrong?

@petschki
Copy link
Member

petschki commented Jun 2, 2022

svg flags got merged

@petschki petschki closed this as completed Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
04 type: enhancement New feature or request 05 type: question Further information is requested 22 status: in-progress
Projects
None yet
Development

No branches or pull requests

3 participants