Commit 0c3ac827 authored by Adam Niedzielski's avatar Adam Niedzielski

Remove inline JavaScript. Add datepicker to the edit form.

parent 6d892244
...@@ -4,6 +4,13 @@ ...@@ -4,6 +4,13 @@
$('li.project_member').bind('ajax:success', function() { $('li.project_member').bind('ajax:success', function() {
return $(this).fadeOut(); return $(this).fadeOut();
}); });
$('.js-project-members-page').on('focus', '.js-access-expiration-date', function() {
$(this).datepicker({
dateFormat: 'yy-mm-dd',
minDate: 1
});
});
} }
return ProjectMembers; return ProjectMembers;
......
...@@ -15,16 +15,11 @@ ...@@ -15,16 +15,11 @@
%strong= link_to "here", help_page_path("user/permissions"), class: "vlink" %strong= link_to "here", help_page_path("user/permissions"), class: "vlink"
.form-group .form-group
= label_tag :expires_at, "Access expiration date", class: 'control-label' = label_tag :expires_at, 'Access expiration date', class: 'control-label'
.col-sm-10 .col-sm-10
= text_field_tag :expires_at, nil, class: "datepicker form-control", placeholder: "Select access expiration date" = text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date', placeholder: 'Select access expiration date'
.help-block .help-block
Leave it empty if you do not want this user's access to expire. Leave it empty if you do not want this user's access to expire.
.form-actions .form-actions
= f.submit 'Add users to project', class: "btn btn-create" = f.submit 'Add users to project', class: "btn btn-create"
:javascript
$(".datepicker").datepicker({
dateFormat: "yy-mm-dd"
});
- page_title "Members" - page_title "Members"
.project-members-page.prepend-top-default .project-members-page.js-project-members-page.prepend-top-default
- if can?(current_user, :admin_project_member, @project) - if can?(current_user, :admin_project_member, @project)
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
......
...@@ -80,7 +80,8 @@ ...@@ -80,7 +80,8 @@
= form_for member, remote: true do |f| = form_for member, remote: true do |f|
.prepend-top-10 .prepend-top-10
= f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control' = f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control'
- if member.type == 'ProjectMember'
.prepend-top-10 .prepend-top-10
= f.text_field :expires_at, class: 'form-control', placeholder: 'Access expiration date' = f.text_field :expires_at, class: 'form-control js-access-expiration-date', placeholder: 'Access expiration date', id: "member_expires_at_#{member.id}"
.prepend-top-10 .prepend-top-10
= f.submit 'Save', class: 'btn btn-save btn-sm' = f.submit 'Save', class: 'btn btn-save btn-sm'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment