Add read more display none option.

This commit is contained in:
BoHung Chiu 2023-02-18 08:19:42 +08:00
parent 9c7c25bd98
commit 74dbad4a5b
4 changed files with 30 additions and 25 deletions

View File

@ -417,32 +417,35 @@ class AnnouncementsController < ApplicationController
if (@read_more_option != 0 rescue false)
extra_html += "
<script style=\"display:none\">
$(document).ready(function(){
var read_more_position = #{@read_more_option};
var read_more_block = $(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-annc__more\");
if(read_more_position == 1 || read_more_position == 2){
read_more_block.addClass(\"pull-left\");
if(read_more_position == 5){
read_more_block.css('display', 'none');
}else{
read_more_block.addClass(\"pull-right\");
}
if(read_more_position == 1 || read_more_position == 3){
var first_element = $(\"[data-subpart-id=\\\"#{subpart.id}\\\"] > *:eq(0)\");
var div_clearfix = $('<div class=\"clearfix\"></div>')
if(first_element.height() == 0){
read_more_block.appendTo(div_clearfix);
if(read_more_position == 1 || read_more_position == 2){
read_more_block.addClass(\"pull-left\");
}else{
div_clearfix = read_more_block;
read_more_block.addClass(\"pull-right\");
}
first_element.before(div_clearfix);
var annc_title = $(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-annc__widget-title\").eq(0);
if(annc_title.length != 0){
read_more_block.appendTo(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-annc__widget-title:eq(0)\");
if(read_more_position == 1 || read_more_position == 3){
var first_element = $(\"[data-subpart-id=\\\"#{subpart.id}\\\"] > *:eq(0)\");
var div_clearfix = $('<div class=\"clearfix\"></div>')
if(first_element.height() == 0){
read_more_block.appendTo(div_clearfix);
}else{
div_clearfix = read_more_block;
}
first_element.before(div_clearfix);
var annc_title = $(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-annc__widget-title\").eq(0);
if(annc_title.length != 0){
read_more_block.appendTo(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-annc__widget-title:eq(0)\");
}
}else{
var div_clearfix = $('<div class=\"clearfix\"></div>');
read_more_block.appendTo(div_clearfix);
$(\"[data-subpart-id=\\\"#{subpart.id}\\\"] > *:eq(-1)\").after(div_clearfix);
}
}else{
var div_clearfix = $('<div class=\"clearfix\"></div>');
read_more_block.appendTo(div_clearfix);
$(\"[data-subpart-id=\\\"#{subpart.id}\\\"] > *:eq(-1)\").after(div_clearfix);
}
})
</script>
@ -491,7 +494,7 @@ class AnnouncementsController < ApplicationController
def get_tabs_option
subpart = OrbitHelper.get_current_widget
tab_options = ["not_enable_tabs","enable_tabs_with_categories_include_all","enable_tabs_with_categories"]
read_more_options = ['default','upper_left','lower_left','upper_right','lower_right']
read_more_options = ['default','upper_left','lower_left','upper_right','lower_right', 'display_none']
all_setting_options = ['the_same_as_data_count','display_all_in_other_tabs']
@tab_option = 0
@read_more_option = 0

View File

@ -39,10 +39,11 @@ en:
display_all_in_other_tabs: Display all contents in other tabs
read_more_position_options: '"read more" button position'
default: Default
upper_left: Upper left
lower_left: Lower left
upper_right: Upper right
lower_right: Lower right
upper_left: Upper Left
lower_left: Lower Left
upper_right: Upper Right
lower_right: Lower Right
display_none: Display None
tabs_options: Tabs options
not_enable_tabs: Not enable tabs
enable_tabs_with_categories_include_all: Enable tabs with categories(include all)

View File

@ -44,6 +44,7 @@ zh_tw:
lower_left: 左下
upper_right: 右上
lower_right: 右下
display_none: 隱藏
tabs_options: 頁籤選項
not_enable_tabs: 無頁籤
enable_tabs_with_categories_include_all: 開啟頁籤(依類別,並包含全部所選類別之頁籤)

View File

@ -24,7 +24,7 @@ module Announcement
value2_item2 = {}
key1_options = ['small_size','medium_size','orignal_size']
key2_options = ['not_enable_tabs','enable_tabs_with_categories_include_all','enable_tabs_with_categories']
key3_options = ['default','upper_left','lower_left','upper_right','lower_right']
key3_options = ['default','upper_left','lower_left','upper_right','lower_right', 'display_none']
key4_options = ['the_same_as_data_count','display_all_in_other_tabs']
key1_options.each_with_index do |k,i|
key1_attr[i] = {}