Commits

Akiko Takano committed 71c8968

Compatible with Redmine2.0.0.

Signed-off-by: Akiko Takano <akiko.pusu@gmail.com>

Comments (0)

Files changed (3)

app/models/site_feedback.rb

   
 
   def SiteFeedback.hide_anonymous?
-    return false unless Setting.plugin_redmine_site_feedback['hide_anonymous']
+    return false unless Setting.plugin_redmine_site_feedback['hide_anonymous'] == "true"
     return false if Setting.plugin_redmine_site_feedback['hide_anonymous'] == ""
     return true
   end
 
   def SiteFeedback.enable_feedback?
-    return false unless Setting.plugin_redmine_site_feedback['enable']
+    return false unless Setting.plugin_redmine_site_feedback['enable'] == "true"
     return false if Setting.plugin_redmine_site_feedback['enable'] == ""
+    return false if Setting.plugin_redmine_site_feedback['feedback_url'].blank?
     return true
   end
 end
+# -*- coding: utf-8 -*-
 require 'redmine'
-
 require 'site_feedback_application_hooks'
 
 Redmine::Plugin.register :redmine_site_feedback do
   name 'Redmine Site Feedback plugin'
   author 'Akiko Takano'
+  author_url 'http://twitter.com/akiko_pusu'  
   description 'Plugin to provide site-wide feedback tab for users to ease the process of accessing feedback forums, issue tracker & information.'
-  version '0.0.1'
-  requires_redmine :version_or_higher => '1.2.0'
+  version '0.0.2'
+  requires_redmine :version_or_higher => '2.0.0'
+  url 'https://bitbucket.org/akiko_pusu/redmine_site_feedback'
 
   settings :partial => 'settings/redmine_site_feedback',
     :default => {
       'hide_anonymous' => 'false',
       'hide_issue_show_page' => 'false',
       'feedback_url' => '',
-      'feedback_description' => 'フィードバック受付用のフォーム(URL)を表示します'
+      'feedback_description' => 'This description is shown as tooltip, title attribute, when mouse is over the feedback tab.'
     }
 end

lib/site_feedback_application_hooks.rb

+# -*- coding: utf-8 -*-
 class SiteFeedbackApplicationHooks < Redmine::Hook::ViewListener
   def view_layouts_base_body_bottom(context = { })
-
-    return '' unless Setting.plugin_redmine_site_feedback['enable']
+    settings = Setting.send "plugin_redmine_site_feedback"
+    return '' unless settings['enable'] == "true"
     return '' unless SiteFeedback.activate_tab?(User.current)
     if context[:controller].class.name == 'IssuesController' and \
       context[:controller].action_name != 'index' and \
-      Setting.plugin_redmine_site_feedback['hide_issue_show_page'] == "true"
+      settings['hide_issue_show_page'] == "true"
       return ''
     end
 
     # show feedback tab icon
-    img_src = image_path('feedback.png', :plugin=>'redmine_site_feedback')
-    title = Setting.plugin_redmine_site_feedback['feedback_description']
-
-    return "
-<img src=\"#{img_src}\" width=\"100\" height=\"20\"
-  title=\"#{title}\" alt=\"feedback\" id=\"feedback\"/>
-"
-
+    title = settings['feedback_description']
+    img_src = image_tag('feedback.png', :plugin => 'redmine_site_feedback', :title => title,
+      :width => 100, :height => 20, :alt => 'feedback', :id => 'feedback')    
+    return img_src
   end
 
   render_on :view_layouts_base_html_head, :partial => 'site_feedback/html_header'