diff --git a/Gemfile b/Gemfile index 0ea40e013..bfc0b773f 100644 --- a/Gemfile +++ b/Gemfile @@ -72,6 +72,10 @@ end group :development do gem "rdoc", ">= 2.4.2" + if nil + gem 'thin' + gem 'rack-mini-profiler' + end end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 200810c4b..2f7d6e600 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -114,22 +114,12 @@ class IssuesController < ApplicationController @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } @allowed_statuses = @issue.new_statuses_allowed_to(User.current) - # @edit_allowed = User.current.allowed_to?(:edit_issues, @project) - if User.current.admin? || User.current.id == @issue.author_id || User.current.id == @issue.assigned_to_id || ProjectInfo.manager?(User.current.id, @project) - @edit_allowed = true - # elsif User.current.id == @issue.author.id - else - @edit_allowed = false - end - # @edit_allowed = User.current.allowed_to?(:edit_issues, @project) + @edit_allowed = User.current.allowed_to?(:edit_issues, @project) @priorities = IssuePriority.active @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young - #by huang - # @change_flag = (@issue.author == User.current) || (User.current.admin?) - #end respond_to do |format| format.html { retrieve_previous_and_next_issue_ids diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 98f6316ad..95fbed1d3 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -128,7 +128,7 @@ class ProjectsController < ApplicationController def index #Modified by nie - @project_type = params[:project_type] + @project_type = params[:project_type].to_i per_page_option = 10 @projects_all = Project.active.visible. @@ -177,30 +177,166 @@ class ProjectsController < ApplicationController def course @project_type = params[:project_type] + @school_id = params[:school_id] per_page_option = 10 - - @projects_all = Project.active.visible. - joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). - where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course) + if @school_id == "0" or @school.nil? + @projects_all = Project.active.visible. + joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). + where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course) + else + @projects_all = Project.active.visible. + joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). + joins(:course_extra). + where("#{Project.table_name}.project_type = ? AND #{Course.table_name}.school_id = ?", Project::ProjectType_course, @school_id) + end @project_count = @projects_all.count @project_pages = Paginator.new @project_count, per_page_option, params['page'] + +#gcm activity count + + @project_activity_count=Hash.new + + @projects_all.each do |project| + @project_activity_count[project.id]=0 + end + @project_ids=@project_activity_count.keys() + + days = Setting.activity_days_default.to_i + date_to ||= Date.today + 1 + date_from = date_to - days-1.years + +#approach 1 +=begin + + @projects_all.each do |project| + #issue_count + issues=Issue.where("project_id=?",project.id) + issue_count=0 + issues.each do |issue| + issue_count+=issue.journals.count + end + + #repository_count + repositories=Repository.where("project_id=?",project.id) + repository_count=0 + repositories.each do |repository| + repository_count+=repository.changesets.count + end + + #news_count + news_count=News.where("project_id=?",project.id).count + #document_count + document_count=Document.where("project_id=?",project.id).count + #file_count + file_count=Attachment.where("container_type='Project' AND container_id=?",project.id).count + + #message_count + boards=Board.where("project_id=?",project.id) + message_count=0 + boards.each do |board| + message_count+=board.messages.count + end + + #time_entry_count + time_entry_count=TimeEntry.where("project_id=?",project.id).count + + #sum + @project_activity_count[project.id.to_s]=issue_count+repository_count+news_count+document_count+file_count+message_count+time_entry_count + + end +=end +#gcm + +#gcm approach 2 + + #issue_count + Issue.where(project_id: @project_ids).where("updated_on>?",date_from).each do |issue| +# @project_activity_count[issue.project_id.to_s]+=1 + @project_activity_count[issue.project_id]+=issue.journals.where("created_on>?",date_from).count + end + + #repository_count + Repository.where(project_id: @project_ids).each do |repository| +# @project_activity_count[repository.project_id.to_s]+=1 + @project_activity_count[repository.project_id]+=repository.changesets.where("committed_on>?",date_from).count + end + + + #news_count + News.where(project_id: @project_ids).where("created_on>?",date_from).each do |news| + @project_activity_count[news.project_id]+=1 + end + + #document_count + Document.where(project_id: @project_ids).where("created_on>?",date_from).each do |document| + @project_activity_count[document.project_id]+=1 + end + + #file_count + Attachment.where(container_id: @project_ids).where("container_type='Project' AND created_on>?",date_from).each do |attachment| + @project_activity_count[attachment.container_id]+=1 + end + + #message_count + Board.where(project_id: @project_ids).each do |board| +# @project_activity_count[board.project_id]+=1 + @project_activity_count[board.project_id]+=board.messages.where("updated_on>?",date_from).count + end + + #time_entry_count + TimeEntry.where(project_id: @project_ids).where("updated_on>?",date_from).each do |timeentry| + @project_activity_count[timeentry.project_id]+=1 + end + + #feedbackc_count + JournalsForMessage.where(jour_id: @project_ids).each do |jourformess| + @project_activity_count[jourformess.jour_id]+=1 + end + + #@project_activity_count!=0 + @project_all_array=[] + i=0; + @projects_all.each do |project| + id=project.id + @project_all_array[i]=project + if @project_activity_count[id]==0 + @project_activity_count[id]=1 + end + i=i+1 + end + + @project_activity_count_array=@project_activity_count.values() + +#gcm end + case params[:project_sort_type] when '0' @projects = @projects_all.order("created_on desc") @s_type = 0 + @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) when '1' @projects = @projects_all.order("course_ac_para desc") @s_type = 1 + @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) when '2' @projects = @projects_all.order("watchers_count desc") @s_type = 2 + @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + + #gcm + when '3' + @projects=desc_sort_course_by_avtivity(@project_ids,@project_activity_count_array,@project_all_array) + @s_type = 3 + @projects = @projects[@project_pages.offset, @project_pages.per_page] + #gcmend + else @s_type = 0 @projects = @projects_all.order("created_on desc") + @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) end - @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) respond_to do |format| format.html { @@ -220,8 +356,8 @@ class ProjectsController < ApplicationController def search #modified by nie - project_type = params[:project_type] - projects_all = (project_type.eql? Project::ProjectType_project) ? Project.project_entities : Project.course_entities + project_type = params[:project_type].to_i + projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities @projects = projects_all.visible @projects = @projects.visible.like(params[:name]) if params[:name].present? @offset, @limit = api_offset_and_limit({:limit => 10}) @@ -576,7 +712,7 @@ class ProjectsController < ApplicationController "show_journals_for_messages" => true } @date_to ||= Date.today + 1 - @date_from = @date_to - @days + @date_from = @date_to - @days-1.years @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])) # 决定显示所用用户或单个用户活动 @@ -881,4 +1017,32 @@ class ProjectsController < ApplicationController @users -= watched.watcher_users end end + + def desc_sort_course_by_avtivity(ids,activity_count,projects) + return projects if activity_count.size<2 + (activity_count.size-2).downto(0) do |i| + (0..i).each do |j| + if activity_count[j]activity_count[j+1] do + # count_temp=activity_count[j] + + # activity_count[j]=activity_count[j+1] + # activity_count[j+1]=count_temp + # end + # end + # end +#desc_sort_course_by_avtivity(@project_ids,@project_activity_count_array,@projects_all) + end end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index ec9913684..9ef935cf7 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -1,4 +1,16 @@ class SchoolController < ApplicationController + + before_filter :require_admin, :only => :upload_logo + + def upload_logo + + end + + + def index + + end + def get_options @school = School.where("province = ?", params[:province]) p = params[:province] @@ -7,11 +19,33 @@ class SchoolController < ApplicationController @school.each do |s| #options << "" - options << "
  • #{s.name}
  • " + options << "
  • #{s.name}
  • " end render :text => options end + + def get_schoollist + @school = School.where("province = ?", params[:province]) + + options = "" + @school.each do |s| + options << "
  • #{s.name}
  • " + end + + render :text => options + end + + def search_school + @school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]); + + options = "" + @school.each do |s| + options << "
  • #{s.name}
  • " + end + + render :text => options + end end diff --git a/app/controllers/user_score_controller.rb b/app/controllers/user_score_controller.rb index 875229e89..0676155ad 100644 --- a/app/controllers/user_score_controller.rb +++ b/app/controllers/user_score_controller.rb @@ -1,5 +1,5 @@ class UserScoreController < ApplicationController - helper :UserScoreHelper + helper :UserScore diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ad90f8942..859b19655 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -255,26 +255,17 @@ module ApplicationHelper end classes = (ancestors.empty? ? 'root' : 'child') s << "
  • " - if params[:project_type] == "0" + if project.try(:project_type) == Project::ProjectType_project s << h(block_given? ? yield(project) : project.name) else end - # if @project.project_type == 1 - # unless Course.find_by_extra(@project.identifier).nil? - # unless Course.find_by_extra(@project.identifier).tea_id == User.current.id - # s << "" - # s << join_in_course(@project, User.current)#, ['whiteButton']) - # s << "" - # end - # end - # end - if params[:project_type] == "0" + if project.try(:project_type) == Project::ProjectType_project unless User.current.member_of?(@project) s << "" s << watcher_link(@project, User.current)#, ['whiteButton']) s << "" - end + end s << (render :partial => 'projects/project', :locals => {:project => project}).to_s else s << (render :partial => 'projects/course', :locals => {:project => project}).to_s @@ -1579,9 +1570,14 @@ module ApplicationHelper forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"} stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'} + + school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'} + + #@nav_dispaly_project_label nav_list = Array.new nav_list.push(home_link) if !@nav_dispaly_home_path_label + nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 2d2934cc2..5bd677bdf 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -69,18 +69,29 @@ module ProjectsHelper content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected") content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) when 1 content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected") # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) when 2 content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected") - + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + + #gcm + when 3 + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) + # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type), :class=>"selected"), :class=>"selected") end + #gcmend + content = content_tag('ul', content) content_tag('div', content, :class => "tabs") end @@ -164,7 +175,7 @@ module ProjectsHelper def render_project_hierarchy(projects) render_project_nested_lists(projects) do |project| #Modified by young - if (project.project_type==1) + if (project.try(:project_type) == Project::ProjectType_course ) s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}").html_safe else s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}") diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index e25b4f3f6..53869b9ed 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -56,12 +56,49 @@ module WelcomeHelper # # => 前7个项目为新课程,后面三个是参与人数最多的 # # Returns project&courses array - def find_miracle_course(sum=10, max_rate=7) - Project.active.visible.course_entities. - joins(:course_extra). - joins(:memberships). - group('members.project_id'). - reorder("courses.time DESC, COUNT(members.project_id) DESC").take sum + def find_miracle_course(sum=10, max_rate=7, school_id) + + if User.current.user_extensions.school.nil? and school_id.nil? + Project.active.visible.course_entities. + joins(:course_extra). + joins(:memberships). + group('members.project_id'). + reorder("courses.time DESC, COUNT(members.project_id) DESC").take sum +# elseif school_id.nil? + + else + if school_id.nil? + Project.active.visible.course_entities. + joins(:course_extra). + joins(:memberships). + where("#{Course.table_name}.school_id = ?", User.current.user_extensions.school.id). + group('members.project_id'). + reorder("courses.time DESC, COUNT(members.project_id) DESC").take sum + else + if school_id == "0" + Project.active.visible.course_entities. + joins(:course_extra). + joins(:memberships). + group('members.project_id'). + reorder("courses.time DESC, COUNT(members.project_id) DESC").take sum + else + Project.active.visible.course_entities. + joins(:course_extra). + joins(:memberships). + where("#{Course.table_name}.school_id = ?", school_id). + group('members.project_id'). + reorder("courses.time DESC, COUNT(members.project_id) DESC").take sum + end + end + end +# else +# Project.active.visible.course_entities. +# joins(:course_extra). +# joins(:memberships). +# where("#{Course.table_name}.school_id = ?", school_id). +# group('members.project_id'). +# reorder("courses.time DESC, COUNT(members.project_id) DESC").take sum +# end # max = sum*(max_rate.to_f/10) # c1 = find_new_course(sum).to_a.dup # c2 = find_all_hot_course(sum).to_a.dup diff --git a/app/models/mailer.rb b/app/models/mailer.rb index aee837ac4..3db787525 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -446,7 +446,9 @@ class Mailer < ActionMailer::Base def self.deliver_mail(mail) return false if mail.to.blank? && mail.cc.blank? && mail.bcc.blank? - super + Thread.new do + super + end end def self.method_missing(method, *args, &block) diff --git a/app/views/contests/settings.html.erb b/app/views/contests/settings.html.erb index 8e25bb6a0..a2780f060 100644 --- a/app/views/contests/settings.html.erb +++ b/app/views/contests/settings.html.erb @@ -2,13 +2,6 @@

    <%=l(:label_contest_settings)%>    - <% if User.current.logged? %> - <% if @contest.author.id == User.current.id %> - - <%= link_to '删除竞赛', {:controller => 'contests', :action => 'destroy_contest', :id => @contest}, data: { confirm: '你确定要删除该竞赛吗?' } %> - - <% end %> - <% end %>

    diff --git a/app/views/projects/_course.html.erb b/app/views/projects/_course.html.erb index f55a80db3..33d222145 100644 --- a/app/views/projects/_course.html.erb +++ b/app/views/projects/_course.html.erb @@ -16,7 +16,10 @@ <%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%> <% @admin = @project.project_infos%> <%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%> - <%= @admin.first.user.user_extensions.occupation %> + + <% unless @project.course_extra.school.nil? %> + <%= @project.course_extra.school.name %> + <% end %> <% end %>

    @@ -45,6 +48,15 @@ <%= content_tag('span', link_to("#{@project.members.count}", member_project_path(@project)), :class => "info") %> <%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>

    + + +

    + + <%= content_tag('span', link_to("#{@project_activity_count[@project.id]}", member_project_path(@project)), :class => "info") %> + <%= content_tag('span', l(:label_x_activity, :count => @project_activity_count[@project.id])) %> +

    + +
    <% if @project.project_type==Project::ProjectType_course %> diff --git a/app/views/projects/course.html.erb b/app/views/projects/course.html.erb index d7a84f534..1359b8bea 100644 --- a/app/views/projects/course.html.erb +++ b/app/views/projects/course.html.erb @@ -3,7 +3,7 @@ <% end %>
    - <%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %> + <%= form_tag(projects_search_path, :method => :get) do %> diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 4bc094f7e..c4b2bdc9e 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -3,7 +3,7 @@ <% end %>
    - <%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %> + <%= form_tag(projects_search_path, :method => :get) do %>
    <%= l(:label_course_practice) %>
    diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb index 79d21dcb0..b1bd3d41e 100644 --- a/app/views/projects/search.html.erb +++ b/app/views/projects/search.html.erb @@ -2,7 +2,7 @@ <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> <% end %>
    - <%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %> + <%= form_tag(projects_search_path, :method => :get) do %> <% if params[:project_type] == "1" %>
    <%= l(:label_project_deposit) %>
    diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb new file mode 100644 index 000000000..c9fca54aa --- /dev/null +++ b/app/views/school/index.html.erb @@ -0,0 +1,66 @@ +<% port = ":3000" if Rails.env.development? %> + + + + + +
    +

    + 全部学校      + 我的学校 +

    +
      +
    • 请选择省份:<%= select_tag "province", + options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), + :onclick => "get_school(this.value)" %>
    • +
    • +
    • +
    + +
    +
    +
      + +
    +
    + diff --git a/app/views/school/upload_logo.html.erb b/app/views/school/upload_logo.html.erb new file mode 100644 index 000000000..ecad26f59 --- /dev/null +++ b/app/views/school/upload_logo.html.erb @@ -0,0 +1 @@ + diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index 896b6a2c8..1cec18b37 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -23,7 +23,7 @@ <%= form_for "tag_for_save",:remote=>true,:url=>tag_path, :update => "tags_show", :complete => '$("#put-tag-form-issue").hide();' do |f| %> - <%= f.text_field :name ,:id => "name-issue",:size=>"30",:require=>true,:maxlength => 25,:minlength=>1 %> + <%= f.text_field :name ,:id => "name-issue",:size=>"30",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>1 %> <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%> <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%> <%= f.submit l(:button_project_tags_add),:class => "small"%> diff --git a/app/views/users/tag_save.js.erb b/app/views/users/tag_save.js.erb index 7e1a5938d..c406f32df 100644 --- a/app/views/users/tag_save.js.erb +++ b/app/views/users/tag_save.js.erb @@ -2,7 +2,7 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); -$('#put-tag-form-issue').hide(); +//$('#put-tag-form-issue').hide(); $('#name-issue').val(""); <% elsif @obj_flag == '6'%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); @@ -15,6 +15,6 @@ $('#name-issue').val(""); $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); $('#put-tag-form #name').val(""); -$('#put-tag-form').hide(); +//$('#put-tag-form').hide(); <% end %> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index d8dc45873..6c89489c6 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -98,7 +98,11 @@
    +
    + <%= image_tag '/images/transparent.png', size: "75x75" %> +
    + <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_contest) %> , <%= l(:label_welcome_trustie_contest_description) %>
    diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 1f498fb5d..f757e83bb 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -1,223 +1,270 @@ -<%= stylesheet_link_tag 'welcome' %> - - - - -
    - -
    -
    - <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> , <%= l(:label_welcome_trustie_course_description) %> -
    - -
    -
    -
    - -
    - - -
    -

    新开课程

    - <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1} %> -
    -
      - <% find_miracle_course(10, 7).map do |project| %> -
    • > -
      - <%= image_tag(get_course_avatar(project), :class => "avatar-4") %> -
      - -
      - [<%= get_course_term project %>] - <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> - (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) - <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> - (<%=link_to "#{files_count}份", project_files_path(project) %>资料) -
      -
      - - <% course = Course.find_by_extra(project.identifier) %> - <%= course.teacher.user_extensions.occupation.try(:gsub, /(.+)$/, '\1:') %> - - - <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %> - <%#=course.try(:teacher).try(:name)%> - -
      - - -
    • - <% end; reset_cycle %> -
    -
    -
    - -
    - - - - - - - - - - - - - - -
    课程总量: <%#=@course.count%>教师数量: <%#=@teacher.count%>
    用户总量: <%#=User.count%>学生数量: <%#=@student.count%>
    资源总量: <%#=Attachment.count%> 
    - -
    -
    -
    -

    - 问题和反馈动态 - <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> - <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> -

    - <%= link_to "更多>>", forums_path %> -
    -
      - <% find_new_forum_topics(10).each do |topic|%> -
    • -
      -       - <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> - -
      - <%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前 - - 由 <%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %> 发表 - - 回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>) -
      -
    • - <% end %> -
    -
    -
    -
    - -
    -
    - - - - - - - -
    当前网站状态活跃课程: <%=@courseCount%>高校: 2个教师: <%=@teacherCount%> 名学生: <%=@studentCount%> 名 -
    -
    +<%= stylesheet_link_tag 'welcome' %> + + + + +
    + +
    +
    + + + <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> + <%= image_tag '/images/transparent.png', size: "75x75" %> + <% else%> + <% if params[:school_id] == "0" %> + <%= image_tag '/images/transparent.png', size: "75x75" %> + <% else %> + <% if params[:school_id].nil? %> + <% if School.find(User.current.user_extensions.school.id).logo_link.nil? %> + <%= image_tag '/images/transparent.png', size: "75x75" %> + <% else %> + <%= image_tag(School.find(User.current.user_extensions.school.id).logo_link, size: "75x75") %> + <% end %> +
    + <% else %> + <%= image_tag(School.find(params[:school_id]).logo_link, size: "75x75") %> +
    + <% end %> + <% end %> + <% end %> +
    +
    + + + <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> + <% else%> + <% if params[:school_id] == "0" %> + <% else %> + <% if params[:school_id].nil? %> + + <%= School.find(User.current.user_extensions.school.id).name %> +
    + <% else %> + <%= School.find(params[:school_id]).name %> +
    + <% end %> + <% end %> + <% end %> +
    + <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> + <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> + , <%= l(:label_welcome_trustie_course_description) %> + <% else %> + <% if params[:school_id] == "0" %> + , <%= l(:label_welcome_trustie_course_description) %> + <% end %> + <% end %> +
    + +
    +
    +
    + +
    + + +
    +

    新开课程

    + <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %> +
    +
      + <% find_miracle_course(10, 7,params[:school_id]).map do |project| %> +
    • > +
      + <%= image_tag(get_course_avatar(project), :class => "avatar-4") %> +
      + +
      + [<%= get_course_term project %>] + <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> + (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) + <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> + (<%=link_to "#{files_count}份", project_files_path(project) %>资料) +
      +
      + + <% course = Course.find_by_extra(project.identifier) %> + <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %> + + + <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %> + <%#=course.try(:teacher).try(:name)%> + +
      + + +
    • + <% end; reset_cycle %> +
    +
    +
    + + +
    +

    + 问题和反馈动态 + <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> + <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> +

    + <%= link_to "更多>>", forums_path %> +
    +
      + <% find_new_forum_topics(10).each do |topic|%> +
    • +
      +       + <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> + +
      + <%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前 + + 由 <%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %> 发表 + + 回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>) +
      +
    • + <% end %> +
    +
    +
    +
    + +
    +
    + + + + + + + +
    当前网站状态活跃课程: <%=@courseCount%>高校: 2个教师: <%=@teacherCount%> 名学生: <%=@studentCount%> 名 +
    +
    \ No newline at end of file diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index c1b5bba9f..1ffb23856 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -97,8 +97,11 @@
    微信扫码
    +
    + <%= image_tag '/images/transparent.png', size: "75x75" %> +
    - <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_project) %> , <%= l(:label_welcome_trustie_project_description) %> + <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_project) %> , <%= l(:label_welcome_trustie_project_description) %>