Project

General

Profile

Feature #16326 » RM_16326_Custom_queries_mode_column_top_and_bottom.diff

Jérôme BATAILLE, 2014-03-12 18:28

View differences:

app/views/queries/_columns.html.erb (copie de travail)
23 23
              :ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);" %>
24 24
    </td>
25 25
    <td class="buttons">
26
      <input type="button" value="&#8648;" onclick="moveOptionTop(this.form.selected_columns);" /><br />
26 27
      <input type="button" value="&#8593;" onclick="moveOptionUp(this.form.selected_columns);" /><br />
27
      <input type="button" value="&#8595;" onclick="moveOptionDown(this.form.selected_columns);" />
28
      <input type="button" value="&#8595;" onclick="moveOptionDown(this.form.selected_columns);" /><br />
29
      <input type="button" value="&#8650;" onclick="moveOptionBottom(this.form.selected_columns);" />
28 30
    </td>
29 31
  </tr>
30 32
</table>
public/javascripts/select_list_move.js (copie de travail)
64 64
  }
65 65
}
66 66

  
67
function moveOptionTop(theSel) {
68
  var index = theSel.selectedIndex;
69

  
70
  if (index > 0) {
71
    for (i=index; i>0; i--) {
72
      swapOptions(theSel, i-1, i);
73
    }
74
    theSel.selectedIndex = 0;
75
  }
76
}
77

  
67 78
function moveOptionDown(theSel) {
68 79
  var index = theSel.selectedIndex;
69 80
  if (index < theSel.length - 1) {
......
72 83
  }
73 84
}
74 85

  
86
function moveOptionBottom(theSel) {
87
  var index = theSel.selectedIndex;
88
  var indexTop = theSel.length - 1;
89
  if (index < theSel.length - 1) {
90
    for (i=index; i<indexTop; i++) {
91
      swapOptions(theSel, i+1, i);
92
    }
93
    theSel.selectedIndex = indexTop;
94
  }
95
}
96

  
75 97
// OK
76 98
function selectAllOptions(id)
77 99
{
(2-2/2)