Merge branch 'yuanke' into yuanke_1

Conflicts:
	app/views/layouts/new_base_user.html.erb
This commit is contained in:
yuanke 2016-04-25 14:03:27 +08:00
commit bb80cad1e3
11 changed files with 110 additions and 63 deletions

View File

@ -32,6 +32,10 @@ class SettingsController < ApplicationController
hidden_non_project = Setting.find_by_name("hidden_non_project") hidden_non_project = Setting.find_by_name("hidden_non_project")
@text = (hidden_non_project && hidden_non_project.value == "0") ? l(:label_show_non_project) : l(:label_hidden_non_project) @text = (hidden_non_project && hidden_non_project.value == "0") ? l(:label_show_non_project) : l(:label_hidden_non_project)
#1隐藏了课程信息 0显示了课程信息
hidden_courses = Setting.find_by_name("hidden_courses")
@text_1 = (hidden_courses && hidden_courses.value == "1") ? l(:label_show_courses) : l(:label_hidden_courses)
@notifiables = Redmine::Notifiable.all @notifiables = Redmine::Notifiable.all
if request.post? && params[:settings] && params[:settings].is_a?(Hash) if request.post? && params[:settings] && params[:settings].is_a?(Hash)
settings = (params[:settings] || {}).dup.symbolize_keys settings = (params[:settings] || {}).dup.symbolize_keys
@ -89,4 +93,22 @@ class SettingsController < ApplicationController
redirect_to settings_url redirect_to settings_url
end end
#隐藏/显示课程信息
def hidden_courses
@notifiable = Setting.find_by_name("hidden_courses")
if @notifiable
@notifiable.value == "1" ? @notifiable.value = 0 : @notifiable.value = 1
@notifiable.save
else
@notifiable = Setting.new()
@notifiable.name = "hidden_courses"
@notifiable.value = 1
@notifiable.save
end end
redirect_to settings_url
end
end

View File

@ -185,9 +185,11 @@
<div class="homepageLeftMenuBlock"> <div class="homepageLeftMenuBlock">
<%= link_to "动态",user_activities_path(@user.id),:class => "homepageMenuText"%> <%= link_to "动态",user_activities_path(@user.id),:class => "homepageMenuText"%>
</div> </div>
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<div class="homepageLeftMenuBlock"> <div class="homepageLeftMenuBlock">
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "homepageMenuText" %> <a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<% if is_current_user%> <% 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.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<div class="courseMenu" id="courseMenu"> <div class="courseMenu" id="courseMenu">
@ -228,6 +230,8 @@
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %> <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
</ul> </ul>
</div> </div>
<% end %>
<div class="homepageLeftMenuBlock"> <div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuForge').slideToggle();">项目</a> <a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuForge').slideToggle();">项目</a>

View File

@ -1,5 +1,6 @@
<h3 style="float: left;"><%=l(:label_settings)%></h3> <h3 style="float: left;"><%=l(:label_settings)%></h3>
<%= link_to @text,settings_hidden_non_project_path,:id => "hidden_non_project",:style => "float: right;margin-right: 60px;margin-top: 9px;"%> <%= link_to @text,settings_hidden_non_project_path,:id => "hidden_non_project",:style => "float: right;margin-right: 60px;margin-top: 9px;"%>
<%= link_to @text_1,settings_hidden_courses_path,:id => "hidden_courses",:style => "float: right;margin-right: 60px;margin-top: 9px;"%>
<div class="clear"></div> <div class="clear"></div>
<%= render_tabs administration_settings_tabs %> <%= render_tabs administration_settings_tabs %>

View File

@ -0,0 +1,5 @@
<% if @notifiable.value == "0"%>
$("#hidden_courses").replaceWith("<%= escape_javascript(link_to '隐藏课程信息',settings_hidden_courses_path,:id => 'hidden_courses',:style => 'float: right;margin-right: 60px;margin-top: 9px;', :remote => true)%>");
<% else%>
$("#hidden_courses").replaceWith("<%= escape_javascript(link_to '显示课程信息',settings_hidden_courses_path,:id => 'hidden_courses',:style => 'float: right;margin-right: 60px;margin-top: 9px;', :remote => true)%>");
<% end%>

