forked from fixin.me/fixin.me
Change namespace for defaults controllers
To allow proper path prefix for view partials when using config.action_view.prefix_partial_path_with_controller_namespace
This commit is contained in:
parent
f402e6ba00
commit
537cd18336
1
app/assets/images/pictograms/download-outline.svg
Normal file
1
app/assets/images/pictograms/download-outline.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="icon" viewBox="0 0 24 24"><path d="M13,5V11H14.17L12,13.17L9.83,11H11V5H13M15,3H9V9H5L12,16L19,9H15V3M19,18H5V20H19V18Z" /></svg>
|
After Width: | Height: | Size: 174 B |
1
app/assets/images/pictograms/upload-outline.svg
Normal file
1
app/assets/images/pictograms/upload-outline.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="icon" viewBox="0 0 24 24"><path d="M9,10V16H15V10H19L12,3L5,10H9M12,5.8L14.2,8H13V14H11V8H9.8L12,5.8M19,18H5V20H19V18Z" /></svg>
|
After Width: | Height: | Size: 173 B |
@ -1,4 +1,4 @@
|
||||
class Units::DefaultsController < ApplicationController
|
||||
class Default::UnitsController < ApplicationController
|
||||
navigation_tab :units
|
||||
|
||||
before_action except: :index do
|
||||
@ -6,5 +6,6 @@ class Units::DefaultsController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@units = current_user.units.defaults_diff
|
||||
end
|
||||
end
|
2
app/helpers/default/units_helper.rb
Normal file
2
app/helpers/default/units_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module Default::UnitsHelper
|
||||
end
|
@ -1,2 +0,0 @@
|
||||
module Units::DefaultsHelper
|
||||
end
|
17
app/views/default/units/index.html.erb
Normal file
17
app/views/default/units/index.html.erb
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="rightside buttongrid">
|
||||
<%= image_link_to t('.back'), 'arrow-left-bold-outline', units_path %>
|
||||
</div>
|
||||
|
||||
<table class="main items">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= User.human_attribute_name(:symbol).capitalize %></th>
|
||||
<% if current_user.at_least(:active) %>
|
||||
<th><%= t :actions %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="units">
|
||||
<%= render(@units, partial: 'default') || render_no_items %>
|
||||
</tbody>
|
||||
</table>
|
@ -1,2 +0,0 @@
|
||||
<h1>Units::Defaults#index</h1>
|
||||
<p>Find me in app/views/units/defaults/index.html.erb</p>
|
@ -2,9 +2,8 @@
|
||||
<% if current_user.at_least(:active) %>
|
||||
<%= image_link_to t('.add_unit'), 'plus-outline', new_unit_path, id: :add_unit,
|
||||
onclick: 'this.blur();', data: {turbo_stream: true} %>
|
||||
<%= image_link_to t('.import_units'), 'import', units_defaults_path, class: 'tools',
|
||||
data: {turbo_stream: true} %>
|
||||
<% end %>
|
||||
<%= image_link_to t('.import_units'), 'download-outline', default_units_path, class: 'tools' %>
|
||||
</div>
|
||||
|
||||
<%= tag.div id: :unit_form %>
|
||||
|
@ -67,6 +67,10 @@ en:
|
||||
multiplier_reset: Multiplier of "%{symbol}" has been reset to 1, due to repositioning
|
||||
destroy:
|
||||
success: Deleted unit
|
||||
default:
|
||||
units:
|
||||
index:
|
||||
back: Back to units...
|
||||
users:
|
||||
index:
|
||||
disguise: View as...
|
||||
|
@ -8,8 +8,8 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
namespace :units do
|
||||
resources :defaults, only: :index
|
||||
namespace :default do
|
||||
resources :units, only: :index
|
||||
end
|
||||
|
||||
resources :users, only: [:index, :show, :update] do
|
||||
|
@ -1,6 +1,6 @@
|
||||
require "test_helper"
|
||||
|
||||
class Units::DefaultsControllerTest < ActionDispatch::IntegrationTest
|
||||
class Default::UnitsControllerTest < ActionDispatch::IntegrationTest
|
||||
test "should get index" do
|
||||
get units_defaults_index_url
|
||||
assert_response :success
|
Loading…
x
Reference in New Issue
Block a user