foodsoft/app/views/shared/_group_form_fields.html.haml

46 lines
1.4 KiB
Text
Raw Normal View History

2011-06-10 01:36:04 +02:00
= f.input :name
= f.input :description
= yield
- if f.object.is_a?(Workgroup)
2011-06-10 13:22:15 +02:00
%h3 Wöchentliche Jobs
2011-06-10 01:36:04 +02:00
= f.input :weekly_task
#weekly_task_fields
= f.input :weekday
= f.input :task_name
= f.input :task_required_users
= f.input :task_duration, :as => :select, :collection => (1..3)
= f.input :task_description, as: :text, input_html: {rows: 10}
2012-07-31 18:48:41 +02:00
= f.input :next_weekly_tasks_number
2011-06-10 01:36:04 +02:00
2011-06-10 13:22:15 +02:00
= f.input :user_tokens, :as => :string, :input_html => { 'data-pre' => f.object.users.map { |u| u.token_attributes }.to_json }
2011-06-10 01:36:04 +02:00
- content_for :head do
:javascript
function toggleWeeklyTaskFields() {
2011-06-10 13:22:15 +02:00
if ($('#workgroup_weekly_task').is(':checked')) {
2011-06-10 01:36:04 +02:00
$('#weekly_task_fields div.input').show();
2011-06-10 13:22:15 +02:00
$('#weekly_task_fields input').removeAttr('disabled');
2011-06-10 01:36:04 +02:00
} else {
$('#weekly_task_fields div.input').hide();
2011-06-10 13:22:15 +02:00
$('#weekly_task_fields input').attr('disabled', 'disabled');
2011-06-10 01:36:04 +02:00
}
}
$(function() {
toggleWeeklyTaskFields();
$('#workgroup_weekly_task').click(function() {
toggleWeeklyTaskFields();
2011-06-10 13:22:15 +02:00
});
$("##{f.object.class.to_s.underscore}_user_tokens").tokenInput("#{users_path(:format => :json)}", {
crossDomain: false,
2012-07-31 18:48:41 +02:00
prePopulate: $("##{f.object.class.to_s.underscore}_user_tokens").data("pre"),
hintText: 'Nach Nutzerin suchen',
noResultText: 'Keine Nutzerin gefunden',
searchingText: 'Suche ...'
2011-06-10 13:22:15 +02:00
});
});