View File

@ -81,10 +81,12 @@
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div> </div>
<% if activity.homework_detail_manual.comment_status != 0 %>
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: activity.id, course_id: activity.course.id), class: 'c_blue test-program-btn',:remote => true %> <%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: activity.id, course_id: activity.course.id), class: 'c_blue test-program-btn',:remote => true %>
</div> </div>
<% end %> <% end %>
<% end %>
<% if activity.homework_type == 2%> <% if activity.homework_type == 2%>
<div class="homepagePostDeadline mr15"> <div class="homepagePostDeadline mr15">
语言: 语言:

View File

@ -65,7 +65,11 @@
<% case user_activity.act_type.to_s %> <% case user_activity.act_type.to_s %>
<% when 'HomeworkCommon' %> <% when 'HomeworkCommon' %>
<%# cache (act) do %> <%# cache (act) do %>
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %>
<% end %>
<%# end %> <%# end %>
<% when 'News' %> <% when 'News' %>
<%# cache [act, act.comments.count] do %> <%# cache [act, act.comments.count] do %>

View File

@ -80,10 +80,12 @@
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div> </div>
<% if homework_common.homework_detail_manual.comment_status != 0 %>
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: homework_common.id, course_id: homework_common.course_id), class: 'c_blue test-program-btn',:remote => true %> <%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: homework_common.id, course_id: homework_common.course_id), class: 'c_blue test-program-btn',:remote => true %>
</div> </div>
<% end %> <% end %>
<% end %>
<% if homework_common.homework_type == 2%> <% if homework_common.homework_type == 2%>
<div class="homepagePostDeadline mr15"> <div class="homepagePostDeadline mr15">
语言: 语言:

View File

@ -7,6 +7,9 @@
<ul class="homepagePostType"> <ul class="homepagePostType">
<li> <li>
<ul class="homepagePostTypeHomework fl"> <ul class="homepagePostTypeHomework fl">
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<li class="f14">课程动态</li> <li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> <li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li> <!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
@ -17,6 +20,7 @@
<li><%= link_to "课程留言", {:controller => "users", :action => "show", :type => "course_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> <li><%= link_to "课程留言", {:controller => "users", :action => "show", :type => "course_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>--> <!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>--> <!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
<% end %>
</ul> </ul>
</li> </li>
<li> <li>

View File

@ -371,8 +371,8 @@ zh:
permission_contest_attachments_download: 竞赛附件下载 permission_contest_attachments_download: 竞赛附件下载
permission_upload_attachments: 资源上传 permission_upload_attachments: 资源上传
label_show_courses: 显示课程信息
label_hidden_courses: 隐藏课程信息
label_user: 用户 label_user: 用户
label_user_plural: 用户列表 label_user_plural: 用户列表

View File

@ -1089,6 +1089,7 @@ RedmineApp::Application.routes.draw do
match 'settings/edit', :via => [:get, :post] match 'settings/edit', :via => [:get, :post]
match 'settings/plugin/:id', :to => 'settings#plugin', :via => [:get, :post], :as => 'plugin_settings' match 'settings/plugin/:id', :to => 'settings#plugin', :via => [:get, :post], :as => 'plugin_settings'
match 'settings/hidden_non_project', :via => [:get, :post] match 'settings/hidden_non_project', :via => [:get, :post]
match 'settings/hidden_courses', :via => [:get, :post]
match 'sys/projects', :via => :get match 'sys/projects', :via => :get
match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post

View File

@ -267,6 +267,8 @@ please_chose:
default: 请选择 default: 请选择
hidden_non_project: hidden_non_project:
default: 1 default: 1
hidden_courses:
default: 0
plugin_redmine_ckeditor: plugin_redmine_ckeditor:
serialized: true serialized: true
default: --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess default: --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess