diff --git a/app/helpers/plans_helper.rb b/app/helpers/plans_helper.rb
index cf5a0c6..bff80a5 100644
--- a/app/helpers/plans_helper.rb
+++ b/app/helpers/plans_helper.rb
@@ -5,14 +5,14 @@
def plan_list_column_heading(column)
if column.kind_of?(Array)
heading = (column.first.kind_of?(String) ? column.first : _(' - '))
-
+
elsif column.kind_of?(String)
heading = column
else
heading = _(' - ')
end
-
+
klass = (['name', 'description'].include?(heading) ? :dmp_th_big : :dmp_th_small)
content_tag(:th, t("helpers.project.columns.#{heading}"), class: klass) # parametrised YAML keys are no longer possible with gettext, TODO
@@ -21,9 +21,9 @@
# Populate a variable column for the project list
# --------------------------------------------------------
def plan_list_column_body(column, plan)
-
+
col = (column.kind_of?(Array) ? column[0] : column)
-
+
klass, content = case col
when 'name'
[ "dmp_td_big", link_to(plan.title, plan_path(plan), class: "dmp_table_link") ]
@@ -51,7 +51,7 @@
_('Test/Practice')
elsif plan.visibility == 'privately_visible'
_('Private')
- end
+ end
["dmp_td_small", text ]
when 'last_edited'
[ "dmp_td_small", l(plan.latest_update.to_date, formats: :short) ]
@@ -87,4 +87,18 @@
content_tag(:small, t("helpers.settings.plans.#{key}"))
end
+
+ # display the role of the user for a given plan
+ def display_role(role)
+ case role.access_level
+ when 3
+ access = 'Co-owner'
+ when 2
+ access = 'Editor'
+ when 1
+ access = 'Read only'
+ end
+ return access
+ end
+
end
diff --git a/app/views/plans/share.html.erb b/app/views/plans/share.html.erb
index 42f6988..ecde6e9 100644
--- a/app/views/plans/share.html.erb
+++ b/app/views/plans/share.html.erb
@@ -30,15 +30,17 @@
| <%= role.user.name %> |
- <% if role.creator? then %>
- <%= _('Owner')%>
- <% else %>
- <%= form_for role, url: {controller: :roles, action: :update, id: role.id }, html: {method: :put} do |f| %>
-
+ <% 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| %>
+
+ <% end %>
<% end %>
- <% end %>
|
<% unless role.creator? || role.user == current_user then %>
@@ -53,20 +55,20 @@
-
+
<% new_role = Role.new %>
<% new_role.plan = @plan %>
- <%= form_for new_role, url: {controller: :roles, action: :create },
+ <%= form_for new_role, url: {controller: :roles, action: :create },
html: {method: :post, class: 'roadmap-form'} do |f| %>
|