2014-03-23 00:22:25 +00:00
|
|
|
module Features
|
|
|
|
module FormHelpers
|
|
|
|
def fill_form(model, hash)
|
|
|
|
hash.each do |attribute, value|
|
2015-11-08 09:41:11 +00:00
|
|
|
fill_in attribute_translation(model, attribute), with: value
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-03-30 19:50:52 +00:00
|
|
|
def fill_tinymce(element, contents)
|
|
|
|
page.execute_script("$('#{element}').tinymce().setContent('#{contents}')")
|
|
|
|
end
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
def submit(model, action)
|
|
|
|
helper_translation(model, action)
|
|
|
|
end
|
|
|
|
|
|
|
|
def attribute_translation(model, attribute)
|
|
|
|
I18n.t("activerecord.attributes.#{model}.#{attribute}")
|
|
|
|
end
|
|
|
|
|
|
|
|
def helper_translation(model, action)
|
|
|
|
I18n.t("helpers.submit.#{model}.#{action}")
|
|
|
|
end
|
|
|
|
end
|
2014-04-04 19:38:44 +00:00
|
|
|
end
|