Merge branch 'szzh' into dev_zanle

dev_repository_hjq
sw 11 years ago
commit a6b3ddcfcb

@ -322,4 +322,11 @@ class AdminController < ApplicationController
end
end
#组织
def organization
@organizations = Organization.all
respond_to do |format|
format.html
end
end
end

@ -0,0 +1,55 @@
class OrganizationController < ApplicationController
layout 'project_base'
before_filter :require_admin, :except => [:index]
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
def new
@organizations = Organization.new
respond_to do |format|
format.html
end
end
def create
@organizations = Organization.new
@organizations.name = params[:organization][:name]
if @organizations.save
redirect_to admin_organization_url
end
end
def edit
@organization = Organization.find params[:id]
respond_to do |format|
format.html
end
rescue Exception => e
render_404
end
def update
@organization = Organization.find params[:id]
@organization.name = params[:organization][:name]
if @organization.save
redirect_to admin_organization_url
end
rescue Exception => e
render_404
end
def destroy
@organization = Organization.find params[:id]
if @organization.destroy
redirect_to admin_organization_url
end
rescue Exception => e
render_404
end
end

@ -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

@ -179,6 +179,7 @@ class ProjectsController < ApplicationController
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
@project.organization_id = params[:organization_id]
if validate_parent_id && @project.save
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
# Add current user as a project member if he is not admin
@ -412,6 +413,7 @@ class ProjectsController < ApplicationController
def update
@project.safe_attributes = params[:project]
@project.organization_id = params[:organization_id]
#@project.dts_test = params[:project][:dts_test]
if validate_parent_id && @project.save
@course = Course.find_by_extra(@project.identifier)

@ -27,28 +27,31 @@ class WelcomeController < ApplicationController
def index
# 企业版定制: params[:project]为传过来的参数
unless params[:organization].nil?
@cur_projects = Project.find(params[:organization])
@organization = @cur_projects.enterprise_name
@organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization)
@e_count = @organization_projects.count
@part_projects = []
# 取十个
@organization_projects.each do |obj|
break if(@organization_projects[10] == obj)
@part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil?
end
# 不够十个的用最火项目替代
@e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects
# 配置文件首页定制
@organization = Organization.find params[:organization]
@organization_projects = Project.visible.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all
@part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : []
# @cur_projects = Project.find(params[:organization])
# @organization = @cur_projects.enterprise_name
# @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization)
# @e_count = @organization_projects.count
# @part_projects = []
# # 取十个
# @organization_projects.each do |obj|
# break if(@organization_projects[10] == obj)
# @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil?
# end
# # 不够十个的用最火项目替代
# @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects
# # 配置文件首页定制
@enterprise_page = FirstPage.find_by_page_type('enterprise')
if @enterprise_page.nil?
@enterprise_page = FirstPage.new
@enterprise_page.page_type = 'enterprise'
end
# 主页配置部分结束
end
# end 企业版定制结束
if @first_page.nil? || @first_page.sort_type.nil?
@projects = find_miracle_project(10, 3,"score desc")
else
@ -74,7 +77,8 @@ class WelcomeController < ApplicationController
@projects = @projects_all.order("score desc")
end
end
rescue Exception => e
render_404
end
def robots

@ -1841,7 +1841,7 @@ module ApplicationHelper
# course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
# courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'}
users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain}
#users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain}
# contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"}
@ -1860,7 +1860,7 @@ module ApplicationHelper
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
# nav_list.push(projects_link) if @nav_dispaly_project_label
nav_list.push(users_link) if @nav_dispaly_user_label
#nav_list.push(users_link) if @nav_dispaly_user_label
# nav_list.push(contest_link) if @nav_dispaly_contest_label && @show_contest == 1
nav_list.push(bids_link) if @nav_dispaly_bid_label
nav_list.push(forum_link) if @nav_dispaly_forum_label

@ -371,4 +371,19 @@ module ProjectsHelper
return projects
end
def project_organizations_id_option
type = []
option1 = []
option1 << l(:label_organization_choose)
option1 << 0
type << option1
Organization.all.each do |org|
option = []
option << org.name
option << org.id
type << option
end
type
end
end

@ -0,0 +1,5 @@
class Organization < ActiveRecord::Base
attr_accessible :logo_link, :name
has_many :projects
end

@ -91,6 +91,8 @@ class Project < ActiveRecord::Base
has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags'
belongs_to :organization
# has_many :journals
acts_as_nested_set :order => 'name', :dependent => :destroy

