This commit is contained in:
sw 2015-05-08 09:55:00 +08:00
commit 78f30344b9
30 changed files with 3491 additions and 3478 deletions

View File

@ -0,0 +1,42 @@
class DiscussDemosController < ApplicationController
def index
@discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10)
end
def new
@discuss_demo = DiscussDemo.create
@discuss_demo.save!
@discuss_demo
end
def create
end
def update
@discuss_demo = DiscussDemo.find(params[:id])
@discuss_demo.update_attributes(:title => params[:discuss_demo][:title],:body => params[:discuss_demo][:body])
redirect_to :controller=> 'discuss_demos',:action => 'show',:id => params[:id]
end
def delete
end
def destroy
asset = Kindeditor::Asset.find_by_owner_id(params[:id])
if !asset.nil?
filepath = File.join(Rails.root,"public","files","uploads",
asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s,
asset[:asset].to_s)
File.delete(filepath) if File.exist?filepath
end
DiscussDemo.destroy(params[:id])
redirect_to :controller=> 'discuss_demos',:action => 'index'
end
def show
@discuss_demo = DiscussDemo.find(params[:id])
end
end

View File

@ -86,7 +86,7 @@ class CoursesService
gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender
work_unit = get_user_work_unit m.user work_unit = get_user_work_unit m.user
location = get_user_location m.user location = get_user_location m.user
users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender, :work_unit => work_unit, :mail => m.user.mail, :location => location, :brief_introduction => m.user.user_extensions.brief_introduction} users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender, :work_unit => work_unit, :mail => m.user.mail, :location => location, :brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname}
end end
users users
end end

View File

@ -44,17 +44,15 @@
<br/> <br/>
<p>
<p class="break_word" id="contentmessage<%=topic.id %>"> <div id="contentmessage<%=topic.id %>" class="project_board_content">
<%= topic.content %> </p> <%= topic.content %>
<div class="lg-foot" style="display: block" id="lg-foot<%= topic.id %>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');"> </div>
<label id="expend_more_information<%= topic.id%>" value="show_more"><%= l(:label_expend_information)%></label> <label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down"> <span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" /> <img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span> </span>
</div> </p>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %> <%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div> </div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %> <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
@ -143,7 +141,7 @@
<% end %> <% end %>
</ul> </ul>
</div> </div>
<div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div> <div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%= topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %> <% end %>
</div> </div>

View File

@ -1,5 +1,4 @@
<div class="project_r_h" xmlns="http://www.w3.org/1999/html">
<div class="project_r_h">
<h2 class="project_h2 fl"> <h2 class="project_h2 fl">
<% if User.current.language == "zh"%> <% if User.current.language == "zh"%>
<%= h @board.name %> <%= h @board.name %>
@ -43,17 +42,18 @@
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a> <a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a>
<% end %> <% end %>
<div class="cl"></div>
<br/> <p id="contentmessage<%=topic.id %>" class="project_board_content">
<%= topic.content %>
<p class="break_word" id="contentmessage<%=topic.id %>"> </p> <p>
<%= topic.content %> </p> <label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<div class="lg-foot" style="display: block" id="lg-foot<%= topic.id %>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');">
<label id="expend_more_information<%= topic.id%>" value="show_more"><%= l(:label_expend_information)%></label>
<span class="g-arr-down"> <span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" /> <img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span> </span>
</div>
</p>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %> <%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
@ -144,7 +144,7 @@
<% end %> <% end %>
</ul> </ul>
</div> </div>
<div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div> <div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %> <% end %>
</div> </div>
@ -166,6 +166,7 @@
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
<% end %> <% end %>
</div>
<script type="text/javascript"> <script type="text/javascript">
// var flag = false; // var flag = false;
// jQuery(document).ready(function($) { // jQuery(document).ready(function($) {

View File

