diff --git a/src/noosfero-spb/software_communities/public/blocks/software-download.js b/src/noosfero-spb/software_communities/public/blocks/software-download.js index 0661bba..b177e34 100644 --- a/src/noosfero-spb/software_communities/public/blocks/software-download.js +++ b/src/noosfero-spb/software_communities/public/blocks/software-download.js @@ -4,14 +4,13 @@ modulejs.define('SoftwareDownload', ['jquery', 'NoosferoRoot'], function($, Noos function SoftwareDownload() { } - SoftwareDownload.prototype.addNewDonwload = function() { var new_download = $('#download-list-item-template').html(); $("#droppable-list-downloads").append(new_download); } SoftwareDownload.prototype.selectFile = function(element) { - var path = "/" + noosfero.profile + "/" + $(element).find('.file-path').html(); + var path = $(element).find('.file-path').html(); var size = $(element).find('.file-size').html(); var download_option = $(element).find('.file-size').closest('.download-option'); @@ -19,8 +18,14 @@ modulejs.define('SoftwareDownload', ['jquery', 'NoosferoRoot'], function($, Noos download_option.find('#block_downloads__size').val(size); } + SoftwareDownload.prototype.toggleFiles = function(element) { + var files_ul = $(element).parent().find('ul')[0]; + files_ul.classList.toggle('opened'); + files_ul.classList.toggle('closed'); + } + SoftwareDownload.prototype.deleteDownload = function(element) { - var delete_download = $(element).parent().parent().parent().remove(); + var delete_download = $(element).closest('.download-option').remove(); } return { @@ -28,7 +33,6 @@ modulejs.define('SoftwareDownload', ['jquery', 'NoosferoRoot'], function($, Noos return $('.download-block').length !== 0; }, - init: function() { window.softwareDownload = new SoftwareDownload(); } diff --git a/src/noosfero-spb/software_communities/public/style.css b/src/noosfero-spb/software_communities/public/style.css index 0ba3d8a..2dc4c5f 100644 --- a/src/noosfero-spb/software_communities/public/style.css +++ b/src/noosfero-spb/software_communities/public/style.css @@ -140,4 +140,19 @@ margin-top: 10px; } +.download-option .files ul { + width: 450px; + background: #9E9E9E; + transition: height ease .35s; + overflow: scroll; +} + +.download-option ul.closed { + height: 0px; +} + +.download-option ul.opened { + height: 70px; +} + /* end of profile_design download block */ diff --git a/src/noosfero-spb/software_communities/views/box_organizer/_download_block.html.erb b/src/noosfero-spb/software_communities/views/box_organizer/_download_block.html.erb index 173a1ee..7627bd1 100644 --- a/src/noosfero-spb/software_communities/views/box_organizer/_download_block.html.erb +++ b/src/noosfero-spb/software_communities/views/box_organizer/_download_block.html.erb @@ -1,11 +1,11 @@

<%= _('Download options') %>

-
+
+ <%= link_to_function _('New link'), 'softwareDownload.addNewDonwload(); return false', :class => 'button icon-add with-text download-new-link-button' %> diff --git a/src/noosfero-spb/software_communities/views/box_organizer/_download_list_item.html.erb b/src/noosfero-spb/software_communities/views/box_organizer/_download_list_item.html.erb index 372b9b0..86a7a64 100644 --- a/src/noosfero-spb/software_communities/views/box_organizer/_download_list_item.html.erb +++ b/src/noosfero-spb/software_communities/views/box_organizer/_download_list_item.html.erb @@ -1,33 +1,25 @@
  • -