th_simple_admin_panel 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDVkZTQzMjlkNzg4MTg0ZmJiZjY1ZWNkYjJmNjIyOTM1NjkwOWY5Mw==
4
+ YmM5ZmQzNTU5MTM2MzhiMDkzOWY5NzI4MmYyYTVmODZmZGNiMWRmYQ==
5
5
  data.tar.gz: !binary |-
6
- Mjg2ZmRkMzFhNTBlYzFmM2NjNzVmNTg4YWNhZjQ5YzZiNzk2MGY1MQ==
6
+ ZWI1YmE5NTE1NDFkMzc0YzliZTBmYWNhZjgwMTFmZGZkZTg0YWQxYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjQ1NzljODJjZmNhNWRjMjU1ZWZhNWEwOWQyNjVmMzk3ZWRmNWMyYWNhMzg0
10
- ZGQwODdmODA1NTEyZGMyZjYyYmFkMGJlOTkwZjkzY2RiMDYxZWRiOGQzNTUw
11
- NmU0MjdiNDQ1MjczMjBmYzMyMmZiMWFjZmVkMDRiNjc1Y2JiNGQ=
9
+ MjRjNmVjYjlmOTJjMWM3M2JiMjBkOTE1MzMyNzIyYzRlMzljNzBlNjRjZTFj
10
+ MzgzNjYzNjVkMWUxNjExMTVlOWQwZGYwZTg4NWFkZTUyYWIzM2Y1YmM4OWYw
11
+ MDZkYmRhMDEyMGM4NWM4MGNhMGZjOWI4MzNiMzMzOWY0NDZlMzE=
12
12
  data.tar.gz: !binary |-
13
- YTllZWQyN2E2OTJmZTU4ZThiODU1MmUzYjVkMThhNDQ2NjJmMTI4NTY0ZDIw
14
- NDdjMjZmMjQ5ZGFlMDBhZmU5ODZlZTU0MjQwNmY4MTM0NTc5MjMxZWNjY2U2
15
- NjhiNDI1M2QzOTQwNjk2OWFmZjc2YzliNzVhYWY4OWNkNWZhYWQ=
13
+ ZDA3OTdiMjQyOThmZWYxZGM2Y2RkYzkwZGQ5NjYzNDI5YTQxNDZiZGZlNjhi
14
+ ZDNlMTViMTcyOWMxZDY2MmJjYWZlM2UxZDFiNmQ1YTI5MmNlMTIzZDM5M2Qz
15
+ NzgzZTYxNGExOGM1N2JiZWU4ODFlNjJiZjBmNmFkZDI5NWE0Y2I=
@@ -0,0 +1,9 @@
1
+ module SimpleAdminPanel
2
+ module BreadcrumbHelper
3
+ def label_for_resource resource
4
+ %w(label name title to_s).each do |attr|
5
+ return resource.public_send attr if resource.respond_to? attr
6
+ end
7
+ end
8
+ end
9
+ end
@@ -4,7 +4,7 @@
4
4
 
5
5
  <% association_chain.each do |association_item| %>
6
6
  <li><%= link_to association_item.class.model_name.human(count: 2), url_for(controller: association_item.class.model_name.underscore.pluralize, action: :index) %> <span class="divider">/</span></li>
7
- <li><%= link_to association_item.name, url_for(controller: association_item.class.model_name.underscore.pluralize, action: :show, id: association_item.id) %> <span class="divider">/</span></li>
7
+ <li><%= link_to label_for_resource(association_item), url_for(controller: association_item.class.model_name.underscore.pluralize, action: :show, id: association_item.id) %> <span class="divider">/</span></li>
8
8
  <% end %>
9
9
 
10
10
  <% if %w(new create).include?(params[:action]) %>
@@ -17,9 +17,9 @@
17
17
  <% end %>
18
18
  <% elsif params[:action] == "show" %>
19
19
  <li><%= link_to resource_class.model_name.human(count: 2), collection_path %> <span class="divider">/</span></li>
20
- <li class="active"><%= resource.name %></li>
20
+ <li class="active"><%= label_for_resource resource %></li>
21
21
  <% if controller.respond_to?(:destroy) && can?(:destroy, resource) %>
22
- <li class="pull-right"><%= link_to icon("trash icon-white") + " Verwijderen", resource_path, class: "btn btn-mini btn-danger", method: :delete, confirm: "Are you sure to delete #{resource_class.model_name.human(count: 1)} '#{resource.name}'?" %></li>
22
+ <li class="pull-right"><%= link_to icon("trash icon-white") + " Verwijderen", resource_path, class: "btn btn-mini btn-danger", method: :delete, confirm: "Are you sure to delete #{resource_class.model_name.human(count: 1)} '#{label_for_resource resource}'?" %></li>
23
23
  <% end %>
24
24
  <% if controller.respond_to?(:edit) && can?(:edit, resource) %>
25
25
  <li class="pull-right"><%= link_to icon("edit icon-white") + " Wijzigen", edit_resource_path, class: "btn btn-mini btn-info" %></li>
@@ -27,7 +27,7 @@
27
27
  <% else %>
28
28
  <li><%= link_to resource_class.model_name.human(count: 2), collection_path %> <span class="divider">/</span></li>
29
29
  <% if params[:id].present? %>
30
- <li><%= link_to_if controller.respond_to?(:show) && can?(:show, resource), resource.name, resource_path %> <span class="divider">/</span></li>
30
+ <li><%= link_to_if controller.respond_to?(:show) && can?(:show, resource), label_for_resource(resource), resource_path %> <span class="divider">/</span></li>
31
31
  <% end %>
32
32
  <li class="active"><%= t(".actions.#{resource_class.model_name.underscore}.#{params[:action]}", default: t(".actions.#{params[:action]}")) %></li>
33
33
  <% end %>
@@ -3,6 +3,7 @@ module SimpleAdminPanel::ControllerExtensions
3
3
 
4
4
  included do
5
5
  layout "simple_admin_panel/application"
6
+ helper SimpleAdminPanel::BreadcrumbHelper
6
7
  with_role :admin if self.is_a? InheritedResources::Base
7
8
  before_filter :authenticate_user!
8
9
  before_filter :require_admin
@@ -1,4 +1,4 @@
1
1
  module SimpleAdminPanel
2
- class Engine < ::Rails::Engine
3
- end
2
+ class Engine < ::Rails::Engine
3
+ end
4
4
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleAdminPanel
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: th_simple_admin_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Hinloopen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-30 00:00:00.000000000 Z
11
+ date: 2013-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -64,7 +64,7 @@ files:
64
64
  - app/assets/stylesheets/shared/layout.css.scss
65
65
  - app/assets/stylesheets/shared.css.scss
66
66
  - app/controllers/simple_admin_panel/application_controller.rb
67
- - app/helpers/simple_admin_panel/application_helper.rb
67
+ - app/helpers/simple_admin_panel/breadcrumb_helper.rb
68
68
  - app/views/layouts/simple_admin_panel/_alert.html.erb
69
69
  - app/views/layouts/simple_admin_panel/_breadcrumb.html.erb
70
70
  - app/views/layouts/simple_admin_panel/_navbar.html.erb
@@ -1,4 +0,0 @@
1
- module SimpleAdminPanel
2
- module ApplicationHelper
3
- end
4
- end