Commit 51a74966d0d9d05460dc29496eae8b29efdd26ab

Authored by Victor Costa
1 parent 1fdebc4b
Exists in master

Remove view_type option for group block

lib/pairwise_plugin/questions_group_list_block.rb
... ... @@ -9,11 +9,8 @@ class PairwisePlugin::QuestionsGroupListBlock < Block
9 9 end
10 10  
11 11 settings_items :group_description, :type => String
12   - settings_items :view_type, :type => String, :default => 'menu'
13 12  
14   - attr_accessible :group_description, :questions_ids, :random_sort, :view_type
15   -
16   - AVAILABLE_VIEW_TYPES = [[_('Menu'), 'menu'], [_('List'), 'list']]
  13 + attr_accessible :group_description, :questions_ids, :random_sort
17 14  
18 15 def content(args={})
19 16 block = self
... ...
views/blocks/questions_group_menu.html.erb
... ... @@ -1,99 +0,0 @@
1   -<% extend PairwisePlugin::Helpers::ViewerHelper %>
2   -<% questions = block.questions_for_view || [] %>
3   -
4   -<div id='pairwise_group_list_block_<%= block.id %>' class="pairwise_group_menu_container" data-open-prompt="0">
5   - <div class="questions-menu clearfix">
6   - <span class="menu-icon">
7   - <span class="icon-bar"></span>
8   - <span class="icon-bar"></span>
9   - <span class="icon-bar"></span>
10   - </span>
11   - <span class="icon-label"><%= _('Select theme') %></span>
12   - <% if questions.count > 1 %>
13   - <div class="menu" style="display: none">
14   - <div class="label">
15   - <%= _('Select a specific theme below to vote on proposals:') %>
16   - </div>
17   - <div class="items">
18   - <% questions.each_with_index do |pairwise_content, index| %>
19   - <div class="item <%= pairwise_group_row_classes(index) %>">
20   - <%= pairwise_content.name %>
21   - </div>
22   - <% end %>
23   - </div>
24   - </div>
25   - <% end %>
26   - </div>
27   - <div class="question container">
28   - <% if block.questions.blank? %>
29   - <span><%= _("Empty") %></span>
30   - <% else %>
31   - <% questions.each_with_index do |pairwise_content, index| %>
32   - <%#= pairwise_group_content_body(index, pairwise_content) %>
33   - <div class="pairwise_inner_body" id="pairwise_inner_body_<%= pairwise_content.id %>" style="<%= index!=0 ? 'display:none' : '' %>" >
34   - <div id="pairwise_<%= pairwise_content.id %>">
35   - <div id="pairwise_main" class="pairwise_main">
36   - <% embeded = params[:embeded] %>
37   - <% question = nil %>
38   -
39   - <%= render :partial => 'content_viewer/menu', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :active_tab => :prompt} %>
40   -
41   - <div class="pairwise_content">
42   - <div class="pairwise_body"><%= block.title %></div>
43   - <div class="description">
44   - <%= block.group_description %>
45   - </div>
46   - <div class=""><%= pairwise_content.title %></div>
47   - <%= render :partial => 'content_viewer/pairwise_prompts', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :question => question, :source => (defined?(source) ? source : '') } %>
48   - <% if embeded %>
49   - <div class="footer"><%= _('Powered by') + ' ' + pairwise_content.environment.name%></div>
50   - <% end %>
51   - </div>
52   -
53   - <%= render :partial => 'content_viewer/pairwise_skip_vote', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :question => question, :source => (defined?(source) ? source : '') } %>
54   - </div>
55   - </div>
56   - </div>
57   - <% end %>
58   - <% end %>
59   - </div>
60   -</div>
61   -
62   -<script type="text/javascript">
63   - jQuery(document).ready(function($){
64   - $('.pairwise_group_menu_container .questions-menu .menu-icon').click(function() {
65   - $(this).siblings('.menu').toggle();
66   - });
67   - $('.pairwise_group_menu_container .questions-menu .items .row').click(function() {
68   - $('.pairwise_group_menu_container .questions-menu .menu').hide('fast');
69   - });
70   -
71   - function updatePairwiseMenuInfo() {
72   - var block_id = '#pairwise_group_list_block_<%= block.id %>';
73   - $(block_id + ' .pairwise_body').text('<%= block.title %>');
74   - $(block_id + ' .pairwise_body').after('<div class="description"><%= block.group_description %></div>');
75   - }
76   - //updatePairwiseMenuInfo();
77   - });
78   -
79   -// FIXME move to js file
80   -jQuery(document).ready(function($){
81   - var block_id = '#pairwise_group_list_block_<%= block.id %>';
82   - var block_element = $(block_id);
83   - var questions_arrows = $(block_id + ' .arrow');
84   - var questions_rows = $(block_id + ' .row');
85   - var questions_bodies = $(block_id + ' .pairwise_inner_body');
86   - questions_rows.click(function(){
87   - var current_open = parseInt(block_element.attr('data-open-prompt'));
88   - var index_clicked = questions_rows.index(this);
89   - if(index_clicked != current_open){
90   - block_element.attr('data-open-prompt', index_clicked);
91   - $(questions_bodies[current_open]).slideToggle();
92   - $(questions_rows[current_open]).toggleClass("secondary");
93   -
94   - $(questions_bodies[index_clicked]).slideToggle();
95   - $(questions_rows[index_clicked]).toggleClass("secondary");
96   - }
97   - });
98   -});
99   -</script>
views/box_organizer/pairwise_plugin/_questions_group_list_block.html.erb
... ... @@ -11,10 +11,6 @@
11 11 <h3> <%= _('Description:') %> </h3>
12 12 <%= text_area(:block, :group_description, :rows => 6, :cols => 50) %>
13 13 </div>
14   - <div class="view-type">
15   - <h3> <%= _('Choose a view type:') %> </h3>
16   - <%= select_tag "block[view_type]", options_for_select(PairwisePlugin::QuestionsGroupListBlock::AVAILABLE_VIEW_TYPES, @block.view_type) %>
17   - </div>
18 14 <div id="questions_content" %>
19 15 <h3> <%= _('Choose which attributes should be displayed and drag to reorder them:') %> </h3>
20 16 <ul id="pairwise_questions_list">
... ...