From 180b5f14dc40eb79a6af0dda172530424d477d10 Mon Sep 17 00:00:00 2001 From: giangnt Date: Fri, 19 Jul 2013 12:02:20 +0700 Subject: [PATCH 1/7] UI-2818 Featured Poll - Incorrect UI and behavior --- .../src/main/webapp/skin/exo-gadget/gadget-common.css | 2 +- .../gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/gadgets-sample/exo-gadget-resources/src/main/webapp/skin/exo-gadget/gadget-common.css b/samples/gadgets-sample/exo-gadget-resources/src/main/webapp/skin/exo-gadget/gadget-common.css index 58811aa5c4..aa420ef001 100644 --- a/samples/gadgets-sample/exo-gadget-resources/src/main/webapp/skin/exo-gadget/gadget-common.css +++ b/samples/gadgets-sample/exo-gadget-resources/src/main/webapp/skin/exo-gadget/gadget-common.css @@ -66,7 +66,7 @@ img { } .light_message { - color: #333; + color: #999999; } .UIGadgetThemes .IconDropDown { diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less index a406f5f01f..35fa63a2c5 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less +++ b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less @@ -69,6 +69,7 @@ } .horizontalBG{ + min-width: 50px; height: 10px; border-radius: 5px; background-image: linear-gradient(to bottom, #d3d3d3, #eaeaea); From 66acca4c461708f3f489c983d5371f81a2e078a3 Mon Sep 17 00:00:00 2001 From: Son Dang Ngoc Date: Wed, 24 Jul 2013 11:39:35 +0700 Subject: [PATCH 2/7] PLF-5069: PLF-5292(CLONE) Featured Poll - Incorrect UI and behavior --- .../main/webapp/gadgets/FeaturedPoll/Poll.xml | 77 ++-- .../gadgets/FeaturedPoll/script/poll.js | 372 +++++++++--------- 2 files changed, 224 insertions(+), 225 deletions(-) diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml index 3612cf1089..ff71e9e104 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml @@ -1,16 +1,14 @@ - - - - - - - - + + + + + + + + + @@ -26,33 +24,32 @@ - - + + + - - - - - - - - - -
-
- __MSG_title__ - -
- -
-
-
-
-
-
- ]]> -
-
+ + + + + + + + +
+
+ __MSG_title__ + +
+ +
+
+
+
+
+
+ ]]> + + \ No newline at end of file diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js index 6963b8c8e3..de179baf40 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js @@ -1,208 +1,210 @@ function init() { - - createPollDiv(); - // Adding eXo Platform container information - var opts = {}; - opts[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [ - "portalName", - "restContext", - "host"]; - var req = opensocial.newDataRequest(); - req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER, opts), 'viewer'); - req.send(createURL); - $('.settingBt').click(function(){ - config(); - }); + createPollDiv(); + // Adding eXo Platform container information + var opts = {}; + opts[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = ["portalName", "restContext", "host" ]; + var req = opensocial.newDataRequest(); + req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER, opts), 'viewer'); + req.send(createURL); + $('.settingBt').click(function() { + config(); + }); } function createPollDiv() { - var prefs = new gadgets.Prefs(); - var forumURL = window.location.protocol + "//" + window.location.host + parent.parent.eXo.env.portal.context + "/"+ parent.parent.eXo.env.portal.portalName +"/forum"; - adjustHeight(); + var prefs = new gadgets.Prefs(); + var forumURL = window.location.protocol + "//" + window.location.host + parent.parent.eXo.env.portal.context + "/" + parent.parent.eXo.env.portal.portalName + "/forum"; + adjustHeight(); } function createURL(data) { - this.viewer = data.get('viewer').getData(); - var hostName = viewer.getField('hostName'); - var portalName = viewer.getField('portalName'); - var restContext = viewer.getField('restContextName'); - baseURL = hostName + "/" + restContext + "/ks/poll/"; - var url = baseURL + "viewpoll/pollid"; - $.getJSON(url,createPollList); + this.viewer = data.get('viewer').getData(); + var hostName = viewer.getField('hostName'); + var portalName = viewer.getField('portalName'); + var restContext = viewer.getField('restContextName'); + baseURL = hostName + "/" + restContext + "/ks/poll/"; + var url = baseURL + "viewpoll/pollid"; + $.getJSON(url, createPollList); } -function createPollList(data){ - var prefs = new gadgets.Prefs(); - - var pollIds = data.pollId; - var pollNames = data.pollName; - var len = pollIds.length; - - if (data.isAdmin == "true") { - var html = []; - html.push('
'); - html.push('
'); - html.push(''); - html.push('
'); - html.push(''); - html.push(''); - html.push(''); - html.push('
'); - html.push('
'); - html.push('
'); - $('#listpoll').html(html.join('')); - } - - var randomPollId = 0; - var url = baseURL + "viewpoll/" + pollIds[randomPollId]; - - if(len == 0){ - document.getElementById("poll").innerHTML = "
" + prefs.getMsg("nopoll") + "
"; - adjustHeight(); - return; - - } - - $.getJSON(url,function(data){ - showPoll(data, false); - }); +function createPollList(data) { + var prefs = new gadgets.Prefs(); + var pollIds = data.pollId; + var pollNames = data.pollName; + var len = pollIds.length; + var votedValue = prefs.getString('votedValue'); + + if (data.isAdmin == "true") { + var html = []; + html.push('
'); + html.push('
'); + html.push(''); + html.push('
'); + html.push(''); + html.push(''); + html.push(''); + html.push('
'); + html.push('
'); + html.push('
'); + $('#listpoll').html(html.join('')); + } + + var randomPollId = 0; + var url = baseURL + "viewpoll/" + pollIds[randomPollId]; + if (len == 0) { + document.getElementById("poll").innerHTML = "
" + prefs.getMsg("nopoll") + "
"; + adjustHeight(); + return; + } + + // initialize values for vote options + if (votedValue) { + var selVote = document.getElementById("selVoteQuestions"); + selVote.value = votedValue; + selVote.onchange(); + } else { + $.getJSON(url, function(data) { + showPoll(data, false); + }); + } } +function showPoll(data, isVoteAgain) { + var options = data.option; + var prefs = new gadgets.Prefs(); + var lblVote = prefs.getMsg("vote"); + var question = data.question; + var pollId = data.id; + var parentPath = data.parentPath; + var haveTopic = parentPath.indexOf("ForumData/CategoryHome"); // check topic of poll if toptic is exist + if (!data.showVote || isVoteAgain) { + html = []; + if (haveTopic) { + var prefs = new gadgets.Prefs(); + var topicId = pollId.replace("poll", "topic"); + var topicURL = window.location.protocol + "//" + window.location.host + parent.parent.eXo.env.portal.context + "/" + parent.parent.eXo.env.portal.portalName + "/forum/topic/" + topicId; + html.push('
' + question + '' + prefs.getMsg("discuss") + '
'); + } else { + html.push('
' + question + '
'); + } + html.push('
'); + html.push('') + if (data.isMultiCheck) { + for ( var i = 0, len = options.length; i < len; i++) { + html.push(''); + } + } else { + for ( var i = 0, len = options.length; i < len; i++) { + html.push(''); + } + } + html.push("
"); + html.push(""); -function showPoll(data, isVoteAgain){ - var options = data.option; - var prefs = new gadgets.Prefs(); - var lblVote = prefs.getMsg("vote"); - var question = data.question; - var pollId = data.id; - var parentPath = data.parentPath; - var haveTopic = parentPath.indexOf("ForumData/CategoryHome"); //check topic of poll if toptic is exist - if(!data.showVote || isVoteAgain){ - html = []; - if(haveTopic){ - var prefs = new gadgets.Prefs(); - var topicId= pollId.replace("poll","topic"); - var topicURL = window.location.protocol + "//" + window.location.host + parent.parent.eXo.env.portal.context + "/"+ parent.parent.eXo.env.portal.portalName +"/forum/topic/" + topicId; - html.push('
' + question + '' + prefs.getMsg("discuss") + '
'); - } - else{ - html. push('
' + question + '
'); - } - html.push('
'); - html.push('') - if(data.isMultiCheck){ - for(var i = 0, len = options.length; i < len; i++){ - html.push(''); - } - } else { - for(var i = 0, len = options.length; i < len; i++){ - html.push(''); - } - } - html.push("
"); - html.push(""); - - $('#poll').html(html.join('')); - }else{ - showResult(data); - } - adjustHeight(); + $('#poll').html(html.join('')); + } else { + showResult(data); + } + adjustHeight(); } -function showResult(data){ - var prefs = new gadgets.Prefs(); - var voters = data.infoVote[data.infoVote.length-1]; - var options = data.option; - var vote = data.vote; - var question = data.question; - var msgOption = prefs.getMsg('option'); - var msgPercent = prefs.getMsg('percent'); - var msgVoter = prefs.getMsg('voter'); - var msgTotal = prefs.getMsg('total'); - var pollId = data.id; - var parentPath = data.parentPath; - var haveTopic = parentPath.indexOf("ForumData/CategoryHome"); //check topic of poll if toptic is exist - var tbl = []; - - if(haveTopic){ - var prefs = new gadgets.Prefs(); - var topicId= pollId.replace("poll","topic"); - var topicURL = window.location.protocol + "//" + window.location.host + parent.parent.eXo.env.portal.context + "/"+ parent.parent.eXo.env.portal.portalName + "/forum/topic/" + topicId; - tbl.push('
' + question + '' + prefs.getMsg('discuss') + '
'); - } - else{ - tbl.push('
' + question + '
'); - } - - tbl.push(''); - tbl.push(''); - for(var i = 0, len = options.length; i < len; i++){ - var result = Math.round(vote[i]); - var style =""; - if(result>5){ - var style = 'width:' + result + '%;'; - } - else{ - var style = 'width:' + result + '%;'; - } - - tbl.push(''); - } - tbl.push(''); - tbl.push('
' + options[i] + '
 
' + result + '%
'); - tbl.push('
'); - if(data.isAgainVote){ - tbl.push(""); - $("#btnVoteAgain").live("click", function(){ - showPoll(data, true); - }); - } - tbl.push(' '+ msgTotal +': ' + voters + ' ' + msgVoter +''); - tbl.push('
'); - - $("#poll").html(tbl.join('')); - adjustHeight(); +function showResult(data) { + var prefs = new gadgets.Prefs(); + var voters = data.infoVote[data.infoVote.length - 1]; + var options = data.option; + var vote = data.vote; + var question = data.question; + var msgOption = prefs.getMsg('option'); + var msgPercent = prefs.getMsg('percent'); + var msgVoter = prefs.getMsg('voter'); + var msgTotal = prefs.getMsg('total'); + var pollId = data.id; + var parentPath = data.parentPath; + var haveTopic = parentPath.indexOf("ForumData/CategoryHome"); // check topic of poll if toptic is exist + var tbl = []; + + if (haveTopic) { + var prefs = new gadgets.Prefs(); + var topicId = pollId.replace("poll", "topic"); + var topicURL = window.location.protocol + "//" + window.location.host + parent.parent.eXo.env.portal.context + "/" + parent.parent.eXo.env.portal.portalName + "/forum/topic/" + topicId; + tbl.push('
' + question + '' + prefs.getMsg('discuss') + '
'); + } else { + tbl.push('
' + question + '
'); + } + + tbl.push(''); + tbl.push(''); + for ( var i = 0, len = options.length; i < len; i++) { + var result = Math.round(vote[i]); + var style = ""; + if (result > 5) { + var style = 'width:' + result + '%;'; + } else { + var style = 'width:' + result + '%;'; + } + + tbl.push(''); + } + tbl.push(''); + tbl.push('
' + options[i] + '
 
' + result + '%
'); + tbl.push('
'); + if (data.isAgainVote) { + tbl.push(""); + $("#btnVoteAgain").live("click", function() { + showPoll(data, true); + }); + } + tbl.push(' ' + msgTotal + ': ' + voters + ' ' + msgVoter + ''); + tbl.push('
'); + + $("#poll").html(tbl.join('')); + adjustHeight(); } -function doVote(el){ - var votes = []; - $(".radio:checked").each(function(){ - votes.push($(this).val()); - }); - - if(votes.length < 1) { - $("input:checked").each(function() { - votes.push($(this).val()); - }); - if(votes.length < 1) return; - } - - var pollId = el.form.elements["pollid"].value; - var url = baseURL + "votepoll/" + pollId + "/" + votes.join(":"); - $.getJSON(url,showResult); +function doVote(el) { + var votes = []; + $(".radio:checked").each(function() { + votes.push($(this).val()); + }); + + if (votes.length < 1) { + $("input:checked").each(function() { + votes.push($(this).val()); + }); + if (votes.length < 1) { + return; + } + } + + var pollId = el.form.elements["pollid"].value; + var url = baseURL + "votepoll/" + pollId + "/" + votes.join(":"); + $.getJSON(url, showResult); } -function changeVote(obj){ - var selectedValue = obj.options[obj.selectedIndex].value; - var url = baseURL + "viewpoll/" + selectedValue; - $.getJSON(url,function(data){ - showPoll(data, false); - }); - config(); +function changeVote(obj) { + var selectedValue = obj.options[obj.selectedIndex].value; + var url = baseURL + "viewpoll/" + selectedValue; + var prefs = new gadgets.Prefs(); + prefs.set('votedValue', selectedValue); + $.getJSON(url, function(data) { + showPoll(data, false); + }); + config(); } -function config(){ - if($('#listpoll').is(':visible')) - $('#listpoll').fadeOut("fast",adjustHeight); - else - $('#listpoll').fadeIn("fast",adjustHeight); - adjustHeight(); +function config() { + if ($('#listpoll').is(':visible')) { + $('#listpoll').fadeOut("fast", adjustHeight); + } else { + $('#listpoll').fadeIn("fast", adjustHeight); + } + adjustHeight(); } -function adjustHeight(){ - gadgets.window.adjustHeight($('.uiGadgetThemes').outerHeight()); +function adjustHeight() { + gadgets.window.adjustHeight($('.uiGadgetThemes').outerHeight()); } gadgets.util.registerOnLoadHandler(init); \ No newline at end of file From dd08ac2994f56a3507e3c4e406f4e2b6ad7d7b39 Mon Sep 17 00:00:00 2001 From: Son Dang Ngoc Date: Thu, 25 Jul 2013 10:13:56 +0700 Subject: [PATCH 3/7] PLF-5069: Featured Poll - Incorrect UI and behavior --- .../src/main/webapp/gadgets/FeaturedPoll/Poll.xml | 2 +- .../webapp/gadgets/FeaturedPoll/script/poll.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml index ff71e9e104..7f3785ddee 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml @@ -38,7 +38,7 @@ -
+
__MSG_title__ diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js index de179baf40..94fb655cf0 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js @@ -162,6 +162,20 @@ function showResult(data) { tbl.push('
'); $("#poll").html(tbl.join('')); + // Adjust width of progress bar if it's too short + var featPoll = document.getElementById('uiFeaturePoll'); + if (featPoll.offsetWidth < 300) { + var childs = featPoll.getElementsByTagName('td'); + if (childs) { + childs[0].style.width = 70; + var labelVote = featPoll.getElementsByClassName('label-vote'); + if (labelVote) { + for (var pos = 0; pos < labelVote.length; pos++) { + labelVote[pos].style.width = 65; + } + } + } + } adjustHeight(); } From 8d793a40ecbcbaa566ed9e3fca3aa29313f36efc Mon Sep 17 00:00:00 2001 From: giangnt Date: Wed, 24 Jul 2013 15:16:19 +0700 Subject: [PATCH 4/7] PLF-5069:Featured Poll - Incorrect UI and behavior --- .../main/webapp/gadgets/FeaturedPoll/Poll.xml | 46 +++++++++---------- .../gadgets/FeaturedPoll/script/poll.js | 2 +- .../src/main/webapp/skin/less/Poll.less | 5 +- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml index 7f3785ddee..33c946e457 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml @@ -28,28 +28,28 @@ - - - - - - - -
-
- __MSG_title__ - -
- -
-
-
-
-
-
- ]]> + + + + + + + + +
+
+ __MSG_title__ + +
+ +
+
+
+
+
+
+ ]]>
\ No newline at end of file diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js index 94fb655cf0..c40f5f3e57 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js @@ -164,7 +164,7 @@ function showResult(data) { $("#poll").html(tbl.join('')); // Adjust width of progress bar if it's too short var featPoll = document.getElementById('uiFeaturePoll'); - if (featPoll.offsetWidth < 300) { + if (featPoll.offsetWidth < 400) { var childs = featPoll.getElementsByTagName('td'); if (childs) { childs[0].style.width = 70; diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less index 35fa63a2c5..71d09330aa 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less +++ b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less @@ -69,7 +69,8 @@ } .horizontalBG{ - min-width: 50px; + width: 100%; + min-width: 110px; height: 10px; border-radius: 5px; background-image: linear-gradient(to bottom, #d3d3d3, #eaeaea); @@ -137,4 +138,4 @@ margin: 0px; } } -} \ No newline at end of file +} From 598b81b9365ac52c49cb9f4c6d542c4a2f389d1d Mon Sep 17 00:00:00 2001 From: giangnt Date: Thu, 3 Oct 2013 16:34:06 +0700 Subject: [PATCH 5/7] UI-2818 Featured Poll - Incorrect UI and behavior --- .../gadgets/FeaturedPoll/script/poll.js | 5 ++-- .../src/main/webapp/skin/less/Poll.less | 30 +++++++++++++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js index c40f5f3e57..9dbd85cc21 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js @@ -167,11 +167,12 @@ function showResult(data) { if (featPoll.offsetWidth < 400) { var childs = featPoll.getElementsByTagName('td'); if (childs) { - childs[0].style.width = 70; + childs[0].style.width = "110px"; + childs[0].style.maxWidth= "110px"; var labelVote = featPoll.getElementsByClassName('label-vote'); if (labelVote) { for (var pos = 0; pos < labelVote.length; pos++) { - labelVote[pos].style.width = 65; + labelVote[pos].style.width = "105px"; } } } diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less index 71d09330aa..0dbc4dee29 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less +++ b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less @@ -37,6 +37,7 @@ border: none; width: 100%; margin: 10px 0; + table-layout: fixed; .label-vote{ max-width: 170px; white-space: nowrap; @@ -44,8 +45,9 @@ text-overflow: ellipsis; } .percent{ - width: 40px; - padding-left: 12px; + width: 35px; + padding-left: 6px; + text-align: right; } } @@ -70,18 +72,34 @@ .horizontalBG{ width: 100%; - min-width: 110px; + min-width: 103px; height: 10px; border-radius: 5px; - background-image: linear-gradient(to bottom, #d3d3d3, #eaeaea); - box-shadow: 0 1px 1px #C0C0C0 inset; + background-color: #dcdcdc; + background-image: -moz-linear-gradient(top, #d3d3d3, #eaeaea); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#d3d3d3), to(#eaeaea)); + background-image: -webkit-linear-gradient(top, #d3d3d3, #eaeaea); + background-image: -o-linear-gradient(top, #d3d3d3, #eaeaea); + background-image: linear-gradient(to bottom, #d3d3d3, #eaeaea); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd3d3d3', endColorstr='#ffeaeaea', GradientType=0); + -webkit-box-shadow: 0 1px 1px #c0c0c0 inset; + -moz-box-shadow: 0 1px 1px #c0c0c0 inset; + box-shadow: 0 1px 1px #c0c0c0 inset; overflow: hidden; } .horizontalBar { height: 10px; border-radius: 5px 0 0 5px; - background-image: linear-gradient(to bottom, #5d83c3, #456697); + background-color: #5377b1; + background-image: -moz-linear-gradient(top, #5d83c3, #456697); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5d83c3), to(#456697)); + background-image: -webkit-linear-gradient(top, #5d83c3, #456697); + background-image: -o-linear-gradient(top, #5d83c3, #456697); + background-image: linear-gradient(to bottom, #5d83c3, #456697); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5d83c3', endColorstr='#ff456697', GradientType=0); } .listpoll { From 33c4733ef757eecd479931d483871cde0542e014 Mon Sep 17 00:00:00 2001 From: giangnt Date: Wed, 13 Nov 2013 14:01:24 +0700 Subject: [PATCH 6/7] UI-2818 Featured Poll - Incorrect UI and behavior: add tooltip for label vote --- .../main/webapp/gadgets/FeaturedPoll/Poll.xml | 5 +- .../gadgets/FeaturedPoll/script/poll.js | 49 +++++++++++++------ .../src/main/webapp/skin/less/Poll.less | 44 +++++++++++++++-- 3 files changed, 77 insertions(+), 21 deletions(-) diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml index 33c946e457..09b2878c9c 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/Poll.xml @@ -32,7 +32,8 @@ - + + @@ -41,7 +42,7 @@
__MSG_title__ - +
diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js index 9dbd85cc21..284f034c1c 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js @@ -87,7 +87,7 @@ function showPoll(data, isVoteAgain) { var prefs = new gadgets.Prefs(); var topicId = pollId.replace("poll", "topic"); var topicURL = window.location.protocol + "//" + window.location.host + parent.parent.eXo.env.portal.context + "/" + parent.parent.eXo.env.portal.portalName + "/forum/topic/" + topicId; - html.push('
' + question + '' + prefs.getMsg("discuss") + '
'); + html.push('
' + question + '' + prefs.getMsg("discuss") + '
'); } else { html.push('
' + question + '
'); } @@ -110,6 +110,7 @@ function showPoll(data, isVoteAgain) { showResult(data); } adjustHeight(); + $("[data-toggle=tooltip]").tooltip(); } function showResult(data) { @@ -131,7 +132,7 @@ function showResult(data) { var prefs = new gadgets.Prefs(); var topicId = pollId.replace("poll", "topic"); var topicURL = window.location.protocol + "//" + window.location.host + parent.parent.eXo.env.portal.context + "/" + parent.parent.eXo.env.portal.portalName + "/forum/topic/" + topicId; - tbl.push('
' + question + '' + prefs.getMsg('discuss') + '
'); + tbl.push('
' + question + '' + prefs.getMsg('discuss') + '
'); } else { tbl.push('
' + question + '
'); } @@ -147,7 +148,7 @@ function showResult(data) { var style = 'width:' + result + '%;'; } - tbl.push('
' + options[i] + '
 
' + result + '%'); + tbl.push('
' + options[i] + '
 
' + result + '%'); } tbl.push(''); tbl.push(''); @@ -164,20 +165,40 @@ function showResult(data) { $("#poll").html(tbl.join('')); // Adjust width of progress bar if it's too short var featPoll = document.getElementById('uiFeaturePoll'); - if (featPoll.offsetWidth < 400) { - var childs = featPoll.getElementsByTagName('td'); - if (childs) { - childs[0].style.width = "110px"; - childs[0].style.maxWidth= "110px"; - var labelVote = featPoll.getElementsByClassName('label-vote'); - if (labelVote) { - for (var pos = 0; pos < labelVote.length; pos++) { - labelVote[pos].style.width = "105px"; - } + var labelVote = featPoll.getElementsByClassName('label-vote'); + var isWindowMode = featPoll.offsetWidth < 400 ? false : true; + if (!isWindowMode) { + $(featPoll).addClass('minimize'); + var children = featPoll.getElementsByTagName('td'); + if (children) + children[0].style.width = 105; + } + + makeTooltipForLabel(labelVote, isWindowMode); + adjustHeight(); +} + +function makeTooltipForLabel(labels, mode) { + if (labels) { + for (var j = 0; j < labels.length; j++) { + var width = labels[j].offsetWidth; + console.log(width); + + if (mode == false) { + if (width > 105) + setAttribute(labels[j], 'data-toggle', 'tooltip'); + labels[j].style.width = 100; + } else if (mode == true) { + if (width > 170) + setAttribute(labels[j], 'data-toggle', 'tooltip'); + $(labels[j]).addClass('w170'); } } } - adjustHeight(); +} + +function setAttribute(element, property, value) { + return element.setAttribute(property, value); } function doVote(el) { diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less index 0dbc4dee29..eaebbec7f5 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less +++ b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less @@ -1,10 +1,24 @@ .uiGadgetThemes{ .gadContent { padding: 8px 16px; + .question, .question .text{ + color: #2f5e92; + } .question{ - margin: 10px 0px 12px 0px; + margin: 5px 0 10px; text-decoration: none; - color: #2f5e92; + display: inline-block; + line-height: 18px; + > i { + float: left; + margin-right: 5px; + margin-top: 1px; + } + .text { + display: block; + line-height: 18px; + margin-left: 21px; + } } .poll{ h6{ @@ -39,14 +53,17 @@ margin: 10px 0; table-layout: fixed; .label-vote{ - max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + display: inline-block; + } + .label-vote.w170 { + width: 170px; } .percent{ width: 35px; - padding-left: 6px; + padding-left: 2px; text-align: right; } } @@ -72,7 +89,6 @@ .horizontalBG{ width: 100%; - min-width: 103px; height: 10px; border-radius: 5px; background-color: #dcdcdc; @@ -118,6 +134,7 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + text-align: left; } } .selectbox{ @@ -156,4 +173,21 @@ margin: 0px; } } + &.minimize { + .gadContent { + .listpoll { + .control-group { + .control-label { + width: auto; + float: none; + padding: 0; + margin: 0 0 8px; + } + .controls { + margin-left: 0; + } + } + } + } + } } From 3f4b2428d514bb7401386433c517b2a6dda4cadf Mon Sep 17 00:00:00 2001 From: giangnt Date: Thu, 19 Dec 2013 10:06:50 +0700 Subject: [PATCH 7/7] UI-2818 Featured Poll - Incorrect UI and behavior --- .../webapp/gadgets/FeaturedPoll/script/poll.js | 7 +++---- .../gadgets/src/main/webapp/skin/less/Poll.less | 14 ++++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js index 284f034c1c..673430ac0b 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js +++ b/samples/gadgets-sample/gadgets/src/main/webapp/gadgets/FeaturedPoll/script/poll.js @@ -173,6 +173,9 @@ function showResult(data) { if (children) children[0].style.width = 105; } + else { + $(featPoll).addClass('maximize'); + } makeTooltipForLabel(labelVote, isWindowMode); adjustHeight(); @@ -188,10 +191,6 @@ function makeTooltipForLabel(labels, mode) { if (width > 105) setAttribute(labels[j], 'data-toggle', 'tooltip'); labels[j].style.width = 100; - } else if (mode == true) { - if (width > 170) - setAttribute(labels[j], 'data-toggle', 'tooltip'); - $(labels[j]).addClass('w170'); } } } diff --git a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less index eaebbec7f5..d86364da2a 100644 --- a/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less +++ b/samples/gadgets-sample/gadgets/src/main/webapp/skin/less/Poll.less @@ -51,16 +51,12 @@ border: none; width: 100%; margin: 10px 0; - table-layout: fixed; .label-vote{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; } - .label-vote.w170 { - width: 170px; - } .percent{ width: 35px; padding-left: 2px; @@ -174,6 +170,9 @@ } } &.minimize { + .voteResult { + table-layout: fixed; + } .gadContent { .listpoll { .control-group { @@ -190,4 +189,11 @@ } } } + &.maximize { + .voteResult { + .label-vote { + padding-right: 10px; + } + } + } }