What is content_type.js? This is javascript for the node content editing form. Now it contains one behavior for setting summaries on content type form (display selected options in side vertical tabs):
Demonstration work content_type script

Problem/Motivation

Looks like content_type.js is a small file with a big potential for improvement:

  1. A different way to collect selected options in different tabs. Example:
    // '#edit-workflow'
    $(context).find('input[name^="options"]:checked').parent().each(...
    // '#edit-language'
    $('input:checked', context).next('label').each(...
    

    This led to the following issues:

    In #2849100-10: Spaces shown before commas in publishing options contains a patch with one of the possible approaches to make processing more universal. But in #2849100-15: Spaces shown before commas in publishing options different point, because #edit-submission has only title, and it can be simplified. But there is no guarantee that in the future this tab will not have more options. In short, everything is complicated :)

    In addition to an extra space, this also leads to other hidden problems, like #2086981: "Publishing options" vertical tab summary includes #description. Yes, this can not reproduce for Bartik, but can reproduce for Seven on Content Type page :)

  2. By the way, it seems oddly that in Bartik script works on Create Page too, while in Seven it is works only on Content Type.
  3. Script use tag names, like input, label:
    $editContext.find('input:checked').next('label').each(function () {
    but the drupal standard assumes the use of data-* attributes. See #2849100-66: Spaces shown before commas in publishing options.

    Also, maybe the script can avoid some id selectors. See #2346799: Replace #ID selectors for data-drupal-selector attribute.

  4. Heterogeneous syntax. Watch the context:
    $context.find('#edit-submission').drupalSetSummary(function (context) {
    ...
    $(context).find('#edit-title-label').val()
    ...
    $('#edit-language', context).drupalSetSummary(function (context) {
    ...
    $editContext.find('input:checked').next('label').each(function () {
    
  5. Tests, of course :) We have already a ton of tests in #2849100: Spaces shown before commas in publishing options. But it is not easy to create the ideal solution and not go beyond the scope of the "extra space" problem :)
  6. Your points here.
  7. Proposed resolution

    Find the right way and implement it.

    Remaining tasks

    Improve it as much as possible.

    User interface changes

    API changes

    Data model changes

CommentFileSizeAuthor
content_type_demonstration.png25.74 KBAnonymous (not verified)

Comments

Anonymous’s picture

vaplas created an issue. See original summary.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +stale-issue-cleanup

Thank you for creating this issue to improve Drupal.

We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

Thanks!

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

smustgrave’s picture

Component: javascript » node system
Status: Postponed (maintainer needs more info) » Active

Never seen this file. Think it's been under the wrong component.

Not entirely sure what's to be done (maybe nothing?) lets put back for other thoughts though.

acbramley’s picture

Status: Active » Postponed (maintainer needs more info)

The file is 75 lines of JS just for an admin form, I don't really feel strongly about refactoring this for big improvements tbh.

This was also created ~9 years ago so things have shifted a bit since. I'm inclined to close this since the original author doesn't exist anymore and there's been no further action but will set to PMNMI for now.