Commit a3f7b47957e500c98066380c32874320b96185c3
1 parent
a5bb8fc7
Exists in
master
and in
29 other branches
ActionItem18: customizing comatose
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@383 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
5 changed files
with
21 additions
and
16 deletions
Show diff stats
app/controllers/application.rb
app/helpers/document_helper.rb
1 | 1 | module DocumentHelper |
2 | 2 | |
3 | + # displays an icon corresponding to the document passed in +doc+. | |
4 | + # | |
5 | + # The class of the document can define its icon by providing an +icon+ | |
6 | + # method (i.e. +doc.class.icon+ will be called) | |
3 | 7 | def icon_for_document(doc) |
4 | - design_display_icon(doc.class.icon) | |
8 | + icon = | |
9 | + case doc | |
10 | + when Comatose::Page | |
11 | + 'text-x-generic' | |
12 | + else | |
13 | + if doc.class.respond_to?(:icon) | |
14 | + doc.class.icon | |
15 | + else | |
16 | + 'none' | |
17 | + end | |
18 | + end | |
19 | + design_display_icon(icon) | |
5 | 20 | end |
6 | 21 | |
7 | 22 | end | ... | ... |
app/views/comatose_admin/_page_list_item.rhtml
... | ... | @@ -23,24 +23,21 @@ collapse_children = (level >= Comatose.config.default_tree_level) |
23 | 23 | <li id="page_<%= page.id %>"> |
24 | 24 | <table cellpadding="0" cellspacing="0"> |
25 | 25 | <tr> |
26 | - <td rowspan="2" valign="center"> | |
26 | + <td valign="center"> | |
27 | 27 | <% if !page.children.empty? %> |
28 | 28 | <%= image_tag( ((collapse_children) ? 'comatose/collapsed.gif' : 'comatose/expanded.gif'), :title=>'Expand/Collapse', :onclick=>"ComatoseList.toggle_tree_nodes(this,#{page.id});", :class=>'tree-controller', :size=>'12x12', :id=>"page_controller_#{page.id}" ) %> |
29 | 29 | <% else %> |
30 | 30 | <%= image_tag 'comatose/no-children.gif', :size=>'12x12', :class=>'tree-controller' %> |
31 | 31 | <% end %> |
32 | 32 | </td> |
33 | - <td rowspan="2" valign="center"> | |
34 | - <%= image_tag 'comatose/page.gif', :size=>'25x31', :align=>"absmiddle" %> | |
33 | + <td valign="center"> | |
34 | + <%= icon_for_document(page) %> | |
35 | 35 | <span class="handle">DRAG</span> |
36 | 36 | </td> |
37 | 37 | <td> |
38 | 38 | <%= link_to page.title, {:action=>'edit', :id=>page}, :title=>"Path:#{page.full_path}", :class=>'page' %> |
39 | 39 | </td> |
40 | - </tr> | |
41 | - <tr> | |
42 | 40 | <td class="commands"> |
43 | - Updated <span title="Created on <%= page.created_on %>"><%= time_ago_in_words page.updated_on, true %> ago</span><%= " by #{page.author}" unless page.author.nil? or page.author.empty? %>, | |
44 | 41 | <%= links.join(', ') %>. |
45 | 42 | </td> |
46 | 43 | </tr> | ... | ... |
config/environment.rb