From 20cd5941a8cd06a760c984340107c410d6a2f3af Mon Sep 17 00:00:00 2001 From: xianbo Date: Fri, 21 Mar 2014 15:17:14 +0800 Subject: [PATCH] modify project main page --- app/helpers/application_helper.rb | 12 +- app/views/layouts/base.html.erb | 4 + app/views/projects/index.html.erb | 1 - app/views/welcome/_search_project.html.erb | 7 + app/views/welcome/index.html.erb | 147 +++++++++------------ lib/redmine.rb | 4 +- 6 files changed, 78 insertions(+), 97 deletions(-) create mode 100644 app/views/welcome/_search_project.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fc3d6cd61..ab45d8e9a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1500,16 +1500,16 @@ module ApplicationHelper end def render_dynamic_nav - home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index',:host => Setting.forge_domain} + home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index'} course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1} course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher'} - courses_link = link_to l(:label_course_practice), {:controller => 'projects', :action => 'course', :project_type => 1, :host=>Setting.course_domain} - projects_link = link_to l(:label_project_deposit), {:controller => 'projects', :action => 'index', :project_type => 0, :host => Setting.project_domain} + courses_link = link_to l(:label_course_practice), {:controller => 'projects', :action => 'course', :project_type => 1} + projects_link = link_to l(:label_project_deposit), {:controller => 'projects', :action => 'index', :project_type => 0} users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index'} - contest_link = link_to l(:label_contest_innovate), {:controller => 'bids', :action => 'contest', :project_type => 1, :host=>Setting.contest_domain} + contest_link = link_to l(:label_contest_innovate), {:controller => 'bids', :action => 'contest', :project_type => 1 } bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'} - forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index", :host => Setting.forge_domain} - stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index', :host => Setting.forge_domain} + 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'} #@nav_dispaly_project_label nav_list = Array.new diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index e475bbd5f..421e76050 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -21,6 +21,10 @@ @nav_dispaly_course_all_label = 1 @nav_dispaly_teacher_all_label = 1 @nav_dispaly_forum_label = 1 + elsif (realUrl.match(/forge\.trustie\.net/)) + @nav_dispaly_project_label = 1 + @nav_dispaly_user_label = 1 + @nav_dispaly_forum_label = 1 else @nav_dispaly_course_label = 1 @nav_dispaly_project_label = 1 diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 9d2aaccdd..db37af91b 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -25,7 +25,6 @@ <%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %> - <% end %> <%= sort_project(@s_type, @project_type) %> diff --git a/app/views/welcome/_search_project.html.erb b/app/views/welcome/_search_project.html.erb new file mode 100644 index 000000000..a082a6dcf --- /dev/null +++ b/app/views/welcome/_search_project.html.erb @@ -0,0 +1,7 @@ +<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %> + +<% end %> \ No newline at end of file diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index b3d057c54..fd539b12f 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -94,8 +94,8 @@
<%= l(:label_welcome_trustie) %> , <%= l(:label_welcome_trustie_description) %>
- @@ -107,7 +107,58 @@ <%= stylesheet_link_tag 'welcome' %> -
+ +
+

热门项目

+ <%= link_to "更多>>", { :controller => 'projects', :action => 'index', :project_type => 0, :host => Setting.project_domain}, :target => "_blank" %> +
+
    + <% find_all_hot_project.map do |project| break if(project == find_all_hot_project[10]) %> +
  • +
    + <%= image_tag url_to_avatar(project), :class => "avatar-4" %> +
    +
    +

    + <%= link_to( project.name, :controller => 'projects', :action => 'show', :host=> Setting.project_domain, :id => project.id, :class => "d-g-blue d-p-project-name", :title => "#{project.name}", :target => "_blank" )%> + <%= content_tag "span", show_grade(project), + :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ", + :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", + :class => "tooltip", + :id => "tooltip-#{project.id}" %> +

    +

    + <%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %> +

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

    用户动态

    + <%= link_to "更多>>", { :controller => 'users', :action => 'index'}, :target => "_blank" %> +
    + <% find_all_activities.each do |event| %> +
  • +
    + <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %> +
    + +
    + <%= link_to event.event_author, (user_path(event.event_author) if event.event_author), :style => "color:green;", :target => "_blank" %><%= show_user_content event %> +

    <%= l(:field_updated_on) %><%= time_tag_welcome event.event_datetime %>前     <%= show_event_reply event %>

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

    贴吧动态

    @@ -133,88 +184,8 @@
-
-
    -

    用户动态

    - <%= link_to "更多>>", { :controller => 'users', :action => 'index'}, :target => "_blank" %> -
    - <% find_all_activities.each do |event| %> -
  • -
    - <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %> -
    - -
    - <%= link_to event.event_author, (user_path(event.event_author) if event.event_author), :style => "color:green;", :target => "_blank" %><%= show_user_content event %> -

    <%= l(:field_updated_on) %><%= time_tag_welcome event.event_datetime %>前     <%= show_event_reply event %>

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

热门项目

- <%= link_to "更多>>", { :controller => 'projects', :action => 'index', :project_type => 0, :host => Setting.project_domain}, :target => "_blank" %> -
-
    - <% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %> -
  • -
    - <%= image_tag url_to_avatar(project), :class => "avatar-4" %> -
    -
    -

    - <%= link_to( project.name, :controller => 'projects', :action => 'show', :host=> Setting.project_domain, :id => project.id, :class => "d-g-blue d-p-project-name", :title => "#{project.name}", :target => "_blank" )%> - <%= content_tag "span", show_grade(project), - :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ", - :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", - :class => "tooltip", - :id => "tooltip-#{project.id}" %> -

    -

    - <%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %> -

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

热门课程

- <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :project_sort_type => 1, :host => Setting.course_domain}, :target => "_blank" %> -
-
    - <% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %> -
  • -
    - <% if get_avatar?(project)%> - <%= image_tag(url_to_avatar(project), :class => "avatar-4") %> - <% else %> - <%= image_tag('../images/avatars/Project/course.jpg', :class => "avatar-4") %> - <% end %> -
    -
    -

    - <%= link_to( project.name, :controller => 'projects', :action => 'show', :id => project.id, :host => Setting.course_domain, :class => "d-g-blue d-p-project-name",:title => "#{project.name}", :target => "_blank" )%> - 学生人数:<%= link_to "#{studentCount(project)}", project_member_path(project, :role => 2) ,:course =>'1', :target => "_blank" %> -

    -

    - <%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %> -

    -
    -
  • - <% end %> -
-
-
- - -
+ + -
+ diff --git a/lib/redmine.rb b/lib/redmine.rb index 1d1df605d..e5fb39446 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -265,9 +265,9 @@ end Redmine::MenuManager.map :account_menu do |menu| menu.push :login, {:controller => 'account', :action => 'login', :host => Setting.forge_domain}, :if => Proc.new { !User.current.logged? } - menu.push :register, {:controller => 'account', :action => 'register', :host => Setting.forge_domain}, :if => Proc.new { !User.current.logged? && Setting.self_registration? } + menu.push :register, {:controller => 'account', :action => 'register'}, :if => Proc.new { !User.current.logged? && Setting.self_registration? } # menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } - menu.push :logout, {:controller => 'account', :action => 'logout', :host => Setting.forge_domain}, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? } + menu.push :logout, {:controller => 'account', :action => 'logout'}, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? } end ########fq Redmine::MenuManager.map :bid_menu do |menu|