fix for property module authorization

This commit is contained in:
Harry Bomrah 2018-01-17 16:17:23 +08:00
parent e37286ef6e
commit 0e655ebb61
3 changed files with 24 additions and 18 deletions

View File

@ -10,15 +10,17 @@
<% @properties.each do |property| %> <% @properties.each do |property| %>
<tr> <tr>
<td> <td>
<a href="<%= admin_property_hire_path(property) %>"><%= property.title %></a> <% if can_edit_or_delete?(property) %>
<div class="quick-edit"> <a href="<%= admin_property_hire_path(property) %>"><%= property.title %></a>
<ul class="nav nav-pills"> <div class="quick-edit">
<% if can_edit_or_delete?(property) %> <ul class="nav nav-pills">
<li><a href="<%= edit_admin_property_hire_path(property, :page => params[:page]) %>"><%= t(:edit) %></a></li> <li><a href="<%= edit_admin_property_hire_path(property, :page => params[:page]) %>"><%= t(:edit) %></a></li>
<li><a href="<%= admin_property_hire_path(property.id, :page => params[:page]) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li> <li><a href="<%= admin_property_hire_path(property.id, :page => params[:page]) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
<% end %> </ul>
</ul> </div>
</div> <% else %>
<%= property.title %>
<% end %>
</td> </td>
<td> <td>
<%= property.category.title %> <%= property.category.title %>

View File

@ -30,13 +30,15 @@
<% end %> <% end %>
</td> </td>
<td> <td>
<a href="<%= show_booking_details_admin_property_hire_path(p_hire, :page => params[:page]) %>" class="btn btn-info">View</a> <% if can_edit_or_delete?(p_hire.property) %>
<% if p_hire.passed %> <a href="<%= show_booking_details_admin_property_hire_path(p_hire, :page => params[:page]) %>" class="btn btn-info">View</a>
<a href="<%= pass_booking_admin_property_hire_path(p_hire, :page => params[:page], :status => "reject", :ref => "index") %>" class="btn btn-warning">Reject</a> <% if p_hire.passed %>
<% else %> <a href="<%= pass_booking_admin_property_hire_path(p_hire, :page => params[:page], :status => "reject", :ref => "index") %>" class="btn btn-warning">Reject</a>
<a href="<%= pass_booking_admin_property_hire_path(p_hire, :page => params[:page], :status => "accept", :ref => "index") %>" class="btn btn-success">Accept</a> <% else %>
<a href="<%= pass_booking_admin_property_hire_path(p_hire, :page => params[:page], :status => "accept", :ref => "index") %>" class="btn btn-success">Accept</a>
<% end %>
<a href="<%= delete_booking_details_admin_property_hire_path(p_hire, :page => params[:page]) %>" class="btn btn-danger" data-method="delete" data-confirm="Are you sure?">Delete</a>
<% end %> <% end %>
<a href="<%= delete_booking_details_admin_property_hire_path(p_hire, :page => params[:page]) %>" class="btn btn-danger" data-method="delete" data-confirm="Are you sure?">Delete</a>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@ -39,12 +39,14 @@
</tbody> </tbody>
</table> </table>
<a href="<%= admin_property_hire_path(@booking.property, :page => params[:page]) %>" class="btn btn-warning">Back</a> <a href="<%= admin_property_hire_path(@booking.property, :page => params[:page]) %>" class="btn btn-warning">Back</a>
<% if @booking.passed %> <% if can_edit_or_delete?(@booking.property) %>
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "reject") %>" class="btn btn-warning">Reject</a> <% if @booking.passed %>
<% else %> <a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "reject") %>" class="btn btn-warning">Reject</a>
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "accept") %>" class="btn btn-success">Accept</a> <% else %>
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "accept") %>" class="btn btn-success">Accept</a>
<% end %>
<a href="<%= delete_booking_details_admin_property_hire_path(@booking, :page => params[:page]) %>" class="btn btn-danger" data-method="delete" data-confirm="Are you sure?">Delete</a>
<% end %> <% end %>
<a href="<%= delete_booking_details_admin_property_hire_path(@booking, :page => params[:page]) %>" class="btn btn-danger" data-method="delete" data-confirm="Are you sure?">Delete</a>