mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-03 10:24:30 +08:00
Settings page - breadcrumbs [SCI-8511]
This commit is contained in:
parent
c152df4e71
commit
88df4b2a11
9 changed files with 76 additions and 36 deletions
|
@ -5,6 +5,7 @@ class LabelPrintersController < ApplicationController
|
||||||
|
|
||||||
before_action :check_manage_permissions, except: %i(index index_zebra update_progress_modal)
|
before_action :check_manage_permissions, except: %i(index index_zebra update_progress_modal)
|
||||||
before_action :find_label_printer, only: %i(edit update destroy)
|
before_action :find_label_printer, only: %i(edit update destroy)
|
||||||
|
before_action :set_breadcrumbs_items, only: %i(index_zebra)
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@label_printers = LabelPrinter.all
|
@label_printers = LabelPrinter.all
|
||||||
|
@ -133,4 +134,22 @@ class LabelPrintersController < ApplicationController
|
||||||
def find_label_printer
|
def find_label_printer
|
||||||
@label_printer = LabelPrinter.find(params[:id])
|
@label_printer = LabelPrinter.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_breadcrumbs_items
|
||||||
|
@breadcrumbs_items = []
|
||||||
|
@breadcrumbs_items.push({
|
||||||
|
label: t('breadcrumbs.addons'),
|
||||||
|
url: addons_path
|
||||||
|
})
|
||||||
|
if @label_printer
|
||||||
|
@breadcrumbs_items.push({
|
||||||
|
label: @label_printer.name,
|
||||||
|
url: label_printers_path(@label_printer)
|
||||||
|
})
|
||||||
|
else
|
||||||
|
@breadcrumbs_items.push({
|
||||||
|
label: t('breadcrumbs.label_printer')
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,25 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Users
|
module Users
|
||||||
module Settings
|
module Settings
|
||||||
module Account
|
module Account
|
||||||
class AddonsController < ApplicationController
|
class AddonsController < ApplicationController
|
||||||
|
before_action :set_breadcrumbs_items, only: %i(index show)
|
||||||
layout 'fluid'
|
layout 'fluid'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@label_printer_any = LabelPrinter.any?
|
@label_printer_any = LabelPrinter.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_breadcrumbs_items
|
||||||
|
@breadcrumbs_items = []
|
||||||
|
@breadcrumbs_items.push({
|
||||||
|
label: t('breadcrumbs.addons'),
|
||||||
|
url: addons_path
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Users
|
module Users
|
||||||
module Settings
|
module Settings
|
||||||
class TeamsController < ApplicationController
|
class TeamsController < ApplicationController
|
||||||
|
@ -6,27 +8,29 @@ module Users
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include InputSanitizeHelper
|
include InputSanitizeHelper
|
||||||
|
|
||||||
before_action :load_user, only: [
|
before_action :load_user, only: %i(
|
||||||
:index,
|
index
|
||||||
:datatable,
|
datatable
|
||||||
:new,
|
new
|
||||||
:create,
|
create
|
||||||
:show,
|
show
|
||||||
:users_datatable
|
users_datatable
|
||||||
]
|
)
|
||||||
|
|
||||||
before_action :load_team, only: [
|
before_action :load_team, only: %i(
|
||||||
:show,
|
show
|
||||||
:users_datatable,
|
users_datatable
|
||||||
:name_html,
|
name_html
|
||||||
:description_html,
|
description_html
|
||||||
:update,
|
update
|
||||||
:destroy
|
destroy
|
||||||
]
|
)
|
||||||
|
|
||||||
before_action :check_create_team_permission,
|
before_action :check_create_team_permission,
|
||||||
only: %i(new create)
|
only: %i(new create)
|
||||||
|
|
||||||
|
before_action :set_breadcrumbs_items, only: %i(index show)
|
||||||
|
|
||||||
layout 'fluid'
|
layout 'fluid'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -154,7 +158,7 @@ module Users
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_team
|
def load_team
|
||||||
@team = Team.find_by_id(params[:id])
|
@team = Team.find_by(id: params[:id])
|
||||||
render_403 unless can_manage_team?(@team)
|
render_403 unless can_manage_team?(@team)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -171,6 +175,21 @@ module Users
|
||||||
:description
|
:description
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_breadcrumbs_items
|
||||||
|
@breadcrumbs_items = []
|
||||||
|
|
||||||
|
@breadcrumbs_items.push({
|
||||||
|
label: t('breadcrumbs.teams'),
|
||||||
|
url: teams_path
|
||||||
|
})
|
||||||
|
if @team
|
||||||
|
@breadcrumbs_items.push({
|
||||||
|
label: @team.name,
|
||||||
|
url: team_path(@team)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,13 +5,6 @@
|
||||||
|
|
||||||
<div class="content-pane flexible label-printer-show">
|
<div class="content-pane flexible label-printer-show">
|
||||||
<div class="content-header">
|
<div class="content-header">
|
||||||
<div id="breadcrumbsWrapper">
|
|
||||||
<div class="breadcrumbs-container">
|
|
||||||
<%= render partial: 'shared/breadcrumbs', locals: {
|
|
||||||
links: [{label: 'Add-ons', url: addons_path}]
|
|
||||||
} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="title-row">
|
<div class="title-row">
|
||||||
<h1 class="printer-title">
|
<h1 class="printer-title">
|
||||||
<% if @printer_type == 'fluics' %>
|
<% if @printer_type == 'fluics' %>
|
||||||
|
|
|
@ -56,8 +56,10 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="breadcrumbs-link" title="<%= last_item[:label] %>">
|
<% if last_item %>
|
||||||
<%= last_item[:label] %>
|
<span class="breadcrumbs-link" title="<%= last_item[:label] %>">
|
||||||
</span>
|
<%= last_item[:label] %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -9,9 +9,6 @@
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane content-pane" role="tabpanel"></div>
|
<div class="tab-pane content-pane" role="tabpanel"></div>
|
||||||
<div class="tab-pane content-pane active" role="tabpanel">
|
<div class="tab-pane content-pane active" role="tabpanel">
|
||||||
|
|
||||||
<%= render partial: "users/settings/teams/breadcrumbs.html.erb" %>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<% if @member_of > 0 %>
|
<% if @member_of > 0 %>
|
||||||
<%= t("users.settings.teams.index.description_label") %>
|
<%= t("users.settings.teams.index.description_label") %>
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane content-pane" role="tabpanel"></div>
|
<div class="tab-pane content-pane" role="tabpanel"></div>
|
||||||
<div class="tab-pane content-pane active" role="tabpanel">
|
<div class="tab-pane content-pane active" role="tabpanel">
|
||||||
|
|
||||||
<%= render partial: "users/settings/teams/breadcrumbs.html.erb" %>
|
|
||||||
|
|
||||||
<%= bootstrap_form_for @new_team, url: create_team_path do |f| %>
|
<%= bootstrap_form_for @new_team, url: create_team_path do |f| %>
|
||||||
<div class="form-group" style="max-width: 500px;">
|
<div class="form-group" style="max-width: 500px;">
|
||||||
<%= f.text_field :name,
|
<%= f.text_field :name,
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane content-pane" role="tabpanel"></div>
|
<div class="tab-pane content-pane" role="tabpanel"></div>
|
||||||
<div class="tab-pane content-pane active team-settings-pane" role="tabpanel">
|
<div class="tab-pane content-pane active team-settings-pane" role="tabpanel">
|
||||||
|
|
||||||
<%= render partial: "users/settings/teams/breadcrumbs.html.erb" %>
|
|
||||||
|
|
||||||
<!-- TITLE -->
|
<!-- TITLE -->
|
||||||
<h1 id="team-name" class="settings-team-name" data-current-team="<%= current_team == @team %>">
|
<h1 id="team-name" class="settings-team-name" data-current-team="<%= current_team == @team %>">
|
||||||
<% if can_manage_team?(@team) %>
|
<% if can_manage_team?(@team) %>
|
||||||
|
|
|
@ -3592,6 +3592,9 @@ en:
|
||||||
inventories: "Inventories"
|
inventories: "Inventories"
|
||||||
protocols: "Protocol templates"
|
protocols: "Protocol templates"
|
||||||
labels: "Label templates"
|
labels: "Label templates"
|
||||||
|
teams: "All Teams"
|
||||||
|
addons: "Add-Ons"
|
||||||
|
label_printer: "Label Printer"
|
||||||
|
|
||||||
Add: "Add"
|
Add: "Add"
|
||||||
Asset: "File"
|
Asset: "File"
|
||||||
|
|
Loading…
Add table
Reference in a new issue