Skip to content

Commit

Permalink
container links management from superadmin
Browse files Browse the repository at this point in the history
  • Loading branch information
anupnivargi committed Feb 22, 2010
1 parent ea09d86 commit 6af948d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/helpers/admin/application_helper.rb
Expand Up @@ -49,7 +49,7 @@ def select_language(*args)
# <tt>checkboxes_from_list(ITEMS, sa_items, @conf, "conf") </tt>
def checkboxes_from_list(var, param, conf, object, horizontal=false)
res = []
key = ([param.split('_').last.singularize] & ['item', 'language', 'layout', 'type', 'category']).first
key = ([param.split('_').last.singularize] & ['item', 'language', 'layout', 'type', 'category','container']).first
var.each do |l|
if horizontal
content = '<div class="checkboxListHorizontal">'
Expand Down Expand Up @@ -103,4 +103,4 @@ def available_item_types_for_ck
str += "<a href='/admin/ck_display/tabs/links' id='fck_insert_link'>Link</a></div>"
str
end
end
end
12 changes: 7 additions & 5 deletions app/views/layouts/_admin_menu.html.erb
Expand Up @@ -59,18 +59,20 @@
</ul>
</div>
<% CONTAINERS.each do |container| %>
<% containers = container.classify.constantize.allowed_user_with_permission(@current_user, "#{container}_show", container) %>
<% unless containers.blank? %>
<div class="subMenuCol">
<% if available_containers_links.include?(container) %>
<% containers = container.classify.constantize.allowed_user_with_permission(@current_user, "#{container}_show", container) %>
<% unless containers.blank? %>
<div class="subMenuCol">
<h3><%= I18n.t("layout.application.#{container.pluralize}") %></h3>
<ul>
<% containers.each do |w| -%>
<li><%= link_to w.title, container_path(w) %></li>
<% end -%>
</ul>
</div>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
</div>
<div class="menuLabel"><%= I18n.t('layout.menu.display') %></div>
Expand Down
18 changes: 10 additions & 8 deletions app/views/layouts/_user_menu.html.erb
Expand Up @@ -56,17 +56,19 @@
</ul>
</div>
<% CONTAINERS.each do |container| %>
<% if available_containers_links.include?(container) %>
<% containers = container.classify.constantize.allowed_user_with_permission(@current_user, "#{container}_show", container) %>
<% unless containers.blank? %>
<div class="subMenuCol">
<h3><%= I18n.t("layout.application.#{container.pluralize}") %></h3>
<ul>
<% containers.each do |w| -%>
<li><%= link_to w.title, container_path(w) %></li>
<% end -%>
</ul>
<div class="subMenuCol">
<h3><%= I18n.t("layout.application.#{container.pluralize}") %></h3>
<ul>
<% containers.each do |w| -%>
<li><%= link_to w.title, container_path(w) %></li>
<% end -%>
</ul>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions app/views/superadmin/general_settings/index.html.erb
Expand Up @@ -35,6 +35,11 @@
<%= f.check_box :sa_mandatory_user_activation, { :class => "checkboxes"}, 'true', 'false' %>
</div>

<label>Available Container Links:</label>
<div class="formElement">
<%= checkboxes_from_list(CONTAINERS, "sa_containers", @configuration, "configuration", true) %>
</div>

<label>Available items:</label>
<div class="formElement">
<%= checkboxes_from_list(ITEMS, "sa_items", @configuration, "configuration", true) %>
Expand Down
9 changes: 8 additions & 1 deletion lib/configuration.rb
Expand Up @@ -31,6 +31,13 @@ def is_mandatory_user_activation?
return @configuration['sa_mandatory_user_activation']=='true'
end

# Get Selected Items List
#
# will return a array of string of available items
def available_containers_links
return @configuration['sa_containers'] || CONTAINERS
end

# Get Selected Items List
#
# will return a array of string of available items
Expand Down Expand Up @@ -79,4 +86,4 @@ def get_fcke_item_types
return ['page', 'image', 'cms_file', 'video', 'audio', 'bookmark']
end

end
end

0 comments on commit 6af948d

Please sign in to comment.