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/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 97c0ce4f6..9e9a34d55 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -59,8 +59,8 @@ class IssuesController < ApplicationController sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) sort_update(@query.sortable_columns) @query.sort_criteria = sort_criteria.to_a - - @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young + + @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base' if @query.valid? case params[:format] diff --git a/app/models/forum.rb b/app/models/forum.rb index e0592723e..61ba528a0 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -30,7 +30,7 @@ class Forum < ActiveRecord::Base def destroyable_by? user # user && user.logged? && Forum.find(self.forum_id).creator_id == user.id || user.admin? - user.admin? + self.creator == user || user.admin? end # Updates topic_count, memo_count and last_memo_id attributes for +board_id+ diff --git a/app/models/memo.rb b/app/models/memo.rb index b02564834..847795b4f 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -88,11 +88,11 @@ class Memo < ActiveRecord::Base def editable_by? user # user && user.logged? || (self.author == usr && usr.allowed_to?(:edit_own_messages, project)) - user.admin? + (user && self.author == user) || user.admin? end def destroyable_by? user - (user && user.logged? && (Forum.find(self.forum_id).creator_id == user.id) ) || user.admin? + (user && self.author == user) || user.admin? #self.author == user || user.admin? end diff --git a/app/views/bids/_alert_anonyoms.html.erb b/app/views/bids/_alert_anonyoms.html.erb index e533048f5..6205b2b6c 100644 --- a/app/views/bids/_alert_anonyoms.html.erb +++ b/app/views/bids/_alert_anonyoms.html.erb @@ -14,7 +14,7 @@ /* 匿名评分弹框 */ - .anonymos{width:480px;height:180px;position:absolute;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} + .anonymos{width:480px;height:180px;position:fixed;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} .ni_con { width:425px; margin:25px 30px;} .ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;} .ni_con p{ color:#808181; } diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 73a9bc6bd..aadc93fa4 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -1,4 +1,38 @@ + + + <% if bids.blank? %> <%#= l(:label_uncommit_homework) %> 暂无作业! @@ -26,7 +60,15 @@ <% if User.current.logged? && is_cur_course_student(@course) %> <% cur_user_homework = cur_user_homework_for_bid(bid) %> <% if cur_user_homework!= nil && cur_user_homework.empty? %> - <%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %> + <% if bid.comment_status == 0 || bid.comment_status == 2%> + + <%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %> + + <% else %> + + 提交作业 + + <% end %> <% else %> <%= l(:lable_has_commit_homework)%> @@ -34,7 +76,8 @@ <% end %> <% end %> <% if (User.current.admin?||User.current.id==bid.author_id) %> - + <% if bid.open_anonymous_evaluation == 1%> + <% case bid.comment_status %> <% when 0 %> <%= link_to '启动匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...' %> @@ -44,11 +87,13 @@ 匿评结束 <% end %> - <%= link_to( + <%end%> + + <%= link_to( l(:button_edit), - {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id}, - :class => 'icon icon-edit' + {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id} ) %> + <%#= link_to( l(:button_delete), {:action => 'homework_destroy', :controller=>'bids', :course_id => bid.id}, @@ -94,19 +139,6 @@ ) - - <% if betweentime(bid.deadline) < 0 %> - - <%= l(:label_commit_limit)%> - - <% else %> - <% if betweentime(bid.deadline) < 3 %> - - <%= l(:label_commit_ar) %> - - <% end %> - <% end %> - @@ -146,10 +178,18 @@ <%=format_time bid.created_on %> - <%= l(:field_deadline) %> - :  - <%=bid.deadline %> - + <% if betweentime(bid.deadline) < 0 %> + + <%= l(:label_commit_limit)%> + + <% else %> + + + + <% end %> + diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 078ca8000..7cde4f31d 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -43,9 +43,9 @@ <% end %> <% unless @is_teacher%> - <% if @bid.comment_status == 0%> + <% if @bid.comment_status == 0 && @bid.open_anonymous_evaluation == 1%> $("#my_homework").click(); - <% elsif @bid.comment_status == 2%> + <% elsif @bid.comment_status == 2 || @bid.open_anonymous_evaluation == 0%> $("#all_homeworks").click(); <% end %> <% end %> 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/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index acbcbc2fa..036289b0a 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -28,14 +28,17 @@ <% else %> --> -

