Skip to content
Snippets Groups Projects
Commit 6d56afc0 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

clean

parent 8a62819f
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,16 @@ module ApplicationController::WithContext
included do
def current_university
@current_university ||= University.with_host(request.host)
unless @current_university
@current_university = current_website ? current_website.university
: University.with_host(request.host)
end
@current_university
end
helper_method :current_university
def current_website
@current_website ||= Features::Websites::Site.with_host(request.host)
@current_website ||= Features::Websites::Site.with_host(request.host)
end
helper_method :current_website
......
......@@ -7,21 +7,21 @@ module Admin::ApplicationHelper
def show_link(object, **options)
link_to_if can?(:read, object),
options.delete(:label) || 'Voir',
options.delete(:label) || t('show'),
polymorphic_url_param(object, **options),
class: button_classes
end
def edit_link(object, **options)
return unless can?(:update, object)
link_to options.delete(:label) || 'Modifier',
link_to options.delete(:label) || t('edit'),
polymorphic_url_param(object, prefix: :edit, **options),
class: button_classes
end
def destroy_link(object, **options)
return unless can?(:destroy, object)
link_to options.delete(:label) || 'Supprimer',
link_to options.delete(:label) || t('delete'),
polymorphic_url_param(object, **options),
method: :delete,
data: { confirm: 'Êtes-vous certain ?' },
......@@ -32,7 +32,7 @@ module Admin::ApplicationHelper
return unless can?(:create, object_class)
object_class_sym = object_class.name.underscore.gsub('/', '_').to_sym
link_to options.delete(:label) || 'Créer',
link_to options.delete(:label) || t('create'),
polymorphic_url_param(object_class_sym, prefix: :new, **options),
class: button_classes
end
......
......@@ -24,5 +24,5 @@
</table>
<% content_for :buttons do %>
<%= create_link University %>
<%= link_to t('create'), new_adminserver_university_path, class: button_classes %>
<% end %>
<footer>
<div class="container small">
<%= current_university %>
</div>
</footer>
<nav class="navbar navbar-light">
<div class="container">
<a class="navbar-brand" href="/">
<% if current_website %>
<%= current_website %><br>
<% else %>
<%= current_university %>
<% end %>
</a>
</div>
</nav>
......@@ -10,17 +10,11 @@
<%= javascript_include_tag 'application' %>
</head>
<body>
<nav>
<div class="container-fluid text-center">
<% if current_website %>
Site: <%= current_website %><br>
<% end %>
University: <%= current_university %>
</div>
</nav>
<main class="container-fluid">
<%= render 'nav' %>
<main class="container">
<%= render_breadcrumbs builder: Appstack::BreadcrumbsOnRailsBuilder %>
<%= yield %>
</main>
<%= render 'footer' %>
</body>
</html>
......@@ -2,6 +2,8 @@ fr:
true: Oui
false: Non
dashboard: Tableau de bord
show: Voir
create: Créer
edit: Modifier
delete: Supprimer
activerecord:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment