diff --git a/app/controllers/universal_tables_controller.rb b/app/controllers/universal_tables_controller.rb index 31f73a4..f76f9c3 100644 --- a/app/controllers/universal_tables_controller.rb +++ b/app/controllers/universal_tables_controller.rb @@ -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 diff --git a/lib/universal_table/engine.rb b/lib/universal_table/engine.rb index b070345..7e65ed3 100644 --- a/lib/universal_table/engine.rb +++ b/lib/universal_table/engine.rb @@ -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'}, diff --git a/modules/universal_table/_tag_cloud.html.erb b/modules/universal_table/_tag_cloud.html.erb new file mode 100644 index 0000000..32f95c0 --- /dev/null +++ b/modules/universal_table/_tag_cloud.html.erb @@ -0,0 +1 @@ +hi \ No newline at end of file