课程大纲的优化
This commit is contained in:
parent
a99b03ff76
commit
da7509f64c
|
@ -6,7 +6,7 @@ class SyllabusesController < ApplicationController
|
|||
include CoursesHelper
|
||||
|
||||
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy, :delete_syllabus]
|
||||
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :update_base_info, :delete_syllabus, :delete_des]
|
||||
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus, :delete_des]
|
||||
def index
|
||||
user = User.current
|
||||
@syllabuses = user.syllabuses
|
||||
|
@ -140,6 +140,16 @@ class SyllabusesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#修改课程名称
|
||||
def edit_syllabus_title
|
||||
if @syllabus && params[:title] != ""
|
||||
@syllabus.update_column("title",params[:title])
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#修改英文名称
|
||||
def edit_syllabus_eng_name
|
||||
if @syllabus
|
||||
|
|
|
@ -3323,7 +3323,7 @@ def get_group_member_names work
|
|||
result
|
||||
end
|
||||
|
||||
def course_syllabus_option user
|
||||
def course_syllabus_option user = User.current
|
||||
syllabuses = user.syllabuses
|
||||
type = []
|
||||
option1 = []
|
||||
|
|
|
@ -772,12 +772,12 @@ module CoursesHelper
|
|||
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
||||
link = link_to(text, url, :remote => true, :method => method, :class => "Blue-btn", :style => "margin_left: 0px;", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
||||
else
|
||||
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a")
|
||||
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "Blue-btn", :style => "margin_left: 0px;")
|
||||
end
|
||||
else
|
||||
link = "<span class='pr_join_span mr5' >#{l(:label_course_join_student)}</span>"
|
||||
link = "<span class='pr_join_span mr5' >#{l(:label_course_join_student)}</span>"
|
||||
end
|
||||
link.html_safe
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||
<% if @syllabus.nil? %>
|
||||
<%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
|
||||
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
|
||||
<% else %>
|
||||
<span><%=@syllabus.title %></span>
|
||||
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
</li>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||
<%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:280px'} %>
|
||||
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:280px'} %>
|
||||
<span class="c_red" id="edit_syllabus_notice" style="display: none;">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
|
|
|
@ -8,30 +8,29 @@
|
|||
<% end %>
|
||||
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
|
||||
</div>
|
||||
<div class="pr_info_id fl f14" style="margin-top: 0px;">
|
||||
<div class="pr_info_id fl f14 pr_info_name" style="margin-top: 0px;">
|
||||
<!--<span class="pr_info_name hidden">-->
|
||||
<% if @course.syllabus%>
|
||||
<a class="pr_info_name fb c_dark fl hidden" title="<%=@course.syllabus.title %>" style="max-width: 120px;" href="<%= Setting.protocol%>://<%= Setting.host_name%>/syllabuses/<%= @course.syllabus_id%>" target="_blank">
|
||||
<%=@course.syllabus.title %>
|
||||
<a class="c_dark fl" title="<%=@course.syllabus.title %>" href="<%= Setting.protocol%>://<%= Setting.host_name%>/syllabuses/<%= @course.syllabus_id%>" target="_blank">
|
||||
<%= @course.syllabus.title + " •" %>
|
||||
</a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<span class="hidden fl" style="max-width: <%=is_excellent_course(@course) ? '63px' : '80px'%>" title="<%= @course.name %><%=@course.is_public == 0 ? '(私有)' : '(公开)' %>"><%= @course.name %></span><span class="fl"><%=@course.is_public == 0 ? '(私有)' : '(公开)' %></span>
|
||||
<%= @course.name %><%=@course.is_public == 0 ? '(私有)' : '(公开)' %>
|
||||
<% if is_excellent_course(@course) %>
|
||||
<img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" />
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="pr_info_id fl f14" style="margin-top: 0px;">
|
||||
<% unless is_teacher %>
|
||||
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
|
||||
<% end %>
|
||||
<!--</span>-->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div>
|
||||
<span class="f14">邀请码:</span>
|
||||
<span class="f14 fontBlue2"><%=@course.generate_invite_code %></span>
|
||||
<span class="f14 fl">邀请码:</span>
|
||||
<span class="f14 fontBlue2 fl"><%=@course.generate_invite_code %></span>
|
||||
<% unless is_teacher %>
|
||||
<div id="join_in_course_header" class="fl ml35"><%= join_in_course_header(@course, User.current) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="pr_info_foot ">
|
||||
<%= l(:label_account_identity_teacher)%>(<%= course_teacher_link teacher_num %>)
|
||||
|
@ -45,6 +44,9 @@
|
|||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText boxShadow">
|
||||
<% if @course.syllabus %>
|
||||
<li><%= link_to "查看课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %></li>
|
||||
<% end %>
|
||||
<li><%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
|
||||
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
|
||||
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<% teachers_num = teacher_count @syllabus%>
|
||||
<% students_num = student_count @syllabus%>
|
||||
<% files_num = file_count @syllabus%>
|
||||
<div class="pr_info_logo fl mb5">
|
||||
<%# teachers_num = teacher_count @syllabus%>
|
||||
<%# students_num = student_count @syllabus%>
|
||||
<%# files_num = file_count @syllabus%>
|
||||
<div class="pr_info_logo fl mb5 mr10">
|
||||
<%= image_tag("../images/syllabus.jpg",width:"60px", height: "60px") %>
|
||||
</div>
|
||||
<div class="fl ml15">
|
||||
<p class="homepageSyllabusName mb5" title="<%=@syllabus.title %>"><%=@syllabus.title %></p>
|
||||
<div class="cl"></div>
|
||||
<div class="fl">
|
||||
<div id="syllabus_title_show" class="homepageSyllabusName mb5">
|
||||
<%= render :partial => 'layouts/syllabus_title', :locals => {:syllabus => @syllabus}%>
|
||||
</div>
|
||||
<textarea class="syllabusTitleTextarea none" placeholder="请编辑课程名称" id="syllabus_title_edit" onblur="edit_syllabus_title('<%= edit_syllabus_title_syllabus_path(@syllabus.id)%>');"><%= @syllabus.title %></textarea>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
|
@ -15,8 +17,9 @@
|
|||
</div>
|
||||
<textarea class="homepageSignatureTextarea none" placeholder="请编辑英文名称" id="syllabus_eng_name_edit" onblur="edit_syllabus_eng_name('<%= edit_syllabus_eng_name_syllabus_path(@syllabus.id)%>');"><%= @syllabus.eng_name %></textarea>
|
||||
</div>
|
||||
<!--
|
||||
<div class="pr_info_foot ">
|
||||
教师(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的教师数"><%=teachers_num %></a>)<span>|</span>
|
||||
学生(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的学生数"><%=students_num %></a>)<span>|</span>
|
||||
资源(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的资源数"><%=files_num %></a>)</div>
|
||||
<div class="cl"></div>
|
||||
教师(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的教师数"><%#=teachers_num %></a>)<span>|</span>
|
||||
学生(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的学生数"><%#=students_num %></a>)<span>|</span>
|
||||
资源(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的资源数"><%#=files_num %></a>)</div>
|
||||
<div class="cl"></div>-->
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<span style="word-break: normal; word-wrap: normal;"><%=@syllabus.title %></span>
|
||||
|
||||
<% if User.current == syllabus.user %>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :onclick => "show_edit_title();"%>
|
||||
<% end %>
|
|
@ -42,7 +42,7 @@
|
|||
<div class="homepageContentContainer">
|
||||
<div class="homepageContent">
|
||||
<div class="homepageLeft">
|
||||
<div class="homepagePortraitContainer mt15">
|
||||
<div class="homepagePortraitContainer mt15" onmouseover="$('#syllabus_edit_title_png').show();" onmouseout="$('#syllabus_edit_title_png').hide();">
|
||||
<%=render :partial => 'layouts/syllabus_info' %>
|
||||
</div>
|
||||
<% update_visiti_count @syllabus %>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<div class="homepageLeftMenuBlock">
|
||||
<%=link_to '班级', {:controller => "syllabuses", :action => "syllabus_courselist", :id => @syllabus.id}, :class => 'homepageMenuText' %>
|
||||
<% if is_current_user%>
|
||||
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<% if User.current == @syllabus.user && User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<div class="courseMenu" id="courseMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
$("#syllabus_title_show").html("<%= escape_javascript render :partial => 'layouts/syllabus_title', :locals => {:syllabus => @syllabus} %>");
|
||||
$("#syllabus_title_show").show();
|
||||
$("#syllabus_title_edit").hide();
|
|
@ -1083,6 +1083,7 @@ RedmineApp::Application.routes.draw do
|
|||
member do
|
||||
match 'syllabus_courselist', :to => 'syllabuses#syllabus_courselist', :via => :get, :as => 'syllabus_courselist'
|
||||
get 'edit_syllabus_eng_name'
|
||||
get 'edit_syllabus_title'
|
||||
post 'update_base_info'
|
||||
get 'delete_syllabus'
|
||||
get 'delete_des'
|
||||
|
|
|
@ -48,6 +48,24 @@ function edit_syllabus_eng_name(url){
|
|||
);
|
||||
}
|
||||
|
||||
//编辑课程名称
|
||||
function show_edit_title() {
|
||||
$("#syllabus_title_show").hide();
|
||||
$("#syllabus_title_edit").show();
|
||||
$("#syllabus_title_edit").focus();
|
||||
}
|
||||
|
||||
//编辑课程名称之后提交
|
||||
function edit_syllabus_title(url){
|
||||
$.get(
|
||||
url,
|
||||
{ title: $("#syllabus_title_edit").val().trim() },
|
||||
function (data) {
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//展开所有属性
|
||||
function toggle_all_syllabus_attr(){
|
||||
var btn = $("#show_all_syllabus_attr");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
.search{ margin-top:8px; margin-left:71px;}
|
||||
/*信息*/
|
||||
.project_info{ background:#fff; padding:10px; padding-right:0px;width:222px; padding-right:8px; margin-bottom:10px;}
|
||||
.pr_info_id{ width:137px; color:#5a5a5a; font-size:14px; margin-top:5px;}
|
||||
.pr_info_id{ width:130px; color:#5a5a5a; font-size:14px; margin-top:5px;}
|
||||
.pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;}
|
||||
.pr_info_logo:hover{ border:1px solid #64bdd9; }
|
||||
.pr_info_join{}
|
||||
|
|
|
@ -10,7 +10,7 @@ a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;}
|
|||
.tag_h span,.tag_h a{ margin-bottom:5px;}
|
||||
/*信息*/
|
||||
.project_info{ background:#fff; padding:10px 8px; width:222px; margin-bottom:10px; border:1px solid #dddddd;}
|
||||
.pr_info_id{ width:137px; color:#5a5a5a; font-size:14px; margin-top:5px;}
|
||||
.pr_info_id{ width:130px; color:#5a5a5a; font-size:14px; margin-top:5px;}
|
||||
.pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;}
|
||||
.pr_info_logo:hover{ border:1px solid #297fb8; }
|
||||
|
||||
|
@ -155,4 +155,6 @@ a:hover.course-title{ color:#269ac9;}
|
|||
/*新建页面*/
|
||||
.name_input{ border:1px solid #64bdd9; height:16px; width:310px; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
|
||||
.homepageSyllabusName {font-size:16px; color:#484848; height:25px; float:left; font-weight: bold; max-width:120px;overflow: hidden; white-space:nowrap; text-overflow:ellipsis;}
|
||||
.homepageSyllabusName {font-size:16px; color:#484848; float:left; max-width:120px;}
|
||||
.syllabusTitleTextarea {resize:none; width:120px; margin-left: 10px; height:80px; max-width:120px; max-height:80px; border:1px solid #d9d9d9; outline:none; margin:0px 0px 12px 0px;}
|
||||
|
||||
|
|
Loading…
Reference in New Issue