Commit 915f2250f7b18a74a28d3c3146b75e6bbc4ad844

Authored by Antonio Terceiro
1 parent b2dc6bdc

Cleaner theme selection screen

app/models/theme.rb
@@ -2,10 +2,10 @@ class Theme @@ -2,10 +2,10 @@ class Theme
2 2
3 class << self 3 class << self
4 def system_themes 4 def system_themes
5 - Dir.glob(File.join(system_themes_dir, '*')).map do |item|  
6 - File.basename(item)  
7 - end.map do |item|  
8 - new(item) 5 + Dir.glob(File.join(system_themes_dir, '*')).map do |path|
  6 + config_file = File.join(path, 'theme.yml')
  7 + config = File.exists?(config_file) ? YAML.load_file(config_file) : {}
  8 + new(File.basename(path), config)
9 end 9 end
10 end 10 end
11 11
@@ -61,7 +61,7 @@ class Theme @@ -61,7 +61,7 @@ class Theme
61 @id = id 61 @id = id
62 load_config 62 load_config
63 attributes.each do |k,v| 63 attributes.each do |k,v|
64 - self.send("#{k}=", v) 64 + self.send("#{k}=", v) if self.respond_to?("#{k}=")
65 end 65 end
66 config['id'] = id 66 config['id'] = id
67 end 67 end
app/views/themes/index.rhtml
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 :class => 'template-opt list-opt selected') 21 :class => 'template-opt list-opt selected')
22 else # Not selected 22 else # Not selected
23 link_to( 23 link_to(
24 - base_content + content_tag('span', _('Use this template') ) +'</div>', 24 + base_content +'</div>',
25 { :action => 'set_layout_template', :id => template.id }, 25 { :action => 'set_layout_template', :id => template.id },
26 :class => 'template-opt list-opt') 26 :class => 'template-opt list-opt')
27 end 27 end
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 if theme 46 if theme
47 47
48 base_content = image_tag( 48 base_content = image_tag(
49 - "/designs/themes/#{theme.name}/preview.png", 49 + "/designs/themes/#{theme.id}/preview.png",
50 :alt => (_('The "%s" theme.') % theme.name)) + 50 :alt => (_('The "%s" theme.') % theme.name)) +
51 '<div class="opt-info">' + 51 '<div class="opt-info">' +
52 content_tag('strong', theme.name, :class => 'name') + 52 content_tag('strong', theme.name, :class => 'name') +
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 :class => 'theme-opt list-opt selected') 58 :class => 'theme-opt list-opt selected')
59 else # Not selected 59 else # Not selected
60 link_to( 60 link_to(
61 - base_content + content_tag('span', _('Use this theme') ) +'</div>', 61 + base_content + '</div>',
62 { :action => 'set', :id => theme.id }, 62 { :action => 'set', :id => theme.id },
63 :class => 'theme-opt list-opt') 63 :class => 'theme-opt list-opt')
64 end 64 end
public/designs/themes/aluminium/theme.yml
1 -theme: "Aluminium theme" 1 +name: "Aluminium"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/base/theme.yml
1 -theme: "Noosfero base theme" 1 +name: "Noosfero base theme"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/butter/theme.yml
1 -theme: "Butter theme" 1 +name: "Butter"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/chameleon/theme.yml
1 -theme: "Chameleon theme" 1 +name: "Chameleon"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/chocolate/theme.yml
1 -theme: "Chocolate theme" 1 +name: "Chocolate"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/noosfero/theme.yml
1 -theme: "Noosfero default theme" 1 +name: "Noosfero"
2 layout: "application-ng" 2 layout: "application-ng"
3 jquery_theme: "smoothness_mod" 3 jquery_theme: "smoothness_mod"
4 icon_theme: [default, pidgin] 4 icon_theme: [default, pidgin]
public/designs/themes/orange/theme.yml
1 -theme: "Orange Red theme" 1 +name: "Orange"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/plum/theme.yml
1 -theme: "Plum theme" 1 +name: "Plum"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/profile-base/theme.yml
1 -theme: "Noosfero base theme for profiles" 1 +name: "Noosfero base theme for profiles"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/scarletred/theme.yml
1 -theme: "Scarlet Red theme" 1 +name: "Scarlet Red"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/designs/themes/skyblue/theme.yml
1 -theme: "Skyblue theme" 1 +name: "Sky Blue"
2 layout: "application-ng" 2 layout: "application-ng"
3 icon_theme: [default, pidgin] 3 icon_theme: [default, pidgin]
public/stylesheets/application.css
@@ -4101,10 +4101,10 @@ h1#agenda-title { @@ -4101,10 +4101,10 @@ h1#agenda-title {
4101 -webkit-border-radius: 10px; 4101 -webkit-border-radius: 10px;
4102 } 4102 }
4103 .list-opt:hover { 4103 .list-opt:hover {
4104 - background: #FE0; 4104 + background: #eeeeec;
4105 } 4105 }
4106 .list-opt.selected { 4106 .list-opt.selected {
4107 - background: #F8F0A0; 4107 + background: #fcf5c0;
4108 } 4108 }
4109 4109
4110 #theme-options .list-opt { 4110 #theme-options .list-opt {
@@ -4123,7 +4123,7 @@ h1#agenda-title { @@ -4123,7 +4123,7 @@ h1#agenda-title {
4123 4123
4124 .opt-info { 4124 .opt-info {
4125 position: absolute; 4125 position: absolute;
4126 - top: 15px; 4126 + top: 0px;
4127 left: 75px; 4127 left: 75px;
4128 width: 130px; 4128 width: 130px;
4129 } 4129 }
@@ -4135,16 +4135,12 @@ h1#agenda-title { @@ -4135,16 +4135,12 @@ h1#agenda-title {
4135 top: 2px; 4135 top: 2px;
4136 } 4136 }
4137 4137
4138 -.list-opt span {  
4139 - text-decoration: underline;  
4140 -}  
4141 -  
4142 .list-opt big { 4138 .list-opt big {
4143 opacity: 0.5; 4139 opacity: 0.5;
4144 } 4140 }
4145 4141
4146 .list-opt .name { 4142 .list-opt .name {
4147 - font-size: 20px; 4143 + font-size: 16px;
4148 } 4144 }
4149 #user-themes .list-opt .name { 4145 #user-themes .list-opt .name {
4150 font-size: 18px; 4146 font-size: 18px;