@ -0,0 +1,43 @@
<div class="contextual">
<%= link_to l(:label_organization_new), new_organization_path, :class => 'icon icon-add' %>
</div>
<h3>
<%=l(:label_organization_list)%>
</h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th>
<%=l(:label_organization)%>
</th>
<th>
<%=l(:field_created_on)%>
</th>
<th></th>
</tr>
</thead>
<tbody>
<% @organizations.each do |org|%>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align:center;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=org.name%>'>
<span>
<%= link_to org.name,home_path(:organization => org.id) %>
</span>
</td>
<td align="center">
<%= format_date(org.created_at) %>
</td>
<td class="buttons">
<%= link_to(l(:button_change), edit_organization_path(org.id), :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), organization_path(org.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
</td>
</tr>
<% end%>
</tbody>
</table>
</div>
<% html_title(l(:label_project_plural)) -%>

@ -2,16 +2,25 @@
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
</div>
<h3><%=l(:label_project_plural)%></h3>
<h3>
<%=l(:label_project_plural)%>
</h3>
<%= form_tag({}, :method => :get) do %>
<fieldset><legend><%= l(:label_filter_plural) %></legend>
<label for='status'><%= l(:field_status) %> :</label>
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'><%= l(:label_project) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
<fieldset>
<legend>
<%= l(:label_filter_plural) %>
</legend>
<label for='status'>
<%= l(:field_status) %> :
</label>
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'>
<%= l(:label_project) %>:
</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
@ -19,17 +28,31 @@
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead><tr>
<th><%=l(:label_project)%></th>
<th><%=l(:field_is_public)%></th>
<th><%=l(:field_created_on)%></th>
<th>
<%=l(:label_project)%>
</th>
<th>
<%=l(:field_is_public)%>
</th>
<th>
<%=l(:field_created_on)%>
</th>
<th></th>
</tr></thead>
<tbody>
<% project_tree(@projects) do |project, level| %>
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'><span><%= link_to_project_settings(project, {}) %></span></td>
<td align="center"><%= checked_image project.is_public? %></td>
<td align="center"><%= format_date(project.created_on) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'>
<span>
<%= link_to_project_settings(project, {}) %>
</span>
</td>
<td align="center">
<%= checked_image project.is_public? %>
</td>
<td align="center">
<%= format_date(project.created_on) %>
</td>
<td class="buttons">
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>

@ -0,0 +1,21 @@
<%= error_messages_for 'project' %>
<!--[form:project]-->
<% unless @organizations.new_record? %>
<p>
<%= render :partial=>"avatar/avatar_form",:locals=> {source:@organizations} %>
</p>
<% end %>
<p>
<label for="project_description">
<%= l(:label_organization_name)%>
<span class="required">&nbsp;&nbsp;</span>
</label>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:290px;" %>
</p>
<!--<p>-->
<!--<label for="project_description">-->
<%#= l(:field_description)%>
<!--<span class="required">&nbsp;&nbsp;</span>-->
<!--</label>-->
<!--<%#= f.text_area :description, :required => true, :size => 60, :style => "width:490px;" %>-->
<!--</p>-->

@ -0,0 +1,25 @@
<%= form_for(@organization) do |f|%>
<h3>
<%=l(:label_organization_edit)%>
</h3>
<div class="box tabular" >
<%= error_messages_for 'project' %>
<p>
<%= render :partial=>"avatar/avatar_form",:locals=> {source:@organization} %>
</p>
<p>
<label for="project_description">
<%= l(:label_organization_name)%>
<span class="required">&nbsp;&nbsp;</span>
</label>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:290px;" %>
</p>
<span style="padding-left: 60px">
<%= submit_tag l(:button_create), :class => "enterprise"%>
</span>
</div>
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
<%= javascript_tag "$('#project_name').focus();" %>
<% end %>
<% html_title(l(:label_organization_edit)) -%>

@ -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="<%= organization.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)) -%>

@ -0,0 +1,18 @@
<%= form_for(@organizations, :method => :post,
:name => 'new_form',
:url => {:controller => 'organization',
:action => 'create'}) do |f|%>
<h3>
<%=l(:label_organization_new)%>
</h3>
<div class="box tabular" >
<%= render :partial => 'form', :locals => { :f => f } %>
<span style="padding-left: 60px">
<%= submit_tag l(:button_create), :class => "enterprise"%>
</span>
</div>
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
<%= javascript_tag "$('#project_name').focus();" %>
<% end %>
<% html_title(l(:label_organization_new)) -%>

@ -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)) -%>

