OSDN Git Service

bugfix refs #36243
authorakrstjp <akrst@users.osdn.me>
Thu, 14 Apr 2016 11:45:12 +0000 (20:45 +0900)
committerakrstjp <akrst@users.osdn.me>
Thu, 14 Apr 2016 11:45:12 +0000 (20:45 +0900)
app/controllers/quick_edit_issues_controller.rb
app/views/quick_edit_issues/_error_dialog.html.erb [new file with mode: 0644]
app/views/quick_edit_issues/edit.js.erb
config/locales/en.yml
config/locales/ja.yml

index 162dc7e..b8d829e 100644 (file)
@@ -88,7 +88,8 @@ private
     unless @attribute_name == :notes
       unless @issue.safe_attribute_names.include?(@attribute_name)
         logger.warn "### quick edit ### no safe attribute. target_specifier=" + @target_specifier
-        render_404
+        @error_message = l(:text_can_not_edit)
+        render
       end
     end
 
diff --git a/app/views/quick_edit_issues/_error_dialog.html.erb b/app/views/quick_edit_issues/_error_dialog.html.erb
new file mode 100644 (file)
index 0000000..7f77bb7
--- /dev/null
@@ -0,0 +1,16 @@
+<div id="quick_edit_input_dialog" class="flash error" 
+  style="display: none; z-index: 1000; position: fixed; top: 10px; left: 10px; opacity: 0.9; min-width: 300px; background-color: #ffe3e3;">
+  <div style="padding: 10px 5px;"> 
+    <span><%= @error_message %></span>
+  </div> 
+</div>
+
+<script>
+//<![CDATA[
+  var dialog = $("#quick_edit_input_dialog");
+  dialog.fadeIn(500, function () {
+    setTimeout( function() { dialog.fadeOut(); }, 3000)
+   });
+  $("#quick_edit_input_dialog").click( function(e) { e.stopPropagation(); } );
+//]]>
+</script>
index 8497a1e..1989df8 100644 (file)
@@ -1,3 +1,7 @@
 $("#quick_edit_input_dialogs").html(
+  <% if @error_message.nil? %>
   "<%= escape_javascript(render :partial => 'input_dialog', :layout => false ) %>"
+  <% else %>
+  "<%= escape_javascript(render :partial => 'error_dialog', :layout => false ) %>"
+  <% end %>
 );
index 9cc64d3..7e4d988 100644 (file)
@@ -14,3 +14,4 @@ en:
   text_invalid_format: invalid format.
   text_multiple_update_confirm: You selected many issues to be the non unique value.\nAre you sure you want to update?
 
+  text_can_not_edit: This value can't be edited.
index 96c78ea..9063bdd 100644 (file)
@@ -13,3 +13,5 @@ ja:
   text_none_is_invalid: noneは特別な意味を持つため指定できません。
   text_invalid_format: 入力された値の書式に誤りがあります。
   text_multiple_update_confirm: 複数のチケットが同じ値に更新されます。よろしいですか?
+
+  text_can_not_edit: この値は編集できません。