Module: Bumbleworks::Rails::TasksHelper
- Included in:
- BumbleworksController
- Defined in:
- app/helpers/bumbleworks/rails/tasks_helper.rb
Instance Method Summary collapse
- #entity_task_path(task, options = {}) ⇒ Object
- #entity_task_url(task, options = {}) ⇒ Object
- #entity_tasks_path(entity, options = {}) ⇒ Object
- #entity_tasks_url(entity, options = {}) ⇒ Object
- #render_task_partial(task, options = {}) ⇒ Object
- #task_name(task) ⇒ Object
Instance Method Details
#entity_task_path(task, options = {}) ⇒ Object
27 28 29 |
# File 'app/helpers/bumbleworks/rails/tasks_helper.rb', line 27 def entity_task_path(task, = {}) entity_task_url(task, .merge(:only_path => true)) end |
#entity_task_url(task, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/helpers/bumbleworks/rails/tasks_helper.rb', line 19 def entity_task_url(task, = {}) if task.has_entity? [:entity_type] = task.entity.class.entity_type.pluralize [:entity_id] = task.entity.identifier end main_app.task_url(.merge(:id => task.id)) end |
#entity_tasks_path(entity, options = {}) ⇒ Object
39 40 41 |
# File 'app/helpers/bumbleworks/rails/tasks_helper.rb', line 39 def entity_tasks_path(entity, = {}) entity_tasks_url(entity, .merge(:only_path => true)) end |
#entity_tasks_url(entity, options = {}) ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/helpers/bumbleworks/rails/tasks_helper.rb', line 31 def entity_tasks_url(entity, = {}) if entity [:entity_type] = entity.class.entity_type.pluralize [:entity_id] = entity.identifier end main_app.tasks_url() end |
#render_task_partial(task, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/bumbleworks/rails/tasks_helper.rb', line 4 def render_task_partial(task, = {}) [:prefixes] = ["bumbleworks/tasks"] [:prefixes].unshift("#{task.entity.class.entity_type.pluralize}/tasks") if task.has_entity? template = "custom/_#{task.nickname}" if lookup_context.exists?(template, [:prefixes]) [:template] = template render end end |
#task_name(task) ⇒ Object
14 15 16 17 |
# File 'app/helpers/bumbleworks/rails/tasks_helper.rb', line 14 def task_name(task) entity = task.has_entity? ? task.entity.to_param : nil I18n.t(task.nickname, :entity => entity, :scope => 'bumbleworks.tasks.names', :default => task.to_s) end |