This commit is contained in:
huang 2015-03-18 15:50:34 +08:00
commit 4ae5e2af7c
14 changed files with 172 additions and 63 deletions

View File

@ -1,5 +1,6 @@
class DiscussDemosController < ApplicationController class DiscussDemosController < ApplicationController
def index def index
@discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10) @discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10)
end end
@ -24,7 +25,12 @@ class DiscussDemosController < ApplicationController
end end
def destroy def destroy
DiscussDemo.delete_all(["id = ?",params[:id]]) asset = Kindeditor::Asset.find_by_owner_id(params[:id])
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
DiscussDemo.destroy(params[:id])
redirect_to :controller=> 'discuss_demos',:action => 'index' redirect_to :controller=> 'discuss_demos',:action => 'index'
end end

View File

@ -20,7 +20,7 @@ class WelcomeController < ApplicationController
include WelcomeHelper include WelcomeHelper
helper :project_score helper :project_score
caches_action :robots caches_action :robots
before_filter :find_first_page, :only => [:index] #before_filter :find_first_page, :only => [:index]
# before_filter :fake, :only => [:index, :course] # before_filter :fake, :only => [:index, :course]
before_filter :entry_select, :only => [:index] before_filter :entry_select, :only => [:index]

View File

@ -1,4 +1,4 @@
class DiscussDemo < ActiveRecord::Base class DiscussDemo < ActiveRecord::Base
attr_accessible :title, :body attr_accessible :title, :body
has_many_kindeditor_assets :attachments, :dependent => :destroy has_many_kindeditor_assets :assets, :dependent => :destroy
end end

View File

@ -1,7 +1,7 @@
<% attachmenttypes = @project.attachmenttypes %> <% attachmenttypes = @project.attachmenttypes %>
<% sufixtypes = @project.contenttypes %> <% sufixtypes = @project.contenttypes %>
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2">资源共享区</h2> <h2 class="project_h2"><%= l(:lable_file_sharingarea) %></h2>
</div> </div>
<div class="content-title-top"> <div class="content-title-top">
@ -16,12 +16,12 @@
</div> </div>
<div id="relation_file_div" class="relation_file_div hidden"> <div id="relation_file_div" class="relation_file_div hidden">
<fieldset> <fieldset>
<legend>搜索</legend> <legend><%= l(:label_search)%></legend>
<%= form_tag( <%= form_tag(
attachments_autocomplete_path(:format => 'js'), attachments_autocomplete_path(:format => 'js'),
:remote => true, :remote => true,
:method => :post) do %> :method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %> <%= label_tag(:attach_search, l(:label_search_by_keyword)) %>
<%= text_field_tag(:attach_search) %> <%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %> <%#= submit_tag("Search") %>
<% end -%> <% end -%>

View File

@ -3,7 +3,7 @@
<div class="well"> <div class="well">
<% next if member.new_record? %> <% next if member.new_record? %>
<% unless member.created_on.nil? %> <% unless member.created_on.nil? %>
<%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %> <%= content_tag "p", (User.current.language == ""|| User.current.language == "zh")?("#{format_date(member.created_on)}"+" "+"#{l(:label_member_since)}"):("#{l(:label_member_since)}+" "+#{format_date(member.created_on)}"), :class => "float_right member_since" %>
<% end %> <% end %>
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :class => 'avatar')) %> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :class => 'avatar')) %>
<%= content_tag "div", link_to(member.user.name, user_path(member.user)), :class => "nomargin avatar_name" %> <%= content_tag "div", link_to(member.user.name, user_path(member.user)), :class => "nomargin avatar_name" %>

View File

@ -25,7 +25,7 @@
</p></td> </p></td>
</tr> </tr>
<tr> <tr>
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %> <td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %>&nbsp;<%= format_date(user.created_on) %>
</td> </td>
</tr> </tr>
</table></td> </table></td>

View File