@ -4,9 +4,14 @@
<input type="text" maxlength="100" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="input_title" placeholder="问卷标题"/>
</div>
<div class="ur_title_editor_prefix">
<textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor"><%= @poll.polls_description%></textarea>
<div contenteditable="true" id="polls_description_div" class="ur_textbox" style="min-height: 150px;width: 100%;background-color: #ffffff" onkeyup="edit_head();">
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
</div>
<textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor" style="display: none">
<%= @poll.polls_description%>
</textarea>
</div>
<div class="ur_editor_footer">
<div class="ur_editor_footer" style="padding-top: 10px;">
<a class="btn_submit" data-button="ok" onclick="pollsSubmit($(this));">
<%= l(:label_button_ok)%>
</a>

@ -7,6 +7,11 @@
<%#= javascript_include_tag "polls" %>
<script type="text/javascript">
//编辑问卷描述之后
function edit_head(){
$("#polls_description").val($("#polls_description_div").html());
}
function add_MC(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title").focus();

@ -3,8 +3,6 @@
<h1 class="ur_page_title" id="polls_name_h">
<%= poll.polls_name%>
</h1>
<p class="ur_prefix_content" id="polls_description_p">
<%= @poll.polls_description%>
</p>
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
<div class="cl"></div>
</div><!--头部显示 end-->

@ -1,6 +1,6 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
showModal('ajax-modal', '180px');
showModal('ajax-modal', '250px');
$('#ajax-modal').css('height','111px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

@ -1,6 +1,6 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
showModal('ajax-modal', '180px');
showModal('ajax-modal', '250px');
$('#ajax-modal').css('height','80px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

@ -34,7 +34,7 @@
<%= @poll.polls_name%>
</h1>
<p class="ur_prefix_content">
<%= @poll.polls_description %>
<%= @poll.polls_description.html_safe %>
</p>
</div>

@ -1,6 +1,4 @@
$("#polls_title").val("<%= @poll.polls_name%>");
$("#polls_description").val("<%= @poll.polls_description %>");
$("#polls_name_h").html("<%= @poll.polls_name %>");
$("#polls_description_p").html("<%= @poll.polls_description %>");
$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:poll => @poll}) %>");
$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:poll => @poll}) %>");
$("#polls_head_edit").hide();
$("#polls_head_show").show();

@ -1,35 +1,62 @@
<%= error_messages_for 'project' %>
<!--[form:project]-->
<% unless @project.new_record? %>
<p><%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %></p>
<p>
<%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %>
</p>
<% end %>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p>
<p>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %>
</p>
<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,
<p>
<%#= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %>
<label for="project_description">
<%= l(:field_enterprise_name)%>
<span class="required">&nbsp;&nbsp;</span>
</label>
<%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %>
</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? %>
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
<em class="info">
<%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %>
<%= l(:text_project_identifier_info).html_safe %>
</em>
<% end %></p>
<!-- <p style="margin-left:-10px;"><%#= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> --> <!-- by huang -->
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %></em></p>
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :hidden_repo, :style => "margin-left:10px;" %></em></p>
<p style="margin-left:-10px;">
<em style ="color: #888888;display: block;font-size: 90%;font-style: normal;">
<%= f.check_box :is_public, :style => "margin-left:10px;" %>
</em>
</p>
<p style="margin-left:-10px;">
<em style ="color: #888888;display: block;font-size: 90%;font-style: normal;">
<%= f.check_box :hidden_repo, :style => "margin-left:10px;" %>
</em>
</p>
<!--
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;">
<%#= f.check_box :dts_test, :style => "margin-left:10px;" %>
</em></p>
-->
<p style="display:none;"><%= f.text_field :project_type, :value => 0 %></p>
<p style="display:none;">
<%= f.text_field :project_type, :value => 0 %>
</p>
<%= wikitoolbar_for 'project_description' %>
<% @project.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :project, value %></p>
<p>
<%= custom_field_tag_with_label :project, value %>
</p>
<% end %>
<%= call_hook(:view_projects_form, :project => @project, :form => f) %>

@ -4,7 +4,9 @@
<%= labelled_form_for @project do |f| %>
<h3><%=l(:label_project_new)%></h3>
<div class="box tabular" >
<p style="font-weight: bold; color: rgb(237,137,36)"> <%=raw l(:label_project_new_description)%> </p>
<p style="font-weight: bold; color: rgb(237,137,36)">
<%=raw l(:label_project_new_description)%>
</p>
<%= render :partial => 'form', :locals => { :f => f } %>
<span style="padding-left: 60px">
<%= submit_tag l(:button_create), :class => "enterprise"%>

@ -5,7 +5,9 @@
<!-- 上左下右 -->
<div style="float: left; margin-left: 10px; width: 380px;">
<% unless project.is_public %>
<span class="private_project"> <%= l(:label_private) %> </span>
<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 l(:label_project_member_amount, :count=>projectCount(project)), project_member_path(project) ,:course =>'0' %>)

