From 6c9c849e7c9b1c097453018542f80507561f6a52 Mon Sep 17 00:00:00 2001 From: baiyu Date: Tue, 19 Nov 2013 15:15:54 +0800 Subject: [PATCH 1/5] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E7=9A=84=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=202=E3=80=81=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E6=88=90=E5=91=98=E5=AD=A6=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 13 +++++++- app/views/bids/settings.erb | 30 +++++++++++++++++++ app/views/layouts/base_bids.html.erb | 4 +-- app/views/layouts/base_contest.html.erb | 16 ++++++++-- app/views/layouts/base_users.html.erb | 4 +-- app/views/news/index.html.erb | 2 +- app/views/projects/_member_list.html.erb | 4 +-- app/views/projects/member.html.erb | 2 +- config/locales/zh.yml | 2 ++ config/routes.rb | 1 + public/stylesheets/application.css | 26 ++++++++++++++-- .../stylesheets/application.css | 13 ++++++++ 12 files changed, 103 insertions(+), 14 deletions(-) create mode 100644 app/views/bids/settings.erb diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index a6fa6ed8c..e354e477f 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -8,7 +8,7 @@ class BidsController < ApplicationController menu_item :homework_statistics, :only => :homework_statistics #Ended by young before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork, - :show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator] + :show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] # added by fq before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest] # end @@ -253,6 +253,17 @@ class BidsController < ApplicationController render :layout => 'base_contest' end + + def settings + if @bid.author.id == User.current.id + if @bid.reward_type == 2 + @contest = Bid.find_by_reward_type(@bid.reward_type) + render :layout => 'base_contest' + end + else + render_403 :message => :notice_not_contest_setting_authorized + end + end #end def show_course diff --git a/app/views/bids/settings.erb b/app/views/bids/settings.erb new file mode 100644 index 000000000..aabe788ae --- /dev/null +++ b/app/views/bids/settings.erb @@ -0,0 +1,30 @@ + +

<%=l(:label_settings)%>

+ +<%= error_messages_for 'bid' %> + +<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_contest'} do |f| %> +
+ <%= render :partial => 'form_contest', :locals => { :f => f } %> +
+ <%= submit_tag l(:button_create) %> + <%= javascript_tag "$('#bid_name').focus();" %> +<% end %> \ No newline at end of file diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb index 377f44132..91584d42c 100644 --- a/app/views/layouts/base_bids.html.erb +++ b/app/views/layouts/base_bids.html.erb @@ -68,7 +68,7 @@ - + @@ -86,7 +86,7 @@ <% if @bid.reward_type.nil? or @bid.reward_type == 1%> <% elsif @bid.reward_type == 2%> - + <% else %> <% end %> diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb index 2af659def..a75374eb8 100644 --- a/app/views/layouts/base_contest.html.erb +++ b/app/views/layouts/base_contest.html.erb @@ -62,19 +62,29 @@
<%= h @bid.name %>
<%= watcher_link(@bid, User.current) %>
<%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget%><%= l(:label_bids_reward_method) %><%= @bid.budget%><%= l(:label_bids_reward_method) %><%= @bid.budget%><%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= @bid.budget%> <%= l(:label_bids_credit_number) %>
- + - + <%= watcher_link(@bid, User.current) %>
<%= h @bid.name %>
+ <%= join_in_contest(@bid, User.current)%> - <%= watcher_link(@bid, User.current) %>
+ + + + diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 64c33e32a..5d66992c8 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -55,8 +55,8 @@
+ <%if User.current.logged? %> + <% if @bid.author.id == User.current.id %> + <%= link_to l(:label_contest_modify_settings), {:controller => 'bids', :action => 'settings', :id => @bid} %> + <% end %> + <% end %> +
<%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%>
<%= l(:label_bids_reward_method) %><%= @bid.budget%>
- - <%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%> +
<%= h @user.lastname<<@user.firstname %> <%= h @user.lastname<<@user.firstname %> + <%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%>
<% unless User.current == @user %> diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index b4c23fd73..39fcfd7da 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -22,7 +22,7 @@ <%= labelled_form_for @news, :url => project_news_index_path(@project), :html => { :id => 'news-form', :multipart => true } do |f| %> <%= render :partial => 'news/form', :locals => { :f => f } %> - <%= submit_tag l(:button_create) %> + <%= submit_tag l(:button_create), :class => 'button-submit', :name => nil %> <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> | <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()' %> <% end if @project %> diff --git a/app/views/projects/_member_list.html.erb b/app/views/projects/_member_list.html.erb index 9040b6a51..9702fb526 100644 --- a/app/views/projects/_member_list.html.erb +++ b/app/views/projects/_member_list.html.erb @@ -6,8 +6,8 @@ <%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %> <% end %> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :class => 'avatar')) %> - <%= content_tag "div", link_to_user(member.principal), :class => "nomargin avatar_name" %> - + <%= content_tag "div", link_to_user(member.user.show_name), :class => "nomargin avatar_name" %> + <%= l(:label_bidding_user_studentcode) %> :<%= member.user.user_extensions.student_id%> <% if @project.project_type == 1 %>
 

