OSDN Git Service

client is version 0.5.41, fixed Finder.ApplicationButton
[pettanr/pettanr.git] / app / controllers / provider_statuses_controller.rb
index 95a60ef..e38c564 100644 (file)
@@ -41,7 +41,8 @@ class ProviderStatusesController < ApplicationController
     @provider_status.overwrite
     respond_to do |format|
       if @provider_status.save
-        format.html { redirect_to @provider_status, notice: 'ProviderStatus was successfully updated.' }
+        flash[:notice] = I18n.t('provider_statuses.flash.notice.created')
+        format.html { redirect_to @provider_status }
         format.json { head :ok }
       else
         format.html { render action: "edit" }
@@ -52,10 +53,16 @@ class ProviderStatusesController < ApplicationController
 
   def destroy
     @provider_status = ProviderStatus.edit(params[:id], @admin)
-    @provider_status.destroy
     respond_to do |format|
-      format.html { redirect_to comics_url }
-      format.json { head :ok }
+      if @provider_status.stop
+        flash[:notice] = I18n.t('provider_statuses.flash.notice.stopped')
+        format.html { redirect_to provider_statuses_url }
+        format.json { head :ok }
+      else
+        flash[:notice] = I18n.t('provider_statuses.flash.notice.not_stopped')
+        format.html { render action: "edit" }
+        format.json { render json: @provider_status.errors, status: :unprocessable_entity }
+      end
     end
   end
 end