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

37 lines
1.1 KiB
Plaintext
Raw Normal View History

2011-06-10 01:36:04 +02:00
= f.input :name
2012-10-09 02:31:10 +02:00
= f.input :description, as: :text, input_html: {rows: 4}
2011-06-10 01:36:04 +02:00
= yield
2012-10-09 02:31:10 +02:00
= f.input :user_tokens, :as => :string,
2013-10-29 18:46:55 +01:00
:input_html => { 'data-pre' => f.object.users.map(&:token_attributes).to_json }
2011-06-10 13:22:15 +02:00
2012-10-09 02:31:10 +02:00
- content_for :javascript do
2011-06-10 01:36:04 +02:00
:javascript
function toggleWeeklyTaskFields() {
2011-06-10 13:22:15 +02:00
if ($('#workgroup_weekly_task').is(':checked')) {
2012-10-09 02:31:10 +02:00
$('#weekly_task_fields .control-group').show();
2011-06-10 13:22:15 +02:00
$('#weekly_task_fields input').removeAttr('disabled');
2011-06-10 01:36:04 +02:00
} else {
2012-10-09 02:31:10 +02:00
$('#weekly_task_fields .control-group').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"),
2013-02-09 10:19:48 +01:00
hintText: '#{t('.search_user')}',
noResultText: '#{t('.user_not_found')}',
searchingText: '#{t('.search')}',
2012-10-09 02:31:10 +02:00
theme: 'facebook'
2011-06-10 13:22:15 +02:00
});
});