Remove quick_edit on bulletin index load

This commit is contained in:
Christophe Vilayphiou 2012-03-23 17:32:59 +08:00
parent a126935d2c
commit 61698f3f2c
11 changed files with 37 additions and 41 deletions

View File

@ -12,4 +12,9 @@ $('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1); $(this).next('.should_destroy').attr('value', 1);
//$("#bulletin_" + $(this).prev().attr('value')).hide(); //$("#bulletin_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_" + $(this).prev().attr('value')).hide();
});
$('.quick_edit_cancel').live('click', function(){
tr = $(this).attr('rel');
$('#' + tr).hide();
}); });

View File

@ -39,12 +39,6 @@ $(document).ready(function(){
break; break;
} }
}); });
$(document).on('click', '.toggle-tr-edit', function() {
$(this).parents('tr').next('.qe-block').removeClass('hide');
$(this).parents('tr').next('.qe-block').find('.qe-edit-div').addClass('hide');
$(this).parents('tr').next('.qe-block').find('#qe-' + $(this).attr('rel')).toggleClass('hide');
});
$(document).on('click', '.sort-header > .sort', function() { $(document).on('click', '.sort-header > .sort', function() {
$.getScript($(this).attr('rel')); $.getScript($(this).attr('rel'));

View File

@ -172,6 +172,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# end # end
def load_quick_edit
@bulletin = Bulletin.find(params[:id])
@type = params[:type]
@bulletin_categories = BulletinCategory.all
get_tags
end
protected protected

View File

@ -16,11 +16,11 @@
<li class="dropdown"> <li class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a> <a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
<ul class="dropdown-menu" id="menu1"> <ul class="dropdown-menu" id="menu1">
<li><a href="#" class='toggle-tr-edit' rel='basic'><%= t(:basic) %></a></li> <li><%= link_to t(:basic), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'basic'), :remote => true %></li>
<li><a href="#" class='toggle-tr-edit' rel='picture'><%= t(:picture) %></a></li> <li><%= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li>
<li><a href="#" class='toggle-tr-edit' rel='tags'><%= t(:tags) %></a></li> <li><%= link_to t(:tags), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'tags'), :remote => true %></li>
<li><a href="#" class='toggle-tr-edit' rel='link'><%= t(:link) %></a></li> <li><%= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li>
<li><a href="#" class='toggle-tr-edit' rel='file'><%= t(:file) %></a></li> <li><%= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
</ul> </ul>
</li> </li>
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li> <li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
@ -39,11 +39,4 @@
</td> </td>
<td><%= User.from_id(bulletin.update_user_id).name rescue ''%></td> <td><%= User.from_id(bulletin.update_user_id).name rescue ''%></td>
</tr> </tr>
<tr id="<%= dom_id bulletin, :edit %>" class="qe-block hide" />
<%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %>
<% content_for :page_specific_javascript do %>
<script>
</script>
<% end %>

View File

@ -1,17 +1,10 @@
<!-- <tr class="qe-block hide"> --> <td colspan="8">
<tr class="qe-block hide"> <legend><%= t(:quick_edit) %> - <span class='qe_title'></span><%= t(type) %></legend>
<td colspan="8"> <%= form_for @bulletin, :url => panel_announcement_back_end_bulletin_path(@bulletin), :html => {:class => 'form-horizontal'} do |f| %>
<legend><%= t(:quick_edit) %> - <span class='qe_title'></span>Basic / Picture / Tags / Link / File</legend> <%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_#{@type}", :locals => { :f => f, :bulletin => @bulletin } %>
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'form-horizontal'} do |f| %> <div class="form-actions">
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %> <%= f.submit t(:submit), :class => 'btn btn-primary' %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %> <%= f.submit t(:cancel), :class => 'btn quick_edit_cancel', :type => 'reset', :rel => dom_id(@bulletin, :edit) %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %> </div>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %> <% end %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %> </td>
<div class="form-actions">
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>
</div>
<% end %>
</td>
</tr>

View File

@ -1,4 +1,4 @@
<div id="qe-basic" class="qe-edit-div hide"> <div id="qe-basic" class="qe-edit-div">
<div id="widget-category"> <div id="widget-category">
<div class="control-group"> <div class="control-group">
<label class="control-label"><%= t(:category) %></label> <label class="control-label"><%= t(:category) %></label>

View File

@ -1,4 +1,4 @@
<div id="qe-file" class="qe-edit-div hide"> <div id="qe-file" class="qe-edit-div">
<div id="widget-file"> <div id="widget-file">
<div class="control-group"> <div class="control-group">
<table class="table table-condensed"> <table class="table table-condensed">

View File

@ -1,4 +1,4 @@
<div id="qe-link" class="qe-edit-div hide"> <div id="qe-link" class="qe-edit-div">
<div id="widget-link"> <div id="widget-link">
<div class="control-group"> <div class="control-group">
<table class="table table-condensed"> <table class="table table-condensed">

View File

@ -1,4 +1,4 @@
<div id="qe-picture" class="qe-edit-div hide"> <div id="qe-picture" class="qe-edit-div">
<div id="widget-picture"> <div id="widget-picture">
<div class="control-group"> <div class="control-group">
<label class="control-label">Picture</label> <label class="control-label">Picture</label>

View File

@ -32,7 +32,7 @@
</div> </div>
</div> --> </div> -->
<div id="qe-tags" class="qe-edit-div hide"> <div id="qe-tags" class="qe-edit-div">
<div id="widget-tags"> <div id="widget-tags">
<div class="form-horizontal"> <div class="form-horizontal">
<% @tags.each do |tag| %> <% @tags.each do |tag| %>

View File

@ -10,6 +10,9 @@ Rails.application.routes.draw do
resources :bulletins do resources :bulletins do
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
member do
get 'load_quick_edit'
end
end end
resources :bulletin_categorys, :controller => 'bulletin_categorys' do resources :bulletin_categorys, :controller => 'bulletin_categorys' do
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit