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

@ -13,3 +13,8 @@ $('.action a.remove_existing_record').live('click', function(){
//$("#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

@ -40,12 +40,6 @@ $(document).ready(function(){
}
});
$(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() {
$.getScript($(this).attr('rel'));
});

View File

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

View File

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

View File

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

View File

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

View File

@ -10,6 +10,9 @@ Rails.application.routes.draw do
resources :bulletins do
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
member do
get 'load_quick_edit'
end
end
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit