Ignore:
Timestamp:
Jun 3, 2010, 3:13:32 PM (14 years ago)
Author:
roberth
Message:

Fixed IE7 issues with studies and publications, including bug #85

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/study/show.gsp

    r497 r522  
    116116
    117117                // Add a title to the bandinfo
    118                 <% sortedGroupSubjects = eventGroup.subjects.sort( { a, b -> a.name <=> b.name } as Comparator )  %>
     118                <%
     119                  sortedGroupSubjects = eventGroup.subjects.sort( { a, b -> a.name <=> b.name } as Comparator );
     120                  def simpleSubjects = sortedGroupSubjects.name.join( ', ' );
     121
     122                  // We can only show appr. 30 characters per line and as many lines as there are events
     123                  def charsPerLine = 30;
     124                  def numEvents = eventGroup.events.size();
     125                  def maxChars = numEvents * charsPerLine;
     126
     127                  // If the subjects will fit, show them all
     128                  if( simpleSubjects.size() < maxChars ) {
     129                    showSubjects = simpleSubjects;
     130                  } else {
     131                    // Always add the first name
     132                    def subjectNames = sortedGroupSubjects[0]?.name;
     133
     134                    // Continue adding names until the length is to long
     135                    id = 0;
     136                    sortedGroupSubjects.each { subject ->
     137                      if( id > 0 ) {
     138                        println( "ID: " + id + " - " + subjectNames.size() + " - " + subject.name.size() + " - " + maxChars );
     139                        if( subjectNames.size() + subject.name.size() < maxChars - 15 ) {
     140                          subjectNames += ", " + subject.name;
     141                        } else {
     142                          return;
     143                        }
     144                      }
     145                      id++;
     146                    }
     147
     148                    // Add a postfix
     149                    subjectNames += " and " + ( sortedGroupSubjects.size() - id ) + " more";
     150
     151                    showSubjects = subjectNames;
     152                  }
     153
     154
     155                %>
    119156                bandTitleInfo[ timelineNr ][ ${bandNr} ] = {
    120157                  title: "${eventGroup.name}",
    121                   subjects: "${sortedGroupSubjects.name.join( ', ' )}"
     158                  subjects: "${showSubjects}"
    122159                };
    123160
Note: See TracChangeset for help on using the changeset viewer.