From 0d0f85e7ad6acd2c772f97ec4a6fdc89e5a846ee Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 22 Jul 2013 20:54:40 +0800 Subject: [PATCH] Fix tooltip in form Change form_file --- app/assets/javascripts/basic.js | 2 +- app/assets/javascripts/ckeditor/config.js.erb | 9 +++++++ .../lib/{archive => }/file-type.js | 13 +++++++--- app/assets/stylesheets/basic/global.css | 6 +++-- config/locales/new_ui.en.yml | 2 ++ .../back_end/bulletin_categorys_helper.rb | 16 ------------ .../announcement/back_end/bulletins_helper.rb | 22 ---------------- .../back_end/bulletins/_form.html.erb | 5 ++-- .../back_end/bulletins/_form_file.html.erb | 26 +++++++++---------- .../back_end/archive_files/_form.html.erb | 5 ++-- .../archive_files/_form_file.html.erb | 22 +++++++++++----- 11 files changed, 57 insertions(+), 71 deletions(-) rename app/assets/javascripts/lib/{archive => }/file-type.js (81%) delete mode 100644 vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb delete mode 100644 vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb diff --git a/app/assets/javascripts/basic.js b/app/assets/javascripts/basic.js index 7f975c67a..3aa1a5169 100644 --- a/app/assets/javascripts/basic.js +++ b/app/assets/javascripts/basic.js @@ -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 diff --git a/app/assets/javascripts/ckeditor/config.js.erb b/app/assets/javascripts/ckeditor/config.js.erb index 064f91545..9f51e6070 100644 --- a/app/assets/javascripts/ckeditor/config.js.erb +++ b/app/assets/javascripts/ckeditor/config.js.erb @@ -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" + } + }); +}); diff --git a/app/assets/javascripts/lib/archive/file-type.js b/app/assets/javascripts/lib/file-type.js similarity index 81% rename from app/assets/javascripts/lib/archive/file-type.js rename to app/assets/javascripts/lib/file-type.js index ede0441ba..9a2803e2a 100644 --- a/app/assets/javascripts/lib/archive/file-type.js +++ b/app/assets/javascripts/lib/file-type.js @@ -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); - } - } - }) + }; + }; + }); }); }); \ No newline at end of file diff --git a/app/assets/stylesheets/basic/global.css b/app/assets/stylesheets/basic/global.css index 811ed303d..61728dc52 100644 --- a/app/assets/stylesheets/basic/global.css +++ b/app/assets/stylesheets/basic/global.css @@ -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: ''; diff --git a/config/locales/new_ui.en.yml b/config/locales/new_ui.en.yml index bc586229b..21bdbfda2 100644 --- a/config/locales/new_ui.en.yml +++ b/config/locales/new_ui.en.yml @@ -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 diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb deleted file mode 100644 index c9274aab5..000000000 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb +++ /dev/null @@ -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 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb deleted file mode 100644 index b892d7549..000000000 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ /dev/null @@ -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 diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 2086da51a..165aeb726 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -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(); }); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_file.html.erb index 5d42da5ce..4e66fe1a9 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_file.html.erb @@ -1,26 +1,24 @@ <% if form_file.new_record? %>
<% else %> -
+
<% 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 %>
- <% if form_file.new_record? %> - - <% end %> + <% @site_valid_locales.each_with_index do |locale, i| %> diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb index 69dad760c..7ce3574fb 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb @@ -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(); }); diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form_file.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form_file.html.erb index e876d3438..baa912446 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form_file.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form_file.html.erb @@ -1,5 +1,13 @@ -
- <%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> +<% if form_file.new_record? %> +
+<% else %> +
+ <% 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 %>
- + <% @site_valid_locales.each_with_index do |locale, i| %> <%= 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 %> <% end %> @@ -24,11 +32,11 @@ - <%= f.text_field :sort_number , :class => "input-mini"%> + <%= f.text_field :sort_number , :class => "input-mini" %> - <%= t('archive.show_lang') %> +