diff options
author | Adam Niedzielski <adamsunday@gmail.com> | 2016-08-06 23:53:48 +0300 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2016-08-06 23:53:48 +0300 |
commit | 0c3ac8276811ec17608acc56f02a03a0890f809a (patch) | |
tree | 7b2d4a5010e2acb2448db09f8413cd2ccb396789 /app | |
parent | 6d892244580f0176b6ec33d8437844570c815c71 (diff) |
Remove inline JavaScript. Add datepicker to the edit form.
Diffstat (limited to 'app')
4 files changed, 13 insertions, 10 deletions
diff --git a/app/assets/javascripts/project_members.js b/app/assets/javascripts/project_members.js index f6a796b325a..8171fa8d533 100644 --- a/app/assets/javascripts/project_members.js +++ b/app/assets/javascripts/project_members.js @@ -4,6 +4,13 @@ $('li.project_member').bind('ajax:success', function() { return $(this).fadeOut(); }); + + $('.js-project-members-page').on('focus', '.js-access-expiration-date', function() { + $(this).datepicker({ + dateFormat: 'yy-mm-dd', + minDate: 1 + }); + }); } return ProjectMembers; diff --git a/app/views/projects/project_members/_new_project_member.html.haml b/app/views/projects/project_members/_new_project_member.html.haml index 5aa0950523b..0545ed07d62 100644 --- a/app/views/projects/project_members/_new_project_member.html.haml +++ b/app/views/projects/project_members/_new_project_member.html.haml @@ -15,16 +15,11 @@ %strong= link_to "here", help_page_path("user/permissions"), class: "vlink" .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 - = 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 Leave it empty if you do not want this user's access to expire. .form-actions = f.submit 'Add users to project', class: "btn btn-create" - -:javascript - $(".datepicker").datepicker({ - dateFormat: "yy-mm-dd" - }); diff --git a/app/views/projects/project_members/index.html.haml b/app/views/projects/project_members/index.html.haml index 9031f01b496..9d063b3081f 100644 --- a/app/views/projects/project_members/index.html.haml +++ b/app/views/projects/project_members/index.html.haml @@ -1,6 +1,6 @@ - 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) .panel.panel-default .panel-heading diff --git a/app/views/shared/members/_member.html.haml b/app/views/shared/members/_member.html.haml index ae487f86e50..c215445f123 100644 --- a/app/views/shared/members/_member.html.haml +++ b/app/views/shared/members/_member.html.haml @@ -80,7 +80,8 @@ = form_for member, remote: true do |f| .prepend-top-10 = f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control' - .prepend-top-10 - = f.text_field :expires_at, class: 'form-control', placeholder: 'Access expiration date' + - if member.type == 'ProjectMember' + .prepend-top-10 + = 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 = f.submit 'Save', class: 'btn btn-save btn-sm' |