codevise/pageflow · storylines_controller.rb
ruby logo
def create
      entry = DraftEntry.find(params[:entry_id])
      storyline = entry.storylines.build(storyline_params)

      authorize!(:create, storyline)
      verify_edit_lock!(entry.to_model)
      storyline.save

      respond_with(storyline)
    end
Similar code snippets
1.
codevise/pageflow · chapters_controller.rb
Match rating: 75.68% · See similar code snippets
ruby logo
def order
      storyline = Storyline.find(params[:storyline_id])
      entry = DraftEntry.new(storyline.entry)

      authorize!(:edit_outline, storyline.entry)
      verify_edit_lock!(storyline.entry)
      params.require(:ids).each_with_index do |id, index|
        entry.chapters.update(id, storyline_id: storyline.id, position: index)
      end

      head :no_content
    end
2.
codevise/pageflow · storylines_controller.rb
Match rating: 74.42% · See similar code snippets
ruby logo
def update
      storyline = Storyline.find(params[:id])

      authorize!(:update, storyline)
      verify_edit_lock!(storyline.entry)
      storyline.update_attributes(storyline_params)

      respond_with(storyline)
    end
3.
codevise/pageflow · storylines_controller.rb
Match rating: 71.55% · See similar code snippets
ruby logo
def destroy
      storyline = Storyline.find(params[:id])

      authorize!(:destroy, storyline)
      verify_edit_lock!(storyline.entry)

      storyline.destroy

      respond_with(storyline)
    end
4.
codevise/pageflow · chapters_controller.rb
Match rating: 65.88% · See similar code snippets
ruby logo
def create
      storyline = Storyline.find(params[:storyline_id])
      chapter = storyline.chapters.build(chapter_params)

      authorize!(:create, chapter)
      verify_edit_lock!(storyline.entry)
      chapter.save

      respond_with(chapter)
    end
5.
codevise/pageflow · storylines_controller.rb
Match rating: 53.8% · See similar code snippets
ruby logo
def order
      entry = DraftEntry.find(params[:entry_id])

      authorize!(:edit_outline, entry.to_model)
      verify_edit_lock!(entry)
      params.require(:ids).each_with_index do |id, index|
        entry.storylines.update(id, position: index)
      end

      head :no_content
    end
6.
codevise/pageflow · seeds.rb
Match rating: 49.36% · See similar code snippets
ruby logo
def sample_entry(attributes)
      entry = Entry.where(attributes.slice(:account, :title)).first

      if entry.nil?
        entry = Entry.create!(attributes) do |created_entry|
          created_entry.theming = attributes.fetch(:account).default_theming

          say_creating_entry(created_entry)
          yield(created_entry) if block_given?
        end

        storyline = entry.draft.storylines.first

        chapter = storyline.chapters.create!(title: 'Chapter 1', position: 0)
        chapter.pages.create!(template: 'background_image')
        chapter.pages.create!(template: 'background_image')

        chapter = storyline.chapters.create!(title: 'Chapter 2', position: 1)
        chapter.pages.create!(template: 'video')
      end

      entry
    end
7.
story-branch/story_branch · main.rb
Match rating: 45.3% · See similar code snippets
ruby logo
def create_story_branch
      stories = @tracker.stories
      if stories.empty?
        prompt.say 'No stories started, exiting'
        return
      end
      options = build_stories_structure(stories)
      story = prompt.select('Choose the feature you want to work on:',
                            options,
                            filter: true)
      create_feature_branch story
    end
8.
donaldpiret/github-pivotal-flow · configuration.rb
Match rating: 44.92% · See similar code snippets
ruby logo
def story
      return @story if @story
      story_id = Git.get_config(KEY_STORY_ID, :branch)
      if story_id.blank? && (matchdata = /^[a-z0-9_\-]+\/(\d+)(-[a-z0-9_\-]+)?$/i.match(Git.current_branch))
        story_id = matchdata[1]
        Git.set_config(KEY_STORY_ID, story_id, :branch) unless story_id.blank?
      end
      if story_id.blank?
        story_id = ask('What Pivotal story ID is this branch associated with?').strip
        Git.set_config(KEY_STORY_ID, story_id, :branch) unless story_id.blank?
      end
      return nil if story_id.blank?
      return (@story = Story.new(project, project.stories.find(story_id.to_i), branch_name: Git.current_branch))
    end
9.
donaldpiret/github-pivotal-flow · finish.rb
Match rating: 44.3% · See similar code snippets
ruby logo
def run!
      raise_error_if_development_or_master
      story = @configuration.story
      fail("Could not find story associated with branch") unless story
      story.can_merge?
      commit_message = options[:commit_message]
      if story.release?
        story.merge_release!(commit_message, @options)
      else
        story.merge_to_roots!(commit_message, @options)
      end
      return 0
    end
10.
raul/pt · action.rb
Match rating: 43.56% · See similar code snippets
ruby logo
def done_story(story)
      #we need this for finding again later
      story_id = story.id

      if !@params[1] && story.estimate == -1
        error("You need to give an estimate for this task")
        return
      end

      if @params[1] && story.estimate == -1
        if [0,1,2,3].include? @params[1].to_i
          estimate_story(story, @params[1].to_i)
        end
        if @params[2]
          story = task_by_id_or_pt_id story_id
          @client.comment_task(story, @params[2])
        end
      else
        @client.comment_task(story, @params[1]) if @params[1]
      end

      start_story story

      finish_story story

      deliver_story story
    end