Admin namespace beendet.

This commit is contained in:
benni 2011-06-10 13:22:15 +02:00
parent 6ddef7267a
commit 172db1d37e
23 changed files with 78 additions and 193 deletions

View file

@ -1,63 +0,0 @@
= @form.error_messages
%div{:style => "float:left;width:55%;"}
%p
= @form.label :name
%br/
= @form.text_field :name, :size => 20
%p
= @form.label :description
%br/
= @form.text_field :description, :size => 40
= yield
- if @group.is_a?(Workgroup)
%div{:style => "clear:both"}
%h3
Wöchentliche Jobs definieren?
= @form.check_box :weekly_task, {:onclick => "toggleWeeklyTask();"}
%table
%tr
%td
= @form.label :weekday, "Wochentag:"
%td
= @form.select :weekday, Workgroup.weekdays
%tr
%td
= @form.label :task_name, "Dienstname:"
%td= @form.text_field :task_name, :size => 20
%tr
%td
= @form.label :task_required_users, "Benötigte Verantwortliche:"
%td= @form.text_field :task_required_users, :size => 3
%tr
%td
= @form.label :task_duration, "Vor. Dauer in Stunden"
%td= @form.select :task_duration, options_for_select(1..3, @group.task_duration)
%tr
%td
= @form.label :task_description, "Beschreibung:"
%td= @form.text_area :task_description, :size => "30x10"
%script{ 'type' => "text/javascript"}
:plain
//<![CDATA[
// preset data
function toggleWeeklyTask(){
if ($("workgroup_weekly_task").checked == true) {
$('workgroup_weekday').disabled = false;
$('workgroup_task_name').disabled = false;
$('workgroup_task_required_users').disabled = false;
$('workgroup_task_duration').disabled = false;
$('workgroup_task_description').disabled = false;
} else {
$('workgroup_weekday').disabled = true;
$('workgroup_task_name').disabled = true;
$('workgroup_task_required_users').disabled = true;
$('workgroup_task_duration').disabled = true;
$('workgroup_task_description').disabled = true;
}
}
toggleWeeklyTask();
//]]>

View file

@ -4,7 +4,7 @@
= yield
- if f.object.is_a?(Workgroup)
%h3 Wöchentliche Jobs definieren?
%h3 Wöchentliche Jobs
= f.input :weekly_task
#weekly_task_fields
= f.input :weekday
@ -13,13 +13,17 @@
= f.input :task_duration, :as => :select, :collection => (1..3)
= f.input :task_description
= f.input :user_tokens, :as => :string, :input_html => { 'data-pre' => f.object.users.map { |u| u.token_attributes }.to_json }
- content_for :head do
:javascript
function toggleWeeklyTaskFields() {
if ($('#workgroup_weekly_task').attr('checked') == 'checked') {
if ($('#workgroup_weekly_task').is(':checked')) {
$('#weekly_task_fields div.input').show();
$('#weekly_task_fields input').removeAttr('disabled');
} else {
$('#weekly_task_fields div.input').hide();
$('#weekly_task_fields input').attr('disabled', 'disabled');
}
}
@ -27,5 +31,11 @@
toggleWeeklyTaskFields();
$('#workgroup_weekly_task').click(function() {
toggleWeeklyTaskFields();
})
})
});
$("##{f.object.class.to_s.underscore}_user_tokens").tokenInput("#{users_path(:format => :json)}", {
crossDomain: false,
prePopulate: $("##{f.object.class.to_s.underscore}_user_tokens").data("pre")
});
});