コード例 #1
0
ファイル: InlineController.php プロジェクト: JCQS04/myimouto
 public function crop()
 {
     $this->inline = Inline::find($this->params()->id);
     $image = $this->inline->inline_images->toArray();
     $this->image = array_shift($image);
     if (!$this->image) {
         throw new Rails\ActiveRecord\Exception\RecordNotFoundException("Inline images set #" . $this->inline->id . " doesn't have inline images");
     }
     if (!current_user()->has_permission($this->inline)) {
         $this->access_denied();
         return;
     }
     if ($this->request()->isPost()) {
         if ($this->inline->crop($this->params()->toArray())) {
             $this->redirectTo(['#edit', 'id' => $this->inline->id]);
         } else {
             $this->respond_to_error($this->inline, ['#edit', 'id' => $this->inline->id]);
         }
     }
 }