diff --git a/Gemfile b/Gemfile index 7309c6e99..dd19b4435 100644 --- a/Gemfile +++ b/Gemfile @@ -20,8 +20,6 @@ group :openid do end # Optional gem for exporting the gantt to a PNG file, not supported with jruby - - platforms :jruby do # jruby-openssl is bundled with JRuby 1.7.0 gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0' diff --git a/app/assets/javascripts/teachers.js b/app/assets/javascripts/teachers.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/teachers.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/teachers.css b/app/assets/stylesheets/teachers.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/app/assets/stylesheets/teachers.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index a273afe51..dc7036f6a 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -42,7 +42,7 @@ class AccountController < ApplicationController redirect_to home_url elsif request.post? logout_user - redirect_to signin_path + redirect_to home_url end # display the logout form end @@ -147,6 +147,13 @@ class AccountController < ApplicationController else register_manually_by_administrator(@user) end + + #added by bai + unless @user.id.nil? + UserExtensions.create(:identity => params[:identity].to_i, :user_id => @user.id) + end + #end + end end end @@ -178,9 +185,11 @@ class AccountController < ApplicationController def password_authentication user = User.try_to_login(params[:username], params[:password]) - + if user.nil? invalid_credentials + elsif user.status == 2 + invalid_credentials_new elsif user.new_record? onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) else @@ -270,6 +279,11 @@ class AccountController < ApplicationController logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}" flash.now[:error] = l(:notice_account_invalid_creditentials) end + + def invalid_credentials_new + logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}" + flash.now[:error] = l(:notice_account_invalid_creditentials_new) + end # Register a user for email activation. # @@ -277,6 +291,7 @@ class AccountController < ApplicationController def register_by_email_activation(user, &block) token = Token.new(:user => user, :action => "register") if user.save and token.save + UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) Mailer.register(token).deliver flash[:notice] = l(:notice_account_register_done) redirect_to signin_path @@ -293,6 +308,7 @@ class AccountController < ApplicationController user.activate user.last_login_on = Time.now if user.save + UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) self.logged_user = user flash[:notice] = l(:notice_account_activated) redirect_to my_account_path @@ -306,6 +322,7 @@ class AccountController < ApplicationController # Pass a block for behavior when a user fails to save def register_manually_by_administrator(user, &block) if user.save + UserStatus.create(:user_id => user.id ,:changsets_count => 0, :watchers_count => 0) # Sends an email to the administrators Mailer.account_activation_request(user).deliver account_pending diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 43b24d1e0..b4127f151 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -15,15 +15,53 @@ class BidsController < ApplicationController @bids = @bids.like(params[:name]) if params[:name].present? @bid_count = @bids.count @bid_pages = Paginator.new @bid_count, @limit, params['page'] - + @offset ||= @bid_pages.reverse_offset #@bids = @bids.offset(@offset).limit(@limit).all.reverse - unless @offset == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse + # unless @offset == 0 + # @bids = @bids.offset(@offset).limit(@limit).all.reverse + # else + # limit = @bid_count % @limit + # @bids = @bids.offset(@offset).limit(limit).all.reverse + # end + #added by nie + if params[:bid_sort_type].present? + case params[:bid_sort_type] + when '0' + unless @offset == 0 + @bids = @bids.offset(@offset).limit(@limit).all.reverse + else + limit = @bid_count % @limit + @bids = @bids.offset(@offset).limit(limit).all.reverse + end + @s_state = 0 + when '1' + unless @offset == 0 + @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse + else + limit = @bid_count % @limit + @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse + end + @s_state = 1 + when '2' + unless @offset == 0 + @bids = @bids.offset(@offset).limit(@limit).all.reverse + else + limit = @bid_count % @limit + @bids = @bids.offset(@offset).limit(@limit).all.reverse + end + @s_state = 0 + end else - limit = @bid_count % @limit - @bids = @bids.offset(@offset).limit(limit).all.reverse + unless @offset == 0 + @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse + else + limit = @bid_count % @limit + @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse + end + @s_state = 1 end + #end # @limit = api_offset_and_limit({:limit => 5}) # @bids = Bid.visible # @bids = @bids.like(params[:name]) if params[:name].present? @@ -107,7 +145,7 @@ class BidsController < ApplicationController if params[:bid_message][:message].size>0 if params[:reference_content] - message = params[:reference_content] + params[:bid_message][:message] + message = params[:bid_message][:message] + "\n" + params[:reference_content] else message = params[:bid_message][:message] end @@ -138,8 +176,10 @@ class BidsController < ApplicationController ##删除留言 def destroy - JournalsForMessage.delete_message(params[:object_id]) @user = @bid.author + if User.current.admin? || User.current.id == @user.id + JournalsForMessage.delete_message(params[:object_id]) + end @jours = @bid.journals_for_messages.reverse @limit = 10 @feedback_count = @jours.count @@ -185,39 +225,39 @@ class BidsController < ApplicationController def new_bid @bid = Bid.new @bid.safe_attributes = params[:bid] - # if params[:bid_title] - # # if params[:bid_budget].to_s =~ /^(\d+)$|^(\d+).([0-9]{2})$/ - # unless params[:bid_reward_type] == "0" - # if params[:bid_deadline].to_s =~ /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/ - # bid = Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description], params[:bid_reward_type].to_i) - # unless bid.watched_by?(User.current) - # if bid.add_watcher(User.current) - # flash[:notice] = l(:label_bid_succeed) - # end - # end - # else - # flash[:error] = l(:label_wrong_date) - # end - # else - # flash[:error] = "wrong" - # end - # # else - # # flash[:error] = l(:label_wrong_budget) - # # end - # end - # @limit = 5 - # @bid_count = Bid.count - # @bid_pages = Paginator.new @bid_count, @limit, params['page'] - # @offset ||= @bid_pages.offset - # @bids = Bid.offset(@offset).limit(@limit).all - # respond_to do |format| - # # format.html - # format.html { redirect_to :back } - # format.js - # # format.api { render_api_ok } - # end + # if params[:bid_title] + # # if params[:bid_budget].to_s =~ /^(\d+)$|^(\d+).([0-9]{2})$/ + # unless params[:bid_reward_type] == "0" + # if params[:bid_deadline].to_s =~ /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/ + # bid = Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description], params[:bid_reward_type].to_i) + # unless bid.watched_by?(User.current) + # if bid.add_watcher(User.current) + # flash[:notice] = l(:label_bid_succeed) + # end + # end + # else + # flash[:error] = l(:label_wrong_date) + # end + # else + # flash[:error] = "wrong" + # end + # # else + # # flash[:error] = l(:label_wrong_budget) + # # end + # end + # @limit = 5 + # @bid_count = Bid.count + # @bid_pages = Paginator.new @bid_count, @limit, params['page'] + # @offset ||= @bid_pages.offset + # @bids = Bid.offset(@offset).limit(@limit).all + # respond_to do |format| + # # format.html + # format.html { redirect_to :back } + # format.js + # # format.api { render_api_ok } + # end end - + def create_bid @bid = Bid.new @bid.name = params[:bid][:name] @@ -239,6 +279,32 @@ class BidsController < ApplicationController render :action => 'new_bid' end end + + def create_homework + @bid = Bid.new + @bid.name = params[:bid][:name] + @bid.description = params[:bid][:description] + @bid.reward_type = 3 + # @bid.budget = params[:bid][:budget] + @bid.deadline = params[:bid][:deadline] + @bid.budget = 0 + @bid.author_id = User.current.id + @bid.commit = 0 + # @bid. + if @bid.save + HomeworkForCourse.create(:project_id => params[:course_id], :bid_id => @bid.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(@bid) + else + @bid.safe_attributes = params[:bid] + render :action => 'new_bid' + end + + end def more @jour = @bid.journals_for_messages @@ -251,6 +317,7 @@ class BidsController < ApplicationController #format.api { render_api_ok } end end + def back @jour = @bid.journals_for_messages diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb new file mode 100644 index 000000000..8011b238b --- /dev/null +++ b/app/controllers/courses_controller.rb @@ -0,0 +1,39 @@ +class CourseController < ApplicationController + + before_filter :require_login, :only => [:join, :unjoin] + + def join + if User.current.logged? + course = Project.find(params[:object_id]) + if params[:course_password] == '123' + members = [] + members << Member.new(:role_ids => [5], :user_id => User.current.id) + course.members << members + + StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id]) + else + end + end + respond_to do |format| + # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} + format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id])} } + end + end + + def unjoin + if User.current.logged? + + @member = Member.where('project_id = ? and user_id = ?', params[:object_id], User.current.id) + @member.first.destroy + + joined = StudentsForCourse.where('student_id = ? and course_id = ?', User.current.id, params[:object_id]) + joined.each do |join| + join.delete + end + end + respond_to do |format| + # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} + format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id])} } + end + end +end \ No newline at end of file diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 62a8e4a4e..d5a4834a4 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -50,12 +50,46 @@ class MyController < ApplicationController def account @user = User.current @pref = @user.pref + + + + # if @user.user_extensions.nil? + # se = UserExtebsions.new + # se.user_id = @user.id + # se.occupation = params[:occupation] + # se.save + # else + # # = @user.user_extensions + # end + # @occupation = UserExtensions.occupation + # @occupation.save if request.post? @user.safe_attributes = params[:user] @user.pref.attributes = params[:pref] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') + + # # UserExtensions.create(:user_id => @user.id, :occupation => params[:occupation]) + # else + # ue = @user.user_extensions + # ue.occupation = params[:occupation] + # ue.save + # end + + # added by bai + if @user.UserExtensions.nil? + se = UserExtensions.new + se.user_id = @user.id + se.occupation = params[:occupation] + se.save + else + se = @user.user_extensions + se.occupation = params[:occupation] + se.save + end + # end + if @user.save @user.pref.save @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ee98739e4..5908c5940 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -14,20 +14,24 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - class ProjectsController < ApplicationController layout 'base_projects'# by young menu_item :overview menu_item :roadmap, :only => :roadmap menu_item :settings, :only => :settings - menu_item :homework, :only => :homework + menu_item l(:label_sort_by_time), :only => :index + menu_item l(:label_sort_by_active), :only => :index + menu_item l(:label_sort_by_influence), :only => :index + #by huang + # menu_item :files, :only => :files + # menu_tiem :news, :only => :news - before_filter :find_project, :except => [ :index, :list, :new, :create, :copy, :statistics] - before_filter :authorize, :except => [:new_homework, :homework, :statistics, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback] + before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join] + before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback] before_filter :authorize_global, :only => [:new, :create] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] #by young - before_filter :member, :file + before_filter :member, :file, :statistics, :watcherlist # accept_rss_auth :index accept_api_auth :index, :show, :create, :update, :destroy @@ -37,7 +41,7 @@ class ProjectsController < ApplicationController controller.send :expire_action, :controller => 'welcome', :action => 'robots' end end - + helper :bids include BidsHelper helper :sort @@ -54,49 +58,138 @@ class ProjectsController < ApplicationController helper :activities helper :documents helper :watchers + # helper :watcherlist ### added by william include ActsAsTaggableOn::TagsHelper - - + + # Lists visible projects + # def index + # respond_to do |format| + # format.html { + # scope = Project + # unless params[:closed] + # scope = scope.active + # end + # @projects = scope.visible.order('lft').all + # } + # format.api { + # @offset, @limit = api_offset_and_limit + # @project_count = Project.visible.count + # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all + # } + # format.atom { + # projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all + # render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") + # } + # end + # end + def index #Modified by nie # @offset, @limit = api_offset_and_limit({:limit => 10}) # @project_count = Project.visible.count # @project_pages = Paginator.new @project_count, @limit, params['page'] - # @offset ||= @project_pages.offset + # @offset ||= @project_pages.offset # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all - + @offset, @limit = api_offset_and_limit({:limit => 10}) - @projects = Project.visible + @projects_status = ProjectStatus.visible + # @projects.each do |project| + # @admin = project.users_by_role[Role.find(3)] + # unless @admin.nil? + # @admin.each do |user| + # ProjectInfo.create(:user_id => user.id, :project_id => project.id) + # end + # + # end + # end # @projects.each do |project| - # @admin = project.users_by_role[Role.find(3)] - # unless @admin.nil? - # @admin.each do |user| - # ProjectInfo.create(:user_id => user.id, :project_id => project.id) - # end -# - # end + # ProjectStatus.create(:changesets_count => project.changesets.count, :project_id => project.id, :watchers_count => project.watcher_users.count) # end - @projects = Project.visible.like(params[:name]) if params[:name].present? - @project_count = @projects.count + #@projects_status = Project.visible.like(params[:name]) if params[:name].present? + @project_count = @projects_status.count @project_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @project_pages.offset - @projects = @projects.offset(@offset).limit(@limit).order('created_on DESC').all + + @offset ||= @project_pages.reverse_offset + + #@projects = @projects.offset(@offset).limit(@limit).order('created_on DESC').all + if params[:project_sort_type].present? + case params[:project_sort_type] + when '0' + @offset ||= @project_pages.reverse_offset + unless @offset == 0 + @projects_status = @projects_status.offset(@offset).limit(@limit).all.reverse + else + limit = @project_count % @limit + if limit == 0 + limit = @limit + end + @projects_status = @projects_status.offset(@offset).limit(limit).all.reverse + end + @s_type = 0 + # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on } + # @projects = @projects[@offset, @limit] + when '1' + @offset ||= @project_pages.reverse_offset + unless @offset == 0 + @projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse + else + limit = @project_count % @limit + if limit == 0 + limit = @limit + end + @projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(limit).all.reverse + end + @s_type = 1 + + #@projects = @projects[@offset, @limit] + when '2' + @offset ||= @project_pages.reverse_offset + unless @offset == 0 + @projects_status = @projects_status.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse + else + limit = @project_count % @limit + if limit == 0 + limit = @limit + end + @projects_status = @projects_status.reorder('watchers_count').offset(@offset).limit(limit).all.reverse + end + @s_type = 2 + end + else + @offset ||= @project_pages.reverse_offset + unless @offset == 0 + @projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse + else + limit = @project_count % @limit + if limit == 0 + limit = @limit + end + @projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(limit).all.reverse + end + @s_type = 1 + # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on } + # @projects = @projects[@offset, @limit] + end + + @projects = [] + @projects_status.each do |obj| + @projects << Project.find_by_id("#{obj.project_id}") + end #end - respond_to do |format| + respond_to do |format| format.html { - render :layout => 'base' + render :layout => 'base' scope = Project unless params[:closed] - scope = scope.active + scope = scope.active end - @projects = scope.visible.offset(@offset).limit(@limit).order('created_on DESC').all } format.api { -# @offset, @limit = api_offset_and_limit -# @project_count = Project.visible.count -# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all + # @offset, @limit = api_offset_and_limit + # @project_count = Project.visible.count + # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all } format.atom { projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all @@ -105,14 +198,48 @@ class ProjectsController < ApplicationController end end + def search + + @projects = Project.visible + @projects = @projects.visible.like(params[:name]) if params[:name].present? + @offset, @limit = api_offset_and_limit({:limit => 10}) + @project_count = @projects.visible.count + @project_pages = Paginator.new @project_count, @limit, params['page'] + @offset ||= @project_pages.offset + @projects = @projects.visible.offset(@offset).limit(@limit).all + respond_to do |format| + format.html { + render :layout => 'base' + scope = Project + unless params[:closed] + scope = scope.active + end + } + format.api { + # @offset, @limit = api_offset_and_limit + # @project_count = Project.visible.count + # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all + } + format.atom { + projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all + render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") + } + end + end + + # added by fq + def new_join + @course = Project.find(params[:object_id]) + end + #Added by young - def homework + def homework @offset, @limit = api_offset_and_limit({:limit => 10}) - @bids = Bid.visible + @bids = @project.homeworks @bids = @bids.like(params[:name]) if params[:name].present? @bid_count = @bids.count @bid_pages = Paginator.new @bid_count, @limit, params['page'] - + @offset ||= @bid_pages.reverse_offset #@bids = @bids.offset(@offset).limit(@limit).all.reverse unless @offset == 0 @@ -122,16 +249,15 @@ class ProjectsController < ApplicationController @bids = @bids.offset(@offset).limit(limit).all.reverse end render :layout => 'base_courses' - end - - def new_homework + end + + def new_homework @homework = Bid.new - @homework.safe_attributes = params[:bid] + @homework.safe_attributes = params[:bid] render :layout => 'base_courses' - end -#Ended by young + end + #Ended by young - def feedback @jours = @project.journals_for_messages.reverse @limit = 10 @@ -142,40 +268,80 @@ class ProjectsController < ApplicationController @state = false end + def project_respond + + if params[:project_respond].size>0 + jour = JournalsForMessage.find(params[:reference_id]) if params[:reference_id] + if jour + user = jour.user + text = jour.notes + else + user = User.current + text = [] + end + # Replaces pre blocks with [...] + text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') + reference_content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " + reference_content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + # reference_message = JournalForMessage.find(params[:reference_id]) + message = params[:project_respond] + "\n" + reference_content + + + user.add_jour(User.current, message, user.id) + flash[:notice]=l(:label_projects_feedback_respond_success) + # if a_message.size > 5 + # @message = a_message[-5, 5] + # else + # @message = a_message + # end + # @message_count = a_message.count + end + + respond_to do |format| + format.html { redirect_to :back } + #format.api { render_api_ok } + end + # redirect_to project_feedback_path(@project) + end + def new @course_tag = params[:course] @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] - ##add by xianbo + ##add by huang @course=Course.new @course.safe_attributes = params[:course] ##end - render :layout => 'base' + render :layout => 'base' end - def create - @course_tag = params[:project][:project_type] - @course = Course.new - @course.extra=params[:project][:identifier] - @course.safe_attributes = params[:project][:course] - + @course_tag = params[:project][:project_type] + if(@course_tag=="1") + @course = Course.new + @course.extra=params[:project][:identifier] + @course.safe_attributes = params[:project][:course] + @course.save + # project = ProjectInfo.create(:user_id => User.current.id, :project_id => @project.id) + # project_status = ProjectStatus.create(:project_id => @project.id) + end @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] - @course.save - if validate_parent_id && @project.save + + if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') # Add current user as a project member if he is not admin unless User.current.admin? r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first m = Member.new(:user => User.current, :roles => [r]) project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id) - @project.members << m - @project.project_infos << project + project_status = ProjectStatus.create(:project_id => @project.id) + @project.members << m + @project.project_infos << project end respond_to do |format| format.html { @@ -227,21 +393,23 @@ class ProjectsController < ApplicationController end end rescue ActiveRecord::RecordNotFound - # source_project not found + # source_project not found render_404 - end + end # Show @project def show # try to redirect to the requested menu item if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) - return + return end @users_by_role = @project.users_by_role @subprojects = @project.children.visible.all @news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all @trackers = @project.rolled_up_trackers + @user = User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id) + cond = @project.project_condition(Setting.display_subprojects_issues?) @open_issues_by_tracker = Issue.visible.open.where(cond).count(:group => :tracker) @total_issues_by_tracker = Issue.visible.where(cond).count(:group => :tracker) @@ -251,13 +419,13 @@ class ProjectsController < ApplicationController end @key = User.current.rss_key - #新增内容 + #新增内容 @days = Setting.activity_days_default.to_i if params[:from] begin; @date_to = params[:from].to_date + 1; rescue; end end - + has = { "show_issues" => true, "show_files" => true, @@ -268,24 +436,24 @@ class ProjectsController < ApplicationController @date_from = @date_to - @days @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) -# 决定显示所用用户或单个用户活动 + # 决定显示所用用户或单个用户活动 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects, :author => @author) @activity.scope_select {|t| !has["show_#{t}"].nil?} - # @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? + # @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? #Added by young events = @activity.events(@date_from, @date_to) - + @offset, @limit = api_offset_and_limit({:limit => 10}) @events_count = events.count @events_pages = Paginator.new @events_count, @limit, params['page'] - @offset ||= @events_pages.offset + @offset ||= @events_pages.offset events = events.slice(@offset,@limit) #Ended by young @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} - # documents - @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' + # documents + @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' documents = @project.documents.includes(:attachments, :category).all case @sort_by when 'date' @@ -295,17 +463,16 @@ class ProjectsController < ApplicationController when 'author' @grouped = documents.select{|d| d.attachments.any?}.group_by {|d| d.attachments.last.author} else - @grouped = documents.group_by(&:category) + @grouped = documents.group_by(&:category) end @document = @project.documents.build -# + # @base_courses_tag = @project.project_type respond_to do |format| - format.html{render :layout => 'base_courses' if @base_courses_tag } + format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.api end end - def settings @issue_custom_fields = IssueCustomField.sorted.all @@ -314,30 +481,37 @@ class ProjectsController < ApplicationController @trackers = Tracker.sorted.all @wiki ||= @project.wiki #Added by young - @course_tag = params[:course] - if @course_tag == '1' + # @course_tag = params[:course] + # if @course_tag == '1' + if @project.project_type render :layout => 'base_courses' end - #Ended by young + #Ended by young end def edit end - + #by young def member end - - + def file + # @course_tag = params[:course] + # if @course_tag == '1' + # render :layout => 'base_courses' + # end + + # User.current + end + + def statistics + end - #end def update @project.safe_attributes = params[:project] - @Course.safe_attributes=params[:project][:course] - @Course.save if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') respond_to do |format| @@ -397,9 +571,9 @@ class ProjectsController < ApplicationController format.html { redirect_to admin_projects_path } format.api { render_api_ok } end - else - render :layout => "base" - end + else + render :layout => "base" + end # hide project in layout @project = nil end @@ -415,9 +589,17 @@ class ProjectsController < ApplicationController parent = parent_id.blank? ? nil : Project.find_by_id(parent_id.to_i) unless @project.allowed_parents.include?(parent) @project.errors.add :parent_id, :invalid - return false + return false end end true end + + # added by huang + + def watcherlist + if @watched + @users -= watched.watcher_users + end + end end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index a7c787746..e99d2500c 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -9,222 +9,106 @@ class TagsController < ApplicationController include BidsHelper include ActsAsTaggableOn::TagsHelper helper :projects - + before_filter :require_admin,:only => [:delete,:show_all] - $selected_tags = Array.new - $related_tags = Array.new + # $selected_tags = Array.new + # $related_tags = Array.new + NUMBERS = Setting.tags_show_search_results - def index - $selected_tags = [] - $related_tags = [] - $selected_tags << params[:q] - - @issues_tags_num = Issue.tag_counts.size - @projects_tags_num = Project.tag_counts.size - @users_tags_num = User.tag_counts.size - @bids_tags_num = Bid.tag_counts.size - - # 这里为了提高系统的响应速度 把搜索结果放到case中去了 - @users_results = nil - @projects_results = nil - @issues_results = nil - @bids_results = nil - @obj_pages = nil - + # 接收参数解释: + # params[:q]这是在其他页面点击tag,跳转到该页面后的结果显示 ;params[:selected_tags],这是在过滤页面增删tag进行过滤传过来的参数 + # 最后是2个过滤何种数据,显示结果的控制参数params[:obj_id],params[:object_falg] + # 0代表删除tag 1代表增加tag + def index + @obj_id = params[:obj_id] @obj_flag = params[:object_flag] - @numbers = Setting.tags_show_search_results - - case @obj_flag - when '1' then - @users_results = get_users_by_tag($selected_tags) - @obj = User.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @users_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @users_results = @users_results.offset(@offset).limit(@limit).all - when '2' then - @projects_results = get_projects_by_tag($selected_tags) - @obj = Project.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @projects_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @projects_results = @projects_results.offset(@offset).limit(@limit).order('lft').all - - when '3' then - @issues_results = get_issues_by_tag($selected_tags) - @obj = Issue.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @issues_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @issues_results = @issues_results.offset(@offset).limit(@limit).all - when '4' - @bids_results = get_bids_by_tag($selected_tags) - @obj = Bid.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @bids_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @bids_results = @bids_results.offset(@offset).limit(@limit).all - + + @selected_tags = Array.new + @related_tags = nil + + if params[:q] + @selected_tags << params[:q] else - @obj = nil + @do_what = params[:do_what] + @tag = params[:tag] + @selected_tags = params[:current_selected_tags] + @selected_tags = @selected_tags.nil? ? Array.new : @selected_tags + + case @do_what + when '0' then + @selected_tags.delete @tag #数组中删除有多方式 可以改用shift,pop + when '1' then + # 判断是否已存在该tag 主要用来处理分页的情况 + unless @selected_tags.include? @tag + @selected_tags << @tag + end + end end + + @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num = get_tags_size + + # 获取搜索结果 + @obj,@obj_pages,@results_count,@users_results, + @projects_results, + @issues_results, + @bids_results = refresh_results(@obj_id,@obj_flag,@selected_tags) + # 这里是做tag推荐用的, 用来生产推荐的tags unless @obj.nil? @tags = @obj.tag_list - $selected_tags.each do |i| + @selected_tags.each do |i| @tags.delete(i) - end - $related_tags = @tags + end + @related_tags = @tags else - return + return end end - + + # 增加已选的tag def add_tag @tag = params[:tag] @show_flag = params[:show_flag] + $selected_tags << @tag $related_tags.delete(@tag) - @obj_pages = nil - @numbers = Setting.tags_show_search_results - - # @issues_results = get_issues_by_tag($selected_tags) - # @projects_results = get_projects_by_tag($selected_tags) - # @users_results = get_users_by_tag($selected_tags) - case @show_flag - when '1' then - @users_results = get_users_by_tag($selected_tags) - @obj = User.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @users_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @users_results = @users_results.offset(@offset).limit(@limit).all - when '2' then - @projects_results = get_projects_by_tag($selected_tags) - @obj = Project.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @projects_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @projects_results = @projects_results.offset(@offset).limit(@limit).order('lft').all - - when '3' then - @issues_results = get_issues_by_tag($selected_tags) - @obj = Issue.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @issues_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @issues_results = @issues_results.offset(@offset).limit(@limit).all - when '4' - @bids_results = get_bids_by_tag($selected_tags) - @obj = Bid.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @bids_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @bids_results = @bids_results.offset(@offset).limit(@limit).all - - else - @obj = nil - end + # 获取搜索结果 + @obj,@obj_pages,@users_results, + @projects_results, + @issues_results, + @bids_results = refresh_results(@obj_id,@show_flag) end + # 删除已选tag def delete_tag @tag = params[:tag] @show_flag = params[:show_flag] + $related_tags << @tag $selected_tags.delete(@tag) - @obj_pages = nil - @numbers = Setting.tags_show_search_results - - # @issues_results = get_issues_by_tag($selected_tags) - # @projects_results = get_projects_by_tag($selected_tags) - # @users_results = get_users_by_tag($selected_tags) - case @show_flag - when '1' then - @users_results = get_users_by_tag($selected_tags) - @obj = User.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @users_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @users_results = @users_results.offset(@offset).limit(@limit).all - when '2' then - @projects_results = get_projects_by_tag($selected_tags) - @obj = Project.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @projects_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @projects_results = @projects_results.offset(@offset).limit(@limit).order('lft').all - - when '3' then - @issues_results = get_issues_by_tag($selected_tags) - @obj = Issue.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @issues_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @issues_results = @issues_results.offset(@offset).limit(@limit).all - when '4' - @bids_results = get_bids_by_tag($selected_tags) - @obj = Bid.find_by_id(@obj_id) - - @offset, @limit = api_offset_and_limit({:limit => @numbers}) - @project_count = @bids_results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - @bids_results = @bids_results.offset(@offset).limit(@limit).all + # 获取搜索结果 + @obj,@obj_pages,@results_count,@users_results, + @projects_results, + @issues_results, + @bids_results = refresh_results(@obj_id,@show_flag) - else - @obj = nil - end - end - - def count(name) end def show_all @tags = ActsAsTaggableOn::Tag.find(:all) end - - def for_pagination(results) - @offset, @limit = api_offset_and_limit({:limit => 2}) - @project_count = results.count - @obj_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @obj_pages.offset - results = results.offset(@offset).limit(@limit).order('lft').all - end + #完全从数据库删除tag def delete if params[:q] @tag = ActsAsTaggableOn::Tag.find_by_id(params[:q]) - @tag.delete - + @tag.delete @taggings = ActsAsTaggableOn::Tagging.find_all_by_tag_id(@tag.id) - @taggings.each do |tagging| tagging.delete end @@ -233,9 +117,52 @@ class TagsController < ApplicationController end private + # 这里用来刷新搜索结果的区域 + # 函数的返回值 前2字段用来处理获取其他tag和分页 ,另外4个返回值为过滤结果 + def refresh_results(obj_id,obj_flag,selected_tags) + @users_results = nil + @projects_results = nil + @issues_results = nil + @bids_results = nil + @obj_pages = nil + @obj = nil + + # 这里为了提高系统的响应速度 把搜索结果放到case中去了 + case obj_flag + when '1' then + @obj = User.find_by_id(obj_id) + @obj_pages,@users_results,@results_count = for_pagination(get_users_by_tag(selected_tags)) + when '2' then + @obj = Project.find_by_id(obj_id) + @obj_pages,@projects_results,@results_count = for_pagination(get_projects_by_tag(selected_tags)) + when '3' then + @obj = Issue.find_by_id(obj_id) + @obj_pages,@issues_results,@results_count = for_pagination(get_issues_by_tag(selected_tags)) + when '4' then + @obj_pages,@bids_results,@results_count = for_pagination(get_bids_by_tag(selected_tags)) + @obj = Bid.find_by_id(obj_id) + else + @obj = nil + end + return @obj,@obj_pages,@results_count,@users_results,@projects_results,@issues_results,@bids_results + end - def tagged_on_object(object) - + def for_pagination(results) + @offset, @limit = api_offset_and_limit({:limit => NUMBERS }) # 设置每页显示的个数 + @results_count = results.count + @obj_pages = Paginator.new @results_count, @limit, params['page'] # 3个参数分别是:总数,每页显示数目,第几页 + @offset ||= @obj_pages.offset + results = results.offset(@offset).limit(@limit).all # 这里默认设置为按时间排序 + return @obj_pages,results, @results_count + end + + #获取有某类对象的tag总数 + def get_tags_size + @issues_tags_num = Issue.tag_counts.size + @projects_tags_num = Project.tag_counts.size + @users_tags_num = User.tag_counts.size + @bids_tags_num = Bid.tag_counts.size + return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num end end diff --git a/app/controllers/teachers_controller.rb b/app/controllers/teachers_controller.rb new file mode 100644 index 000000000..b4d0c4839 --- /dev/null +++ b/app/controllers/teachers_controller.rb @@ -0,0 +1,5 @@ +class TeachersController < ApplicationController + def show + + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 751d497ca..fa8879921 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -19,13 +19,13 @@ class UsersController < ApplicationController #Added by young menu_item :activity menu_item :user_information, :only => :info - menu_item :project, :only => :user_projects + menu_item :user_project, :only => :user_projects menu_item :requirement_focus, :only => :watch_bids menu_item :user_newfeedback, :only => :user_newfeedback #Ended by young - before_filter :require_admin, :except => [:show, :index,:tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:edit,:update] + before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:edit,:update] before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info] accept_api_auth :index, :show, :create, :update, :destroy,:tag_save @@ -154,16 +154,125 @@ class UsersController < ApplicationController "show_changesets" => true } # @count = Redmine::Activity::Fetcher.new(User.current, :author => @user).scope_select {|t| !has["show_#{t}"].nil?}.events(nil, nil).count - - scope = User.logged.status(@status) - scope = scope.like(params[:name]) if params[:name].present? + + scope = UserStatus.visible + scope = scope.in_group(params[:group_id]) if params[:group_id].present? - + # scope.each do |user| + # UserStatus.create(:changesets_count => user.changesets.count, :watchers_count => user.watcher_users.count, :user_id => user.id) + # end @user_count = scope.count @user_pages = Paginator.new @user_count, @limit, params['page'] - @offset ||= @user_pages.offset - @users = scope.order(sort_clause).limit(@limit).offset(@offset).all + #@offset ||= @user_pages.offset + #@users = scope.order(sort_clause).limit(@limit).offset(@offset).all @user_base_tag = params[:id]?'base_users':'base' + if params[:user_sort_type].present? + case params[:user_sort_type] + when '0' + @offset ||= @user_pages.reverse_offset + unless @offset == 0 + @users_statuses = scope.offset(@offset).limit(@limit).all.reverse + else + limit = @user_count % @limit + if limit == 0 + limit = @limit + end + @users_statuses = scope.offset(@offset).limit(limit).all.reverse + end + @s_type = 0 + # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on } + # @projects = @projects[@offset, @limit] + when '1' + @offset ||= @user_pages.reverse_offset + unless @offset == 0 + @users_statuses = scope.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse + else + limit = @user_count % @limit + if limit == 0 + limit = @limit + end + @users_statuses = scope.reorder('changesets_count').offset(@offset).limit(limit).all.reverse + end + @s_type = 1 + #sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count} + #@users = @users[@offset, @limit] + when '2' + @offset ||= @user_pages.reverse_offset + unless @offset == 0 + @users_statuses = scope.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse + else + limit = @user_count % @limit + if limit == 0 + limit = @limit + end + @users_statuses = scope.reorder('watchers_count').offset(@offset).limit(limit).all.reverse + end + @s_type = 2 + #@users = @users[@offset, @limit] + end + + else + @offset ||= @user_pages.reverse_offset + unless @offset == 0 + @users_statuses = scope.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse + else + limit = @user_count % @limit + if limit == 0 + limit = @limit + end + @users_statuses = scope.reorder('changesets_count').offset(@offset).limit(limit).all.reverse + end + @s_type = 1 + # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on } + # @projects = @projects[@offset, @limit] + end + + @users = [] + @users_statuses.each do |obj| + @users << User.find_by_id("#{obj.user_id}") + end + + + respond_to do |format| + format.html { + @groups = Group.all.sort + render :layout => @user_base_tag + } + format.api + end + end + + def search + sort_init 'login', 'asc' + sort_update %w(login firstname lastname mail admin created_on last_login_on) + + case params[:format] + when 'xml', 'json' + @offset, @limit = api_offset_and_limit({:limit => 15}) + else + @limit = 15#per_page_option + end + + @status = params[:status] || 1 + has = { + "show_changesets" => true + } + scope = User.logged.status(@status) + scope = scope.like(params[:name]) if params[:name].present? + @user_count = scope.count + @user_pages = Paginator.new @user_count, @limit, params['page'] + @user_base_tag = params[:id]?'base_users':'base' + @offset ||= @user_pages.reverse_offset + unless @offset == 0 + @users = scope.offset(@offset).limit(@limit).all.reverse + else + limit = @user_count % @limit + if limit == 0 + limit = @limit + end + @users = scope.offset(@offset).limit(limit).all.reverse + end + respond_to do |format| format.html { @groups = Group.all.sort @@ -172,6 +281,7 @@ class UsersController < ApplicationController format.api end end + ### modified by fq def show @@ -215,18 +325,48 @@ class UsersController < ApplicationController # @activity_pages = Paginator.new @activity_count, @limit, params['page'] # @offset ||= @activity_pages.offset # @events_by_day_ = @events.slice(@offset,@limit) - if @user == User.current + case params[:type] + when "1" + if @user == User.current + activity = Activity.where('user_id = ?', User.current.id).order('id desc') + @offset, @limit = api_offset_and_limit({:limit => 10}) + @activity_count = activity.count + @activity_pages = Paginator.new @activity_count, @limit, params['page'] + @offset ||= @activity_pages.offset + @activity = activity.offset(@offset).limit(@limit) + @state = 1 + end + when "2" + message = [] + if @user == User.current + message = JournalsForMessage.reference_message(@user.id) + message += Journal.reference_message(@user.id) + end + @offset, @limit = api_offset_and_limit({:limit => 10}) + @activity_count = message.size + @info_pages = Paginator.new @activity_count, @limit, params['page'] + @offset ||= @info_pages.offset + + messages = message.sort {|x,y| y.created_on <=> x.created_on } + + @message = messages[@offset, @limit] + @state = 2 + else + if @user == User.current watcher = User.watched_by(@user) watcher.push(User.current) activity = Activity.where('user_id in (?)', watcher).order('id desc') - else + else activity = Activity.where('user_id = ?', @user.id).order('id desc') + end + @offset, @limit = api_offset_and_limit({:limit => 10}) + @activity_count = activity.count + @activity_pages = Paginator.new @activity_count, @limit, params['page'] + @offset ||= @activity_pages.offset + @activity = activity.offset(@offset).limit(@limit) + @state = 0 end - @offset, @limit = api_offset_and_limit({:limit => 10}) - @activity_count = activity.count - @activity_pages = Paginator.new @activity_count, @limit, params['page'] - @offset ||= @activity_pages.offset - @activity = activity.offset(@offset).limit(@limit) + #Modified by nie unless User.current.admin? @@ -249,10 +389,10 @@ class UsersController < ApplicationController def info message = [] - if @user == User.current - + if @user == User.current message = JournalsForMessage.reference_message(@user.id) - message += Journal.reference_message(@user.id) end + message += Journal.reference_message(@user.id) + end @offset, @limit = api_offset_and_limit({:limit => 10}) @info_count = message.size @info_pages = Paginator.new @info_count, @limit, params['page'] diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index fa212a682..b06b8cbb3 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -14,10 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - class WatchersController < ApplicationController before_filter :require_login, :find_watchables, :only => [:watch, :unwatch] - def watch set_watcher(@watchables, User.current, true) end @@ -25,6 +23,41 @@ class WatchersController < ApplicationController def unwatch set_watcher(@watchables, User.current, false) end + + def join + if User.current.logged? + course = Project.find(params[:object_id]) + if params[:course_password] == '123' + members = [] + members << Member.new(:role_ids => [5], :user_id => User.current.id) + course.members << members + + StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id]) + else + end + end + respond_to do |format| + # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} + format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id])} } + end + end + + def unjoin + if User.current.logged? + + @member = Member.where('project_id = ? and user_id = ?', params[:object_id], User.current.id) + @member.first.destroy + + joined = StudentsForCourse.where('student_id = ? and course_id = ?', User.current.id, params[:object_id]) + joined.each do |join| + join.delete + end + end + respond_to do |format| + # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} + format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id])} } + end + end before_filter :find_project, :authorize, :only => [:new, :create, :append, :destroy, :autocomplete_for_user] accept_api_auth :create, :destroy @@ -86,7 +119,7 @@ class WatchersController < ApplicationController end rescue render_404 - end + end def find_watchables klass = Object.const_get(params[:object_type].camelcase) rescue nil @@ -100,7 +133,27 @@ class WatchersController < ApplicationController def set_watcher(watchables, user, watching) watchables.each do |watchable| watchable.set_watcher(user, watching) - @user = watchable # added by william + # @user = watchable # added by william + if watching + # 修改 user和project的状态 + if watchable.instance_of?(User) + #写user_statuses表 + UserStatus.find_by_user_id(watchable.id).update_watchers_count(1) + elsif watchable.instance_of?(Project) + #写project_statuese表 + ProjectStatus.find_by_project_id(watchable.id).update_watchers_count(1) + end + else + # 修改 user和project的状态 + if watchable.instance_of?(User) + #写user_statuses表 + UserStatus.find_by_user_id(watchable.id).update_watchers_count(-1) + elsif watchable.instance_of?(Project) + #写project_statuese表 :project_status + ProjectStatus.find_by_project_id(watchable.id).update_watchers_count(-1) + end + end + end respond_to do |format| format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index ed14686b0..9a31927ce 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -6,7 +6,7 @@ class WordsController < ApplicationController if params[:new_form][:user_message].size>0 unless params[:user_id].nil? if params[:reference_content] - message = params[:reference_content] + params[:new_form][:user_message] + message = params[:new_form][:user_message] + "\n" + params[:reference_content] else message = params[:new_form][:user_message] end @@ -37,7 +37,9 @@ class WordsController < ApplicationController end def destroy - JournalsForMessage.delete_message(params[:object_id]) + if User.current.admin? || User.current.id == @user.id + JournalsForMessage.delete_message(params[:object_id]) + end @jours = @user.journals_for_messages.reverse @limit = 10 @feedback_count = @jours.count @@ -71,6 +73,10 @@ class WordsController < ApplicationController text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + + # @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + # @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " + @id = user.id rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e99ff4eee..5204788cf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -219,7 +219,8 @@ module ApplicationHelper if projects.any? ancestors = [] original_project = @project - projects.sort_by(&:lft).each do |project| + #modified by nie + projects.each do |project| # set the project environment to please macros. @project = project if (ancestors.empty? || project.is_descendant_of?(ancestors.last)) diff --git a/app/helpers/bids_helper.rb b/app/helpers/bids_helper.rb index 71f73ff39..89dbdd85f 100644 --- a/app/helpers/bids_helper.rb +++ b/app/helpers/bids_helper.rb @@ -34,7 +34,22 @@ module BidsHelper # this method is used to get all projects that tagged one tag # added by william def get_bids_by_tag(tag_name) - Bid.tagged_with(tag_name) + Bid.tagged_with(tag_name).order('updated_on desc') + end + + def sort_bid(state) + content = ''.html_safe + case state + when 0 + content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1'))) + content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0'), :class=>"selected"), :class=>"selected") + + when 1 + content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1'), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0'))) + end + content = content_tag('ul', content) + content_tag('div', content, :class => "tabs") end end \ No newline at end of file diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index aa58eb575..b0b507dd4 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -33,7 +33,7 @@ module GroupsHelper s = content_tag('div', principals_check_box_tags('user_ids[]', principals), :id => 'principals') - links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options| + links = pagination_links_full(principal_pages, principal_count, :per_page_links => false){|text, parameters, options| link_to text, autocomplete_for_user_group_path(group, parameters.merge(:q => params[:q], :format => 'js')), :remote => true } diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 4ecc33690..f5847abbc 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -377,7 +377,7 @@ module IssuesHelper # this method is used to get all projects that tagged one tag # added by william def get_issues_by_tag(tag_name) - Issue.tagged_with(tag_name) + Issue.tagged_with(tag_name).order('updated_on desc') end end diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 80bfd65b3..788bd0765 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -24,17 +24,17 @@ module JournalsHelper destroyable = User.current.logged? && ((journal.user == User.current) || (issue.author_id == User.current.id) || (User.current.admin == 1)) links = [] if !journal.notes.blank? - links << link_to(image_tag('comment.png'), + links << link_to(l(:button_quote), {:controller => 'journals', :action => 'new', :id => issue, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote)) if options[:reply_links] - links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes", + links << link_to_in_place_notes_editor(l(:button_edit), "journal-#{journal.id}-notes", { :controller => 'journals', :action => 'edit', :id => journal, :format => 'js' }, :title => l(:button_edit)) if editable #Added by young if destroyable - links << link_to(image_tag('delete.png'), { :controller => 'journals', :action => 'destroy', :id => journal, :format => 'js' }, + links << link_to(l(:button_delete), { :controller => 'journals', :action => 'destroy', :id => journal, :format => 'js' }, :title => l(:button_delete)) end end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index aa6b9d436..915e02627 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -21,7 +21,7 @@ module MembersHelper def render_principals_for_new_members(project) scope = Principal.active.sorted.not_member_of(project).like(params[:q]) principal_count = scope.count - principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page']#by young + principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] #by young principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all s = content_tag('div', principals_check_box_tags('membership[user_ids][]', principals), :id => 'principals') diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index cc7a29960..416f2d87c 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -29,7 +29,7 @@ module ProjectsHelper {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural}, {:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural}, {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural}, - {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki}, + # {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki}, {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural}, {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities} @@ -38,17 +38,44 @@ module ProjectsHelper end + def sort_project(state) + content = ''.html_safe + case state + when 0 + + content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1'))) + content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2'))) + content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0'), :class=>"selected"), :class=>"selected") + when 1 + + content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1'), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2'))) + content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0'))) + when 2 + content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1'))) + content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2'), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0'))) + end + content = content_tag('ul', content) + content_tag('div', content, :class => "tabs") + end + + #Added by young def course_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, - {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural} + # {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural}, + {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural} ] tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} end #Ended by young + + + def parent_project_select_tag(project) selected = project.parent # retrieve the requested parent project @@ -67,7 +94,7 @@ module ProjectsHelper def render_project_hierarchy(projects) render_project_nested_lists(projects) do |project| #Modified by young - if project.project_type + if (project.project_type==1) s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")+"(#{l(:label_course)})".html_safe else s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}") @@ -103,7 +130,7 @@ module ProjectsHelper # this method is used to get all projects that tagged one tag # added by william def get_projects_by_tag(tag_name) - Project.tagged_with(tag_name) + Project.tagged_with(tag_name).order('updated_on desc') end end diff --git a/app/helpers/teachers_helper.rb b/app/helpers/teachers_helper.rb new file mode 100644 index 000000000..1015c8c9f --- /dev/null +++ b/app/helpers/teachers_helper.rb @@ -0,0 +1,2 @@ +module TeachersHelper +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 8a2ab765f..32c4b6142 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -58,9 +58,58 @@ module UsersHelper # this method is used to get all projects that tagged one tag # added by william def get_users_by_tag(tag_name) - User.tagged_with(tag_name) + User.tagged_with(tag_name).order('updated_on desc') end # added by fq + # + + def show_activity(state) + content = ''.html_safe + case state + when 0 + s = content_tag('span', l(:label_user_all_activity), :class => "current-page") + content << content_tag('li', s) + content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) + content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) + when 1 + s = content_tag('span', l(:label_user_activity_myself), :class => "current-page") + content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) + content << content_tag('li', s, :class => "current-page") + content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) + when 2 + s = content_tag('span', l(:label_user_all_respond), :class => "current-page") + content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) + content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) + content << content_tag('li', s, :class => "current-page") + end + content_tag('div', content, :class => "pagination") + end +# added by huang +def sort_user(state) + content = ''.html_safe + case state + when 0 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1'))) + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2'))) + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0'), :class=>"selected"), :class=>"selected") + when 1 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1'), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2'))) + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0'))) + when 2 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1'))) + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2'), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0'))) + end + content = content_tag('ul', content) + content_tag('div', content, :class => "tabs") + end +#end end diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 052c3fd25..a97deaec2 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -45,6 +45,20 @@ module WatchersHelper link_to text, url, :remote => true, :method => method, :class => css end + + def join_in_course(course, user) + return '' unless user && user.logged? + joined = user.join_in?(course) + text = joined ? '退出课程' : '加入课程' + url_t = join_path(:object_id => course.id) + url_f = try_join_path(:object_id => course.id) + method = joined ? 'delete' : 'post' + if joined + link_to text, url_t, :remote => true, :method => method, :id => 'join', :confirm => l(:text_are_you_sure) + else + link_to text, url_f, :remote => true, :method => method, :id => 'join' + end + end # Returns the css class used to identify watch links for a given +object+ def watcher_css(objects) diff --git a/app/models/bid.rb b/app/models/bid.rb index 25e7743f8..c79f8fd10 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -9,13 +9,15 @@ class Bid < ActiveRecord::Base has_many :projects, :through => :biding_projects has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + has_many :homework_for_courses, :dependent => :destroy + has_many :courses, :through => :homework_for_courses, :source => :project NAME_LENGTH_LIMIT = 60 DESCRIPTION_LENGTH_LIMIT = 250 validates_length_of :name, :maximum => NAME_LENGTH_LIMIT validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT - validates_presence_of :author_id, :name, :deadline, :budget + validates_presence_of :author_id, :name, :deadline # validates_presence_of :deadline, :message => 'test' # validates_format_of :deadline, :with => validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/ @@ -54,6 +56,10 @@ class Bid < ActiveRecord::Base 'description', 'budget', 'deadline' + + # safe_attributes 'name', + # 'description', + # 'deadline' def add_jour(user, notes, reference_user_id = 0) self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id) diff --git a/app/models/changeset.rb b/app/models/changeset.rb index b46f7a312..e3e7ac705 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -23,6 +23,11 @@ class Changeset < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # end + #Added by nie + has_one :project_status, :dependent => :destroy + has_one :users_status + #end + has_and_belongs_to_many :issues has_and_belongs_to_many :parents, :class_name => "Changeset", diff --git a/app/models/course.rb b/app/models/course.rb index 9f25f5c05..be335ec4f 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -1,15 +1,16 @@ class Course < ActiveRecord::Base include Redmine::SafeAttributes - attr_accessible :code, :extra, :name, :state, :tea_id, :time - belongs_to :project, :class_name => 'Project', :foreign_key => :tea_id + attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location + belongs_to :project, :class_name => 'Project', :foreign_key => :extra has_many :bid - validates_presence_of :code, :time + validates_presence_of :code, :time, :location, :name safe_attributes 'extra', 'time', 'name', 'extra', - 'code' - + 'code', + 'location' + end diff --git a/app/models/homework_for_course.rb b/app/models/homework_for_course.rb new file mode 100644 index 000000000..7a440449a --- /dev/null +++ b/app/models/homework_for_course.rb @@ -0,0 +1,8 @@ +class HomeworkForCourse < ActiveRecord::Base + attr_accessible :bid_id, :project_id + + belongs_to :bid + belongs_to :project + + +end diff --git a/app/models/project.rb b/app/models/project.rb index 48ca45746..4e0e4549c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -53,13 +53,20 @@ class Project < ActiveRecord::Base has_many :changesets, :through => :repository # added by fq has_many :journals_for_messages, :as => :jour, :dependent => :destroy + has_many :homework_for_courses, :dependent => :destroy + has_many :homeworks, :through => :homework_for_courses, :source => :bid + has_many :students_for_courses, :dependent => :destroy + has_many :student, :through => :students_for_courses, :source => :user + # end #ADDED BY NIE - has_many :project_infos, :dependent => :destroy + has_many :project_infos, :dependent => :destroy + has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy #end + has_one :wiki, :dependent => :destroy ##added by xianbo - has_one :course, :dependent => :destroy + has_one :course, :dependent => :destroy ,:order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC" accepts_nested_attributes_for :course ##end # Custom field for the project issues @@ -85,10 +92,10 @@ class Project < ActiveRecord::Base :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}}, :author => nil ############################added by william - acts_as_taggable - scope :by_join_date, order("created_at DESC") + acts_as_taggable + scope :by_join_date, order("created_on DESC") ###################added by liuping 关注 - acts_as_watchable + acts_as_watchable attr_protected :status @@ -689,6 +696,7 @@ class Project < ActiveRecord::Base 'project_type' + safe_attributes 'enabled_module_names', :if => lambda {|project, user| project.new_record? || user.allowed_to?(:select_project_modules, project) } diff --git a/app/models/project_status.rb b/app/models/project_status.rb new file mode 100644 index 000000000..02eeb30c8 --- /dev/null +++ b/app/models/project_status.rb @@ -0,0 +1,21 @@ +class ProjectStatus < ActiveRecord::Base + attr_accessible :changesets_count, :watchers_count, :project_id + belongs_to :projects + belongs_to :watchers + belongs_to :changesets + validates_presence_of :project_id + validates_uniqueness_of :project_id + + scope :visible, lambda {|*args| nil } + # 更新字段 watchers_count 加1 这里没有做用户是否存在的匹配 + # 负责这个表的聂同学 是在新建用户时就新建了该表的记录 + # 但是 如果超级用户删除其他用户的话会造成读取错误 这里是遗漏点 + # 删除用户时 此表创建人员未作相应删除动作 + def update_watchers_count(num) + if self.watchers_count >= 0 + self.update_attribute(:watchers_count, self.watchers_count.to_i + num) + end + end + + +end diff --git a/app/models/students_for_course.rb b/app/models/students_for_course.rb new file mode 100644 index 000000000..597d74da6 --- /dev/null +++ b/app/models/students_for_course.rb @@ -0,0 +1,10 @@ +class StudentsForCourse < ActiveRecord::Base + attr_accessible :course_id, :student_id + + belongs_to :course, :class_name => 'Project', :foreign_key => :course_id + belongs_to :student, :class_name => 'User', :foreign_key => :student_id + + validates_presence_of :course_id, :student_id + validates_uniqueness_of :student_id, :scope => :course_id + +end diff --git a/app/models/teacher.rb b/app/models/teacher.rb new file mode 100644 index 000000000..cf57a1be8 --- /dev/null +++ b/app/models/teacher.rb @@ -0,0 +1,13 @@ +class Teacher < ActiveRecord::Base + attr_accessible :course_code, :couurse_time, :location, :tea_name + include Redmine::SafeAttributes + + belongs_to :project + + safe_attributes'tea_name', + 'location', + 'couurse_time', + 'course_code', + 'extra' + +end diff --git a/app/models/user.rb b/app/models/user.rb index 8497918e7..7185041ae 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -82,12 +82,16 @@ class User < Principal has_many :bids, :foreign_key => 'author_id', :dependent => :destroy has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1" - has_many :journal_replies - has_many :activities + has_many :journal_replies, :dependent => :destroy + has_many :activities, :dependent => :destroy + has_many :students_for_courses, :dependent => :destroy + has_many :courses, :through => :students_for_courses, :source => :project + has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy ##### ######added by nie has_many :project_infos, :dependent => :destroy + has_one :user_status, :dependent => :destroy ##### scope :logged, lambda { where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}") } @@ -98,10 +102,10 @@ class User < Principal acts_as_customizable ############################added by william acts_as_taggable - scope :by_join_date, order("created_at DESC") + scope :by_join_date, order("created_on DESC") ############################# added by liuping 关注 - acts_as_watchable - has_one :user_extensions + acts_as_watchable + has_one :user_extensions,:dependent => :destroy ## end attr_accessor :password, :password_confirmation @@ -128,6 +132,9 @@ class User < Principal before_create :set_mail_notification before_save :update_hashed_password before_destroy :remove_references_before_destroy + # added by fq + after_create :act_as_activity + # end scope :in_group, lambda {|group| group_id = group.is_a?(Group) ? group.id : group.to_i @@ -145,6 +152,17 @@ class User < Principal self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true) end + ### fq + def join_in?(course) + joined = StudentsForCourse.where('student_id = ? and course_id = ?', self.id, course.id) + if joined.size > 0 + true + else + false + end + end + ## end + def count_new_jour count = self.new_jours.count end @@ -200,7 +218,7 @@ class User < Principal user = find_by_login(login) if user # user is already in local database - return nil unless user.active? + #return nil unless user.active? return nil unless user.check_password?(password) else # user is not yet registered, try to authenticate with available sources @@ -668,6 +686,10 @@ class User < Principal end private + + def act_as_activity + self.acts << Activity.new(:user_id => self.id) + end # Removes references that are not handled by associations # Things that are not deleted are reassociated with the anonymous user diff --git a/app/models/user_extensions.rb b/app/models/user_extensions.rb index 47578e66f..11df8958d 100644 --- a/app/models/user_extensions.rb +++ b/app/models/user_extensions.rb @@ -1,6 +1,6 @@ class UserExtensions < ActiveRecord::Base belongs_to :user - attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code + attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity #this method was used to update the table user_extensions def update_user_extensions(birthday=nil,brief_introduction=nil, gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil) diff --git a/app/models/user_status.rb b/app/models/user_status.rb new file mode 100644 index 000000000..f7815b62e --- /dev/null +++ b/app/models/user_status.rb @@ -0,0 +1,20 @@ +class UserStatus < ActiveRecord::Base + attr_accessible :changesets_count, :user_id, :watchers_count + belongs_to :users + belongs_to :watchers + belongs_to :changesets + validates_presence_of :user_id + validates_uniqueness_of :user_id + + scope :visible, lambda {|*args| nil } + # 更新字段 watchers_count 加1 这里没有做用户是否存在的匹配 + # 负责这个表的聂同学 是在新建用户时就新建了该表的记录 + # 但是 如果超级用户删除其他用户的话会造成读取错误 这里是遗漏点 + # 删除用户时 此表创建人员未作相应删除动作 + def update_watchers_count(num) + if self.watchers_count >= 0 + self.update_attribute(:watchers_count, self.watchers_count.to_i + num) + end + end + +end diff --git a/app/models/watcher.rb b/app/models/watcher.rb index 1cea711b7..853e0cf6b 100644 --- a/app/models/watcher.rb +++ b/app/models/watcher.rb @@ -18,6 +18,10 @@ class Watcher < ActiveRecord::Base belongs_to :watchable, :polymorphic => true belongs_to :user + #Added by nie + has_one :project_status + has_one :users_status + #end validates_presence_of :user validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id] diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 05a9f61f7..4ee1fcfc2 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -26,13 +26,15 @@ - - <% if Setting.lost_password? %> + + + <% if Setting.lost_password? %> <%= link_to l(:label_password_lost), lost_password_path %> - <% end %> - - - + <% end %> + + + + diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 8264a4891..292cf9a74 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -1,4 +1,4 @@ -

