Sha256: aadd990772e1a2bd6b0851dc971f2bac244662f7ad6a5174d269aadbe7bd3535

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

require 'jldrill/contexts/ModifyVocabularyContext'

module JLDrill

	class AddNewVocabularyContext < ModifyVocabularyContext
				
		def initialize(viewBridge)
			super(viewBridge)
            @actionName = "Add"
		end

        # This is called when the action button is pressed on the
        # view.  In this case it adds the vocabulary to the quiz.
        def doAction(vocabulary)
            if vocabulary.valid?
                addVocabulary(vocabulary)
                @mainView.clearVocabulary
            end
        end
 
		def addVocabulary(vocab)
		    if !@parent.nil? && !@parent.quiz.nil?
    		    item = @parent.quiz.appendVocab(vocab)
                @parent.displayItem(item)
    		    @parent.updateQuizStatus
    		end
		end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.5.1.7 lib/jldrill/contexts/AddNewVocabularyContext.rb