mardi 27 octobre 2020

Conditional statement in Ruby on Rails

I'm working on Jira integration in my project. I wanted to add a condition to check if project_id is generated from the valid user account (same user account). If it is generated from valid user account then show the message Jira integration is successfulotherwise Jira integration is not successful.

This is the code that I'm using.

Jira.prototype.setJiraProject = function(projects) {
    var projectField = $("#project_id"),
      projectID = $("#project_id").val();
    projectField.find('option[data-type=jira-int]').remove();
    projects.map(function(el){
      if (projectID != el[0])
        projectField.append($('<option>', { 'data-type': 'jira-int', value: el[0], text: el[1]}));
    });
    projectField.attr('disabled', false).focus();
    showError('Jira integration is successful.', 'success');
  };

Is there anyway possible to achieve it?

Aucun commentaire:

Enregistrer un commentaire