diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index b865328f5..062199491 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -152,7 +152,8 @@ class AccountController < ApplicationController unless @user.id.nil? ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => params[:no]) unless params[:province].nil? || params[:city].nil? - ue.location = params[:province]+params[:city] + ue.location = params[:province] + ue.location_city = params[:city] ue.save end end diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index f41209d8c..91d3538b8 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -12,6 +12,7 @@ class BidsController < ApplicationController helper :watchers helper :attachments include AttachmentsHelper + helper :projects def index # Modified by nie @@ -62,6 +63,46 @@ class BidsController < ApplicationController end #end end + + def fork + @new_bid = Bid.new + @new_bid.safe_attributes = params[:bid] + @courses = [] + @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) + @membership.each do |membership| + if membership.project.project_type == 1 + @courses << membership.project + end + end + end + + def create_fork + @homework = Bid.new + @homework.name = params[:bid][:name] + @homework.description = params[:bid][:description] + @homework.reward_type = 3 + # @bid.budget = params[:bid][:budget] + @homework.deadline = params[:bid][:deadline] + @homework.budget = 0 + @homework.author_id = User.current.id + @homework.commit = 0 + @homework.homework_type = params[:bid][:homework_type] + @homework.parent_id = @bid.id + @homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) + # @bid. + if @homework.save + HomeworkForCourse.create(:project_id => params[:course], :bid_id => @homework.id) + unless @bid.watched_by?(User.current) + if @bid.add_watcher(User.current) + flash[:notice] = l(:label_bid_succeed) + end + end + redirect_to respond_path(@homework) + else + @homework.safe_attributes = params[:bid] + render :action => 'fork' + end + end def show @user = @bid.author @@ -393,6 +434,7 @@ class BidsController < ApplicationController def find_bid if params[:id] @bid = Bid.find(params[:id]) + @user = @bid.author end rescue render_404 diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 21a474e89..550f2f903 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -79,30 +79,41 @@ class MyController < ApplicationController # added by bai if @user.user_extensions.nil? - se = UserExtensions.new - se.user_id = @user.id - se.occupation = params[:occupation] - se.gender = params[:gender] - if params[:province] && params[:city] - se.location = params[:province]+params[:city] - end - if params[:identity] - se.identity = params[:identity].to_i - end - if params[:technical_title] - se.technical_title = params[:technical_title] - end - if params[:no] - se.student_id = params[:no] - end + se = UserExtensions.new + se.user_id = @user.id + if params[:occupation] + se.occupation = params[:occupation] + end + + se.gender = params[:gender] + + if params[:province] && params[:city] + se.location = params[:province] + se.location_city = params[:city] + end + if params[:identity] + se.identity = params[:identity].to_i + end + if params[:technical_title] + se.technical_title = params[:technical_title] + end + if params[:no] + se.student_id = params[:no] + end se.save else se = @user.user_extensions - se.occupation = params[:occupation] + if params[:occupation] + se.occupation = params[:occupation] + end + se.gender = params[:gender] + if params[:province] && params[:city] - se.location = params[:province]+params[:city] - end + se.location = params[:province] + se.location_city = params[:city] + end + if params[:identity] se.identity= params[:identity].to_i end diff --git a/app/helpers/bids_helper.rb b/app/helpers/bids_helper.rb index 6176b0f20..ddab8da7e 100644 --- a/app/helpers/bids_helper.rb +++ b/app/helpers/bids_helper.rb @@ -39,7 +39,7 @@ module BidsHelper Bid.tagged_with(tag_name).order('updated_on desc') end - def sort_bid(state) + def sort_bid(state) content = ''.html_safe case state when 0 @@ -54,6 +54,17 @@ module BidsHelper content_tag('div', content, :class => "tabs") end + def course_options_for_select(courses) + # + html = '' + courses.each do |course| + html << "" + end + html.html_safe + end + # used to get the reward and handle the value which can be used to display in views # added by william diff --git a/app/views/bids/_fork_form.html.erb b/app/views/bids/_fork_form.html.erb new file mode 100644 index 000000000..b84404527 --- /dev/null +++ b/app/views/bids/_fork_form.html.erb @@ -0,0 +1,20 @@ + +<%= error_messages_for 'bid' %> + +
<%= l(:label_homeworks_form_new_description) %>
+选择课程<%= select_tag 'course', course_options_for_select(@courses) %>
+<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :value => @bid.name %>
+ ++<%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>
+ +<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%> +
+<%= f.select :homework_type, homework_type_option %> +
+ \ No newline at end of file diff --git a/app/views/bids/fork.html.erb b/app/views/bids/fork.html.erb new file mode 100644 index 000000000..d87221aca --- /dev/null +++ b/app/views/bids/fork.html.erb @@ -0,0 +1,10 @@ + +<%= l(:label_location) %>
diff --git a/app/views/praise_tread/_praise_tread.html.erb b/app/views/praise_tread/_praise_tread.html.erb index fbdb6f8b9..4e28d7033 100644 --- a/app/views/praise_tread/_praise_tread.html.erb +++ b/app/views/praise_tread/_praise_tread.html.erb @@ -5,17 +5,17 @@ <% @is_valuate = is_praise_or_tread(obj,user_id)%> <% if @is_valuate.size > 0 %> <% @flag = @is_valuate.first.praise_or_tread %> - <% if @flag == 1 %> + <% if @flag == 1 %><%= image_tag "/images/praise_tread/praise_true.png" ,:title => l(:label_issue_praise_over) %> | +<%= image_tag "/images/praise_tread/praise_false.png" , weight:"35px", height:"35px",:title => l(:label_issue_praise_over) %> |
<%= get_praise_num(obj)%> | |
<%= image_tag "/images/praise_tread/tread_false.png",:title => l(:label_issue_appraise_over) %> | +<%= image_tag "/images/praise_tread/tread_false.png",weight:"35px", height:"35px",:title => l(:label_issue_appraise_over) %> |
<%= image_tag "/images/praise_tread/praise_false.png", :title => l(:label_issue_appraise_over) %> | +<%= image_tag "/images/praise_tread/praise_false.png",weight:"35px", height:"35px", :title => l(:label_issue_appraise_over) %> |
<%= get_praise_num(obj)%> | |
<%= image_tag "/images/praise_tread/tread_true.png",:title => l(:label_issue_tread_over) %> | +<%= image_tag "/images/praise_tread/tread_false.png",weight:"35px", height:"35px",:title => l(:label_issue_tread_over) %> |
<%= link_to image_tag("/images/praise_tread/praise_false.png",:title => l(:label_issue_praise)), + | <%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"35px", height:"35px",:title => l(:label_issue_praise)), :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class%> |
<%= get_praise_num(obj)%> | |
<%= link_to image_tag("/images/praise_tread/tread_false.png",:title => l(:label_issue_tread)),:controller=>"praise_tread", + | <%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"35px", height:"35px",:title => l(:label_issue_tread)),:controller=>"praise_tread", :action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class %> |
<% if bid.reward_type.nil? or bid.reward_type == 1%> - <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= bid.budget%> + <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= bid.budget%> <% elsif bid.reward_type == 2%> - <%= l(:label_bids_reward_method) %><%= bid.budget%> + <%= l(:label_bids_reward_method) %><%= bid.budget%> <% else %> - <%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= bid.budget%> <%= l(:label_bids_credit_number) %> + <%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= bid.budget%> <%= l(:label_bids_credit_number) %> <% end %> diff --git a/config/configuration.yml b/config/configuration.yml index 2bdb88836..3a14fa5d7 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -85,12 +85,14 @@ default: delivery_method: :smtp smtp_settings: - address: smtp.163.com - port: 25 - domain: smtp.163.com - authentication: :login - user_name: trustie2@163.com - password: PDLtrustie2 + + + address: smtp.gmail.com + port: 587 + domain: smtp.gmail.com + authentication: :plain + user_name: trustieforge@gmail.com + password: '!@#$%^&*()' # Absolute path to the directory where attachments are stored. # The default is the 'files' directory in your Redmine instance. diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2522b0bc7..dea23647e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1402,12 +1402,13 @@ zh: label_welcome_leave_message: 您好!系统目前正在内测,有意见和建议请 label_welcome_click_me: 点击我 - +# modified by bai label_issue_praise: 好问题,顶! label_issue_tread: 烂问题,踩! - label_issue_praise_over: 已顶! - label_issue_tread_over: 已踩! - label_issue_appraise_over: 已评价! + label_issue_praise_over: 我刚才顶过了~ + label_issue_tread_over: 我刚才踩过了~ + #end + label_issue_appraise_over: 只能评价一次哦! label_welcome_my_respond: 请在此留下你的意见和建议! label_no_current_fans: 该用户暂无粉丝 label_no_current_watchers: 该用户暂未关注其他用户 @@ -1515,6 +1516,7 @@ zh: label_course_homework_new: 发布作业 label_course_data: 资料 label_homework_statistics: 作业统计 + label_technical_title: 职称 # added by william 无english版本 label_bidding_results: 应标结果 diff --git a/config/routes.rb b/config/routes.rb index 946d788dc..a3a300573 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -446,6 +446,8 @@ RedmineApp::Application.routes.draw do match 'calls/create_homework', :to => 'bids#create_homework' match 'calls/:id/homework_respond', :to => 'bids#homework_respond' match 'calls/:id/homework_statistics', :to => 'bids#homework_statistics' + match 'calls/:id/fork', :to => 'bids#fork', :as => 'fork' + match 'calls/:id/create_fork', :to => 'bids#create_fork' post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' diff --git a/config/settings.yml b/config/settings.yml index d05a81828..3c22b1ad4 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -56,7 +56,7 @@ activity_days_default: per_page_options: default: '25,50,100' mail_from: - default: trustie2@163.com + default: trustieforge@gmail.com bcc_recipients: default: 1 plain_text_mail: @@ -90,11 +90,6 @@ diff_max_lines_displayed: enabled_scm: serialized: true default: - - Subversion - - Darcs - - Mercurial - - Cvs - - Bazaar - Git autofetch_changesets: default: 1 diff --git a/db/migrate/20130911135608_addidentity_to_user_extensions.rb b/db/migrate/20130911135608_addidentity_to_user_extensions.rb new file mode 100644 index 000000000..ad308a1bc --- /dev/null +++ b/db/migrate/20130911135608_addidentity_to_user_extensions.rb @@ -0,0 +1,7 @@ +class AddidentityToUserExtensions < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/migrate/20130911140019_removeidentity_from_user_extensions.rb b/db/migrate/20130911140019_removeidentity_from_user_extensions.rb new file mode 100644 index 000000000..3247c4df1 --- /dev/null +++ b/db/migrate/20130911140019_removeidentity_from_user_extensions.rb @@ -0,0 +1,7 @@ +class RemoveidentityFromUserExtensions < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/migrate/20130911140205_add_identity_to_user_extensions.rb b/db/migrate/20130911140205_add_identity_to_user_extensions.rb new file mode 100644 index 000000000..1f723fbf6 --- /dev/null +++ b/db/migrate/20130911140205_add_identity_to_user_extensions.rb @@ -0,0 +1,5 @@ +class AddIdentityToUserExtensions < ActiveRecord::Migration + def change + add_column :user_extensions, :identity, :integer + end +end diff --git a/db/migrate/20130918085747_add_student_id_to_user_extensions.rb b/db/migrate/20130918085747_add_student_id_to_user_extensions.rb new file mode 100644 index 000000000..74ff788bd --- /dev/null +++ b/db/migrate/20130918085747_add_student_id_to_user_extensions.rb @@ -0,0 +1,5 @@ +class AddStudentIdToUserExtensions < ActiveRecord::Migration + def change + add_column :user_extensions, :student_id, :integer + end +end diff --git a/db/migrate/20130922123727_add_teacher_realname_to_user_extensions.rb b/db/migrate/20130922123727_add_teacher_realname_to_user_extensions.rb new file mode 100644 index 000000000..6555c5264 --- /dev/null +++ b/db/migrate/20130922123727_add_teacher_realname_to_user_extensions.rb @@ -0,0 +1,5 @@ +class AddTeacherRealnameToUserExtensions < ActiveRecord::Migration + def change + add_column :user_extensions, :teacher_realname, :string + end +end diff --git a/db/migrate/20130922123849_add_studentr_realname_to_user_extensions.rb b/db/migrate/20130922123849_add_studentr_realname_to_user_extensions.rb new file mode 100644 index 000000000..6d8dac690 --- /dev/null +++ b/db/migrate/20130922123849_add_studentr_realname_to_user_extensions.rb @@ -0,0 +1,5 @@ +class AddStudentrRealnameToUserExtensions < ActiveRecord::Migration + def change + add_column :user_extensions, :student_realname, :string + end +end diff --git a/db/migrate/20130926005448_add_parent_id_to_bid.rb b/db/migrate/20130926005448_add_parent_id_to_bid.rb new file mode 100644 index 000000000..1bdd7fd3d --- /dev/null +++ b/db/migrate/20130926005448_add_parent_id_to_bid.rb @@ -0,0 +1,5 @@ +class AddParentIdToBid < ActiveRecord::Migration + def change + add_column :bids, :parent_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index f0e7566d5..c4b87d14e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,8 +11,15 @@ # # It's strongly recommended to check this file into your version control system. +ActiveRecord::Schema.define(:version => 20130926005448) do - + create_table "a_user_watchers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "member_id" + end create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -88,6 +95,7 @@ t.integer "commit" t.integer "reward_type" t.integer "homework_type" + t.integer "parent_id" end create_table "boards", :force => true do |t| @@ -281,9 +289,9 @@ add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :null => false t.integer "delay" end @@ -425,6 +433,22 @@ add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" + create_table "messages_for_bids", :force => true do |t| + t.string "message" + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages_for_users", :force => true do |t| + t.integer "messager_id" + t.integer "user_id" + t.string "message" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -564,26 +588,6 @@ t.string "issues_visibility", :limit => 30, :default => "default", :null => false end - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -594,9 +598,9 @@ create_table "shares", :force => true do |t| t.date "created_on" - t.string "url" t.string "title" - t.integer "share_type" + t.string "share_type" + t.string "url" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "project_id" @@ -604,9 +608,8 @@ t.string "description" end - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" + create_table "students", :force => true do |t| + t.string "name" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end @@ -669,7 +672,7 @@ create_table "tokens", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false + t.string "value", :limit => 40 t.datetime "created_on", :null => false end @@ -701,13 +704,12 @@ t.integer "student_id" t.string "teacher_realname" t.string "student_realname" -======= + t.string "location_city" t.integer "identity" t.string "technical_title" ->>>>>>> .theirs end create_table "user_preferences", :force => true do |t| @@ -732,13 +734,12 @@ create_table "user_tags", :force => true do |t| t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "tag_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - create_table "users", :force => true do |t| t.string "login", :default => "", :null => false t.string "hashed_password", :limit => 40, :default => "", :null => false diff --git a/public/images/praise_tread/praise_false.png b/public/images/praise_tread/praise_false.png index b3b7c00a2..9979427e0 100644 Binary files a/public/images/praise_tread/praise_false.png and b/public/images/praise_tread/praise_false.png differ diff --git a/public/images/praise_tread/praise_true.png b/public/images/praise_tread/praise_true.png index 8aef048ec..cb78f4839 100644 Binary files a/public/images/praise_tread/praise_true.png and b/public/images/praise_tread/praise_true.png differ diff --git a/public/images/praise_tread/tread_false.png b/public/images/praise_tread/tread_false.png index 5c06409f8..884cd380c 100644 Binary files a/public/images/praise_tread/tread_false.png and b/public/images/praise_tread/tread_false.png differ diff --git a/public/images/praise_tread/tread_true.png b/public/images/praise_tread/tread_true.png index 99bb52f01..b4328a0f5 100644 Binary files a/public/images/praise_tread/tread_true.png and b/public/images/praise_tread/tread_true.png differ |