@ -23,99 +23,15 @@
</script> </script>
<script type="text/javascript">//侧导航 <script type="text/javascript">//侧导航
$(function(){
$(".subNav").click(function(){
$(this).toggleClass("currentDd").siblings(".subNav").removeClass("currentDd")
$(this).toggleClass("currentDt").siblings(".subNav").removeClass("currentDt")
// 修改数字控制速度, slideUp(500)控制卷起速度
$(this).next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
})
})
function show_more_msg()
{
$("#course_description").toggleClass("course_description_none");
}
function show_more_msg02()
{
$("#news_description").toggleClass("news_description_none");
}
function show_newtalk() function show_newtalk()
{ {
$("#about_newtalk").toggle(); $("#about_newtalk").toggle();
} }
function show_newreply()
{
$("#replyContent").toggle();
}
function show_more() {
$("#contentmessage").toggleClass("course_description_none");
var information = $("#expend_more_information2");
var arrow = $("#arrow2");
var val = information.attr("value");
if (val == "show_more") {
$("#expend_more_information2").text("收起");
information.attr("value", "hide_more");
arrow.attr("src", "/images/jiantouup.jpg")
}
else {
$("#expend_more_information2").text("展开");
information.attr("value", "show_more");
arrow.attr("src", "/images/jiantou.jpg")
}
}
function regexContent()
{
var content = $.trim($("#message_content").val());
if(content.length ==0)
{
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
$("#message_content_span").css('color','#ff0000');
flag = false;
}
else
{
$("#message_content_span").text("<%= l(:label_field_correct) %>");
$("#message_content_span").css('color','#008000');
flag = true;
}
}
function regexSubject()
{
var content = $.trim($("#message_subject").val());
if(content.length ==0)
{
$("#subject_span").text("主题不能为空");
$("#subject_span").css('color','#ff0000');
return false;
}
else
{
$("#subject_span").text("填写正确");
$("#subject_span").css('color','#008000');
return true;
}
return false;
}
function regexContent()
{
var content = message_content_editor.html();
if(content.length ==0)
{
$("#message_content_span").text("描述不能为空");
$("#message_content_span").css('color','#ff0000');
return false;
}
else
{
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color','#008000');
return true;
}
return false;
}
</script> </script>
<% if @project %> <% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %> <%= render :partial => 'project_show', locals: {project: @project} %>

View File

@ -46,7 +46,7 @@
<% end %><!--meny end --> <% end %><!--meny end -->
<!-- more --> <!-- more -->
<div class="subNav subNav_jiantou" onclick="expand_tools_expand();" id="expand_tools_expand"><%= l(:label_project_more) %></div> <div class="subNav subNav_jiantou" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent"> <ul class="navContent" id="navContent">
<%= render 'projects/tools_expand' %> <%= render 'projects/tools_expand' %>
</ul> </ul>

View File

@ -157,8 +157,8 @@
<!--邀请加入--> <!--邀请加入-->
<div class="subNavBox"> <div class="subNavBox">
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" onclick="expand_tools_expand('invit');"><%= l(:label_invite)%></div> <div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" onclick="$('#navContent_invit').toggle(500);"><%= l(:label_invite)%></div>
<ul class="navContent " style="display:block"> <ul class="navContent " style="display:block" id="navContent_invit">
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li> <li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
<% if User.current.allowed_to?(:manage_members, @project) %> <% if User.current.allowed_to?(:manage_members, @project) %>
<li><%= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li> <li><%= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li>

View File

