From e4c0c840bf92bf59e6118a87fa9d1410ed862b05 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 17 Mar 2015 15:30:15 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AE=8C=E6=88=90=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4=202=E3=80=81=E4=BF=AE=E6=94=B9=E6=84=8F?= =?UTF-8?q?=E8=A7=81=E5=8F=8D=E9=A6=88=E9=BB=98=E8=AE=A4=E5=9C=A8=E5=8F=B3?= =?UTF-8?q?=E4=B8=8B=E8=A7=92=E4=BD=8D=E7=BD=AE=203=E3=80=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=88=91=E7=9A=84=E8=AF=BE=E7=A8=8B=E3=80=81=E6=88=91?= =?UTF-8?q?=E7=9A=84=E9=A1=B9=E7=9B=AEjs=204=E3=80=81ruby=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84=E8=8F=9C=E5=8D=95=E6=A0=8F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=8F=8A=E9=83=A8=E5=88=86=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E9=87=8D=E5=86=99=205=E3=80=81=E5=B0=81=E8=A3=85=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=9D=A2=E7=9A=84ruby=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=88=B0helper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 15 +- app/helpers/courses_helper.rb | 8 + app/views/layouts/_new_feedback.html.erb | 27 ++ app/views/layouts/_new_header.html.erb | 71 +++++ app/views/layouts/base_courses.html.erb | 347 +---------------------- lib/redmine/menu_manager.rb | 12 +- public/javascripts/feedback.js | 47 +++ public/javascripts/header.js | 41 +++ public/javascripts/polls.js | 65 ----- public/stylesheets/public.css | 4 +- 10 files changed, 228 insertions(+), 409 deletions(-) create mode 100644 app/views/layouts/_new_feedback.html.erb create mode 100644 app/views/layouts/_new_header.html.erb create mode 100644 public/javascripts/feedback.js create mode 100644 public/javascripts/header.js delete mode 100644 public/javascripts/polls.js diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9629ed437..6f7019077 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 = "
  • " << home_link << "
  • " + home_link = "
  • " << home_link << "
  • " # 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 diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index db547061f..bd9901240 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -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 diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb new file mode 100644 index 000000000..ec113d413 --- /dev/null +++ b/app/views/layouts/_new_feedback.html.erb @@ -0,0 +1,27 @@ +<%= javascript_include_tag "feedback" %> +
    +
    +
    +
    + 关闭 +
    +
    +
    +
    + +
    + 提  交 +
    + + +
    +
    +
    +
    +
    在线客服
    +
    \ No newline at end of file diff --git a/app/views/layouts/_new_header.html.erb b/app/views/layouts/_new_header.html.erb new file mode 100644 index 000000000..84ded1afe --- /dev/null +++ b/app/views/layouts/_new_header.html.erb @@ -0,0 +1,71 @@ +<%= stylesheet_link_tag 'public', :media => 'all' %> +<%= javascript_include_tag "header" %> + + \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 814478174..af03ba9ca 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -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) %> @@ -15,353 +12,27 @@ <%= 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 %> + <%= yield :header_tags -%> - -
    -
    -
    -<%= render :partial => 'layouts/base_header' %> -
    - -
    - - - - - - - - - - -
    - - <%= l(:label_courses_community)%> - - - - <%= l(:label_user_location) %> : - - - -
    -

    - <%= link_to l(:field_homepage), home_path %> - > - - <%=l(:label_courses_management_platform)%> - - > - <%= link_to @course.name, nil %> -

    -
    -
    - - - -
    -
    -
      -
    • - <%= link_to l(:label_course_overview), course_path(@course), :class => link_class(:overview) %> -
    • -
    • - <%= link_to l(:label_homework), homework_course_path(@course), :class => link_class([:homework,:new_homework,:edit]), :course_type => 1 %> -
    • -
    • - <%= link_to l(:label_course_file), course_files_path(@course), :class => link_class(:files) %> -
    • -
    • - <%= link_to l(:label_course_news), course_news_index_path(@course), :class => link_class(:news) %> -
    • -
    • - <%= link_to l(:label_course_board), {:controller => 'boards', :action => 'index', :course_id => @course}, :class => link_class(:boards) %> -
    • -
    • - <%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => link_class(:feedback) %> -
    • -
    -
    - <%= render_flash_messages %> - <%= yield %> - <%= call_hook :view_layouts_base_content %> -
    - - -
    - -<%= render :partial => 'layouts/base_footer' %> -
    - -
    +
    + <%= call_hook :view_layouts_base_body_bottom %>
    +<%= render :partial => 'layouts/new_feedback' %> \ No newline at end of file diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index 60719753d..947103ea8 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -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 diff --git a/public/javascripts/feedback.js b/public/javascripts/feedback.js new file mode 100644 index 000000000..56d1c296f --- /dev/null +++ b/public/javascripts/feedback.js @@ -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 + }); +}); \ No newline at end of file diff --git a/public/javascripts/header.js b/public/javascripts/header.js new file mode 100644 index 000000000..e5363f8d5 --- /dev/null +++ b/public/javascripts/header.js @@ -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(); +}); \ No newline at end of file diff --git a/public/javascripts/polls.js b/public/javascripts/polls.js deleted file mode 100644 index c10bf6d1f..000000000 --- a/public/javascripts/polls.js +++ /dev/null @@ -1,65 +0,0 @@ -function add_MC(){ - var now = new Date().getTime(); - $("#poll_content").append("
    "+ - "
    "+ - "
    " + - "
    " + - "
    " + - "" + - "" + - "" + - "" + - "" + - "
    " + - "
    " + - "
      " + - "
    • " + - "" + - "" + - "" + - "" + - "
    • " + - "
      " + - "
    • " + - "" + - "" + - "" + - "" + - "
    • " + - "
      " + - "
    • " + - "" + - "" + - "" + - "" + - "
    • " + - "
      " + - "
    " + - "
    " + - "" + - "
    " + - "
    " + - "
    " + - "
    " + - "
    "); -} -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("
  • " + - ""+ - "
  • "); -} -function remove_single_answer(doc) -{ - if(doc.parent().siblings("li").length == 0){doc.parent().parent().parent().parent().parent().parent().remove();}else{doc.parent().remove();} -} \ No newline at end of file diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 0ee806159..d44c10161 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -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; }