Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
9ef212b6d3
|
@ -80,6 +80,10 @@ module Mobile
|
|||
class_period: params[:class_period]
|
||||
}
|
||||
course = ::Course.find(params[:course_id])
|
||||
# 如果没有传密码过来,那就把原来的密码给上,不然会不更新
|
||||
if params[:password].nil? || params[:password].blank?
|
||||
cs_params[:course][:password] = course[:password]
|
||||
end
|
||||
cs.edit_course_authorize(current_user,course)
|
||||
course = cs.edit_course(cs_params, course,current_user)
|
||||
present :data, course, with: Mobile::Entities::Course
|
||||
|
|
|
@ -29,6 +29,9 @@ class SettingsController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
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)
|
||||
|
||||
@notifiables = Redmine::Notifiable.all
|
||||
if request.post? && params[:settings] && params[:settings].is_a?(Hash)
|
||||
settings = (params[:settings] || {}).dup.symbolize_keys
|
||||
|
@ -70,4 +73,20 @@ class SettingsController < ApplicationController
|
|||
rescue Redmine::PluginNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
#隐藏/显示非项目信息
|
||||
def hidden_non_project
|
||||
@notifiable = Setting.find_by_name("hidden_non_project")
|
||||
if @notifiable
|
||||
@notifiable.value == "1" ? @notifiable.value = 0 : @notifiable.value = 1
|
||||
@notifiable.save
|
||||
else
|
||||
@notifiable = Setting.new()
|
||||
@notifiable.name = "hidden_non_project"
|
||||
@notifiable.value = 0
|
||||
@notifiable.save
|
||||
end
|
||||
|
||||
redirect_to settings_url
|
||||
end
|
||||
end
|
||||
|
|
|
@ -132,9 +132,10 @@ module ApplicationHelper
|
|||
def link_to_user_header user,canShowRealName=false,options={}
|
||||
if user.is_a?(User)
|
||||
if canShowRealName
|
||||
name = h(user.realname(options[:format]))
|
||||
name = user.show_name
|
||||
name = user.login if name == ""
|
||||
else
|
||||
name = h(user.name(options[:format]))
|
||||
name = user.login
|
||||
end
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => options[:class]
|
||||
else
|
||||
|
@ -1947,6 +1948,8 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def bootstrap_render_dynamic_nav
|
||||
hidden_non_project = Setting.find_by_name("hidden_non_project")
|
||||
visiable = !(hidden_non_project && hidden_non_project.value == "0")
|
||||
|
||||
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
|
||||
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
|
||||
|
@ -1964,21 +1967,21 @@ module ApplicationHelper
|
|||
|
||||
#@nav_dispaly_project_label
|
||||
nav_list = Array.new
|
||||
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1
|
||||
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1 && visiable
|
||||
# nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label && @show_course == 1
|
||||
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1
|
||||
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1 && visiable
|
||||
|
||||
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
|
||||
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1
|
||||
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1
|
||||
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1 && visiable
|
||||
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1 && visiable
|
||||
|
||||
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
|
||||
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1 && visiable
|
||||
# nav_list.push(projects_link) if @nav_dispaly_project_label
|
||||
#nav_list.push(users_link) if @nav_dispaly_user_label
|
||||
# nav_list.push(contest_link) if @nav_dispaly_contest_label && @show_contest == 1
|
||||
nav_list.push(bids_link) if @nav_dispaly_bid_label
|
||||
nav_list.push(forum_link) if @nav_dispaly_forum_label
|
||||
nav_list.push(stores_link) if @nav_dispaly_store_all_label
|
||||
nav_list.push(bids_link) if @nav_dispaly_bid_label && visiable
|
||||
nav_list.push(forum_link) if @nav_dispaly_forum_label && visiable
|
||||
nav_list.push(stores_link) if @nav_dispaly_store_all_label && visiable
|
||||
|
||||
content_li = ''
|
||||
nav_list.collect do |nav_item|
|
||||
|
|
|
@ -44,7 +44,11 @@ module MembersHelper
|
|||
# add by nwb
|
||||
# 课程可添加的成员列表
|
||||
def render_principals_for_new_course_members(course)
|
||||
scope = Principal.active.sorted.not_member_of_course(course).like(params[:q])
|
||||
if params[:q] && params[:q] != ""
|
||||
scope = Principal.active.sorted.not_member_of_course(course).like(params[:q])
|
||||
else
|
||||
scope = []
|
||||
end
|
||||
principals = paginateHelper scope,10
|
||||
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
|
||||
|
||||
|
|
|
@ -434,7 +434,7 @@ class CoursesService
|
|||
many_times = course.homeworks.index(bid) + 1
|
||||
name = bid.name
|
||||
homework_count = bid.homeworks.count #已提交的作业数量
|
||||
student_questions_count = bid.commit.nil? ? 0 : bid.commit
|
||||
student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
description = bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = bid.comment_status
|
||||
|
@ -454,7 +454,7 @@ class CoursesService
|
|||
many_times = course.homeworks.index(bid) + 1
|
||||
name = bid.name
|
||||
homework_count = bid.homeworks.count #已提交的作业数量
|
||||
student_questions_count = bid.commit.nil? ? 0 : bid.commit
|
||||
student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
description = bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = bid.comment_status
|
||||
|
|
|
@ -17,23 +17,7 @@
|
|||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% container.saved_attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>" class="attachment">
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
|
||||
<%= if attachment.id.nil?
|
||||
#待补充代码
|
||||
else
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
|
||||
end
|
||||
%>
|
||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<script type='text/javascript'>
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
</span>
|
||||
<% project = project %>
|
||||
<span class="add_attachment" style="font-weight:normal;">
|
||||
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
|
||||
<%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn', :style => ie8? ? 'display:none' : '' %>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
:class => ie8? ? '' : 'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this);',
|
||||
:style => 'display:none',
|
||||
:style => ie8? ? '' : 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= labelled_form_for @bid do |f| %>
|
||||
<%= labelled_form_for @bid,:html => { :multipart => true } do |f| %>
|
||||
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %>
|
||||
<% end %>
|
|
@ -1,9 +1,8 @@
|
|||
<% if @statue == 1%>
|
||||
alert('启动成功');
|
||||
$("#<%= @bid.id %>_start_anonymous_comment").remove();
|
||||
$("#<%= @bid.id %>_anonymous_comment").append('<%= link_to "关闭匿评", alert_anonymous_comment_bid_path(@bid), remote: true, id:"#{@bid.id}_stop_anonymous_comment" %>');
|
||||
$("#<%= @bid.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_bid_path(@bid), remote: true, id:"#{@bid.id}_stop_anonymous_comment",:class => "fr mr10 work_edit")%>');
|
||||
<% elsif @statue == 2 %>
|
||||
alert('启动失败\n作业总数大于等于2份时才能启动匿评');
|
||||
<% elsif @statue == 3%>
|
||||
alert("已开启匿评,请务重复开启");
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -1,2 +1,2 @@
|
|||
alert('关闭成功');
|
||||
$("#<%= @bid.id %>_anonymous_comment").html('<a href="javascript:" style="background:#8e8e8e;">匿评结束</a>');
|
||||
$("#<%= @bid.id %>_stop_anonymous_comment").replaceWith('<a class="fr pr_join_span mr10 span_wping_background" title="匿评结束">匿评结束</a>');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% @members.each do |member| %>
|
||||
<li >
|
||||
<%= link_to_user_header member.principal,false,:class => "w150 c_orange fl" %>
|
||||
<%= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %>
|
||||
<span class="w150 fl">
|
||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
||||
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
|
||||
<%= labelled_form_for @homework, :html => { :multipart => true }, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
|
||||
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid",:f => f,:edit_mode => false } %>
|
||||
<% end %>
|
|
@ -22,10 +22,10 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" type="button"><%= l(:label_browse)%></button>
|
||||
<button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" style="<%= ie8? ? 'display:none' : ''%>" type="button" ><%= l(:label_browse) %></button>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
:class => ie8? ? '':'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this);',
|
||||
:style => ie8? ? '': 'display:none',
|
||||
|
|
|
@ -26,7 +26,10 @@
|
|||
<tr>
|
||||
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
|
||||
<span class="font_description2">
|
||||
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
|
||||
<% author = topic.last_reply.try(:author)%>
|
||||
<% if author%>
|
||||
最后回复:<%=link_to_user author %>
|
||||
<% end%>
|
||||
</span>
|
||||
<br />
|
||||
</span></td>
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
<div class="N_con">
|
||||
<%= form_for(HomeworkAttach.new, :method => :post,
|
||||
:name => 'new_form',
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'homework_attach',
|
||||
:action => 'create',
|
||||
:user_id => User.current.id,
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
<ul style="padding:0 0; margin:0 0;display:inline;">
|
||||
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;" class="loggedas_li">
|
||||
<%=link_to_user(User.current)%>
|
||||
<% hidden_non_project = Setting.find_by_name("hidden_non_project")
|
||||
visiable = hidden_non_project && hidden_non_project.value == "0"%>
|
||||
<ul class="sub_menu">
|
||||
<% if @show_course == 1 %>
|
||||
<% if @show_course == 1 && !visiable %>
|
||||
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
|
||||
<% hasCourse=false %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<div class="sidebar-forums">
|
||||
<div class="forums-line">
|
||||
<div class="forums-title"><%= @forum.name %></div>
|
||||
<div class="forums-description"><%= @forum.description %></div>
|
||||
<div class="forums-description"><%= @forum.description.html_safe %></div>
|
||||
</div>
|
||||
<!--informations-->
|
||||
<div class="formus-first-title" >创建人信息</div>
|
||||
|
|
|
@ -32,8 +32,10 @@
|
|||
padding-left: 5px !important;
|
||||
padding-right: 5px !important;
|
||||
line-height: 1.9;
|
||||
float: left;
|
||||
}
|
||||
.span_wping a:hover{ background-color:#03a1b3;}
|
||||
.span_wping_background{background: #CCC !important;}
|
||||
</style>
|
||||
</head>
|
||||
<body class="<%= h body_css_classes %>">
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<div class="sidebar-forums">
|
||||
<div class="forums-line">
|
||||
<div class="forums-title"><%= @forum.name %></div>
|
||||
<div class="forums-description"><%= @forum.description %></div>
|
||||
<div class="forums-description"><%= @forum.description.html_safe %></div>
|
||||
</div>
|
||||
<!--informations-->
|
||||
<div class="formus-first-title" >创建人信息</div>
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
<%= f.text_area 'user_introduction', :rows => 3,
|
||||
:cols => 65,
|
||||
:placeholder => "#{l(:label_my_brief_introduction)}",
|
||||
:maxlength => 200,
|
||||
:style => "resize: none;",
|
||||
:class => 'noline'%>
|
||||
</td>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<%=h @memo.subject %>
|
||||
</div>
|
||||
<div class="memo-content" id="memo-content_div">
|
||||
<%= textAreailizable(@memo,:content) %>
|
||||
<%= @memo.content.html_safe %>
|
||||
<p>
|
||||
<% if @memo.attachments.any?%>
|
||||
<% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<h3><%= 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;"%>
|
||||
<div class="clear"></div>
|
||||
|
||||
<%= render_tabs administration_settings_tabs %>
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<% if @notifiable.value == "0"%>
|
||||
$("#hidden_non_project").replaceWith("<%= escape_javascript(link_to '显示非项目信息',settings_hidden_non_project_path,:id => 'hidden_non_project',:style => 'float: right;margin-right: 60px;margin-top: 9px;', :remote => true)%>");
|
||||
<% else%>
|
||||
$("#hidden_non_project").replaceWith("<%= escape_javascript(link_to '隐藏非项目信息',settings_hidden_non_project_path,:id => 'hidden_non_project',:style => 'float: right;margin-right: 60px;margin-top: 9px;', :remote => true)%>");
|
||||
<% end%>
|
|
@ -1,6 +1,9 @@
|
|||
|
||||
<%hidden_non_project = Setting.find_by_name("hidden_non_project")
|
||||
visiable = hidden_non_project && hidden_non_project.value == "0"%>
|
||||
<% unless visiable%>
|
||||
<div class="linkother" style="margin-left: 30%; float: left">
|
||||
<a href="http://<%= Setting.host_name%>" class="link_other_item"><%=l(:label_projects_management_platform)%></a>
|
||||
<a href="http://<%= Setting.host_course%>" class="link_other_item"><%=l(:label_courses_management_platform)%></a>
|
||||
<a href="http://<%= Setting.host_contest%>" class="link_other_item"><%=l(:label_contests_management_platform)%></a>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
|
@ -1988,4 +1988,6 @@ zh:
|
|||
modal_valid_unpassing: 该分班已经存在
|
||||
|
||||
mail_footer: 点击修改邮件发送设置
|
||||
label_show_non_project: 显示非项目信息
|
||||
label_hidden_non_project: 隐藏非项目信息
|
||||
|
||||
|
|
|
@ -736,6 +736,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'settings', :controller => 'settings', :action => 'index', :via => :get
|
||||
match 'settings/edit', :via => [:get, :post]
|
||||
match 'settings/plugin/:id', :to => 'settings#plugin', :via => [:get, :post], :as => 'plugin_settings'
|
||||
match 'settings/hidden_non_project', :via => [:get, :post]
|
||||
|
||||
match 'sys/projects', :via => :get
|
||||
match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
|
||||
|
|
|
@ -266,6 +266,8 @@ repository_domain:
|
|||
default: repository.trustie.net
|
||||
please_chose:
|
||||
default: 请选择
|
||||
hidden_non_project:
|
||||
default: 1
|
||||
plugin_redmine_ckeditor:
|
||||
serialized: true
|
||||
default: --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
||||
|
|
|
@ -195,7 +195,8 @@ function addInputFiles(inputEl) {
|
|||
var aFilename = inputEl.value.split(/\/|\\/);
|
||||
attachmentId = addFile(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false);
|
||||
if (attachmentId) {
|
||||
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]', style: 'display:none;' }).appendTo('#attachments_' + attachmentId);
|
||||
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]'}).hide();
|
||||
$('#upload_file_count').html("已上传"+"<span id=\"count\">"+1+"</span>"+"个文件");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ a:hover.tijiao{ background:#0f99a9;}
|
|||
.members_left ul li a{ float:left; text-align:center;}
|
||||
.members_left ul li span{ float:left; text-align:center; color:#484747;}
|
||||
|
||||
.w150{ text-align:center; width:150px;}
|
||||
.w150{ text-align:center; width:150px;min-height: 10px;}
|
||||
.f_b{ font-weight: bold;}
|
||||
.members_right label{ margin-left:15px;}
|
||||
.N_search{ height:20px; border:1px solid #999;}
|
||||
|
|
Loading…
Reference in New Issue