Commit 1fdebc4b121236d2ae62caf99545b3d1e277875b
1 parent
74db0fa7
Exists in
master
Hide embeded code in embeded mode
Showing
2 changed files
with
22 additions
and
1 deletions
Show diff stats
test/functional/profile/pairwise_plugin_profile_controller_test.rb
@@ -220,6 +220,27 @@ class PairwisePluginProfileControllerTest < ActionController::TestCase | @@ -220,6 +220,27 @@ class PairwisePluginProfileControllerTest < ActionController::TestCase | ||
220 | assert_select "div[class='total_votes']", 1 | 220 | assert_select "div[class='total_votes']", 1 |
221 | end | 221 | end |
222 | 222 | ||
223 | + should 'do not show embeded code when embeded' do | ||
224 | + login_as(@user.user.login) | ||
225 | + @question.expects(:get_choices).returns(PairwiseContentFixtures.choices_with_stats).at_least_once | ||
226 | + PairwisePlugin::PairwiseContent.any_instance.expects(:question).returns(@question).at_least_once | ||
227 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content).at_least_once | ||
228 | + | ||
229 | + xhr :get, :result, :profile => @profile.identifier, :id => @content.id, :question_id => @question.id, :embeded => true | ||
230 | + | ||
231 | + assert_select '.embeded_code_link', 0 | ||
232 | + end | ||
233 | + | ||
234 | + should 'show embeded code when not embeded' do | ||
235 | + login_as(@user.user.login) | ||
236 | + @question.expects(:get_choices).returns(PairwiseContentFixtures.choices_with_stats).at_least_once | ||
237 | + PairwisePlugin::PairwiseContent.any_instance.expects(:question).returns(@question).at_least_once | ||
238 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content).at_least_once | ||
239 | + | ||
240 | + xhr :get, :result, :profile => @profile.identifier, :id => @content.id, :question_id => @question.id, :embeded => false | ||
241 | + assert_select '.embeded_code_link', 1 | ||
242 | + end | ||
243 | + | ||
223 | should 'suggest new idea' do | 244 | should 'suggest new idea' do |
224 | login_as(@user.user.login) | 245 | login_as(@user.user.login) |
225 | 246 |
views/content_viewer/_result.html.erb
@@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
48 | </div> | 48 | </div> |
49 | <% end %> | 49 | <% end %> |
50 | 50 | ||
51 | - <% if @page.allow_edit?(user) %> | 51 | + <% if !embeded && @page.allow_edit?(user) %> |
52 | <div class="embeded_code"> | 52 | <div class="embeded_code"> |
53 | <span class="embeded_code_link"><a href="javascript:;"><%= _("Show/Hide Embeded Code") %></a></span> | 53 | <span class="embeded_code_link"><a href="javascript:;"><%= _("Show/Hide Embeded Code") %></a></span> |
54 | <div id="pairwise_embeded_box" style="display:none"> | 54 | <div id="pairwise_embeded_box" style="display:none"> |