<%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

+

<%=l(:label_register)%> <%=link_to l(:label_loginkk), signin_url if Setting.openid? %>

<%= labelled_form_for @user, :url => register_path do |f| %> <%= error_messages_for 'user' %> @@ -20,14 +20,21 @@ <%="#{l(:label_mail_attention)} "%>

<%= f.select :language, lang_options_for_select %>

+ + +

<%= l(:label_identity) %><%= select_tag 'identity', "".html_safe %>

+ + <% if Setting.openid? %>

<%= f.text_field :identity_url %>

<% end %> + <% @user.custom_field_values.select {|v| v.editable? || v.required?}.each do |value| %>

<%= custom_field_tag_with_label :user, value %>

<% end %> + <%= submit_tag l(:button_submit) %> <% end %> diff --git a/app/views/bids/_bid_show.html.erb b/app/views/bids/_bid_show.html.erb index 30dd92ed5..40760e12f 100644 --- a/app/views/bids/_bid_show.html.erb +++ b/app/views/bids/_bid_show.html.erb @@ -13,19 +13,25 @@ - - -
-<% if bid.reward_type.nil? or bid.reward_type == 1%> +
+ <% 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%> <% elsif bid.reward_type == 2%> <%= 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 %> -(<%= link_to bid.biding_projects.count, project_for_bid_path(bid)%>)<%= l(:label_biding_project) %> -(<%= link_to bid.commit, respond_path(bid)%>)<%= l(:label_responses) %> -(<%= link_to bid.watcher_users.count, respond_path(bid)%>)<%= l(:label_followers) %>
+ + + + + + <%= l(:label_x_biding_project, :count => bid.biding_projects.count) %>(<%=link_to bid.biding_projects.count, project_for_bid_path(bid) %>) + <%= l(:label_x_responses, :count => bid.commit) %>(<%=link_to bid.commit, respond_path(bid) %>) + <%= l(:label_x_followers, :count => bid.watcher_users.count) %>(<%=link_to bid.watcher_users.count, respond_path(bid) %>) + + + <%= format_time bid.created_on %> diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index 494511e54..aac579d7b 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -1,7 +1,7 @@ - +
<%=l(:label_user_response)%><%=l(:label_user_response)%>
@@ -11,14 +11,14 @@ <% if journals.size >0 %> -<% remove_allowed = (User.current.id == journals.first.jour_id) %> + <% for journal in journals%>
<%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> - + @@ -26,17 +26,18 @@ <% if @user==User.current|| User.current.admin? %> - + <%= link_to(l(:label_bid_respond_delete), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm), + :remote => true, :method => 'delete', :class => "delete", :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %> <% else %> -
<%=link_to journal.user, user_path(journal.user)%> <%= l(:label_respond_requirement) %><%= link_to "##{journal.indice}", respond_path(bid), :class => "journal-link" %> <%=link_to journal.user, user_path(journal.user)%> <%= l(:label_respond_requirement) %>

