diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb index cee19ba04..a123f3b55 100644 --- a/app/controllers/test_controller.rb +++ b/app/controllers/test_controller.rb @@ -9,6 +9,27 @@ def index # @message.each do |m| # Activity.create(:act_id => m.id, :act_type => 'Message', :user_id => m.author_id) # end + activity = Message.all + activity += News.all + activity += Journal.all + activity += Issue.all + activity += Bid.all + @activity = activity.sort {|x,y| x.created_on <=> y.created_on} + @activity.each do |act| + if act.instance_of?(Bid) + act.acts << Activity.new(:user_id => act.author_id) + elsif act.instance_of?(News) + act.acts << Activity.new(:user_id => act.author_id) + elsif act.instance_of?(Message) + act.acts << Activity.new(:user_id => act.author_id) + elsif act.instance_of?(Journal) + act.acts << Activity.new(:user_id => act.user_id) + elsif act.instance_of?(Issue) + act.acts << Activity.new(:user_id => act.author_id) + elsif act.instance_of?(Changeset) + act.acts << Activity.new(:user_id => act.user_id) + end + end #@watchers_of_projects = WatchersOfProjects.new diff --git a/app/models/issue.rb b/app/models/issue.rb index 8d6f6e7c5..cc321aad0 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -42,6 +42,11 @@ class Issue < ActiveRecord::Base has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all + + # added by fq + has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + # end + acts_as_nested_set :scope => 'root_id', :dependent => :destroy acts_as_attachable :after_add => :attachment_added, :after_remove => :attachment_removed @@ -65,6 +70,11 @@ class Issue < ActiveRecord::Base DONE_RATIO_OPTIONS = %w(issue_field issue_status) attr_reader :current_journal + + # fq + after_create :act_as_activity + # end + delegate :notes, :notes=, :private_notes, :private_notes=, :to => :current_journal, :allow_nil => true validates_presence_of :subject, :priority, :project, :tracker, :author, :status @@ -102,6 +112,15 @@ class Issue < ActiveRecord::Base after_save :after_create_from_copy after_destroy :update_parent_attributes + + # fq + def act_as_activity + self.acts << Activity.new(:user_id => self.author_id) + end + # end + + + # Returns a SQL conditions string used to find all issues visible by the specified user def self.visible_condition(user, options={}) Project.allowed_to_condition(user, :view_issues, options) do |role, user| diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 6928f6171..8879c381b 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -5,8 +5,8 @@
<% if @user.auth_source_id.nil? %> -

<%= f.text_field :login, :size => 25, :required => true %>

- +

<%= f.text_field :login, :size => 25, :required => true %> + 至多25个字符。

<%= f.password_field :password, :size => 25, :required => true %> <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %>

diff --git a/app/views/bids/show_project.html.erb b/app/views/bids/show_project.html.erb index c50be2f54..ba0b99283 100644 --- a/app/views/bids/show_project.html.erb +++ b/app/views/bids/show_project.html.erb @@ -6,8 +6,8 @@ height: 30px; line-height: 18px; font-size: 14px; - color: rgb(255, 255, 255); - background: url("/images/button/bg104.jpg") no-repeat scroll left top transparent; + color: rgb(0, 0, 0); + background: url("/images/button/bg103.jpg") no-repeat scroll left top transparent; padding: 0px 0px 4px 0px; border-radius: 2px; border: 1px solid rgb(148, 148, 148); @@ -21,8 +21,8 @@ height: 30px; line-height: 18px; font-size: 14px; - color: rgb(255, 255, 255); - background: url("/images/button/bg104.jpg") no-repeat scroll left top transparent; + color: rgb(0, 0, 0); + background: url("/images/button/bg103.jpg") no-repeat scroll left top transparent; padding: 0px 0px 4px 0px; border-radius: 2px; border: 1px solid rgb(148, 148, 148); diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 07ffffd1d..0dcde40b5 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -79,10 +79,29 @@ <%= textilizable act.description %>

+ <% when 'Issue' %> + + <% if e.user == User.current%> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %> + <% else %> + <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %> + <% end %> + + + +

+ <%= textilizable act.description %> +

+ <% end %> - <%= format_time(e.act.created_on) %> + + <% if e.act_type == 'Changeset' %> + <%= format_time(e.act.committed_on) %> + <% else %> + <%= format_time(e.act.created_on) %> + <% end %> diff --git a/config/routes.rb b/config/routes.rb index d9b70ec40..c7d85549b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -430,6 +430,8 @@ RedmineApp::Application.routes.draw do match 'bids/new_bid', :controller => 'bids', :action => 'new_bid' match 'bids/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid' match 'bids/:id/add', :controller => 'bids', :action => 'add' + ## 测试用 + match 'test/index', :controller => 'test', :action => 'index' # added by young match 'bids', :controller => 'bids', :action => 'index' diff --git a/db/schema.rb b/db/schema.rb index 9d1b24e05..c5d03c06c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -625,22 +625,6 @@ ActiveRecord::Schema.define(:version => 20130811122119) do t.integer "fields_bits", :default => 0 end - create_table "user_extensions", :force => true do |t| - t.integer "user_id" - t.text "brief_introduction" - t.text "gender" - t.date "birthdate" - t.text "occupation" - t.text "location" - t.integer "zip_code" - t.float "work_experitions" - t.integer "qq" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "user_preferences", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.text "others"