Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-29699

Space List Macro Category Picker vanishes if a category returns no results

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      User loses access to the category picker forever more once they select a category that returns no results (or at least until the category gets some updates).

      How to Reproduce
      From the Dashboard, click the Space Category tab and select a category with no updates from the Category Picker.

      Workaround
      Adding this javascript to your sites Custom HTML simply extends the code that lists the category updates. If there are no results the code ensures that the user still gets access to the category picker...

      Custom HTML - Confluence 4.3
      <script>
      // Workaround bug CONF-29699 - Confluence 4
        Confluence.Templates.Dashboard.Updates.updates_old = Confluence.Templates.Dashboard.Updates.updates;
        Confluence.Templates.Dashboard.Updates.updates = function(opt_data, opt_sb) {
          var output = Confluence.Templates.Dashboard.Updates.updates_old(opt_data, opt_sb);
          if (opt_data.changeSets.length == 0 && opt_data.selectedTab == 'team') {
            var output_old = output;
            output = opt_sb || new soy.StringBuilder();
            if (opt_data.viewableCategories.length > 0) {
              output.append('<div class="team-selection"><label for="updatesSelectedCategory">', soy.$$escapeHtml("Select:"), '</label><select id="updatesSelectedCategory" name="updatesSelectedTeam">');
              var categoryLabelList123 = opt_data.viewableCategories;
              var categoryLabelListLen123 = categoryLabelList123.length;
              for (var categoryLabelIndex123 = 0; categoryLabelIndex123 < categoryLabelListLen123; categoryLabelIndex123++) {
                var categoryLabelData123 = categoryLabelList123[categoryLabelIndex123];
                output.append('<option value="', soy.$$escapeHtml(categoryLabelData123.name), '" ', (categoryLabelData123.name == opt_data.selectedCategory) ? 'selected' : '', '>', soy.$$escapeHtml(categoryLabelData123.capitalised), '</option>');
              }
              output.append('</select></div>');
            } else {
              output.append('<div class="loading-container"><div class="loading-text">', soy.$$escapeHtml("No categories have been created yet. A category is used to group together a list of spaces. A space or site administrator is required to set up this type of category. This can be done in the edit space labels page under space administration."), '</div></div>');
            }
            output.append(output_old.toString());
          }
          return opt_sb ? '' : output.toString();
        }
      </script>
      
      Custom HTML - Confluence 5.1
      <script>
      // Workaround bug CONF-29699 - Confluence 5
        Confluence.Templates.Dashboard.Updates.updates_old = Confluence.Templates.Dashboard.Updates.updates;
        Confluence.Templates.Dashboard.Updates.updates = function(opt_data, opt_sb) {
          var output = Confluence.Templates.Dashboard.Updates.updates_old(opt_data, opt_sb);
          if (opt_data.changeSets.length == 0 && opt_data.selectedTab == 'team') {
            var output_old = output;
            output = opt_sb || new soy.StringBuilder();
            if (opt_data.viewableCategories.length > 0) {
              output.append('<div class="team-selection"><form class="aui"><label for="updatesSelectedCategory">', soy.$$escapeHtml("Select:"), '</label><select id="updatesSelectedCategory" name="updatesSelectedTeam" class="select">');
              var categoryLabelList123 = opt_data.viewableCategories;
              var categoryLabelListLen123 = categoryLabelList123.length;
              for (var categoryLabelIndex123 = 0; categoryLabelIndex123 < categoryLabelListLen123; categoryLabelIndex123++) {
                var categoryLabelData123 = categoryLabelList123[categoryLabelIndex123];
                output.append('<option value="', soy.$$escapeHtml(categoryLabelData123.name), '" ', (categoryLabelData123.name == opt_data.selectedCategory) ? 'selected' : '', '>', soy.$$escapeHtml(categoryLabelData123.capitalised), '</option>');
              }
              output.append('</select></form></div>');
            } else {
              output.append('<div class="loading-container"><div class="loading-text">', soy.$$escapeHtml("No categories have been created yet. A category is used to group together a list of spaces. A space or site administrator is required to set up this type of category. This can be done in the edit space labels page under space administration."), '</div></div>');
            }
            output.append(output_old.toString());
          }
          return opt_sb ? '' : output.toString();
        }
      </script>
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              acd7da918ec6 Sam Hall
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: