Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
C
CoopStarter Front
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 3
    • Merge Requests 3
  • Packages
    • Packages
    • Container Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • Startin blox
    • A
      applications
  • Coop Starter
  • CoopStarter Front
  • Issues
  • #138

Closed
Open
Opened Jan 28, 2020 by Poggioli@Alice-P
  • Report abuse
Report abuse

A awful mistake from a awful junior

This function looks useless in coopstarter.js. We sould remove it and the 'locahost' it contains..

function InitManagementForType() {
  var forms = document.querySelectorAll(".resource_by_step");

  forms.forEach(form => {
    form.addEventListener(
      "populate",
      e => {
        window.setTimeout(() => {
          let type_hidden_field = form.querySelectorAll('select[name="type"]');
          type_hidden_field.forEach(function(select_hidden) {
            options_hidden = select_hidden.getElementsByTagName("option");
            for (let option_hidden of options_hidden) {
              option_hidden.removeAttribute("selected");
              if (option_hidden.value == '{"@id": "http://localhost:8000/types/1/"}') {
                //Actually selecting the option if it is the good one
                option_hidden.setAttribute("selected", "selected");
                select_hidden.setAttribute("value", option_hidden.value);
              }
            }
           //Trigerring a reload of the associated form
      let parent_form = select_hidden.closest("sib-form");
      parent_form.component.inputChange();
      refreshPagination();
          });
        });
      },
      3000
    );
  });
}
Edited Jan 28, 2020 by Poggioli
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
1
Labels
P3
Assign labels
  • View project labels
Reference: startinblox/applications/coop-starter/coopstarter-front#138