Module: PactBroker::UI::Helpers::MatrixHelper
- Extended by:
- MatrixHelper
- Included in:
- Controllers::CanIDeploy, Controllers::Matrix, MatrixHelper
- Defined in:
- lib/pact_broker/ui/helpers/matrix_helper.rb
Instance Method Summary collapse
- #create_options_model(options) ⇒ Object
- #create_selector_objects(selector_hashes) ⇒ Object
- #matrix_badge_url(selectors, lines, base_url) ⇒ Object
Instance Method Details
#create_options_model(options) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/pact_broker/ui/helpers/matrix_helper.rb', line 20 def () o = OpenStruct.new() o.cvpv_checked = o.latestby == 'cvpv' ? 'checked' : nil o.cvp_checked = o.latestby == 'cvp' ? 'checked' : nil o.all_rows_checked = o.latestby.nil? ? 'checked' : nil o end |
#create_selector_objects(selector_hashes) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pact_broker/ui/helpers/matrix_helper.rb', line 8 def create_selector_objects(selector_hashes) selector_hashes.collect do | selector_hash | o = OpenStruct.new(selector_hash) o.specify_latest_tag = o.tag && o.latest ? 'checked' : nil o.specify_all_tagged = o.tag && !o.latest ? 'checked' : nil o.specify_latest = o.latest ? 'checked' : nil o.specify_version = o.pacticipant_version_number ? 'checked' : nil o.specify_all_versions = !(o.tag || o.pacticipant_version_number) ? 'checked' : nil o end end |
#matrix_badge_url(selectors, lines, base_url) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/pact_broker/ui/helpers/matrix_helper.rb', line 28 def matrix_badge_url(selectors, lines, base_url) if lines.any? && selectors.size == 2 && selectors.all?{ | selector| selector.latest_for_pacticipant_and_tag? } consumer_selector = selectors.find{ | selector| selector.pacticipant_name == lines.first.consumer_name } provider_selector = selectors.find{ | selector| selector.pacticipant_name == lines.first.provider_name } if consumer_selector && provider_selector PactBroker::Api::PactBrokerUrls.matrix_badge_url_for_selectors(consumer_selector, provider_selector, base_url) end end end |