Commit dae2c3ed8895b5fea60fe20530b3634e9c8a1ee6
1 parent
2931665f
Exists in
remove_broken_theme
Remove broken theme
- The theme: Noosfero responsive some Bootstrap styling. Was removed Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com> Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
1 changed file
with
29 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,29 @@ | @@ -0,0 +1,29 @@ | ||
| 1 | +require_dependency 'theme' | ||
| 2 | + | ||
| 3 | +class Theme | ||
| 4 | + | ||
| 5 | + class << self | ||
| 6 | + def approved_themes(owner) | ||
| 7 | + Dir.glob(File.join(system_themes_dir, '*')).map do |item| | ||
| 8 | + next unless File.exists? File.join(item, 'theme.yml') | ||
| 9 | + id = File.basename item | ||
| 10 | + config = YAML.load_file File.join(item, 'theme.yml') | ||
| 11 | + | ||
| 12 | + approved = config['public'] | ||
| 13 | + unless approved | ||
| 14 | + begin | ||
| 15 | + approved = owner.kind_of?(config['owner_type'].constantize) | ||
| 16 | + rescue | ||
| 17 | + end | ||
| 18 | + approved &&= config['owner_id'] == owner.id if config['owner_id'].present? | ||
| 19 | + end | ||
| 20 | + | ||
| 21 | + approved = false if id == 'cube-responsive' | ||
| 22 | + | ||
| 23 | + [id, config] if approved | ||
| 24 | + end.compact.map do |id, config| | ||
| 25 | + new id, config | ||
| 26 | + end | ||
| 27 | + end | ||
| 28 | + end | ||
| 29 | +end |