Commit 0c93a29d3e443362286c9e127424649f6a187943
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
merge with master - changed to keep tasks filter after tasks close action
Showing
10 changed files
with
35 additions
and
9 deletions
Show diff stats
app/controllers/my_profile/tasks_controller.rb
app/helpers/task_helper.rb
| ... | ... | @@ -10,4 +10,15 @@ module TaskHelper |
| 10 | 10 | ) |
| 11 | 11 | end |
| 12 | 12 | |
| 13 | + def task_action action | |
| 14 | + require 'debugger'; debugger | |
| 15 | + base_url = { action: action } | |
| 16 | + url_for(base_url.merge(filter_params)) | |
| 17 | + end | |
| 18 | + | |
| 19 | + def filter_params | |
| 20 | + filter_fields = ['filter_type', 'filter_text', 'filter_responsible', 'filter_tags'] | |
| 21 | + params.select {|filter| filter if filter_fields.include? filter } | |
| 22 | + end | |
| 23 | + | |
| 13 | 24 | end | ... | ... |
app/models/highlights_block.rb
| ... | ... | @@ -12,6 +12,7 @@ class HighlightsBlock < Block |
| 12 | 12 | block.images.each do |i| |
| 13 | 13 | i[:image_id] = i[:image_id].to_i |
| 14 | 14 | i[:position] = i[:position].to_i |
| 15 | + i[:address] = Noosfero.root + i[:address] unless Noosfero.root.nil? | |
| 15 | 16 | begin |
| 16 | 17 | file = UploadedFile.find(i[:image_id]) |
| 17 | 18 | i[:image_src] = file.public_filename | ... | ... |
app/views/tasks/index.html.erb
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | <em><%= _('No pending tasks for %s') % profile.name %></em> |
| 51 | 51 | </p> |
| 52 | 52 | <% else %> |
| 53 | - <%= form_tag :action => 'close' do%> | |
| 53 | + <%= form_tag task_action('close') do%> | |
| 54 | 54 | <% button_bar(:class => 'task-actions') do %> |
| 55 | 55 | <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> |
| 56 | 56 | <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> | ... | ... |
plugins/people_block/lib/friends_block.rb
| ... | ... | @@ -17,7 +17,7 @@ class FriendsBlock < PeopleBlockBase |
| 17 | 17 | end |
| 18 | 18 | |
| 19 | 19 | def suggestions |
| 20 | - owner.profile_suggestions.of_person.enabled.limit(3).includes(:suggestion) | |
| 20 | + owner.suggested_profiles.of_person.enabled.limit(3).includes(:suggestion) | |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | def footer | ... | ... |
plugins/people_block/test/functional/profile_controller_test.rb
| ... | ... | @@ -17,8 +17,8 @@ class ProfileControllerTest < ActionController::TestCase |
| 17 | 17 | login_as(user.login) |
| 18 | 18 | owner = user.person |
| 19 | 19 | |
| 20 | - suggestion1 = owner.profile_suggestions.create(:suggestion => fast_create(Person)) | |
| 21 | - suggestion2 = owner.profile_suggestions.create(:suggestion => fast_create(Person)) | |
| 20 | + suggestion1 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner) | |
| 21 | + suggestion2 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner) | |
| 22 | 22 | |
| 23 | 23 | FriendsBlock.delete_all |
| 24 | 24 | block = FriendsBlock.new | ... | ... |
plugins/people_block/test/unit/friends_block_test.rb
| ... | ... | @@ -138,8 +138,8 @@ class FriendsBlockTest < ActionView::TestCase |
| 138 | 138 | |
| 139 | 139 | should 'list owner\'s friends suggestions' do |
| 140 | 140 | owner = fast_create(Person) |
| 141 | - suggestion1 = owner.profile_suggestions.create(:suggestion => fast_create(Person)) | |
| 142 | - suggestion2 = owner.profile_suggestions.create(:suggestion => fast_create(Person)) | |
| 141 | + suggestion1 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner) | |
| 142 | + suggestion2 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner) | |
| 143 | 143 | |
| 144 | 144 | block = FriendsBlock.new |
| 145 | 145 | block.stubs(:owner).returns(owner) | ... | ... |
plugins/statistics/lib/statistics_block.rb
public/javascripts/manage-categories.js
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | fetch_sub_items = function(sub_items, category){ |
| 3 | 3 | loading_for_button($("#category-loading-"+category)[0]); |
| 4 | 4 | $.ajax({ |
| 5 | - url: "/admin/categories/get_children", | |
| 5 | + url: noosfero_root() + "/admin/categories/get_children", | |
| 6 | 6 | dataType: "html", |
| 7 | 7 | data: {id: category}, |
| 8 | 8 | success: function(data, st, ajax){ | ... | ... |
test/unit/highlights_block_test.rb
| ... | ... | @@ -119,6 +119,19 @@ class HighlightsBlockTest < ActiveSupport::TestCase |
| 119 | 119 | block.featured_images |
| 120 | 120 | end |
| 121 | 121 | |
| 122 | + should 'return correct sub-dir address' do | |
| 123 | + Noosfero.stubs(:root).returns("/social") | |
| 124 | + f1 = mock() | |
| 125 | + f1.expects(:public_filename).returns('address') | |
| 126 | + UploadedFile.expects(:find).with(1).returns(f1) | |
| 127 | + block = HighlightsBlock.new | |
| 128 | + i1 = {:image_id => 1, :address => '/address', :position => 3, :title => 'address'} | |
| 129 | + block.images = [i1] | |
| 130 | + block.save! | |
| 131 | + block.reload | |
| 132 | + assert_equal block.images.first[:address], "/social/address" | |
| 133 | + end | |
| 134 | + | |
| 122 | 135 | [Environment, Profile].each do |klass| |
| 123 | 136 | should "choose between owner galleries when owner is #{klass.name}" do |
| 124 | 137 | owner = fast_create(klass) | ... | ... |