diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index 0bf9394aa..fdb45b030 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -4,7 +4,11 @@ class AppliedProjectController < ApplicationController def applied_join_project @user_id = params[:user_id] @project = Project.find(params[:project_id]) - AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) + if @applieds.count == 0 + AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + end + #redirect_to project_path(params[:project_id]) #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true} respond_to do |format| @@ -16,10 +20,11 @@ class AppliedProjectController < ApplicationController #取消申请 def unapplied_join_project @project = Project.find(params[:project_id]) - @applied = AppliedProject.find(params[:id]) - @applied.destroy - #redirect_to project_path(params[:project_id]) - #redirect_to_referer_or {render :text => ( 'unsubscribe success.'), :layout => true} + #@applied = AppliedProject.find(params[:id]) + #@applied.destroy + + AppliedProject.deleteappiled(params[:user_id], params[:project_id]) + respond_to do |format| format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} format.js { render :partial => 'set_applied' } diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 5168913a7..d8e583bf7 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -46,42 +46,58 @@ class MembersController < ApplicationController end def create - members = [] - project_info = [] - user_grades = [] - if params[:membership] - if params[:membership][:user_ids] - attrs = params[:membership].dup - user_ids = attrs.delete(:user_ids) - user_ids.each do |user_id| - members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id) - user_grades << UserGrade.new(:user_id => user_id, :project_id => @project.id) - ## added by nie - if(params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3") - project_info << ProjectInfo.new(:user_id => user_id, :project_id => @project.id) - # ProjectInfo.create(:name => "test", :user_id => 123) + if params[:refusal_button] + members = [] + applied_members = true + if params[:membership] + if params[:membership][:user_ids] + attrs = params[:membership].dup + user_ids = attrs.delete(:user_ids) + user_ids.each do |user_id| + AppliedProject.deleteappiled(user_id, @project.id) end - ## end end - else - members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => params[:membership][:user_id]) - user_grades << UserGrade.new(:user_id => params[:membership][:user_id], :project_id => @project.id) - ## added by nie - if(params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3") - project_info << ProjectInfo.new(:project_id => @project.id, :user_id => params[:membership][:user_id]) - end - ## end end - @project.members << members - # added by nie - @project.project_infos << project_info - @project.user_grades << user_grades - # end + else + applied_members = false + members = [] + project_info = [] + user_grades = [] + if params[:membership] + if params[:membership][:user_ids] + attrs = params[:membership].dup + user_ids = attrs.delete(:user_ids) + user_ids.each do |user_id| + members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id) + user_grades << UserGrade.new(:user_id => user_id, :project_id => @project.id) + ## added by nie + if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3") + project_info << ProjectInfo.new(:user_id => user_id, :project_id => @project.id) + # ProjectInfo.create(:name => "test", :user_id => 123) + end + ## end + AppliedProject.deleteappiled(user_id, @project.id) + end + else + members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => params[:membership][:user_id]) + user_grades << UserGrade.new(:user_id => params[:membership][:user_id], :project_id => @project.id) + ## added by nie + if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3") + project_info << ProjectInfo.new(:project_id => @project.id, :user_id => params[:membership][:user_id]) + end + ## end + end + @project.members << members + # added by nie + @project.project_infos << project_info + @project.user_grades << user_grades + # end + end end respond_to do |format| format.html { redirect_to_settings_in_projects } - format.js { @members = members } + format.js { @members = members;@applied_members = applied_members; } format.api { @member = members.first if @member.valid? diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb index 4feca7b27..52b81610f 100644 --- a/app/controllers/open_source_projects_controller.rb +++ b/app/controllers/open_source_projects_controller.rb @@ -57,7 +57,7 @@ class OpenSourceProjectsController < ApplicationController @memo = RelativeMemo.new(:open_source_project => @open_source_project) @topic_count = @open_source_project.topics.count - @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] + @topic_pages = Paginator.new @topic_count, 10, params['page'] @memos = @open_source_project.topics. reorder("#{RelativeMemo.table_name}.sticky DESC"). includes(:last_reply). @@ -73,11 +73,40 @@ class OpenSourceProjectsController < ApplicationController format.json { render json: @open_source_project } end end - - def search + + +def search end + +# added by yiang 暴力添加,请绕道 +def showmemo + @open_source_project = OpenSourceProject.find(params[:id]) + + sort_init 'updated_at', 'desc' + sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at", + 'replies' => "#{RelativeMemo.table_name}.replies_count", + 'updated_at' => "COALESCE (last_replies_relative_memos.created_at, #{RelativeMemo.table_name}.created_at)" + + @memo = RelativeMemo.new(:open_source_project => @open_source_project) + @topic_count = @open_source_project.topics.count + @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] + @memos = @open_source_project.topics. + reorder("#{RelativeMemo.table_name}.sticky DESC"). + includes(:last_reply). + limit(@topic_pages.per_page). + offset(@topic_pages.offset). + order(sort_clause). + all + + respond_to do |format| + format.html { + render :layout => "base_opensource_p" + } + format.json { render json: @open_source_project } + end +end # GET /open_source_projects/new # GET /open_source_projects/new.json def new diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 32fc3dd57..5d270401a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -767,6 +767,7 @@ class ProjectsController < ApplicationController @subPage_title = l :label_member_list @members = @project.member_principals.includes(:roles, :principal).all @members = sort_project_members(@project, @members) + @applied_members = appied_project_members(@project, @members) end @members = paginateHelper @members render :layout => 'base_courses' if @project.project_type == 1 @@ -797,7 +798,20 @@ class ProjectsController < ApplicationController end memberlist end - + + def appied_project_members (project, members) + users = AppliedProject.where(:project_id => project.id). + memberlist = [] + users.each do |user| + members.each do |member| + if member[:user_id] == user[:user_id] + memberlist << member + end + end + end + memberlist + end + def file end diff --git a/app/controllers/relative_memos_controller.rb b/app/controllers/relative_memos_controller.rb index f8741365b..924efe9e7 100644 --- a/app/controllers/relative_memos_controller.rb +++ b/app/controllers/relative_memos_controller.rb @@ -37,7 +37,7 @@ class RelativeMemosController < ApplicationController def show pre_count = REPLIES_PER_PAGE - @memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示 + # @memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示 @memo.update_column(:viewed_count_local, (@memo.viewed_count_local.to_i + 1)) page = params[:page] @@ -92,13 +92,14 @@ class RelativeMemosController < ApplicationController def create @memo = RelativeMemo.new(params[:relative_memo]) # @memo.url = "http://forge.trustie.net/open_source_projects" - @memo.osp_id = params[:open_source_project_id] + # @memo.osp_id = params[:open_source_project_id] @memo.author_id = User.current.id @memo.save_attachments(params[:attachments] || (params[:relative_memo] && params[:relative_memo][:uploads])) respond_to do |format| if @memo.save + RelativeMemoToOpenSourceProject.create(:osp_id => params[:open_source_project_id], :relative_memo_id => @memo.id) format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } format.json { render json: @memo, status: :created, location: @memo } else @@ -142,7 +143,7 @@ class RelativeMemosController < ApplicationController def find_memo return unless find_osp - @memo = @open_source_project.relative_memos.find(params[:id]) + @memo = @open_source_project.topics.find(RelativeMemo.find(params[:id]).root.id) rescue ActiveRecord::RecordNotFound render_404 nil diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0c4514769..228f57ab6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -28,7 +28,6 @@ module ApplicationHelper include AvatarHelper ## added by william include PraiseTreadHelper - # add by nyan include CoursesHelper extend Forwardable @@ -472,6 +471,14 @@ module ApplicationHelper def added_time(created) l(:label_added_time, :age => time_tag(created)).html_safe end + + def user_url_and_time(user_name, user_url, created) + unless user_name.nil? + l(:label_added_time_by, :author => link_to(user_name, user_url), :age => time_tag(created)).html_safe + else + l(:label_added_time, :age => time_tag(created)).html_safe + end + end #huang def betweentime(enddate) @@ -1320,6 +1327,15 @@ module ApplicationHelper tags end + def hubspot_head + tags = javascript_include_tag('hubspot/messenger.min', 'hubspot/messenger-theme-future') + tags << stylesheet_link_tag('hubspot/messenger', 'hubspot/messenger-theme-future', 'hubspot/messenger-theme-flat') + unless User.current.pref.warn_on_leaving_unsaved == '0' + tags << "\n".html_safe + javascript_tag("$(window).load(function(){ warnLeavingUnsaved('#{escape_javascript l(:text_warn_on_leaving_unsaved)}'); });") + end + tags + end + def favicon "".html_safe end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 75676f475..91e05d6a8 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -32,4 +32,21 @@ module MembersHelper s + content_tag('div', content_tag('ul', links), :class => 'pagination_new') end + + # 当前申请加入的成员名单 + def render_principals_for_applied_members(project) + scope = Principal.active.sorted.applied_members(project).like(params[:q]) + principal_count = scope.count + principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] + principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all + + s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals') + + links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options| + link_to text, appliedproject_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true + } + + s + content_tag('div', content_tag('ul', links), :class => 'applied_new') + end + end diff --git a/app/models/applied_project.rb b/app/models/applied_project.rb index 04056cadc..accbc90e2 100644 --- a/app/models/applied_project.rb +++ b/app/models/applied_project.rb @@ -2,5 +2,14 @@ class AppliedProject < ActiveRecord::Base attr_accessible :project_id, :user_id belongs_to :user - belongs_to :project + belongs_to :project + + #删除用户申请 + def self.deleteappiled(userid, projectid) + @applieds = AppliedProject.where("user_id = ? and project_id = ?", userid, projectid) + @applieds.each do |applied| + applied.destroy + end + end + end diff --git a/app/models/open_source_project.rb b/app/models/open_source_project.rb index e526dc921..6413a0d9f 100644 --- a/app/models/open_source_project.rb +++ b/app/models/open_source_project.rb @@ -3,8 +3,10 @@ class OpenSourceProject < ActiveRecord::Base include Redmine::SafeAttributes has_many :applies, :class_name => "ApplyProjectMaster", :as => :apply, :dependent => :delete_all - has_many :topics, :class_name => 'RelativeMemo', :foreign_key => 'osp_id', :conditions => "#{RelativeMemo.table_name}.parent_id IS NULL", :order => "#{RelativeMemo.table_name}.created_at DESC", :dependent => :destroy - has_many :relative_memos, :class_name => 'RelativeMemo', :foreign_key => 'osp_id', :dependent => :destroy + has_many :relation_topics, :class_name => 'RelativeMemoToOpenSourceProject', :foreign_key => 'osp_id', :order => "#{RelativeMemo.table_name}.created_at DESC", :dependent => :destroy + # has_many :topics, :class_name => 'RelativeMemo', :foreign_key => 'osp_id', :conditions => "#{RelativeMemo.table_name}.parent_id IS NULL", :order => "#{RelativeMemo.table_name}.created_at DESC", :dependent => :destroy + has_many :topics, :through => :relation_topics, :class_name => 'RelativeMemo' + # has_many :relative_memos, :class_name => 'RelativeMemo', :foreign_key => 'osp_id', :dependent => :destroy has_many :tags, :through => :project_tags, :class_name => 'Tag' has_many :project_tags, :class_name => 'ProjectTags' has_many :masters, :class_name => 'ApplyProjectMaster', :as => :apply, :dependent => :delete_all, :conditions => "#{ApplyProjectMaster.table_name}.status = 2" @@ -126,9 +128,14 @@ class OpenSourceProject < ActiveRecord::Base def self.reset_counters!(id) osp_id = id.to_i - update_all("topic_count = (SELECT COUNT(*) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id} AND parent_id IS NULL)," + - " memo_count = (SELECT COUNT(*) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id} AND parent_id IS NOT NULL)," + - " last_memo_id = (SELECT MAX(id) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id})", + # update_all("topic_count = (SELECT COUNT(*) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id} AND parent_id IS NULL)," + + # " memo_count = (SELECT COUNT(*) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id} AND parent_id IS NOT NULL)," + + # " last_memo_id = (SELECT MAX(id) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id})", + # ["id = ?", osp_id]) + update_all("topic_count = (SELECT COUNT(*) FROM #{RelativeMemoToOpenSourceProject.table_name} WHERE osp_id=#{osp_id})", + # + + # " memo_count = (SELECT COUNT(*) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id} AND parent_id IS NOT NULL)," + + # " last_memo_id = (SELECT MAX(id) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id})", ["id = ?", osp_id]) end end diff --git a/app/models/principal.rb b/app/models/principal.rb index b6f41d535..15cebdf53 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -72,6 +72,12 @@ class Principal < ActiveRecord::Base } scope :sorted, lambda { order(*Principal.fields_for_order_statement)} + scope :applied_members, lambda {|project| + id = project.id + ids1 = project.applied_projects.map(&:user_id) + where("#{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE user_id in (?))", ids1) + } + before_create :set_default_empty_values def name(formatter = nil) diff --git a/app/models/project.rb b/app/models/project.rb index 5da9f674e..20c5de89b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -66,6 +66,7 @@ class Project < ActiveRecord::Base has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_many :applied_projects + # end #ADDED BY NIE has_many :project_infos, :dependent => :destroy @@ -121,7 +122,8 @@ class Project < ActiveRecord::Base after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?} after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} - after_save :create_board_sync #nyan + # 创建project之后默认创建一个board,之后的board去掉了board的概念 + after_save :create_board_sync before_destroy :delete_all_members def remove_references_before_destroy return if self.id.nil? diff --git a/app/models/relative_memo.rb b/app/models/relative_memo.rb index 24504241e..11766bb05 100644 --- a/app/models/relative_memo.rb +++ b/app/models/relative_memo.rb @@ -7,12 +7,13 @@ class RelativeMemo < ActiveRecord::Base has_many :tags, :through => :project_tags, :class_name => 'Tag' has_many :project_tags, :class_name => 'ProjectTags' + has_many :relation_topics, :class_name => 'RelativeMemoToOpenSourceProject' + has_many :no_uses, :as => :no_use, :dependent => :delete_all acts_as_taggable - acts_as_attachable - validates_presence_of :osp_id, :subject + validates_presence_of :subject #validates :content, presence: true # validates_length_of :subject, maximum: 50 #validates_length_of :content, maximum: 3072 @@ -80,6 +81,11 @@ class RelativeMemo < ActiveRecord::Base { :include => :no_uses, :conditions => ["#{NoUse.table_name}.user_id = ?", user_id] } } + + # 获取帖子的回复 + def replies + memos = RelativeMemo.where("parent_id = ?", id) + end def no_use_for?(user) self.no_uses.each do |no_use| diff --git a/app/models/relative_memo_to_open_source_project.rb b/app/models/relative_memo_to_open_source_project.rb new file mode 100644 index 000000000..cb33de2d6 --- /dev/null +++ b/app/models/relative_memo_to_open_source_project.rb @@ -0,0 +1,14 @@ +class RelativeMemoToOpenSourceProject < ActiveRecord::Base + # attr_accessible :title, :body + belongs_to :open_source_project, :foreign_key => "osp_id" + belongs_to :topic, :class_name => 'RelativeMemo', :foreign_key => 'relative_memo_id' + + has_many :no_uses, :as => :no_use, :dependent => :delete_all + + validates_presence_of :osp_id, :relative_memo_id + + scope :no_use_for, lambda { |user_id| + {:include => :no_uses, + :conditions => ["#{NoUse.table_name}.user_id = ?", user_id] } + } +end diff --git a/app/views/applied_project/_set_applied.js.erb b/app/views/applied_project/_set_applied.js.erb index e77592060..7403b963b 100644 --- a/app/views/applied_project/_set_applied.js.erb +++ b/app/views/applied_project/_set_applied.js.erb @@ -1,4 +1,13 @@ <% selector = ".#{applied_css(@project)}" %> $("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript applied_link(@project, User.current) %>")}); - - +if (window.Messenger) { + Messenger.options = { + extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right', + theme: 'flat' + } + Messenger().post({ + id: "label_apply_project_waiting", + message: "<%= l(:label_apply_project_waiting) %>", + showCloseButton: true, + }); +}; diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index d720429fb..c9a8af0a4 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -4,7 +4,12 @@
- +
<%= l(:label_task_plural)%>(<%= @homework_list.count%>)<%= l(:label_task_plural)%>(<%= @homework_list.count%>) + <%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if( + User.current.admin? || + !(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) || + (Rails.env.development?) %> + <% end %> <% display_id = im_watching_student_id? @bid%> -<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;display: inline-block;" if( - User.current.admin? || - !(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) || - (Rails.env.development?) %> <% @homework_list.each do |homework|%> <% if homework.attachments.any?%> diff --git a/app/views/bids/show_project.html.erb b/app/views/bids/show_project.html.erb index 02ef72e7c..c14d2e14c 100644 --- a/app/views/bids/show_project.html.erb +++ b/app/views/bids/show_project.html.erb @@ -1,110 +1,71 @@ - - <% if @bid.homework_type == Bid::HomeworkFile %> - <%= render :partial => 'homework' %> - + <%= render :partial => 'homework' %> + <% else %> - - - <% if User.current.logged? %> - - -
- - -
-
- - - <% if @bid.reward_type == 3 %> - - - - <% else %> - - - - <% end %> - - - -
<%= select_tag 'bid', options_for_select(select_option_helper(@option)), :name => 'bid', :class => 'grayline' %> -

-

- <%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%> -
-

-
<%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason_homework), :style => "resize: none;", :class => 'noline'%>
<%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%>
- <%= submit_tag l(:button_add), :name => nil , :class => "enterprise", - :onmouseout => "this.style.backgroundPosition = 'left top'", - :onmouseover => "this.style.backgroundPosition = 'left -30px'"%> - <%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();", - :type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'", - :onmouseover => "this.style.backgroundPosition = 'left -30px'" %> -
- <% end %> - - <% end %> -
- <%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project,:bid => @bid} %> -
+ function cancel() { + $("#put-bid-form").hide(); + } + + <% if User.current.logged? %> + + + + <% end %> +
+ <%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project, :bid => @bid} %> +
<% end %> diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 6aef01e1d..f4857bd22 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -2,7 +2,7 @@
- + + + +
<%= link_to h(topic.subject), open_source_project_relative_memo_path(topic.open_source_project, topic) %><%= link_to h(topic.subject), open_source_project_relative_memo_path(open_source_project, topic) %> - + - +
<%= link_to (topic.replies_count), open_source_project_relative_memo_path(topic.open_source_project, topic) %><%= link_to (topic.replies_count), open_source_project_relative_memo_path(open_source_project, topic) %>
回答回帖
- + + + + + +
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(topic.open_source_project, topic) %><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %>
关注
+ + + @@ -36,25 +400,20 @@ - + - + - - - -
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %>
浏览
帖子来源:<%= link_to topic.url, topic.url%> 帖子来源:<%=link_to 'OSChina', topic.url %> + <%= no_use_link(topic, User.current) %>
<%= image_tag( "/images/sidebar/tags.png") %> - <%= render :partial => 'tags/tag_name', :locals => {:obj => topic,:object_flag => "9",:non_list_all => true }%>
- <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index e7d24c329..d84cfb664 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -147,6 +147,8 @@ en: general_pdf_encoding: UTF-8 general_first_day_of_week: '7' + label_approve: Approve + label_refusal: Refusal notice_account_updated: Account was successfully updated. notice_account_invalid_creditentials: Invalid user or password notice_account_password_updated: Password was successfully updated. @@ -1166,6 +1168,7 @@ en: label_tags_issue_description: issue description label_tags_all_objects: all objects label_apply_project: Apply Project + label_apply_project_waiting: "Application has been submitted, please wait for administrator review." label_unapply_project: Unsubscribe #fq diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 8c89eab78..b03e3bc31 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -155,6 +155,9 @@ zh: general_pdf_encoding: gb18030 general_first_day_of_week: '7' + label_approve: 批准 + label_refusal: 拒绝 + notice_account_updated: 帐号更新成功 notice_account_invalid_creditentials: 无效的用户名或密码 notice_account_invalid_creditentials_new: 您还未到邮箱激活 @@ -480,7 +483,7 @@ zh: label_project_latest: 最近的项目 label_issue: 问题 label_issue_new: 新建问题 - label_issue_plural: 缺陷 #问题 #nyan + label_issue_plural: 缺陷 label_issue_view_all: 查看所有问题 label_issues_by: "按 %{value} 分组显示问题" label_issue_added: 问题已添加 @@ -758,7 +761,7 @@ zh: label_sort_higher: 上移 label_sort_lower: 下移 label_sort_lowest: 置底 - label_roadmap: 里程碑 #版本路线图 #nyan + label_roadmap: 里程碑 #版本路线图 label_roadmap_due_in: "截止日期到 %{value}" label_roadmap_overdue: "%{value} 延期" label_roadmap_no_issues: 该版本没有问题 @@ -1262,9 +1265,9 @@ zh: setting_default_projects_tracker_ids: Default trackers for new projects label_total_time: 合计 label_create_time: 创建时间 #Customer added!Added by nie - label_comment_time: 留言时间 #nyan - label_activity_time: 发布时间 #nyan - label_update_time: 更新时间 #nyan + label_comment_time: 留言时间 + label_activity_time: 发布时间 + label_update_time: 更新时间 label_current_contributors: 位当前贡献者 label_commit_limit: 作业提交时间已过! label_commit_ar: 作业提交截止时间快到了! @@ -1332,6 +1335,7 @@ zh: label_tags_issue_description: 问题描述 label_tags_all_objects: 所有 label_apply_project: 申请加入 + label_apply_project_waiting: 已处理申请,请等待管理员审核 label_unapply_project: 取消申请 #fq diff --git a/config/routes.rb b/config/routes.rb index ea678e231..dbbc544ac 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -301,6 +301,7 @@ RedmineApp::Application.routes.draw do resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do collection do get 'autocomplete' + get 'appliedproject' end end diff --git a/db/migrate/20140401004102_create_relative_memos.rb b/db/migrate/20140401004102_create_relative_memos.rb index 6654b8fe5..6f0d776db 100644 --- a/db/migrate/20140401004102_create_relative_memos.rb +++ b/db/migrate/20140401004102_create_relative_memos.rb @@ -1,10 +1,10 @@ class CreateRelativeMemos < ActiveRecord::Migration def change create_table :relative_memos do |t| - t.integer :osp_id, :null => false + t.integer :osp_id, :null => true t.integer :parent_id, null: true t.string :subject, null: false - t.text :content, null: false + t.mediumtext :content, null: false t.integer :author_id t.integer :replies_count, default: 0 t.integer :last_reply_id diff --git a/db/migrate/20140516031200_create_relative_memo_to_open_source_projects.rb b/db/migrate/20140516031200_create_relative_memo_to_open_source_projects.rb new file mode 100644 index 000000000..492577c6c --- /dev/null +++ b/db/migrate/20140516031200_create_relative_memo_to_open_source_projects.rb @@ -0,0 +1,10 @@ +class CreateRelativeMemoToOpenSourceProjects < ActiveRecord::Migration + def change + create_table :relative_memo_to_open_source_projects do |t| + t.integer :osp_id + t.integer :relative_memo_id + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index e2afdaae2..51246fb0b 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 => 20140521072851) do +ActiveRecord::Schema.define(:version => 20140519074133) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -23,9 +23,9 @@ ActiveRecord::Schema.define(:version => 20140521072851) do add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" add_index "activities", ["user_id"], :name => "index_activities_on_user_id" - create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false + create_table "andoidcontests", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "apply_project_masters", :force => true do |t| @@ -57,14 +57,11 @@ ActiveRecord::Schema.define(:version => 20140521072851) do add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - create_table "attachmentstypes", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "typeId" + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false t.string "typeName", :limit => 50 end - add_index "attachmentstypes", ["id"], :name => "id" - create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false @@ -623,6 +620,14 @@ ActiveRecord::Schema.define(:version => 20140521072851) do add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + create_table "projecting_softapplictions", :force => true do |t| + t.integer "user_id" + t.integer "softapplication_id" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "projects", :force => true do |t| t.string "name", :default => "", :null => false t.text "description" @@ -638,6 +643,7 @@ ActiveRecord::Schema.define(:version => 20140521072851) do t.boolean "inherit_members", :default => false, :null => false t.integer "project_type" t.boolean "hidden_repo", :default => false, :null => false + t.integer "user_id" t.integer "attachmenttype", :default => 1 end @@ -667,6 +673,13 @@ ActiveRecord::Schema.define(:version => 20140521072851) do add_index "queries", ["project_id"], :name => "index_queries_on_project_id" add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "relative_memos", :force => true do |t| t.integer "osp_id", :null => false t.integer "parent_id" @@ -774,7 +787,7 @@ ActiveRecord::Schema.define(:version => 20140521072851) do t.integer "softapplication_id" t.integer "is_public" t.string "application_developers" - t.string "deposit_project_url" + t.string "deposit_project" end create_table "students_for_courses", :force => true do |t| diff --git a/public/javascripts/hubspot/messenger-theme-future.js b/public/javascripts/hubspot/messenger-theme-future.js new file mode 100644 index 000000000..41f4ea40b --- /dev/null +++ b/public/javascripts/hubspot/messenger-theme-future.js @@ -0,0 +1,33 @@ +(function() { + var $, FutureMessage, spinner_template, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + $ = jQuery; + + spinner_template = '
\n \n \n \n \n \n \n
'; + + FutureMessage = (function(_super) { + + __extends(FutureMessage, _super); + + function FutureMessage() { + return FutureMessage.__super__.constructor.apply(this, arguments); + } + + FutureMessage.prototype.template = function(opts) { + var $message; + $message = FutureMessage.__super__.template.apply(this, arguments); + $message.append($(spinner_template)); + return $message; + }; + + return FutureMessage; + + })(window.Messenger.Message); + + window.Messenger.themes.future = { + Message: FutureMessage + }; + +}).call(this); diff --git a/public/javascripts/hubspot/messenger.min.js b/public/javascripts/hubspot/messenger.min.js new file mode 100644 index 000000000..79828950a --- /dev/null +++ b/public/javascripts/hubspot/messenger.min.js @@ -0,0 +1,2 @@ +/*! messenger 1.4.1 */ +(function(){var e,t=window.Messenger;e=window.Messenger=function(){return e._call.apply(this,arguments)},window.Messenger.noConflict=function(){return window.Messenger=t,e}})(),window.Messenger._=function(){if(window._)return window._;var e=Array.prototype,t=Object.prototype,n=Function.prototype,s=(e.push,e.slice),r=(e.concat,t.toString);t.hasOwnProperty;var o=e.forEach,i=(e.map,e.reduce,e.reduceRight,e.filter),a=(e.every,e.some,e.indexOf,e.lastIndexOf,Array.isArray,Object.keys),l=n.bind,u={},c={},h=u.each=u.forEach=function(e,t,n){if(null!=e)if(o&&e.forEach===o)e.forEach(t,n);else if(e.length===+e.length){for(var s=0,r=e.length;r>s;s++)if(t.call(n,e[s],s,e)===c)return}else for(var i in e)if(u.has(e,i)&&t.call(n,e[i],i,e)===c)return};u.result=function(e,t){if(null==e)return null;var n=e[t];return u.isFunction(n)?n.call(e):n},u.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}};var p=0;return u.uniqueId=function(e){var t=++p+"";return e?e+t:t},u.filter=u.select=function(e,t,n){var s=[];return null==e?s:i&&e.filter===i?e.filter(t,n):(h(e,function(e,r,o){t.call(n,e,r,o)&&(s[s.length]=e)}),s)},h(["Arguments","Function","String","Number","Date","RegExp"],function(e){u["is"+e]=function(t){return r.call(t)=="[object "+e+"]"}}),u.defaults=function(e){return h(s.call(arguments,1),function(t){if(t)for(var n in t)null==e[n]&&(e[n]=t[n])}),e},u.extend=function(e){return h(s.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},u.keys=a||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)u.has(e,n)&&(t[t.length]=n);return t},u.bind=function(e,t){if(e.bind===l&&l)return l.apply(e,s.call(arguments,1));var n=s.call(arguments,2);return function(){return e.apply(t,n.concat(s.call(arguments)))}},u.isObject=function(e){return e===Object(e)},u}(),window.Messenger.Events=function(){if(window.Backbone&&Backbone.Events)return Backbone.Events;var e=function(){var e=/\s+/,t=function(t,n,s,r){if(!s)return!0;if("object"==typeof s)for(var o in s)t[n].apply(t,[o,s[o]].concat(r));else{if(!e.test(s))return!0;for(var i=s.split(e),a=0,l=i.length;l>a;a++)t[n].apply(t,[i[a]].concat(r))}},n=function(e,t){var n,s=-1,r=e.length;switch(t.length){case 0:for(;r>++s;)(n=e[s]).callback.call(n.ctx);return;case 1:for(;r>++s;)(n=e[s]).callback.call(n.ctx,t[0]);return;case 2:for(;r>++s;)(n=e[s]).callback.call(n.ctx,t[0],t[1]);return;case 3:for(;r>++s;)(n=e[s]).callback.call(n.ctx,t[0],t[1],t[2]);return;default:for(;r>++s;)(n=e[s]).callback.apply(n.ctx,t)}},s={on:function(e,n,s){if(!t(this,"on",e,[n,s])||!n)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:n,context:s,ctx:s||this}),this},once:function(e,n,s){if(!t(this,"once",e,[n,s])||!n)return this;var r=this,o=_.once(function(){r.off(e,o),n.apply(this,arguments)});return o._callback=n,this.on(e,o,s),this},off:function(e,n,s){var r,o,i,a,l,u,c,h;if(!this._events||!t(this,"off",e,[n,s]))return this;if(!e&&!n&&!s)return this._events={},this;for(a=e?[e]:_.keys(this._events),l=0,u=a.length;u>l;l++)if(e=a[l],r=this._events[e]){if(i=[],n||s)for(c=0,h=r.length;h>c;c++)o=r[c],(n&&n!==o.callback&&n!==o.callback._callback||s&&s!==o.context)&&i.push(o);this._events[e]=i}return this},trigger:function(e){if(!this._events)return this;var s=Array.prototype.slice.call(arguments,1);if(!t(this,"trigger",e,s))return this;var r=this._events[e],o=this._events.all;return r&&n(r,s),o&&n(o,arguments),this},listenTo:function(e,t,n){var s=this._listeners||(this._listeners={}),r=e._listenerId||(e._listenerId=_.uniqueId("l"));return s[r]=e,e.on(t,"object"==typeof t?this:n,this),this},stopListening:function(e,t,n){var s=this._listeners;if(s){if(e)e.off(t,"object"==typeof t?this:n,this),t||n||delete s[e._listenerId];else{"object"==typeof t&&(n=this);for(var r in s)s[r].off(t,n,this);this._listeners={}}return this}}};return s.bind=s.on,s.unbind=s.off,s};return e()}(),function(){var e,t,n,s,r,o,i,a,l,u,c,h={}.hasOwnProperty,p=function(e,t){function n(){this.constructor=e}for(var s in t)h.call(t,s)&&(e[s]=t[s]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},d=[].slice,f=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};e=jQuery,o=null!=(l=window._)?l:window.Messenger._,s=null!=(u="undefined"!=typeof Backbone&&null!==Backbone?Backbone.Events:void 0)?u:window.Messenger.Events,n=function(){function t(t){e.extend(this,s),o.isObject(t)&&(t.el&&this.setElement(t.el),this.model=t.model),this.initialize.apply(this,arguments)}return t.prototype.setElement=function(t){return this.$el=e(t),this.el=this.$el[0]},t.prototype.delegateEvents=function(e){var t,n,s,r,i,a,l;if(e||(e=o.result(this,"events"))){this.undelegateEvents(),t=/^(\S+)\s*(.*)$/,l=[];for(s in e){if(i=e[s],o.isFunction(i)||(i=this[e[s]]),!i)throw Error('Method "'+e[s]+'" does not exist');r=s.match(t),n=r[1],a=r[2],i=o.bind(i,this),n+=".delegateEvents"+this.cid,""===a?l.push(this.jqon(n,i)):l.push(this.jqon(n,a,i))}return l}},t.prototype.jqon=function(e,t,n){var s;return null!=this.$el.on?(s=this.$el).on.apply(s,arguments):(null==n&&(n=t,t=void 0),null!=t?this.$el.delegate(t,e,n):this.$el.bind(e,n))},t.prototype.jqoff=function(e){var t;return null!=this.$el.off?(t=this.$el).off.apply(t,arguments):(this.$el.undelegate(),this.$el.unbind(e))},t.prototype.undelegateEvents=function(){return this.jqoff(".delegateEvents"+this.cid)},t.prototype.remove=function(){return this.undelegateEvents(),this.$el.remove()},t}(),i=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return p(n,t),n.prototype.defaults={hideAfter:10,scroll:!0,closeButtonText:"×"},n.prototype.initialize=function(t){return null==t&&(t={}),this.shown=!1,this.rendered=!1,this.messenger=t.messenger,this.options=e.extend({},this.options,t,this.defaults)},n.prototype.show=function(){var e;return this.rendered||this.render(),this.$message.removeClass("messenger-hidden"),e=this.shown,this.shown=!0,e?void 0:this.trigger("show")},n.prototype.hide=function(){var e;if(this.rendered)return this.$message.addClass("messenger-hidden"),e=this.shown,this.shown=!1,e?this.trigger("hide"):void 0},n.prototype.cancel=function(){return this.hide()},n.prototype.update=function(t){var n,s=this;return o.isString(t)&&(t={message:t}),e.extend(this.options,t),this.lastUpdate=new Date,this.rendered=!1,this.events=null!=(n=this.options.events)?n:{},this.render(),this.actionsToEvents(),this.delegateEvents(),this.checkClickable(),this.options.hideAfter?(this.$message.addClass("messenger-will-hide-after"),null!=this._hideTimeout&&clearTimeout(this._hideTimeout),this._hideTimeout=setTimeout(function(){return s.hide()},1e3*this.options.hideAfter)):this.$message.removeClass("messenger-will-hide-after"),this.options.hideOnNavigate?(this.$message.addClass("messenger-will-hide-on-navigate"),null!=("undefined"!=typeof Backbone&&null!==Backbone?Backbone.history:void 0)&&Backbone.history.on("route",function(){return s.hide()})):this.$message.removeClass("messenger-will-hide-on-navigate"),this.trigger("update",this)},n.prototype.scrollTo=function(){return this.options.scroll?e.scrollTo(this.$el,{duration:400,offset:{left:0,top:-20}}):void 0},n.prototype.timeSinceUpdate=function(){return this.lastUpdate?new Date-this.lastUpdate:null},n.prototype.actionsToEvents=function(){var e,t,n,s,r=this;n=this.options.actions,s=[];for(t in n)e=n[t],s.push(this.events['click [data-action="'+t+'"] a']=function(e){return function(n){return n.preventDefault(),n.stopPropagation(),r.trigger("action:"+t,e,n),e.action.call(r,n,r)}}(e));return s},n.prototype.checkClickable=function(){var e,t,n,s;n=this.events,s=[];for(t in n)e=n[t],"click"===t?s.push(this.$message.addClass("messenger-clickable")):s.push(void 0);return s},n.prototype.undelegateEvents=function(){var e;return n.__super__.undelegateEvents.apply(this,arguments),null!=(e=this.$message)?e.removeClass("messenger-clickable"):void 0},n.prototype.parseActions=function(){var t,n,s,r,o,i;n=[],o=this.options.actions;for(r in o)t=o[r],s=e.extend({},t),s.name=r,null==(i=s.label)&&(s.label=r),n.push(s);return n},n.prototype.template=function(t){var n,s,r,o,i,a,l,u,c,h,p=this;for(i=e("
"),t.showCloseButton&&(r=e('