Module: Workbench::SoftValidationHelper

Defined in:
app/helpers/workbench/soft_validation_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) object_id_string(object, prefix = nil)



16
17
18
# File 'app/helpers/workbench/soft_validation_helper.rb', line 16

def object_id_string(object, prefix = nil)
  [prefix, "#{object.metamorphosize.class}_#{object.id}"].compact.join('_')
end

- (Object) soft_validation_alert_tag(object)

Populated after page load events with a sweeper

.soft_validation_anchor { display:none }

After page load

Hit http://127.0.0.1:3000/soft_validations/validate?global_id=gid%3A%2F%2Ftaxon%2Dworks%2FTaxonNameRelationship%3A%3AIczn%3A%3AValidating%3A%3AUncertainPlacement%2F209410 
to get JSON back


8
9
10
11
12
13
14
# File 'app/helpers/workbench/soft_validation_helper.rb', line 8

def soft_validation_alert_tag(object)
  (:span, '', 
              id: object_id_string(object, 'soft_validation'), 'title' => 'Click to view validations',
              class: [:soft_validation_anchor], 
              data: { icon: 'attention', global_id: URI.escape( object.to_global_id.to_s, /[\W\\]/) }
             )
end