This commit is contained in:
whimlex 2015-04-23 16:13:19 +08:00
commit b5781ac22b
19 changed files with 74 additions and 65 deletions

View File

@ -42,12 +42,19 @@ class BoardsController < ApplicationController
elsif @course
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
@boards = @course.boards.includes(:last_message => :author).all
@boards = [] << @boards[0] if @boards.any?
if @boards.size == 1
@board = @boards.first
show and return
if @course.boards.empty?
@board = @course.boards.build
@board.name = " #{l(:label_borad_course) }"
@board.description = @course.name.to_s
@board.project_id = -1
if @board.save
@boards = @course.boards.includes(:last_message => :author).all
end
end
render :layout => 'base_courses'
if @boards.size == 1
@board = @course.boards.first
end
show and return
else
render_403
end
@ -65,7 +72,7 @@ class BoardsController < ApplicationController
'replies' => "#{Message.table_name}.replies_count",
'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
@topic_count = @board.topics.count
@topic_count = @board ? @board.topics.count : 0
if @project
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@topics = @board.topics.
@ -77,14 +84,13 @@ class BoardsController < ApplicationController
preload(:author, {:last_reply => :author}).
all
elsif @course
board_topics = @board.topics.
reorder("#{Message.table_name}.sticky DESC").
board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC").
includes(:last_reply).
# limit(@topic_pages.per_page).
# offset(@topic_pages.offset).
order(sort_clause).
preload(:author, {:last_reply => :author}).
all
all : []
@topics = paginateHelper board_topics,10
end

View File

@ -81,9 +81,10 @@ class WordsController < ApplicationController
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
if @journal_destroyed.jour_type == "Bid"
@bid = Bid.find(@journal_destroyed.jour_id)
end
if @bid
@jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
elsif @journal_destroyed.jour_type == "Course"
@course = Course.find @journal_destroyed.jour_id
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
end
respond_to do |format|
format.js

View File

@ -633,7 +633,7 @@ module ApplicationHelper
def principals_check_box_tags_li(name, principals)
s = ''
principals.each do |principal|
s << "<li>#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id), :class => "c_blue" }</li>\n"
s << "<li>#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id) }</li>\n"
end
s.html_safe
end

View File

@ -32,7 +32,7 @@ module MembersHelper
#获取项目可邀请的成员列表
def render_project_members project
if params[:q] && params[:q] != ""
if params[:q] && params[:q].lstrip.rstrip != ""
scope = Principal.active.sorted.not_member_of(project).like(params[:q])
else
scope = []
@ -48,7 +48,7 @@ module MembersHelper
# add by nwb
# 课程可添加的成员列表
def render_principals_for_new_course_members(course)
if params[:q] && params[:q] != ""
if params[:q] && params[:q].lstrip.rstrip != ""
scope = Principal.active.sorted.not_member_of_course(course).like(params[:q])
else
scope = []
@ -63,19 +63,6 @@ module MembersHelper
s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links")
end
# 项目配置中添加成员列表
def render_principals_for_new_project_members(project)
scope = Principal.active.sorted.not_member_of(project).like(params[:q])
principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true) {|text, parameters, options|
link_to text, appliedproject_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
}
s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links")
end
# 新申请加入项目成员列表
def render_principals_for_applied_members_new project
scope = project.applied_projects.map(&:user)

View File

@ -1,5 +1,5 @@
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生姓名、学号进行搜索'%>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生昵称、姓名、学号进行搜索'%>
<% if @group %>
<%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
<input type="hidden" name="ingroup">

View File

@ -17,11 +17,12 @@
<p style="color: #ff0000">
(<%= l(:label_memos_max_length) %>)
</p>
<p>
<p class="fl" style="margin-top: 5px;">
<%= l(:label_attachment_plural) %>
<br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>
<div class="cl"></div>
<%= f.submit :value => l(:label_memo_create) %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %>
</div>

View File

@ -18,8 +18,8 @@
<% if User.current.logged? -%>
<li id="current_user_li">
<%= link_to_user_header(User.current,false,:class =>'parent')%>
<ul id="user_sub_menu">
<%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.user_domain}, :class => "uses_name"%>
<ul id="user_sub_menu" style="right: 0px;display: none;">
<% 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}, :class => "parent" %>

