Changeset 32742


Ignore:
Timestamp:
Mar 3, 2022, 3:51:12 PM (2 years ago)
Author:
plg
Message:

handle long notes: only display the first letters. Could be improved with a pure CSS solution.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AddUsersNotes/js/usersnotes.js

    r32697 r32742  
    3636    pop_in.find('.user-property-last-visit').html(get_formatted_date(user_to_edit.last_visit));
    3737    pop_in.find('.user-property-last-visit').tipTip({content: `${last_visit_str}<br />${user_to_edit.last_visit_since}`});
    38         pop_in.find('.usernotes-title').html(user_to_edit.usernotes);
     38
     39    var usernotes_to_display = user_to_edit.usernotes ? user_to_edit.usernotes : '';
     40    if (usernotes_to_display.length > 70) {
     41        usernotes_to_display = usernotes_to_display.substring(0, 70) + '<span title="' + user_to_edit.usernotes + '">...</span>'
     42    }
     43        pop_in.find('.usernotes-title').html(usernotes_to_display);
    3944        pop_in.find('.user-property-usernotes-change input').val(user_to_edit.usernotes);
    4045}
     
    96101                if (last_user_index != -1) {
    97102                    current_users[last_user_index].usernotes = data.result.users[0].usernotes;
    98                     $('#UserList .user-property-usernotes .usernotes-title').html(current_users[last_user_index].usernotes);
     103                    usernotes_to_display = current_users[last_user_index].usernotes ? current_users[last_user_index].usernotes : '';
     104                    if (usernotes_to_display.length > 70) {
     105                        usernotes_to_display = usernotes_to_display.substring(0, 70) + '<span title="' + current_users[last_user_index].usernotes + '">...</span>';
     106                    }
     107                    $('#UserList .user-property-usernotes .usernotes-title').html(usernotes_to_display);
    99108                    fill_container_user_info($('#user-table-content .user-container').eq(last_user_index), last_user_index);
    100109                }
Note: See TracChangeset for help on using the changeset viewer.