diff --git a/app/views/tags/_tag_add.html.erb b/app/views/tags/_tag_add.html.erb
new file mode 100644
index 000000000..14f2dc965
--- /dev/null
+++ b/app/views/tags/_tag_add.html.erb
@@ -0,0 +1,13 @@
+<%= link_to '+ 添加标签', 'javascript:void(0);',
+ :class => "yellowBtn f_l",
+ :onclick=>"$('#add_tag_#{obj.id}').slideToggle();" if User.current.logged? %>
+
+ <%= form_for "tag_for_save",:remote=>true,:url => save_tag_path,
+ :update => "tags_show",
+ :complete => '$("#put-tag-form").hide();' do |f| %>
+ <%= f.text_field :name ,:id => "tags_name_#{obj.id}",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class => "isTxt w90 f_l" %>
+ <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
+ <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
+ <%= f.submit "",:class => "submit f_l" %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb
new file mode 100644
index 000000000..092e0d898
--- /dev/null
+++ b/app/views/tags/_tag_list.html.erb
@@ -0,0 +1,20 @@
+<% @tags = obj.reload.tag_list %>
+
+<% 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 %>
+
+ <% case object_flag %>
+ <% when '6' %>
+ <% if obj.author_id == User.current.id || User.current.admin?%>
+ <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
+ :taggable_id => obj.id, :taggable_type => object_flag %>
+ <% end %>
+ <% end %>
+
+ <% end %>
+<% else %>
+
+ <%= l(:label_tags_no) %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/tags/_tag_new.html.erb b/app/views/tags/_tag_new.html.erb
new file mode 100644
index 000000000..eb49005ae
--- /dev/null
+++ b/app/views/tags/_tag_new.html.erb
@@ -0,0 +1,24 @@
+ <%#begin
+ 1 代表是user类型
+ 2 代表是project类型
+ 3 代表是issue类型
+ 4 代表是bid类型
+ 5 代表是forum类型
+ 6 代表是Attachment类型
+ 7 代表是contest类型
+ 8 代表是OpenSourceProject类型
+ 9 代表是RelativeMemo类型
+ #end%>
+
+ <% if object_flag == '3' %>
+
+ <% elsif object_flag == '6' %>
+
+ <%= render :partial => "tags/tag_list",:locals => {:obj => obj,:object_flag => object_flag} %>
+
+
+ <%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %>
+
+ <% else %>
+
+ <% end %>
diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb
new file mode 100644
index 000000000..20ffb54cf
--- /dev/null
+++ b/app/views/tags/tag_save.js.erb
@@ -0,0 +1,9 @@
+//本js使用的新的tag显示方法
+<% if @obj_flag == '6'%>
+$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
+$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
+//$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide();
+$("#tags_name_<%= @obj.id%>").val("");
+//$('#put-tag-form').hide();
+<% end %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 1a2309c2c..35b7b6ca2 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -792,6 +792,7 @@ RedmineApp::Application.routes.draw do
match 'parise_tread/tread_plus', :as=>"tread"
match 'tags/delete'
match 'tags/remove_tag', :as=>"remove_tag"
+ match 'tags/tag_save', :as => "save_tag"
match 'words/add_brief_introdution'
diff --git a/public/images/files/btn.png b/public/images/files/btn.png
new file mode 100644
index 0000000000000000000000000000000000000000..85cea7f5c179b272cbe136f07f804ab663f8b161
GIT binary patch
literal 1308
zcmV+%1>^dOP)
(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd
zMgRZ=qD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AIO3r!%c+Ja<|!f{
z&3s}dc|Y3C6m%5Xp&Jkv`yf@c26#$TmS%c(1TR?0`q8pXv|xN<1w7=0^hg=dH2)9v
zycIekZFHXRKZT?2EI@o4MR*$8v~k1TG*qByA+iV#yBHs5Rcwth!O<88K})Gp>&9sfT=$
zah-FnzLuLB!3$_)9fj^=4V%(B^E5dMBN(
zOiLFl+asTPJ*1}Yeg1wzFGSJMYu)7Q;KAFY`#T%C{-tlfzg&LUzxL!M_vz>9>C@-;
fK3sgQo0~g*=8t{Del5JIq&Lc_H}zNh{bzpx7X2%s
literal 0
HcmV?d00001
diff --git a/public/images/files/pic_open01.png b/public/images/files/pic_open01.png
new file mode 100644
index 0000000000000000000000000000000000000000..45552ae00bcd00a3bf353764b915e4c70a8b0511
GIT binary patch
literal 215
zcmeAS@N?(olHy`uVBq!ia0vp^dO$43!3HGvPgwUINO2Z;L>4nJa0`PlBg3pY51MapOd5U}4UhMjHT;S(dy&t2
znTg-#!vSU(QU9>Wxj*cy+;m~72S6wO|If_8*TJi1ZM;|!Xc2>_tDnm{r-UW|7s)?b
literal 0
HcmV?d00001
diff --git a/public/images/files/pic_open02.png b/public/images/files/pic_open02.png
new file mode 100644
index 0000000000000000000000000000000000000000..b457f302f7b55e3c899afee2e2e091835cb635ec
GIT binary patch
literal 215
zcmeAS@N?(olHy`uVBq!ia0vp^dO$43!3HGvPgwUINO2Z;L>4nJa0`PlBg3pY5rkifktt>%r=h}o#S;-%_7-oFaYIxMbW^pc?c|~t(^S>|y
z-46$t`E6jte{ntYFK=ES4z)+>iz|hdl!0_`wkbcR)P-?)y@G60U!DwdtNNjv*Dd-du7N
zJfI+O;DC&ify326*&T-&Or7l4GQXSdal>=Xy&t!3YNlL=+`*s^wB!GOW(JidylT(Oq#psf
N44$rjF6*2Ung9^~MY#X~
literal 0
HcmV?d00001
diff --git a/public/images/files/pic_select02.png b/public/images/files/pic_select02.png
new file mode 100644
index 0000000000000000000000000000000000000000..e620fad1fde281e6a583d0430aa00ef6700eefd1
GIT binary patch
literal 225
zcmeAS@N?(olHy`uVBq!ia0vp^5kM@)!3HE=ES4z)+>iz|hdl!0_`wkbcR)P-?)y@G60U!DwdtNNjv*Dd-du7N
zJfI+O;DAir3Kp5bK#N5}2F~_tncq$KxZ!yw?&qx=8*fE01{^v2a_4$pfz9EC!rDR{
zIvY53HXKmfaDZtx7;)z?aqDcD%g85Ll$Ct6e!~gQ9Sr(FJO2M?W_YxLS8WRW=XF3X
NgQu&X%Q~loCIFg}MBM-Y
literal 0
HcmV?d00001
diff --git a/public/stylesheets/images/btn.png b/public/stylesheets/images/btn.png
new file mode 100644
index 0000000000000000000000000000000000000000..85cea7f5c179b272cbe136f07f804ab663f8b161
GIT binary patch
literal 1308
zcmV+%1>^dOP)(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd
zMgRZ=qDe$SRCwCVn9Xk!M;OL`Gv0iV0||8$5CI7)acRn@3Q^e;s^}&ELMv63s#L<>
z9D3-fBJ{+i2XAs{sZ`7GQ#{@3QS<9h$;eUJbAan=E(kaBu&-wyuX&@6>PCV+0sN%jux
zpc-yW1D`v9gVtmBYno62A{)A|E4W|Np!FEwNI(Jvs`p^Op3MIzzQ!y}(g6elbO)f<
z-PR<>%4>-L?EbhNE3a|g&3E*Po5s+HZ~%l9Xl>qXwWH18H{5(;+dSLDZ@BqXA8p6q
z0#r1x0XP=+o-7VBDcR8!?6v!#7_SCscepp*JV&g=H)9D*LgRBJrNn9doHQWg;0`x~
zA1<$P%gsm6w=DT@x#<_r;S^va>2(LBi_N5m%4;kpfU!ZDcZU*^FS_}}{?4j5A~x3)
zXxY9TyxIt^B`vk-KX`Sm#m6p-Za!)!z3*1czV0+}qE&bCjgP5+dpqA!(P7!Cc?-_mCo=5lYv>`sVj5_kKPP1Y-MlUr3-2
z*ai#%{V&$qD>DUb0_(s(KwVTS72f&%C%JIo3yFPIDW}6v)O}im>bgM09wDN@2kMALY!MGhKZ`6&;n0J5x6%3xz^r
z|NQ)XS7r)@LgZ(++xfI(Hq|y{g3Qm)x3mj|LQ82k*1WUZX+Xx0{gDz?{-zy|F*i3yp-_m%*)eR3$FqNMw=kMk
z`eL!z^Yn-V>ovwpNpCayveu5#RM%y#HCidU{TQ{GFBXgVzK`$wQM;Wop6B8Fen(J=
z(pyt9mGqwHwbVeAxSQD^+l{m1c9p&p)KV-GADYPC8$JUon)*|^*(rFi=EDfN2&
zg892Z0M5d~!r8&W!HWm|{|*3=5ER6x
SG$&F30000=yUvaqn=$)1L+-fWUdKhlK8rJJ;Fz?9lnwg|x0i%s@k9_h25P&b-;R=M!6Y*uC4J
znkZDjL&O4!ckD+>qOuEJh0fD$o&^gCnW*epQa!T;G#nyO;)J{{lm$?R94r(iNxB6@
z0Sdez@=(k}NhyemAb{n=(rBSGRN8uD8H=t|c1%d1@O&J{TwLIAIO3r!%c+Ja<|!f{
z&3s}dc|Y3C6m%5Xp&Jkv`yf@c26#$TmS%c(1TR?0`q8pXv|xN<1w7=0^hg=dH2)9v
zycIekZFHXRKZT?2EI@o4MR*$8v~k1TG*qByA+iV#yBHs5Rcwth!O<88K})Gp>&9sfT=$
zah-FnzLuLB!3$_)9fj^=4V%(B^E5dMBN(
zOiLFl+asTPJ*1}Yeg1wzFGSJMYu)7Q;KAFY`#T%C{-tlfzg&LUzxL!M_vz>9>C@-;
fK3sgQo0~g*=8t{Del5JIq&Lc_H}zNh{bzpx7X2%s
literal 0
HcmV?d00001
diff --git a/public/stylesheets/images/pic_open01.png b/public/stylesheets/images/pic_open01.png
new file mode 100644
index 0000000000000000000000000000000000000000..45552ae00bcd00a3bf353764b915e4c70a8b0511
GIT binary patch
literal 215
zcmeAS@N?(olHy`uVBq!ia0vp^dO$43!3HGvPgwUINO2Z;L>4nJa0`PlBg3pY51MapOd5U}4UhMjHT;S(dy&t2
znTg-#!vSU(QU9>Wxj*cy+;m~72S6wO|If_8*TJi1ZM;|!Xc2>_tDnm{r-UW|7s)?b
literal 0
HcmV?d00001
diff --git a/public/stylesheets/images/pic_open02.png b/public/stylesheets/images/pic_open02.png
new file mode 100644
index 0000000000000000000000000000000000000000..b457f302f7b55e3c899afee2e2e091835cb635ec
GIT binary patch
literal 215
zcmeAS@N?(olHy`uVBq!ia0vp^dO$43!3HGvPgwUINO2Z;L>4nJa0`PlBg3pY5rkifktt>%r=h}o#S;-%_7-oFaYIxMbW^pc?c|~t(^S>|y
z-46$t`E6jte{ntYFK=ES4z)+>iz|hdl!0_`wkbcR)P-?)y@G60U!DwdtNNjv*Dd-du7N
zJfI+O;DC&ify326*&T-&Or7l4GQXSdal>=Xy&t!3YNlL=+`*s^wB!GOW(JidylT(Oq#psf
N44$rjF6*2Ung9^~MY#X~
literal 0
HcmV?d00001
diff --git a/public/stylesheets/images/pic_select02.png b/public/stylesheets/images/pic_select02.png
new file mode 100644
index 0000000000000000000000000000000000000000..e620fad1fde281e6a583d0430aa00ef6700eefd1
GIT binary patch
literal 225
zcmeAS@N?(olHy`uVBq!ia0vp^5kM@)!3HE=ES4z)+>iz|hdl!0_`wkbcR)P-?)y@G60U!DwdtNNjv*Dd-du7N
zJfI+O;DAir3Kp5bK#N5}2F~_tncq$KxZ!yw?&qx=8*fE01{^v2a_4$pfz9EC!rDR{
zIvY53HXKmfaDZtx7;)z?aqDcD%g85Ll$Ct6e!~gQ9Sr(FJO2M?W_YxLS8WRW=XF3X
NgQu&X%Q~loCIFg}MBM-Y
literal 0
HcmV?d00001
diff --git a/public/stylesheets/resource.css b/public/stylesheets/resource.css
new file mode 100644
index 000000000..3c7ab35bb
--- /dev/null
+++ b/public/stylesheets/resource.css
@@ -0,0 +1,84 @@
+body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
+div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,form,span,textarea{ margin:0; padding:0;}
+div,img,tr,td,textarea{ border:0;}
+table,tr,td{border:0; cellspacing:0; cellpadding:0;}
+ul,li{ list-style-type:none}
+.cl{ clear:both; overflow:hidden; }
+a{ text-decoration:none; text-align:center; }
+a:hover{ text-decoration:underline;}
+/**** 常用***/
+.f_l{ float:left;}
+.f_r{ float:right;}
+.b_lblue{ background:#64bdd9 !important;}
+.b_dblue{ background:#55a1b9 !important; cursor:pointer !important;}
+.f_b{ font-weight: bold !important;}
+.c_blue{ color:#64bdd9;}
+.c_grey{ color:#999999 !important;}
+.c_grey02{ color:#666666 !important;}
+.f_14{ font-size:14px ;}
+.c_dblue{ color:#3e6d8e;}
+.w90{width:90px;}
+.ml10{margin-left:10px;}
+
+
+.container{ }
+
+/****搜索***/
+.resource{ width:693px;}
+.re_top{width:688px; height:50px; margin-left:5px; background:#eaeaea;}
+.re_top input{ float:left;}
+.re_search{ margin:12px;}
+.re_schbox{ width:240px; height:24px; border:1px solid #64bdd9 !important; color:#666666;}
+.re_schbtn
+{
+ width:60px !important;
+ height:26px !important;
+ color:#fff !important;
+ margin-right:5px !important;
+ border:none !important;
+ margin-left:0px !important;
+ box-shadow: none !important;
+ padding: 0px !important;
+ border-radius: 0 !important;
+ text-shadow: none !important;
+}
+a.re_fabu { display:block; width:90px; height:35px; font-size:14px; color:#fff; text-align:center; padding-top:5px; margin:5px; }
+a:hover.re_fabu{background:#55a1b9;}
+/****列表***/
+.re_con{ margin:5px; width:683px;}
+.re_con_top{color:#494949; }
+.re_con_top span{ color:#999999; font-weight:bold;}
+a.re_select{ display:block; width:88px; height:22px; background:url(images/pic_select01.png) 0 0 no-repeat; color:#fff; font-weight:bold; margin-left:10px;}
+a:hover.re_select{background:url(images/pic_select02.png) 0 0 no-repeat;}
+.re_open{display:block; width:46px; height:22px; background:url(images/pic_open01.png) 0 0 no-repeat; color:#fff; font-weight:bold; margin-left:10px;}
+a:hover.re_open{background:url(images/pic_open02.png) 0 0 no-repeat;}
+a.re_de{ color:#6883b6; margin-left:15px;}
+.re_con_box{ border-bottom:1px dashed #dadada; padding:10px 0;}
+/****翻页***/
+.wlist{ margin-top:15px;}
+.wlist a{ float:right; border:1px solid #15bccf; padding:0 5px; margin-left:3px; color:#15bccf;}
+.wlist a:hover{border:1px solid #15bccf; background-color:#15bccf; color:#fff;}
+.wlist_select a { background-color:#64bdd9; color:#fff;}
+/****标签***/
+a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;}
+.submit
+{
+ height:21px !important;
+ border:0 !important;
+ cursor:pointer !important;
+ background:url(images/btn.png) no-repeat 0 0 !important;
+ width:42px !important;
+ margin-top:2px !important;
+ margin-left:3px !important;
+ border:none !important;
+ margin-left:0px !important;
+ box-shadow: none !important;
+ padding: 0px !important;
+ border-radius: 0 !important;
+ text-shadow: none !important;
+}
+.isTxt{background:#fbfbfb url(images/inputBg.png) repeat-x left top !important;height:22px !important;line-height:22px !important;border:1px solid #c1c1c1 !important;padding:0 5px !important;color:#666666 !important;}
+.re_tag{ width: auto; padding:0 5px; height:22px; border:1px solid #f8df8c; background:#fffce6; margin-right:10px;}
+.re_tag a{ color:#0d90c3;}
+.tag_h span,.tag_h a{ margin-bottom:5px;}
+
From 0821320dfefd4c7187dbdd7c65b5f329f3f89f97 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Wed, 19 Nov 2014 10:07:49 +0800
Subject: [PATCH 07/40] =?UTF-8?q?tag=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=8C=E7=BF=BB=E9=A1=B5=E6=A0=B7=E5=BC=8F?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/tags_controller.rb | 35 +++++++++++++++++++++++++++
app/views/files/_course_file.html.erb | 2 +-
app/views/tags/_tag_list.html.erb | 2 +-
app/views/tags/remove_tag_new.js.erb | 6 +++++
config/routes.rb | 1 +
public/stylesheets/resource.css | 10 +++++---
6 files changed, 50 insertions(+), 6 deletions(-)
create mode 100644 app/views/tags/remove_tag_new.js.erb
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 27f7fe61d..5bd5fb0e3 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -14,6 +14,7 @@ class TagsController < ApplicationController
include AttachmentsHelper
include ContestsHelper
include ActsAsTaggableOn::TagsHelper
+ include TagsHelper
helper :projects
helper :courses
helper :tags
@@ -189,6 +190,40 @@ class TagsController < ApplicationController
end
end
+ # 只删除某个对象的该tag
+ def remove_tag_new
+ @obj = nil
+ @object_flag = nil
+
+ if request.get?
+ # 获取传过来的tag_id taggable_id 和 taggable_type,通过2者确定要删除tag的对象
+ @tag_name = params[:tag_name]
+ @tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id
+ @taggable_id = params[:taggable_id] # 当做参数传时对象会变成字符串
+ @taggable_type = numbers_to_object_type(params[:taggable_type])
+
+ @obj = get_object(@taggable_id,params[:taggable_type])
+ @object_flag = params[:taggable_type]
+
+ # if can_remove_tag?(User.current,@taggable_id,@taggable_type)
+
+ @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type)
+
+ unless @taggings.nil?
+ @taggings.delete
+ end
+
+ # 是否还有其他记录 引用了 tag_id
+ @tagging = ActsAsTaggableOn::Tagging.find_by_tag_id(@tag_id)
+ # 如果taggings表中记录已经不存在 ,那么检查tags表 作删除动作
+ if @tagging.nil?
+ @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
+ @tag.delete unless @tag.nil?
+ end
+ # end
+ end
+ end
+
def tag_save
@tags = params[:tag_for_save][:name]
@obj_id = params[:tag_for_save][:object_id]
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index 8edd054be..603318cf6 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -11,7 +11,7 @@
- 发布资源
+ 上传资源
diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb
index 092e0d898..c815d71f8 100644
--- a/app/views/tags/_tag_list.html.erb
+++ b/app/views/tags/_tag_list.html.erb
@@ -7,7 +7,7 @@
<% case object_flag %>
<% when '6' %>
<% if obj.author_id == User.current.id || User.current.admin?%>
-
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
+ <%= link_to 'x', :controller => "tags", :action => "remove_tag_new", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
<% end %>
diff --git a/app/views/tags/remove_tag_new.js.erb b/app/views/tags/remove_tag_new.js.erb
new file mode 100644
index 000000000..24d52a35f
--- /dev/null
+++ b/app/views/tags/remove_tag_new.js.erb
@@ -0,0 +1,6 @@
+//本js使用的新的tag显示方法
+<% if @object_flag == "6"%>
+$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
+$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>');
+<% end %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 35b7b6ca2..3e2abce47 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -792,6 +792,7 @@ RedmineApp::Application.routes.draw do
match 'parise_tread/tread_plus', :as=>"tread"
match 'tags/delete'
match 'tags/remove_tag', :as=>"remove_tag"
+ match 'tags/remove_tag_new', :as=>"remove_tag_new"
match 'tags/tag_save', :as => "save_tag"
match 'words/add_brief_introdution'
diff --git a/public/stylesheets/resource.css b/public/stylesheets/resource.css
index 3c7ab35bb..f179b6683 100644
--- a/public/stylesheets/resource.css
+++ b/public/stylesheets/resource.css
@@ -55,10 +55,12 @@ a:hover.re_open{background:url(images/pic_open02.png) 0 0 no-repeat;}
a.re_de{ color:#6883b6; margin-left:15px;}
.re_con_box{ border-bottom:1px dashed #dadada; padding:10px 0;}
/****翻页***/
-.wlist{ margin-top:15px;}
-.wlist a{ float:right; border:1px solid #15bccf; padding:0 5px; margin-left:3px; color:#15bccf;}
-.wlist a:hover{border:1px solid #15bccf; background-color:#15bccf; color:#fff;}
-.wlist_select a { background-color:#64bdd9; color:#fff;}
+ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
+.wlist li{float: left;}
+.wlist span{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;}
+.wlist a{display: block; border:1px solid #15bccf; padding:0 5px; margin-left:3px;}
+.wlist a:hover{ background:#15bccf; color:#fff; text-decoration:none;}
+.wlist_select { background-color:#64bdd9; color:#fff; padding:0 5px; margin-left:3px; border:1px solid #64bdd9;}
/****标签***/
a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;}
.submit
From 91cb6e29d5336587ffaa92cce315df23ab35bc9b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 19 Nov 2014 10:34:36 +0800
Subject: [PATCH 08/40] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84?=
=?UTF-8?q?=E5=AD=97=E6=AE=B5=20=E6=96=B0=E5=BB=BA=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E6=98=AF=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF?=
=?UTF-8?q?=E5=8C=BF=E8=AF=84=E5=8A=9F=E8=83=BD=E4=BB=A5=E5=8F=8A=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E9=A1=B5=E9=9D=A2=E6=95=88=E6=9E=9C=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E7=9B=B8=E5=85=B3js=E5=88=A4=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 2 +
app/controllers/courses_controller.rb | 1 +
app/views/bids/_homework_form.html.erb | 4 ++
app/views/bids/edit.html.erb | 61 ++++++++++++++-----
app/views/courses/_homework_form.html.erb | 4 ++
app/views/courses/new_homework.html.erb | 50 ++++++++++-----
config/locales/zh.yml | 1 +
...119011439_add_open_anonymous_evaluation.rb | 9 +++
db/schema.rb | 15 ++---
9 files changed, 110 insertions(+), 37 deletions(-)
create mode 100644 db/migrate/20141119011439_add_open_anonymous_evaluation.rb
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index 145a73178..c8ce6ec31 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -807,6 +807,7 @@ class BidsController < ApplicationController
@bid.is_evaluation = params[:bid][:is_evaluation]
@bid.proportion = params[:bid][:proportion]
@bid.evaluation_num = params[:bid][:evaluation_num]
+ @bid.open_anonymous_evaluation = params[:bid][:open_anonymous_evaluation]
@bid.reward_type = 3
# @bid.budget = params[:bid][:budget]
@bid.deadline = params[:bid][:deadline]
@@ -863,6 +864,7 @@ class BidsController < ApplicationController
@bid.is_evaluation = params[:bid][:is_evaluation]
@bid.proportion = params[:bid][:proportion]
@bid.evaluation_num = params[:bid][:evaluation_num]
+ @bid.open_anonymous_evaluation = params[:bid][:open_anonymous_evaluation]
@bid.reward_type = 3
@bid.deadline = params[:bid][:deadline]
@bid.budget = 0
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 5381e8757..edfc893d8 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -511,6 +511,7 @@ class CoursesController < ApplicationController
def new_homework
@homework = Bid.new
@homework.safe_attributes = params[:bid]
+ @homework.open_anonymous_evaluation = 1
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses'
else
diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb
index 448e4144a..cd682deb0 100644
--- a/app/views/bids/_homework_form.html.erb
+++ b/app/views/bids/_homework_form.html.erb
@@ -44,6 +44,10 @@
<%= f.select :proportion, proportion_option %>
+ <%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
+ 未开启匿评作业将直接进入众评点赞阶段
+
+
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
匿评分配数量不宜太大,否则会影响开启匿评速度
diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb
index 322b8cdc3..0a2d17e7d 100644
--- a/app/views/bids/edit.html.erb
+++ b/app/views/bids/edit.html.erb
@@ -43,35 +43,66 @@
{
var evaluation_num = $.trim($("#bid_evaluation_num").val());
var regex = /^\d+$/;
- if(evaluation_num=="")
+ if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
- $("#bid_evaluation_num_span").text("匿评分配数量不能为空");
- $("#bid_evaluation_num_span").css('color','#ff0000');
- return false;
- }
- else if(regex.test(evaluation_num))
- {
- if(evaluation_num > 0)
+ if(evaluation_num=="")
{
- $("#bid_evaluation_num_span").text("填写正确");
- $("#bid_evaluation_num_span").css('color','#008000');
- return true;
+ $("#bid_evaluation_num_span").text("匿评分配数量不能为空");
+ $("#bid_evaluation_num_span").css('color','#ff0000');
+ return false;
+ }
+ else if(regex.test(evaluation_num))
+ {
+ if(evaluation_num > 0)
+ {
+ $("#bid_evaluation_num_span").text("填写正确");
+ $("#bid_evaluation_num_span").css('color','#008000');
+ return true;
+ }
+ else
+ {
+ $("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
+ $("#bid_evaluation_num_span").css('color','#ff0000');
+ return false;
+ }
}
else
{
- $("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
+ $("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
- $("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
- $("#bid_evaluation_num_span").css('color','#ff0000');
- return false;
+ return true;
}
}
+ $(function(){
+ $("#bid_open_anonymous_evaluation").click(function(){
+ if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
+ {
+ $("#evaluation_num_p").slideDown();
+ }
+ else
+ {
+ $("#evaluation_num_p").slideUp();
+ }
+ });
+ });
+
+ $(function(){
+ if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
+ {
+ $("#evaluation_num_p").show();
+ }
+ else
+ {
+ $("#evaluation_num_p").hide();
+ }
+ });
+
function submitHomework(id)
{
if(regexDeadLine()&®exName()&®exEvaluationNum())
diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb
index 9d5ad1155..8ce6be3fe 100644
--- a/app/views/courses/_homework_form.html.erb
+++ b/app/views/courses/_homework_form.html.erb
@@ -49,6 +49,10 @@
<%= f.select :proportion, proportion_option %>
+ <%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
+ 未开启匿评作业将直接进入众评点赞阶段
+
+
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
匿评分配数量不宜太大,否则会影响开启匿评速度
diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb
index 753aa20c8..7b6784243 100644
--- a/app/views/courses/new_homework.html.erb
+++ b/app/views/courses/new_homework.html.erb
@@ -43,35 +43,55 @@
{
var evaluation_num = $.trim($("#bid_evaluation_num").val());
var regex = /^\d+$/;
- if(evaluation_num=="")
+ if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
- $("#bid_evaluation_num_span").text("匿评分配数量不能为空");
- $("#bid_evaluation_num_span").css('color','#ff0000');
- return false;
- }
- else if(regex.test(evaluation_num))
- {
- if(evaluation_num > 0)
+ if(evaluation_num=="")
{
- $("#bid_evaluation_num_span").text("填写正确");
- $("#bid_evaluation_num_span").css('color','#008000');
- return true;
+ $("#bid_evaluation_num_span").text("匿评分配数量不能为空");
+ $("#bid_evaluation_num_span").css('color','#ff0000');
+ return false;
+ }
+ else if(regex.test(evaluation_num))
+ {
+ if(evaluation_num > 0)
+ {
+ $("#bid_evaluation_num_span").text("填写正确");
+ $("#bid_evaluation_num_span").css('color','#008000');
+ return true;
+ }
+ else
+ {
+ $("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
+ $("#bid_evaluation_num_span").css('color','#ff0000');
+ return false;
+ }
}
else
{
- $("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
+ $("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
- $("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
- $("#bid_evaluation_num_span").css('color','#ff0000');
- return false;
+ return true;
}
}
+ $(function(){
+ $("#bid_open_anonymous_evaluation").click(function(){
+ if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
+ {
+ $("#evaluation_num_p").slideDown();
+ }
+ else
+ {
+ $("#evaluation_num_p").slideUp();
+ }
+ });
+ });
+
function submitHomework()
{
if(regexDeadLine()&®exName()&®exEvaluationNum())
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index a3807dca3..591c1144b 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2198,3 +2198,4 @@ zh:
label_submit_comments: 提交评论
field_evaluation_num: 匿评分配数量
label_my_score: 我的评分
+ field_open_anonymous_evaluation: 是否开启匿评
diff --git a/db/migrate/20141119011439_add_open_anonymous_evaluation.rb b/db/migrate/20141119011439_add_open_anonymous_evaluation.rb
new file mode 100644
index 000000000..cea7143c4
--- /dev/null
+++ b/db/migrate/20141119011439_add_open_anonymous_evaluation.rb
@@ -0,0 +1,9 @@
+class AddOpenAnonymousEvaluation < ActiveRecord::Migration
+ def up
+ add_column :bids, :open_anonymous_evaluation, :integer, default: 1
+ end
+
+ def down
+ remove_column :bids, :open_anonymous_evaluation
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f6fc138af..2e664eaa7 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 => 20141105012624) do
+ActiveRecord::Schema.define(:version => 20141119011439) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -95,21 +95,22 @@ ActiveRecord::Schema.define(:version => 20141105012624) do
create_table "bids", :force => true do |t|
t.string "name"
- t.string "budget", :null => false
+ t.string "budget", :null => false
t.integer "author_id"
t.date "deadline"
t.text "description"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
t.integer "commit"
t.integer "reward_type"
t.integer "homework_type"
t.integer "parent_id"
t.string "password"
t.integer "is_evaluation"
- t.integer "proportion", :default => 60
- t.integer "comment_status", :default => 0
- t.integer "evaluation_num", :default => 3
+ t.integer "proportion", :default => 60
+ t.integer "comment_status", :default => 0
+ t.integer "evaluation_num", :default => 3
+ t.integer "open_anonymous_evaluation", :default => 1
end
create_table "boards", :force => true do |t|
From ff185852ebb1ebb800e4abca789a991fabf83606 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 19 Nov 2014 10:53:22 +0800
Subject: [PATCH 09/40] =?UTF-8?q?=E6=9C=AA=E5=BC=80=E5=90=AF=E5=8C=BF?=
=?UTF-8?q?=E8=AF=84=E6=97=B6=E8=80=81=E5=B8=88=E7=95=8C=E9=9D=A2=E5=8F=96?=
=?UTF-8?q?=E6=B6=88=E5=BC=80=E5=90=AF/=E5=85=B3=E9=97=AD=E5=8C=BF?=
=?UTF-8?q?=E8=AF=84=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/bids/_bid_homework_show.html.erb | 4 +++-
app/views/layouts/base_homework.html.erb | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb
index cc8159821..971b2e3eb 100644
--- a/app/views/bids/_bid_homework_show.html.erb
+++ b/app/views/bids/_bid_homework_show.html.erb
@@ -76,7 +76,8 @@
<% end %>
<% end %>
<% if (User.current.admin?||User.current.id==bid.author_id) %>
-