_columns.html.erb 1.98 KB
Newer Older
1 2 3 4
<% tag_id = tag_name.gsub(/[\[\]]+/, '_').sub(/_+$/, '') %>
<% available_tag_id = "available_#{tag_id}" %>
<% selected_tag_id = "selected_#{tag_id}" %>

5 6
<span class="query-columns">
  <span>
7
      <%= label_tag available_tag_id, l(:description_available_columns) %>
8
      <%= select_tag 'available_columns',
9
              options_for_select(query_available_inline_columns_options(query)),
10
              :id => available_tag_id,
11
              :multiple => true, :size => 10, :style => "width:150px",
12
              :ondblclick => "moveOptions(this.form.#{available_tag_id}, this.form.#{selected_tag_id});" %>
13 14
  </span>
  <span class="buttons">
15
      <input type="button" value="&#8594;"
16
       onclick="moveOptions(this.form.<%= available_tag_id %>, this.form.<%= selected_tag_id %>);" />
17
      <input type="button" value="&#8592;"
18
       onclick="moveOptions(this.form.<%= selected_tag_id %>, this.form.<%= available_tag_id %>);" />
19 20
  </span>
  <span>
21
      <%= label_tag selected_tag_id, l(:description_selected_columns) %>
22
      <%= select_tag tag_name,
23
              options_for_select(query_selected_inline_columns_options(query)),
24 25 26
              :id => selected_tag_id,
              :multiple => true, :size => 10, :style => "width:150px",
              :ondblclick => "moveOptions(this.form.#{selected_tag_id}, this.form.#{available_tag_id});" %>
27 28 29 30 31
  </span>
  <span class="buttons">
      <input type="button" value="&#8648;" onclick="moveOptionTop(this.form.<%= selected_tag_id %>);" />
      <input type="button" value="&#8593;" onclick="moveOptionUp(this.form.<%= selected_tag_id %>);" />
      <input type="button" value="&#8595;" onclick="moveOptionDown(this.form.<%= selected_tag_id %>);" />
32
      <input type="button" value="&#8650;" onclick="moveOptionBottom(this.form.<%= selected_tag_id %>);" />
33 34
  </span>
</span>
35

36 37 38
<%= javascript_tag do %>
$(document).ready(function(){
  $('.query-columns').closest('form').submit(function(){
39
    $('#<%= selected_tag_id %> option').prop('selected', true);
40 41
  });
});
42
<% end %>