Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed 'Add' from sidebar.

  • Loading branch information...
commit 281cc215883fcf91ffc5a4036bcce0de376334c5 1 parent 2ad00eb
@fesplugas fesplugas authored
View
4 CHANGELOG.md
@@ -44,6 +44,10 @@ CHANGELOG
* [CHANGED] Removed `generate_html` alias method and use `get_paginated_data`.
This also fixes the usage of `ctags`.
+ * [CHANGED] Do not show "Add" link on the sidebar because it's confusing,
+ duplicated. We also have plans to remove the sidebar, so consider this as an
+ starting point. (Sidebar will be replaced by a drop down menu.)
+
Changes: <https://github.com/fesplugas/typus/compare/v3.1.9...master>
View
4 app/assets/stylesheets/typus/sidebar.css
@@ -17,6 +17,10 @@
line-height: 1.5em;
}
+#sidebar ul li.active:before {
+ content: "»";
+}
+
#sidebar ul ul li {
list-style: none;
padding-left: 0.5em;
View
10 app/helpers/admin/resources_helper.rb
@@ -12,13 +12,13 @@ def admin_search(resource = @resource, params = params)
end
def build_sidebar
- resources = ActiveSupport::OrderedHash.new
+ resources = []
app_name = @resource.typus_application
admin_user.application(app_name).each do |resource|
klass = resource.constantize
unless klass.typus_options_for(:hide_from_sidebar)
- resources[resource] = [sidebar_add_new(klass)].compact
+ resources << klass
end
end
@@ -29,12 +29,6 @@ def build_sidebar
end
end
- def sidebar_add_new(klass)
- if admin_user.can?("create", klass)
- { :message => Typus::I18n.t("Add"), :url => { :action => "new" } }
- end
- end
-
# TODO: This method should be moved to `lib/typus/controller/actions.rb`
def resource_actions
@resource_actions ||= []
View
21 app/views/helpers/admin/resources/_sidebar.html.erb
@@ -1,23 +1,14 @@
<div id="sidebar">
- <% resources.each do |resource, actions| %>
-
- <% klass = resource.constantize %>
+ <% resources.each do |resource| %>
+ <% html_class = @resource.model_name.eql?(resource.model_name) ? 'active' : 'inactive' %>
<ul>
-
- <%= link_to :controller => "/admin/#{klass.to_resource}" do %>
- <li class="header"><%= klass.model_name.human.pluralize %></li>
+ <%= link_to :controller => "/admin/#{resource.to_resource}" do %>
+ <li class="header <%= html_class %>">
+ <%= resource.model_name.human.pluralize %>
+ </li>
<% end %>
-
- <% if @resource.model_name.eql?(resource) %>
- <ul>
- <% actions.each do |action| %>
- <li><%= link_to action[:message], action[:url] %></li>
- <% end %>
- </ul>
- <% end %>
-
</ul>
<% end %>
Please sign in to comment.
Something went wrong with that request. Please try again.