From 02e3184945f2e04a0108feeba09989ade47f9db6 Mon Sep 17 00:00:00 2001 From: binarygit Date: Wed, 31 Aug 2022 10:25:55 +0545 Subject: [PATCH] Replace angular tooltips in Primary Details tab --- .../admin/enterprises/form/_permalink.html.haml | 9 +++------ .../enterprises/form/_primary_details.html.haml | 12 ++++-------- app/views/admin/shared/_tooltip.html.haml | 3 +-- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/app/views/admin/enterprises/form/_permalink.html.haml b/app/views/admin/enterprises/form/_permalink.html.haml index 910aa086a2..28867e9392 100644 --- a/app/views/admin/enterprises/form/_permalink.html.haml +++ b/app/views/admin/enterprises/form/_permalink.html.haml @@ -3,8 +3,7 @@ .row .three.columns.alpha = label_tag :permalink, t('.permalink') - %div{'ofn-with-tip' => t('.permalink_tip', link: main_app.root_url)} - %a= t('admin.whats_this') + = render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.permalink_tip', link: main_app.root_url)} .eight.columns = text_field_tag "enterprise[permalink]", @enterprise.permalink, data: { action: "input->permalink#validate", "permalink-target": "permalinkField" } .two.columns.omega @@ -21,15 +20,13 @@ .row .three.columns.alpha %label= t('.link_to_front') - %div{'ofn-with-tip' => t('.link_to_front_tip')} - %a= t('admin.whats_this') + = render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.link_to_front_tip')} .eight.columns.omega - front_shop_path = "#{main_app.root_url}#{@enterprise.permalink}/shop" = link_to front_shop_path, front_shop_path , target: "_blank" .row .three.columns.alpha = label_tag :id, t('.ofn_uid') - %div{'ofn-with-tip' => t('.ofn_uid_tip')} - %a= t('admin.whats_this') + = render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.ofn_uid_tip')} .six.columns = @enterprise.id diff --git a/app/views/admin/enterprises/form/_primary_details.html.haml b/app/views/admin/enterprises/form/_primary_details.html.haml index 9ada528942..e2b5e4959f 100644 --- a/app/views/admin/enterprises/form/_primary_details.html.haml +++ b/app/views/admin/enterprises/form/_primary_details.html.haml @@ -8,15 +8,13 @@ .row .three.columns.alpha = f.label :group_ids, t('.groups') - %div{'ofn-with-tip' => t('.groups_tip')} - %a= t('admin.whats_this') + = render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.groups_tip')} .eight.columns.omega = f.collection_select :group_ids, @groups, :id, :name, {}, data: { controller: "tom-select", "tom-select-options-value": { plugins: ['remove_button'], maxItems: nil } }, class: "full-width", multiple: true, placeholder: t('.groups_placeholder') .row .three.columns.alpha %label= t('.primary_producer') - %div{'ofn-with-tip' => t('.primary_producer_tip')} - %a= t('admin.whats_this') + = render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.primary_producer_tip')} .five.columns.omega = f.check_box :is_primary_producer, data: { action: "change->primary-details#primaryProducerChanged" } = f.label :is_primary_producer, t('.producer') @@ -24,8 +22,7 @@ .row .three.columns.alpha = f.label :sells, t('.sells') - %div{'ofn-with-tip' => t('.sells_tip')} - %a= t('admin.whats_this') + = render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.sells_tip')} .two.columns = f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells', data: {action: "change->primary-details#enterpriseSellsChanged"} = f.label :sells, t('.none'), value: "none" @@ -38,8 +35,7 @@ .row .three.columns.alpha %label= t('.visible_in_search') - %div{'ofn-with-tip' => t('.visible_in_search_tip')} - %a= t('admin.whats_this') + = render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.visible_in_search_tip')} .two.columns = f.radio_button :visible, "public", 'ng-model' => 'Enterprise.visible' = f.label :visible, t('.visible'), value: 'public' diff --git a/app/views/admin/shared/_tooltip.html.haml b/app/views/admin/shared/_tooltip.html.haml index 7fe456bcf4..3d0f140518 100644 --- a/app/views/admin/shared/_tooltip.html.haml +++ b/app/views/admin/shared/_tooltip.html.haml @@ -2,6 +2,5 @@ %a{"data-tooltip-target": "element", "data-action": "mouseenter->tooltip#showTooltip mouseleave->tooltip#hideTooltip"}= t('admin.whats_this') .tooltip-container .tooltip{"data-tooltip-target": "tooltip"} - = tooltip_text + = sanitize tooltip_text .arrow{"data-tooltip-target": "arrow"} -