修改课程列表显示样式
This commit is contained in:
parent
49c22fbec3
commit
2b10258ae1
|
@ -19,7 +19,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id])} }
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id]), :object_id => params[:object_id]} }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -36,7 +36,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id])} }
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id]), :object_id => params[:object_id]} }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -249,22 +249,30 @@ module ApplicationHelper
|
|||
end
|
||||
classes = (ancestors.empty? ? 'root' : 'child')
|
||||
s << "<li class='project-table'><div class='#{classes}'>"
|
||||
if params[:project_type] == "0"
|
||||
s << h(block_given? ? yield(project) : project.name)
|
||||
else
|
||||
end
|
||||
|
||||
# if @project.project_type == 1
|
||||
# unless Course.find_by_extra(@project.identifier).nil?
|
||||
# unless Course.find_by_extra(@project.identifier).tea_id == User.current.id
|
||||
# s << "<span style = 'float: right;'>"
|
||||
# s << join_in_course(@project, User.current)#, ['whiteButton'])
|
||||
# s << "</span>"
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
if params[:project_type] == "0"
|
||||
unless User.current.member_of?(@project)
|
||||
s << "<span style = 'float: right;'>"
|
||||
s << watcher_link(@project, User.current)#, ['whiteButton'])
|
||||
s << "</span>"
|
||||
end
|
||||
if @project.project_type == 1
|
||||
unless Course.find_by_extra(@project.identifier).nil?
|
||||
unless Course.find_by_extra(@project.identifier).tea_id == User.current.id
|
||||
s << "<span style = 'float: right;'>"
|
||||
s << join_in_course(@project, User.current)#, ['whiteButton'])
|
||||
s << "</span>"
|
||||
end
|
||||
end
|
||||
end
|
||||
s << (render :partial => 'projects/project', :locals => {:project => project}).to_s
|
||||
else
|
||||
s << (render :partial => 'projects/course', :locals => {:project => project}).to_s
|
||||
end
|
||||
s << "</div>\n"
|
||||
ancestors << project
|
||||
end
|
||||
|
|
|
@ -47,6 +47,7 @@ module WatchersHelper
|
|||
end
|
||||
|
||||
# added by fq, modify nyan
|
||||
# Somebody may use option params
|
||||
def join_in_course(course, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
joined = user.member_of?(course)
|
||||
|
@ -61,6 +62,20 @@ module WatchersHelper
|
|||
end
|
||||
end
|
||||
|
||||
def join_in_course_for_list(course, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
joined = user.member_of?(course)
|
||||
text = joined ? l(:label_exit_course) : l(:label_join_course)
|
||||
url_t = join_path(:object_id => course.id)
|
||||
url_f = try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the css class used to identify watch links for a given +object+
|
||||
def watcher_css(objects)
|
||||
objects = Array.wrap(objects)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$('#join').replaceWith('<%= escape_javascript join_in_course(course, user) %>');
|
||||
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course_for_list(course, user) %>');
|
||||
<% if @state %>
|
||||
<% if @state == 0 %>
|
||||
alert("加入成功")
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
<div class="project-block">
|
||||
<div class="img-tag-2">
|
||||
<% if get_avatar?(project)%>
|
||||
<%= image_tag(url_to_avatar(project), :class => "avatar2") %>
|
||||
<% else %>
|
||||
<%= image_tag('../images/avatars/Project/course.jpg', :class => "avatar2") %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="wiki-description">
|
||||
<p >
|
||||
<%= content_tag('span',"#{l(:label_bid_show_course_name)}:", :class => "course-font")%>
|
||||
<%= content_tag('span', link_to("#{@project.name}", project_path(@project), :class => "info"))%>
|
||||
</p>
|
||||
<p >
|
||||
<%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%>
|
||||
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
|
||||
<%= @admin.first.user.user_extensions.occupation %>
|
||||
<% end %>
|
||||
</p>
|
||||
<p >
|
||||
<%= content_tag('div', "#{l(:field_teacher_name)}:", :class => "info course-font teacher") %>
|
||||
<% @admin = @project.project_infos%>
|
||||
<% if @admin.size > 0 %>
|
||||
<%= content_tag('a', @admin.collect{|u| link_to(u.user.lastname+u.user.firstname, user_path(u.user_id))}.join(", ").html_safe) %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="information_for_course" >
|
||||
<p class="stats">
|
||||
<%= content_tag('span', link_to("#{@project.homeworks.count}", homework_project_path(@project)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_task, :count => @project.homeworks.count)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<% files_count = @project.attachments.count %>
|
||||
<% @project.versions.each do |version| %>
|
||||
<% files_count += version.attachments.count %>
|
||||
<% end %>
|
||||
<%= content_tag('span', link_to(files_count, file_project_path(@project)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_data,:count => files_count)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('span', link_to("#{@project.members.count}", member_project_path(@project)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>
|
||||
</p>
|
||||
<div class="buttons" style="margin-top:30px;margin-left:140px">
|
||||
<span class="info"></span>
|
||||
<%= join_in_course_for_list(@project, User.current,['regular'])%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="add-info">
|
||||
<div class="main-language" style="margin-left: 30px;margin-top:-10px">
|
||||
<%= content_tag "span","#{l(:label_duration_time)}:", :class => "course-font"%>
|
||||
<%= DateTime.parse(Course.find_by_extra(@project.identifier).setup_time.to_s).strftime("%Y年%m月%d日").to_s unless Course.find_by_extra(@project.identifier).setup_time.nil? %>
|
||||
<%= '-' unless Course.find_by_extra(@project.identifier).setup_time.nil? %>
|
||||
<%= DateTime.parse(Course.find_by_extra(@project.identifier).endup_time.to_s).strftime("%Y年%m月%d日").to_s unless Course.find_by_extra(@project.identifier).endup_time.nil? %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="add-info" style="margin-left: 30px; margin-top: -20px">
|
||||
<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
|
||||
<%= content_tag "div", project.short_description, :class => "brief_introduction", :title => project.short_description %>
|
||||
</div>
|
||||
|
||||
<div class="tags">
|
||||
<div id="tags">
|
||||
<%= image_tag( "/images/sidebar/tags.png") %>
|
||||
<%= render :partial => 'tags/tag_name', :locals => {:obj => @project,:object_flag => "2",:non_list_all => true }%>
|
||||
</div>
|
||||
</div>
|
|
@ -76,9 +76,9 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div style="color:#919294;">
|
||||
<%= l(:label_tags_no) %>
|
||||
</div>
|
||||
<span style="color:#8c8a8a">
|
||||
<%= l(:label_tags_no) %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
|
@ -1688,3 +1688,7 @@ zh:
|
|||
label_update_homework_succeed: 作业更新成功
|
||||
label_task_plural: 作业
|
||||
label_search_by_student_id: 按学号过滤
|
||||
label_institution_name: 单位名称
|
||||
label_duration_time: 授课时间
|
||||
label_course_brief_introduction: 课程简介
|
||||
field_teacher_name: 教 师
|
||||
|
|
|
@ -1153,7 +1153,24 @@ div.wiki-description {
|
|||
a.project {
|
||||
float: left;
|
||||
}*/
|
||||
|
||||
.information_for_course {
|
||||
margin-top: 20px;
|
||||
margin-left: 507px;
|
||||
float: left;
|
||||
height: auto;
|
||||
width: 300px;
|
||||
font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/
|
||||
color: rgb(0, 0, 0);
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
position: absolute;
|
||||
}
|
||||
.img-tag-2{
|
||||
float: left;
|
||||
margin-top: 15px;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
.project-block {
|
||||
float: left;
|
||||
margin-top: 0px;
|
||||
|
@ -1883,9 +1900,132 @@ div.avatar_user{
|
|||
float:left;
|
||||
margin-top:-30px;
|
||||
margin-left: 550px;
|
||||
}.create-share{
|
||||
}
|
||||
.create-share{
|
||||
border-radius: 5px;
|
||||
padding-top: 3px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.buttons a, .buttons button{
|
||||
display:block;
|
||||
float:left;
|
||||
margin:0 7px 0 0;
|
||||
background-color:#ec6300;
|
||||
border:1px solid #dedede;
|
||||
border-top:1px solid #eee;
|
||||
border-left:1px solid #eee;
|
||||
|
||||
font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
|
||||
font-size:12px;
|
||||
line-height:130%;
|
||||
text-decoration:none;
|
||||
font-weight:bold;
|
||||
color:#565656;
|
||||
cursor:pointer;
|
||||
padding:5px 10px 6px 7px; /* Links */
|
||||
}
|
||||
.buttons button{
|
||||
width:auto;
|
||||
overflow:visible;
|
||||
padding:4px 10px 3px 7px; /* IE6 */
|
||||
}
|
||||
.buttons button[type]{
|
||||
padding:5px 10px 5px 7px; /* Firefox */
|
||||
line-height:17px; /* Safari */
|
||||
}
|
||||
*:first-child+html button[type]{
|
||||
padding:4px 10px 3px 7px; /* IE7 */
|
||||
}
|
||||
.buttons button img, .buttons a img{
|
||||
margin:0 3px -3px 0 !important;
|
||||
padding:0;
|
||||
border:none;
|
||||
width:16px;
|
||||
height:16px;
|
||||
}
|
||||
|
||||
/* STANDARD */
|
||||
|
||||
button:hover, .buttons a:hover{
|
||||
background-color:#dff4ff;
|
||||
border:1px solid #c2e1ef;
|
||||
color:#336699;
|
||||
}
|
||||
.buttons a:active{
|
||||
background-color:#6299c5;
|
||||
border:1px solid #6299c5;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
/* POSITIVE */
|
||||
|
||||
button.positive, .buttons a.positive{
|
||||
color:#529214;
|
||||
}
|
||||
.buttons a.positive:hover, button.positive:hover{
|
||||
background-color:#E6EFC2;
|
||||
border:1px solid #C6D880;
|
||||
color:#529214;
|
||||
}
|
||||
.buttons a.positive:active{
|
||||
background-color:#529214;
|
||||
border:1px solid #529214;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
/* NEGATIVE */
|
||||
|
||||
.buttons a.negative, button.negative{
|
||||
color:#d12f19;
|
||||
}
|
||||
.buttons a.negative:hover, button.negative:hover{
|
||||
background:#fbe3e4;
|
||||
border:1px solid #fbc2c4;
|
||||
color:#d12f19;
|
||||
}
|
||||
.buttons a.negative:active{
|
||||
background-color:#d12f19;
|
||||
border:1px solid #d12f19;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
/* REGULAR */
|
||||
|
||||
button.regular, .buttons a.regular{
|
||||
color:#ffffff;
|
||||
}
|
||||
.buttons a.regular:hover, button.regular:hover{
|
||||
background-color:#dff4ff;
|
||||
border:1px solid #c2e1ef;
|
||||
color:#336699;
|
||||
}
|
||||
.buttons a.regular:active{
|
||||
background-color:#6299c5;
|
||||
border:1px solid #6299c5;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
|
||||
.course-font {
|
||||
color:#8c8a8a;
|
||||
}
|
||||
|
||||
.teacher {
|
||||
display: inline-block;
|
||||
word-spacing: 22px;
|
||||
width: 55px;
|
||||
text-justify:inter-ideograph;
|
||||
text-align: justify;
|
||||
}
|
||||
.brief_introduction {
|
||||
margin-top: -18px;
|
||||
margin-left: 60px;
|
||||
/*display: inline-block;*/
|
||||
width: 500px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
}
|
Loading…
Reference in New Issue