Commit d3c015610a097059cee099f51c7536ca5bbc0e17

Authored by Victor Costa
1 parent 51a74966
Exists in master

Display login button to non-logged users to suggest ideas

public/style.css
... ... @@ -556,3 +556,6 @@ div.pairwise_group_menu_container .questions-menu .menu .label {
556 556 margin-bottom: 10px;
557 557 }
558 558  
  559 +.pairwise-plugin .login-box .icon-close {
  560 + display: none !important;
  561 +}
... ...
test/functional/profile/pairwise_plugin_profile_controller_test.rb
... ... @@ -122,6 +122,19 @@ class PairwisePluginProfileControllerTest < ActionController::TestCase
122 122 assert_select "div#suggestions_box", 0
123 123 end
124 124  
  125 + should 'show login button when new ideas were allowed but user is not logged in' do
  126 + #login_as(@user.user.login)
  127 + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content)
  128 + get :prompt,
  129 + :profile => @profile.identifier,
  130 + :id => @content.id,
  131 + :question_id => @question.id,
  132 + :prompt_id => @question.prompt.id
  133 + assert_not_nil assigns(:pairwise_content)
  134 + assert_select "div#suggestions_box_not_logged", 1
  135 + end
  136 +
  137 +
125 138 should 'skip prompt' do
126 139 login_as @user.user.login
127 140 next_prompt_id = 33
... ...
views/content_viewer/_prompt_body.html.erb
... ... @@ -29,9 +29,7 @@
29 29 </div>
30 30 </div>
31 31 <% else %>
32   - <div id="suggestions_box_not_logged">
33   - <%= link_to(_("Add new idea"), '#', :id => 'new_idea_button_not_logged', :class => 'require-login-popup') %>
34   - </div>
  32 + <%= render :partial => 'pairwise_plugin_profile/suggestion_not_logged' %>
35 33 <% end %>
36 34 <% end %>
37 35 </div>
... ...
views/pairwise_plugin_profile/_suggestion_not_logged.html.erb 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +<div id="suggestions_box_not_logged">
  2 + <%= modal_inline_link_to(_('Would you like to suggest an idea?'), login_url, '#inlineLoginBox', :id => 'link_login') %>
  3 + <div id='inlineLoginBox' style='display: none;'>
  4 + <div class="pairwise-plugin">
  5 + <%= render :file => 'account/login', :locals => { :is_popin => true } %>
  6 + </div>
  7 + </div>
  8 + <script>
  9 + jQuery(document).ready(function($) {
  10 + $('.login-box a').attr('target','_blank');
  11 + });
  12 + </script>
  13 +</div>
... ...