mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-10-04 01:10:43 -04:00
Compare commits
3
Commits
2026.8.2
...
b021ca9f7d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b021ca9f7d | ||
|
|
feb357b9a4 | ||
|
|
df41436e61 |
No files matched your search
@@ -13,6 +13,8 @@ class VehiclesController < ApplicationController
|
|||||||
|
|
||||||
include AuthHelper
|
include AuthHelper
|
||||||
|
|
||||||
|
# This tells Redmine to check global permissions for the current controller/action
|
||||||
|
before_action :authorize_global
|
||||||
before_action :require_user
|
before_action :require_user
|
||||||
|
|
||||||
def allowed_params
|
def allowed_params
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<% if appointment.customer.present? %>
|
<% if User.current.allowed_to?(:add_vehicles, nil, global: true) %>
|
||||||
<% unless appointment.vehicle.present? &&%>
|
<% if appointment.customer.present? %>
|
||||||
<p>
|
<% unless appointment.vehicle.present? &&%>
|
||||||
<%= link_to new_vehicle_path(customer_id: appointment.customer_id), class: 'icon icon-add' do %>
|
<p>
|
||||||
<%= l(:label_add_vehicle) %>
|
<%= link_to new_vehicle_path(customer_id: appointment.customer_id), class: 'icon icon-add' do %>
|
||||||
|
<%= l(:label_add_vehicle) %>
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<h4><%=t(:field_vehicles)%>:</h4>
|
<h4><%=t(:field_vehicles)%>:</h4>
|
||||||
<%= render partial: 'vehicles/list', locals: { vehicles: customer.vehicles.paginate(page: params[:page]), show_customer: false, show_checkbox: true } %>
|
<%= render partial: 'vehicles/list', locals: { vehicles: customer.vehicles.paginate(page: params[:page]), show_customer: false, show_checkbox: true } %>
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<%= button_to t(:button_new_vehicle), new_customer_vehicle_path(customer), method: :get %>
|
<% if User.current.allowed_to?(:add_vehicles, nil, global: true) %>
|
||||||
|
<%= button_to t(:button_new_vehicle), new_customer_vehicle_path(customer), method: :get %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -54,6 +54,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get %>
|
<% if User.current.allowed_to?(:edit_vehicles, nil, global: true) %>
|
||||||
<%= button_to t(:label_delete), vehicle, method: :delete, data: { confirm: t(:warn_ru_sure) } %>
|
<%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get %>
|
||||||
|
<% end %>
|
||||||
|
<% if User.current.allowed_to?(:delete_vehicles, nil, global: true) %>
|
||||||
|
<%= button_to t(:label_delete), vehicle, method: :delete, data: { confirm: t(:warn_ru_sure) } %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo_vehicles do
|
|||||||
name 'Redmine QBO Vehicles plugin'
|
name 'Redmine QBO Vehicles plugin'
|
||||||
author 'Rick Barrette'
|
author 'Rick Barrette'
|
||||||
description 'This is a plugin for Redmine to intergrate with the redmine_qbo plugin to provide vehicle data tracking'
|
description 'This is a plugin for Redmine to intergrate with the redmine_qbo plugin to provide vehicle data tracking'
|
||||||
version '2026.8.2'
|
version '2026.9.1'
|
||||||
url 'https://github.com/rickbarrette/redmine_qbo_vehicles'
|
url 'https://github.com/rickbarrette/redmine_qbo_vehicles'
|
||||||
author_url 'https://barrettefabrication.com'
|
author_url 'https://barrettefabrication.com'
|
||||||
requires_redmine version_or_higher: '6.1.0'
|
requires_redmine version_or_higher: '6.1.0'
|
||||||
@@ -29,11 +29,15 @@ Redmine::Plugin.register :redmine_qbo_vehicles do
|
|||||||
# Add safe attributes for core models
|
# Add safe attributes for core models
|
||||||
Issue.safe_attributes :vehicle_id
|
Issue.safe_attributes :vehicle_id
|
||||||
|
|
||||||
# Permissions for security
|
# Global Permissions
|
||||||
permission :view_vehicles, vehicles: :new, public: false
|
permission :view_vehicles, { vehicles: [:index, :show] }, global: true
|
||||||
|
permission :add_vehicles, { vehicles: [:new, :create] }, global: true
|
||||||
|
permission :edit_vehicles, { vehicles: [:edit, :update] }, global: true
|
||||||
|
permission :delete_vehicles, { vehicles: [:destroy] }, global: true
|
||||||
|
|
||||||
|
|
||||||
# Register top menu items
|
# Register top menu items
|
||||||
menu :top_menu, :vehicles, { controller: :vehicles, action: :index }, caption: :field_vehicles, if: Proc.new { User.current.logged? }
|
menu :top_menu, :vehicles, { controller: :vehicles, action: :index }, caption: :field_vehicles, if: Proc.new { User.current.allowed_to?(:view_vehicles, nil, global: true) }
|
||||||
|
|
||||||
Redmine::Search.map do |search|
|
Redmine::Search.map do |search|
|
||||||
search.register :vehicles
|
search.register :vehicles
|
||||||
|
|||||||
Reference in new issue
Block a user