Commit 2a21aa48b9e4f62467fdde16bcbbd0dd1aab7a15
1 parent
46a481f9
Exists in
master
Refactor group menu
Showing
3 changed files
with
34 additions
and
31 deletions
Show diff stats
lib/pairwise_plugin/helpers/viewer_helper.rb
... | ... | @@ -88,6 +88,7 @@ module PairwisePlugin::Helpers::ViewerHelper |
88 | 88 | :action => "group", |
89 | 89 | :id => pairwise_content.parent.id, |
90 | 90 | :embeded => 1, |
91 | + :source => "SOURCE_NAME", | |
91 | 92 | :only_path => false}) |
92 | 93 | else |
93 | 94 | embeded_url = url_for({:controller => "pairwise_plugin_profile", | ... | ... |
... | ... | @@ -0,0 +1,32 @@ |
1 | +<div class="questions-menu clearfix"> | |
2 | + <span class="menu-icon"> | |
3 | + <span class="icon-bar"></span> | |
4 | + <span class="icon-bar"></span> | |
5 | + <span class="icon-bar"></span> | |
6 | + </span> | |
7 | + <span class="icon-label"><%= _('Select theme') %></span> | |
8 | + <% if questions.count > 1 %> | |
9 | + <div class="menu" style="display: none"> | |
10 | + <div class="label"> | |
11 | + <%= _('Select a specific theme below to vote on proposals:') %> | |
12 | + </div> | |
13 | + <div class="items"> | |
14 | + <% questions.each_with_index do |pairwise_content, index| %> | |
15 | + <div class="item <%= pairwise_group_row_classes(index) %>"> | |
16 | + <%= pairwise_content.name %> | |
17 | + </div> | |
18 | + <% end %> | |
19 | + </div> | |
20 | + </div> | |
21 | + <% end %> | |
22 | +</div> | |
23 | +<script type="text/javascript"> | |
24 | + jQuery(document).ready(function($){ | |
25 | + $('.pairwise_group_menu_container .questions-menu .menu-icon').click(function() { | |
26 | + $(this).siblings('.menu').toggle(); | |
27 | + }); | |
28 | + $('.pairwise_group_menu_container .questions-menu .items .row').click(function() { | |
29 | + $('.pairwise_group_menu_container .questions-menu .menu').hide('fast'); | |
30 | + }); | |
31 | + }); | |
32 | +</script> | ... | ... |
views/content_viewer/pairwise_group.html.erb
1 | 1 | <% extend PairwisePlugin::Helpers::ViewerHelper %> |
2 | 2 | |
3 | 3 | <div id='pairwise_group_list_block_<%= pairwise_group.id %>' class="pairwise_group_menu_container" data-open-prompt="0"> |
4 | - <div class="questions-menu clearfix"> | |
5 | - <span class="menu-icon"> | |
6 | - <span class="icon-bar"></span> | |
7 | - <span class="icon-bar"></span> | |
8 | - <span class="icon-bar"></span> | |
9 | - </span> | |
10 | - <span class="icon-label"><%= _('Select theme') %></span> | |
11 | - <% if questions.count > 1 %> | |
12 | - <div class="menu" style="display: none"> | |
13 | - <div class="label"> | |
14 | - <%= _('Select a specific theme below to vote on proposals:') %> | |
15 | - </div> | |
16 | - <div class="items"> | |
17 | - <% questions.each_with_index do |pairwise_content, index| %> | |
18 | - <div class="item <%= pairwise_group_row_classes(index) %>"> | |
19 | - <%= pairwise_content.name %> | |
20 | - </div> | |
21 | - <% end %> | |
22 | - </div> | |
23 | - </div> | |
24 | - <% end %> | |
25 | - </div> | |
4 | + <%= render :partial => 'content_viewer/pairwise_group_menu', :locals => {:questions => questions} %> | |
26 | 5 | <div class="question container"> |
27 | 6 | <% if questions.blank? %> |
28 | 7 | <span><%= _("Empty") %></span> |
... | ... | @@ -35,15 +14,6 @@ |
35 | 14 | </div> |
36 | 15 | |
37 | 16 | <script type="text/javascript"> |
38 | - jQuery(document).ready(function($){ | |
39 | - $('.pairwise_group_menu_container .questions-menu .menu-icon').click(function() { | |
40 | - $(this).siblings('.menu').toggle(); | |
41 | - }); | |
42 | - $('.pairwise_group_menu_container .questions-menu .items .row').click(function() { | |
43 | - $('.pairwise_group_menu_container .questions-menu .menu').hide('fast'); | |
44 | - }); | |
45 | - }); | |
46 | - | |
47 | 17 | // FIXME move to js file |
48 | 18 | jQuery(document).ready(function($){ |
49 | 19 | var block_id = '#pairwise_group_list_block_<%= pairwise_group.id %>'; | ... | ... |