disguise 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -2,9 +2,13 @@ class Admin::Disguise::DomainThemesController < ApplicationController
2
2
  unloadable
3
3
 
4
4
  def create
5
- @domain_theme = DomainTheme.create(params[:domain_theme])
6
- respond_to do |format|
5
+ @domain_theme = DomainTheme.new(params[:domain_theme])
6
+ if !@domain_theme.save
7
+ flash[:notice] = t('disguise.error_creating_domain_theme', :error => @domain_theme.errors.full_messages.to_sentence)
8
+ else
7
9
  flash[:notice] = t('disguise.theme_updated')
10
+ end
11
+ respond_to do |format|
8
12
  format.html { redirect_to edit_admin_theme_path }
9
13
  end
10
14
  end
@@ -18,4 +22,13 @@ class Admin::Disguise::DomainThemesController < ApplicationController
18
22
  end
19
23
  end
20
24
 
25
+ def destroy
26
+ @domain_theme = DomainTheme.find(params[:id])
27
+ @domain_theme.destroy
28
+ respond_to do |format|
29
+ flash[:notice] = t('disguise.uri_deleted')
30
+ format.html { redirect_to edit_admin_theme_path }
31
+ end
32
+ end
33
+
21
34
  end
@@ -6,7 +6,7 @@ class Admin::Disguise::ThemesController < ApplicationController
6
6
  def edit
7
7
  @current_theme, @themes = Theme.available_themes(@theme)
8
8
  @domain_themes = {}
9
- DomainTheme.all.each{|d| @domain_themes[d.name] = d}
9
+ DomainTheme.all.each{ |d| @domain_themes[d.name] = @domain_themes[d.name].blank? ? [d] : @domain_themes[d.name] << d }
10
10
  if @themes.empty?
11
11
  respond_to do |format|
12
12
  format.html { render :template => 'admin/themes/no_themes' }
@@ -1,7 +1,6 @@
1
1
  class DomainTheme < ActiveRecord::Base
2
2
 
3
3
  validates_presence_of :name, :uri
4
- validates_uniqueness_of :name, :uri
5
4
 
6
5
  class << self
7
6
  def use_domain_themes?
@@ -6,16 +6,26 @@
6
6
  <%= theme[:description] %>
7
7
  <% end -%>
8
8
  <% if DomainTheme.use_domain_themes? -%>
9
- <% domain_theme = @domain_themes[theme[:name]] || DomainTheme.new(:name => theme[:name]) %>
9
+ <% domain_theme = DomainTheme.new(:name => theme[:name]) %>
10
10
  <% form_for [:admin, domain_theme] do |f| -%>
11
11
  <%= f.hidden_field :name %>
12
12
  <%= f.label t('disguise.theme_uri_label') %>
13
13
  <%= f.text_field :uri %>
14
- <% if domain_theme.new_record? -%>
15
- <%= submit_tag t('disguise.add_uri') %>
16
- <% else -%>
17
- <%= submit_tag t('disguise.update_uri') %>
18
- <% end -%>
14
+ <%= submit_tag t('disguise.add_uri') %>
19
15
  <% end -%>
20
16
  <% end -%>
21
- </div>
17
+ <% if !@domain_themes[theme[:name]].blank? %>
18
+ <p class="theme-information"><%= t('disguise.uris_title') %></p>
19
+ <ul class="theme-list">
20
+ <% @domain_themes[theme[:name]].each do |domain_theme| -%>
21
+ <li>
22
+ <% form_for [:admin, domain_theme], :html => { :method => :delete } do |f| -%>
23
+ <%= domain_theme.uri %>
24
+ <%= submit_tag t('disguise.delete_uri') %>
25
+ <% end -%>
26
+ </li>
27
+ <% end -%>
28
+ </ul>
29
+ <% end -%>
30
+ </div>
31
+
@@ -1,7 +1,7 @@
1
1
  <h1><%= t('disguise.set_theme') %></h1>
2
2
  <div id="current-theme">
3
3
  <% if DomainTheme.use_domain_themes? -%>
4
- <%= t('disguise.use_domain_themes') %>
4
+ <h2><%= t('disguise.use_domain_themes') %></h2>
5
5
  <% else -%>
6
6
  <h2><%= t('disguise.name_theme') %></h2>
7
7
  <% if @current_theme -%>
@@ -13,8 +13,8 @@
13
13
  <% else -%>
14
14
  <%= t('disguise.no_current_theme') %>
15
15
  <% end -%>
16
+ <h2><%= t('disguise.activate_theme_message') %></h2>
16
17
  <% end -%>
17
18
  </div>
18
- <h2><%= t('disguise.activate_theme_message') %></h2>
19
19
  <%= error_messages_for :theme %>
20
- <%= render :partial => 'admin/themes/theme', :collection => @themes %>
20
+ <%= render :partial => 'admin/themes/theme', :collection => @themes %>
data/disguise.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{disguise}
5
- s.version = "0.2.0"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Justin Ball"]
9
- s.date = %q{2009-06-06}
9
+ s.date = %q{2009-06-11}
10
10
  s.description = %q{Add themes to your Rails application to easily change the view layer and impress everyone you know}
11
11
  s.email = %q{justinball@gmail.com}
12
12
  s.extra_rdoc_files = [
data/locales/en.yml CHANGED
@@ -6,8 +6,12 @@ en:
6
6
  current_theme: Current Theme
7
7
  activate_theme_message: Click on a theme to activate it
8
8
  no_current_theme: 'Currently no theme has been selected for this application and so the default application view will be used.'
9
- use_domain_themes: 'Themes are currently set to be changed based on the current url. In this mode the current theme will be determined by the url specified with each theme below.'
9
+ use_domain_themes: 'The current theme will be determined by the url specified with each theme below.'
10
10
  update_uri: Update Url
11
- add_uri: Add Url
11
+ add_uri: Add
12
+ delete_uri: Delete
12
13
  remove_all_themes: "Remove all themes and use default application templates"
13
- theme_uri_label: Url for Theme
14
+ theme_uri_label: Url for Theme
15
+ uris_title: "This theme will be displayed for all the following urls"
16
+ error_creating_domain_theme: "There was a problem adding the url: {{error}}"
17
+ uri_deleted: "The specified url has been deleted"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disguise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-06 00:00:00 -06:00
12
+ date: 2009-06-11 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15