Commit 9356036a4ea54b3da2a4e766de838881b667a13f

Authored by Antonio Terceiro
1 parent 692e6f67

ActionItem1050: restricting user themes

app/models/environment.rb
... ... @@ -48,6 +48,7 @@ class Environment < ActiveRecord::Base
48 48 'select_preferred_domain' => _('Select preferred domains per profile'),
49 49 'display_wizard_signup' => _('Display wizard signup'),
50 50 'use_portal_community' => _('Use the portal as news source for front page'),
  51 + 'user_themes' => N_('Allow users to create their own themes'),
51 52 }
52 53 end
53 54  
... ...
app/views/themes/index.rhtml
... ... @@ -65,31 +65,34 @@
65 65 <% end %>
66 66  
67 67  
68   - <tr>
69   - <td colspan='6'>
70   - <h2><%= _('My themes') %></h2>
71   - </td>
72   - </tr>
73   - <% for themes in profile.themes.in_groups_of(3) %>
  68 + <% if environment.enabled?('user_themes') %>
74 69 <tr>
75   - <% for theme in themes %>
76   - <td>
77   - <%# FIXME add proper thumbnails %>
78   - <%= image_tag('/images/icons-app/design-editor.png', :alt => (_('The "%s" theme.') % theme.name)) if theme %>
79   - </td>
80   - <td>
81   - <strong><%= theme.name if theme%></strong><br/>
82   - <%= link_to(_('Edit this theme'), :action => 'edit', :id => theme.id) if theme %>
83   - <br/>
84   - <%= link_to(_('Test this theme'), :action => 'start_test', :id => theme.id) if theme %>
85   - </td>
86   - <td>
87   - &nbsp;&nbsp;&nbsp;&nbsp;
88   - </td>
89   - <% end %>
  70 + <td colspan='6'>
  71 + <h2><%= _('My themes') %></h2>
  72 + </td>
90 73 </tr>
91   - <tr><td colspan='3'>&nbsp;</td></tr>
  74 + <% for themes in profile.themes.in_groups_of(3) %>
  75 + <tr>
  76 + <% for theme in themes %>
  77 + <td>
  78 + <%# FIXME add proper thumbnails %>
  79 + <%= image_tag('/images/icons-app/design-editor.png', :alt => (_('The "%s" theme.') % theme.name)) if theme %>
  80 + </td>
  81 + <td>
  82 + <strong><%= theme.name if theme%></strong><br/>
  83 + <%= link_to(_('Edit this theme'), :action => 'edit', :id => theme.id) if theme %>
  84 + <br/>
  85 + <%= link_to(_('Test this theme'), :action => 'start_test', :id => theme.id) if theme %>
  86 + </td>
  87 + <td>
  88 + &nbsp;&nbsp;&nbsp;&nbsp;
  89 + </td>
  90 + <% end %>
  91 + </tr>
  92 + <tr><td colspan='3'>&nbsp;</td></tr>
  93 + <% end %>
92 94 <% end %>
  95 +
93 96 </table>
94 97  
95 98 <% button_bar do %>
... ...