diff --git a/Gemfile b/Gemfile index 6eccd600..ca660050 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,6 @@ gem 'rake' gem 'resque' # background jobs gem 'resque-scheduler' # job scheduling gem 'resque-restriction' -gem 'rb-readline' gem 'ruby-debug19' gem 'rubyzip' gem 'therubyracer' @@ -34,6 +33,8 @@ gem 'sinatra' gem 'sprockets' gem 'tinymce-rails' gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux") +gem 'rb-readline' if RUBY_PLATFORM.downcase.include?("linux") + gem "impressionist", :require => "impressionist", :path => "vendor/impressionist" diff --git a/Gemfile.lock b/Gemfile.lock index e21da804..776d0b32 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -168,7 +168,6 @@ GEM rdoc (~> 3.4) thor (~> 0.14.6) rake (0.9.2.2) - rb-readline (0.4.2) rdoc (3.12) json (~> 1.4) redis (2.2.2) @@ -302,7 +301,6 @@ DEPENDENCIES radius rails (>= 3.1.0, < 3.2.0) rake - rb-readline resque resque-restriction resque-scheduler diff --git a/app/models/app_manager.rb b/app/models/app_manager.rb index 46cbbb91..0d81a0ec 100644 --- a/app/models/app_manager.rb +++ b/app/models/app_manager.rb @@ -1,7 +1,7 @@ class AppManager include Mongoid::Document include Mongoid::Timestamps - + belongs_to :user belongs_to :managing_app, :polymorphic => true #,:class_name => 'ModuleApp',:inverse_of => :managers,:foreign_key => "user_id" diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 7ad4ac1d..9708316f 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -4,7 +4,7 @@ class ModuleApp include OrbitCoreLib::ObjectTokenUnility field :key - field :title + field :title field :version field :organization field :author @@ -16,8 +16,8 @@ class ModuleApp field :app_pages ,type: Array field :widgets ,type: Array - has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app - has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app + has_many :managers,as: :managing_app ,:class_name => "AppManager" ,:dependent => :destroy#,:foreign_key => "managing_app_id",:inverse_of => :managing_app + has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager", :dependent => :destroy#,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app has_many :tags has_many :page_parts diff --git a/app/models/user/user.rb b/app/models/user/user.rb index 7c1e4c63..4f820c16 100644 --- a/app/models/user/user.rb +++ b/app/models/user/user.rb @@ -17,10 +17,10 @@ class User has_many :attribute_values, :autosave => true, :dependent => :destroy has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists - has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth" - has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth" + has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth", :dependent => :destroy + has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth", :dependent => :destroy - has_many :managing_apps,:class_name => "AppManager" + has_many :managing_apps,:class_name => "AppManager", :dependent => :destroy belongs_to :role has_and_belongs_to_many :sub_roles diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 73b5191a..26925aee 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -12,7 +12,7 @@ <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class =>( active_for_action('bulletin_categorys', 'index') || active_for_ob_auths_object("BulletinCategory") ) %> <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %> - <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %> + <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue true) %> <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_for_app_auth('Announcement') if (is_admin? rescue nil) %> <% end -%> @@ -26,7 +26,7 @@ <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') || active_for_ob_auths_object("NewsBulletinCategory") %> <%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %> - <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %> + <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue true) %> <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_for_app_auth('news') if (is_admin? rescue nil) %> <% end -%> diff --git a/config/resque.god b/config/resque.god index 80da5abe..aa9cb0b4 100644 --- a/config/resque.god +++ b/config/resque.god @@ -2,7 +2,7 @@ default_uid = 'kaito' default_gid = 'staff' -rails_env = 'development' #ENV['RAILS_ENV'] || "production" +rails_env = ENV['RAILS_ENV'] || "production" rails_root = ENV['RAILS_ROOT'] || File.expand_path("..",File.dirname(__FILE__)) @@ -17,10 +17,10 @@ num_workers.times do |num| w.interval = 30.seconds p "/usr/bin/rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}" # w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env} - w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}" + w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env} -P /var/godgod.#{port}.pid" - w.uid = rails_env == 'production' ? nccu : default_uid - w.gid = rails_env == 'production' ? nccu : default_gid + w.uid = rails_env == 'production' ? "nccu" : default_uid + w.gid = rails_env == 'production' ? "nccu" : default_gid w.log = "#{rails_root}/log/god.log" diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb index c384bc8f..49f24079 100644 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb @@ -6,4 +6,10 @@ module Panel::Announcement::BackEnd::BulletinsHelper by_bulletin and by_user end + def show_delete_link(bulletin) + by_bulletin = (bulletin.create_user_id == current_user.id) + by_user = (is_manager? or is_admin?) + by_bulletin or by_user + end + end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb index 8f879e79..afb57306 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -48,12 +48,12 @@