<%= link_to l(:label_issue_view_all), :controller => 'issues', - :action => 'index', - :set_filter => 1, - :assigned_to_id => 'me', - :sort => 'priority:desc,updated_on:desc' %>

+

+ <%#= link_to l(:label_issue_view_all), :controller => 'issues', + :action => 'index', + :set_filter => 1, + :assigned_to_id => 'me', + :sort => 'priority:desc,updated_on:desc' %> +

<% end %> <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, diff --git a/app/views/my/blocks/_issuesreportedbyme.html.erb b/app/views/my/blocks/_issuesreportedbyme.html.erb index 06bbda7f8..de5e20229 100644 --- a/app/views/my/blocks/_issuesreportedbyme.html.erb +++ b/app/views/my/blocks/_issuesreportedbyme.html.erb @@ -3,7 +3,7 @@ <% reported_issues = issuesreportedbyme_items %> <%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %> <% if reported_issues.length > 0 %> -

<%= link_to l(:label_issue_view_all), :controller => 'issues', +

<%#= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :set_filter => 1, :status_id => '*', diff --git a/app/views/my/blocks/_issueswatched.html.erb b/app/views/my/blocks/_issueswatched.html.erb index 510920a08..906a47b12 100644 --- a/app/views/my/blocks/_issueswatched.html.erb +++ b/app/views/my/blocks/_issueswatched.html.erb @@ -3,7 +3,7 @@ <%= render :partial => 'issues/list_simple', :locals => { :issues => watched_issues } %> <% if watched_issues.length > 0 %> -

<%= link_to l(:label_issue_view_all), :controller => 'issues', +

