Module: WithEditor

Extended by:
ActiveSupport::Concern
Included in:
Problem
Defined in:
app/models/concerns/with_editor.rb

Instance Method Summary collapse

Instance Method Details

#choice?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/models/concerns/with_editor.rb', line 9

def choice?
  [:single_choice, :multiple_choice].include? editor.to_sym
end

#editor_with_defaults?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/concerns/with_editor.rb', line 13

def editor_with_defaults?
  code?
end

#pretty_choicesObject



17
18
19
20
21
22
23
24
# File 'app/models/concerns/with_editor.rb', line 17

def pretty_choices
  choices.each_with_index.map do |choice, index|
    struct id: "content_choice_#{index}",
           index: index,
           value: choice,
           text: Mumukit::ContentType::Markdown.to_html(choice_text(choice))
  end
end