Add can_comment and can_edit_dossier abilities to valuators
This commit is contained in:
14
app/views/admin/valuators/_user_row.html.erb
Normal file
14
app/views/admin/valuators/_user_row.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<tr>
|
||||
<td><%= link_to user.name, user_path(user), target: "_blank" %></td>
|
||||
<td><%= user.email %></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %>
|
||||
<%= f.hidden_field :user_id %>
|
||||
<%= f.submit t("admin.valuators.valuator.add"),
|
||||
class: "button success expanded" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
30
app/views/admin/valuators/_valuator_row.html.erb
Normal file
30
app/views/admin/valuators/_valuator_row.html.erb
Normal file
@@ -0,0 +1,30 @@
|
||||
<tr>
|
||||
<td><%= link_to valuator.name, admin_valuator_path(valuator) %></td>
|
||||
<td><%= valuator.email %></td>
|
||||
<td>
|
||||
<% if valuator.description.present? %>
|
||||
<%= valuator.description %>
|
||||
<% else %>
|
||||
<%= t("admin.valuators.index.no_description") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if valuator.valuator_group.present? %>
|
||||
<%= valuator.valuator_group.try(:name) %>
|
||||
<% else %>
|
||||
<%= t("admin.valuators.index.no_group") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= valuator_abilities(valuator) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.actions.edit"),
|
||||
edit_admin_valuator_path(valuator),
|
||||
class: "button hollow" %>
|
||||
<%= link_to t("admin.valuators.valuator.delete"),
|
||||
admin_valuator_path(valuator),
|
||||
method: :delete,
|
||||
class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
21
app/views/admin/valuators/_valuators.html.erb
Normal file
21
app/views/admin/valuators/_valuators.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<table>
|
||||
<thead>
|
||||
<th scope="col"><%= t("admin.valuators.index.name") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.email") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.description") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.group") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.abilities") %></th>
|
||||
<th scope="col" class="small-3"><%= t("admin.actions.actions") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% valuators.each do |valuator| %>
|
||||
<% if valuator.is_a?(Valuator) %>
|
||||
<%= render partial: 'valuator_row', locals: {valuator: valuator} %>
|
||||
<% elsif valuator.valuator? %>
|
||||
<%= render partial: 'valuator_row', locals: {valuator: valuator.valuator} %>
|
||||
<% else %>
|
||||
<%= render partial: 'user_row', locals: {user: valuator} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -15,6 +15,12 @@
|
||||
@valuator_groups.map {|group| [group.name, group.id] },
|
||||
{ include_blank: true } %>
|
||||
</div>
|
||||
<%= f.submit t("admin.valuators.form.update"), class: "button success" %>
|
||||
<div>
|
||||
<div class="filter">
|
||||
<%= f.check_box :can_comment %>
|
||||
<%= f.check_box :can_edit_dossier %>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.submit class: "button success" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -8,46 +8,7 @@
|
||||
<% if @valuators.any? %>
|
||||
<h3 class="margin"><%= page_entries_info @valuators %></h3>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<th scope="col"><%= t("admin.valuators.index.name") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.email") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.description") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.group") %></th>
|
||||
<th scope="col" class="small-3"><%= t("admin.actions.actions") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @valuators.each do |valuator| %>
|
||||
<tr>
|
||||
<td><%= link_to valuator.name, admin_valuator_path(valuator) %></td>
|
||||
<td><%= valuator.email %></td>
|
||||
<td>
|
||||
<% if valuator.description.present? %>
|
||||
<%= valuator.description %>
|
||||
<% else %>
|
||||
<%= t("admin.valuators.index.no_description") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if valuator.valuator_group.present? %>
|
||||
<%= valuator.valuator_group.try(:name) %>
|
||||
<% else %>
|
||||
<%= t("admin.valuators.index.no_group") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.actions.edit"),
|
||||
edit_admin_valuator_path(valuator),
|
||||
class: "button hollow" %>
|
||||
<%= link_to t("admin.valuators.valuator.delete"),
|
||||
admin_valuator_path(valuator),
|
||||
method: :delete,
|
||||
class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= render partial: "valuators", locals: {valuators: @valuators} %>
|
||||
|
||||
<%= paginate @valuators %>
|
||||
<% else %>
|
||||
|
||||
@@ -5,51 +5,7 @@
|
||||
<div id="valuators">
|
||||
<% if @users.any? %>
|
||||
<h3 class="margin"><%= page_entries_info @users %></h3>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<th scope="col"><%= t("admin.valuators.index.name") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.email") %></th>
|
||||
<th scope="col"><%= t("admin.valuators.index.description") %></th>
|
||||
<th scope="col"><%= t("admin.shared.actions") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @users.each do |user| %>
|
||||
<tr>
|
||||
<td><%= user.name %></td>
|
||||
<td><%= user.email %></td>
|
||||
<td>
|
||||
<% if user.valuator? %>
|
||||
<% if user.valuator.description.present? %>
|
||||
<%= user.valuator.description %>
|
||||
<% else %>
|
||||
<%= t("admin.valuators.index.no_description") %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= t("admin.valuators.index.no_description") %>
|
||||
<% end %>
|
||||
<td>
|
||||
<% if user.valuator? %>
|
||||
<%= link_to t("admin.actions.edit"),
|
||||
edit_admin_valuator_path(user.valuator),
|
||||
class: "button hollow" %>
|
||||
|
||||
<%= link_to t("admin.valuators.valuator.delete"),
|
||||
admin_valuator_path(user),
|
||||
method: :delete,
|
||||
class: "button hollow alert expanded" %>
|
||||
<% else %>
|
||||
<%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %>
|
||||
<%= f.hidden_field :user_id %>
|
||||
<%= f.submit t("admin.valuators.valuator.add"),
|
||||
class: "button success expanded" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= render partial: "valuators", locals: {valuators: @users} %>
|
||||
<% else %>
|
||||
<div class="callout alert margin">
|
||||
<%= t("admin.shared.no_search_results") %>
|
||||
|
||||
@@ -27,4 +27,13 @@
|
||||
<%= t("admin.valuators.show.no_group") %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong><%= t("admin.valuators.show.abilities") %></strong><br>
|
||||
<% if valuator_abilities(@valuator).present? %>
|
||||
<%= valuator_abilities(@valuator) %>
|
||||
<% else %>
|
||||
<%= t("admin.valuators.show.no_abilities") %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user