<%#= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :set_filter => 1, :watcher_id => 'me', diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index 4d3414a1f..63592d91a 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -76,8 +76,9 @@ <%= f.text_field :name ,:id => "tags_name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %> <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%> <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%> - <%= f.submit l(:button_project_tags_add),:class => "small" %> - <%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%> + <%= f.submit l(:button_project_tags_add),:class => "ButtonAddTags" %> + <%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();',:class=>'ButtonColor'%> + <% end %> <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 7d13e404e..28994fe29 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -107,7 +107,7 @@ <%= l(:label_i_new_activity) %> - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> + <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), course_for_bid_path(e.act_id) %> <% else %> @@ -117,7 +117,7 @@ <%= l(:label_new_activity) %>   - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> + <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), course_for_bid_path(e.act_id) %> <% end %> <% else %> diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index c33cc841e..8d0d6c40d 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -1,5 +1,5 @@ <% course_list.map do |course| %> -

  • /,"") %>> +
  • <%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
    @@ -9,11 +9,11 @@ <% unless course.is_public == 1 %> <%= l(:label_private) %> <% end %> - <%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <%= link_to(course.name.truncate(25, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> - <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> + <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> <%#=course.try(:teacher).try(:name)%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d89d078a7..f01a6e6d8 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2202,3 +2202,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| diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index e691b87aa..1b1580d8c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1277,7 +1277,7 @@ input#openid_url { background: url(../images/openid-bg.gif) no-repeat; backgroun .clear:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; } /***** Links *****/ -a, a:link, a:visited{ color: #169; text-decoration: none; } +a, a:link, a:visited{ color: #169 ; text-decoration: none; } a:hover, a:active{ color: #c61a1a; text-decoration: underline;} a img{ border: 0; } @@ -1580,13 +1580,15 @@ form {display: inline;} /*added by bai*/ input[type="submit"].bid_btn { padding-bottom: 5px; - width: 55px; + width: 50px; height: 25px; + text-align: center; font-family: '微软雅黑', Arial, Helvetica, sans-serif; font-size: 12px; color: #fff; - padding: 0px; + padding: 8px; background: #15bccf; + text-align: center; border-radius: 4px; border: 1px solid #15bccf; box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2), 0px 0px 2px rgb(255, 255, 255) inset; @@ -1594,6 +1596,25 @@ input[type="submit"].bid_btn { cursor: pointer; } +input[type="submit"].ButtonAddTags { + color: #fffbff ; + padding-bottom:5px ; + width:auto ; + height: 25px ; + font-family: '微软雅黑',Arial,Helvetica,sans-serif ; + font-size: 15px ; + font-weight: normal; + text-align: center ; + margin:0 auto; + border-radius: 0px !important; + background: #15bccf; + border: 0px solid #15bccf !important; + position: relative; + top:3px; + + +} + input[type="button"].bid_btn { /*padding-bottom: 5px;*/ width: 55px; @@ -1603,6 +1624,7 @@ input[type="button"].bid_btn { color: #fff; padding: 0px; background: #15bccf; + text-align: center; border-radius: 4px; border: 1px solid #15bccf; box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2), 0px 0px 2px rgb(255, 255, 255) inset; @@ -2180,7 +2202,7 @@ button.tab-right { padding-bottom: 2px; text-align: center; border: 1px solid #15BCCF; - /*border-bottom: 0px solid #15BCCF;*/ + border-bottom: 0px solid #15BCCF; color:#606060; font-weight:bold; diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index e54cd3af5..2eb401dfd 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -69,7 +69,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} /****评分弹框****/ -.alert_box {width:488px;height:550px;position:absolute;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; } +.alert_box {width:488px;height:550px;position:fixed;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; } .alert .close{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-502px;background:url(images/close.png) no-repeat;cursor:pointer;} .alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; } @@ -143,7 +143,7 @@ a:hover.tijiao{ background:#0f99a9 !important;} .N_search{ height:20px !important; border:1px solid #999 !important;} /* 匿名评分弹框 */ -.alert_praise{width:480px;height:200px;position:absolute;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} +.alert_praise{width:480px;height:200px;position:fixed;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} .alert .close02{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-490px;background:url(images/close.png) no-repeat;cursor:pointer;} .ni_con { width:425px; margin:25px 30px;} .ni_con h2{ display:block; height:40px; width:188px; margin:0 auto;} diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 10dbededb..50a1de7c4 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -475,19 +475,21 @@ body { top: 1px; } input[class~='ButtonClolr'],.ButtonColor{ + color: #fffbff !important; - padding-bottom: 5px; - width: 40px; - height: 20px; + padding: 5px; + width: auto; + height: 24px ; font-family: '微软雅黑',Arial,Helvetica,sans-serif; font-size: 15px; - + text-align: center; padding: 0px; - background: #15bccf; - border: 1px solid #15bccf; - + background: #15bccf !important; + border: 0px solid #15bccf ; + display:inline-block } + input[class~='whiteButton'], .whiteButton { -moz-box-shadow: inset 0px 1px 0px 0px #ffffff; -webkit-box-shadow: inset 0px 1px 0px 0px #ffffff; @@ -541,7 +543,6 @@ input[class~='m3p10'], .m3p10 { padding: 3px 10px; height: 20px; display: inline-block; - text-align: center; color: #ffffff; } @@ -648,14 +649,14 @@ input[class='nyan-clean-gray']:active, .nyan-clean-gray:active { } .tools a:visited { - color: #116699; + color: #fffbff; text-decoration: none; padding: 3px 5px 0px 5px; width: 100px; } .tools a:hover { - color: white; + color: #fffbff; padding: 3px 3px 0px 20px; width: 88px; text-decoration: none;