diff --git a/README.rdoc b/README.rdoc index b237aa4..eea1a0d 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,3 +1,3 @@ -= Bulletin += CurationPost This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/Rakefile b/Rakefile index ccd84f8..efcca7b 100644 --- a/Rakefile +++ b/Rakefile @@ -8,7 +8,7 @@ require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Announcement' + rdoc.title = 'Curation' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.rdoc') rdoc.rdoc_files.include('lib/**/*.rb') diff --git a/announcement.gemspec b/announcement.gemspec deleted file mode 100644 index fa041d1..0000000 --- a/announcement.gemspec +++ /dev/null @@ -1,339 +0,0 @@ -# encoding: UTF-8 -$:.push File.expand_path("../lib", __FILE__) -# Maintain your gem's version: -require "announcement/version" -require 'json' -require 'yaml' -require 'fileutils' -bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install' -if bundle_update_flag - env_pwd = ENV['PWD'] - begin - require ::File.expand_path('app/helpers/bundler_helper.rb', env_pwd) - extend BundlerHelper - rescue LoadError - def bundler_with_clean_env(&block) - if block_given? - if Bundler.respond_to?(:with_unbundled_env) - Bundler.with_unbundled_env(&block) - else - Bundler.with_clean_env(&block) - end - end - end - end - if File.exist?("#{env_pwd}/app/models/google.rb") - FileUtils.rm("#{env_pwd}/app/models/google.rb", :force => true) - end - if Dir.exist?("#{env_pwd}/app/models/concern") - FileUtils.rm_r("#{env_pwd}/app/models/concern", :force => true) - end - app_path = File.expand_path(__dir__) - template_path = env_pwd + '/app/templates' - all_template = Dir.glob(template_path+'/*/') - puts 'editing files for sassc' - use_local_gemfile = File.exist?(env_pwd + '/.use_local_gemfile') - new_gemfile_text = File.read(app_path+'/temp_file/Gemfile') - old_gemfile_text = File.read(env_pwd+'/Gemfile') - check_texts = ['@import "../../bootstrap/variables";',".response-content {\n justify-self: auto;\n}\n"] - git_url = bundler_with_clean_env{%x[cd '#{env_pwd}' && git config --get remote.origin.url].split("\n")[0]} - git_remote = bundler_with_clean_env{%x[cd '#{env_pwd}' && git remote].split("\n")[0]} - if !(git_url.include?('//ruling.digital/git')) && !(File.exist?("#{env_pwd}/custom_git.txt")) - puts 'changing remote url' - bundler_with_clean_env{system("cd #{env_pwd} && git remote set-url #{git_remote} https://ruling.digital/git")} - end - default_announcement_widget_info = JSON.parse(File.read("#{app_path}/modules/announcement/info.json"))["widgets"].sort_by{|h| h["filename"].to_i} rescue [] - all_template.each do |folder| - if !folder.include?('mobile') - begin - if folder.split('/')[-1] != 'mobile' - bundler_with_clean_env{%x[cp -rf #{app_path}/temp_file/templates/javascripts/* #{folder}assets/javascripts/plugin/.]} - unity_text = File.open(folder+'assets/stylesheets/template/base/_unity.scss','r:UTF-8') do |f| - f.read - end rescue '' - if unity_text.split(/\n/).join.strip.empty? - File.open(folder+'assets/stylesheets/template/base/_unity.scss', 'a') do |file| - file.puts "@charset \"utf-8\";\n\n@import \"variables\";\n\n// Title\n.unity-title {\n margin: 0.5em 0;\n line-height: 1.5;\n font-family: $main-font;\n font-size: $font-h1;\n\n .layout-footer & {\n margin-bottom: 10px;\n border-bottom: none;\n\n span {\n display: inline;\n margin-bottom: 0;\n border-bottom: none;\n }\n }\n}\n\n.status {\n font-family: $main-font;\n font-size: 0.75rem;\n}\n\n.status-top {\n background-color: $theme-color-second;\n}\n\n.status-hot {\n background-color: $theme-color-third;\n}\n\n.status-source {\n background-color: $theme-color-main;\n\n a {\n color: $theme-white;\n }\n}\n" - end - end - filename = folder+'assets/stylesheets/template/base/_variables.scss' - texts = File.open(filename,'r:UTF-8') do |f| - f.read - end.force_encoding('UTF-8').gsub(/(\r\n){2,}/, "\r\n") - s1 = texts.scan(/{|}/) - if s1.count % 2 != 0 - i = texts.rindex(s1[-1]) - texts[i] = "" - end - regex_pattern = /((?=^)[ \t\r\n]*)*\.response-content {\n justify-self: auto;\n}[\r\n]*|((?=^)[ \t\r\n]*)*\.response-content {\n position: static;\n}[\r\n]*|((?=^)[ \t\r\n]*)*\.response-content {\n position: relative;\n}[\r\n]*/m #|((?=^)[ \t\r\n]*)*\.response-content[^{]*{[^}]*@media[^{]*{[^{]*}[^{]*@media[^{]*{[^{]*}[^}]*}[^}]*} - if !texts.include? "$font-h1:" - texts = "$font-h1: 1.5rem;\n$font-h2: 1.35rem;\n$font-h3: 1.2rem;\n$font-h4: 1.1rem;\n$font-h5: 1rem;\n$font-h6: 0.9rem;\n\n" + texts - end - if !texts.include? "$main-font:" - texts = "$main-font: Arial, \"微軟正黑體\", \"Helvetica Neue\", Helvetica, sans-serif;\n" + texts - end - if !texts.include? "$theme-white" - texts = "$theme-white: #fff;\n" + texts - end - File.open(filename,'w') do |f| - f.write texts - end - tp_text = File.read(folder+'assets/stylesheets/template/template.scss').force_encoding('UTF-8') rescue '' - tp_last_text = tp_text - tp_text.scan(/@import.*http.*;/).each do |pat| - if pat.scan(/@import\W+url/).count==0 - pat1 = pat.sub(/@import\W/,"@import url(") - pat1 = pat1.sub(/;/,");") - tp_last_text = tp_last_text.sub(pat,pat1) - end - end - if tp_last_text != tp_text - File.open(folder+'assets/stylesheets/template/template.scss','w') do |f| - f.write tp_last_text - end - end - texts = texts.gsub(/\n{2,}/,"\n") - auto_save_array = texts.scan(regex_pattern) - if auto_save_array.count > 1 - auto_save_text = auto_save_array.join('') - File.open(folder+'assets/stylesheets/template/base/_autobackup.bak', 'a') do |file| - file.puts auto_save_text - end - texts = texts.gsub(regex_pattern,"") - File.open(filename, 'w') do |file| - file.write (texts) - end - end - check_texts.each do |check_text| - if !texts.include?(check_text) - puts "editing #{folder}assets/stylesheets/template/base/_variables.scss" - texts = texts + "\n" + check_text - File.open(filename, 'w') do |file| - file.write(texts) - end - end - end - end - rescue => e - puts "not found #{folder}assets/stylesheets/template/base/_variables.scss" - end - begin - puts "updating announcement show page" - bundler_with_clean_env{%x[cp -f #{app_path}/modules/announcement/show.html.erb #{folder}modules/announcement/show.html.erb]} - rescue - puts "There has some error in updating announcement show page" - end - info_json_file = "#{folder}modules/announcement/info.json" - if File.exist?(info_json_file) - begin - file_text = File.read(info_json_file) rescue "" - encode_file_text = file_text.encode("UTF-8", "UTF-8", invalid: :replace, replace: "???") - next if (encode_file_text.include?("???") rescue true) - info = JSON.parse(encode_file_text) rescue {} - flag = (info.count != 0 rescue false) - if flag - puts "Checking announcement widgets" - widget_info = info["widgets"].sort_by{|h| h["filename"].to_i} rescue [] - update_flag = false - last_index = widget_info.collect{|v| v["filename"].to_s.scan(/\d+/).collect{|v1| v1.to_i}}.flatten.sort[-1] rescue nil - if !last_index.nil? - idx_regex = /^(\d+[\. \t]*)|[ \t]+$/ - default_announcement_widget_info.each do |h| - name_without_index = h["name"]["zh_tw"].gsub(idx_regex,'') - widget_info_index = (widget_info.index{|hh| hh["name"]["zh_tw"].gsub(idx_regex,'') == name_without_index}||-1 rescue -1) - if (widget_info_index == -1 || widget_info_index.nil?) - update_flag = true - copy_h = h.dup - h.delete("force_cover") - last_index = last_index + 1 - copy_h["filename"] = copy_h["filename"].sub(/\d+/){|ff| last_index.to_s} - copy_h["name"].keys.each do |locale| - copy_h["name"][locale] = copy_h["name"][locale].sub(/\d+/){|ff| last_index.to_s} - end - widget_info << copy_h - bundler_with_clean_env{%x[cp -f #{app_path}/modules/announcement/_#{h["filename"]}.html.erb #{folder}modules/announcement/_#{copy_h["filename"]}.html.erb]} - elsif h["force_cover"] == "true" - bundler_with_clean_env{%x[cp -f #{app_path}/modules/announcement/_#{h["filename"]}.html.erb #{folder}modules/announcement/_#{widget_info[widget_info_index]["filename"]}.html.erb]} - end - end - if update_flag - info["widgets"] = widget_info - puts "Writing json #{info["widgets"].count} in #{info_json_file}" - begin - info_json = JSON.pretty_generate(info).gsub(":[",":[\n").gsub(":{",":{\n") - rescue - info_json = info.to_s.gsub("=>",": \n") - end - File.open(info_json_file,"w+"){|f| f.write(info_json)} - end - bundler_with_clean_env{%x[cp -rn #{app_path}/modules/announcement/thumbs/* #{folder}modules/announcement/thumbs/.]} - end - end - rescue => e - puts e - puts "There has some error when checking announcement widgets" - end - end - end - end - if !use_local_gemfile && old_gemfile_text != new_gemfile_text - unicorn_rails = %x[which unicorn_rails].sub("\n",'') - puts 'updating gemfile' - if Dir["#{env_pwd}/config/secrets.yml"].length==0 - r = open("#{env_pwd}/config/environment.rb",'r'){|f| f.read()} - secret_key = r.scan(/Orbit::Application\.config\.secret_key_base = '(.*)'/).flatten[0] rescue nil - if !secret_key.nil? - open("#{env_pwd}/config/secrets.yml",'w+') do |f| - c = {"production"=> {"secret_key_base"=> secret_key},"development"=> {"secret_key_base"=> secret_key}} - c = c.to_yaml.sub("---\n",'') - f.write(c) - end - end - end - bundler_with_clean_env{%x[cp -f '#{env_pwd}'/Gemfile '#{env_pwd}'/Gemfile.bak123]} - bundler_with_clean_env{%x[cp -f '#{app_path}'/temp_file/Gemfile '#{env_pwd}'/Gemfile]} - check_version = %x[cd #{env_pwd} && git rev-list `git rev-parse --abbrev-ref HEAD` | grep 2f23511469505bd114df2c863a477a8730bcdefa] - if check_version.strip != '' #update mongoid version - command4 = "" - puts 'mongoid has been updated!' - else - command4 = ";mv #{env_pwd}/app/controllers/sessions_controller.rb #{env_pwd}/tmp/sessions_controller_backup.rb;cp -rf #{app_path}/temp_file/app #{env_pwd};cp -rf #{app_path}/temp_file/config #{env_pwd};rm #{env_pwd}/app/models/google.rb" - end - log_development = File.mtime(env_pwd+'/log/development.log').strftime('%Y%m%d%H%M').to_i rescue 0 - log_production = File.mtime(env_pwd+'/log/production.log').strftime('%Y%m%d%H%M').to_i rescue 0 - if log_development > log_production - mode = 'development' - else - mode = 'production' - end - files = Dir[env_pwd+'/Gemfile.lock'] - dir_name = env_pwd.split('/')[-1] - watch_dog = %x[screen -ls auto_reopen_#{dir_name}] - if watch_dog.scan("auto_reopen_#{dir_name}").count != 0 - bundler_with_clean_env{%x[screen -ls | grep auto_reopen_#{dir_name} | cut -d. -f1 | awk '{print $1}' | xargs kill]} - end - if %x[ruby -v].scan(/\d\.\d\.\d/)[0] == '2.1.3' - install_cmd = 'rvm install 2.1.10 && rvm use default 2.1.10;' - use_cmd = 'source ~/.rvm/scripts/rvm && rvm use 2.1.10 --default;' - else - install_cmd = '' - use_cmd = '' - end - #if files.count ==0 - # command1 = "gem install bundler -v 1.17.3 ; bundle update --all" - #else - if RUBY_VERSION.to_f==2.1 - command1 = "gem install bundler -v 1.17.3 ; bundle update --all" - #else - #command1 = "gem install bundler -v 2.3.3 ; bundle update --all" - end - #end - filedata = File.read(env_pwd+"/built_in_extensions.rb") - exist_str = "gem 'patchfile', git: 'http://gitlab.tp.rulingcom.com/chiu/patch_file.git'" - if filedata.include? exist_str - puts "patchfile exist" - else - file = env_pwd+"/built_in_extensions.rb" - open(file, 'a') { |f| - f.puts exist_str - } - end - all_command = "#{install_cmd} #{command1} #{command4} " - watch_dog_cmd = "watch -n 30 \'unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}\'" - #file = File.new(File.join(env_pwd,'bundle_update_background.sh'),"w") - #file.write(all_command) - #file.chmod(0755) - #file.close - restart_cmd = "UNICORN_PID=\"`fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock` `cat tmp/pids/unicorn.pid `\" && kill -s TERM $UNICORN_PID ; while (kill -0 $UNICORN_PID > /dev/null 2>&1) ; do printf '.' && sleep 1 ; done ; unset UNICORN_FD; bundle exec unicorn_rails -c config/unicorn.rb -D -E #{mode}" - - a = Thread.start do - bundler_with_clean_env do - puts env_pwd - puts mode - exec("cd #{env_pwd} && env -i HOME=\"$HOME\" bash -l -c \"#{all_command}\" ;screen -d -m -S auto_reopen_#{dir_name} bash -c \"#{use_cmd} #{restart_cmd};#{watch_dog_cmd}\" ") - end - end - now_priority = Thread.current.priority.to_i - system('sleep 2') - a.priority = now_priority + 2 - a.run - #Thread.exit - else - dir_name = env_pwd.split('/')[-1] - watch_dog = %x[screen -ls auto_reopen_#{dir_name}] - if watch_dog.scan("auto_reopen_#{dir_name}").count != 0 - bundler_with_clean_env{%x[screen -ls | grep auto_reopen_#{dir_name} | cut -d. -f1 | awk '{print $1}' | xargs kill]} - end - #system("cp -rf #{app_path}/temp_file/app #{env_pwd}") - end - c = open("#{env_pwd}/config/mongoid.yml",'r'){|f| f.read} - if c.scan(/^[ \t]*sessions\:/).length != 0 - c = c.gsub(/^([ \t]*)sessions\:/,'\1clients:') - r = YAML.load(c) - r.each do |mode,v1| - v1.each do |clients,d| - d.each do |k,v| - next if v.class != Hash - if !v["username"].nil? - if v["options"].nil? - v["options"] = {} - end - v["options"]["user"] = v["username"] - v.delete "username" - end - if !v["password"].nil? - if v["options"].nil? - v["options"] = {} - end - v["options"]["password"] = v["password"] - v.delete "password" - end - if !v["options"].nil? && !v["options"]["pool_size"].nil? - v["options"]["max_pool_size"] = v["options"]["pool_size"] - v["options"].delete "pool_size" - end - if !v["options"].nil? && v["options"]["read"].class == String - v["options"]["read"] = {"mode"=> v["options"]["read"]} - end - end - end - end - c = YAML.dump(r).sub("---\n",'') - open("#{env_pwd}/config/mongoid.yml",'w+'){|f| f.write(c)} - end - if !File.exist?("#{env_pwd}/.carrierwave_upgraded") - upgrading = File.exist?("#{env_pwd}/.carrierwave_upgrading") - File.open("#{env_pwd}/.carrierwave_upgrading", "w") {} - uploaders = Dir.chdir(env_pwd){ Dir.glob("app/uploaders/*") } - uploaders.each do |uploader| - if upgrading - bundler_with_clean_env{%x[cd #{env_pwd} && git checkout -- #{uploader}]} - end - uploader_contents = File.read("#{env_pwd}/#{uploader}") - uploader_contents.gsub!(/^[ \t]*require[ \t]+['"]carrierwave\/processing\/mime_types['"][ \t]*$/, '') - uploader_contents.gsub!(/^[ \t]*include[ \t]+CarrierWave::MimeTypes[ \t]*$/, '') - File.open("#{env_pwd}/#{uploader}", "w"){|f| f.write(uploader_contents)} - end - File.open("#{env_pwd}/.carrierwave_upgraded", "w") {} - end -end -# Describe your gem and declare its dependencies: -Gem::Specification.new do |s| - s.name = "announcement" - s.version = Announcement::VERSION - s.authors = ["RulingDigital"] - s.email = ["orbit@rulingcom.com"] - s.homepage = "http://www.rulingcom.com" - s.summary = "Announcements for Orbit" - s.description = "Announcements for Orbit" - s.license = "MIT" - s.metadata = { - "_require" => "#{File.expand_path("../app/models/announcement_setting", __FILE__)}", - "global_hash" => "{enable_manually_sort: (AnnouncementSetting.first.enable_manually_sort rescue false),enable_annc_dept: (AnnouncementSetting.first.enable_annc_dept rescue false), annc_depts_translations: (AnnouncementSetting.first.annc_depts_translations rescue {})}" - } - s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] - s.test_files = Dir["test/**/*"] - - s.add_dependency "rufus-scheduler", "~> 3.6.0" - s.add_dependency "mimemagic" , "0.3.9" -end diff --git a/app/controllers/admin/announcements_controller.rb b/app/controllers/admin/curations_controller.rb similarity index 52% rename from app/controllers/admin/announcements_controller.rb rename to app/controllers/admin/curations_controller.rb index 316818d..450e4d2 100644 --- a/app/controllers/admin/announcements_controller.rb +++ b/app/controllers/admin/curations_controller.rb @@ -1,67 +1,67 @@ # encoding: utf-8 require 'rubyXL' -class Admin::AnnouncementsController < OrbitAdminController - include Admin::AnnouncementsHelper +class Admin::CurationsController < OrbitAdminController + include Admin::CurationsHelper before_action ->(module_app = @app_title) { set_variables module_app } before_action :set_bulletin, only: [:edit, :destroy, :comment] before_action :load_access_level, :load_settings before_action :set_module_pages, only: [:edit,:new] def set_module_pages - @module_pages = Page.where(:module => 'announcement').collect{|p| [p.name,p.id] } + @module_pages = Page.where(:module => 'curation').collect{|p| [p.name,p.id] } end def initialize super - @app_title = "announcement" + @app_title = "curation" end def update_sort ids = params[:ids] ids.each_with_index do |id,i| - Bulletin.where(id: id).update(sort_number: i) + CurationPost.where(id: id).update(sort_number: i) end - AnnsCache.all.delete + CurationCache.all.delete edit_sort render 'update_sort',layout: false - + end def update_sort_setting setting = @announcement_setting setting.update_attributes(settings_params) if defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash - OrbitHelper::SharedHash['announcement'][:enable_manually_sort] = setting.enable_manually_sort + OrbitHelper::SharedHash['curation'][:enable_manually_sort] = setting.enable_manually_sort end - redirect_to edit_sort_admin_announcement_path + redirect_to edit_sort_admin_curation_path end - + def edit_sort - @setting = AnnouncementSetting.first - @announcements = Bulletin.where(is_top: true).order_by({is_top: -1,sort_number: 1,postdate: -1, _id: -1}) - @table_fields = ['announcement.table.sort_number','announcement.table.title','announcement.default_widget.postdate'] + @setting = CurationSetting.first + @announcements = CurationPost.where(is_top: true).order_by({is_top: -1,sort_number: 1,postdate: -1, _id: -1}) + @table_fields = ['curation.table.sort_number','curation.table.title','curation.default_widget.postdate'] end def comment_hidden - b = BulletinComment.find(params[:id]) rescue nil + b = CurationPostComment.find(params[:id]) rescue nil if !b.nil? b.is_hidden = !b.is_hidden b.save - @table_feed_fields = ["announcement.time", "announcement.comment", "announcement.account","ip","is_hidden"] - @comments = b.bulletin.bulletin_comments.reverse rescue [] + @table_feed_fields = ["curation.time", "curation.comment", "curation.account","ip","is_hidden"] + @comments = b.curation_post.curation_post_comments.reverse rescue [] render partial: 'comment' end end def comment - @table_feed_fields = ["announcement.time", "announcement.comment", "announcement.account","ip","is_hidden"] - @comments = @bulletin.bulletin_comments.reverse rescue [] + @table_feed_fields = ["curation.time", "curation.comment", "curation.account","ip","is_hidden"] + @comments = @bulletin.curation_post_comments.reverse rescue [] end def index - Bulletin.remove_expired_status + CurationPost.remove_expired_status @tags = @module_app.tags - @table_fields = [:status, :category, :title, :start_date, :end_date, "announcement.comment", :last_modified] - setting = AnnouncementSetting.first + @table_fields = [:status, :category, :title, :start_date, :end_date, "curation.comment", :last_modified] + setting = CurationSetting.first @annc_depts = [] @enable_annc_dept = false if (setting.enable_annc_dept rescue false) - @table_fields.insert(1, "announcement.annc_dept") + @table_fields.insert(1, "curation.annc_dept") @annc_depts = setting.annc_depts @enable_annc_dept = true end @@ -71,55 +71,55 @@ class Admin::AnnouncementsController < OrbitAdminController if current_user_is_sub_manager @categories = current_user.approved_categories.select{|c| c.module_app_id == @module_app.id} rescue [] @filter_fields = filter_fields(@categories, @tags) - @bulletins = Bulletin.where(:create_user_id=>current_user.id,:is_preview.in=>[false,nil]) + @bulletins = CurationPost.where(:create_user_id=>current_user.id,:is_preview.in=>[false,nil]) .order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")) .with_status(filters("status")) else - @bulletins = Bulletin.where(:uid=>nil) + @bulletins = CurationPost.where(:uid=>nil) @categories = @module_app.categories.enabled @filter_fields = filter_fields(@categories, @tags) end else @categories = @module_app.categories.enabled @filter_fields = filter_fields(@categories, @tags) - @bulletins = Bulletin.where(:is_preview.in=>[false,nil]) + @bulletins = CurationPost.where(:is_preview.in=>[false,nil]) .order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")) .with_status(filters("status")) end @bulletins = search_data(@bulletins,[:title]).page(params[:page]).per(10) - + if request.xhr? render :partial => "index" end end def get_all_anncs_without_subannc - Bulletin.remove_expired_status + CurationPost.remove_expired_status @tags = @module_app.tags @table_fields = [:category, :title, :start_date] @current_user = current_user - if AnnouncementSetting.first.is_display_edit_only && !current_user.is_admin? && !current_user.is_manager?(@module_app) + if CurationSetting.first.is_display_edit_only && !current_user.is_admin? && !current_user.is_manager?(@module_app) current_user_is_sub_manager = !current_user.is_manager?(@module_app) && (current_user.is_sub_manager?(@module_app) || current_user.is_sub_manager_with_role?(@module_app)) rescue false if current_user_is_sub_manager @categories = current_user.approved_categories.select{|c| c.module_app_id == @module_app.id} rescue [] @filter_fields = filter_fields(@categories, @tags) - @bulletins = Bulletin.where(:create_user_id=>current_user.id,:title.ne => "",:is_preview.in=>[false,nil]) + @bulletins = CurationPost.where(:create_user_id=>current_user.id,:title.ne => "",:is_preview.in=>[false,nil]) .order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")) .with_status(filters("status")) else - @bulletins = Bulletin.where(:uid=>nil) + @bulletins = CurationPost.where(:uid=>nil) @categories = @module_app.categories.enabled @filter_fields = filter_fields(@categories, @tags) end else @categories = @module_app.categories.enabled @filter_fields = filter_fields(@categories, @tags) - @bulletins = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]) + @bulletins = CurationPost.where(:title.ne => "",:is_preview.in=>[false,nil]) .order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")) @@ -133,17 +133,13 @@ class Admin::AnnouncementsController < OrbitAdminController render :layout => false end end - def feed - @table_feed_fields = ["announcement.feed_name",:tags , :category , "announcement.rssfeed", "announcement.jsonfeed"] - @feeds = BulletinFeed.all.asc(:created_at) - - end + def generate_iframe_url iframe_params = params.require(:iframe).permit! uids = iframe_params['member_ids'].to_a.map{|m_id| MemberProfile.find(m_id).uid rescue nil}.select{|uid| !uid.nil?} url_params = iframe_params.except(:member_ids) url_params['uids'] = uids if uids != [] - render :plain => '/xhr/panel/announcement/widget/sync_data?'+url_params.to_param + render :plain => '/xhr/panel/curation/widget/sync_data?'+url_params.to_param end def settings @setting = @announcement_setting @@ -164,16 +160,16 @@ class Admin::AnnouncementsController < OrbitAdminController def excel_format respond_to do |format| format.xlsx { - response.headers['Content-Disposition'] = 'attachment; filename="announcement_import_format.xlsx"' + response.headers['Content-Disposition'] = 'attachment; filename="curation_import_format.xlsx"' } end end def export_excel - @thread = Multithread.where(:key=>'export_announcements').first + @thread = Multithread.where(:key=>'export_curations').first update_flag = true if @thread.nil? - @thread = Multithread.create(:key=>'export_announcements',:status=>{:status=>'Processing'}) + @thread = Multithread.create(:key=>'export_curations',:status=>{:status=>'Processing'}) else update_flag = false if @thread.status[:status] == 'Processing' && @thread.respond_to?(:updated_at) && (@thread.updated_at > DateTime.now - 1.minute rescue false) if update_flag @@ -187,11 +183,11 @@ class Admin::AnnouncementsController < OrbitAdminController end Thread.new do begin - @announcements = Bulletin.where(:is_preview.ne=>true).desc(:id) - last_updated = [Bulletin.max(:updated_at).to_i, AnnouncementSetting.max(:updated_at).to_i].max - filename = "public/announcement_export_#{last_updated}.xlsx" + @announcements = CurationPost.where(:is_preview.ne=>true).desc(:id) + last_updated = [CurationPost.max(:updated_at).to_i, CurationSetting.max(:updated_at).to_i].max + filename = "public/curation_export_#{last_updated}.xlsx" if File.exist?(filename) - @thread.update(:status=>{:status=>'finish','finish_percent'=>100,'info'=>I18n.t('announcement.read_from_cache')}) + @thread.update(:status=>{:status=>'finish','finish_percent'=>100,'info'=>I18n.t('curation.read_from_cache')}) else excel_contents = render_to_string( handlers: [:axlsx], formats: [:xlsx] ,partial: 'export_excel.xlsx' ) File.open(filename, 'w') do |f| @@ -199,7 +195,7 @@ class Admin::AnnouncementsController < OrbitAdminController end end @thread.status[:file] = filename - @thread.status[:filename] = "announcement_export_#{DateTime.now.in_time_zone(Time.zone.utc_offset / 3600).strftime('%Y_%m_%d_%H%M')}.xlsx" + @thread.status[:filename] = "curation_export_#{DateTime.now.in_time_zone(Time.zone.utc_offset / 3600).strftime('%Y_%m_%d_%H%M')}.xlsx" @thread.save rescue => e @thread.status[:status] = 'error' @@ -209,7 +205,7 @@ class Admin::AnnouncementsController < OrbitAdminController end end end - redirect_to admin_announcement_import_path(:thread_id=>@thread.id.to_s) + # redirect_to admin_curation_import_path(:thread_id=>@thread.id.to_s) end def render_404 render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => 404, :formats => [:html] @@ -222,160 +218,42 @@ class Admin::AnnouncementsController < OrbitAdminController render_404 end end - def import_from_xml - download_tmp_xml params["import_xml"] - import_from_tmp_xml File.read(File.join(Rails.root, "tmp", "ann_cc_ntu.xml")) - redirect_to admin_announcements_path - end - - def import_from_wp - import_from_wordpress params["import_xml"].tempfile - redirect_to admin_announcements_path - end - - def importanns - workbook = RubyXL::Parser.parse(params["import_file"].tempfile) - raw_categories = @module_app.categories.asc(:created_at).to_a.map.with_index{|v, k| [k.to_s,v]}.to_h - raw_tags = @module_app.tags.asc(:created_at).to_a.map.with_index{|v, k| [k.to_s,v]}.to_h - categories = raw_categories.clone - tags = raw_tags.clone - sheet = workbook[0] - if sheet.count <= 503 - sheet.each_with_index do |row, i| - if i == 2 - begin - cats_text = row.cells[0].value.to_s.sub(/(^|,)\s*Example\s*:.*$/,'') - cats_keys = cats_text.split('->').map{|s| s.split(',')[-1].strip}[0...-1] - cats_values = cats_text.split('->')[1..-1].to_a.map{|s| s.strip.sub(/,\s*\d+$/,'')} - categories_relations = cats_keys.zip(cats_values).to_h - rescue => e - categories_relations = {} - end - begin - tags_text = row.cells[1].value.to_s.sub(/(^|,)\s*Example\s*:.*$/,'') - tags_keys = tags_text.split('->').map{|s| s.split(',')[-1].strip}[0...-1] - tags_values = tags_text.split('->')[1..-1].to_a.map{|s| s.strip.sub(/,\s*\d+$/,'')} - tags_relations = tags_keys.zip(tags_values).to_h - rescue => e - tags_relations = {} - end - if categories_relations.present? - categories = categories_relations.map do |k, v| - tmp = raw_categories[k] - if tmp && tmp.title.strip == v - [k, tmp] - else - tmp = raw_categories.detect{|kk, vv| vv.title.strip == v} - if tmp.nil? - tmp = @module_app.categories.create(:title_translations=> localize_data(v)) - end - [k, tmp] - end - end.to_h - end - if tags_relations.present? - tags = tags_relations.map do |k, v| - tmp = raw_tags[k] - if tmp && tmp.name.strip == v - [k, tmp] - else - tmp = raw_tags.detect{|kk, vv| vv.name.strip == v} - if tmp.nil? - tmp = @module_app.tags.create(:name_translations=> localize_data(v)) - end - [k, tmp] - end - end.to_h - end - end - next if i < 3 - v = row.cells.first.value rescue nil - next if v.blank? - import_this_announcement(row, categories, tags) - end - redirect_to admin_announcements_path - else - redirect_to admin_announcements_path(:error => "1") - end - end def createsettings - setting = AnnouncementSetting.new(settings_params) + setting = CurationSetting.new(settings_params) setting.save - redirect_to admin_announcement_settings_path + redirect_to admin_curation_settings_path end - + def updatesettings setting = @announcement_setting - ids = params['announcement_setting']['anns_status_settings'].to_a.collect do |i,v| + ids = params['curation_setting']['curation_status_settings'].to_a.collect do |i,v| v['_id'] end.compact - AnnsStatusSetting.where(:id.nin=>ids).destroy + CurationStatusSetting.where(:id.nin=>ids).destroy setting.update_attributes(settings_params) setting.save - redirect_to admin_announcement_settings_path - end - - def feedform - if params[:type] == "new" - @announcement_feed = BulletinFeed.new(id: nil) - render :partial => "feed_form" - else params[:type] == "edit" - @announcement_feed = BulletinFeed.find(params[:id]) - render :partial => "edit_feed_form" - end - end - - def createfeed - announcement_feed = BulletinFeed.new(feed_params) - announcement_feed.save - #BulletinFeed.create_feed_cache(nil,announcement_feed) - feeds = BulletinFeed.all.asc(:created_at) - render :partial => "feed", :collection => feeds - end - - def updatefeed - ann_feed = BulletinFeed.find(params[:id]) - ann_feed.update_attributes(feed_params) - ann_feed.save - #BulletinFeed.create_feed_cache(nil,ann_feed) - feeds = BulletinFeed.all.asc(:created_at) - render :partial => "feed", :collection => feeds - end - - def deletefeed - ann_feed = BulletinFeed.find(params[:id]) - ann_feed.destroy - feeds = BulletinFeed.all.asc(:created_at) - render :partial => "feed", :collection => feeds + redirect_to admin_curation_settings_path end def new @tags = @module_app.tags @statuses = [] - @bulletin = Bulletin.new + @bulletin = CurationPost.new @bulletin.email_sentdate = Time.now @reach_limit = @bulletin.check_status_limit(current_user,true) - if defined? Calendar - categories = user_authenticated_categories rescue ['all'] - if categories.first == "all" - @calendar_categories = CalendarType.all - else - @calendar_categories = CalendarType.where(:category_id.in => categories) rescue [] - end - end end def create bps = bulletin_params - bulletin = Bulletin.new(bps) - if !bps['bulletin_links_attributes'].nil? - bps['bulletin_links_attributes'].each do |idx,link| - bps['bulletin_links_attributes'].delete(idx.to_s) if link['url'].blank? + bulletin = CurationPost.new(bps) + if !bps['curation_post_links_attributes'].nil? + bps['curation_post_links_attributes'].each do |idx,link| + bps['curation_post_links_attributes'].delete(idx.to_s) if link['url'].blank? end end - if((!AnnouncementSetting.first.only_manager_can_edit_status) || (AnnouncementSetting.first.only_manager_can_edit_status && (@current_user.is_admin? || @current_user.is_manager?(@module_app))) ) - if bps[:is_top] == "1" && !AnnouncementSetting.check_limit_for_user(bulletin.create_user_id, bulletin.id) + if((!CurationSetting.first.only_manager_can_edit_status) || (CurationSetting.first.only_manager_can_edit_status && (@current_user.is_admin? || @current_user.is_manager?(@module_app))) ) + if bps[:is_top] == "1" && !CurationSetting.check_limit_for_user(bulletin.create_user_id, bulletin.id) bps[:is_top] = "0" bps[:top_end_date] = nil end @@ -385,12 +263,9 @@ class Admin::AnnouncementsController < OrbitAdminController bps[:is_hidden] = false end - if !defined?(Calendar).nil? - bps = update_calendar(bps,bulletin) - end bulletin.create_user_id = current_user.id bulletin.update_user_id = current_user.id - if AnnouncementSetting.is_pro? + if CurationSetting.is_pro? if user_can_approve? bulletin.approved = true else @@ -399,7 +274,7 @@ class Admin::AnnouncementsController < OrbitAdminController else bulletin.approved = true end - + bulletin.save build_email(bulletin,I18n.locale) Thread.new do @@ -411,7 +286,7 @@ class Admin::AnnouncementsController < OrbitAdminController def approve_bulletin id = params[:id] - bulletin = Bulletin.find(id) + bulletin = CurationPost.find(id) if params["approved"] == "true" bulletin.approved = true bulletin.rejected = false @@ -424,7 +299,7 @@ class Admin::AnnouncementsController < OrbitAdminController end bulletin.save #BulletinFeed.create_feed_cache(bulletin) - redirect_to admin_announcements_path + redirect_to admin_curation_path end def edit @@ -432,14 +307,6 @@ class Admin::AnnouncementsController < OrbitAdminController @reach_limit = @bulletin.check_status_limit(current_user,true) @tags = @module_app.tags @categories = @module_app.categories.enabled - if defined? Calendar - categories = user_authenticated_categories rescue ['all'] - if categories.first == "all" - @calendar_categories = CalendarType.all - else - @calendar_categories = CalendarType.where(:category_id.in => categories) rescue [] - end - end @statuses = [] @bulletin.email_sentdate = Time.now if @bulletin.email_sent == false else @@ -449,8 +316,8 @@ class Admin::AnnouncementsController < OrbitAdminController def update uid = params[:id].split('-').last - bulletin = Bulletin.find_by(:uid=>uid) - Bulletin.where(:copy_id=>bulletin.id.to_s).destroy + bulletin = CurationPost.find_by(:uid=>uid) + CurationPost.where(:copy_id=>bulletin.id.to_s).destroy bulletin.is_edit = true bulletin.save set_approved = bulletin.is_preview @@ -460,13 +327,13 @@ class Admin::AnnouncementsController < OrbitAdminController bps[:tags] = bps[:tags].blank? ? [] : bps[:tags] bps[:email_member_ids] = bps[:email_member_ids].blank? ? [] : bps[:email_member_ids] - if !bps['bulletin_links_attributes'].nil? - bps['bulletin_links_attributes'].each do |idx,link| - bps['bulletin_links_attributes'].delete(idx.to_s) if link['url'].blank? + if !bps['curation_post_links_attributes'].nil? + bps['curation_post_links_attributes'].each do |idx,link| + bps['curation_post_links_attributes'].delete(idx.to_s) if link['url'].blank? end end - if((!AnnouncementSetting.first.only_manager_can_edit_status) || (AnnouncementSetting.first.only_manager_can_edit_status && (@current_user.is_admin? || @current_user.is_manager?(@module_app))) ) - if bps[:is_top] == "1" && !AnnouncementSetting.check_limit_for_user(bulletin.create_user_id, bulletin.id) + if((!CurationSetting.first.only_manager_can_edit_status) || (CurationSetting.first.only_manager_can_edit_status && (@current_user.is_admin? || @current_user.is_manager?(@module_app))) ) + if bps[:is_top] == "1" && !CurationSetting.check_limit_for_user(bulletin.create_user_id, bulletin.id) bps[:is_top] = "0" bps[:top_end_date] = nil end @@ -494,38 +361,32 @@ class Admin::AnnouncementsController < OrbitAdminController bulletin.notify_feed("update") end #BulletinFeed.create_feed_cache(bulletin) - now_bulletin_page = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]) + now_bulletin_page = CurationPost.where(:title.ne => "",:is_preview.in=>[false,nil]) .order_by(sort).map(&:id).map.with_index.select{|v,i| v==bulletin.id}[0][1] rescue nil now_bulletin_page = now_bulletin_page.nil? ? 0 : ((now_bulletin_page+1).to_f/10).ceil - redirect_to admin_announcements_path(:page=>now_bulletin_page) + redirect_to admin_curations_path(:page=>now_bulletin_page) end def destroy @bulletin.destroy - Thread.new do - @bulletin.notify_feed("destroy") - end - redirect_to admin_announcements_path + redirect_to admin_curations_path end def delete if params[:ids] - Bulletin.any_in(:uid => params[:ids]).destroy_all - Thread.new do - Bulletin.notify_feed_delete(params[:ids]) - end + CurationPost.any_in(:uid => params[:ids]).destroy_all end if request.xhr? render :body => nil, :status => 204 else - redirect_to admin_announcements_path + redirect_to admin_curations_path end end def preview if params['preview_type'].eql?('edit') bulletin_data = bulletin_params - org_bulletin = Bulletin.find(params['bulletin_id']) + org_bulletin = CurationPost.find(params['bulletin_id']) bulletin = org_bulletin.clone bulletin.generate_uid bulletin.bulletin_files = [] @@ -534,16 +395,16 @@ class Admin::AnnouncementsController < OrbitAdminController bulletin.image = org_bulletin.image end - if !bulletin_data['bulletin_files_attributes'].blank? - bulletin_data['bulletin_files_attributes'].each do |key, bulletin_file| + if !bulletin_data['curation_post_files_attributes'].blank? + bulletin_data['curation_post_files_attributes'].each do |key, bulletin_file| next if !bulletin_file['_destroy'].blank? file = nil if bulletin_file['id'].blank? - file = BulletinFile.new(bulletin_file) + file = CurationPostFile.new(bulletin_file) file.bulletin_id = bulletin.id file.save else - org_file = BulletinFile.find(bulletin_file['id']) + org_file = CurationPostFile.find(bulletin_file['id']) file = org_file.clone file.bulletin_id = bulletin.id file.file = org_file.file @@ -557,15 +418,15 @@ class Admin::AnnouncementsController < OrbitAdminController end end - if !bulletin_data['bulletin_links_attributes'].blank? - bulletin_data['bulletin_links_attributes'].each do |key, bulletin_link| + if !bulletin_data['curation_post_links_attributes'].blank? + bulletin_data['curation_post_links_attributes'].each do |key, bulletin_link| next if !bulletin_link['_destroy'].blank? if bulletin_link['id'].blank? - link = BulletinLink.new(bulletin_link) + link = CurationPostLink.new(bulletin_link) link.bulletin_id = bulletin.id else - link = BulletinLink.find(bulletin_link['id']).clone + link = CurationPostLink.find(bulletin_link['id']).clone link.bulletin_id = bulletin.id bulletin_link.delete('id') bulletin_link.delete('_destroy') @@ -577,33 +438,33 @@ class Admin::AnnouncementsController < OrbitAdminController end end - bulletin_data.delete('bulletin_files_attributes') - bulletin_data.delete('bulletin_links_attributes') + bulletin_data.delete('curation_post_files_attributes') + bulletin_data.delete('curation_post_links_attributes') bulletin.update_attributes(bulletin_data) bulletin.copy_id = params['bulletin_id'] else - bulletin = Bulletin.new(bulletin_params) + bulletin = CurationPost.new(bulletin_params) end - + bulletin.is_preview = true bulletin.save #BulletinFeed.create_feed_cache(bulletin) render :plain=>page_for_bulletin(bulletin) + "?preview=true" end def get_preview_action - bulletin = Bulletin.find_by(:uid=>params['uid']) + bulletin = CurationPost.find_by(:uid=>params['uid']) is_not_edit = (!bulletin.is_edit) org_bulletin = bulletin.get_org_model - Bulletin.where(:copy_id=>org_bulletin.id.to_s).destroy + CurationPost.where(:copy_id=>org_bulletin.id.to_s).destroy if is_not_edit bulletin.destroy render :json=> {:success=>true,:action=>"close"} else - render :json=> {:success=>true,:action=>"redirect",:path=>edit_admin_announcement_path(:id=>org_bulletin.id)} + render :json=> {:success=>true,:action=>"redirect",:path=>edit_admin_curation_path(:id=>org_bulletin.id)} end end def destroy_preview - bulletin = Bulletin.find_by(:uid=>params['uid']) + bulletin = CurationPost.find_by(:uid=>params['uid']) if bulletin.is_preview bulletin.destroy end @@ -624,7 +485,7 @@ class Admin::AnnouncementsController < OrbitAdminController is_sent = !params[:resend_mail].eql?("true") if !params[:resend_mail].blank? doc = Nokogiri::HTML(bulletin.title_translations[locale]) title = doc.text.empty? ? 'no content' : doc.text - + bulletin.email.update_attributes( :create_user=>current_user, :mail_sentdate=>bulletin.email_sentdate, @@ -649,59 +510,22 @@ class Admin::AnnouncementsController < OrbitAdminController private def load_settings - @announcement_setting = AnnouncementSetting.first rescue nil + @announcement_setting = CurationSetting.first rescue nil if @announcement_setting.nil? - @announcement_setting = AnnouncementSetting.create + @announcement_setting = CurationSetting.create end end def set_bulletin - @bulletin = Bulletin.find(params[:id]) + @bulletin = CurationPost.find(params[:id]) end def bulletin_params - params[:bulletin][:email_sent] = params[:bulletin][:email_sent].nil? ? 0 : params[:bulletin][:email_sent] - params.require(:bulletin).permit! - end - - def feed_params - feed_params = params.require(:bulletin_feed).permit! - if feed_params[:tag_ids].nil? - feed_params[:tag_ids] = [] - end - if feed_params[:category_ids].nil? - feed_params[:category_ids] = [] - end - feed_params + params[:curation_post][:email_sent] = params[:curation_post][:email_sent].nil? ? 0 : params[:curation_post][:email_sent] + params.require(:curation_post).permit! end def settings_params - params.require(:announcement_setting).permit! - end - def update_calendar(bps,bulletin) - bps = bps.to_h.with_indifferent_access - if bps[:add_to_calendar] == '0' && !bps[:event_id].blank? - Event.find(bps[:event_id]).destroy rescue nil - bps[:event_id] = nil - elsif bps[:add_to_calendar] == '1' - event = Event.find(bps[:event_id]) rescue Event.new(create_user_id: current_user.id) - e_start = bps[:calendar_start_date].blank? ? bps[:postdate] : bps[:calendar_start_date] - e_start = Time.now.to_datetime if e_start.blank? - e_end = bps[:calendar_end_date].blank? ? bps[:deadline] : bps[:calendar_end_date] - #e_end = Time.now.to_datetime + 1.year if e_end.blank? - event.update_attributes(model_class: 'Bulletin', - module_key: 'announcement', - model_cat: bps[:category_id], - model_tags: bps[:tags], - model_page_id: bps[:page_id], - model_id: bulletin.id,start: e_start, - end: e_end,update_user_id: current_user.id, - all_day: bps[:calendar_all_day], - calendar_type_id: bps[:calendar_type_id], - title_translations: bps[:title_translations], - note_translations: bps[:subtitle_translations]) - bps[:event_id] = event.id - end - bps + params.require(:curation_setting).permit! end end diff --git a/app/controllers/announcement_feeds_controller.rb b/app/controllers/announcement_feeds_controller.rb deleted file mode 100644 index 1b334d5..0000000 --- a/app/controllers/announcement_feeds_controller.rb +++ /dev/null @@ -1,96 +0,0 @@ -require "rss" -class AnnouncementFeedsController < ApplicationController - include Admin::AnnouncementsHelper - def feed_add_remote - if params[:url].present? - uid = params[:uid].to_s - bulletin_feed = BulletinFeed.where(uid: uid).first - if !(bulletin_feed.remote_urls.include?(params[:url])) - bulletin_feed.remote_urls << params[:url] - bulletin_feed.save - end - end - render :json => {success: true} - end - def feed_remove_remote - if params[:url].present? - uid = params[:uid].to_s - bulletin_feed = BulletinFeed.where(uid: uid).first - if bulletin_feed.remote_urls.delete(params[:url]) - bulletin_feed.save - end - end - render :json => {success: true} - end - def feed - uid = params[:uid].to_s - startdt = params[:start].blank? ? nil : params[:start] - enddt = params[:end].blank? ? nil : params[:end] - dt = params[:date].blank? ? nil : params[:date] - feed_cache = BulletinFeedCache.where(uid: uid, start: startdt, end: enddt, date: dt) - feed_cache_old = feed_cache.all_of([{:invalid_date.ne=>nil},{:invalid_date.lte => Time.now}]).last - feed_cache.all_of([{:invalid_date.ne=>nil},{:invalid_date.lte => Time.now}]).destroy - count = feed_cache.count - if count > 1 - feed_cache.limit(count-1).destroy - end - feed_cache = feed_cache.first - anns = '' - if feed_cache.nil? - anns = BulletinFeed.where(uid: uid).first.generate_one_cache_timeout(startdt: startdt,enddt: enddt,dt: dt,base_url: request.base_url,timeout: 20) - anns = (feed_cache_old.content rescue "") if anns.nil? - else - anns = feed_cache.content - end - render :json => anns - end - - def rssfeed - uid = params[:uid].to_s - @bf = BulletinFeed.find_by(:uid => uid) rescue nil - if !@bf.nil? - tags = @bf.tag_ids - if !tags.empty? - @announcements = Bulletin.can_display_and_sorted.is_approved.filter_by_tags(tags) - else - @announcements = Bulletin.can_display_and_sorted.is_approved - end - categories = @bf.category_ids - if !categories.empty? - @announcements = @announcements.filter_by_categories(categories) - end - end - respond_to do |format| - format.html {redirect_to "/xhr/announcements/rssfeed/#{@bf.uid}.rss"} - format.rss - end - end - - def feeds - feeds = [] - BulletinFeed.all.each do |bf| - feed = {} - feed["title_translations"] = bf.title_translations - feed["uid"] = bf.uid - feed["url"] = "#{request.base_url}/xhr/announcements/feed/#{bf.uid}" - feed["xml_url"] = "#{request.base_url}/xhr/announcements/rssfeed/#{bf.uid}.rss" - feed["tags"] = [] - bf.tag_ids.each do |t| - tag = Tag.find(t) - d = {} - d["name_translations"] = tag.name_translations - feed["tags"] << d - end - feeds << feed - end - render :json => {"feeds" => feeds}.to_json - end - - -end - - - - - - diff --git a/app/controllers/bulletins_controller.rb b/app/controllers/curation_posts_controller.rb similarity index 98% rename from app/controllers/bulletins_controller.rb rename to app/controllers/curation_posts_controller.rb index c0193ee..c10cef8 100644 --- a/app/controllers/bulletins_controller.rb +++ b/app/controllers/curation_posts_controller.rb @@ -1,5 +1,5 @@ # encoding: utf-8 -class BulletinsController < ApplicationController +class CurationPostsController < ApplicationController before_filter :set_I18n def annc_depts_translations if defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash diff --git a/app/controllers/announcements_controller.rb b/app/controllers/curations_controller.rb similarity index 98% rename from app/controllers/announcements_controller.rb rename to app/controllers/curations_controller.rb index 76c2abd..fd53a34 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/curations_controller.rb @@ -1,6 +1,6 @@ -class AnnouncementsController < ApplicationController +class CurationsController < ApplicationController ViewRootDir = File.expand_path("../../views", __FILE__) - include AnnouncementsHelper + include CurationsHelper DefaultImgSrc = "/assets/announcement-default.jpg\" onerror=\"this.src="/assets/announcement-default-2.jpg";this.onerror='';" def initialize super @@ -300,7 +300,7 @@ class AnnouncementsController < ApplicationController end max_all_count = [OrbitHelper.widget_data_count,anns.count].min if @tab_option != 0 - OrbitHelper.set_widget_title(OrbitHelper.widget_title + + OrbitHelper.set_widget_title(OrbitHelper.widget_title + "
" + "