Sha256: cf4ca42b8ffa02288c89a6ba4f46732253a3a39d6a54f85c7e5389afc65613d3

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8
require 'jldrill/contexts/ModifyVocabularyContext'

module JLDrill

	class EditVocabularyContext < ModifyVocabularyContext
				
		def initialize(viewBridge)
			super(viewBridge)
            @actionName = "Set"
		end
	
        # When items have been updated in the quiz, If we are editing and
        # the problem changes, then the edit window should change to that
        # problem.
        def update(problem)
            super(problem)
		    @mainView.update(problem.item.to_o)
        end
		
        # Sets the vocabulary of the current problem to vocab
        # Refuses to set the vocabulary if it already exists in the
        # quiz.  Returns true if the vocabulary was set, false otherwise
        # Note, if the vocabulary is the one in the problem it will replace
        # it even if it is the same vocabulary in order to update the comment.
		def doAction(vocab)
            if @originalProblem.contains?(vocab) ||
                !@parent.quiz.exists?(vocab)
                @originalProblem.vocab = vocab
                @parent.quiz.setCurrentProblem(@originalProblem)
                close
            end
		end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.6.0.1 lib/jldrill/contexts/EditVocabularyContext.rb