增加组织的index界面,以及index界面到组织首页的跳转

This commit is contained in:
sw 2015-03-05 14:15:07 +08:00
parent dead08a0d6
commit 3b4bf8b99d
5 changed files with 45 additions and 33 deletions

View File

@ -0,0 +1,10 @@
class OrganizationController < ApplicationController
layout 'project_base'
def index
#@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)")
@organizations = Organization.all
respond_to do |format|
format.html
end
end
end

View File

@ -1,6 +0,0 @@
class OrganizationsController < ApplicationController
layout 'project_base'
def index
@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)")
end
end

View File

@ -0,0 +1,31 @@
<title>
<%= l(:label_all_enterprises) %>
</title>
<div class="content_syqy">
<div class="list">
<%= l(:label_all_enterprises) %>
</div>
<div class="syqy_box">
<% if @organizations.empty? %>
<h3>
<%= l(:label_enterprise_nil) %>
</h3>
<% else %>
<% @organizations.each do |organization| %>
<% unless organization.name.blank? %>
<ul>
<li >
<img src="/images/organization_logo.jpg" width="30" height="30" alt="#{project.enterprise_name}" />
<%= link_to organization.name, home_path(:organization => organization.id) %>
</li>
</ul>
<% end %>
<% end %>
<% end %>
</div>
</div>
<div style="clear: both"></div>
<div class="school-index">
<ul id="schoollist" style="line-height: 25px"></ul>
</div>
<% html_title(l(:label_enterprise_all)) -%>

View File

@ -1,23 +0,0 @@
<title><%= l(:label_all_enterprises) %></title>
<div class="content_syqy">
<div class="list"><%= l(:label_all_enterprises) %></div>
<div class="syqy_box">
<% if @projects.count == 0 %>
<h3><%= l(:label_enterprise_nil) %></h3>
<% else %>
<% @projects.each do |organization| %>
<% unless organization.enterprise_name.blank? %>
<ul>
<li ><img src="/images/organization_logo.jpg" width="30" height="30" alt="#{project.enterprise_name}" />
<%= link_to organization.enterprise_name, home_path(:organization => organization) %></li>
</ul>
<% end %>
<% end %>
<% end %>
</div>
</div>
<div style="clear: both"></div>
<div class="school-index">
<ul id="schoollist" style="line-height: 25px"></ul>
</div>
<% html_title(l(:label_enterprise_all)) -%>

View File

@ -26,9 +26,6 @@
# Example: :via => :get ====> :via => :get
RedmineApp::Application.routes.draw do
get "organizations/index"
#match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
mount Mobile::API => '/api'
@ -39,6 +36,10 @@ RedmineApp::Application.routes.draw do
resources :apply_project_masters
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
resources :organization, :only => [:index] do
end
resources :homework_attach do
collection do
get 'get_homework_member_list'
@ -390,7 +391,6 @@ RedmineApp::Application.routes.draw do
match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get
# match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get
match '/homework', :to => 'projects#homework', :as => 'homework', :via => :get
match 'organizations', :to => 'organizations#index', :as => 'index', :via => :get
# match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get
# match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get