diff --git a/app/views/projects/member.html.erb b/app/views/projects/member.html.erb index 33eac5da1..3d3076bcc 100644 --- a/app/views/projects/member.html.erb +++ b/app/views/projects/member.html.erb @@ -5,6 +5,6 @@

<%= error_messages_for 'member' %> - <%= render :partial => @render_file, :locals => {:members => @members} %> + <%= render :partial => @render_file, :locals => {:members => @members} %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2262c5e0c..0140d667f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -168,6 +168,7 @@ zh: notice_file_not_found: 您访问的页面不存在或已被删除。 notice_locking_conflict: 数据已被另一位用户更新 notice_not_authorized: 对不起,您无权访问此页面。 + notice_not_contest_setting_authorized: 对不起,您无权配置此竞赛。 notice_not_authorized_archived_project: 要访问的项目已经归档。 notice_email_sent: "邮件已发送至 %{value}" notice_email_error: "发送邮件时发生错误 (%{value})" @@ -1588,6 +1589,7 @@ zh: label_join_contest: 加入竞赛 label_exit_contest: 退出竞赛 + label_contest_modify_settings: 配置竞赛 #added by bai label_no_current_participate: 该竞赛暂无参与者 #end diff --git a/config/routes.rb b/config/routes.rb index 7fe48d3d7..14fa0c9d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -474,6 +474,7 @@ RedmineApp::Application.routes.draw do post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest' delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest' match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai + match 'calls/:id/settings', :to => 'bids#settings' delete 'attachment/:id', :to => 'attachments#delete_homework' match 'new_join', :to => 'projects#new_join', :as => 'try_join' diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index d6709d448..6be28f47b 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -31,7 +31,18 @@ h4 {border-bottom: 1px dotted #bbb;} padding-bottom: 20px; padding-left: 5px; } - + +.new_submit{ + padding-bottom: 5px; + width: 55px; + height: 25px; + font-family: '微软雅黑',Arial,Helvetica,sans-serif; + font-size: 12px; + color: #fff; + padding: 0px; + background: #15bccf; + border: 1px solid #15bccf; +} .content-text-list{ margin-bottom: 10px; border-bottom: 1px dashed rgb(204, 204, 204); @@ -100,7 +111,18 @@ h4 {border-bottom: 1px dotted #bbb;} padding-top: 5px; } - +.button-submit{ + padding-bottom: 5px; + width: 55px; + height: 25px; + font-family: '微软雅黑',Arial,Helvetica,sans-serif; + font-size: 12px; + color: #fff; + padding: 0px; + background: #15bccf; + border: 1px solid #15bccf; + +} /*end*/ .top-content-home{ diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 921d4ce2d..2fbc30426 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -1906,6 +1906,19 @@ input[type="submit"] { text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2), 0px 1px 0px rgb(255, 255, 255); cursor: pointer; } + +input[type="button-submit"] { + padding-bottom: 5px; + width: 55px; + height: 25px; + font-family: '微软雅黑',Arial,Helvetica,sans-serif; + font-size: 12px; + color: #fff; + padding: 0px; + background: #15bccf; + border: 1px solid #15bccf; +} + #button_width_auto { padding-bottom: 5px; width: auto; From 9293ef53b9f81579ac157d179145c87b7ed3e375 Mon Sep 17 00:00:00 2001 From: baiyu Date: Tue, 19 Nov 2013 16:05:52 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E9=85=8D=E7=BD=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 24 ++++++++++++++++++- .../bids/{settings.erb => settings.html.erb} | 0 config/routes.rb | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) rename app/views/bids/{settings.erb => settings.html.erb} (100%) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index e354e477f..73eb31068 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -248,7 +248,7 @@ class BidsController < ApplicationController end - # added by bai + # added by bai 增加了参与者和竞赛设置 def show_participator render :layout => 'base_contest' @@ -608,6 +608,28 @@ class BidsController < ApplicationController end end + def update_contest + @bid = Bid.find(params[:id]) + @bid.name = params[:bid][:name] + @bid.description = params[:bid][:description] + @bid.reward_type = 2 + @bid.budget = params[:bid][:budget] + @bid.deadline = params[:bid][:deadline] + @bid.password = params[:bid][:password] + @bid.author_id = User.current.id + @bid.commit = 0 + if @bid.save + unless @bid.watched_by?(User.current) + if @bid.add_watcher(User.current) + flash[:notice] = l(:label_bid_succeed) + end + end + redirect_to respond_path(@bid) + else + @bid.safe_attributes = params[:bid] + render :action => 'new_bid' + end + end #huang def new_contest @bid = Bid.new diff --git a/app/views/bids/settings.erb b/app/views/bids/settings.html.erb similarity index 100% rename from app/views/bids/settings.erb rename to app/views/bids/settings.html.erb diff --git a/config/routes.rb b/config/routes.rb index 14fa0c9d2..2e897b4ef 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -474,6 +474,7 @@ RedmineApp::Application.routes.draw do post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest' delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest' match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai + match 'calls/:id/update_contest', :to => 'bids#update_contest' #bai match 'calls/:id/settings', :to => 'bids#settings' delete 'attachment/:id', :to => 'attachments#delete_homework' From e8aa5633d8310bea70784363d6971bd6ef19e9d5 Mon Sep 17 00:00:00 2001 From: baiyu Date: Tue, 19 Nov 2013 16:08:55 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E9=85=8D=E7=BD=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/settings.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/bids/settings.html.erb b/app/views/bids/settings.html.erb index aabe788ae..b9be79d43 100644 --- a/app/views/bids/settings.html.erb +++ b/app/views/bids/settings.html.erb @@ -21,7 +21,7 @@ <%= error_messages_for 'bid' %> -<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_contest'} do |f| %> +<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'update_contest'} do |f| %>
<%= render :partial => 'form_contest', :locals => { :f => f } %>
From 1a42cdd0137341667adeb0d33c0f4c5f50f14e43 Mon Sep 17 00:00:00 2001 From: baiyu Date: Wed, 20 Nov 2013 08:57:37 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=B8=8E=E7=AB=9E=E8=B5=9B=E7=9A=84=E4=BA=BA=E5=90=8D?= =?UTF-8?q?=E8=B6=85=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 1 + app/views/bids/show_participator.html.erb | 2 +- app/views/projects/_member_list.html.erb | 2 +- config/routes.rb | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 73eb31068..7d7861c16 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -608,6 +608,7 @@ class BidsController < ApplicationController end end +# added by bai def update_contest @bid = Bid.find(params[:id]) @bid.name = params[:bid][:name] diff --git a/app/views/bids/show_participator.html.erb b/app/views/bids/show_participator.html.erb index 80492de32..da62436b9 100644 --- a/app/views/bids/show_participator.html.erb +++ b/app/views/bids/show_participator.html.erb @@ -12,7 +12,7 @@ :title => "#{user.show_name}" %>
-
<%= content_tag "div", link_to_user(user.show_name), :class => "project_avatar_name" , + <%= content_tag "div", link_to(user.show_name, user_path(user)), :class => "project_avatar_name" , :title => "#{user.show_name}" %> diff --git a/app/views/projects/_member_list.html.erb b/app/views/projects/_member_list.html.erb index 9702fb526..9143ae971 100644 --- a/app/views/projects/_member_list.html.erb +++ b/app/views/projects/_member_list.html.erb @@ -6,7 +6,7 @@ <%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %> <% end %> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :class => 'avatar')) %> - <%= content_tag "div", link_to_user(member.user.show_name), :class => "nomargin avatar_name" %> + <%= content_tag "div", link_to(member.user.show_name, user_path(member.user)), :class => "nomargin avatar_name" %> <%= l(:label_bidding_user_studentcode) %> :<%= member.user.user_extensions.student_id%> <% if @project.project_type == 1 %>
  diff --git a/config/routes.rb b/config/routes.rb index 2e897b4ef..dd1af90c7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -475,7 +475,7 @@ RedmineApp::Application.routes.draw do delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest' match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai match 'calls/:id/update_contest', :to => 'bids#update_contest' #bai - match 'calls/:id/settings', :to => 'bids#settings' + match 'calls/:id/settings', :to => 'bids#settings' #bai delete 'attachment/:id', :to => 'attachments#delete_homework' match 'new_join', :to => 'projects#new_join', :as => 'try_join' From ec9e98936119305e5d6a898f379cd4394b28f19f Mon Sep 17 00:00:00 2001 From: huangjingquan Date: Wed, 20 Nov 2013 09:30:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=AD=A6=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_member_list.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/projects/_member_list.html.erb b/app/views/projects/_member_list.html.erb index 9143ae971..e29dde733 100644 --- a/app/views/projects/_member_list.html.erb +++ b/app/views/projects/_member_list.html.erb @@ -7,7 +7,11 @@ <% end %> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :class => 'avatar')) %> <%= content_tag "div", link_to(member.user.show_name, user_path(member.user)), :class => "nomargin avatar_name" %> - <%= l(:label_bidding_user_studentcode) %> :<%= member.user.user_extensions.student_id%> + + <% unless member.user.user_extensions.identity ==0 %> + + <%= content_tag "p", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :class => "nomargin avatar_name" %> + <% end %> <% if @project.project_type == 1 %>