Fix for quick edit file and link in announcement
Change submit_button into ajax_for_submit
This commit is contained in:
parent
6bf4c60d45
commit
3d293f6419
|
@ -1,4 +1,4 @@
|
||||||
$('#submit_button').live('click', function(){
|
$(document).on('click', '#ajax_form_submit', function(){
|
||||||
$('#ajaxForm').ajaxSubmit({
|
$('#ajaxForm').ajaxSubmit({
|
||||||
beforeSubmit: function(a,f,o) {
|
beforeSubmit: function(a,f,o) {
|
||||||
o.dataType = 'script';
|
o.dataType = 'script';
|
||||||
|
|
|
@ -6,10 +6,9 @@ $('.bulletin_files_block a.delete').live('click', function(){
|
||||||
$(this).parents('.list_item').remove();
|
$(this).parents('.list_item').remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.action a.remove_existing_record').live('click', function(){
|
$(document).on('click', '.action a.remove_existing_record', function(){
|
||||||
$(this).next('.should_destroy').attr('value', 1);
|
$(this).next('.should_destroy').attr('value', 1);
|
||||||
//$("#bulletin_" + $(this).prev().attr('value')).hide();
|
$("tr #" + $(this).prev().attr('value')).hide();
|
||||||
$("tr#bulletin_" + $(this).prev().attr('value')).hide();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.quick_edit_cancel').live('click', function(){
|
$('.quick_edit_cancel').live('click', function(){
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
//
|
//
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
|
//= require jquery.form
|
||||||
//= require bootstrap
|
//= require bootstrap
|
||||||
//= require jquery.isotope.min
|
//= require jquery.isotope.min
|
||||||
//= require jquery.tinyscrollbar.min
|
//= require jquery.tinyscrollbar.min
|
||||||
|
@ -14,3 +15,4 @@
|
||||||
//= require tinymce_orbit
|
//= require tinymce_orbit
|
||||||
//= require orbit-bar-search
|
//= require orbit-bar-search
|
||||||
//= require side_bar_history
|
//= require side_bar_history
|
||||||
|
//= require ajax_form
|
|
@ -9,7 +9,7 @@
|
||||||
<%= link_back %>
|
<%= link_back %>
|
||||||
<%= f.submit t(:edit) %>
|
<%= f.submit t(:edit) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a id='submit_button'><%= t(:edit) %></a>
|
<a id='ajax_form_submit'><%= t(:edit) %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<%= link_back %>
|
<%= link_back %>
|
||||||
<%= f.submit t(:create) %>
|
<%= f.submit t(:create) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a id='submit_button' class="new"><%= t(:create) %></a>
|
<a id='ajax_form_submit' class="new"><%= t(:create) %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<% # encoding: utf-8 %>
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
<%= form_for(@bulletin_file, :remote => true, :url => @file_url) do |f| %>
|
<%= form_for @bulletin_file, :url => @file_url, :html => {:id => 'ajaxForm', :multipart => true} do |f| %>
|
||||||
|
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
|
@ -38,9 +38,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<%= hidden_field_tag 'bulletin_file[bulletin_id]', @bulletin_file.bulletin_id %>
|
<%= hidden_field_tag 'bulletin_file[bulletin_id]', @bulletin_file.bulletin_id %>
|
||||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
<a class="btn btn-primary" id='ajax_form_submit'><%= t('submit')%></a>
|
||||||
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
|
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
|
|
||||||
<tr id="<%= dom_id list_bulletin_file %>">
|
<tr id="<%= dom_id list_bulletin_file %>">
|
||||||
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.zh_tw, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.filetitle.zh_tw %></td>
|
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.zh_tw, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.filetitle.zh_tw %></td>
|
||||||
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.en, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.filetitle.en %></td>
|
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.en, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.filetitle.en %></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<%= panel_announcement_back_end_bulletin_file_quick_edit_path(list_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
<a href="<%= panel_announcement_back_end_bulletin_file_quick_edit_path(list_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||||
<span class="action">
|
<span class="action">
|
||||||
<%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %>
|
<%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %>
|
||||||
<%= f.hidden_field :id %>
|
<%= f.hidden_field :id %>
|
||||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
<%= hidden_field_tag :tr, (dom_id list_bulletin_file) %>
|
||||||
<%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %>
|
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||||
<% end %>
|
<%= f.hidden_field :_destroy, :value => nil , :class => 'should_destroy' %>
|
||||||
</span>
|
<% end %>
|
||||||
</td>
|
</span>
|
||||||
</tr>
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
|
<tr id="<%= dom_id list_bulletin_link %>">
|
||||||
<tr id="<%= dom_id list_bulletin_link %>">
|
<td><%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %></td>
|
||||||
<td><%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %></td>
|
<td><%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %></td>
|
||||||
<td><%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %></td>
|
<td>
|
||||||
<td>
|
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(list_bulletin_link) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
||||||
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(list_bulletin_link) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
<span class="action">
|
||||||
<span class="action">
|
<%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %>
|
||||||
<%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %>
|
<%= f.hidden_field :id %>
|
||||||
<%= f.hidden_field :id %>
|
<%= hidden_field_tag :tr, (dom_id list_bulletin_link) %>
|
||||||
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
|
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||||
<%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %>
|
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div id="qe-file" class="qe-edit-div">
|
<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 id="bulletin_files" class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Chinese</th>
|
<th>Chinese</th>
|
||||||
|
|
|
@ -15,6 +15,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="bulletin_file_qe">
|
||||||
|
<div id="modal-file" class="modal fade">
|
||||||
|
<%= render :partial => "bulletin_file_qe" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in New Issue