Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (40 sloc) 1.34 KB
module RubyMotionQuery
class App
# When adding a new template do the following:
# 1 - Add it here
# 2 - Add the test
# 3 - Add symbol to the README.md list
def self.add_template_actions(template, &block)
yes = "Yes" #NSLocalizedString("Yes", nil)
no = "No" #NSLocalizedString("No", nil)
cancel = "Cancel" #NSLocalizedString("Cancel", nil)
ok = "OK" #NSLocalizedString("OK", nil)
delete = "Delete" #NSLocalizedString("Delete", nil)
case template
when :yes_no
[
rmq.app.make_button(title: yes, tag: :yes, &block),
rmq.app.make_button(title: no, tag: :no, &block)
]
when :yes_no_cancel
[
rmq.app.make_button(title: yes, tag: :yes, &block),
rmq.app.make_button(title: no, tag: :no, &block),
rmq.app.make_button(title: cancel, tag: :cancel, style: :cancel, &block)
]
when :ok_cancel
[
rmq.app.make_button(title: ok, &block),
rmq.app.make_button(title: cancel, tag: :cancel, style: :cancel, &block)
]
when :delete_cancel
[
rmq.app.make_button(title: delete, tag: :delete, style: :destructive, &block),
rmq.app.make_button(title: cancel, tag: :cancel, style: :cancel, &block)
]
else
[]
end
end
end
end
You can’t perform that action at this time.