View File

@ -132,12 +132,12 @@
</div>
<div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{@course.boards[0].topics.count})", course_boards_path(@course), :class => "subnav_num c_orange" %>
<%= link_to( "+#{l(:label_message_new)}", new_board_message_path(@course.boards[0]), :class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) %>
<%= link_to "(#{@course.boards.first ? @course.boards.first.topics.count : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
<%= link_to( "+#{l(:label_message_new)}", new_board_message_path(@course.boards.first), :class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) && @course.boards.first %>
</div>
<div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange" %>
<%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange", :id => "course_jour_count"%>
</div>
<div class="subNav">
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02"%>

View File

@ -9,10 +9,12 @@
<!-- <p> < %= f.text_area :content, :required => true, :size => "75%", :resize => "none", id: 'editor01' %> </p> -->
<%= f.kindeditor :content, :cols => 80, :rows => 15, :value => @content %>
<!--<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> -->
<p>
<div class="cl" style="padding-top: 10px;"></div>
<p style="float: left;margin-top: 6px;">
<%= l(:label_attachment_plural) %>
<br />
<%= render :partial => 'attachments/form' %>
</p>
<div class="cl"></div>
<%= f.submit value: l(:label_reply_plural), class: "replies" %>
<% end %>

View File

@ -7,10 +7,10 @@
<!--<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> -->
<br/>
<p>
<p style="margin-right: 10px;" class="fl">
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>
<%= f.submit :value => l(:label_memo_create) %> <%= link_to l(:button_back), forum_path(@forum) %>
<%= f.submit :value => l(:label_memo_create), :style => "margin-left: 100px;"%> <%= link_to l(:button_back), forum_path(@forum) %>
</div>
<% end %>

View File

@ -8,8 +8,8 @@
<%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %>
</div>
<div class="talk_txt fl">
<p class="problem_tit fl fb" >
<%= link_to @topic.subject, course_boards_path(@topic.course),title: @topic.subject.to_s %>
<p class="problem_tit fl fb c_blue" >
<%= @topic.subject %>
</p>
<br/>
<p>

View File

@ -12,19 +12,19 @@
<div class="members_left">
<% if members.any? %>
<ul style=" border-bottom:none;">
<li><span class="w90 f_b" ><%= l(:label_user) %></span><span class="w210 f_b"><%= l(:label_role_plural) %></span><span></span></li>
<li><span class="w140_h f_b" ><%= l(:label_user) %></span><span class="w180_h f_b"><%= l(:label_role_plural) %></span><span></span></li>
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
<% members.each do |member| %>
<li >
<%= link_to_user_header member.principal,false,:class => "w90 c_orange fl" %>
<span class="w210 fl">
<%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %>
<span class="w180_h fl">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
) do |f| %>
<% roles.each do |role| %>
<ul class="ml80" style="text-align: left;" >
<ul style="text-align: left;" >
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
<label ><%= h role %></label>
@ -32,7 +32,7 @@
<!--<br/>-->
<% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<div class="ml80">
<div>
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
<%= l(:button_change)%>
</a>
@ -43,10 +43,10 @@
<% end %>
</span>
<% unless member.user_id == @project.user_id %>
<a href="javascript:void(0) " class="c_dblue ml15 fl" onclick="$('#member-<%= member.id%>-roles-form').show();$(this).parent().height(110);">编辑</a>
<a href="javascript:void(0) " class="c_setting_blue ml30 fl" onclick="$('#member-<%= member.id%>-roles-form').show();$(this).parent().height(110);">编辑</a>
<%= delete_link membership_path(member),
:remote => true,
:class => "c_dblue ml30 fl",
:class => "c_setting_blue ml15 fl",
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_for_project_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %>
<% end%>
</li>

View File

@ -19,9 +19,9 @@
<td class="w150"> </td>
</tr>
<% @project.repositories.sort.each do |repository| %>
<tr class="pro_table_on">
<tr class="<%= cycle 'pro_table_on', '' %>">
<td><a href="javascript:viod(0)" title="<%= repository.identifier %>">
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?), :class =>"c_blue" %></a></td>
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %></a></td>
<td> <%= checked_image repository.is_default? %></td>
<td><%=h repository.scm_name %></td>
<%if repository.scm_name=="Git"%>

