组织界面增加分栏
This commit is contained in:
parent
2855c0e409
commit
ab4d0e4678
|
@ -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 org_subfields controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,19 @@
|
||||||
|
class OrgSubfieldsController < ApplicationController
|
||||||
|
def create
|
||||||
|
@subfield = OrgSubfield.create(:name => params[:name])
|
||||||
|
@organization = Organization.find(params[:organization_id])
|
||||||
|
@organization.org_subfields << @subfield
|
||||||
|
@subfield.update_attributes(:priority => @subfield.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@subfield = OrgSubfield.find(params[:id])
|
||||||
|
@organization = Organization.find(@subfield.organization_id)
|
||||||
|
@subfield.destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@subfield = OrgSubfield.find(params[:id])
|
||||||
|
@subfield.update_attributes(:name => params[:name])
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module OrgSubfieldsHelper
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
class OrgSubfield < ActiveRecord::Base
|
||||||
|
belongs_to :organization, :foreign_key => :organization_id
|
||||||
|
end
|
|
@ -6,6 +6,7 @@ class Organization < ActiveRecord::Base
|
||||||
has_many :courses, :through => :org_courses
|
has_many :courses, :through => :org_courses
|
||||||
has_many :org_document_comments, :dependent => :destroy
|
has_many :org_document_comments, :dependent => :destroy
|
||||||
has_many :org_courses, :dependent => :destroy
|
has_many :org_courses, :dependent => :destroy
|
||||||
|
has_many :org_subfields, :dependent => :destroy
|
||||||
has_many :users, :through => :org_members
|
has_many :users, :through => :org_members
|
||||||
validates_uniqueness_of :name
|
validates_uniqueness_of :name
|
||||||
after_create :save_as_org_activity
|
after_create :save_as_org_activity
|
||||||
|
|
|
@ -81,59 +81,8 @@
|
||||||
<%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>)
|
<%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepageLeftMenuContainer">
|
<div class="homepageLeftMenuContainer" id="sub_field_left_lists">
|
||||||
<div class="homepageLeftMenuBlock">
|
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
|
||||||
<%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %>
|
|
||||||
</div>
|
|
||||||
<div class="homepageLeftMenuBlock">
|
|
||||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
|
|
||||||
<%=link_to "", join_project_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%>
|
|
||||||
<!--<div class="courseMenu" id="projectMenu">-->
|
|
||||||
<!--<ul>-->
|
|
||||||
<!--<li class="courseMenuIcon" id="projectMenuIcon">-->
|
|
||||||
<!--<ul class="topnav_course_menu" id="topnav_project_menu" style="line-height:1;">-->
|
|
||||||
<!--<!–<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>–>-->
|
|
||||||
<!--<li>-->
|
|
||||||
<!--<%#= link_to "关联项目",join_project_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>-->
|
|
||||||
<!--</li>-->
|
|
||||||
<!--</ul>-->
|
|
||||||
<!--</li>-->
|
|
||||||
<!--</ul>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
|
|
||||||
</div>
|
|
||||||
<div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuProjects">
|
|
||||||
<ul >
|
|
||||||
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%>
|
|
||||||
<!--<%#= @organization.org_projects.each do |p|%>-->
|
|
||||||
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey"><%#= p.name%></a></li>-->
|
|
||||||
<!--<%# end %>-->
|
|
||||||
<!--<li class="homepageLeftMenuMore"><a href="javascript:void(0);" class="homepageLeftMenuMoreIcon"></a></li>-->
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="homepageLeftMenuBlock">
|
|
||||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
|
|
||||||
<%=link_to "", join_course_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
|
|
||||||
<%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>
|
|
||||||
<!--<div class="courseMenu" id="courseMenu">-->
|
|
||||||
<!--<ul>-->
|
|
||||||
<!--<li class="courseMenuIcon" id="courseMenuIcon">-->
|
|
||||||
<!--<ul class="topnav_course_menu" id="topnav_course_menu" style="line-height:1;">-->
|
|
||||||
<!--<!–<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>–>-->
|
|
||||||
<!--<li>-->
|
|
||||||
<!--<%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>-->
|
|
||||||
<!--</li>-->
|
|
||||||
<!--</ul>-->
|
|
||||||
<!--</li>-->
|
|
||||||
<!--</ul>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
|
|
||||||
</div>
|
|
||||||
<div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuCourses">
|
|
||||||
<ul >
|
|
||||||
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepageRight">
|
<div class="homepageRight">
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
$("#org_subfield_list").html("");
|
||||||
|
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
|
||||||
|
$("#sub_field_left_lists").html("");
|
||||||
|
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
|
@ -0,0 +1,4 @@
|
||||||
|
$("#org_subfield_list").html("");
|
||||||
|
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
|
||||||
|
$("#sub_field_left_lists").html("");
|
||||||
|
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
|
@ -0,0 +1 @@
|
||||||
|
$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>");
|
|
@ -0,0 +1,60 @@
|
||||||
|
<div class="homepageLeftMenuBlock">
|
||||||
|
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
|
||||||
|
</div>
|
||||||
|
<div class="homepageLeftMenuBlock">
|
||||||
|
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
|
||||||
|
<%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%>
|
||||||
|
<!--<div class="courseMenu" id="projectMenu">-->
|
||||||
|
<!--<ul>-->
|
||||||
|
<!--<li class="courseMenuIcon" id="projectMenuIcon">-->
|
||||||
|
<!--<ul class="topnav_course_menu" id="topnav_project_menu" style="line-height:1;">-->
|
||||||
|
<!--<!–<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>–>-->
|
||||||
|
<!--<li>-->
|
||||||
|
<!--<%#= link_to "关联项目",join_project_menu_organization_path(organization),:remote => true,:class => "menuGrey",:method => "post"%>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
|
||||||
|
</div>
|
||||||
|
<div class="homepageLeftMenuCourses" id="homepageLeftMenuProjects">
|
||||||
|
<ul >
|
||||||
|
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||||
|
<!--<%#= organization.org_projects.each do |p|%>-->
|
||||||
|
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey"><%#= p.name%></a></li>-->
|
||||||
|
<!--<%# end %>-->
|
||||||
|
<!--<li class="homepageLeftMenuMore"><a href="javascript:void(0);" class="homepageLeftMenuMoreIcon"></a></li>-->
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="homepageLeftMenuBlock">
|
||||||
|
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
|
||||||
|
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
|
||||||
|
<%#= link_to "关联课程",join_course_menu_organization_path(organization),:remote => true,:class => "menuGrey",:method => "post"%>
|
||||||
|
<!--<div class="courseMenu" id="courseMenu">-->
|
||||||
|
<!--<ul>-->
|
||||||
|
<!--<li class="courseMenuIcon" id="courseMenuIcon">-->
|
||||||
|
<!--<ul class="topnav_course_menu" id="topnav_course_menu" style="line-height:1;">-->
|
||||||
|
<!--<!–<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>–>-->
|
||||||
|
<!--<li>-->
|
||||||
|
<!--<%#= link_to "关联课程",join_course_menu_organization_path(organization),:remote => true,:class => "menuGrey",:method => "post"%>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
|
||||||
|
</div>
|
||||||
|
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses">
|
||||||
|
<ul >
|
||||||
|
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% organization.org_subfields.each do |field| %>
|
||||||
|
<div class="homepageLeftMenuBlock">
|
||||||
|
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses_#{field.id}').slideToggle();"><%= field.name %></a>
|
||||||
|
<%=link_to "", :title => "关联#{field.name}"%>
|
||||||
|
</div>
|
||||||
|
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>">
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
<ul class="orgListRow">
|
||||||
|
<li class="orgListUser fb">已有栏目</li>
|
||||||
|
<li class="orgListRole fb">状态</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<ul class="orgListRow">
|
||||||
|
<li class="orgListUser">动态</li>
|
||||||
|
<li class="orgListUser">默认</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<ul class="orgListRow">
|
||||||
|
<li class="orgListUser">项目</li>
|
||||||
|
<li class="orgListUser">默认</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<ul class="orgListRow">
|
||||||
|
<li class="orgListUser">课程</li>
|
||||||
|
<li class="orgListUser">默认</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<% subfields.each do |field| %>
|
||||||
|
<ul class="orgListRow">
|
||||||
|
<li class="orgListUser"><div id="subfield_show_<%= field.id %>"><%= field.name %></div><div id="subfield_edit_<%= field.id %>" style="display:none;">
|
||||||
|
<input type="text" name="name" onblur="update_subfield('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>','<%= field.id %>',$(this).val());" value="<%= field.name %>" style="width:70px;" /></div></li>
|
||||||
|
<li class="orgListUser">新增</li>
|
||||||
|
<%= link_to "删除",org_subfield_path(field), :method => 'delete',:remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr5" %>
|
||||||
|
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function edit(show_id, edit_id){
|
||||||
|
$(show_id).toggle();
|
||||||
|
$(edit_id).toggle();
|
||||||
|
$(edit_id).focus();
|
||||||
|
}
|
||||||
|
function update_subfield(show_id, edit_id, field_id, input_value) {
|
||||||
|
if ($(show_id).html().trim() != input_value.trim()) {
|
||||||
|
if (confirm('确定修改为' + input_value + "?"))
|
||||||
|
$.ajax({
|
||||||
|
url :"/org_subfields/" + field_id + "?name=" + input_value,
|
||||||
|
type :'put'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(show_id).show();
|
||||||
|
$(edit_id).hide();
|
||||||
|
// $(edit_id).focus();
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -2,7 +2,7 @@
|
||||||
function g(o){return document.getElementById(o);}
|
function g(o){return document.getElementById(o);}
|
||||||
function HoverLi(n){
|
function HoverLi(n){
|
||||||
//如果有N个标签,就将i<=N;
|
//如果有N个标签,就将i<=N;
|
||||||
for(var i=1;i<=2;i++){
|
for(var i=1;i<=3;i++){
|
||||||
g('orgSetting_'+i).className='orgSettingOp';
|
g('orgSetting_'+i).className='orgSettingOp';
|
||||||
g('orgContent_'+i).className='undis';}
|
g('orgContent_'+i).className='undis';}
|
||||||
g('orgContent_'+n).className='dis ml15 mr15';
|
g('orgContent_'+n).className='dis ml15 mr15';
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
<ul class="mb10">
|
<ul class="mb10">
|
||||||
<li class="orgSettingOp orgOpActive" id="orgSetting_1" onclick="HoverLi(1);">信息</li>
|
<li class="orgSettingOp orgOpActive" id="orgSetting_1" onclick="HoverLi(1);">信息</li>
|
||||||
<li class="orgSettingOp" id="orgSetting_2" onclick="HoverLi(2);">成员</li>
|
<li class="orgSettingOp" id="orgSetting_2" onclick="HoverLi(2);">成员</li>
|
||||||
|
<li class="orgSettingOp" id="orgSetting_3" onclick="HoverLi(3);">分栏</li>
|
||||||
<li class="orgBorder"></li>
|
<li class="orgBorder"></li>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -104,4 +105,26 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="undis ml15 mr15" id="orgContent_3">
|
||||||
|
<div class="orgMemberList" id="org_subfield_list">
|
||||||
|
<%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields } %>
|
||||||
|
</div>
|
||||||
|
<div class="fr orgMemContainer">
|
||||||
|
<div class="orgMemberAdd">
|
||||||
|
<p class="fontBlue fb mb5">新增栏目</p>
|
||||||
|
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
|
||||||
|
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb20" />
|
||||||
|
<div class="cl"></div>
|
||||||
|
<a href="javascript:void(0);" class="saveBtn db fl mt10" onclick="add_org_subfield();">确定</a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function add_org_subfield(){
|
||||||
|
if ($("#subfield_name").val().trim() != "")
|
||||||
|
$("#add_subfield_form").submit();
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -70,6 +70,10 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :org_subfields do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
resources :org_document_comments do
|
resources :org_document_comments do
|
||||||
member do
|
member do
|
||||||
post 'add_reply'
|
post 'add_reply'
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateOrgSubfields < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :org_subfields do |t|
|
||||||
|
t.integer :organization_id
|
||||||
|
t.integer :priority
|
||||||
|
t.string :name
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -54,4 +54,14 @@ a.cancelBtn:hover {background-color:#717171; color:#ffffff;}
|
||||||
|
|
||||||
/*关联项目弹窗*/
|
/*关联项目弹窗*/
|
||||||
.projectRelate {float:left; max-height:118px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden; width:288px;}
|
.projectRelate {float:left; max-height:118px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden; width:288px;}
|
||||||
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
|
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
|
||||||
|
|
||||||
|
/*组织首页新151204Tim*/
|
||||||
|
.orgNav {width:1000px; height:30px; background-color:#cfcfcf; margin:0 auto;}
|
||||||
|
.orgContainer {width:100%; margin:0 auto; background-color:#cfcfcf;}
|
||||||
|
.navOrgLogo {width:21px; height:30px; margin-left:2px; margin-right:15px;}
|
||||||
|
.navOrgMenu {display:inline-block;height:30px; line-height:30px; vertical-align:middle;}
|
||||||
|
a.linkGrey8 {color:#888888;}
|
||||||
|
a.linkGrey8:hover {color:#585858;}
|
||||||
|
.orgBorder {width:583px; height:21px; border-bottom:3px solid #e4e4e4; float:left;}
|
||||||
|
.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px; color:#555555;}
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe OrgSubfieldsController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue