From 84060477ead5c0a97c862cac80ca75adc3697032 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Sun, 22 Sep 2013 23:50:55 +0200 Subject: Ability to select multiple packages and install them with one click --- usr/share/mageiawelcome/css/style.css | 16 +++++++------ usr/share/mageiawelcome/helpers.py | 8 +++---- usr/share/mageiawelcome/index.html | 39 +++++++++++++++++++++++++++----- usr/share/mageiawelcome/mageiawelcome.py | 19 +++++++++++++--- 4 files changed, 62 insertions(+), 20 deletions(-) diff --git a/usr/share/mageiawelcome/css/style.css b/usr/share/mageiawelcome/css/style.css index c7ba10a..bb1383e 100644 --- a/usr/share/mageiawelcome/css/style.css +++ b/usr/share/mageiawelcome/css/style.css @@ -79,7 +79,7 @@ div#slide-pager li a:hover{text-decoration:underline;color:#EEE;} #rpmdrake_info{background:#FFCC00;color:#111;line-height:29px;border-bottom: 1px solid #111;text-align:center;text-shadow: none;} div#applist {width:100%;clear:both;padding:0;margin:0;} ul.filter, ul.list{float:left;margin-top:0;} -ul.filter {width: 139px;background: #FFF;margin:0;height:425px; +ul.filter {width: 169px;background: #FFF;margin:0;height:425px; } @@ -89,7 +89,7 @@ ul.filter li {display:block; } ul.filter li.current,ul.filter li.current:hover {background-color: #0A5C93; color: #FFF;} ul.filter li:hover {background-color: #e5e5e5; color: #333;} -ul.list {width: 660px;height:425px; overflow-x:hidden;overflow-y:auto;padding:0;list-style-type:none;border-left:1px solid #262F45;} +ul.list {width: 630px;height:425px; overflow-x:hidden;overflow-y:auto;padding:0;list-style-type:none;border-left:1px solid #262F45;} ul.list img.icon {height:32px;width:32px; float:left;margin:6px;} ul.list li {width: 660px;height:54px;margin: 0;position:relative;border-bottom:1px solid #262F45;padding:2px;} @@ -97,15 +97,17 @@ ul.list li:hover {background:rgba(0, 0, 0, 0.2); } ul.list li h6 {margin:0;margin-top:6px;} ul.list li p.description {margin-top:0;} -ul.list li button.cmd,ul.list li button.inst {position:absolute; left:576px; top:28px;width:66px;float:right;} +ul.list li button.cmd,ul.list li button.inst {position:absolute; left:540px; top:28px;width:72px;float:right;} ul.list li button.uninst {display:none;} /*ul.list li:hover button.uninst {display:block;position:absolute; left:64px; bottom:1px;}*/ ul.list li.urpme {background:rgba(0, 0, 0, 0.4); background-image:url('../img/ok.png'); background-repeat:no-repeat; - background-position:40px 36px; + background-position:48px 14px; } ul.list li.urpme:hover {background-color:rgba(0, 0, 0, 0.3);} -ul.list li span.label{position:absolute; top:2px; right:26px;} - - +ul.list li span.label{position:absolute; top:2px; right:56px;} +.chkbox {float:left;width:30px;height:54px;} +.chkbox input[type='checkbox']{margin-top: 14px;} +#selectedRPMS{position:absolute;bottom:44px;left:2px;background:rgba(0, 0, 0, 0.6); padding:3px;border-radius:3px;font-size:11px; z-index:200;width:165px;} +#install_all {position:absolute;bottom:14px;left:22px;} diff --git a/usr/share/mageiawelcome/helpers.py b/usr/share/mageiawelcome/helpers.py index 027da77..3468892 100644 --- a/usr/share/mageiawelcome/helpers.py +++ b/usr/share/mageiawelcome/helpers.py @@ -14,16 +14,16 @@ def get_listapp(): if (r[6] == 'false'): start_btn = "" else: - start_btn = "" + start_btn = "" if (r[7] != ''): label = "" + r[7] + "" else: label = "" if ( not os.path.isfile(r[5])):# DO ZAINSTALOWANIA - listapp += "
  • \ -
    " + r[2] + "

    " + r[4] + "

    " + start_btn + label + "
  • " + listapp += "
  • \ +
    " + r[2] + "

    " + r[4] + "

    " + start_btn + label + "
  • " else: # JEST ZAINSTALOWANY - listapp += "
  • \ + listapp += "
  • \
    " + r[2] + "

    " + r[4] + "

    " + start_btn + label + "
  • " return listapp \ No newline at end of file diff --git a/usr/share/mageiawelcome/index.html b/usr/share/mageiawelcome/index.html index c7efc76..7f9d8e8 100644 --- a/usr/share/mageiawelcome/index.html +++ b/usr/share/mageiawelcome/index.html @@ -49,7 +49,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" }); //APPLIST $('.filtr').click(function() { - var cat = this.id; + cat = this.id; $(this).addClass('current'); $(this).siblings().removeClass('current'); $('ul#lista_applikacji li').hide(); @@ -85,13 +85,36 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" send('"' + link + '"'); }); // RUN DRAKS AND APPLICATIONS - $('.cmd').click(function(){send('"run ' + ($(this).data("run")) + '"');}); + $('#lista_applikacji').on('click','button.cmd', function(){send('"run ' + ($(this).data("run")) + '"');}); //URPMI FROM APPLIST - $('#lista_applikacji li button').not('.cmd').click(function(){ + $('#lista_applikacji').on('click','button.inst', function(){ var rpm = $(this).data('rpm'); - send('"gurpmi ' + rpm + '"'); + send('"gurpmi ' + cat +' ' + rpm + '"'); }); - + // INSTALL SELECTED + + // APPLIST - INSTALL SELECTED + $('#lista_applikacji').on('click','input:checkbox', function() { + selected = []; + $('#lista_applikacji input:checkbox').each(function () { + var $this = $(this), + rpm = $this.attr('datasrc'); + if ($(this).prop('checked')) { + selected.push(rpm); + } + }); + $('span#count_rpms').text(selected.length); + //$('span#selectedRPMS').tooltip('destroy'); + $('div#selectedPKGS').html(selected.join(' ')); + //$('span#selectedRPMS').tooltip('show'); + }); + $('#install_all').on('click','button.install_all',function(){ + var rpms = selected.join(' '); + send('"install_selected ' + cat +' '+ rpms + '"'); + selected = []; + $('span#count_rpms').text(selected.length); + $('div#selectedPKGS').html(' '); + }); }); // ]]> @@ -228,7 +251,11 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  •   Graphics
  •   System
  •   Programming
  • - + +
    Selected packages: 0
    +
    +
    +