@ -16,8 +16,8 @@
<div class="menu"> <div class="menu">
<%= link_to "#{l(:label_course_new)}", new_course_path, class: 'icon icon-add' if @user == User.current %> <%= link_to "#{l(:label_course_new)}", new_course_path, class: 'icon icon-add' if @user == User.current %>
<ul> <ul>
<li mode='doing' class="on"><%= l(:label_course_doing)%></li> <li mode='doing' class="on"><%= l('user.courses.doing')%></li>
<li mode='end'><%= l(:label_course_done)%></li> <li mode='end'><%= l('user.courses.done')%></li>
</ul> </ul>
</div> </div>

View File

@ -189,7 +189,7 @@ en:
text_are_you_sure: Are you sure? #js 提示 text_are_you_sure: Are you sure? #js 提示
label_no_data: No data to display
# 项目、课程、用户公用 # 项目、课程、用户公用
label_settings: Settings label_settings: Settings
label_information_plural: Information label_information_plural: Information
@ -209,7 +209,8 @@ en:
label_more: "More>>" label_more: "More>>"
button_download: Download button_download: Download
button_delete: Delete button_delete: Delete
button_unfollow: Unfollow
button_follow: Follow

View File

@ -147,10 +147,7 @@ zh:
cant_link_an_issue_with_a_descendant: "问题不能关联到它的子任务" cant_link_an_issue_with_a_descendant: "问题不能关联到它的子任务"
groupname_repeat: "该班名已存在" groupname_repeat: "该班名已存在"
attachment_all: "全部"
attachment_sufix_browse: "文件类型"
attachment_browse: "内容类型"
attachment_type: '分类'
general_text_No: '否' general_text_No: '否'
general_text_Yes: '是' general_text_Yes: '是'
general_text_no: '否' general_text_no: '否'
@ -190,7 +187,10 @@ zh:
text_are_you_sure: 您确定要删除吗? #js 提示 text_are_you_sure: 您确定要删除吗? #js 提示
label_no_data: 没有任何数据可供显示
# 项目、课程、用户公用 # 项目、课程、用户公用
label_settings: 配置 label_settings: 配置
label_information_plural: 信息 label_information_plural: 信息
@ -211,8 +211,10 @@ zh:
button_download: 下载 button_download: 下载
button_more: 更多 button_more: 更多
button_delete: 删除 button_delete: 删除
button_unfollow: 取消关注
button_follow: 关注
button_watch: 跟踪
button_unwatch: 取消跟踪
# #
# Trustie上传头像模块 # Trustie上传头像模块
# #

View File

@ -340,7 +340,6 @@ en:
label_create_new_projects: Create a project label_create_new_projects: Create a project
label_work_scores_people: The total number of users given scores label_work_scores_people: The total number of users given scores
label_project_grade: Score label_project_grade: Score
label_user_for_project_grade: Score
label_relation_files: Select an existing resource label_relation_files: Select an existing resource
# Personal signature tips # Personal signature tips
@ -478,7 +477,6 @@ en:
label_text: Long text label_text: Long text
label_attribute: Attribute label_attribute: Attribute
label_attribute_plural: Attributes label_attribute_plural: Attributes
label_no_data: No data to display
label_change_status: Change status label_change_status: Change status
label_history: History label_history: History
label_attachment: Files label_attachment: Files
@ -933,9 +931,7 @@ en:
text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item." text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item."
text_applied_project: "User %{id} Apply Join Project %{project}" text_applied_project: "User %{id} Apply Join Project %{project}"
default_role_manager: Manager
default_role_developer: Developer
default_role_reporter: Reporter
default_tracker_bug: Bug default_tracker_bug: Bug
default_tracker_feature: Feature default_tracker_feature: Feature
default_tracker_support: Support default_tracker_support: Support
@ -1019,8 +1015,7 @@ en:
#end by huang #end by huang
#added by liuping #added by liuping
button_unfollow: Unfollow
button_follow: Follow
label_delete_confirm: Confirm delete label_delete_confirm: Confirm delete
label_exit_project: Exit Project label_exit_project: Exit Project
@ -1067,11 +1062,6 @@ en:
zero: Follower zero: Follower
one: Follower one: Follower
other: Followers other: Followers
#end
label_member_since: joined
label_contribute_to: Participates %{project_count} projects
#modify by men
#end #end
label_total_commit: Totally %{total_commit} commits # modified by bai label_total_commit: Totally %{total_commit} commits # modified by bai
#modify by men #modify by men
@ -1084,7 +1074,7 @@ en:
label_type_as: Type as label_type_as: Type as
label_status_as: Status as label_status_as: Status as
label_priority_as: Priority as label_priority_as: Priority as
label_member_list: Member list
label_author_name: Posted by %{author_name} label_author_name: Posted by %{author_name}
label_comments_count: (%{count} comments) label_comments_count: (%{count} comments)
label_post_on: posts on label_post_on: posts on