View File

@ -18,15 +18,15 @@
<td class="w150"></td>
</tr>
<% for version in @project.shared_versions.sort %>
<tr class="pro_table_on">
<td >
<tr class="<%= cycle 'pro_table_on', '' %>">
<td class="tl">
<a class="c_blue02"><%= 'shared' if version.project != @project %> <%= link_to_version version %></a>
</td>
<td class="description"><%= format_date(version.effective_date) %></td>
<td class="description" style="word-break:break-all;"><%=h version.description %></td>
<td class="description tl" style="word-break:break-all;"><%=h version.description %></td>
<td class="status"><%= l("version_status_#{version.status}") %></td>
<td class="sharing"><%=h format_version_sharing(version.sharing) %></td>
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="">
<td class="tl" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="">
<%= link_to_if_authorized(h(truncate(version.wiki_page_title,:length=>20)), {:controller => 'wiki',
:action => 'show',
:project_id => version.project,

View File

@ -1,5 +1,6 @@
<%= textAreailizable content, :text, :attachments => content.page.attachments,
:edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title}) %>
:edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title, :class =>"break_word_firefox"})
%>
<%#= content.text.html_safe %>

View File

@ -1,8 +1,10 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%>
<% if @jours_count %>
<% if @bid && @@jours_count %>
$('#jours_count').html("<%= @jours_count %>");
<% elsif @course && @jours_count%>
$('#course_jour_count').html("(<%= @jours_count %>)");
<% end %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){

View File

@ -734,7 +734,7 @@ div.actions input[type="text"] {
.replies {
overflow: hidden;
max-width: 100%;
float: right;
float: left;
/*max-width: 90%;*/
}

View File

@ -55,6 +55,9 @@ a:hover.btn_free{ background:#d63502;}
a.invi_search_btn{ background:#15bccf; color:#fff; text-align: center; width:40px; height:22px;border:1px solid #15bccf; padding-top:2px; cursor:pointer;}
a:hover.invi_search_btn{ background:#0da1b2; border:1px solid #0da1b2;}
.rolebox{ margin:10px 0;}
.w180_h{ width:180px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; text-align:left;}
.w140_h{ width:119px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;text-align:left; padding-left:5px;}
/*问题跟踪*/
.problem_top{ margin:10px 0 ;}
.problem_search_input{ border:1px solid #64bdd9; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:5px;}
@ -391,14 +394,14 @@ blockquote {
.box ul li{ line-height:1.9;}
.members_left{ float:left; width:410px; margin-right:20px; text-align:center;}
.members_left{}
.members_left ul li{ height:30px; border-bottom:1px solid #E4E4E4; width:410px; padding-top:10px; }
.members_left ul li a{ float:left; text-align:center;}
.members_left ul li span{ float:left; text-align:center; color:#484747;}
.members_left ul li{ height:22px; border-bottom:1px solid #E4E4E4; width:410px; padding-top:5px; }
.members_left ul li a{ float:left; text-align:left;}
.members_left ul li span{ float:left; text-align:center; color:#484747;text-align:left;}
.w150{ text-align:center; width:150px;}
.f_b{ font-weight: bold;}
.members_right{ float:left; width:240px;}
.members_right label{ margin-left:15px;}
.members_jion{ background:#f0fbff; padding:10px; height:200px; margin-bottom:10px;}
.members_jion{ background:#f0f0f0; padding:10px; height:200px; margin-bottom:10px;}
.members_add{ padding-left:10px; }
.member_search_input{ border:1px solid #15bccf; background:#fff; width:170px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:10px;}
.member_search_btn{ background:#15bccf; color:#fff; text-align: center; width:40px; height:22px;border:1px solid #15bccf; padding-top:2px; cursor:pointer;}
@ -472,6 +475,7 @@ img.ui-datepicker-trigger {
.wiki_con_tit{ font-size:14px; color:#09658c; font-weight:bold;width:630px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; margin-bottom:10px;}
.wiki_con_box{ line-height:1.9; color:#2d2d2d;}
.wiki_page_con{ border-bottom:1px dashed #CCC; margin-bottom:10px; padding-bottom:10px;}
.wiki_page p{word-break: break-all;word-wrap: break-word;}
#wiki_new_box{ display:none;}
/*wiki显示附加*/
.wiki-page {font-size: 14px;color: #09658C !important; font-weight: bold;width: 630px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;margin-bottom: 10px;}

View File

@ -105,6 +105,7 @@ a:hover.c_orange{color: #d33503;}
a.c_lorange{color:#ff9900;}
a:hover.c_lorange{color:#fff;}
a.c_blue{ color:#15bccf;}
a.c_setting_blue{color: #0781B4}
a.c_dblue{ color:#09658c;}
a:hover.c_dblue{ color:#15bccf;}
a.c_white{ color:#fff;}
@ -214,14 +215,15 @@ div#menu {height:41px; font-size:14px; font-weight:bold; }
div#menu ul {float: left;}
div#menu ul.menu { padding-left: 30px; }
div#menu li {position: relative; z-index: 9; margin: 0; display: block; float: left; }
div#menu li:hover>ul { left: -2px;}
/*div#menu li:hover>ul { right: 5px;}*/
div#menu a {position: relative;z-index: 10; height: 41px; display: block; float: left;line-height: 41px; text-decoration: none; font-size:14px; }
div#menu a:hover, div#menu a:hover span { color: #a1ebff; }
div#menu li.current a {}
div#menu {display: block; cursor: pointer; background-repeat: no-repeat;background-position: 95% 0;padding-right: 15px; _padding-right: 20px;}
div#menu ul a.parent {background: url(../images/item.png) -20px -30px no-repeat; width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
div#menu ul a.parent:hover {background: url(../images/item.png) -20px -60px no-repeat;}
div#menu ul ul a.parent {background: url(../images/item.png) -20px 6px no-repeat;}
div#menu ul a.user_name { width:170px; text-align:right; margin:0; }
.pic_triangle{background: url(../images/item.png) -90px -48px no-repeat; float:right; display:block; width:10px; height:10px; margin-top:12px; margin-left:7px;}
.pic_triangle:hover{background: url(../images/item.png) -90px -78px no-repeat; }
div#menu ul ul a.parent {background: url(../images/item.png) -20px 6px no-repeat;width:60px;}
div#menu ul ul a.parent:hover {background: url(../images/item.png) -20px -11px no-repeat;}
/* menu::level1 */
div#menu a { padding: 5px 12px 0 10px;line-height: 30px; color: #fff;}
@ -229,13 +231,13 @@ div#menu a { padding: 5px 12px 0 10px;line-height: 30px; color: #fff;}
div#menu li.last { background: none; }
/* menu::level2 */
div#menu ul ul li { background: none; }
div#menu ul ul { position: absolute;top: 38px; left: -999em; width: 90px; padding: 5px 0 0 0; background:#fff; border:1px solid #15bccf; margin-top:1px;}
div#menu ul ul { position: absolute;top: 38px; width: 90px; padding: 5px 0 0 0; background:#fff; border:1px solid #15bccf; margin-top:1px;}
div#menu ul ul a {padding: 0 0 0 15px; height: auto; float: none;display: block; line-height: 24px; font-size:12px; font-weight:normal;color:#15bccf;}
div#menu ul ul a:hover { color:#ff9900;}
div#menu ul ul li.last { margin-left:15px; }
div#menu ul ul li {width: 100%;}
/* menu::level3 */
div#menu ul ul ul {padding: 0;margin: -38px 0 0 92px !important; width:200px; }
div#menu ul ul ul {padding: 0;margin: -38px 0 0 90px !important; width:200px; }
div#menu ul ul ul li a{ width:185px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf;}
/*主类容*/
@ -289,6 +291,7 @@ a.close_btn {background-position:-44px 0;}
a:hover.close_btn {background-position:-66px 0;}
.show_btn {background-position:-119px 0;}
.msgserver a {color:#15bccf; }
.msgserver a:hover { text-decoration:underline; }
.hiddent{ overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
@ -410,3 +413,5 @@ div.flash.warning, .conflict {
a.box_close{ display:block; float:right; width:16px; height:16px; background:url(../images/img_floatbox.png) 0 0 no-repeat;}
a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;}
/*文本左对齐*/
.tl{text-align: left;}