Add tooltip to bulletin form and remove file

This commit is contained in:
chris 2013-07-22 16:55:02 +08:00
parent fe82427baa
commit 5284571300
4 changed files with 14 additions and 9 deletions

View File

@ -90,7 +90,7 @@
.main-forms fieldset .input-area .controls .exist .input-prepend, .main-forms fieldset .input-area .controls .exist .input-prepend,
.main-forms fieldset .input-area .controls .add-target .input-prepend { .main-forms fieldset .input-area .controls .add-target .input-prepend {
margin-bottom: 10px; margin-bottom: 10px;
display: inline-block; display: block;
} }
.main-forms fieldset .input-area .controls .exist .fileupload-new { .main-forms fieldset .input-area .controls .exist .fileupload-new {
display: block; display: block;

View File

@ -272,7 +272,7 @@
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<script> <script>
$(document).ready(function() { $(function() {
$(document).on('click', '#add_link', function(){ $(document).on('click', '#add_link', function(){
var new_id = $(this).prev().attr('value'); var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_bulletin_links", "g"); var old_id = new RegExp("new_bulletin_links", "g");
@ -281,6 +281,7 @@
$(this).prev().attr('value', parseInt(new_id) + 1); $(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :bulletin_links) %>").replace(old_id, new_id)); $(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :bulletin_links) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active'); $(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
formTip();
}); });
$(document).on('click', '#add_file', function(){ $(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value'); var new_id = $(this).prev().attr('value');
@ -292,11 +293,15 @@
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() { $(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active'); $(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
}); });
formTip();
}); });
$('.for_preview').popover({ html : true }); $('.for_preview').popover({ html : true });
$(document).on('click', '.delete_link', function(){ $(document).on('click', '.delete_link', function(){
$(this).parents('.input-prepend').remove(); $(this).parents('.input-prepend').remove();
}); });
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){ $(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){ if(confirm("<%= I18n.t(:sure?)%>")){
$(this).next('.should_destroy').attr('value', 1); $(this).next('.should_destroy').attr('value', 1);

View File

@ -7,7 +7,7 @@
<div class="input-prepend input-append"> <div class="input-prepend input-append">
<% if form_file.new_record? %> <% if form_file.new_record? %>
<label> <label>
<span class="add-on btn btn-file"> <span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<i class="icons-paperclip"></i> <i class="icons-paperclip"></i>
<%= f.file_field :file %> <%= f.file_field :file %>
</span> </span>
@ -17,7 +17,7 @@
</div> </div>
</label> </label>
<% end %> <% end %>
<span class="add-on icons-pencil"></span> <span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content"> <span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>"> <span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
@ -27,7 +27,7 @@
</span> </span>
<% end %> <% end %>
</span> </span>
<span class="add-on icons-pencil"></span> <span class="add-on icons-pencil" title='<%= t(:description) %>'></span>
<span class="tab-content"> <span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>"> <span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
@ -38,7 +38,7 @@
<% end %> <% end %>
</span> </span>
</span> </span>
<span class="delete_file add-on btn"> <span class="delete_file add-on btn" title="<%= form_file.new_record? ? t(:remove) : t(:delete_) %>">
<% if form_file.new_record? %> <% if form_file.new_record? %>
<a class="icon-trash"></a> <a class="icon-trash"></a>
<% else %> <% else %>

View File

@ -1,7 +1,7 @@
<div class="input-prepend input-append start-line"> <div class="input-prepend input-append start-line">
<span class="add-on icons-link"></span> <span class="add-on icons-link" title="<%= t(:url) %>"></span>
<%= f.text_field :url, class: "input-large", placeholder: t(:url) %> <%= f.text_field :url, class: "input-large", placeholder: t(:url) %>
<span class="add-on icons-pencil"></span> <span class="add-on icons-pencil" title="<%= t(:url_alt) %>"></span>
<span class="tab-content"> <span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>"> <span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
@ -11,7 +11,7 @@
</span> </span>
<% end %> <% end %>
</span> </span>
<span class="delete_link add-on btn"> <span class="delete_link add-on btn" title="<%= form_link.new_record? ? t(:remove) : t(:delete_) %>">
<% if form_link.new_record? %> <% if form_link.new_record? %>
<a class="icon-trash"></a> <a class="icon-trash"></a>
<% else %> <% else %>