From e10e5e8412be22d7f6378d83b9889e07735743af Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 15 Sep 2015 09:50:57 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index f39eb8266..0baafd513 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -48,7 +48,7 @@ <% comments.each do |comment| %> <% next if comment.new_record? %>
-
<%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%>
+
<%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author), :class => "problem_pic fl"%>
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %> From 1ae302621f88eb5dcc6084e433ec4611427a6da2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 15 Sep 2015 10:31:59 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=9A=84=E6=A0=87=E7=AD=BE=E5=BA=93=E5=8F=AF=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/tags_controller.rb | 47 +++++++++++++++++++++++++++++ app/views/files/index.html.erb | 48 ++++++++++++++++++++++++++++++ app/views/tags/_tag_list.html.erb | 3 +- config/routes.rb | 1 + 4 files changed, 98 insertions(+), 1 deletion(-) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 253faa2b1..e0cb8af8e 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -230,6 +230,53 @@ class TagsController < ApplicationController end end + #更新某个tag名称 + def update_tag_name + @tag_name = params[:tagName] + @rename_tag_name = params[:renameName] + @taggable_id = params[:taggableId] + @taggable_type = numbers_to_object_type(params[:taggableType]) + + + @rename_tag = (ActsAsTaggableOn::Tag.find_by_name(@rename_tag_name)) #查找重命名后的tag + @tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id #重命名前的tag_id + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) + @obj = get_object(@taggable_id,params[:taggableType]) + if(@rename_tag.nil?) #这次命名的是新的tag + + # 是否还有其他记录 引用了 tag_id + @tagging = ActsAsTaggableOn::Tagging.where("tag_id = #{@tag_id}") + # 如果taggings表中记录为 1 ,那么改变@tag_id对应的tag的名字 + if @tagging.count == 1 + @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) + @tag.update_attributes({:name=>@rename_tag_name}) + else #如果tagging表中的记录大于1,那么就要新增tag记录 + + unless @obj.nil? + @obj.tag_list.add(@rename_tag_name.split(",")) + @obj.save + end + #删除原来的对应的taggings的记录 + unless @taggings.nil? + @taggings.delete + end + end + else #这是已有的tag + # 更改taggings记录里的tag_id + unless @taggings.nil? + @taggings.update_attributes({:tag_id=>@rename_tag.id}) + end + end + @obj_flag = params[:taggableType] + if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course) + @course = @obj.container + @tag_list = @tag_list = get_course_tag_list @course + end + respond_to do |format| + format.js + end + end + def tag_save @select_tag_name = params[:tag_for_save][:tag_name] @tags = params[:tag_for_save][:name] diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index aefa1a5a9..fa15c1fc7 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -223,6 +223,54 @@ }); } + var tagNameHtml; //当前双击的链接的父节点的html + var tagName; //标签的值 + var parentCssBorder; //当前双击的链接的父节点 + var ele; //当前双击的链接 + var tagId; //标签的id + var taggableType; //被标签的类型 + function rename_tag(domEle,name,id,type){ + if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动 + return; + } + tagNameHtml = domEle.parent().html() + tagName = name; + parentCssBorder = domEle.parent().css("border"); + ele = domEle; + tagId = id; + taggableType = type; + domEle.html(''); + domEle.parent().css("border","1px solid #ffffff"); + $("#renameTagName").focus(); + } + //监听所有的单击事件 + $(document.body).click(function(e){ + node = document.elementFromPoint(e.clientX, e.clientY); + if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了 + return; + } + if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态 + if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态 + ele.parent().css("border",""); + ele.parent().html(tagNameHtml); + + }else{ //否则就要更新tag名称了 + if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ + $.post( + '<%= update_tag_name_path %>', + {"taggableId":tagId,"taggableType":taggableType,"tagName":tagName,"renameName":$("#renameTagName").val().trim()} +// function(data){ +// ele.parent().css("border",""); +// ele.parent().html(tagNameHtml); +// } + ) + }else{ + ele.parent().css("border",""); + ele.parent().html(tagNameHtml); + } + } + } + }); diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index b512f1ef3..49c9b2351 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -2,7 +2,8 @@ <% if @tags.size > 0 %> <% @tags.each do |tag| %> - <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> + <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> + <%= tag %> <% case object_flag %> <% when '10' %> diff --git a/config/routes.rb b/config/routes.rb index 1df7b0d2f..1d2393764 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -884,6 +884,7 @@ RedmineApp::Application.routes.draw do match 'tags/remove_tag', :as=>"remove_tag" match 'tags/remove_tag_new', :as=>"remove_tag_new" match 'tags/tag_save', :as => "save_tag" + match 'tags/update_tag_name',:as => "update_tag_name" match 'words/add_brief_introdution' From 1b9bde2284d5bc3c00742a21e0d342ddfce186fe Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 15 Sep 2015 10:33:05 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=9A=84=E6=A0=87=E7=AD=BE=E5=BA=93=E5=8F=AF=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/tags/update_tag_name.js.erb | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 app/views/tags/update_tag_name.js.erb diff --git a/app/views/tags/update_tag_name.js.erb b/app/views/tags/update_tag_name.js.erb new file mode 100644 index 000000000..b72b0c33f --- /dev/null +++ b/app/views/tags/update_tag_name.js.erb @@ -0,0 +1,40 @@ +//本js使用的新的tag显示方法 +<% if @obj_flag == '3'%> +$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +//$('#put-tag-form-issue').hide(); +$('#name-issue').val(""); +<% elsif @obj_flag == '1'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name3').val(""); +<% elsif @obj_flag == '2'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name2').val(""); +<% elsif @obj_flag == '6'%> +<%if @course%> +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', + :locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>'); +$("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); +<%else%> +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +<%end%> + +$("#tags_name_<%=@obj.id%>").val(""); +$("#add_tag_<%=@obj.id%>").hide(); +<% elsif @obj_flag == '9'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name').val(""); +<% elsif @obj_flag == '10'%> +//$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide(); +<% else%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name').val(""); +//$('#put-tag-form').hide(); +<% end %> \ No newline at end of file From 2fa01f32fb396c00afdf507b8b2427db5c46102a Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 15 Sep 2015 11:28:08 +0800 Subject: [PATCH 4/7] schema --- db/schema.rb | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 4dd7f1b68..3daf4743e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150911064528) do +ActiveRecord::Schema.define(:version => 20150911031029) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -497,26 +497,23 @@ ActiveRecord::Schema.define(:version => 20150911064528) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "enabled_modules", :force => true do |t| @@ -781,6 +778,16 @@ ActiveRecord::Schema.define(:version => 20150911064528) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" From 069c1ddf3c1040f17cf022994bed89dc5fa34c5c Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 15 Sep 2015 15:45:16 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E8=AF=84=E8=AE=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_show.html.erb | 5 +- app/views/users/_course_news_reply.html.erb | 177 ------------- app/views/users/show_chen.erb | 279 -------------------- public/javascripts/course.js | 19 +- 4 files changed, 20 insertions(+), 460 deletions(-) delete mode 100644 app/views/users/_course_news_reply.html.erb delete mode 100644 app/views/users/show_chen.erb diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 0baafd513..9ae951779 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -32,7 +32,8 @@ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
-

