OSDN Git Service

implement(in progress): WorkTime plug-in extension. refs #1362 (http://www.r-labs...
authorAkira Saito <akrstjp@users.sourceforge.jp>
Sat, 21 Mar 2015 07:23:59 +0000 (16:23 +0900)
committerAkira Saito <akrstjp@users.sourceforge.jp>
Sat, 21 Mar 2015 07:23:59 +0000 (16:23 +0900)
app/views/hooks/_quick_view_issues_footer.html.erb
app/views/quick_view_issues/_settings.html.erb [new file with mode: 0644]
init.rb

index 31858df..11bde42 100644 (file)
@@ -9,8 +9,14 @@ var quick_view_click_event_object = null;
 $("tr.issue").click(quick_view_issue_click);
 $("tr.issue").dblclick(quick_view_issue_dblclick);
 
-quick_view_work_time_extension_init();
-$(document).ajaxComplete(quick_view_work_time_extension_init);
+<% if Setting.plugin_quick_view['worktime_ext_enabled'] %>
+if ($("body").hasClass("controller-work_time")) {
+  quick_view_work_time_extension_init();
+
+  <% if Setting.plugin_quick_view['worktime_ext_tooltip_enabled'] %>
+  quick_view_work_time_extension_tooltip_init();
+  <% end %>
+}
 
 function quick_view_work_time_extension_init(){
   var links = $(".wt_iss_link");
@@ -27,7 +33,11 @@ function quick_view_work_time_extension_init(){
      $(anchor_html).insertAfter(insertTo);
      link.addClass("has_quick_view_anchor");
   });
+  $(document).ajaxComplete(quick_view_work_time_extension_init);
+}
 
+function quick_view_work_time_extension_tooltip_init() {
+  var links = $(".wt_iss_link");
   links.mouseover(function(){
      var link = $(this);
      if (link.hasClass("has_tooltip")) return;
@@ -40,8 +50,9 @@ function quick_view_work_time_extension_init(){
        link.tooltip("open");
      }});
   });
+  $(document).ajaxComplete(quick_view_work_time_extension_tooltip_init);
 }
-
+<% end %>
 
 function quick_view_issue_click(event) {
    quick_view_click_event_object = event;
diff --git a/app/views/quick_view_issues/_settings.html.erb b/app/views/quick_view_issues/_settings.html.erb
new file mode 100644 (file)
index 0000000..15794bf
--- /dev/null
@@ -0,0 +1,19 @@
+<table>
+       <tr>
+               <th>WorkTime Extension enabled:</th>
+    <td>
+      <input type="checkbox" id="settings_worktime_ext_enabled" name="settings[worktime_ext_enabled]" <%= settings['worktime_ext_enabled'] ? "checked" : "" %>></input>
+    </td>
+    <td>
+    </td>
+       </tr>
+       <tr>
+    <th>WorkTime Extension(tooltip) enabled:</th>
+    <td>
+      <input type="checkbox" id="settings_worktime_ext_tooltip_enabled" name="settings[worktime_ext_tooltip_enabled]" <%= settings['worktime_ext_tooltip_enabled'] ? "checked" : "" %>></input>
+    </td>
+    <td>
+      Note: there is a possibility that the server load is increase.
+    </td>
+  </tr>
+</table>
diff --git a/init.rb b/init.rb
index ea5fc67..7524623 100644 (file)
--- a/init.rb
+++ b/init.rb
@@ -8,4 +8,9 @@ Redmine::Plugin.register :quick_view do
   author 'Akira Saito'
   description 'This plugin provides ability to view a details of the issue at the issues page.'
   version '0.0.6'
+
+  settings :default => {'issue_tooltip_enabled'=>true,
+                        'worktime_ext_enabled'=>true,
+                        'worktime_ext_tooltip_enabled'=>false}, 
+           :partial => 'quick_view_issues/settings'
 end