View File

@ -66,6 +66,38 @@ en:
label_expend_information: More Information label_expend_information: More Information
#
# 项目托管平台
#
# 项目成员
#
label_member_list: Members
label_member_since: "joined at"
label_user_for_project_grade: Score
default_role_manager: Manager
default_role_developer: Developer
default_role_reporter: Reporter
#
# 项目托管平台
#
# 关注者列表
#
label_followers: Followers
label_contribute_to: "Participates %{project_count} projects—"
#
# 项目托管平台
#
# 资源库
#
# #
# 项目托管平台 # 项目托管平台
# #
@ -80,6 +112,20 @@ en:
# #
#
# 项目托管平台
#
# 资源库
#
#
# 项目托管平台
#
# 版本库
#
# #
# 项目托管平台 # 项目托管平台
# #
@ -98,7 +144,6 @@ en:
project_module_files: Files project_module_files: Files
project_module_boards: Forums project_module_boards: Forums
# #
# 项目托管平台 # 项目托管平台
# #
@ -122,7 +167,7 @@ en:
# #
# 项目托管平台 # 项目托管平台
# #
# 新建项目 # 新建项目/项目配置 >信息
# #
label_project_new_description: "A project can be used to do anything that requires distributed collaboration." label_project_new_description: "A project can be used to do anything that requires distributed collaboration."
field_name: Name field_name: Name
@ -177,6 +222,10 @@ en:
#
# 项目托管平台
#
# 项目得分
#
label_approve: Approve label_approve: Approve
label_refusal: Refusal label_refusal: Refusal

View File

@ -38,7 +38,8 @@ zh:
label_exit_project: 退出项目 label_exit_project: 退出项目
label_apply_project_waiting: 已处理申请,请等待管理员审核 label_apply_project_waiting: 已处理申请,请等待管理员审核
label_unapply_project: 取消申请 label_unapply_project: 取消申请
lable_sure_exit_project: 是否确认退出该项目
label_member: 成员 label_member: 成员
project_module_attachments: 资源 project_module_attachments: 资源
@ -65,6 +66,81 @@ zh:
label_project_overview: "项目简介:" label_project_overview: "项目简介:"
label_expend_information: 展开更多信息 label_expend_information: 展开更多信息
#
# 项目托管平台
#
# 项目成员
#
label_member_list: 成员列表
label_member_since: "加入"
label_user_for_project_grade: 个人得分
default_role_manager: 管理人员
default_role_developer: 开发人员
default_role_reporter: 报告人员
#
# 项目托管平台
#
# 关注者列表
#
label_followers: 关注
label_contribute_to: 参与了 %{project_count} 个项目:
#
# 项目托管平台
#
# 资源库
#
lable_file_sharingarea: 资源共享区
label_upload_files: 上传文件
# 附件公用
label_relation_files: 关联已有资源
label_search_by_keyword: "按关键字搜索:"
label_files_filter: "资源过滤:"
attachment_all: "全部"
attachment_sufix_browse: "文件类型"
attachment_browse: "内容类型"
attachment_type: "分类"
#
# 项目托管平台
#
# 问题跟踪
#
#
# 项目托管平台
#
# 项目讨论区
#
#
# 项目托管平台
#
# 资源库
#
#
# 项目托管平台
#
# 版本库
#
# #
# 项目托管平台 # 项目托管平台
@ -83,7 +159,9 @@ zh:
project_moule_boards_show: 项目论坛 project_moule_boards_show: 项目论坛
project_module_time_tracking: 时间跟踪 project_module_time_tracking: 时间跟踪
project_module_course: 课程 project_module_course: 课程
project_module_files: 资源库
# #
# 项目托管平台 # 项目托管平台
# #