+

+

<%= l(:label_cancel_with_space) %> @@ -76,4 +77,4 @@ <% end %> -<% html_title @news.title -%> +<% html_title @news.title -%> \ No newline at end of file diff --git a/app/views/users/_course_news_reply.html.erb b/app/views/users/_course_news_reply.html.erb deleted file mode 100644 index c3f8571be..000000000 --- a/app/views/users/_course_news_reply.html.erb +++ /dev/null @@ -1,177 +0,0 @@ - -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> - -<% if @news.commentable? %> -

-

<%= l(:label_comment_add) %>

- <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %> -
- <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%> -
-

- - <%= l(:label_cancel_with_space) %> - - - <%= l(:label_comment_with_space) %> - -

- <% end %> -
-<% end %> - -
- - <%= form_for('new_form', :method => :post, - :url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%> - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - -

- <% end %> -
-
-
- 取  消 - - 发送 - -
-
- -
- - - - - diff --git a/app/views/users/show_chen.erb b/app/views/users/show_chen.erb deleted file mode 100644 index 3bd0014c6..000000000 --- a/app/views/users/show_chen.erb +++ /dev/null @@ -1,279 +0,0 @@ -
-
-
最新动态
- -
- -
-
- 用户头像
-
- - -
- -
截止时间:2015-08-20
-
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
- -
-
-
-
-
-
-
- 用户头像
-
- - -
- -
截止时间:2015-08-20
-
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
- -
-
-
-
- - - -
-
-
- 用户头像
-
- - -
- 时间:2015-07-31 -
-
- -
-
-
-
-
-
-
回复(5)
-
2015-07-31
- -
-
- -
-
- - - -
-
-
-
- 用户头像 -
-
-
黄井泉 学生 - 2015-08-01删除 -
-
很开心!
-
-
-
-
-
- 用户头像 -
-
-
陈正东 学生 - 2015-08-02删除 -
-
假期好热,没出去。
-
-
-
-
-
-
-
-
- 用户头像
-
- - -
-
指派给  苏稳 -
-
时间:2015-08-20
-
-
(缺陷描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
-
- 文件附件.zip(123KB) -
-
- 图片附件.png(123KB) -
-
- -
-
-
-
-
-
-
回复(5)
-
2015-07-26
- -
-
- -
-
- - - -
-
-
-
- 用户头像 -
-
-
尹教授 - 2015-08-01删除 -
-
请大家说下软件工程是什么!
-
-
-
-
-
- 用户头像 -
-
-
Tang 学生 - 2015-08-01删除 -
-
软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。
-
-
-
-
-
\ No newline at end of file diff --git a/public/javascripts/course.js b/public/javascripts/course.js index e5c50ac51..fc52ef87a 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -260,8 +260,23 @@ function submitFocus(obj) function submitComment() { - comment_editor.sync(); - $("#add_comment_form").submit(); + if (newsReplyVerify()) { + comment_editor.sync(); + $("#add_comment_form").submit(); + } +} + +function newsReplyVerify() { + var content = comment_editor.html(); + if(content.length == 0) { + $("#add_reply_news").text("评论不能为空"); + $("#add_reply_news").css('color', '#ff0000'); + return false; + } else { + $("#add_reply_news").text("填写正确"); + $("#add_reply_news").css('color', '#008000'); + return true; + } } /////////////////////////////////////////////////课程讨论区 From 0a2bfa1bdb013637d0383813acf4d0ed6ea9ea26 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 15 Sep 2015 16:27:53 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E7=9A=84=E7=BC=BA=E9=99=B7=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E4=B8=8E=E7=BC=BA=E9=99=B7=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E5=86=85=E5=AE=B9=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index cdc310604..0413d6811 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -111,17 +111,14 @@ <% end %> <%= format_time(reply.created_on) %>
- <% if reply.details.any? %> - <% details_to_strings(reply.details).each do |string| %> -
- <%= string %> -
- <% end %> - <% else %> -
- <%= reply.notes.html_safe %> -
- <% end %> +
+ <% if reply.details.any? %> + <% details_to_strings(reply.details).each do |string| %> +

<%= string %>

+ <% end %> + <% end %> +

<%= reply.notes.html_safe %>

+
From fddf466ce1c1b3e80056f637234e3e8e0eed11f0 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 16 Sep 2015 09:45:27 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=B0=86=E5=8F=91=E5=B8=83=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=97=B6=E7=9A=84=E5=BC=95=E7=94=A8=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=E7=9A=84=E2=80=9C=E7=A1=AE=E5=AE=9A=E2=80=9D=E2=80=9C?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E2=80=9D=E6=8C=89=E9=92=AE=E6=94=B9=E6=88=90?= =?UTF-8?q?=E6=95=B4=E4=B8=AA=E6=8C=89=E9=92=AE=E5=8F=AF=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_show_user_resource.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_show_user_resource.html.erb b/app/views/users/_show_user_resource.html.erb index a3c82d995..24d81a787 100644 --- a/app/views/users/_show_user_resource.html.erb +++ b/app/views/users/_show_user_resource.html.erb @@ -59,8 +59,8 @@
- - + 确定 + 取消
<% end %>