<%= textilizable journal.notes%>

<%= l(:label_bids_published) %> <%= time_tag(journal.created_on).html_safe %> <%= l(:label_bids_published_ago) %><%= link_to(image_tag('comment.png'), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true, + <%= link_to(l(:label_bid_respond_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote))%> - <%= link_to(image_tag('delete.png'), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm), - :remote => true, :method => 'delete', :class => "delete", :confirm => l(:text_are_you_sure), :title => l(:button_delete)) if remove_allowed || journal.user_id == User.current.id %><%= link_to(image_tag('comment.png'), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true, + <%= link_to(l(:label_bid_respond_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote))%> <% end %>
+
<% end %> <% end %> diff --git a/app/views/bids/_project_list.html.erb b/app/views/bids/_project_list.html.erb index d3bac2d07..bfe86c75c 100644 --- a/app/views/bids/_project_list.html.erb +++ b/app/views/bids/_project_list.html.erb @@ -1,7 +1,7 @@ <%= render_flash_messages %> - + <% if User.current.logged? %> - diff --git a/app/views/bids/index.html.erb b/app/views/bids/index.html.erb index 32ab5e1b1..f5234a840 100644 --- a/app/views/bids/index.html.erb +++ b/app/views/bids/index.html.erb @@ -28,6 +28,21 @@ <% end %> +<%= sort_bid(@s_state)%> + + +
<%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
diff --git a/app/views/bids/show.html.erb b/app/views/bids/show.html.erb index 06b38307b..d3b526982 100644 --- a/app/views/bids/show.html.erb +++ b/app/views/bids/show.html.erb @@ -5,6 +5,14 @@ @@ -23,7 +31,7 @@ - +
<%= l(:label_bidding_project) %>(<%= @bidding_project.count%>)<%= l(:label_bidding_project) %>(<%= @bidding_project.count%>)
@@ -20,17 +20,17 @@
<%= link_to image_tag(url_to_avatar(b_project.project), :class => 'avatar3'), :class => "avatar" %>
- + - +
+ - + - +
<%= link_to(b_project.project.name, project_path(b_project.project)) %><%= l(:label_join_bidding)%>
<%= b_project.project.description %><%= b_project.project.description %>
<%= b_project.created_at%><%= b_project.created_at%>
@@ -40,7 +40,7 @@ <%= l(:label_bidding_user) %><%= link_to(b_project.user.name, user_path(b_project.user)) %>
<%= l(:label_bidding_reason) %><%= b_project.description %><%= l(:label_bidding_reason) %><%= b_project.description %>
+ <% if @bid.reward_type.nil? or @bid.reward_type == 1%> @@ -12,7 +20,7 @@ <% elsif @bid.reward_type == 2%> <% else %> - + <% end %>

<%= link_to(@bid.author.name, user_path(@bid.author))%>:<%= @bid.name %>

+ + + <%= render :partial => "/praise_tread/praise_tread", + :locals => {:obj => @bid,:show_flag => true,:user_id =>User.current.id}%> + + +
<%= l(:label_bids_reward_method) %><%= @bid.budget%><%= 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) %>
<%= @bid.description %>
<%= @bid.description %>
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index e83ddc879..001ae9596 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,4 +1,4 @@ -
+
<%= link_to(l(:label_attachment_new), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
diff --git a/app/views/git_usage/ch_usage.html.erb b/app/views/git_usage/ch_usage.html.erb index f7b622c44..f2937be17 100644 --- a/app/views/git_usage/ch_usage.html.erb +++ b/app/views/git_usage/ch_usage.html.erb @@ -1,3 +1,4 @@ + @@ -49,6 +50,21 @@ body table tr td p span4 { body table tr td p span4 { font-weight: bold; } +body table tr td span5 { + color: #F00; +} +body table tr td span5 { + font-weight: bold; +} +body table tr td p span6 { + color: #33F; + font-weight: bold; +} +body table tr td span6 { + color: #33F; + font-weight: bold; + font-size: 24px; +} @@ -66,7 +82,8 @@ body table tr td p span4 { - +
 

 

+

Windows

@@ -126,7 +143,8 @@ body table tr td p span4 { - +

在桌面上点击鼠标右键,选择TortoiseGit的Settings进行设置

Name和Email是用来设置自己的用户名和联系方式的(user.name和user.email必须填写,这些将在版本库提交时用到)。 Name和Email是用来设置自己的用户名和联系方式的(user.name和user.email必须填写,这些将在版本库提交时用到, 其中的name和email要和forge.trustie.net上的登陆名和密码保持一致 + ,方便代码贡献统计 )。

接着可以定制上下文菜单:

@@ -265,11 +283,59 @@ body table tr td p span4 {
+ + + + +
Linux
+ + + + + + + + + + +
1、安装
如果你用的是Linux,你可以用你的本地包管理系统(native package management system)来安装。

$ yum install git-core

+

在redhat等系统下用yum

+

$apt-get install git-core

+

在debian,ubuntu等系统下用apt-get

+ + + + + + + + + + + +
 
2、配置

$git config --global user.name “your_name”

+

$git config --global user.email “your_email” 

+

Name和Email是用来设置自己的用户名和联系方式的(user.name和user.email必须填写,这些将在版本库提交时用到, + 其中的name和email要和forge.trustie.net上的登陆名和密码保持一致 +,方便代码贡献统计 )。

+ + + + + +
 
3、代码提交方法

cd file1

+

$ git add file1

+

$ git init

+

$ git commit -a

+

$ git remote add [name] [版本库里给的URL(去掉http)]

+

$ git push [name] master

+

输入password后即可上传。

+

 

diff --git a/app/views/git_usage/en_usage.html.erb b/app/views/git_usage/en_usage.html.erb index d312a86c0..ce202c792 100644 --- a/app/views/git_usage/en_usage.html.erb +++ b/app/views/git_usage/en_usage.html.erb @@ -30,10 +30,10 @@ body p { body table tr td p { color: #333; font-family: "Comic Sans MS", cursive; + font-weight: normal; } body table tr td table tr td span1 { color: #09c; - font-weight: bold; } body table tr td span1 { color: #09c; @@ -45,6 +45,22 @@ span3 { span4 { color: #F00; } +body table tr td p span5 { + color: #F00; +} +body table tr td p span5 { + font-weight: bold; +} +body table tr td table tr td span6 { + color: #33F; + font-weight: bold; + font-size: 24px; +} +body table tr td span6 { + color: #33F; + font-weight: bold; + font-size: 24px; +} @@ -67,6 +83,11 @@ span4 {
——Trustie团队  
+ + + + +
Windows
@@ -122,7 +143,8 @@ span4 {
1. Installation
@@ -256,11 +278,56 @@ span4 {

Right-click on the desktop and select the "Settings" in the "TortoiseGit"

-

User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository).

+

User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository, the name and email must be the same with login name and email you registed in the forge.trustie.net + ).

Then you can customize the "Context Menu":

Please check the "Clone","Sync" and "Commit" options in the "Context Menu",

check the "Import Svn Ignore", "Show Reflog", "Browse References", "Stash Apply" and "Submodule Sync" in the "Set Extend Menu Item".

+ + + + +
Linux
+ + + + + + + +
1.Installation

If you are useing Linux, you can install git through native package management system.

+

$ yum install git-core

+

if you are using redhat, you should type "yum".

+

$apt-get install git-core

+

if you are using debian or ubuntu, you should type "apt-get".

+ + + + + +
 
2. Configuration

$git config --global user.name “your_name”M

+

$git config --global user.email “your_email” 

+

User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository, + the name and email must be the same with login name and email you registed in the forge.trustie.net +).

+ + + + + + + + + + +
 
3. How to commit

cd file1

+

$ git add file1

+

$ git init

+

$ git commit -a

+

$ git remote add [name] [The URL which we give you in our website(with out http)]

+

$ git push [name] master

+

The last step is enter your password.

+

 

diff --git a/app/views/issues/_history.html.erb b/app/views/issues/_history.html.erb index ba1dfa032..0c584e287 100644 --- a/app/views/issues/_history.html.erb +++ b/app/views/issues/_history.html.erb @@ -1,7 +1,9 @@ <% reply_links = authorize_for('issues', 'edit') -%> <% for journal in journals %> -
+ +
+
—— By Trustie Team
diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 50dc818ef..59d43ef56 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -1,6 +1,6 @@

<%= l(:field_issue) %> -
+
<%= link_to l(:label_issue_new), { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new, :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }, :class => 'icon icon-add' %>
diff --git a/app/views/issues/update_form.js.erb b/app/views/issues/update_form.js.erb index 46fc9722e..615bbfcb3 100644 --- a/app/views/issues/update_form.js.erb +++ b/app/views/issues/update_form.js.erb @@ -1,5 +1,5 @@ $('#all_attributes').html('<%= escape_javascript(render :partial => 'form') %>'); - +$(.splitcontent).style("display", "block") <% if User.current.allowed_to?(:log_time, @issue.project) %> $('#log_time').show(); <% else %> diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 9be9065cc..5ee9c8072 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -5,14 +5,15 @@
<%= render_menu :account_menu -%>
- + <%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %> <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %> -
+ + + diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb index 2acb18d37..03717da65 100644 --- a/app/views/layouts/base_bids.html.erb +++ b/app/views/layouts/base_bids.html.erb @@ -53,7 +53,7 @@ <% elsif @bid.reward_type == 2%>

<% else %> - + <% end %> @@ -62,7 +62,9 @@
<%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> <%= l(:label_bids_reward_method) %><%= @bid.budget%><%= 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) %>
- <%= l(:label_followers) %> (<%= link_to @bid.watcher_users.count, home_path %>)  <%= l(:label_bidding_project) %>(<%= link_to @bid.biding_projects.count, project_for_bid_path(@bid) %>) <%=l(:label_responses)%>(<%= link_to @bid.commit, respond_path(@bid)%>) + <%= link_to l(:label_followers)+"("+@bid.watcher_users.count.to_s+")", respond_path(@bid) %>   + <%= link_to l(:label_bidding_project)+"("+@bid.biding_projects.count.to_s+")", project_for_bid_path(@bid) %>  + <%= link_to l(:label_responses)+"("+@bid.commit.to_s+")", respond_path(@bid)%>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 80c619eb0..e9976f4a0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -36,6 +36,7 @@
<%= textilizable @project.name %> + <%= join_in_course(@project, User.current)%>
@@ -52,18 +53,37 @@ <% files_count += version.attachments.count %> <% end %> - <%=link_to "#{@project.members.count}", project_member_path(@project) %> + <%=link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'%> <%=link_to "#{@project.issues.count}", project_issues_path(@project) %> <%=link_to files_count, project_files_path(@project) %> - <%= l(:label_course_student) %> - <%= l(:label_homework) %> + <%= " 成员" %> + <%= "缺陷" %> <%= l(:label_course_data) %>
+ + +
+ + + + + + + + + + + + + +
教师名称:<%= @course.name%>
所在单位:<%= @course.location%>
课程学分:<%= @course.code%>
课程学时:<%= @course.time%>
+
+
@@ -114,18 +134,15 @@
-
-
教师名称:<%= @course.name%>
-
所在单位:并行与分布重点实验室
-
课程学分:<%=@course.code%>
-
课程学时:<%=@course.time%>
-
XXXX:XXXXXXXX
-
+
+
    -
  • <%= link_to(l(:label_overview), project_path(@project))%>
  • +
  • <%= link_to(l(:label_overview), project_path(@project))%>
  • <%= link_to(l(:label_homework), {:controller => 'projects', :action => 'homework'})%>
  • -
  • <%= link_to(l(:label_repository), { :controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1 })%>
  • -
  • <%= link_to(l(:label_settings),{:controller => 'projects', :action => 'settings', :id => @project, :course => 1})%>
+
  • <%= link_to(l(:label_course_file), project_file_path(@project))%>
  • +
  • <%= link_to "课程通知", {:controller => 'news', :action => 'index'} %>
  • + +
  • <%= link_to(l(:label_settings),{:controller => 'projects', :action => 'settings', :id => @project})%>
  • <%= yield %> <%= call_hook :view_layouts_base_content %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index c0cd755a8..404a20fa1 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -34,7 +34,7 @@ <%= link_to image_tag(url_to_avatar(@project), :class => 'avatar2') %>
    - <%= textilizable @project.name %> + <%= @project.name %>
    <% unless User.current.member_of? @project %> @@ -45,7 +45,7 @@
    - +
    @@ -56,12 +56,16 @@ <% end %> + - + + - - - + + + + +
    <%=link_to "#{@project.members.count}", project_member_path(@project) %><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist" %> <%=link_to "#{@project.issues.count}", project_issues_path(@project) %><%=link_to files_count, project_files_path(@project) %>
    <%= l(:label_member) %> <%= l(:label_project_issues) %><%= l(:label_attachment) %> <%= l(:label_member) %><%= l(:label_user_watchered) %> <%= l(:label_project_issues) %>
    @@ -79,7 +83,7 @@ <%= textilizable @project.description %>
    - <%= l(:label_create_time) %>:<%= @project.created_on %> + <%= l(:label_create_time) %>:<%= format_time(@project.created_on) %>
    diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 635120f85..8641e3138 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -47,24 +47,24 @@
    - <%= l(:label_user_watcher) %> (<%=link_to User.watched_by(@user.id).count ,:controller=>"users", :action=>"user_watchlist"%>)   + <%=link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%>   - <%= l(:label_user_fans) %> (<%=link_to @user.watcher_users(@user.id).count, :controller=>"users", :action=>"user_fanslist" %>) + <%=link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users(@user.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist" %>
    - +
    - + - + - +
    <%= l(:label_user_joinin) %><%= format_date(@user.created_on) %><%= l(:label_user_joinin) %><%= format_date(@user.created_on) %>
    <%= l(:label_user_login) %><%= format_date(@user.last_login_on) %><%= l(:label_user_login) %><%= format_date(@user.last_login_on) %>
    <%= l(:label_user_mail) %><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %><%= l(:label_user_mail) %><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %>
    @@ -75,8 +75,10 @@ -
    +
    +
    <%= render :partial => 'tags/tag', :locals => {:obj => @user,:object_flag => "1"}%> +
    @@ -103,7 +105,7 @@
    - <%= l(:label_user_fans) %> + <%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count) %> <% if show_more_fans?(@user) %>
    <%= link_to l(:label_more), :controller => "users", :action => "user_fanslist"%>
    <% end %> @@ -123,11 +125,9 @@
    - <% if @user == User.current %> - <%= render_menu :user_menu_self %> - <%else%> + <%= render_menu :user_menu %> - <%end%> +
    <%= yield %> <%= call_hook :view_layouts_base_content %> diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index c5e591e1a..9a89af75c 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -35,8 +35,10 @@ <%= f.text_field :mail, :required => true %>

    +

    <% if Setting.openid? %>

    <%= f.text_field :identity_url %> @@ -55,7 +57,7 @@ <%= l(:field_mail_notification)%> -

    +

    <%= l(:label_preferences)%> -

    +
    <%= render :partial => 'users/preferences' %>
    -
    +

    <%= l(:label_comment_plural) %>

    + <% comments = @comments.reverse %> + <% comments.each do |comment| %> + <% next if comment.new_record? %> + + + + + +
    <%= image_tag(url_to_avatar(comment.author), :class => "avatar")%> + + + + + + + + + + + +
    <%= link_to_user(comment.author) if comment.respond_to?(:author) %> <%= l(:label_project_newadd) %><%= l(:label_comment_plural) %>
    +

    + <%= textilizable(comment.comments) %> +

    <%= @news.created_on %><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment}, + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
    + <% end if @comments.any? %>
    diff --git a/app/views/projects/_course_form.html.erb b/app/views/projects/_course_form.html.erb index 39876fc4e..34de1fde7 100644 --- a/app/views/projects/_course_form.html.erb +++ b/app/views/projects/_course_form.html.erb @@ -12,9 +12,10 @@ <% end %>

    <%= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %>

    <%= f.fields_for @course do |m| %> +

    <%= m.text_field :name,:required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %>

    <%= m.text_field :time, :size => 60, :style => "width:488px;margin-left: 10px;" %>

    <%= m.text_field :code, :size => 60, :style => "width:488px;margin-left: 10px;" %>

    -

    <%= m.text_field :name, :size => 60, :style => "width:488px;margin-left: 10px;" %>

    +

    <%= m.text_field :location, :size => 60, :style => "width:488px;margin-left: 10px;" %>

    <% end %>

    <%= f.check_box :is_public, :style => "margin-left:10px;" %>

    <%= f.text_field :project_type, :value => 1 %>

    diff --git a/app/views/projects/_edit.html.erb b/app/views/projects/_edit.html.erb index c2bd5ce23..852d7c0b8 100644 --- a/app/views/projects/_edit.html.erb +++ b/app/views/projects/_edit.html.erb @@ -5,4 +5,4 @@ <%= submit_tag l(:button_save) %> <% end %> -
    \ No newline at end of file +
    diff --git a/app/views/projects/_homework_form.html.erb b/app/views/projects/_homework_form.html.erb new file mode 100644 index 000000000..c133ca495 --- /dev/null +++ b/app/views/projects/_homework_form.html.erb @@ -0,0 +1,36 @@ + + + + +<%= error_messages_for 'bid' %> + +

    <%= l(:label_bids_form_new_description) %>

    +

    <%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_requirement_name)}" %>

    + +

    <%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_requirement_description)}" %>

    + +

    <%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%> +

    +

    <%= hidden_field_tag 'course_id', @project.id%> +

    \ No newline at end of file diff --git a/app/views/projects/_new_homework.html.erb b/app/views/projects/_new_homework.html.erb new file mode 100644 index 000000000..7ccbda49b --- /dev/null +++ b/app/views/projects/_new_homework.html.erb @@ -0,0 +1,81 @@ + + + + + +<%= form_tag({:controller => 'bids', +:action => 'new_bid', +:remote => true, +:method => :post, +:id => 'new-bid-form'}) do %> + + + + + + + + + + + + + + + + + + + + + +
    <%= text_field_tag 'bid_title', "#{l(:label_requirement_name)}", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_title', '#{l(:label_requirement_name)}')", :onblur => "showInfo('bid_title', '#{l(:label_requirement_name)}')"%>
    <%= text_area_tag 'bid_description', "#{l(:label_requirement_description)}", :class => 'noline', :required => true, :style => "resize: none;", :rows => 6, + :onfocus => "clearInfo('bid_description', '#{l(:label_requirement_description)}')", :onblur => "showInfo('bid_description', '#{l(:label_requirement_description)}')" %>
    <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :required => true, + :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> + <%= calendar_for('bid_deadline')%>
    + + + + +
    <%= submit_tag l(:button_new_bid), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
    +<%end%> \ No newline at end of file diff --git a/app/views/projects/_new_join.html.erb b/app/views/projects/_new_join.html.erb new file mode 100644 index 000000000..244bb95cb --- /dev/null +++ b/app/views/projects/_new_join.html.erb @@ -0,0 +1,16 @@ +

    请输入课程密码

    + +<%= form_tag({:controller => 'watchers', + :action => 'join', + :object_id => course.id}, + :remote => true, + :method => :post, + :id => 'new-watcher-form') do %> + + <%= text_field_tag 'course_password', nil%> + +

    + <%= submit_tag l(:button_add), :name => nil, :onclick => "hideModal(this);" %> + <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %> +

    +<% end %> diff --git a/app/views/projects/_new_respond.html.erb b/app/views/projects/_new_respond.html.erb new file mode 100644 index 000000000..0db0ecf21 --- /dev/null +++ b/app/views/projects/_new_respond.html.erb @@ -0,0 +1,8 @@ +<%= form_tag({:controller => 'projects', +:action => 'project_respond'}) do %> +<%= text_area_tag 'project_respond', "", :class => 'noline', :required => true, :style => "resize: none;", :rows => 6, :placeholder => l(:label_projects_feedback_respond_content) %> + +<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> +<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "bid_btn"%> + +<%end%> diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index fa0a8b75a..8dbeb11ae 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -1,7 +1,7 @@
    - <%= image_tag(url_to_avatar(project), :class => "avatar2") %> + <%=link_to image_tag(url_to_avatar(project), :class => "avatar2"), project_path(project) %>

    @@ -10,10 +10,10 @@

    - <%= content_tag('span', @project.watcher_users.count, :class => "info") %><%= content_tag('span', l(:label_follow_people)) %> + <%= content_tag('span', @project.watcher_users.count, :class => "info") %><%= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>

    - <%= content_tag('span', "#{@project.users.count}", :class => "info") %><%= content_tag('span', l(:label_current_contributors)) %> + <%= content_tag('span', "#{@project.users.count}", :class => "info") %><%= content_tag('span', l(:label_x_current_contributors, :count => @project.users.count)) %>

    <%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %><%= content_tag('span', l(:label_since_last_commits)) %> @@ -25,7 +25,14 @@

    - <%= content_tag('span', "#{l(:default_role_manager)}: ") %> + + <% if(@project.project_type==1)%> + <%= content_tag('span', "#{l(:field_tea_name)}: ") %> + <% else %> + <%= content_tag('span', "#{l(:default_role_manager)}: ") %> + <% end %> + + <% @admin = @project.project_infos%> <% if @admin.size > 0 %> <%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %> diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index 23fbda04e..e89eb9c39 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -1,27 +1,37 @@

    <%= l(:label_user_response) %>

    +<%= render_flash_messages %> <% if @jour.size >0 %> <% for journal in @jour%> - - - - + + + +
    <%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> - - - - - - - - - - -
    <%=link_to journal.user, user_path(journal.user)%> - 对项目进行了反馈 -

    <%= textilizable journal.notes%>

    <%= format_time journal.created_on %> -
    <%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> + + + + + + + + + + + + + + +
    <%= link_to journal.user, user_path(journal.user)%><%= l(:label_projects_feedback) %>
    +

    + <%= textilizable journal.notes%> +

    <%= format_time journal.created_on %> + <% ids = 'project_respond_form_'+journal.id.to_s%> + <%= toggle_link l(:label_projects_feedback_respond), ids, {:focus => 'project_respond'} %>
    +
    style="display: none"> + <%= render :partial => 'new_respond', :locals => {:journal => journal} %> +
    <% end %> diff --git a/app/views/projects/homework.html.erb b/app/views/projects/homework.html.erb index 50a439db1..850c4bc3d 100644 --- a/app/views/projects/homework.html.erb +++ b/app/views/projects/homework.html.erb @@ -22,12 +22,6 @@
    -<% if User.current.logged? %> - -<% end %> -
    <%= render :partial => 'bids/bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
    diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 814d221f0..804e12537 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -2,7 +2,7 @@ <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> <% end %> -<%= form_tag(projects_path, :method => :get) do %> +<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
    @@ -19,6 +19,22 @@ <% end %> +<%= sort_project(@s_type)%> + + +
    <%= render_project_hierarchy(@projects)%>
    diff --git a/app/views/projects/new_homework.html.erb b/app/views/projects/new_homework.html.erb index 4348382b2..3737a6509 100644 --- a/app/views/projects/new_homework.html.erb +++ b/app/views/projects/new_homework.html.erb @@ -1,8 +1,8 @@

    <%=l(:label_course_new_homework)%>

    -<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_bid'} do |f| %> +<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework'} do |f| %>
    - <%= render :partial => 'bids/form', :locals => { :f => f } %> + <%= render :partial => 'homework_form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> <%= javascript_tag "$('#bid_name').focus();" %> <% end %> diff --git a/app/views/projects/new_join.js.erb b/app/views/projects/new_join.js.erb new file mode 100644 index 000000000..c0a6f4a50 --- /dev/null +++ b/app/views/projects/new_join.js.erb @@ -0,0 +1,3 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', :locals => {:course => @course}) %>'); +showModal('ajax-modal', '400px'); +$('#ajax-modal').addClass('new-watcher'); diff --git a/app/views/projects/project_respond.html.erb b/app/views/projects/project_respond.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb new file mode 100644 index 000000000..e10be86fd --- /dev/null +++ b/app/views/projects/search.html.erb @@ -0,0 +1,67 @@ +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> +<% end %> + +<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %> +
    +
    + + + + + + +
    <%= l(:label_project_plural)%><%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> +
    +
    +<%end%> + + + + +
    + <%= render_project_hierarchy(@projects)%> +
    + + + +<% if User.current.logged? %> +

    + <%= l(:label_my_projects) %> +

    +<% end %> + +<% other_formats_links do |f| %> +<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<% end %> + +<% content_for :sidebar do %> +<%= form_tag({}, :method => :get) do %> +

    <%= l(:label_project_plural) %>

    + +

    + <%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %> +

    +<% end %> +<% end %> + +<% html_title(l(:label_project_plural)) -%> diff --git a/app/views/projects/settings.html.erb b/app/views/projects/settings.html.erb index 3e5999fd4..02a2388c1 100644 --- a/app/views/projects/settings.html.erb +++ b/app/views/projects/settings.html.erb @@ -1,5 +1,5 @@

    <%=l(:label_settings)%>

    -<% if @course_tag %> +<% if @project.project_type %> <%= render_tabs course_settings_tabs %> <% else %> <%= render_tabs project_settings_tabs %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 7192bf05a..b8d94ec3d 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -42,5 +42,9 @@
    <% else %> -

    <%= l(:label_project_no_activity) %>

    +

    +
    <%=link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user)%> + + +
    <%=link_to @user.login.to_s,user_path(@user) %> <%= l(:label_user_create_project) %> <%=link_to @project.name %> !
    <%= format_time(@project.created_on) %>

    <% end %> diff --git a/app/views/projects/show_new.html.erb b/app/views/projects/show_new.html.erb index 25ee6e702..caa8bf94a 100644 --- a/app/views/projects/show_new.html.erb +++ b/app/views/projects/show_new.html.erb @@ -44,7 +44,12 @@ <% for tracker in @trackers %>
  • <%= link_to h(tracker.name), project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>: <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i, - :total => @total_issues_by_tracker[tracker].to_i) %> + :total => @total_issues_by_tracker[tr +
  • <%= l(:default_tracker_bug) %>
  • + <% end %> + <% if tracker.[4]%> +
  • <%= l(:default_tracker_mission) %>
  • + <% end %> <% end %> diff --git a/app/views/projects/watcherlist.html.erb b/app/views/projects/watcherlist.html.erb new file mode 100644 index 000000000..491dd7205 --- /dev/null +++ b/app/views/projects/watcherlist.html.erb @@ -0,0 +1,33 @@ + +

    <%= l(:label_user_watcher)%>

    +
    + <% for user in @project.watcher_users %> +
      +
    • + + + + + +
      <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %> + + + + + + + + + +

      <%= content_tag "div", link_to_user(user), :class =>"project_avatar_name" %>

      +

      + <% unless user.memberships.empty? %> + <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %> + <% for member in user.memberships %> + <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> + <% end %> + <% end %> +

      <%= l(:label_user_joinin) %><%= format_date(user.created_on) %> +
    +<% end %> +
    \ No newline at end of file diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index f63baa955..4c3ec9bbf 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -76,8 +76,9 @@ <% end %> <% end %> -<%= l(:label_how_commit_code) %> <%= link_to(l(:label_how_commit_code_chinese), ch_usage_path)%> <%= link_to('English', en_usage_path)%> - + +<%= l(:label_how_commit_code) %> <%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "usage")%> | <%= link_to('English', en_usage_path, :class => "usage")%> + <% content_for :header_tags do %> diff --git a/app/views/settings/_display.html.erb b/app/views/settings/_display.html.erb index 1ae5a351a..71c44be03 100644 --- a/app/views/settings/_display.html.erb +++ b/app/views/settings/_display.html.erb @@ -3,7 +3,7 @@

    <%= setting_select :ui_theme, Redmine::Themes.themes.collect {|t| [t.name, t.id]}, :blank => :label_default, :label => :label_theme %>

    -

    <%= setting_select :default_language, lang_options_for_select(false) %>

    +

    <%= setting_select :default_language, :Chinese简体中文 => :zh, :English => :en %>

    <%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], :blank => :label_language_based %>

    <% locale = User.current.language.blank? ? ::I18n.locale : User.current.language %> diff --git a/app/views/tags/_pagination.html.erb b/app/views/tags/_pagination.html.erb new file mode 100644 index 000000000..3f2d89ce7 --- /dev/null +++ b/app/views/tags/_pagination.html.erb @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/views/tags/_related_tags.html.erb b/app/views/tags/_related_tags.html.erb index 42b3c010f..2dd1d93e8 100644 --- a/app/views/tags/_related_tags.html.erb +++ b/app/views/tags/_related_tags.html.erb @@ -2,14 +2,14 @@
      <% for rt in related_tags %>
    • - <%= link_to image_tag("/images/sidebar/add.png"),:action => "add_tag",:remote => true,:tag => rt,:show_flag => show_flag %> + <%= link_to image_tag("/images/sidebar/add.png"),:action => "index", + :current_selected_tags => selected_tags,:tag => rt,:do_what => "1", + :obj_id => obj_id,:object_flag => obj_flag %> <%= rt %> - <% @issue_size = Issue.tagged_with("#{rt}").size %> - <% @project_size = Project.tagged_with(rt).size %> - <% @user_size = User.tagged_with("#{rt}").size %> - (<%= @user_size + @project_size + @issue_size %>) + + <%= render :partial => 'sidebar_tags',:locals => {:show_flag => obj_flag,:sg => rt }%>
    • <% end %>
    diff --git a/app/views/tags/_selected_tags.html.erb b/app/views/tags/_selected_tags.html.erb index 78f963744..3081177bc 100644 --- a/app/views/tags/_selected_tags.html.erb +++ b/app/views/tags/_selected_tags.html.erb @@ -2,12 +2,11 @@
      <% for sg in selected_tags %>
    • - <%= link_to image_tag("/images/sidebar/minus.png"),:action => "delete_tag",:remote=>true,:tag => sg,:show_flag => show_flag %> + <%= link_to image_tag("/images/sidebar/minus.png"),:action => "index", + :current_selected_tags => selected_tags ,:tag => sg,:do_what => "0", + :obj_id => obj_id,:object_flag => obj_flag %> <%= sg %> - <% @issue_size = Issue.tagged_with("#{sg}").size %> - <% @project_size = Project.tagged_with(sg).size %> - <% @user_size = User.tagged_with("#{sg}").size %> - (<%= @user_size + @project_size + @issue_size %>) + <%= render :partial => 'sidebar_tags',:locals => {:show_flag => obj_flag,:sg => sg }%>
    • <% end %>
    diff --git a/app/views/tags/_show_bids.html.erb b/app/views/tags/_show_bids.html.erb index 937c97a39..63f351738 100644 --- a/app/views/tags/_show_bids.html.erb +++ b/app/views/tags/_show_bids.html.erb @@ -3,9 +3,11 @@
    <% bids_results.each do |bid| %>

    - <%= l(:label_tags_bid) %>:<%= link_to "#{bid.name}",:controller => "bids",:action => "show",:id => bid.id %> + <%= l(:label_tags_bid) %>:<%= link_to "#{bid.name}", + :controller => "bids",:action => "show",:id => bid.id %>
    <%= l(:label_tags_bid_description) %>:<%= bid.description %> + <%= bid.updated_on %>

    <% end %> diff --git a/app/views/tags/_sidebar_tags.html.erb b/app/views/tags/_sidebar_tags.html.erb new file mode 100644 index 000000000..d64f1c290 --- /dev/null +++ b/app/views/tags/_sidebar_tags.html.erb @@ -0,0 +1,10 @@ +<% case show_flag%> +<% when '1' then %> +(<%= User.tagged_with("#{sg}").size %>) +<%when '2' then %> +(<%= Project.tagged_with(sg).size %>) +<% when '3' then %> +(<%= Issue.tagged_with("#{sg}").size %>) +<% when '4' then %> +(<%= Bid.tagged_with("#{sg}").size %>) +<% end %> diff --git a/app/views/tags/_tag_name.html.erb b/app/views/tags/_tag_name.html.erb index 8780ed01c..d123b9053 100644 --- a/app/views/tags/_tag_name.html.erb +++ b/app/views/tags/_tag_name.html.erb @@ -27,8 +27,6 @@ <% end %> <% else %> - - <% if @tags.size > 0 %> <% @tags.each do |tag| %> @@ -39,7 +37,5 @@ <% else %>
    <%= l(:label_tags_no) %>
    <% end %> - - - + <% end %> \ No newline at end of file diff --git a/app/views/tags/_tag_search_results.html.erb b/app/views/tags/_tag_search_results.html.erb index 2ae4e66f5..44f6d0031 100644 --- a/app/views/tags/_tag_search_results.html.erb +++ b/app/views/tags/_tag_search_results.html.erb @@ -2,29 +2,28 @@ <% unless show_flag.nil? %> <% case %> <% when show_flag == '1' %> - <%=l(:label_user)%> + <%=l(:label_user)%>(<%= @results_count %>) <%= render :partial => "show_users",:locals => {:users_results => users_results}%> <% when show_flag == '2'%> - <%=l(:label_project)%> + <%=l(:label_project)%>(<%= @results_count %>) <%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%> <% when show_flag == '3'%> - <%=l(:label_issue)%> + <%=l(:label_issue)%>(<%= @results_count %>) <%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%> <% when show_flag == '4'%> - <%= l(:label_requirement)%> + <%= l(:label_requirement)%>(<%= @results_count %>) <%= render :partial => "show_bids",:locals => {:bids_results => bids_results}%> <% else %> <%= l(:label_tags_all_objects)%> + <%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%> <%= render :partial => "show_users",:locals => {:users_results => users_results }%> <%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%> + <%= render :partial => "show_bids",:locals => {:bids_results => bids_results}%> <% end %> + <% else %> - no data. + no data... <% end %> - \ No newline at end of file +<%= render :partial => "pagination",:locals => {:obj_pages => @obj_pages} %> diff --git a/app/views/tags/add_tag.js.erb b/app/views/tags/add_tag.js.erb index 5401a34ca..fb4dd5af9 100644 --- a/app/views/tags/add_tag.js.erb +++ b/app/views/tags/add_tag.js.erb @@ -4,6 +4,7 @@ $('#related_tags').html('<%= j(render :partial => "related_tags", :locals => {:related_tags => $related_tags ,:show_flag => @show_flag })%>') $('#show_results').html('<%= j(render :partial => "tag_search_results",:locals => {:issues_results => @issues_results, - :projects_results => @projects_results,:users_results => @users_results,:bids_results => @bids_results ,:show_flag => @show_flag })%>') - - \ No newline at end of file + :projects_results => @projects_results,:users_results => @users_results, + :bids_results => @bids_results ,:show_flag => @show_flag,:obj_pages => @obj_pages })%>') + + diff --git a/app/views/tags/delete_tag.js.erb b/app/views/tags/delete_tag.js.erb index 8483eee22..37f0de92f 100644 --- a/app/views/tags/delete_tag.js.erb +++ b/app/views/tags/delete_tag.js.erb @@ -4,5 +4,7 @@ $('#related_tags').html('<%= j(render :partial => "related_tags", :locals => {:related_tags => $related_tags,:show_flag => @show_flag })%>') $('#show_results').html('<%= j(render :partial => "tag_search_results",:locals => {:issues_results => @issues_results, -:projects_results => @projects_results,:users_results => @users_results,:bids_results => @bids_results ,:show_flag => @show_flag })%>') +:projects_results => @projects_results,:users_results => @users_results, + :bids_results => @bids_results ,:show_flag => @show_flag ,:obj_pages => @obj_pages })%>') + diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb index 8ef79caab..121725ad5 100644 --- a/app/views/tags/index.html.erb +++ b/app/views/tags/index.html.erb @@ -1,14 +1,16 @@ <% content_for :sidebar do %>
    -

    <%= l(:label_tags_selected) %>

    -
    - <%= render :partial => "selected_tags",:locals => {:selected_tags => $selected_tags,:show_flag => @obj_flag}%> -
    - -

    <%= l(:label_tags_related) %>

    - +

    <%= l(:label_tags_selected) %>

    +
    + <%= render :partial => "selected_tags",:locals => { + :selected_tags => @selected_tags,:obj_flag => @obj_flag,:obj_id => @obj_id }%> +
    + +

    <%= l(:label_tags_related) %>

    +
    <% end %> <% content_for :content do %> @@ -16,15 +18,18 @@

    <%= l(:label_tags_search_result) %>

    <%= l(:label_tags_numbers) %> - <%= l(:label_issue_plural) %>(<%= @issues_tags_num %>)| - <%= l(:label_project_plural) %>(<%= @projects_tags_num %>)| - <%= l(:label_user_plural) %>(<%= @users_tags_num %>)| + <%= l(:label_issue_plural) %>(<%= @issues_tags_num %>) | + <%= l(:label_project_plural) %>(<%= @projects_tags_num %>) | + <%= l(:label_user_plural) %>(<%= @users_tags_num %>) | <%= l(:label_tags_call)%>(<%= @bids_tags_num %>)
    -
    - <%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results, - :projects_results => @projects_results,:users_results => @users_results ,:bids_results=>@bids_results,:show_flag => @obj_flag}%> -
    +
    + <%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results, + :projects_results => @projects_results,:users_results => @users_results , + :bids_results=>@bids_results,:show_flag => @obj_flag}%> +
    +
    + <% end %> diff --git a/app/views/tags/show_all.html.erb b/app/views/tags/show_all.html.erb index 8dde3ba9e..8b6fc6199 100644 --- a/app/views/tags/show_all.html.erb +++ b/app/views/tags/show_all.html.erb @@ -5,7 +5,7 @@
    <% for tag in @tags %> - <%= link_to tag.name,:remote=>true,:action=>"delete",:q => tag.id%> + <%= link_to tag.name,:remote=>true,:action=>"delete",:q => tag.id,:confirm => "Are you Sure?"%> <% end %> <% end %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 18b926de9..5eaec7dbd 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -5,7 +5,7 @@

    <%= l(:label_user_plural)%>

    -<%= form_tag(users_path, :method => :get) do %> +<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
    <%= l(:label_filter_plural) %> @@ -72,7 +72,7 @@
    <%= l(:label_user_plural)%> -<%= form_tag(users_path, :method => :get) do %> +<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %> +
    <% for user in @users -%> <% unless user.id == 1%>
    - <%= content_tag "p", "#{format_date(user.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %> + <%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %> <%= image_tag "/images/time_member.png", :class => "img_member_time"%>
    @@ -99,18 +114,18 @@ <%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %>
    - <%= l(:label_has_fans,:count=>user.watcher_users.count)%> + <%= l(:label_x_has_fans,:count=>user.watcher_users.count)%> <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %>
    <% unless user.memberships.empty? %> - <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %> + <%= l(:label_x_contribute_to, :count => user.memberships.count) %> <% for member in user.memberships %> <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> <% end %> <% end %> - <%= user.changesets.count == 0 ? '' : ",#{l(:label_total_commit, :total_commit => user.changesets.count)}" %> + <%= user.changesets.count == 0 ? '' : ",#{l(:label_x_total_commit, :count => user.changesets.count)}" %>
    <% end -%> diff --git a/app/views/users/info.html.erb b/app/views/users/info.html.erb index 9c400691c..e63b71817 100644 --- a/app/views/users/info.html.erb +++ b/app/views/users/info.html.erb @@ -13,12 +13,12 @@ <% if e.instance_of?(JournalsForMessage)%> <% if e.reply_id == User.current.id%> <%if e.jour_type == 'Bid'%> - <%= l(:label_in_bids)%><%= link_to(e.jour.name, respond_path(e.jour))%><%= l(:label_quote_my_words) %> + <%= l(:label_in_bids)%><%= link_to(e.jour.name, respond_path(e.jour))%> <%= l(:label_quote_my_words) %> <% else %> - <%= l(:label_in_users)%><%= link_to(e.jour.firstname, feedback_path(e.jour))%><%= l(:label_quote_my_words) %> + <%= l(:label_in_users)%><%= link_to(e.jour.firstname, feedback_path(e.jour))%> <%= l(:label_quote_my_words) %> <% end %> <% else %> - <%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id))%><%= l(:label_have_respond) %> + <%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id))%> <%= l(:label_have_respond) %> <% end %> <% else %> <% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %> diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb new file mode 100644 index 000000000..8ea035e5d --- /dev/null +++ b/app/views/users/search.html.erb @@ -0,0 +1,140 @@ +<% if User.current.admin? %> +
    + <%= link_to l(:label_user_new), new_user_path, :class => 'icon icon-add' %> +
    + +

    <%= l(:label_user_plural)%>

    + +<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %> +
    + + <%= l(:label_filter_plural) %> + + + <%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> + + <% if @groups.present? %> + + <%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, params[:group_id].to_i), :onchange => "this.form.submit(); return false;" %> + <% end %> + + + <%= text_field_tag 'name', params[:name], :size => 30 %> + <%= submit_tag l(:label_search), :class => "small", :name => nil %> +
    +<% end %> +  + +
    + + + + <%= sort_header_tag('login', :caption => l(:field_login)) %> + <%= sort_header_tag('firstname', :caption => l(:field_firstname)) %> + <%= sort_header_tag('lastname', :caption => l(:field_lastname)) %> + <%= sort_header_tag('mail', :caption => l(:field_mail)) %> + + <%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %> + <%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %> + <%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %> + + + + + <% for user in @users -%> + "> + + + + + + + + + + <% end -%> + +
    <%= avatar(user, :size => "14") %><%= link_to h(user.login), edit_user_path(user) %><%= h(user.firstname) %><%= h(user.lastname) %><%= checked_image user.admin? %><%= format_time(user.created_on) %> <%= change_status_link(user) %> + <%= delete_link user_path(user, :back_url => users_path(params)) unless User.current == user %>
    +
    + + +<% html_title(l(:label_user_plural)) -%> + +<% else %> + +
    +<%= l(:label_user_plural)%> + +<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %> + + +
    + + + + + +
    + <% for user in @users -%> + <% unless user.id == 1%> +
    + + <%= content_tag "p", "#{format_date(user.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %> + <%= image_tag "/images/time_member.png", :class => "img_member_time"%> + +
    + <%= link_to image_tag(url_to_avatar(user), :class => 'avatar'), user_path(user) %> + <%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %> +
    +
    + <%= l(:label_has_fans,:count=>user.watcher_users.count)%> + <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %> +
    + +
    + <% unless user.memberships.empty? %> + <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %> + <% for member in user.memberships %> + <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> + <% end %> + <% end %> + <%= user.changesets.count == 0 ? '' : ",#{l(:label_total_commit, :total_commit => user.changesets.count)}" %> +
    +
    + <% end -%> + <% end -%> +
    + +<% html_title(l(:label_user_plural)) -%> +<% end -%> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index bbf1fdc03..14b3556e5 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,3 +1,7 @@ +<% if User.current.id == @user.id%> +<%= show_activity @state%> +<% end %> +<% unless @state == 2%> <% unless @activity.empty? %>
    <% @activity.each do |e| %> @@ -13,9 +17,9 @@ <% when 'Bid' %> <% if e.user == User.current%> - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_i_new_activity) %> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> <% else %> - <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> <% end %> @@ -28,13 +32,15 @@
    <%= link_to l(:label_find_all_comments), respond_path(e.act_id) %><%= l(:label_comments_count, :count => e.act.commit)%>
    <% when 'Journal' %> + <% 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.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_i_new_activity) %> <%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> <% else %> - <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to( l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> <% end %> +

    @@ -47,9 +53,9 @@ <% when 'Changeset' %> <% 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.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_i_new_activity) %> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %> <% else %> - <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %> <% end %> @@ -64,9 +70,9 @@ <% when 'Message' %> <% 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.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_i_new_activity) %> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> <% else %> - <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> <% end %> @@ -75,15 +81,32 @@ <%= textilizable act.content %>

    + + +
    + <% when 'Principal' %> + + <% if e.user == User.current%> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_new_user) %> + <% else %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_user) %> + <% end %> + + + +

    + +

    +
    <% when 'News' %> <% if e.user == User.current%> - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_i_new_activity) %> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :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("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> <% end %> @@ -96,13 +119,15 @@
    <%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} %><%= l(:label_comments_count, :count => e.act.comments_count)%>
    <% 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} %> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_i_new_activity) %> <%= link_to(l(:label_activity_project)+act.project.name, project_path(act.project.identifier))%> <%= 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} %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to(l(:label_activity_project)+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %> <% end %> +

    @@ -142,4 +167,63 @@ <%= l(:label_user_activities_other) %>

    <% end %> -<% end %> \ No newline at end of file +<% end %> +<% else %> + +<% unless @message.empty? %> +
    + <% @message.each do |e| -%> + + + + + + +
    <%= link_to image_tag(url_to_avatar(e.user), :class => "avatar"), user_path(e.user), :class => "avatar" %> + + + + + + + + + + + + +
    <%= link_to(h(e.user), user_path(e.user)) %> + <% if e.instance_of?(JournalsForMessage)%> + <% if e.reply_id == User.current.id%> + <%if e.jour_type == 'Bid'%> + <%= l(:label_in_bids)%><%= link_to(e.jour.name, respond_path(e.jour))%> <%= l(:label_quote_my_words) %> + <% else %> + <%= l(:label_in_users)%><%= link_to(e.jour.firstname, feedback_path(e.jour))%> <%= l(:label_quote_my_words) %> + <% end %> + <% else %> + <%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id))%> <%= l(:label_have_respond) %> + <% end %> + <% else %> + <% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %> + <%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id))%><%= l(:label_have_respond) %> + + <% else %> + <%= l(:label_in_issues)%><%= link_to(e.issue.subject, issue_path(e.issue))%><%= l(:label_quote_my_words) %> + <% end %> + <% end %>
    +

    + <%= textilizable e.notes %> +

    <%= format_time e.created_on %>
    + <% end %> +
    + +<% else %> +

    <%= l(:label_no_user_respond_you) %>

    +<% end %> + + +<% end %> diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 01359edad..749fd80d9 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -1,5 +1,5 @@ -

    <%= l(:label_user_fans)%>

    +

    <%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)%>

    <% for user in @user.watcher_users %>
    • @@ -8,13 +8,13 @@ <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %> -
      <%= content_tag "div", link_to_user(user), :class => "nomargin avatar_name" %> + <%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>

      <% unless user.memberships.empty? %> - <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %> + <%= l(:label_x_contribute_to, :count => user.memberships.count) %> <% for member in user.memberships %> <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> <% end %> diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index 0c0ae4546..643ccfe96 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -3,7 +3,7 @@ <%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %>

      -留言(<%= @feedback_count%>) +<%= l(:label_newfeedback_message) %>(<%= @feedback_count%>)
      diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 079ceb428..0f71d20b4 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -6,7 +6,7 @@
    • - + diff --git a/app/views/users/user_watchlist.html.erb b/app/views/users/user_watchlist.html.erb index 1c759374a..40658bc66 100644 --- a/app/views/users/user_watchlist.html.erb +++ b/app/views/users/user_watchlist.html.erb @@ -8,13 +8,13 @@
      <%= link_to image_tag(url_to_avatar(membership.project), :class => 'avatar') %><%= link_to image_tag(url_to_avatar(membership.project), :class => 'avatar'), project_path(membership.project) %> @@ -20,8 +20,8 @@

      - - + +
      <%= format_date(membership.created_on) %><%= h membership.roles.sort.collect(&:to_s).join(', ') %> <%= format_time(membership.created_on) %><%= h membership.roles.sort.collect(&:to_s).join(', ') %>
      <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %> -
      <%= content_tag "div", link_to_user(user), :class => "nomargin avatar_name" %> + <%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>

      <% unless user.memberships.empty? %> - <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %> + <%= l(:label_x_contribute_to, :count => user.memberships.count) %> <% for member in user.memberships %> <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> <% end %> diff --git a/app/views/users/watch_bids.html.erb b/app/views/users/watch_bids.html.erb index 08b2d3c5a..4cb39a9cd 100644 --- a/app/views/users/watch_bids.html.erb +++ b/app/views/users/watch_bids.html.erb @@ -7,7 +7,7 @@ - + <% else %> - <%= link_to(image_tag('comment.png'), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true, + <%= link_to(l(:label_newfeedback_quote), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote))%> <% end %> diff --git a/app/views/words/_new.html.erb b/app/views/words/_new.html.erb index 0553059ea..9b1504040 100644 --- a/app/views/words/_new.html.erb +++ b/app/views/words/_new.html.erb @@ -2,12 +2,12 @@ - -

      Error occurred!

      -

      An error occurred on the page you were trying to access.
      - If you continue to experience problems please contact your Trustie administrator for assistance.

      -

      If you are the Trustie administrator, check your log files for details about the error.

      -

      Back

      - + Trustie 500 error + + + +
      +

      Back

      +
      + + + diff --git a/public/images/avatars/Project/6408 b/public/images/avatars/Project/6408 new file mode 100644 index 000000000..bf740e537 Binary files /dev/null and b/public/images/avatars/Project/6408 differ diff --git a/public/images/avatars/Project/6446 b/public/images/avatars/Project/6446 new file mode 100644 index 000000000..90e0e8474 Binary files /dev/null and b/public/images/avatars/Project/6446 differ diff --git a/public/images/logo.png b/public/images/logo.png index 5015e9be2..9a5bf367d 100644 Binary files a/public/images/logo.png and b/public/images/logo.png differ diff --git a/public/images/twurn.com_.png b/public/images/twurn.com_.png new file mode 100644 index 000000000..8e7c6d120 Binary files /dev/null and b/public/images/twurn.com_.png differ diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index a295b3883..0cc4b45a4 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1,16 +1,22 @@ html {overflow-y:scroll;} -body { font-family: Verdana, sans-serif; font-size: 12px; color:#484848; margin: 0; padding: 0; min-width: 900px; } +body { font-family:'微软雅黑', Verdana, sans-serif; font-size: 13px; color:#484848; margin: 0; padding: 0; min-width: 900px; } /*modified by linchun*/ -h1, h2, h3, h4 {font-family: "Trebuchet MS", Verdana, sans-serif;padding: 2px 10px 1px 0px;margin: 0 0 10px 0;} +h1, h2, h3, h4 {font-family: '微软雅黑', "Trebuchet MS", Verdana, sans-serif;padding: 2px 10px 1px 0px;margin: 0 0 10px 0;} #content h1, h2, h3, h4 {color: #555;} h2, .wiki h1 {font-size: 20px;} -h3, .wiki h2 {font-size: 16px;} +h3, .wiki h2 {font-size: 15px;} h4, .wiki h3 {font-size: 13px;} h4 {border-bottom: 1px dotted #bbb;} /*new by huang*/ /**/ +.project_avatar_name { + position: relative; + font-size: 16px; + display:block; +} + a.bids_user { font-family:微软雅黑; color:#15bccf; @@ -45,9 +51,11 @@ a.bids_user { margin-top: 10px; } -ul.list_watch{list-style-type:none; - height:auto; - border-bottom: 1px dashed rgb(204, 204, 204); +ul.list_watch{ + padding-left: 0px; + list-style-type:none; + height:auto; + border-bottom: 1px dashed rgb(204, 204, 204); } .new_creat{ @@ -158,16 +166,33 @@ ul.tool li{list-style-type:none; .font_welcome_trustie{ font-family:Impact; font-weight: regular; - font-size: 28px; + font-size: 29px; color:#15bccf; } .font_welcome_Cdescription{ font-family: 微软雅黑; - font-size: 20px; + font-size: 16px; color: #5c5c5c; } +.font_welcome_tdescription{ + font-family: '微软雅黑'; + font-size: 20px; + color: #5c5c5c; + text-align: justify; + text-justify: inter-ideograph; +} + +.font_welcome_tdescription2{ + font-family: Arial, Helvetica, sans-serif; + font-size: 20px; + color: #FF0000; + text-align: justify; + text-justify: inter-ideograph; +} + + .font_welcome_Edescription{ font-family: Default; font-size: 16px; @@ -191,11 +216,11 @@ ul.tool li{list-style-type:none; .font_lighter{ font-family:微软雅黑; color:#acaeb1; - font-size:12px; + font-size:13px; } .font_lighter2{ - font-family:微软雅黑; + font-family:'微软雅黑'; color:#9a9a9a; font-size:14px; } @@ -203,7 +228,7 @@ ul.tool li{list-style-type:none; .font_lighter_welcome{ color:#acaeb1; font-size:12px; - font-family:宋体; + font-family:微软雅黑; } .font_lighter_sidebar{ /*font-family:微软雅黑;*/ @@ -218,7 +243,7 @@ ul.tool li{list-style-type:none; padding-bottom: 5px; } .font_description{ - font-size:13px; + font-size:14px; line-height: 1.5em; } @@ -240,6 +265,7 @@ ul.tool li{list-style-type:none; .welcone_left{ margin-top: 60px; + margin-left: 90px; float:left; width: 49%; @@ -415,7 +441,7 @@ a.htags{ padding: 0px 4px 0px 4px; margin:0 3px; } -.contextdescription2{font-family: arial; +.contextdescription2{font-family: '微软雅黑'; font-size:12px; font-weight:ligher; color:#7e7e7e; @@ -523,14 +549,14 @@ ul.context_projects li {list-style-type:none; margin-left:auto; text-align: left; - font-family:黑体; + font-size:24px; font-weight:bold; text-decoration:; color:#000000; } .firdtname_project{ - font-family:Arial; + font-size:12px; font-weight:bold; text-decoration:; @@ -616,7 +642,13 @@ ul.newprojects2 li{ white-space:nowrap; } #top-menu a {color: #fff; margin-right: 8px; font-weight: bold;} -#top-menu #loggedas { float: right; margin-right: 0.5em; color: #fff; } +#top-menu #loggedas + { + float: right; + + margin-right: 0.5em; + color: #fff; + } #account {float:right;} @@ -927,7 +959,7 @@ margin-left:-10px; .project_right_tag{margin-top:44%;} .project_homepage_tag{float:left; margin-top:9%;color:#000000;} .project_infor_tag{float:auto;color:#000000;padding-left: 15px;} -.project_page_tag{float:right;color:#C0C0C0; font-family: Verdana;font-size: 13px;} +.project_page_tag{float:right;color:#C0C0C0; font-family: '微软雅黑';font-size: 13px;} .wiki_text{font-size:small;color:#000000;} .user_setting{float:right; color:#000000;padding-right: 10px;} .line_color{color:#000000;} @@ -935,7 +967,7 @@ margin-left:-10px; .project_right_tag{margin-top:40%;} .project_homepage_tag{padding-left:570px;color:#000000;} .project_infor_tag{float:auto;color:#000000;padding-left: 15px; } -.project_page_tag{float:right;color:#C0C0C0; font-family: Verdana;font-size: 13px;} +.project_page_tag{float:right;color:#C0C0C0; font-family: '微软雅黑';font-size: 13px;} .wiki_text{font-size:small;color:#000000;} .user_setting { @@ -961,7 +993,7 @@ margin-left:-10px; height:50px; } -#header a {font-family: Verdana, sans-serif; font-size: 12px; color:#808080;} +#header a {font-family:'微软雅黑', Verdana, sans-serif; font-size: 12px; color:#808080;} #login-form_new table/*Added by young*/ { padding:20px 25px; @@ -969,7 +1001,7 @@ margin-left:-10px; text-align:left; margin-top: 50px; - width:280px; + width:320px; font-family:微软雅黑,lucida grande,verdana; font-size:12px; @@ -985,7 +1017,7 @@ margin-left:-10px; /*end*/ .splitcontentright{float:right; width:49%;} form {display: inline;} -input, select {vertical-align: middle; margin-top: 1px; margin-bottom: 1px;} +input, select {font-family: 微软雅黑;vertical-align: middle; margin-top: 1px; margin-bottom: 1px;} /*modify by men*/ fieldset {border: 1px solid #e4e4e4; margin:0;} legend {color: #484848;} hr { width: 100%; height: 1px; background: #ccc; border: 0; color:#000000;} @@ -1001,6 +1033,7 @@ blockquote { padding-bottom: 0.6em; margin-left: 1.4em; margin-right: 0.4em; + border-radius: 4px; # added by bai (边框变圆润) font-family: 微软雅黑; background: url(/images/requirements/reference.jpg) } @@ -1127,7 +1160,7 @@ ul.projects li {list-style-type:none; #projects-index ul.projects ul.projects { border-left: 3px solid #e0e0e0; padding-left:1em;} #projects-index ul.projects li.root {margin-bottom: 1em;} #projects-index ul.projects li.child {margin-top: 1em;} -#projects-index ul.projects div.root a.project {font-family: "Trebuchet MS", Verdana, sans-serif; font-weight: bold; font-size: 16px; margin: 0 0 10px 0; } +#projects-index ul.projects div.root a.project {font-family:'微软雅黑', "Trebuchet MS", Verdana, sans-serif; font-weight: bold; font-size: 14px; margin: 0 0 10px 0; } .my-project { padding-left: 18px; background: url(../images/fav.png) no-repeat 0 50%; } #notified-projects ul, #tracker_project_ids ul {max-height:250px; overflow-y:auto;} @@ -1226,8 +1259,8 @@ fieldset#notified_events .parent { padding-left: 20px; } span.required {color: #bb0000;} .summary {font-style: italic;} -#attachments_fields input.description {margin-left:4px; width:340px;} -#attachments_fields span {display:block; white-space:nowrap;} +#attachments_fields input.description {margin-left:4px; width:340px; } +#attachments_fields span {display:block; white-space:nowrap; font-family:'微软雅黑';} #attachments_fields input.filename {border:0; height:1.8em; width:150px; color:#555; background-color:inherit; background:url(../images/attachment.png) no-repeat 1px 50%; padding-left:18px;}/*Modified by young*/ #attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;} #attachments_fields .ajax-loading input.filename {background:url(../images/loading.gif) no-repeat 0px 50%;} @@ -1273,7 +1306,7 @@ table.members td.group { padding-left: 20px; background: url(../images/group.png input#principal_search, input#user_search {width:90%} input.autocomplete { - background: #fff url(../images/magnifier.png) no-repeat 2px 50%; padding-left:20px; + background: #fff url(../images/magnifier.png) no-repeat right 50%; padding-left:20px; border:1px solid #9EB1C2; border-radius:2px; height:1.5em; } input.autocomplete.ajax-loading { @@ -1406,44 +1439,117 @@ p.progress-info {clear: left; font-size: 80%; margin-top:-4px; color:#777;} #roadmap table.progress td { height: 1.2em; } /***** Tabs *****/ +/** +#content .tabs_new {height: 2.6em; margin-bottom:1.2em; margin-top: 0.8em; position:relative; overflow:hidden;} +#content .tabs_new ul {margin:0; position:absolute; bottom:0; padding-left: 0.5em; width: 2000px; border-bottom: 1px solid #15BCCF;} +#content .tabs_new ul li { + width:75px; + float:left; + list-style-type:none; + white-space:nowrap; + margin-right:4px; + background:#fff; + position:relative; + margin-bottom:-1px; +} +#content .tabs_new ul li a{ + display:block; + font-size: 14px; + text-decoration:none; + line-height:1.2em; + padding-top: 6px; + padding-bottom: 2px; + text-align: center; + border: 1px solid #15BCCF; + border-bottom: 0px solid #15BCCF; + background-color: #fff; + color:#999; + font-weight:bold; + border-top-left-radius:4px; + border-top-right-radius:4px; +} + **/ +/*added by huang*/ +/*.pagination_list{height: 3em; margin-bottom:1.2em; position:relative; overflow:hidden;} +.pagination_list ul{margin:0; position:absolute; bottom:0; padding-left:0.5em; width:2000px; border-bottom: 1px solid #15BCCF;} +.pagination_list ul li{ + float:left; + list-style-type:none; + white-space:nowrap; + margin-right:4px; + background:#fff; + position:relative; + margin-bottom:-1px; +} +.test_new{ + background: #000; + color: #000; + padding-bottom: -1px; +} +.pagination_list ul li a{ + border: 1px solid #15BCCF; + + display:block; + font-size: 0.9em; + text-decoration: none; + line-height:1.3em; + padding:2px 6px 2px 6px; + background-color:#fff; + color:#606060; + font-weight:bold; + border-top-left-radius:3px; + border-top-right-radius:3px; +} +.pagination_list ul li a:hover{background-color: #E2F4FF; + text-decoration:none; + margin-bottom:-1px;} +.pagination_list ul li a.selected{ + + background-color: #000; + border: 1px solid #000; + border-bottom: 1px solid #000; + color:#111; +} +.pagination_list ul li a.selected:hover {background-color: #000;}*/ +/*end*/ #content .tabs {height: 2.6em; margin-bottom:1.2em; position:relative; overflow:hidden;} -#content .tabs ul {margin:0; position:absolute; bottom:0; padding-left:0.5em;} -#content .tabs ul li { +#content .tabs ul {margin:0; position:absolute; bottom:0; padding-left:0.5em; font-family: 14px; width:2000px; border-bottom: 1px solid #15BCCF;} +#content .tabs ul li { float:left; list-style-type:none; white-space:nowrap; margin-right:0px; background:#fff; position:relative; - margin-bottom:5px; + margin-bottom:-1px; } #content .tabs ul li a{ - font-size: 13px; - text-decoration:none; + + display:block; + font-size: 14px; + text-decoration: none; line-height:1.3em; - padding:2px 6px 2px 6px; - border: 1px solid #ccc; - border-bottom: 1px solid #bbbbbb; - background-color:#FFFFFF; - color:#999; + padding:2px 6px 2px 6px; + background-color:#fff; + color:#606060; font-weight:bold; border-top-left-radius:3px; border-top-right-radius:3px; } #content .tabs ul li a:hover { - background-color: #cacbcb; + background-color: #fff; text-decoration:none; } #content .tabs ul li a.selected { background-color: #fff; - border: 1px solid #bbbbbb; - border-bottom: 1px solid #BBBBBB; + border: 1px solid #15BCCF; + border-bottom: 1px solid #fff; color:#111; } -#content .tabs ul li a.selected:hover {background-color: #E5DFC7;} +#content .tabs ul li a.selected:hover {background-color: #E2F4FF;} div.tabs-buttons { position:absolute; right: 0; width: 48px; height: 24px; background: white; bottom: 0; border-bottom: 1px solid #bbbbbb; } @@ -1472,9 +1578,11 @@ button.tab-right { } /*added by young*/ /***** Settings Tabs *****/ -#content .tabs_new {height: 2.6em; margin-bottom:1.2em; position:relative; overflow:hidden;} -#content .tabs_new ul {margin:0; position:absolute; bottom:0; padding-left:0.5em; width: 2000px; border-bottom: 1px solid #bbbbbb;} +/*modified by huang*/ +#content .tabs_new {height: 2.6em; margin-bottom:1.2em; margin-top: 0.8em; position:relative; overflow:hidden;} +#content .tabs_new ul {margin:0; position:absolute; bottom:0; padding-left: 0.5em; width: 2000px; border-bottom: 1px solid #15BCCF;font-size:14px;} #content .tabs_new ul li { + width:85px; /*modified by linchun*/ float:left; list-style-type:none; white-space:nowrap; @@ -1485,32 +1593,35 @@ button.tab-right { } #content .tabs_new ul li a{ display:block; - font-size: 13px; + font-size: 15px; text-decoration:none; - line-height:1.3em; - padding:4px 6px 4px 6px; - border: 1px solid #ccc; - border-bottom: 1px solid #bbbbbb; - background-color: #f6f6f6; - color:#999; + line-height:1.2em; + padding-top: 6px; + padding-bottom: 2px; + text-align: center; + + border: 1px solid #15BCCF; + /*border-bottom: 0px solid #15BCCF;*/ + + color:#606060; font-weight:bold; - border-top-left-radius:3px; - border-top-right-radius:3px; + border-top-left-radius:4px; + border-top-right-radius:4px; } #content .tabs_new ul li a:hover { - background-color: #cacbcb; + background-color: #E2F4FF; text-decoration:none; } #content .tabs_new ul li a.selected { - background-color: #fff; - border: 1px solid #bbbbbb; + background-color: rgba(28, 158, 199, 0.68); # added by bai + border: 1px solid #15BCCF; border-bottom: 1px solid #fff; - color:#111; + color:#FFF; } -#content .tabs_new ul li a.selected:hover {background-color: #fff;} +#content .tabs_new ul li a.selected:hover {background-color: #15BCCC;} div.tabs_new-buttons { position:absolute; right: 0; width: 48px; height: 24px; background: white; bottom: 0; border-bottom: 1px solid #bbbbbb; } @@ -1537,7 +1648,46 @@ button.tab_new-right { background: #eeeeee url(../images/bullet_arrow_right.png) no-repeat 50% 50%; border-top-right-radius:3px; } -/*end by young*/ +/*added by huang*/ +#content_ .tabs {height: 3.5em; margin-bottom:1.2em; position:relative; overflow:hidden;} +#content_ .tabs ul {margin:0; position:absolute; bottom:0; padding-left:0.5em; width:2000px; border-bottom: 1px solid #15BCCF;font-size:14px;} +#content_ .tabs ul li { + float:left; + list-style-type:none; + white-space:nowrap; + margin-right:0px; + background:#fff; + position:relative; + margin-bottom:-1px; +} +#content_ .tabs ul li a{ + + display:block; + font-size: 14px; + text-decoration: none; + line-height:1.3em; + padding:4px 6px 4px 6px; + background-color:#fff; + color:#606060; + font-weight:bold; + border-top-left-radius:3px; + border-top-right-radius:3px; +} + +#content_ .tabs ul li a:hover { + background-color: #fff; + text-decoration:none; +} + +#content_ .tabs ul li a.selected { + background-color: #fff; + border: 1px solid #15BCCF; + border-bottom: 1px solid #fff; + color:#111; +} + +#content_ .tabs ul li a.selected:hover {background-color: #E2F4FF;} +/*end*/ /***** Diff *****/ .diff_out { background: #fcc; } .diff_out span { background: #faa; } @@ -1700,6 +1850,7 @@ a.close-icon:hover {background-image:url('../images/close_hl.png');} .icon { background-position: 0% 50%; background-repeat: no-repeat; + font-family: '微软雅黑'; /*modify by men*/ padding-left: 20px; padding-top: 2px; padding-bottom: 3px; @@ -1910,7 +2061,7 @@ h2 img { vertical-align:middle; } overflow:hidden; } -/*added by william*/ +/*added by william*/ #tag { background: url(../images/issue_tag.png) no-repeat right -19px; border-radius: 5px 5px 5px 5px; @@ -1918,7 +2069,7 @@ h2 img { vertical-align:middle; } padding: 0px 4px; margin: 3px; display: inline-block; - font-size: 11px; + font-size: 13px; /*modified by linchun*/ text-decoration: none; cursor: pointer; } diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 3c89e1af7..3c9e21a6b 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -51,7 +51,7 @@ only screen and (min-device-pixel-ratio: 2) { body,#wrapper { background-color:#fff; /*整体背景色ecfffb*/ - font-family:Helvetica,Arial,"Lucida Grande",verdana,sans-serif + font-family:'微软雅黑',Helvetica,Arial,"Lucida Grande",verdana,sans-serif } a @@ -367,12 +367,15 @@ ul.projects li.root { background-color:#fff; /*顶层导航颜色*/ color: #fff; - font-size:13px; + font-size:15px; font-family: 微软雅黑; position:relative; padding:0; height:1px; - padding-top:0 + padding-top:0; + /*by bai*/ + border-radius: 5px;/*导航栏边角变圆*/ + /*end*/ } #top-menu ul @@ -386,6 +389,7 @@ ul.projects li.root /*by young*/ padding-top: 10px; color:#fff; + font-weight: bold; line-height:21px; margin-right:1px } @@ -425,9 +429,9 @@ ul.projects li.root #content { - width:680px; + width:693px; float:right; - background-color: #FFFFFF + background-color: #FFFFFF; } #content .wiki img @@ -508,7 +512,7 @@ ul.projects li.root h1,h2,h3,h4 { - font-family:"PT Sans","Lucida Grande",arial,sans-serif + font-family:'微软雅黑',"PT Sans","Lucida Grande",arial,sans-serif /*modify by men*/ } h1 @@ -906,7 +910,7 @@ input#issue_subject textarea.wiki-edit { - font-family:Cambria,Verdana,Serif; + font-family:'微软雅黑',Cambria,Verdana,Serif; /*modify by men*/ font-size:larger } @@ -931,7 +935,7 @@ hr } p { - font-size: small + font-size: 13px } /*end*/ div.issue @@ -994,7 +998,7 @@ ol li ol li ol li input[type="submit"] { - font-family:Arial,Helvetica,sans-serif; + font-family:'微软雅黑',Arial,Helvetica,sans-serif; /*modify by men*/ font-size:13px; color:#050505; padding:5px 10px; @@ -1085,7 +1089,7 @@ div.wiki-description { margin-top: 10px; width: 470px; max-height: 121px; - font-family: helvetica,arial,sans-serif; + font-family: '微软雅黑'; /*modify by men*/ color: rgb(0, 0, 0); font-size: 13px; line-height: 18px; @@ -1100,7 +1104,7 @@ div.wiki-description { float: left; height: auto; width: 246px; - font-family: helvetica,arial,sans-serif; + font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/ color: rgb(0, 0, 0); font-size: 13px; line-height: 18px; @@ -1214,6 +1218,7 @@ p.stats { height: 20px; width: 908px; margin-bottom: 5px; + padding-top: 10px; } .main-language { @@ -1221,7 +1226,7 @@ p.stats { height: 18px; width: 375px; font-size: 13px; - font-family: helvetica,arial,sans-serif; + font-family: '微软雅黑'; /*modify by men*/ line-height: 18px; overflow: hidden; white-space: nowrap; @@ -1234,7 +1239,7 @@ p.stats { height: 18px; width: 260px; font-size: 13px; - font-family: helvetica,arial,sans-serif; + font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/ line-height: 18px; } @@ -1281,7 +1286,7 @@ div.project-block img.avatar2 { margin-bottom: 0px; /*background-color: #f5f5f5;*/ border-bottom: 1px solid #eee; - border-bottom: 1px solid rgba(0, 0, 0, 0.05); + border-bottom: 1px dashed rgb(204, 204, 204); /*-webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; @@ -1346,6 +1351,11 @@ div.pagination ul { margin-left: 0px; margin-top: 0px; } +div.pagination ul li{ + + font-size: 14px; + text-decoration:none; +} div.user-bottom { margin-left: 64px; @@ -1554,7 +1564,7 @@ div.autoscroll li.id a { div.autoscroll li.subject { margin:0px 60px 0px 0px; - font-size: small; + font-size: 13px; line-height: 1.3; word-wrap: break-word; } @@ -1593,7 +1603,7 @@ div.issue-list-description { color: rgb(72, 72, 72); overflow: hidden; white-space: nowrap; - font-size: small; + font-size: 13px; /*modify by men*/ text-overflow: ellipsis; -o-text-overflow: ellipsis; } @@ -1640,14 +1650,15 @@ member style div.member_content div.well { height: auto; margin-bottom: 10px; + width: 660px; } div.member_content { float: left; - margin-top: 20px; + margin-top: 0px; width: 600px; - margin-left: 40px; + margin-left: 0px; } /* @@ -1677,7 +1688,7 @@ div.project-search { } div.project-search input[type="submit"] { width: 40px; - font-family: Arial,Helvetica,sans-serif; + font-family: '微软雅黑',Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(5, 5, 5); padding: 0px; @@ -1697,6 +1708,15 @@ img.avatar3 { a.bid_path { font-size: 14px; } + +/*added by bai*/ +a.usage { + + color: #F60; + font-weight: bold; +} +/*end*/ + a.bid_user { font-family:微软雅黑; color:#acaeb1; @@ -1719,12 +1739,14 @@ input[type='text'].noline { .noline { /*border-style: none; border-color: white;*/ + font-family:微软雅黑; /*modify by men*/ border: #d5dee9 1px solid; font-size: 12px; - color: #ACAEB1; + color: #818283; # modified by bai padding: 9px 5px; width: 98%; cursor: text; + border-radius: 4px; # added by bai (边框变圆润) } .grayline{ border: #d5dee9 1px solid;
      <%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'), :class => "avatar" %><%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'),user_path(bid.author), :class => "avatar" %> @@ -16,14 +16,26 @@ - +
      -
      - - - - - + + +
      <%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%>(<%= bid.biding_projects.count%>)<%= l(:label_biding_project) %>(<%= bid.commit %>)<%= l(:label_responses) %>(<%= bid.watcher_users.count%>)<%= l(:label_followers) %>
      + <% 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%> + <% elsif bid.reward_type == 2%> + <%= l(:label_bids_reward_method) %><%= bid.budget%> + <% else %> + <%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= bid.budget%> <%= l(:label_bids_credit_number) %> + <% end %> + + +
      + <%= l(:label_biding_project) %>(<%=link_to bid.biding_projects.count, project_for_bid_path(bid) %>) + <%= l(:label_responses) %>(<%=link_to bid.commit, respond_path(bid) %>) + <%= l(:label_followers) %>(<%=link_to bid.watcher_users.count, respond_path(bid) %>) +
      <%= format_time bid.created_on %> <%= format_time bid.created_on %>
      diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index 14e50c581..2eef3f356 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -1,5 +1,5 @@ -
      +
      <%= link_to l(:label_version_new), new_project_version_path(@project), :class => 'icon icon-add' if User.current.allowed_to?(:manage_versions, @project) %>
      diff --git a/app/views/watchers/_set_join.js.erb b/app/views/watchers/_set_join.js.erb new file mode 100644 index 000000000..cd6ca1b59 --- /dev/null +++ b/app/views/watchers/_set_join.js.erb @@ -0,0 +1,3 @@ + + +$('#join').html('<%= escape_javascript join_in_course(course, user) %>'); diff --git a/app/views/watchers/_set_watcher.js.erb b/app/views/watchers/_set_watcher.js.erb index b1252a8fa..e5cdc4f3e 100644 --- a/app/views/watchers/_set_watcher.js.erb +++ b/app/views/watchers/_set_watcher.js.erb @@ -1,5 +1,2 @@ <% selector = ".#{watcher_css(watched)}" %> $("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")}); - -$('#fans_num').html('<%= j(render :partial => "/watchers/fans_num",:locals => {:fans_num => get_fans_num(@user) } -) %>'); diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 6272e9763..931c22116 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -139,9 +139,9 @@ software development and software crowdsourcing.
      +
      - + -
      <%= l(:label_welcome_trustie) %> , <%= l(:label_welcome_trustie_description) %><%= l(:label_welcome_trustie) %> , <%= l(:label_welcome_trustie_description) %>
      + + +
      - + - - + + + -
      <%= l(:label_welcome) %> <%=link_to User.current.lastname< <%= l(:label_join) %><%= l(:label_welcome) %> <%=link_to User.current.lastname< <%= l(:label_join) %>
      <%=link_to image_tag(url_to_avatar(User.current), :class => 'avatar'), user_path(User.current) %><%= l(:label_user_watcher) %> (<%= link_to User.watched_by(User.current).count, user_path(User.current) %>)  - <%= l(:label_user_fans) %>(<%=link_to User.current.watcher_users(User.current.id).count, user_path(User.current) %>)<%=link_to image_tag(url_to_avatar(User.current), :class => 'avatar'), user_path(User.current) %><%= link_to l(:label_user_watcher)+"("+User.watched_by(User.current).count.to_s+")", user_path(User.current) %>  + <%=link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+User.current.watcher_users(User.current.id).count.to_s+")", user_path(User.current) %>
      <% unless User.current.memberships.empty? %> - <%= l(:label_welcome_page_to, :project_count => "#{User.current.memberships.count}") %> <% end %>
      - + <% end %> <% end %> diff --git a/app/views/words/_message.html.erb b/app/views/words/_message.html.erb index a8fbb98cc..20458834e 100644 --- a/app/views/words/_message.html.erb +++ b/app/views/words/_message.html.erb @@ -21,12 +21,12 @@
      <%= format_time journal.created_on %> <% if @user == User.current %> - <%= link_to(image_tag('comment.png'), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true, + <%= link_to(l(:label_newfeedback_quote), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote))%> - <%= link_to(image_tag('delete.png'), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user}, + <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) if remove_allowed || journal.jour_id == User.current.id %>