组织配置里的栏目 “排列做成可编辑的”
This commit is contained in:
parent
cf946687d0
commit
893fad2b48
|
@ -130,6 +130,12 @@ class OrgSubfieldsController < ApplicationController
|
||||||
@organization = @org_subfield.organization
|
@organization = @org_subfield.organization
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_status
|
||||||
|
@subfield = OrgSubfield.find(params[:id])
|
||||||
|
@organization = Organization.find(@subfield.organization_id)
|
||||||
|
@subfield.update_attributes(:status => params[:status])
|
||||||
|
end
|
||||||
|
|
||||||
def show_attachments obj
|
def show_attachments obj
|
||||||
@attachments = []
|
@attachments = []
|
||||||
obj.each do |container|
|
obj.each do |container|
|
||||||
|
|
|
@ -59,4 +59,18 @@ module OrganizationsHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#排列下拉框
|
||||||
|
def subfield_status_option
|
||||||
|
type = []
|
||||||
|
option1 = []
|
||||||
|
option1 << 0
|
||||||
|
option1 << 0
|
||||||
|
type << option1
|
||||||
|
option2 = []
|
||||||
|
option2 << 1
|
||||||
|
option2 << 1
|
||||||
|
type << option2
|
||||||
|
type
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>");
|
||||||
|
$("#sub_field_left_lists").html("");
|
||||||
|
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
|
@ -23,7 +23,14 @@
|
||||||
<li class="orgListUser"><%= name %></li>
|
<li class="orgListUser"><%= name %></li>
|
||||||
<li class="orgListStatus">默认</li>
|
<li class="orgListStatus">默认</li>
|
||||||
<li class="orgListStatus">
|
<li class="orgListStatus">
|
||||||
相关
|
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
|
||||||
|
<div class="update_status_class"><span style="width: 35px; text-align: center; float: left;" class="hidden"><%=field.status %></span>
|
||||||
|
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
|
||||||
|
</div>
|
||||||
|
<%= select( :name,:group_id, subfield_status_option,
|
||||||
|
{ :include_blank => false,:selected => field.status},
|
||||||
|
{:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:30px;"}) %>
|
||||||
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li class="orgListStatus">默认</li>
|
<li class="orgListStatus">默认</li>
|
||||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
|
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
|
||||||
|
@ -47,8 +54,14 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="orgListStatus">新增</li>
|
<li class="orgListStatus">新增</li>
|
||||||
<li class="orgListStatus">
|
<li class="orgListStatus">
|
||||||
|
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
|
||||||
相关
|
<div class="update_status_class"><span style="width: 35px; text-align: center; float: left;" class="hidden"><%=field.status %></span>
|
||||||
|
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
|
||||||
|
</div>
|
||||||
|
<%= select( :name,:group_id, subfield_status_option,
|
||||||
|
{ :include_blank => false,:selected => field.status},
|
||||||
|
{:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:30px;"}) %>
|
||||||
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
|
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
|
||||||
<li class="orgListUser hidden">
|
<li class="orgListUser hidden">
|
||||||
|
@ -76,6 +89,34 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".pic_edit2").click(function(){
|
||||||
|
$(this).parent().hide();
|
||||||
|
$(this).parent().next().show();
|
||||||
|
});
|
||||||
|
$(".class-edit").blur(function(){
|
||||||
|
$(this).hide();
|
||||||
|
$(this).prev().show();
|
||||||
|
var editValue = $(this).children("option:selected").text();
|
||||||
|
$(this).prev().children(":first").text(editValue);
|
||||||
|
});
|
||||||
|
function stopPropagation(e) {
|
||||||
|
if (e.stopPropagation)
|
||||||
|
e.stopPropagation();
|
||||||
|
else
|
||||||
|
e.cancelBubble = true;
|
||||||
|
};
|
||||||
|
$(document).bind('click',function(){
|
||||||
|
$('.class-edit').css('display','none');
|
||||||
|
$('.update_status_class').show();
|
||||||
|
});
|
||||||
|
$('.class-edit,.pic_edit2').bind('click',function(e){
|
||||||
|
stopPropagation(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function update_status(id){
|
||||||
|
$(id).submit();
|
||||||
|
}
|
||||||
function edit(show_id, edit_id) {
|
function edit(show_id, edit_id) {
|
||||||
$(show_id).toggle();
|
$(show_id).toggle();
|
||||||
$(edit_id).toggle();
|
$(edit_id).toggle();
|
||||||
|
|
|
@ -112,6 +112,7 @@ RedmineApp::Application.routes.draw do
|
||||||
member do
|
member do
|
||||||
match 'update_sub_dir', :via => [:put]
|
match 'update_sub_dir', :via => [:put]
|
||||||
match 'update_priority', :via => [:put]
|
match 'update_priority', :via => [:put]
|
||||||
|
match 'update_status', :via => [:post]
|
||||||
end
|
end
|
||||||
resource :boards
|
resource :boards
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
class AddTypeToOrganization < ActiveRecord::Migration
|
|
||||||
def change
|
|
||||||
add_column :organizations, :type, :integer, :default => true
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddStatusToOrgSubfields < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :org_subfields, :status, :integer, :default => true
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20160328022623) do
|
ActiveRecord::Schema.define(:version => 20160331063938) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -1289,6 +1289,7 @@ ActiveRecord::Schema.define(:version => 20160328022623) do
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.string "field_type"
|
t.string "field_type"
|
||||||
t.integer "hide", :default => 0
|
t.integer "hide", :default => 0
|
||||||
|
t.integer "status", :default => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "organizations", :force => true do |t|
|
create_table "organizations", :force => true do |t|
|
||||||
|
|
Loading…
Reference in New Issue