Fix tooltip in form

Change form_file
This commit is contained in:
chris 2013-07-22 20:54:40 +08:00
parent de6ce0073f
commit 0d0f85e7ad
11 changed files with 57 additions and 71 deletions

View File

@ -1,8 +1,8 @@
//= require jquery
//= require jquery_ujs
//= require jquery.ui.tooltip
//= require basic/bootstrap
//= require jquery.ui.tooltip
//= require basic/iscroll
//= require basic/orbit_js_1.0.1.js
//= require basic/jquery.nanoscroller.js

View File

@ -121,3 +121,12 @@ CKEDITOR.editorConfig = function( config ) {
// Make dialogs simpler.
config.removeDialogTabs = 'image:advanced;link:advanced';
};
CKEDITOR.on('instanceReady',function(){
$('.cke_button').tooltip({
position: {
my: "center bottom-4",
at: "center top"
}
});
});

View File

@ -4,7 +4,12 @@ $(function () {
$type = ['pdf', 'psd', 'ai', 'fla', 'swf', 'in', 'acc', 'do', 'xl', 'pp', 'zip', 'rar', '7z', 'txt', 'jp', 'gif', 'png', 'mp3', 'wav'];
$fileType.each(function (i) {
var $fileTypeHref = $(this).children('a').attr('href');
var $fileTypeHref = null;
if($(this).children('a').length) {
$fileTypeHref = $(this).children('a').attr('href');
} else {
$fileTypeHref = $(this).attr('href');
};
$fileTypeHref = $fileTypeHref.split("/");
$fileTypeHref = $fileTypeHref[$fileTypeHref.length-1];
@ -21,8 +26,8 @@ $(function () {
$fileType.eq(i).addClass('type-audio');
} else {
$fileType.eq(i).addClass('type-'+type);
}
}
})
};
};
});
});
});

View File

@ -520,9 +520,10 @@ legend {
padding: 0px 5px;
position: absolute;
z-index: 9999;
max-width: 300px;
max-width: 500px;
border-radius: 3px;
background-color: #0088CC;
white-space: nowrap;
}
#sideset .ui-tooltip.sidebar-tooltip:after {
display: none;
@ -532,9 +533,10 @@ legend {
padding: 0px 5px;
position: absolute;
z-index: 9999;
max-width: 300px;
max-width: 500px;
border-radius: 3px;
background-color: #000000;
white-space: nowrap;
}
.ui-tooltip:after {
content: '';

View File

@ -6,6 +6,7 @@ en:
alternative: Alternative
approval_setting: Approval Setting
change: Change
change_file: Change file
create:
error:
category: Error when creating category
@ -40,6 +41,7 @@ en:
select_all: Select all
select_file: Select file
select_image: Select image
sort_number: Sort number
tag:
add: Add tag
delete: Delete tags

View File

@ -1,16 +0,0 @@
module Panel::Announcement::BackEnd::BulletinCategorysHelper
include ActionView::Helpers::UrlHelper
def show_anc_cate_permission_link(category)
type = 'submit'
oa = category.get_object_auth_by_title(type)
if oa.nil?
category.object_auths.new(title: type ).save
oa = category.get_object_auth_by_title(type)
end
# link_to t(:category_auth), edit_admin_object_auth_path(oa)
link_to t(:category_auth),admin_object_auth_ob_auth_path(oa)
end
end

View File

@ -1,22 +0,0 @@
module Panel::Announcement::BackEnd::BulletinsHelper
def file_picture_preview_setting(file_path)
ext = File.extname(file_path)[1..-1].downcase
unless file_path.nil?
case ext
when "jpg","jpeg","png","gif"
{"data-content" => "#{image_tag file_path}" }
when "pdf", "zip", "rar"
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/#{ext}/#{ext}-64_32.png")}"}
when "doc", "docx"
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/docx_mac/docx_mac-64_32.png")}"}
when "xls", "xlsx"
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/xlsx_mac/xlsx_mac-64_32.png")}"}
when "ppt", "pptx"
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/pptx_mac/pptx_mac-64_32.png")}"}
else
{"data-content" => t("sys.not_previewable") }
end
end
end
end

View File

@ -1,14 +1,14 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%#= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%#= javascript_include_tag "lib/ckeditor/ckeditor.js" %>
<%= javascript_include_tag "lib/modal-preview" %>
<%= javascript_include_tag "lib/file-type" %>
<% end %>
<%= f.error_messages %>
@ -295,7 +295,6 @@
});
formTip();
});
$('.for_preview').popover({ html : true });
$(document).on('click', '.delete_link', function(){
$(this).parents('.input-prepend').remove();
});

View File

@ -1,15 +1,14 @@
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload-exist start-line">
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to form_file.file_identifier, form_file.file.url, {:class => 'file-link for_preview', :target => '_blank', :title => t(:view), "data-trigger" => :hover}.merge(file_picture_preview_setting(form_file.file.url)) %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<% if form_file.new_record? %>
<label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<i class="icons-paperclip"></i>
@ -17,10 +16,9 @@
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= t(:select_file) %></span>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<% end %>
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>

View File

@ -2,9 +2,11 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<% end %>
<%= f.error_messages %>
@ -179,9 +181,8 @@
$(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');
});
$('.main-forms .add-on').tooltip();
formTip();
});
$('.for_preview').popover({ html : true });
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});

View File

@ -1,5 +1,13 @@
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
<% else %>
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<span class="add-on btn btn-file" title="<%= t(:file_) %>">
@ -8,15 +16,15 @@
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= t(:select_file) %></span>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title="<%= 'File Name' %>"></span>
<span class="add-on icons-pencil" title="<%= t('file.name') %>"></span>
<span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: 'File Name', :value => (form_file.file_title_translations[locale] rescue nil) %>
<%= f.text_field locale, :class => "input-medium", placeholder: t('file.name'), :value => (form_file.file_title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
@ -28,7 +36,7 @@
</span>
<span class="add-on btn-group btn" title="<%= t('archive.show_lang') %>">
<%= t('archive.show_lang') %> <span class="caret"></span>
<i class="icons-earth"></i> <span class="caret"></span>
<ul class="dropdown-menu">
<% @site_valid_locales.each do |locale| %>
<li>