增加《点击分组名,该分组名底色发生改变》

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2014-12-06 00:52:06 +08:00
parent fbe6ce16d7
commit b5d007ccf7
2 changed files with 24 additions and 10 deletions

View File

@ -5,6 +5,18 @@
alert('<%= l(:label_limit_groupname) %>');
}
}
function checkclass(value) {
for(var i = 0; i < document.getElementsByName("check_group_name").length; i++) {
if(document.getElementsByName("check_group_name")[i].id == value) {
document.getElementById(value).className = "selected";
}
else {
document.getElementsByName("check_group_name")[i].className = "classbox";
}
}
}
function validate_groupname_null(value1) {
value1 = value1.trim();
if(value1.length == 0 ) {
@ -16,25 +28,26 @@
validate_groupname(value1);
}
function validate_add_group() {
value1 = document.getElementById('group_name').value;
validate_groupname(value1);
validate_groupname_null(value1);
function validate_add_group() {
value1 = document.getElementById('group_name').value;
validate_groupname(value1);
validate_groupname_null(value1);
}
}
</script>
<ul>
<li class="classbox">
<li class="classbox" id = "group_name_0" name="check_group_name">
<% course_member_count = l(:label_all) + " ( " + @membercount.to_s + "人)" %>
<%= link_to course_member_count, searchgroupmembers_course_path(@course,:group_id => 0), method: 'get', remote: true,:style => " border:0px; color: #0d90c3; float:left;"%>
<%= link_to course_member_count, searchgroupmembers_course_path(@course,:group_id => 0), :onclick => "checkclass('group_name_0')", method: 'get', remote: true,:style => " border:0px; color: #0d90c3; float:left;"%>
</li>
<% if course_groups.any? %>
<% course_groups.each do |group| %>
<% group_display = group.name + " (" + group.members.count.to_s + "人)" %>
<li class="classbox" id="group_name_<%= group.id %>">
<%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true, :onclick => "$asign_id(#{group.id})",:style => " border:0px; color: #0d90c3; float:left;"%>
<% group_display = group.name + " ( " + group.members.count.to_s + "人)" %>
<li class="classbox" id="group_name_<%= group.id %>" name="check_group_name">
<%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true,
:onclick => "checkclass('group_name_#{group.id}')",:style => " border:0px; color: #0d90c3; float:left;"%>
<% if @canShowCode %>
<a href="javascript:void(0)" class="f_l" onclick="$('#add_tag_<%= group.id %>').slideToggle();"><img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" /></a>
<% end %>

View File

@ -45,6 +45,7 @@ input.f_2 {
/*.st_search input.f_2{ background:#1c9ec7; padding: 3px; margin-left: 3px; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:45px; height:28px; font-size:12px; }*/
.classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;}
.st_addclass ul li.selected { border:1px solid #f8df8c; background:#f8df8c; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;}
.st_addclass{ margin-top:5px;}
.st_addclass ul li{ margin-bottom:10px;}
.st_addclass ul li,.st_addclass a,.st_addclass img{ float:left;}