diff --git a/app/helpers/plans_helper.rb b/app/helpers/plans_helper.rb index 2377439..c4f3af4 100644 --- a/app/helpers/plans_helper.rb +++ b/app/helpers/plans_helper.rb @@ -39,22 +39,22 @@ def display_visibility(val) case val when 'organisationally_visible' - return "#{_('Institution: anyone at my institution can view')}" + return "#{_('Institution')}" when 'publicly_visible' - return "#{_('Public: anyone can view')}" + return "#{_('Public')}" else - return "#{_('Private: restricted to me and people I invite')}" # Both Test and Private + return "#{_('Private')}" # Both Test and Private end end def visibility_tooltip(val) case val when 'organisationally_visible' - return _('Institutional: anyone logged in from your institution can view, copy, or download the plan.') + return _('Institution: anyone at my institution can view.') when 'publicly_visible' - return _('Public: anyone can view, copy, or download the plan. It will appear on the Public DMPs page of this site.') + return _('Public: anyone can view.') else - return _('Private: only owners, co-owners, and others with whom you shared your plan can directly view the plan. Administrators at your institution can view all plans for program development purposes. See the Terms of Use.') + return _('Private: restricted to me and people I invite.') end end end diff --git a/app/views/plans/index.html.erb b/app/views/plans/index.html.erb index 11ca8a5..180c925 100644 --- a/app/views/plans/index.html.erb +++ b/app/views/plans/index.html.erb @@ -34,59 +34,62 @@ <%= _('Template') %> <%= _('Edited') %> <%= _('Role') %> - <%= _('Visibility') %> <%= _('Test') %> - <%= _('Select an Action') %> + <%= _('Visibility') %> + + <%= _('Actions') %> + <% @plans.each do |plan| %> - <%= plan.title %> + + <%= link_to "#{plan.title.length > 60 ? "#{plan.title[0..59]} ..." : plan.title}", + edit_plan_path(plan) %> + <%= plan.template.title %> <%= l(plan.latest_update.to_date, formats: :short) %> <%= display_role(plan.roles.find_by(user: current_user)) %> - <%= raw display_visibility(plan.visibility) %> <%= plan.administerable_by?(current_user.id) ? '' : 'disabled="true"' %> /> - - <% if plan.editable_by?(current_user.id) then %> - <%= link_to _('Edit'), - edit_plan_path(plan), - class: "dmp_table_link" %> + <%= raw display_visibility(plan.visibility) %> + + + <%= _('Actions') %> + + <% end %> diff --git a/lib/assets/javascripts/dmproadmap/utils.js b/lib/assets/javascripts/dmproadmap/utils.js index d30e28f..6c7e170 100644 --- a/lib/assets/javascripts/dmproadmap/utils.js +++ b/lib/assets/javascripts/dmproadmap/utils.js @@ -6,10 +6,23 @@ } }); + // Display the dropdown when the user clicks the link $("a.dropdown").on('click', function(e){ e.preventDefault(); var id = $(this).prop('id'); - var visible = $("#" + id + "-dropdown").css('visibility') == 'visible'; + var visible = $("#" + id + "-dropdown").css('visibility') == 'visible'; $("#" + id + "-dropdown").css('visibility', (visible ? 'hidden' : 'visible')); + + // Set an auto timeout so that the dropdown disappears after a second + var dropdownTimer = setTimeout(function(){ + $("#" + id + "-dropdown").css('visibility', 'hidden'); + }, 1080); + + // If the user mouses over the dropdown clear the timeout timer. hide the dropdown when the mouse out + $("#" + id + "-dropdown").mouseenter(function(){ + clearTimeout(dropdownTimer); + }).mouseleave(function(){ + $(this).css('visibility', 'hidden'); + }); }); }); diff --git a/lib/assets/stylesheets/dmproadmap/base.scss b/lib/assets/stylesheets/dmproadmap/base.scss index d3e1374..45274ff 100644 --- a/lib/assets/stylesheets/dmproadmap/base.scss +++ b/lib/assets/stylesheets/dmproadmap/base.scss @@ -76,13 +76,24 @@ width: 0; height: 0; } -.dropdown-list { +ul.dropdown-list { + position: absolute; background-color: $medium-grey; color: $white; border-radius: 3px; - padding: 6px 10px; - margin-top: 0; - text-align: right; + padding: 10px 25px; + text-align: left; + z-index: 2; + top: 5px; + + li { + list-style: none; + margin-bottom: 10px; + + a { + color: $white; + } + } } /* General Anchor and Button styling */ @@ -215,7 +226,8 @@ top: 32px; li { - background-color: $dark-grey; + display: block; + background-color: $medium-grey; border: none; } } @@ -225,15 +237,10 @@ } .signin-signout-menu { position: absolute; - text-align: right; top: 5px; right: 10px; color: white; - ul li { - list-style: none; - - } a { color: white; font-size: 14px; @@ -338,29 +345,4 @@ width: 30%; } } -} - - - - - - - -.checkbox-label { - display: inline-block; - font-size: 1em; - margin: 0; - padding: 2px; -} - -.checkbox-input { - border: none; - vertical-align: middle; - height: 17px; - margin: 0 4px 0 0; - padding: 0; -} - -.project-title-container { - width: 60%; } \ No newline at end of file diff --git a/lib/assets/stylesheets/dmproadmap/forms.scss b/lib/assets/stylesheets/dmproadmap/forms.scss index 0c68c57..ad4f571 100644 --- a/lib/assets/stylesheets/dmproadmap/forms.scss +++ b/lib/assets/stylesheets/dmproadmap/forms.scss @@ -33,6 +33,21 @@ vertical-align: top; } +.checkbox-label { + display: inline-block; + font-size: 1em; + margin: 0; + padding: 2px; +} + +.checkbox-input { + border: none; + vertical-align: middle; + height: 17px; + margin: 0 4px 0 0; + padding: 0; +} + .org-logo { position: absolute; top: -35px; @@ -512,6 +527,19 @@ div.main_page_content p #create-test { vertical-align: middle; } +td.plan-edit-actions { + position: absolute; + overflow: visible; + + ul { + top: 8px; + left: 0; + + li a { + text-decoration: none; + } + } +} /* Create plan */ /* ------------------------------------------------ */ @@ -557,6 +585,9 @@ /* Show/Edit plan details */ /* ------------------------------------------------ */ +.project-title-container { + width: 60%; +} div.show-plan { width: 60%;