企业版模块

email_verify
huang 11 years ago
parent f7dbb24d35
commit d0a675f2b8

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

@ -0,0 +1,3 @@
// Place all the styles related to the Enterprises controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

@ -0,0 +1,6 @@
class EnterprisesController < ApplicationController
layout 'project_base'
def index
@enterprises = Project.find_by_sql("select enterprise_name from projects")
end
end

@ -25,6 +25,17 @@ class WelcomeController < ApplicationController
before_filter :entry_select, :only => [:index]
def index
unless params[:enterprise].nil?
@enterprise = params[:enterprise]
@enterprise_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @enterprise])
@e_count = @enterprise_projects.count
if @e_count < 10
part_count = 10 -@e_count
# @part_projects = find_all_hot_project part_count, order
@part_projects = find_miracle_project(part_count, 3,"score desc")
limit = 10 - @e_count
end
end
if @first_page.nil? || @first_page.sort_type.nil?
@projects = find_miracle_project(10, 3,"score desc")
else

@ -0,0 +1,2 @@
module EnterprisesHelper
end

@ -367,7 +367,7 @@ module ProjectsHelper
return true
end
end
def find_project_repository project
unless project.repositories.nil?
project.repositories.each do |repository|
@ -375,4 +375,8 @@ module ProjectsHelper
end
end
end
def get_part_projects e_count, t_count
end
end

@ -6,7 +6,7 @@ class Course < ActiveRecord::Base
STATUS_CLOSED = 5
STATUS_ARCHIVED = 9
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表

@ -116,6 +116,7 @@ class Project < ActiveRecord::Base
validates_associated :repository, :wiki
# validates_length_of :description, :maximum => 255
validates_length_of :name, :maximum => 255
validates_length_of :enterprise_name, :maximum => 255
validates_length_of :homepage, :maximum => 255
validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
# donwcase letters, digits, dashes but not digits only
@ -760,7 +761,8 @@ class Project < ActiveRecord::Base
'issue_custom_field_ids',
'project_type',
'dts_test',
'attachmenttype'
'attachmenttype',
'enterprise_name'

@ -0,0 +1,25 @@
<div class="enterprise_all">
<p>
<%= link_to l(:label_all_enterprises) %>
<p>
<p>
<% if @enterprises.count == 0 %>
<h3><%= l(:label_enterprise_nil) %></h3>
<% else %>
<% @enterprises.each do |enterprise| %>
<% unless enterprise.enterprise_name.blank? %>
<ul>
<li>
<%= link_to enterprise.enterprise_name, home_path(:enterprise => enterprise.enterprise_name) %>
</li>
</ul>
<% end %>
<% end %>
<% end %>
</p>
</div>
<div style="clear: both"></div>
<div class="school-index">
<ul id="schoollist" style="line-height: 25px"></ul>
</div>
<% html_title(l(:label_school_all)) -%>

@ -8,7 +8,7 @@
<p style="padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</p><!--by young-->
<p><%= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %></p>
<p style="display: none" ><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
<% unless @project.identifier_frozen? %>

@ -0,0 +1,23 @@
<li style="overflow:hidden;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
<div style="float: left;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div style="float: left; margin-left: 10px; width: 380px;">
<% unless project.is_public %>
<span class="private_project"> <%= l(:label_private) %> </span>
<% end %>
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
</div>
<div style=" float: left;margin:5px; margin-left: 10px; width: 380px;min-height: 42px;">
<span class='font_lighter' title ='<%= project.short_description%>'> <%=project.description.truncate(90, omission: '...')%> </span>
</div>
<div >
<%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s,
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip",
:id => "tooltip-#{project.id}" %>
</div>
</li>

@ -1,5 +1,5 @@
<h1></h1>
<p id="errorExplanation">
<%= course_title%>
<%= course_title %>
</p>
<h1></h1>

File diff suppressed because it is too large Load Diff

@ -275,6 +275,7 @@ zh:
label_course_closed_tips: "确定要%{desc}课程?"
# end
field_name: 名称
field_enterprise_name: 企业名
#added by huang
field_tea_name: 教师
field_couurse_time: 学时
@ -2313,3 +2314,12 @@ zh:
label_technical_support: 技术支持:
label_feedback: 意见反馈
# 项目企业模块
label_all_enterprises: 所有企业
label_my_enterprise: 我的企业
label_enterprise_tips: 暂时还没有该企业对应的项目,系统的其它项目您可能会感兴趣!
label_part_enterprise_tips: 系统的其它项目您可能也会感兴趣!
label_enterprise_nil: 改模块为最新上线模块,目前还未有项目关联到企业!
label_enterprises: 名企

@ -26,6 +26,8 @@
# Example: :via => :get ====> :via => :get
RedmineApp::Application.routes.draw do
get "enterprises/index"
#match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
mount Mobile::API => '/api'
@ -388,7 +390,8 @@ 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 'enterprise', :to => 'enterprises#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
# match '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get

@ -0,0 +1,5 @@
class AddEnterpriseNameToProjects < ActiveRecord::Migration
def change
add_column :projects, :enterprise_name, :string
end
end

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150123020615) do
ActiveRecord::Schema.define(:version => 20150128032421) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -925,6 +925,7 @@ ActiveRecord::Schema.define(:version => 20150123020615) do
t.integer "attachmenttype", :default => 1
t.integer "user_id"
t.integer "dts_test", :default => 0
t.string "enterprise_name"
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -1069,6 +1070,14 @@ ActiveRecord::Schema.define(:version => 20150123020615) do
t.string "description"
end
create_table "social_groups", :force => true do |t|
t.string "name"
t.text "description"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@ -1284,6 +1293,36 @@ ActiveRecord::Schema.define(:version => 20150123020615) do
add_index "versions", ["project_id"], :name => "versions_project_id"
add_index "versions", ["sharing"], :name => "index_versions_on_sharing"
create_table "voting_choices", :force => true do |t|
t.integer "poll_id", :null => false
t.string "text", :null => false
t.datetime "created_on", :null => false
t.integer "position", :default => 1
end
add_index "voting_choices", ["poll_id"], :name => "choices_poll_id"
create_table "voting_polls", :force => true do |t|
t.integer "project_id", :null => false
t.string "question", :null => false
t.datetime "created_on", :null => false
t.boolean "revote"
end
add_index "voting_polls", ["project_id"], :name => "polls_project_id"
create_table "voting_votes", :force => true do |t|
t.integer "user_id", :null => false
t.integer "poll_id", :null => false
t.integer "choice_id", :null => false
t.datetime "created_on", :null => false
end
add_index "voting_votes", ["choice_id"], :name => "votes_choice_id"
add_index "voting_votes", ["poll_id"], :name => "votes_poll_id"
add_index "voting_votes", ["user_id", "poll_id"], :name => "votes_user_poll_unique", :unique => true
add_index "voting_votes", ["user_id"], :name => "votes_user_id"
create_table "watchers", :force => true do |t|
t.string "watchable_type", :default => "", :null => false
t.integer "watchable_id", :default => 0, :null => false

@ -9,6 +9,9 @@ h4, .wiki h3 {font-size: 13px;}
h4 {border-bottom: 1px dotted #bbb;}
/*huang*/
/*current position*/
.enterprise_all{
padding-left: 20px;
}
.course_ad{
position:absolute;
visibility:visible;

@ -0,0 +1,12 @@
require 'spec_helper'
describe EnterprisesController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end
end
Loading…
Cancel
Save