Index: lams_learning/web/discussion/learner.jsp =================================================================== diff -u -r4f526e3455fe0ed91e6a838c833f1cd916844b98 -r0d458a161ee50dd2db8283520b80b5cc559705bf --- lams_learning/web/discussion/learner.jsp (.../learner.jsp) (revision 4f526e3455fe0ed91e6a838c833f1cd916844b98) +++ lams_learning/web/discussion/learner.jsp (.../learner.jsp) (revision 0d458a161ee50dd2db8283520b80b5cc559705bf) @@ -11,8 +11,8 @@ width: 40px; } - /* Underlining the link in title does not look nice*/ #discussion-sentiment-widget .panel-title a { + /* Underlining the link in title does not look nice*/ text-decoration: none !important; } @@ -22,6 +22,7 @@ } #discussion-sentiment-widget th { + /* Table headers feels better this way */ text-align: center; font-weight: bold; font-style: normal; @@ -39,6 +40,19 @@ $('#discussion-sentiment-widget-content').data('remove', true).collapse('hide'); } + function selectDiscussionSentimentOption(selectedOption) { + // clear other cells + var widget = $('#discussion-sentiment-widget'); + $('td', widget).removeClass('selected warning success'); + + if (!selectedOption) { + return; + } + // highlight the successfuly selected cell + var selectedCell = $('#discussion-sentiment-widget-option-cell-' + selectedOption, widget).addClass('selected'); + selectedCell.addClass(selectedCell.hasClass('discussion-sentiment-widget-option-stay') ? 'warning' : 'success'); + } + $(document).ready(function(){ let discussionSentimentWidget = $('#discussion-sentiment-widget'), discussionSentimentContent = $('#discussion-sentiment-widget-content', discussionSentimentWidget) @@ -94,17 +108,16 @@ stopDiscussionSentimentLearnerWidget(); } if (response == 'voted') { - // highlight the successfuly selected cell - $('#discussion-sentiment-widget td').removeClass('selected warning success'); - selectedCell.addClass('selected') - .addClass(selectedCell.hasClass('discussion-sentiment-widget-option-stay') ? 'warning' : 'success'); + selectDiscussionSentimentOption(selectedOption); } }, error : function(){ stopDiscussionSentimentLearnerWidget(); } }); }); + + selectDiscussionSentimentOption('${param.selectedOption}'); }); @@ -133,14 +146,14 @@ - <%-- Stay options start from 1, Move options start from 11 --%> - - +