View File

@ -509,7 +509,7 @@ zh:
label_summer: 夏季学期 label_summer: 夏季学期
label_autumn: 秋季学期 label_autumn: 秋季学期
label_winter: 冬季学期 label_winter: 冬季学期
label_followers: 关注
label_teacher_list: 教师列表 label_teacher_list: 教师列表
label_student_list: 学生列表 label_student_list: 学生列表
@ -558,7 +558,7 @@ zh:
label_text: 文本 label_text: 文本
label_attribute: 属性 label_attribute: 属性
label_attribute_plural: 属性 label_attribute_plural: 属性
label_no_data: 没有任何数据可供显示
label_change_status: 变更状态 label_change_status: 变更状态
label_history: 历史记录 label_history: 历史记录
label_attachment: 文件 label_attachment: 文件
@ -915,8 +915,6 @@ zh:
button_sort: 排序 button_sort: 排序
button_log_time: 登记工时 button_log_time: 登记工时
button_rollback: 恢复到这个版本 button_rollback: 恢复到这个版本
button_watch: 跟踪
button_unwatch: 取消跟踪
button_reply: 回复 button_reply: 回复
button_archive: 存档 button_archive: 存档
button_unarchive: 取消存档 button_unarchive: 取消存档
@ -1003,9 +1001,6 @@ zh:
text_applied_project: "用户 %{id} 申请加入项目 %{project}" text_applied_project: "用户 %{id} 申请加入项目 %{project}"
text_issue_expire: "分配给您的任务%{issue}即将到期" text_issue_expire: "分配给您的任务%{issue}即将到期"
default_role_manager: 管理人员
default_role_developer: 开发人员
default_role_reporter: 报告人员
default_tracker_bug: 错误 default_tracker_bug: 错误
default_tracker_feature: 功能 default_tracker_feature: 功能
default_tracker_support: 支持 default_tracker_support: 支持
@ -1228,11 +1223,6 @@ zh:
zero: 个关注者 zero: 个关注者
one: 个关注者 one: 个关注者
other: 个关注者 other: 个关注者
#end
label_member_since: 加入
label_contribute_to: 参与了 %{project_count} 个项目:
#modify by men
#end #end
label_total_commit: 共%{total_commit}次提交 label_total_commit: 共%{total_commit}次提交
label_question_number: 第%{question_number}题: label_question_number: 第%{question_number}题:
@ -1249,7 +1239,7 @@ zh:
label_type_as: 类型为 label_type_as: 类型为
label_status_as: 状态为 label_status_as: 状态为
label_priority_as: 优先级为 label_priority_as: 优先级为
label_member_list: 成员列表
label_author_name: 由%{author_name}发表了 label_author_name: 由%{author_name}发表了
label_post_on: 发表了 label_post_on: 发表了
@ -1263,9 +1253,6 @@ zh:
#added by liuping #added by liuping
button_unfollow: 取消关注
button_follow: 关注
label_followers: 关注
label_delete_confirm: 确认删除? label_delete_confirm: 确认删除?
label_tags_bid: 需求名称 label_tags_bid: 需求名称
@ -1604,8 +1591,6 @@ zh:
label_code_submit_number: 代码提交次数 label_code_submit_number: 代码提交次数
label_topic_number: 讨论区发言数量 label_topic_number: 讨论区发言数量
label_files_filter: 资源过滤:
label_join_contest: 加入竞赛 label_join_contest: 加入竞赛
@ -1732,7 +1717,6 @@ zh:
label_project_grade: 项目得分 label_project_grade: 项目得分
label_user_grade: 个人得分 label_user_grade: 个人得分
label_user_for_project_grade: 个人得分
label_system_grade: 系统评分 label_system_grade: 系统评分
label_ta: 助教 label_ta: 助教
@ -1798,7 +1782,6 @@ zh:
you_are_master: 您是该项目的版主 you_are_master: 您是该项目的版主
#add by linchun (竞赛相关) #add by linchun (竞赛相关)
label_upload_files: 上传文件
label_upload_softwarepackage: 上传软件包 label_upload_softwarepackage: 上传软件包
label_upload_cuttingphoto: 上传截图 label_upload_cuttingphoto: 上传截图
label_contests_reward_method: 奖励方式 label_contests_reward_method: 奖励方式
@ -1879,7 +1862,6 @@ zh:
one: 个动态 one: 个动态
other: 个动态 other: 个动态
label_relation_files: 关联已有资源
label_contest_settings: 配置竞赛 label_contest_settings: 配置竞赛
label_contest_delete: 删除竞赛 label_contest_delete: 删除竞赛
label_noawards_current: 暂未评奖 label_noawards_current: 暂未评奖
@ -1976,7 +1958,6 @@ zh:
lable_hot_course: 活跃课程 lable_hot_course: 活跃课程
lable_student_list_visable: 学生列表是否公开 lable_student_list_visable: 学生列表是否公开
lable_sure_exit_project: 是否确认退出该项目
lable_input_class_vilidate: 学时只能为整数 lable_input_class_vilidate: 学时只能为整数
lable_school_list: 学校列表 lable_school_list: 学校列表
@ -1984,7 +1965,6 @@ zh:
lable_teacher_evaluation: 作业综评 lable_teacher_evaluation: 作业综评
lable_course_teacher: 主讲老师 lable_course_teacher: 主讲老师
lable_course_end: 课程学期已结束 lable_course_end: 课程学期已结束
lable_file_sharingarea: 资源共享区
label_no_contest_news_description: 竞赛描述不能为空 label_no_contest_news_description: 竞赛描述不能为空
label_contest_news_condition: 竞赛描述超过5000个汉字 label_contest_news_condition: 竞赛描述超过5000个汉字
label_no_contest_news_title: 竞赛标题不能为空 label_no_contest_news_title: 竞赛标题不能为空
@ -2069,6 +2049,6 @@ zh:
label_end_time: 截止时间 label_end_time: 截止时间
label_send_email: 确定发送 label_send_email: 确定发送
label_input_email: 请输入邮箱地址 label_input_email: 请输入邮箱地址
project_module_files: 资源库

View File

@ -135,8 +135,11 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
loadstartEventHandler: $.noop, loadstartEventHandler: $.noop,
progressEventHandler: $.noop progressEventHandler: $.noop
}, options); }, options);
if(uploadUrl.indexOf('?') > 0){
uploadUrl = uploadUrl + '?attachment_id=' + attachmentId; uploadUrl = uploadUrl + '&attachment_id=' + attachmentId;
}else{
uploadUrl = uploadUrl + '?attachment_id=' + attachmentId;
}
if (blob instanceof window.File) { if (blob instanceof window.File) {
uploadUrl += '&filename=' + encodeURIComponent(blob.name); uploadUrl += '&filename=' + encodeURIComponent(blob.name);
} }