Sha256: 9975d6c96fbb0fde0789b2dc4ee1d93975d68453a7d4278ad7e2daaed0bb31d5

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

# encoding: utf-8
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.6.0.1 lib/jldrill/contexts/AddNewVocabularyContext.rb