Fix read more button text bug.

This commit is contained in:
BoHung Chiu 2021-09-15 22:02:59 +08:00
parent 687dcb8f8c
commit c116425287
1 changed files with 8 additions and 8 deletions

View File

@ -188,7 +188,7 @@ class EventNewsController < ApplicationController
if @tab_option == 0
event_news = get_event_news_for_pack_data(cats,tags,nil,is_random)
else
if cats.count != 1 || tags == ["all"] || (cats[0] != "all" && tags.count <= 1)
if cats.count != 1 || tags == ["all"]
cats.each do |cat|
event_news = event_news + get_event_news_for_pack_data([cat],tags,'')
end
@ -326,14 +326,14 @@ class EventNewsController < ApplicationController
var first_filter_tab = $("[data-subpart-id=\"'+subpart.id.to_s+'\"] .filter_tab").eq(0);
var read_more_url = first_filter_tab.data("read_more");
if(read_more_url.length != 0){
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .w-annc__more").attr("href",read_more_url);
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .w-annc__more").text(first_filter_tab.data("read_more_text"));
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .w-event_news__more").attr("href",read_more_url);
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .w-event_news__more").text(first_filter_tab.data("read_more_text"));
}
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .filter_tab").click(function(){
var read_more_url = $(this).data("read_more");
if(read_more_url.length != 0){
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .w-annc__more").attr("href",read_more_url);
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .w-annc__more").text($(this).data("read_more_text"));
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .w-event_news__more").attr("href",read_more_url);
$("[data-subpart-id=\"'+subpart.id.to_s+'\"] .w-event_news__more").text($(this).data("read_more_text"));
}
})
})
@ -357,7 +357,7 @@ class EventNewsController < ApplicationController
extra_html = "
<script>
$(document).ready(function(){
$(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-annc__more\").text(\"#{read_more_text}\");
$(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-event_news__more\").text(\"#{read_more_text}\");
})
</script>
"
@ -368,7 +368,7 @@ class EventNewsController < ApplicationController
$(document).ready(function(){
var read_more_position = #{@read_more_option};
var read_more_block = $(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-annc__more\");
var read_more_block = $(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-event_news__more\");
if(read_more_position == 1 || read_more_position == 2){
read_more_block.addClass(\"pull-left\");
}else{
@ -406,7 +406,7 @@ class EventNewsController < ApplicationController
read_more_url = read_more_url + "?" + {"category"=>all_cats,"tags"=>all_tags}.to_param if read_more_url != ""
extra_after_html += "
<script>
$(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-annc__more\").attr(\"href\",\"#{read_more_url}\");
$(\"[data-subpart-id=\\\"#{subpart.id}\\\"] .w-event_news__more\").attr(\"href\",\"#{read_more_url}\");
</script>
"
end