修改组织模块的bug
This commit is contained in:
parent
ef1bc8aea7
commit
866c2feaa1
|
@ -80,9 +80,12 @@ class OrganizationsController < ApplicationController
|
|||
end
|
||||
|
||||
def set_homepage
|
||||
org = Organization.find(params[:id])
|
||||
org.home_id = params[:home_id]
|
||||
org.save
|
||||
@org = Organization.find(params[:id])
|
||||
@org.home_id = params[:home_id]
|
||||
@org.save
|
||||
# respond_to do |format|
|
||||
# format.html {redirect_to organization_path(org)}
|
||||
# end
|
||||
end
|
||||
|
||||
def autocomplete_search
|
||||
|
|
|
@ -4,6 +4,7 @@ class Organization < ActiveRecord::Base
|
|||
has_many :org_projects ,:dependent => :destroy
|
||||
has_many :projects,:through => :org_projects
|
||||
has_many :org_document_comments, :dependent => :destroy
|
||||
has_many :users, :through => :org_members
|
||||
validates_uniqueness_of :name
|
||||
after_create :save_as_org_activity
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ class User < Principal
|
|||
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
|
||||
belongs_to :auth_source
|
||||
has_many :org_members
|
||||
has_many :organizations, :through => :org_members
|
||||
belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang
|
||||
## added by xianbo for delete
|
||||
# has_many :biding_projects, :dependent => :destroy
|
||||
|
|
|
@ -51,7 +51,9 @@
|
|||
<% end%>
|
||||
</div>
|
||||
<div class="orgName fl mb5 f14">组织id:<%= @organization.id %></div>
|
||||
<a href="<%= setting_organization_path(@organization) %>" class="pr_join_a c_white"><span class="pr_setting"></span>配置</a>
|
||||
<% if User.current.admin_of_org?(@organization) %>
|
||||
<a href="<%= setting_organization_path(@organization) %>" class="pr_join_a c_white"><span class="pr_setting"></span>配置</a>
|
||||
<% end %>
|
||||
|
||||
<div style="clear:both;">
|
||||
<%= link_to l(:label_org_name)+"#{@organization.name}", organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %>
|
||||
|
@ -67,7 +69,7 @@
|
|||
<%= link_to '文章', organization_org_document_comments_path(@organization) %> (
|
||||
<%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %>
|
||||
) |
|
||||
<%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id) %>)
|
||||
<%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id' %>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepageLeftMenuContainer">
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
$('#new_org_document_form').submit();
|
||||
}
|
||||
}
|
||||
function cancel_create_org_document(){
|
||||
$("#document_title").val("");
|
||||
org_document_description_editor.html("");
|
||||
org_document_description_editor.sync();
|
||||
$('#org_document_editor').hide(); $('#doc_title_hint').hide();
|
||||
}
|
||||
</script>
|
||||
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
|
||||
<div class="resources">
|
||||
|
@ -42,7 +48,7 @@
|
|||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="create_org_document();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" onclick="$('#org_document_editor').hide(); $('#doc_title_hint').hide();" class="fr mr10 mt3">取消</a>
|
||||
<a href="javascript:void(0);" onclick="cancel_create_org_document();" class="fr mr10 mt3">取消</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
<% else %>
|
||||
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
|
||||
$("#principals_for_new_member").html('');
|
||||
$("#org_members_count_id").html("<%= @org.org_members.count %>");
|
||||
<% end %>
|
|
@ -1 +1,3 @@
|
|||
$("#org_members_count_id").html("");
|
||||
$("#org_members_count_id").html("<%= @org.org_members.count %>")
|
||||
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
|
|
@ -6,7 +6,12 @@
|
|||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo">
|
||||
<%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %>
|
||||
TO <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> | 组织
|
||||
TO <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> |
|
||||
<% if defined?(home_id) %>
|
||||
<span style="color:#269ac9;">首页</span>
|
||||
<% else %>
|
||||
<span style="color:#269ac9;">组织</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostTitle postGrey"><%= document.title %></div>
|
||||
<div class="homepagePostDate">
|
||||
|
@ -16,6 +21,9 @@
|
|||
<%= document.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- <%# if defined?(home_id) %>
|
||||
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
||||
<%# end %>-->
|
||||
<% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
location.reload();
|
||||
//location.reload();
|
||||
window.location.href ='<%= organization_path(@org)%>'
|
|
@ -12,25 +12,29 @@
|
|||
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||
</style>
|
||||
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%");
|
||||
});
|
||||
</script>
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id)} %>
|
||||
<% end %>
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">最新动态</div>
|
||||
<ul class="resourcesSelect">
|
||||
<!-- <ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li class="mt-4"><a href="javascript:void(0);" class="homepagePostTypeAll postTypeGrey">全部动态</a></li>
|
||||
<li class="mt-4"><a href="/users/8523/user_activities?type=current_user" class="homepagePostTypeMine postTypeGrey">我的动态</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>-->
|
||||
</div>
|
||||
|
||||
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%");
|
||||
});
|
||||
</script>
|
||||
<div id="organization_document_<%= @organization.home_id %>">
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% unless @activities.nil? %>
|
||||
<% @activities.each do |act| %>
|
||||
<% if act.org_act_type == 'CreateOrganization' %>
|
||||
|
@ -51,11 +55,12 @@
|
|||
<% if act.org_act_type == 'OrgDocumentComment' %>
|
||||
<script>
|
||||
$(function() {
|
||||
console.log(111)
|
||||
init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%");
|
||||
});
|
||||
</script>
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
|
||||
<div id="organization_document_<%= act.org_act.id %>">
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<ul class="wlist" style=" border:none; padding-top: 15px;">
|
||||
|
|
|
@ -87,9 +87,9 @@ 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 :organization, :except => [:show] do
|
||||
#
|
||||
# end
|
||||
|
||||
resources :school, :except => [:show] do
|
||||
collection do
|
||||
|
|
Loading…
Reference in New Issue