From d3c015610a097059cee099f51c7536ca5bbc0e17 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 9 Apr 2015 19:30:51 -0300 Subject: [PATCH] Display login button to non-logged users to suggest ideas --- public/style.css | 3 +++ test/functional/profile/pairwise_plugin_profile_controller_test.rb | 13 +++++++++++++ views/content_viewer/_prompt_body.html.erb | 4 +--- views/pairwise_plugin_profile/_suggestion_not_logged.html.erb | 13 +++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 views/pairwise_plugin_profile/_suggestion_not_logged.html.erb diff --git a/public/style.css b/public/style.css index 26f14d3..7453f3f 100644 --- a/public/style.css +++ b/public/style.css @@ -556,3 +556,6 @@ div.pairwise_group_menu_container .questions-menu .menu .label { margin-bottom: 10px; } +.pairwise-plugin .login-box .icon-close { + display: none !important; +} diff --git a/test/functional/profile/pairwise_plugin_profile_controller_test.rb b/test/functional/profile/pairwise_plugin_profile_controller_test.rb index 08dc061..19e6af9 100644 --- a/test/functional/profile/pairwise_plugin_profile_controller_test.rb +++ b/test/functional/profile/pairwise_plugin_profile_controller_test.rb @@ -122,6 +122,19 @@ class PairwisePluginProfileControllerTest < ActionController::TestCase assert_select "div#suggestions_box", 0 end + should 'show login button when new ideas were allowed but user is not logged in' do + #login_as(@user.user.login) + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content) + get :prompt, + :profile => @profile.identifier, + :id => @content.id, + :question_id => @question.id, + :prompt_id => @question.prompt.id + assert_not_nil assigns(:pairwise_content) + assert_select "div#suggestions_box_not_logged", 1 + end + + should 'skip prompt' do login_as @user.user.login next_prompt_id = 33 diff --git a/views/content_viewer/_prompt_body.html.erb b/views/content_viewer/_prompt_body.html.erb index d7396d6..c68af46 100644 --- a/views/content_viewer/_prompt_body.html.erb +++ b/views/content_viewer/_prompt_body.html.erb @@ -29,9 +29,7 @@ <% else %> -
- <%= link_to(_("Add new idea"), '#', :id => 'new_idea_button_not_logged', :class => 'require-login-popup') %> -
+ <%= render :partial => 'pairwise_plugin_profile/suggestion_not_logged' %> <% end %> <% end %> diff --git a/views/pairwise_plugin_profile/_suggestion_not_logged.html.erb b/views/pairwise_plugin_profile/_suggestion_not_logged.html.erb new file mode 100644 index 0000000..2501894 --- /dev/null +++ b/views/pairwise_plugin_profile/_suggestion_not_logged.html.erb @@ -0,0 +1,13 @@ +
+ <%= modal_inline_link_to(_('Would you like to suggest an idea?'), login_url, '#inlineLoginBox', :id => 'link_login') %> + + +
-- libgit2 0.21.2