1、完成课程模块导航栏样式调整

2、修改意见反馈默认在右下角位置
3、调整我的课程、我的项目js
4、ruby生成的菜单栏添加样式及部分方法重写
5、封装部分页面的ruby代码到helper
This commit is contained in:
sw 2015-03-17 15:30:15 +08:00
parent 747a109638
commit e4c0c840bf
10 changed files with 228 additions and 409 deletions

View File

@ -1622,6 +1622,17 @@ module ApplicationHelper
@public_forum = Forum.find(1)
end
#获取用户未过期的课程
def get_user_course user
courses_doing = []
user.courses.each do |course|
if !course_endTime_timeout?(course)
courses_doing.push course
end
end
courses_doing
end
private
def wiki_helper
@ -1847,7 +1858,7 @@ module ApplicationHelper
def render_dynamic_nav
home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index'}
home_link = "<li>" << home_link << "</li>"
home_link = "<li class = 'topnav_a fl'>" << home_link << "</li>"
# bootstrap_render_dynamic_nav
content_tag :ul, (home_link.html_safe+bootstrap_render_dynamic_nav)
end
@ -1888,7 +1899,7 @@ module ApplicationHelper
content_li = ''
nav_list.collect do |nav_item|
content_li << content_tag(:li, nav_item)
content_li << content_tag(:li, nav_item, :class => 'topnav_a fl')
end
content_li.html_safe
end

View File

@ -25,6 +25,14 @@ module CoursesHelper
# searchTeacherAndAssistant(project).count
end
#课程模块需要展示的模块
def course_model
@nav_dispaly_course_all_label = 1
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1
end
# 返回学生数量即roles表中定义的Reporter
#def studentCount project
# searchStudent(project).count

View File

@ -0,0 +1,27 @@
<%= javascript_include_tag "feedback" %>
<div class="scrollsidebar" id="scrollsidebar">
<div class="side_content">
<div class="side_list">
<div class="side_title">
<a title="隐藏" class="close_btn"><span>关闭</span></a>
</div>
<div class="side_center">
<div class="custom_service">
<form>
<textarea class="opnionText" onfocus="if(this.value=='有什么想说的,尽管来咆哮吧~~')this.value=''" >有什么想说的,尽管来咆哮吧~~</textarea>
</form>
<a href="#" class="opnionButton c_white" id="button1">提&nbsp;&nbsp;交</a>
</div>
<div class="msgserver">
<p>
<a href="#" target="_blank">技术支持:黄井泉</a>
<a href="#" target="_blank">技术支持:白&nbsp;&nbsp;羽</a>
</p>
</div>
</div>
<div class="side_bottom"></div>
</div>
</div>
<div class="show_btn"><span>在线客服</span></div>
</div>

View File

@ -0,0 +1,71 @@
<%= stylesheet_link_tag 'public', :media => 'all' %>
<%= javascript_include_tag "header" %>
<div id="Header" >
<!-- logo -->
<div class="logo fl" >
<a href="#" target="_blank">
<%=link_to image_tag("/images/logo.png",weight:"35px", height: "30px")%>
</a>
</div>
<!-- 导航栏 -->
<div id="TopNav" class="fl">
<%= render_dynamic_nav if User.current.logged? || !Setting.login_required? -%>
</div>
<div id="TopUser" class="fr">
<div class="topuser_nav">
<ul id="TopUserNav">
<!--右侧登录、登出、注册按钮-->
<%= header_render_menu :account_menu -%>
<% if User.current.logged? -%>
<!-- 用户信息 -->
<li class="fr">
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
{ :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain },
{:class => 'my-message'} if User.current.logged?%>
</li>
<li class="fr" id="current_user_li">
<%= link_to_user(User.current)%>
<ul id="user_sub_menu">
<% unless User.current.projects.empty? %>
<li id="my_projects_li">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<ul id="my_projects_ul">
<% User.current.projects.each do |project| %>
<li title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %>
</li>
<% end %>
</ul>
</li>
<% end %>
<% if @show_course == 1 && User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) %>
<% user_course = get_user_course User.current%>
<% unless user_course.empty? %>
<li id="my_courses_li">
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
<ul id="my_courses_ul">
<% user_course.each do |course| %>
<li title="<%=course.name%>">
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id} %>
</li>
<% end %>
</ul>
</li>
<% end %>
<% end %>
<li>
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
</li>
</ul>
</li>
<% end -%>
</ul>
</div><!--topuser_nav end-->
</div>
</div>