@ -34,7 +34,17 @@
<% roles.each do |role| %> <% roles.each do |role| %>
<li class="fl mr5"> <li class="fl mr5">
<%= check_box_tag 'membership[role_ids][]', role.id %> <%= check_box_tag 'membership[role_ids][]', role.id %>
<%= h role %> <% if User.current.language == "zh" %>
<% if role.id == 3 %>
<label >管理人员</label>
<% elsif role.id == 4 %>
<label >开发人员</label>
<% else %>
<label >报告人员</label>
<% end %>
<% else %>
<label ><%= h role %></label>
<% end %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -2,7 +2,12 @@
<% <%
roles = Role.givable.all roles = Role.givable.all
if @project.project_type == Project::ProjectType_course if @project.project_type == Project::ProjectType_course
roles = roles[3..5] if User.current.language == "zh"
roles = ["管理人员","开发者","报告人员"]
else
roles = ["管理人员","开发者","报告人员"]
# roles = roles[3..5]
end
else else
roles = roles[0..2] roles = roles[0..2]
end end
@ -18,7 +23,23 @@
<li > <li >
<%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %> <%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %>
<span class="w180_h fl"> <span class="w180_h fl">
<!--区分中英文角色显示的不同-->
<% if User.current.language == "zh" %>
<% zh_roles = [] %>
<% member.roles.each do |role| %>
<% if role.id == 3
zh_roles << "管理人员"
elsif role.id == 4
zh_roles << "开发人员"
else
zh_roles << "报告人员"
end
%>
<% end %>
<%= h zh_roles.sort.reverse.collect(&:to_s).join(', ') %>
<% else %>
<%= h member.roles.sort.collect(&:to_s).join(', ') %> <%= h member.roles.sort.collect(&:to_s).join(', ') %>
<% end %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member), <%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put, :method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}} :html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
@ -27,7 +48,18 @@
<ul style="text-align: left;" > <ul style="text-align: left;" >
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), <%= 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? } %> :disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
<!--编辑时候显示成员,中英文切换后面需从数据库的角度优化-->
<% if User.current.language == "zh" %>
<% if role.id == 3 %>
<label >管理人员</label>
<% elsif role.id == 4 %>
<label >开发人员</label>
<% else %>
<label >报告人员</label>
<% end %>
<% else %>
<label ><%= h role %></label> <label ><%= h role %></label>
<% end %>
</ul> </ul>
<!--<br/>--> <!--<br/>-->
<% end %> <% end %>
@ -107,7 +139,17 @@
<% roles.each do |role| %> <% roles.each do |role| %>
<li> <li>
<%= check_box_tag 'membership[role_ids][]', role.id %> <%= check_box_tag 'membership[role_ids][]', role.id %>
<% if User.current.language == "zh" %>
<% if role.id == 3 %>
<label >管理人员</label>
<% elsif role.id == 4 %>
<label >开发人员</label>
<% else %>
<label >报告人员</label>
<% end %>
<% else %>
<label ><%= h role %></label> <label ><%= h role %></label>
<% end %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -33,9 +33,10 @@ function expand_tools_expand(content) {
$("#expand_tools_expand_invit").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500); $("#expand_tools_expand_invit").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
} }
else { else {
$("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd"); // $("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd");
$("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt"); // $("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
$("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500); // $("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
$("#navContent").toggle(500);
} }
// 修改数字控制速度, slideUp(500)控制卷起速度 // 修改数字控制速度, slideUp(500)控制卷起速度
@ -64,12 +65,12 @@ function show_more_reply(contentid, id2, id3) {
var arrow = $(id3); var arrow = $(id3);
var val = information.attr("value"); var val = information.attr("value");
if (val == "show_more") { if (val == "show_more") {
$(id2).text("收起"); $(id2).text("[收起]");
information.attr("value", "hide_more"); information.attr("value", "hide_more");
arrow.attr("src", "/images/jiantouup.jpg") arrow.attr("src", "/images/jiantouup.jpg")
} }
else { else {
$(id2).text("展开更多信息"); $(id2).text("[展开]");
information.attr("value", "show_more"); information.attr("value", "show_more");
arrow.attr("src", "/images/jiantou.jpg") arrow.attr("src", "/images/jiantou.jpg")
} }
@ -99,7 +100,7 @@ function showhelpAndScrollTo(id) {
information.attr("value", "show_help"); information.attr("value", "show_help");
} }
} }
function showhelpAndScrollToMessage(id, id1) { function showhelpAndScrollToMessage(id, id1, count) {
$('#' + id).toggle(); $('#' + id).toggle();
if(cookieget("repositories_visiable") == "true") if(cookieget("repositories_visiable") == "true")
{ {
@ -113,12 +114,12 @@ function showhelpAndScrollToMessage(id, id1) {
var val = information.attr("value"); var val = information.attr("value");
if(val=="show_help") if(val=="show_help")
{ {
$(id1).text("收起回复"); $(id1).text("收起回复(" + count + ")" );
information.attr("value", "hide_help"); information.attr("value", "hide_help");
} }
else else
{ {
$(id1).text("展开回复"); $(id1).text("展开回复(" + count + ")");
information.attr("value", "show_help"); information.attr("value", "show_help");
} }
} }

View File

@ -534,7 +534,7 @@ a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; pa
.w664{ width:664px;} .w664{ width:664px;}
.w140{ width:140px;} .w140{ width:140px;}
.talklist_box{ } .talklist_box{ }
.talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; padding-bottom:20px; margin-bottom:20px;} .talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; margin-bottom:20px; margin-top: 10px;}
.talkmain_pic{} .talkmain_pic{}
a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;} a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;}
a:hover.talkmain_pic{border:1px solid #64bdd9;} a:hover.talkmain_pic{border:1px solid #64bdd9;}
@ -576,3 +576,4 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}

View File

@ -49,6 +49,7 @@ a:hover.subnav_green{ background:#14ad5a;}
/*简介*/ /*简介*/
.project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;}
.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} .course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;}
.project_board_content{overflow: hidden;max-height: 50px;word-break: break-all;word-wrap: break-word;}
.course_description_none{max-height: none;} .course_description_none{max-height: none;}
.lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;}
.lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;}

View File

@ -697,7 +697,7 @@ tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png);
.w664{ width:664px;} .w664{ width:664px;}
.w140{ width:140px;} .w140{ width:140px;}
.talklist_box{ } .talklist_box{ }
.talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; padding-bottom:20px; margin-bottom:20px;} .talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; margin-bottom:20px; margin-top: 10px;}
.talkmain_pic{} .talkmain_pic{}
a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;} a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;}
a:hover.talkmain_pic{border:1px solid #64bdd9;} a:hover.talkmain_pic{border:1px solid #64bdd9;}
@ -726,3 +726,4 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
.newtalk { margin-top:8px; margin-right:8px;} .newtalk { margin-top:8px; margin-right:8px;}
.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;} .talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;}
#about_newtalk{ display:none;} #about_newtalk{ display:none;}