Merge branch 'hjq_beidou' of http://git.trustie.net/jacknudt/trustieforge into hjq_beidou
Conflicts: db/schema.rb
This commit is contained in:
commit
1ccb3a2c41
|
@ -130,6 +130,12 @@ class OrgSubfieldsController < ApplicationController
|
|||
@organization = @org_subfield.organization
|
||||
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
|
||||
@attachments = []
|
||||
obj.each do |container|
|
||||
|
|
|
@ -59,4 +59,18 @@ module OrganizationsHelper
|
|||
end
|
||||
end
|
||||
|
||||
#排列下拉框
|
||||
def subfield_status_option
|
||||
type = []
|
||||
option1 = []
|
||||
option1 << 0
|
||||
option1 << 0
|
||||
type << option1
|
||||
option2 = []
|
||||
option2 << 1
|
||||
option2 << 1
|
||||
type << option2
|
||||
type
|
||||
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="orgListStatus">默认</li>
|
||||
<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 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>
|
||||
|
@ -47,8 +54,14 @@
|
|||
</li>
|
||||
<li class="orgListStatus">新增</li>
|
||||
<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 class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
|
||||
<li class="orgListUser hidden">
|
||||
|
@ -76,6 +89,34 @@
|
|||
<% end %>
|
||||
|
||||
<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) {
|
||||
$(show_id).toggle();
|
||||
$(edit_id).toggle();
|
||||
|
|
|
@ -112,6 +112,7 @@ RedmineApp::Application.routes.draw do
|
|||
member do
|
||||
match 'update_sub_dir', :via => [:put]
|
||||
match 'update_priority', :via => [:put]
|
||||
match 'update_status', :via => [:post]
|
||||
end
|
||||
resource :boards
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddStatusToOrgSubfields < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :org_subfields, :status, :integer, :default => true
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue