From f1454d2d991fa1e8f722ae0c79a0468728279b5b Mon Sep 17 00:00:00 2001 From: Catouse Date: Fri, 4 Mar 2016 12:18:42 +0800 Subject: [PATCH] * create new UI for priority selectors. --- module/story/view/create.html.php | 24 ++++++++++-------- www/js/my.full.js | 42 +++++++++++++++++++++++++++++++ www/theme/default/style.css | 23 +++++++++++------ 3 files changed, 70 insertions(+), 19 deletions(-) diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index a51bd573f9..186d7ddb26 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -83,19 +83,21 @@ story->title;?> -
-
+
+
-
-
- story->pri?> - story->priList, $pri, "class='form-control'");?> -
-
-
-
- story->estimateAB;?> +
+
+ story->pri;?> + + story->estimateAB;?>
diff --git a/www/js/my.full.js b/www/js/my.full.js index 2bdf0e99dc..118ff0bd63 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -1434,6 +1434,46 @@ function fixedTableHead(boxObj) }); } +/** + * Init prioprity selectors + * @return void + */ +function initPrioritySelector() +{ + $('.dropdown-pris').each(function() + { + var $dropdown = $(this); + var $select = $dropdown.find('select'); + var selectVal = parseInt($select.val()); + var $menu = $dropdown.children('.dropdown-menu'); + if(!$menu.length) + { + $menu = $(''); + $dropdown.append($menu); + } + if(!$menu.children('li').length) + { + var set = $dropdown.data('set').split(',') || [0,1,2,3,4]; + for(var i = 0; i < set.length; ++i) + { + $menu.append('
  • ' + (i ? i : '') + '
  • '); + } + } + $menu.find('a[data-pri="' + selectVal + '"]').parent().addClass('active'); + $dropdown.find('.pri-text').html('' + (selectVal ? selectVal : '') + ''); + + $dropdown.on('click', '.dropdown-menu > li > a', function() + { + var $a = $(this); + $menu.children('li.active').removeClass('active'); + $a.parent().addClass('active'); + selectVal = $a.data('pri'); + $select.val(selectVal); + $dropdown.find('.pri-text').html('' + (selectVal ? selectVal : '') + ''); + }); + }); +} + /* Ping the server every some minutes to keep the session. */ needPing = true; @@ -1481,6 +1521,8 @@ $(document).ready(function() if(checkeds != '') checkeds = checkeds.substring(0, checkeds.length - 1); $.cookie('checkedItem', checkeds, {expires:config.cookieLife, path:config.webRoot}); }); + + initPrioritySelector(); }); /* CTRL+g, auto focus on the search box. */ diff --git a/www/theme/default/style.css b/www/theme/default/style.css index 154d9a77c0..e1656abae0 100644 --- a/www/theme/default/style.css +++ b/www/theme/default/style.css @@ -32,6 +32,7 @@ .pdt-20 {padding-top: 20px !important} /* borders */ +.br-0 {border-radius: 0!important} .bd-0, .borderless, .bd-none {border: none !important;} /* backgrounds */ @@ -147,14 +148,20 @@ i[class^="icon-"],i[class*=" icon-"],.link-icon i[class^="icon-"],.link-icon i[c .btn-icon.text-danger:hover {color: #7e0501!important} /* priority icons. */ -.pri1,.pri0,.pri2,.pri3,.pri4,.pri5,.pri6,.pri{display:inline-block;width: 18px;height: 18px;font-size: 12px;line-height: 14px;font-weight: bold; text-align: center; color: #272d68; -moz-border-radius:50%; -webkit-border-radius:50%; border-radius:50%;border: 2px solid #272d68; font-family: arial, helvetica, clean, sans-serif;} -.pri,.pri0{border-color: #ccc;color: #ccc;} -.pri:before{content: '?'} -.pri2{border-color: #25367e;color: #25367e} -.pri3{border-color: #2c4a9b;color: #2c4a9b} -.pri4{border-color: #475da8;color: #475da8} -.pri5{border-color: #6989c5;color: #6989c5} -.pri6{border-color: #9ebee5;color: #9ebee5} +.pri1,.pri0,.pri2,.pri3,.pri4,.pri5,.pri6,.pri{display:inline-block;width: 18px;height: 18px;font-size: 12px;line-height: 14px;font-weight: bold; text-align: center; color: #ccc; -moz-border-radius:50%; -webkit-border-radius:50%; border-radius:50%;border: 2px solid #ccc; font-family: arial, helvetica, clean, sans-serif; background-color: #fff} +.pri:before, .pri0:before{content: '?'} +.pri1{border-color: #EA644A;color: #EA644A;} +.pri2{border-color: #F1A325;color: #F1A325;} +.pri3{border-color: #BD7B46;color: #BD7B46;} +.pri4{border-color: #8666B8;color: #8666B8;} +.pri5{border-color: #03B8CF;color: #03B8CF} +.pri6{border-color: #38B03F;color: #38B03F} +.dropdown-pris > .dropdown-menu {padding: 0 5px;} +.dropdown-pris > .dropdown-menu > li {display: table-cell;} +.dropdown-pris > .dropdown-menu > li > a {opacity: 0.6; transition: all .2s; padding: 6px 5px; display: block} +.dropdown-pris > .dropdown-menu > li.active > a {opacity: 1} +.dropdown-pris > .dropdown-menu > li.active > a:before {display: none} +.dropdown-pris > .dropdown-menu > li > a:hover {background-color: #f5f5f5; opacity: 1} /* bug severity icons. */ .severity,.severity1,.severity2,.severity3,.severity4,.severity5,.severity6{display:inline-block;width: 16px;height: 16px;line-height: 16px;font-weight: bold; text-align: center; font-size: 12px; color: #fff; -moz-border-radius:50%; -webkit-border-radius:50%; border-radius:50%;font-family: arial, helvetica, clean, sans-serif;}