From 979850b129d2474f192430403b2cd75cb962b9a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Ara=C3=BAjo?=
Date: Mon, 9 Nov 2015 16:18:40 -0200
Subject: [PATCH] Fix parent module navigation when on root module
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Closes Issue #218
KalibroClient returns 0 instead of nil when the module has no parent.
Signed-off-by: Eduardo Silva Araújo
---
app/views/modules/_module_tree.html.erb | 3 ++-
features/repository/show/modules_tree.feature | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/views/modules/_module_tree.html.erb b/app/views/modules/_module_tree.html.erb
index b582b707..d859ad3a 100644
--- a/app/views/modules/_module_tree.html.erb
+++ b/app/views/modules/_module_tree.html.erb
@@ -10,7 +10,8 @@
<%= KalibroModule.human_attribute_name('grade') %>:
<%= format_grade(@root_module_result.grade) %>
-<% unless @root_module_result.parent_id.nil? %>
+
+<% unless @root_module_result.parent_id == 0 %>
<%= link_to '../', '#parent', onClick: "Module.Tree.load('#{escape_javascript(image_tag 'loader.gif')} #{escape_javascript(t('loading_data'))}', #{@root_module_result.parent_id});" %>
<% end %>
diff --git a/features/repository/show/modules_tree.feature b/features/repository/show/modules_tree.feature
index 74054f56..47057cae 100644
--- a/features/repository/show/modules_tree.feature
+++ b/features/repository/show/modules_tree.feature
@@ -17,6 +17,7 @@ Feature: Repository modules tree
When I visit the repository show page
And I click the "Modules Tree" h3
Then I should see the given module result
+ And I should not see "../"
@kalibro_configuration_restart @kalibro_processor_restart @javascript
Scenario: Should show children of root when the process has been finished