Sha256: 260a85150f3fe22fd2f3c8d383c933e42969123058b083c5cc2beb80a49b7b87

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require_dependency "pivotal_reporter/application_controller"

module PivotalReporter
  class StoriesController < ApplicationController
    def index
      @stories = pivotal_project.stories.all(label: pivotal_unique_label)
    end

    def show
      @story = pivotal_project.stories.find(params[:id])
    end

    def new
      @pivotal_unique_label = pivotal_unique_label
    end
  
    def create
      story = PivotalTracker::Story.new(params[:story]).create

      if story.errors.count > 0
        flash[:error] = "Report Submission Failed: #{story.errors}"
      else
        flash[:success] = 'Report Submitted!'
      end

      redirect_to new_story_path
    end

    def accept
      @story = pivotal_project.stories.find(params[:id])
      @story.update({current_state: 'accepted'})

      redirect_to stories_path
    end

    def reject
      @story = pivotal_project.stories.find(params[:id])
      @story.update({current_state: 'rejected'})
      @story.notes.create(:text => URI.decode(params[:reject_message]))

      redirect_to stories_path
    end


  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pivotal_reporter-0.7.2 app/controllers/pivotal_reporter/stories_controller.rb
pivotal_reporter-0.7.1 app/controllers/pivotal_reporter/stories_controller.rb
pivotal_reporter-0.7.0 app/controllers/pivotal_reporter/stories_controller.rb