Sha256: 20cbf15ec6c5eb1f3d6ccb8f7f21966cb06311d1fcbc3d1b1fe2acef89343a17

Contents?: true

Size: 942 Bytes

Versions: 8

Compression:

Stored size: 942 Bytes

Contents

module MobileWorkflow
  module Displayable
    def self.included(base)
      base.extend(Steps::Form)
    end

    include Steps::List
    include Steps::Map
    include Steps::PieChart
    include Steps::Question
    include Steps::Stack
    include Steps::StyledContent::Grid
    include Steps::StyledContent::Stack

    BUTTON_STYLES = [:primary, :outline, :danger, :textOnly]
    ON_SUCCESS_OPTIONS = [:none, :reload, :backward, :forward]
    
    private
    def validate_on_success!(on_success)
      raise 'Unknown on_success action' unless ON_SUCCESS_OPTIONS.include?(on_success)
    end
    
    def validate_button_style!(style)
      raise 'Unknown style' unless BUTTON_STYLES.include?(style)      
    end

    def camelcase_converter(string, first_letter: :upper)
      string = string.split("_").map(&:capitalize).join
      return string unless first_letter == :lower

      string[0].downcase + string[1..-1]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mobile_workflow-0.10.2 app/models/concerns/mobile_workflow/displayable.rb
mobile_workflow-0.10.1 app/models/concerns/mobile_workflow/displayable.rb
mobile_workflow-0.10.0 app/models/concerns/mobile_workflow/displayable.rb
mobile_workflow-0.9.0 app/models/concerns/mobile_workflow/displayable.rb
mobile_workflow-0.8.9 app/models/concerns/mobile_workflow/displayable.rb
mobile_workflow-0.7.9 app/models/concerns/mobile_workflow/displayable.rb
mobile_workflow-0.7.8 app/models/concerns/mobile_workflow/displayable.rb
mobile_workflow-0.7.7 app/models/concerns/mobile_workflow/displayable.rb