<h2><%= _('Set plan visibility') %></h2> <p class="form-control-static"><%= _('Public or organisational visibility is intended for finished plans. You must answer at least one question to enable these options.') %></p> <% allow_visibility = @plan.visibility_allowed? %> <%= form_for(@plan, url: visibility_plan_path, method: :post, html: { id: 'set_visibility'}) do |f| %> <fieldset<%= (allow_visibility ? '' : ' disabled') %>> <div class="form-group col-xs-8"> <div class="radio"> <%= f.label :visibility_privately_visible, raw("#{f.radio_button :visibility, :privately_visible} #{_('Private: restricted to me and my collaborators')}") %> </div> <div class="radio"> <%= f.label :visibility_organisationally_visible, raw("#{f.radio_button :visibility, :organisationally_visible} #{_('Organisation: anyone at my organisation can view')}") %> </div> <div class="radio"> <%= f.label :visibility_publicly_visible, raw("#{f.radio_button :visibility, :publicly_visible} #{_('Public: anyone can view')}") %> </div> </div> </fieldset> <% end %> <h2><%= _('Manage collaborators')%></h2> <p><%= _('Invite specific people to read, edit, or administer your plan. Invitees will receive an email notification that they have access to this plan.') %></p> <% if @plan.roles.any? then %> <table class="table table-hover table-bordered" id="collaborator-table"> <thead> <tr> <th><%= _('Email address')%></th> <th><%= _('Permissions')%></th> <th><span aria-hidden="false" class="sr-only"><%= _('Actions') %></span></th> </tr> </thead> <tbody> <% @plan_roles.each do |role| %> <tr> <td><%= role.user.name %></td> <td> <% if role.creator? %> <span><%= 'Owner' %></span> <% elsif !role.creator? && role.user == current_user %> <span><%= display_role(role) %></span> <% elsif !role.creator? && role.user != current_user %> <%= form_for role, url: {controller: :roles, action: :update, id: role.id }, html: {method: :put} do |f| %> <div class="form-group col-xs-8"> <%= f.hidden_field :id %> <%= f.select :access_level, {"#{_('Co-owner')}": 3, "#{_('Editor')}": 2, "#{_('Read only')}": 1}, {}, {id: "#{role.id}-can-edit", class: "toggle-existing-user-access has-tooltip", 'data-toggle': "tooltip", 'title': _('Editors can contribute to plans. Co-owners have additional rights to edit plan details and control access.') } %> </div> <% end %> <% end %> </td> <td> <% unless role.creator? || role.user == current_user then %> <%= link_to _('Remove'), role, method: :delete, data: { confirm: _('Are you sure?') }, :class => "a-orange" %> <% end %> </td> </tr> <% end %> </tbody> </table> <% end %> <h2><%= _('Invite collaborators') %></h2> <% new_role = Role.new %> <% new_role.plan = @plan %> <%= form_for new_role, url: {controller: :roles, action: :create }, html: {method: :post} do |f| %> <div class="form-group col-xs-8"> <%= f.hidden_field :plan_id %> <%= f.fields_for :user do |user| %> <%= user.label :email, _('Email'), class: 'control-label' %> <%= user.email_field :email, for: :user, name: "user", class: "form-control", "aria-required": true %> <% end %> </div> <div class="form-group col-xs-8"> <p><strong><%= _('Permissions') %></strong></p> <div class="radio"> <%= f.label :access_level, raw("#{f.radio_button :access_level, 1} #{_('Read only: can view but not make changes')}") %> </div> <div class="radio"> <%= f.label :access_level, raw("#{f.radio_button :access_level, 2} #{_('Editor: can comment and make changes')}") %> </div> <div class="radio"> <%= f.label :access_level, raw("#{f.radio_button :access_level, 3, "aria-required": true} #{_('Co-owner: can edit project details, change visibility, and add collaborators')}") %> </div> <%= f.button(_('Submit'), class: "btn btn-primary", type: "submit") %> </div> <div class="clearfix"></div> <% end %> <% if plan.owner_and_coowners.include?(current_user) && current_user.org.present? && current_user.org.feedback_enabled? %> <h2><%= _('Request expert feedback') %></h2> <p><%= _('Click below to give data management staff at your organisation access to read and comment on your plan.') %></p> <p><%= _('You can continue to edit and download the plan in the interim.') %></p> <div class="form-group col-xs-8"> <%= link_to _('Request feedback'), request_feedback_plan_path, class: "btn btn-default#{' disabled' if @plan.feedback_requested?}" %> <span><%= _("Feedback has been requested.") if @plan.feedback_requested? %></span> </div> <% end %>