@ -38,7 +38,7 @@
<%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
<% end %>
<% else %>
<%= image_tag(url_to_avatar(@enterprise_page), width:@first_page.image_width,height: @first_page.image_height) %>
<%= image_tag(url_to_avatar(@organization), width:@first_page.image_width,height: @first_page.image_height) %>
<% end %>
</div>
<div class="welcome_left" id="welcome_left">
@ -47,9 +47,9 @@
<%= @first_page.description.html_safe %>
<% end %>
<% else %>
<span class="font_welcome_school" style="color: #E8770D">
<%= @organization %>
</span>
<span class="font_welcome_school" style="color: #E8770D">
<%= @organization.name %>
</span>
<br/>
<span class="font_welcome_trustie">
<%= @enterprise_page.title %>
@ -86,24 +86,25 @@
<% end; reset_cycle %>
<!-- 企业版项目 -->
<% else %>
<% if @e_count == 0 %>
<div id="flash_notice" class="flash notice"><%= l(:label_enterprise_tips) %></div>
<% @projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<% elsif @e_count < 10 %>
<% @organization_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<div id="flash_notice" class="flash notice"><%= l(:label_part_enterprise_tips) %></div>
<% @part_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<% else %>
<% @part_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<% end %>
<% if @part_projects.empty? %>
<% @projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<% else %>
<% @organization_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<li>
<h1></h1>
<div id="errorExplanation">
<%= l(:label_part_enterprise_tips) %>
</div>
<h1></h1>
</li>
<% @part_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<% end %>
<% end %>
</ul>
</div>

@ -247,7 +247,7 @@ zh:
label_course_closed_tips: "确定要%{desc}课程?"
# end
field_name: 名称
field_enterprise_name: 组织名称
field_enterprise_name: 组织
label_week_mail: 一周动态
label_day_mail: 一日动态
@ -538,6 +538,12 @@ zh:
label_project: 项目
label_activity_project: '项目: ' #added by bai
label_organization: 组织
label_organization_choose: --请选择组织--
label_organization_name: 组织名称
label_organization_list: 组织列表
label_organization_new: 新建组织
label_organization_edit: 修改组织
label_project_plural: 项目列表
label_first_page_made: 首页定制
label_project_first_page: 项目托管平台首页

@ -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, :except => [:show] 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
@ -646,6 +646,7 @@ RedmineApp::Application.routes.draw do
match 'admin/info', :via => :get
match 'admin/test_email', :via => :get
match 'admin/default_configuration', :via => :post
get 'admin/organization'
resources :auth_sources do
member do

@ -0,0 +1,10 @@
class CreateOrganizations < ActiveRecord::Migration
def change
create_table :organizations do |t|
t.string :name
t.string :logo_link
t.timestamps
end
end
end

@ -0,0 +1,9 @@
class AddOrganizationToProject < ActiveRecord::Migration
def up
add_column :projects, :organization_id, :integer
end
def down
remove_column :projects, :organization_id
end
end

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150302091345) do
ActiveRecord::Schema.define(:version => 20150305011359) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -631,16 +631,6 @@ ActiveRecord::Schema.define(:version => 20150302091345) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_details_copy", :force => true do |t|
t.integer "journal_id", :default => 0, :null => false
t.string "property", :limit => 30, :default => "", :null => false
t.string "prop_key", :limit => 30, :default => "", :null => false
t.text "old_value"
t.text "value"
end
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"
@ -825,6 +815,13 @@ ActiveRecord::Schema.define(:version => 20150302091345) do
t.integer "project_id"
end
create_table "organizations", :force => true do |t|
t.string "name"
t.string "logo_link"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "poll_answers", :force => true do |t|
t.integer "poll_question_id"
t.text "answer_text"
@ -949,6 +946,7 @@ ActiveRecord::Schema.define(:version => 20150302091345) do
t.integer "user_id"
t.integer "dts_test", :default => 0
t.string "enterprise_name"
t.integer "organization_id"
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -1036,12 +1034,12 @@ ActiveRecord::Schema.define(:version => 20150302091345) do
end
create_table "roles", :force => true do |t|
t.string "name", :limit => 90
t.integer "position"
t.boolean "assignable"
t.integer "builtin"
t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1
t.boolean "assignable", :default => true
t.integer "builtin", :default => 0, :null => false
t.text "permissions"
t.string "issues_visibility", :limit => 90
t.string "issues_visibility", :limit => 30, :default => "default", :null => false
end
create_table "schools", :force => true do |t|

@ -360,6 +360,7 @@ Redmine::MenuManager.map :homework_menu do |menu|
end
########end
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :organization, {:controller => 'admin', :action => 'organization'}, :caption => :label_organization_list
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

@ -0,0 +1,5 @@
require 'spec_helper'
describe Organization do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save