diff --git a/app/views/plans/_share_form.html.erb b/app/views/plans/_share_form.html.erb new file mode 100644 index 0000000..fabe9a0 --- /dev/null +++ b/app/views/plans/_share_form.html.erb @@ -0,0 +1,84 @@ +

<%= _('Set plan visibility') %>

+

<%= _('Public or organisational visibility is intended for finished plans. You must answer at least one question to enable these options.') %>

+ +<%= form_for @plan, html: {method: :put} do |f| %> + > +
+ <%= f.label :visibility, raw("#{f.radio_button :visibility, :privately_visible} #{_('Private: restricted to me and my collaborators')}") %> +
+
+ <%= f.label :visibility, raw("#{f.radio_button :visibility, :organisationally_visible} #{_('Organisation: anyone at my organisation can view')}") %> +
+
+ <%= f.label :visibility, raw("#{f.radio_button :visibility, :publicly_visible} #{_('Public: anyone can view')}") %> +
+ +<% end %> + +

<%= _('Manage collaborators')%>

+

<%= _('Invite specific people to read, edit, or administer your plan. Invitees will receive an email notification that they have access to this plan.') %>

+ +<% if @plan.roles.any? then %> + + + + + + + + + + <% plan_roles = @plan.roles.where(active: true) %> + <% plan_roles.each do |role| %> + + + + + + <% end %> + +
<%= _('Email address')%><%= _('Permissions')%><%= _('Actions') %>
<%= role.user.name %> + <% if role.creator? %> + <%= 'Owner' %> + <% elsif !role.creator? && role.user == current_user %> + <%= display_role(role) %> + <% elsif !role.creator? && role.user != current_user %> + <%= form_for role, url: {controller: :roles, action: :update, id: role.id }, html: {method: :put} do |f| %> +
+ <%= 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.') } %> +
+ <% end %> + <% end %> +
+ <% unless role.creator? || role.user == current_user then %> + <%= link_to _('Remove'), role, method: :delete, data: { confirm: _('Are you sure?') }, :class => "a-orange" %> + <% end %> +
+<% end %> + +

<%= _('Invite collaborators') %>

+<% new_role = Role.new %> +<% new_role.plan = @plan %> +<%= form_for new_role, url: {controller: :roles, action: :create }, html: {method: :post} do |f| %> +
+ <%= f.hidden_field :plan_id %> + <%= f.fields_for :user do |user| %> + <%= user.label :email, _('Email') %> + <%= user.email_field :email, for: :user, name: "user", class: "input-medium" %> + <% end %> +
+ +

<%= _('Permissions') %>

+
+ <%= f.label :access_level, raw("#{f.radio_button :access_level, 1} #{_('Read only: can view but not make changes')}") %> +
+
+ <%= f.label :access_level, raw("#{f.radio_button :access_level, 2} #{_('Editor: can comment and make changes')}") %> +
+
+ <%= f.label :access_level, raw("#{f.radio_button :access_level, 3} #{_('Co-owner: can edit project details, change visibility, and add collaborators')}") %> +
+ + <%= f.button(_('Submit'), class: "btn btn-default", type: "submit") %> +<% end %> \ No newline at end of file diff --git a/app/views/plans/share.html.erb b/app/views/plans/share.html.erb index f0f9c56..c6660f6 100644 --- a/app/views/plans/share.html.erb +++ b/app/views/plans/share.html.erb @@ -7,140 +7,6 @@
-
- - - - -
- -
-
+ <%= render partial: 'share_form', layout: '/shared/plan_navigation', locals: { plan: @plan } %>
\ No newline at end of file diff --git a/app/views/shared/_plan_navigation.html.erb b/app/views/shared/_plan_navigation.html.erb new file mode 100644 index 0000000..717a0be --- /dev/null +++ b/app/views/shared/_plan_navigation.html.erb @@ -0,0 +1,24 @@ + + +
+
+ <%= yield %> +
+