Sha256: c1f9f3fe46b6dc20b612a5390b28061a3b7a55020524e2ec48b918f2db9aa3bb

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

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.5.1.7 lib/jldrill/contexts/EditVocabularyContext.rb