onozaty / redmine-view-customize-scripts

Code examples for "Redmine View Customize Plugin"
https://github.com/onozaty/redmine-view-customize
111 stars 26 forks source link

select2 #151

Closed ashrafalzyoud closed 3 days ago

ashrafalzyoud commented 3 days ago

i configure that code its work perfect im using this plugin to search inside box https://github.com/redmica/redmica_ui_extension

i note any field have many value and using select2 after my code the page redirect and go down or up if u can help why or modify where the problem

$(function() {
function createManualThreeColumnContentDiv(leftSelectors, centerSelectors, rightSelectors, title) {
  var contentLeft = $('<div class="splitcontentleft">');
  var contentCenter = $('<div class="splitcontentcenter">');
  var contentRight = $('<div class="splitcontentright">');

  function appendStyledAttribute(container, selector) {
    const element = $(selector).parent();
    if (element.length) {
      element.addClass('attribute-card');
      container.append(element);
    }
  }

  leftSelectors.forEach(selector => appendStyledAttribute(contentLeft, selector));
  centerSelectors.forEach(selector => appendStyledAttribute(contentCenter, selector));
  rightSelectors.forEach(selector => appendStyledAttribute(contentRight, selector));

  var content = $('<div class="three-column-layout">')
    .append(contentLeft)
    .append(contentCenter)
    .append(contentRight);

  return $('<div>').append($('<h10>').text(title)).append(content);
}
 var budgetContentID = createManualThreeColumnContentDiv(
    ['#issue_custom_field_values_249', '#issue_custom_field_values_67'], // Left Column
    ['#issue_custom_field_values_464', '#issue_custom_field_values_539'], // Center Column
    ['#issue_custom_field_values_371', '#issue_custom_field_values_394', '#issue_custom_field_values_66'], // Right Column
    'معلومات بند الموازنة'
  );

  // Define the content for decisions
  var decisionContentID = createManualThreeColumnContentDiv(
    ['#issue_custom_field_values_10', '#issue_custom_field_values_87'], // Left Column
    ['#issue_custom_field_values_92', '#issue_custom_field_values_227'], // Center Column
    ['#issue_custom_field_values_403', '#issue_custom_field_values_7', '#issue_custom_field_values_8'], // Right Column
    'معلومات القرار'
  );
    var notesContentID = createManualThreeColumnContentDiv(
        ['#issue_custom_field_values_230', '#issue_custom_field_values_273', '#issue_custom_field_values_275'], // Left Column
        ['#issue_custom_field_values_291', '#issue_custom_field_values_276'], // Center Column
        ['#issue_custom_field_values_229', '#issue_custom_field_values_267', '#issue_custom_field_values_274'], // Right Column
        'ملاحظات'
    );

  // Append content to the desired container
    $('div#attributes').append(decisionContentID).append(budgetContentID).append(notesContentID);
});