From aa53128c303a2006ea19be74d41d716918632c18 Mon Sep 17 00:00:00 2001 From: rulingcom Date: Wed, 13 May 2026 15:59:46 +0800 Subject: [PATCH] Add image size selection feature --- .../universal_tables_controller.rb | 60 +++++++++++++------ modules/universal_table/index.html.erb | 36 ++++++++++- modules/universal_table/index2.html.erb | 36 ++++++++++- modules/universal_table/index3.html.erb | 37 +++++++++++- modules/universal_table/index4.html.erb | 37 +++++++++++- modules/universal_table/index5.html.erb | 36 ++++++++++- modules/universal_table/show.html.erb | 36 ++++++++++- 7 files changed, 254 insertions(+), 24 deletions(-) diff --git a/app/controllers/universal_tables_controller.rb b/app/controllers/universal_tables_controller.rb index c1d64ae..2c5dc0d 100755 --- a/app/controllers/universal_tables_controller.rb +++ b/app/controllers/universal_tables_controller.rb @@ -200,12 +200,20 @@ class UniversalTablesController < ApplicationController ct = ce.table_column next if ct.nil? text = ce.get_frontend_text(ct) - rows << { - "title" => ct.title, - "text" => text, - "order" => ct.order - } if text != "" - end + row_item = { + "title" => ct.title, + "text" => text, + "order" => ct.order + } + + if ct.type == "image" && ce.image.present? + row_item["img_src"] = ce.image.url + row_item["img_thumb"] = ce.image.thumb.url + row_item["img_mobile"] = ce.image.mobile.url + end + + rows << row_item if text != "" + end sorted = rows.sort{ |k,v| k["order"] <=> v["order"] } sorted << { "title" => t("universal_table.hashtags"), @@ -223,12 +231,20 @@ class UniversalTablesController < ApplicationController if ct.is_link_to_show text = "#{text}" end - rows << { - "title" => ct.title, - "text" => text, - "url" => OrbitHelper.url_to_show(e.to_param) - } if text != "" - end + row_item = { + "title" => ct.title, + "text" => text, + "order" => ct.order + } + + if ct.type == "image" && ce.image.present? + row_item["img_src"] = ce.image.url + row_item["img_thumb"] = ce.image.thumb.url + row_item["img_mobile"] = ce.image.mobile.url + end + + rows << row_item if text != "" + end rows << { "title" => t("universal_table.hashtags"), "text" => e.tags_for_frontend @@ -421,14 +437,22 @@ class UniversalTablesController < ApplicationController tablecolumns.each do |column| ce = te.column_entries.where(:table_column_id => column.id).first rescue nil if !ce.nil? - text = ce.get_frontend_text(column) - if column.is_link_to_show - text = "#{text}" - end + text = ce.get_frontend_text(column) + if column.is_link_to_show + text = "#{text}" + end - cols << {"text" => text} + col_data = {"text" => text} + + if column.type == "image" && ce.image.present? + col_data["img_src"] = ce.image.url + col_data["img_thumb"] = ce.image.thumb.url + col_data["img_mobile"] = ce.image.mobile.url + end + + cols << col_data else - cols << {"text" => ""} + cols << {"text" => ""} end end text = te.hashtags_for_frontend diff --git a/modules/universal_table/index.html.erb b/modules/universal_table/index.html.erb index fd697ce..b75e199 100755 --- a/modules/universal_table/index.html.erb +++ b/modules/universal_table/index.html.erb @@ -116,7 +116,7 @@ - {{text}} + {{text}} @@ -124,7 +124,41 @@
{{export_button}}
{{pagination_goes_here}}