add hashtag widget

This commit is contained in:
rulingcom 2025-06-09 21:27:49 +08:00
parent 4aa3e25e72
commit 71e4201fed
3 changed files with 19 additions and 2 deletions

View File

@ -434,4 +434,20 @@ class UniversalTablesController < ApplicationController
"mind_map_data" => mindmap.mind_map_data
}
end
def tag_cloud
tables = UTable.filter_by_widget_categories(OrbitHelper.widget_categories,false)
tags = TableTag.where(:u_table_id.in => tables.pluck(:id))
hashtags = tags.map do |tag|
{
"title" => "##{tag.title}",
"count" => tag.table_entries.count,
"url_to_show" => "#{OrbitHelper.widget_more_url}?tag=#{tag.title}"
}
end
{
"hashtags" => hashtags,
"extras" => {}
}
end
end

View File

@ -19,7 +19,7 @@ module UniversalTable
OrbitApp.registration "UniversalTable", :type => "ModuleApp" do
module_label "universal_table.universal_table"
base_url File.expand_path File.dirname(__FILE__)
widget_methods ["widget"]
widget_methods ["widget","tag_cloud"]
widget_settings [{"data_count"=>30}]
# taggable "Bulletin"
categorizable
@ -38,7 +38,7 @@ module UniversalTable
:priority=>1,
:active_for_action=>{'admin/universal_table'=>'index'},
:available_for => 'users'
context_link 'universal_table.new_table',
context_link 'universal_table.new_table',
:link_path=>"new_admin_universal_table_path" ,
:priority=>2,
:active_for_action=>{'admin/universal_tables'=>'new'},

View File

@ -0,0 +1 @@
hi