From 5d77f2031e7f984ad37225da2cc7f5af2771a35b Mon Sep 17 00:00:00 2001 From: yanxd Date: Thu, 28 Nov 2013 16:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=8E=BB=E9=99=A4=E5=BD=B1?= =?UTF-8?q?=E5=93=8D=E6=80=A7=E8=83=BD=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 10 +- app/helpers/welcome_helper.rb | 58 +++---- app/views/forums/index.html.erb | 4 +- app/views/welcome/index.html.erb | 209 ++++++++------------------ lib/redmine.rb | 2 +- 5 files changed, 98 insertions(+), 185 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index c00f223c9..6d3574309 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -19,8 +19,8 @@ class WelcomeController < ApplicationController caches_action :robots def index - @news = News.latest User.current - @projects = Project.latest User.current + # @news = News.latest User.current + # @projects = Project.latest User.current #by young (redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration] if request.get? @@ -60,10 +60,10 @@ class WelcomeController < ApplicationController end #add by huang - @memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current)) + # @memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current)) - events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) - @events_by_day = events.group_by(&:event_date) + # events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) + # @events_by_day = events.group_by(&:event_date) # end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 55f18459e..03900753b 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -19,18 +19,18 @@ module WelcomeHelper - def newbieTopiclist - find_all_topic_by_board_id - end + # def newbieTopiclist + # find_all_topic_by_board_id + # end - def newbieTopicStickyList - find_all_topic_by_board_id 1 - end + # def newbieTopicStickyList + # find_all_topic_by_board_id 1 + # end - def find_project_by_topic topic - board = find_board_by_topic(topic) - find_project_by_board board - end + # def find_project_by_topic topic + # board = find_board_by_topic(topic) + # find_project_by_board board + # end def find_all_hot_project sort_project_by_hot @@ -48,30 +48,30 @@ module WelcomeHelper sort_contest_by_hot end def time_tag_welcome(time) - text = distance_of_time_in_words(Time.now, time) - content_tag('span', text, :title => format_time(time)) - end + text = distance_of_time_in_words(Time.now, time) + content_tag('span', text, :title => format_time(time)) + end private - def search_project - Project.find_by_identifier "newbie_faq" - end + # def search_project + # Project.find_by_identifier "newbie_faq" + # end - def find_all_topic_by_board_id sticky = 0, limit = 30 - project = search_project - return [] if(project.nil? or project.boards.nil?) - board_id = project.boards.first.id - logger.debug "[WelcomeHelper] ===> find_all_topic_by_board_id=> project.id:#{project.id}, board_id:#{board_id}, sticky:#{sticky}" - Message.where("board_id = :board_id and sticky=:sticky", :board_id => board_id, :sticky => sticky ).limit(limit) - end + # def find_all_topic_by_board_id sticky = 0, limit = 30 + # project = search_project + # return [] if(project.nil? or project.boards.nil?) + # board_id = project.boards.first.id + # logger.debug "[WelcomeHelper] ===> find_all_topic_by_board_id=> project.id:#{project.id}, board_id:#{board_id}, sticky:#{sticky}" + # Message.where("board_id = :board_id and sticky=:sticky", :board_id => board_id, :sticky => sticky ).limit(limit) + # end - def find_board_by_topic topic - Board.find_by_id(topic.board_id) - end - def find_project_by_board board - Project.find_by_id(board.project_id) - end + # def find_board_by_topic topic + # Board.find_by_id(topic.board_id) + # end + # def find_project_by_board board + # Project.find_by_id(board.project_id) + # end def sort_project_by_hot sort_project_by_hot_rails 0, 'grade DESC' diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index b38ecb358..f79c44ae9 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -32,7 +32,7 @@ -<% @forums.each do |forum| %> +< % @forums.each do |forum| %> < %= forum.name %> < %= forum.description %> @@ -41,7 +41,7 @@ < %= link_to 'Edit', edit_forum_path(forum) %> < %= link_to 'Destroy', forum, method: :delete, data: { confirm: 'Are you sure?' } %> -<% end %> +< % end %>
--> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index a4320c656..698e5c7b7 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -135,125 +135,77 @@
-

热门项目

- -
-
    - <% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %> -
  • -

    - <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{project.name}")%> -

    -

    - <%= project.description.truncate(50, omission: '...') %> -

    - -
  • - <% end %> -
-
+ <% end %> + +
-

热门竞赛

- -
-
    - <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %> -
  • -

    - <%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{contest.name}")%> -

    -

    - <%= contest.description.truncate(50, omission: '...') %> -

    - -
  • - <% end %> -
-
+

热门竞赛

+
+
    + <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %> +
  • +

    + <%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{contest.name}")%> +

    +

    + <%= contest.description.truncate(50, omission: '...') %> +

    +
  • + <% end %> +
+
-

热门众包

- -
-
    - <% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %> -
  • -

    - <%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{bid.name}")%> -

    -

    - <%= bid.description.truncate(50, omission: '...') %> -

    -
  • - <% end %> -
-
+

热门众包

+ +
+
    + <% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %> +
  • +

    + <%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{bid.name}")%> +

    +

    + <%= bid.description.truncate(50, omission: '...') %> +

    +
  • + <% end %> +
+
-

热门课程

- -
-
    - <% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %> -
  • -

    - <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{project.name}")%> -

    -

    - <%= project.description.truncate(50, omission: '...') %> -

    -
  • - <% end %> -
-
+

热门课程

+
+
    + <% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %> +
  • +

    + <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{project.name}")%> +

    +

    + <%= project.description.truncate(50, omission: '...') %> +

    +
  • + <% end %> +
+
@@ -264,43 +216,4 @@ - - - - diff --git a/lib/redmine.rb b/lib/redmine.rb index 661cbaaf1..6f0a36757 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -203,7 +203,7 @@ Redmine::MenuManager.map :top_menu do |menu| menu.push :software_user, {:controller => 'users', :action => 'index'} menu.push :contest_innovate, {:controller => 'bids', :action => 'contest', :project_type => 1} menu.push :requirement_enterprise, {:controller => 'bids', :action => 'index'} - menu.push :project_module_forums, forums_path + menu.push :project_module_forums, :forums_path # menu.push :investor, :home_path