lib/taskr/views.rb in taskr-0.1.0 vs lib/taskr/views.rb in taskr-0.2.0
- old
+ new
@@ -22,15 +22,15 @@
include Taskr::Models
CONTENT_TYPE = 'text/xml'
def tasks_list
- @tasks.to_xml(:root => 'tasks', :include => [:task_actions])
+ @tasks.to_xml(:root => 'tasks')#, :include => [:task_actions])
end
def view_task
- @task.to_xml(:root => 'task', :include => [:task_actions])
+ @task.to_xml(:root => 'task')#, :include => [:task_actions])
end
def create_task_result
taskr_response_xml(@task.valid? ? 'success' : 'failure') do
text @task.to_xml
@@ -38,10 +38,12 @@
end
end
end
module HTML
+ include Taskr::Controllers
+
CONTENT_TYPE = 'text/html'
def tasks_list
html_scaffold do
h1 {"Tasks"}
@@ -91,11 +93,11 @@
def new_task
html_scaffold do
script(:type => 'text/javascript') do
%{
function show_action_parameters(num) {
- new Ajax.Updater('parameters_'+num, '/actions', {
+ new Ajax.Updater('parameters_'+num, '#{R(Actions)}', {
method: 'get',
parameters: {
id: $F('action_class_name_'+num),
action: 'parameters_form',
num: num
@@ -132,13 +134,13 @@
a(:id => 'add_action', :href => '#'){'Add another action'}
end
script(:type => 'text/javascript') do
%{
Event.observe('add_action', 'click', function() {
- new Ajax.Updater('add_action', '#{self/'/actions'}', {
+ new Ajax.Updater('add_action', '#{R(Actions, :new)}', {
method: 'get',
- parameters: { action: 'new', num: $$('select.action_class_name').size() },
+ parameters: { num: $$('select.action_class_name').size() },
insertion: Insertion.Before
});
return false;
})
}
@@ -153,11 +155,11 @@
html_scaffold do
form(:method => 'delete', :style => 'display: inline') do
button(:type => 'submit', :value => 'delete') {"Delete"}
end
br
- a(:href => self/'tasks') {"Back to Task List"}
+ a(:href => R(Tasks, :list)) {"Back to Task List"}
h1 "Task #{@task.id}"
table do
tr do
th "Name:"
@@ -166,10 +168,14 @@
tr do
th "Schedule:"
td "#{@task.schedule_method} #{@task.schedule_when}"
end
tr do
+ th "Job ID:"
+ td @task.scheduler_job_id
+ end
+ tr do
th "Triggered:"
td do
if @task.last_triggered
span "#{distance_of_time_in_words(@task.last_triggered, Time.now, true)} ago"
span(:style => 'font-size: 8pt; color: #bbb'){"(#{@task.last_triggered})"}
@@ -181,11 +187,11 @@
if @task.last_triggered_error
th "Error:"
td(:style => 'color: #e00;') do
strong "#{@task.last_triggered_error[:type]}"
br
- span @task.last_triggered_error[:message]
+ pre @task.last_triggered_error[:message]
end
end
tr do
th "Actions:"
td do
@@ -241,10 +247,10 @@
@action.parameters.each do |param|
p do
label param
br
- input :type => 'textarea', :name => "action[#{@num}][#{param}]", :size => 40
+ input :type => 'text', :name => "action[#{@num}][#{param}]", :size => 50
end
end
end
def action_form
\ No newline at end of file