View File

@ -1,7 +1,4 @@
<% @nav_dispaly_course_all_label = 1
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1 %>
<% course_model %>
<% teacher_num = teacherCount(@course) %>
<% student_num = studentCount(@course) %>
<!DOCTYPE html>
@ -15,353 +12,27 @@
<meta name="keywords" content="issue,bug,tracker"/>
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body class="<%= h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%= render :partial => 'layouts/base_header' %>
<div id="main">
<!--added by huang-->
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px;" rowspan="2">
<a href="http://<%= Setting.host_course%>" style="color: #15bccf;">
<%= l(:label_courses_community)%>
</a>
</td>
<td style="color: #15bccf">
<strong>
<%= l(:label_user_location) %> :
</strong>
</td>
<td rowspan="2" width="250px">
<div class="top-content-search">
<script type="text/javascript">
function regexName()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color','#ff0000');
$("#project_name_span").focus();
return false;
}
else
{
$("#project_name_span").text("");
return true;
}
}
<body>
<div id="Container">
<%= render :partial => 'layouts/new_header' %>
function submitSerch()
{
if(regexName()){$("#course_search_form").submit();}
}
</script>
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20, :style => "float:left" %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<br />
<span id="project_name_span" style="float: left"></span>
<%#= submit_tag l(:label_search), :class => "ButtonColor m3p10", :name => nil, :style => "float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" %>
<% end %>
</div>
</td>
</tr>
<tr>
<td>
<p class="top-content-list">
<%= link_to l(:field_homepage), home_path %>
>
<a href="http://<%= Setting.host_course%>" class="link_other_item">
<%=l(:label_courses_management_platform)%>
</a>
>
<%= link_to @course.name, nil %>
</p>
</td>
</tr>
</table>
</div>
<!-- end -->
<!--course page-->
<div id="sidebar">
<div class="spaceleft">
<!--informations-->
<div class="inf_user_image">
<table>
<tr>
<td valign="top">
<% if get_avatar?(@course) %>
<%= image_tag(url_to_avatar(@course), :class => "avatar2") %>
<% else %>
<%= link_to image_tag('../images/avatars/course/course.jpg', :class => "avatar2"), course_path(@course) %>
<% end %>
<td>
<table>
<tr>
<td class="info-course">
<%= link_to @course.name,course_path(@course) %>
</td>
</tr>
<tr>
<td align="center">
<div id="join_in_course">
<% if User.current.logged? %>
<% if User.current.allowed_to?(:as_teacher,@course) %>
<%= link_to l(:button_configure), {:controller => 'courses', :action => 'settings', :id => @course} %>
<%= render :partial => 'courses/set_course_time', :locals => {:course => @course} %>
<% else %>
<%= join_in_course(@course, User.current) %>
<% end %>
<% end %>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--parameter-->
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<% files_count = @course.attachments.count %>
<td class="font_index">
<!-- 1 教师; 2 学生0 全部-->
<% if User.current.member_of_course?(@course) %>
<%= link_to "#{teacher_num}", course_member_path(@course, :role => 1), :course => '1' %>
<% else %>
<span>
<%= teacher_num %>
</span>
<% end%>
</td>
<td class="font_index">
<% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) %>
<%= link_to "#{student_num}", course_member_path(@course, :role => 2), :course => '1' %>
<% else %>
<span>
<%= student_num %>
</span>
<% end %>
</td>
<td class="font_index">
<%= link_to files_count, course_files_path(@course) %>
</td>
<tr class="font_aram">
<td align="center" width="80px" id="teacherCount">
<%= l(:label_x_base_courses_teacher, :count => teacher_num) %>
</td>
<td align="center" width="80px" id="studentCount">
<%= l(:label_x_base_courses_student, :count => student_num) %>
</td>
<td align="center" width="80px">
<%= l(:label_x_course_data, :count => files_count) %>
</td>
</tr>
</table>
<div class="user_underline"></div>
</div>
<!--info-->
<div class="inf_user_context">
<table>
<!-- addedby bai 教师姓名加超链接、加入开课时间、结课时间与课时 -->
<tr>
<td valign="top" style="padding-left: 8px; width:62px">
<%= l(:label_main_teacher) %> :
</td>
<td class="font_lighter_sidebar">
<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher)) %>
</td>
</tr>
<tr class="hidden">
<td valign="top" style="padding-left: 8px;">
<%= l(:label_setup_time) %> :
</td>
<td class="font_lighter_sidebar">
<%= @course.setup_time %>
</td>
</tr>
<tr class="hidden">
<td valign="top" style="padding-left: 8px;">
<%= l(:label_endup_time) %> :
</td>
<td class="font_lighter_sidebar">
<%= @course.endup_time %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_class_period) %> :
</td>
<td class="font_lighter_sidebar">
<%= @course.class_period %>&nbsp;
<%= l(:label_class_hour) %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_main_term) %> :
</td>
<td class="font_lighter_sidebar">
<%= @course.time %>
<%= get_course_term_locales @course %>
</td>
</tr>
<!-- end -->
<% unless @course.teacher.user_extensions.nil? || @course.teacher.user_extensions.school.nil? %>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_course_organizers) %> :
</td>
<td class="font_lighter_sidebar">
<% if @course.school %>
<a href="http://<%= Setting.host_course%>/?school_id=<%= @course.school.id%>">
<%= @course.school %>
</a>
<% else%>
<% end %>
</td>
</tr>
<% else %>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_course_organizers) %> :
</td>
<td class="font_lighter_sidebar">
<%= l(:field_course_un) %>
</td>
</tr>
<% end %>
</table>
</div>
<div class="user_underline"></div>
<!--description-->
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_new_course_description) %>
</div>
<div style="padding-bottom: 8px">
<% if @course.description && !@course.description.blank? %>
<div class="font_lighter_sidebar" style="word-break:break-all; word-wrap:break-word;">
<%= textilizable @course.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_course_description_no) %>
</div>
<% end %>
<div class="created_on_course" style="padding-left: 10px;">
<strong style="color: #068d9c">
<%= l(:label_create_time) %>
</strong>
<%= format_time(@course.created_at) %>
</div>
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans">
<!-- added by william -for tag -->
<div class="user_tags">
<div id="tags">
<%= render :partial => 'tags/tag', :locals => {:obj => @course, :object_flag => "9"} %>
</div>
</div>
</div>
<div class="user_underline"></div>
<style type="text/css">
.polls_btn{ height:33px;border-top:0 solid #15bed1; border-bottom:1px solid #15bed1;border-right:1px solid #cee6e6; width:224px; padding:7px 0 0 15px; }
.polls_btn a{font-size:14px; color:#444444;font-weight:bold;}
.polls_btn span{ color:#15bed1; font-size:12px; font-weight:normal;}
.polls_btn a{ float:left;}
.polls_n{float: left;background: #ff5d31;color: #fff;width: 32px;padding-left: 2px;height: 7px;padding-bottom: 5px;padding-top: 3px;margin-top: -4px;margin-left: 3px; }
.polls_n p{ margin-top:-4px;}
.cl{ clear:both; overflow:hidden; }
</style>
<div class="polls_btn">
<!--<a href="#">问卷调查<span >12</span></a>-->
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id)%>
<div class="polls_n">
<p>NEW</p>
</div>
<div class="cl"></div>
</div>
</div>
</div>
<div id="content">
<div class="tabs_new">
<ul>
<li>
<%= link_to l(:label_course_overview), course_path(@course), :class => link_class(:overview) %>
</li>
<li>
<%= link_to l(:label_homework), homework_course_path(@course), :class => link_class([:homework,:new_homework,:edit]), :course_type => 1 %>
</li>
<li>
<%= link_to l(:label_course_file), course_files_path(@course), :class => link_class(:files) %>
</li>
<li>
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => link_class(:news) %>
</li>
<li>
<%= link_to l(:label_course_board), {:controller => 'boards', :action => 'index', :course_id => @course}, :class => link_class(:boards) %>
</li>
<li>
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => link_class(:feedback) %>
</li>
</ul>
</div>
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<!--gcm-->
</div>
<!--gcm move it mistakenly-->
<%= render :partial => 'layouts/base_footer' %>
</div>
<div id="ajax-indicator" style="display:none;">
<div id="ajax-indicator" style="display:none;">
<span>
<%= l(:label_loading) %>
</span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
</div>
<div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %>
</div>
<%= render :partial => 'layouts/new_feedback' %>
</body>
</html>

View File

@ -104,6 +104,15 @@ module Redmine
links.empty? ? nil : content_tag('ul', links.join("\n").html_safe)
end
#重新写个方法,专门给header用 sw
def header_render_menu (menu, project=nil)
links = []
menu_items_for(menu, project) do |node|
links << render_menu_node(node, project)
end
links.empty? ? nil : links.join("\n").html_safe
end
def bootstrap_render_menu(menu, project=nil)
links = []
menu_items_for(menu, project) do |node|
@ -122,8 +131,7 @@ module Redmine
else
caption, url, selected = extract_node_details(node, project)
unless url.to_s.include?( 'code_review')
return content_tag('li',
render_single_menu_node(node, caption, url, selected))
return content_tag('li',render_single_menu_node(node, caption, url, selected),:class => 'fr')
end
end
end

View File

@ -0,0 +1,47 @@
(function($){
$.fn.fix = function(options){
var defaults = {
float : 'right',
minStatue : true,
skin : 'blue',
durationTime : 1000
};
var options = $.extend(defaults, options);
this.each(function(){
var thisBox = $(this),
closeBtn = thisBox.find('.close_btn' ),
show_btn = thisBox.find('.show_btn' ),
sideContent = thisBox.find('.side_content'),
sideList = thisBox.find('.side_list')
;
var defaultTop = thisBox.offset().top;
thisBox.css(options.float, 0);
if(options.minStatue == "true"){
$(".show_btn").css("float", options.float);
sideContent.css('width', 0);
show_btn.css('width', 25);
}
closeBtn.bind("click",function(){
sideContent.animate({width: '0px'},"fast");
show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast");
cookiesave('minStatue','false','','','');
});
show_btn.bind("click",function() {
$(this).animate({width: '0px'},"fast");
sideContent.stop(true, true).delay(200).animate({ width: '154px'},"fast");
cookiesave('minStatue','false','','','');
});
});
};
})(jQuery);
$(function() {
$("#scrollsidebar").fix({
float : 'right', //default.left or right
//minStatue : true,
durationTime : 600
});
});

View File

@ -0,0 +1,41 @@
function addSlipMenu () {
var loggedas = $('#current_user_li:first');
var sub_menu = $('#user_sub_menu');
loggedas.mouseenter(function(event) {
sub_menu.show();
});
sub_menu.mouseleave(function(event) {
sub_menu.hide();
});
}
function addProjectSlipMenu () {
var loggedas = $('#my_projects_li');
var project_sub_menu = $('#my_projects_ul');
var course_sub_menu = $('#my_courses_ul');
loggedas.mouseenter(function(event) {
course_sub_menu.hide();
project_sub_menu.show();
});
loggedas.mouseleave(function(event) {
project_sub_menu.hide();
});
}
function addCourseSlipMenu () {
var loggedas = $('#my_courses_li');
var project_sub_menu = $('#my_projects_ul');
var course_sub_menu = $('#my_courses_ul');
loggedas.mouseenter(function(event) {
project_sub_menu.hide();
course_sub_menu.show();
});
loggedas.mouseleave(function(event) {
course_sub_menu.hide();
});
}
$(document).ready(function () {
addSlipMenu();
addProjectSlipMenu ();
addCourseSlipMenu();
});

View File

@ -1,65 +0,0 @@
function add_MC(){
var now = new Date().getTime();
$("#poll_content").append("<div id='new_poll_question_" + now + "'>"+
"<form accept-charset='UTF-8' action='/poll/2/create_poll_question' class='new_poll_question' data-remote='true' id='new_poll_question' method='post'>"+
"<div>" +
"<div class='ur_editor radio'>" +
"<div class='ur_editor_title'>" +
"<label>问题:&nbsp;&nbsp;</label>" +
"<input type='hidden' name='question_type' value='1'/>" +
"<input class='ur_question_title' type='text' name='poll_questions_title' placeholder='请输入单选题标题'/>" +
"<input type='checkbox' name='is_necessary' value='true' checked/>" +
"<label>必答</label>" +
"</div>" +
"<div class='ur_editor_content'>" +
"<ul>" +
"<li class='ur_item'>" +
"<label>选项<span class='ur_index'></span></label>" +
"<input type='text' name='question_answer[0]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<li class='ur_item'>" +
"<label>选项<span class='ur_index'></span></label>" +
"<input type='text' name='question_answer[1]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<li class='ur_item'>" +
"<label>选项<span class='ur_index'></span></label>" +
"<input type='text' name='question_answer[2]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"</ul>" +
"</div>" +
"<div class='ur_editor_footer'>" +
"<a class='btn btn_dark btn_submit' data-button='ok' onclick='$(this).parent().parent().parent().parent().submit();'>确定</a>" +
"<a class='btn btn_light btn_cancel' data-button='cancel' onclick='$("+ '"#new_poll_question_' + now + '"' +").remove();'>取消</a>" +
"</div>" +
"<div class='cl'></div>" +
"</div>" +
"</div>" +
"</form>" +
"</div>");
}
function add_MCQ(){$("#poll_content").append("<%= escape_javascript(render :partial => 'new_MCQ') %>");}
function add_single(){$("#poll_content").append("<%= escape_javascript(render :partial => 'new_single') %>");}
function add_mulit(){$("#poll_content").append("<%= escape_javascript(render :partial => 'new_mulit') %>");}
//问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
//单选题
function add_single_answer(doc)
{
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span></label><input type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
}
function remove_single_answer(doc)
{
if(doc.parent().siblings("li").length == 0){doc.parent().parent().parent().parent().parent().parent().remove();}else{doc.parent().remove();}
}

View File

@ -121,10 +121,10 @@ a:hover.c_blue02{color: #0781b4;}
.footlogo{ width:580px; margin:0 auto;height:50px; }
/*意见反馈*/
html{ overflow-x:hidden;}
.scrollsidebar{ position:absolute;top:1px; right:1px; background:none; }
.scrollsidebar{ position:fixed;bottom:1px; right:1px; background:none; }
.side_content{width:154px; height:auto; overflow:hidden; float:left; }
.side_content .side_list {width:154px;overflow:hidden;}
.show_btn{ width:0; height:112px; overflow:hidden; float:left; cursor:pointer;}
.show_btn{ width:0; height:112px; overflow:hidden; float:left;margin-top: 200px; cursor:pointer;}
.show_btn span { display:none;}
.close_btn{width:24px;height:24px;cursor:pointer;}
.side_title,.side_bottom,.close_btn,.show_btn {background:url(../images/sidebar_bg.png) no-repeat; }