fesplugas-typus 0.9.16 → 0.9.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -72,6 +72,7 @@ Typus and blog about Typus.
72
72
  - Alexey Noskov (Russian translation and code) http://github.com/alno
73
73
  - Andres Gutierres (Bugfixes & feedback) http://github.com/andresgutgon
74
74
  - Komzák Nándor (Code, bugfixes & feedback) http://github.com/rubymood
75
+ - Michael Grunewalder (German translation) http://michael.grunewalder.com
75
76
 
76
77
  == Acknowledgments
77
78
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.16
1
+ 0.9.17
@@ -37,7 +37,7 @@ module Admin::SidebarHelper
37
37
 
38
38
  @resource[:class].typus_actions_for(params[:action]).each do |action|
39
39
  if @current_user.can_perform?(@resource[:class], action)
40
- items << (link_to action.humanize, params.merge(:action => action))
40
+ items << (link_to _(action.humanize), params.merge(:action => action))
41
41
  end
42
42
  end
43
43
 
@@ -169,12 +169,12 @@ function surfto_#{model_pluralized}(form) {
169
169
  }
170
170
  </script>
171
171
  <!-- /Embedded JS -->
172
- <p><form class="form" action="#">
172
+ <form class="form" action="#"><p>
173
173
  <select name="#{model_pluralized}" onChange="surfto_#{model_pluralized}(this.form)">
174
174
  <option value="#{url_for params_without_filter}">#{_("filter by")} #{_(model.typus_human_name)}</option>
175
175
  #{items.join("\n")}
176
176
  </select>
177
- </form></p>
177
+ </p></form>
178
178
  HTML
179
179
  else
180
180
  related_items.each do |item|
@@ -0,0 +1,109 @@
1
+ # German translations for Typus
2
+ # by Michael Grunewalder <http://michael.grunewalder.com>
3
+
4
+ de:
5
+ "Email": "Email"
6
+ "Password": "Passwort"
7
+ "Password confirmation": "Passwort Best&auml;tigung"
8
+ "Sign in": "Anmelden"
9
+ "Recover password": "Passwort vergessen?"
10
+ "Sign up": "Konto erstellen"
11
+ "Enter your email below to create the first user": "Geben Sie Ihre Email Adresse unten ein, um den ersten Benutzer zu erstellen"
12
+ "That doesn't seem like a valid email address": "Das schein keine g&uuml;ltige Email Dresse zu sein"
13
+ "I remember my password": "Ich erinnere mein Passwort"
14
+ "Password recovery link sent to your email": "Der Link zur Wiederfindung des Passworts wurde an Ihre Email Adresse gechickt"
15
+ "A valid token is required": "Ein g&uuml;ltiges Merkmal ist erforderlich"
16
+ "The email and/or password you entered is invalid": "Die eingegebene Email Adresse und/oder das Passwort ist ung&uuml;ltig"
17
+ "There are not defined applications in config/typus/*.yml": "Es gibt keine definierten Anwendungen in config/typus/*.yml"
18
+ "Overview": "&Uuml;bersicht"
19
+ "Options": "Optionen"
20
+ "Password confirm": "Passwort best&auml;tigen"
21
+ "Change password": "Passwort &auml;ndern"
22
+ "There are no {{records}}": "Keine {{records}}vorhanden"
23
+ "There are no {{records}} under this filter": "Unter diesem Filter sind keine {{records}} vorhanden"
24
+ "Dashboard": "Dashboard"
25
+ "Create entry": "Eintrag erstellen"
26
+ "Update entry": "Eintrag &auml;ndern"
27
+ "New": "Neu"
28
+ "Show": "Anzeigen"
29
+ "Edit": "Bearbeiten"
30
+ "Login": "Anmeldem"
31
+ "Setup": "Einrichten"
32
+ "Create": "Erstellen"
33
+ "Sign out": "Abmelden"
34
+ "Update": "&Uuml;berarbeiten"
35
+ "View site": "Site anzeigen"
36
+ "Logged as": "Aufgezeichnet als"
37
+ "Remove filter": "Filter entfernen"
38
+ "Back to list": "Zur7uuml;ck zur Liste"
39
+ "Actions": "Aktionen"
40
+ "Add": "Zuf&uuml;gen"
41
+ "&larr; Previous": "&larr; Vorheriger"
42
+ "Next &rarr;": "N&auml;chster &rarr"
43
+ "Previous": "Vorheriger"
44
+ "Next": "N&auml;chster"
45
+ "Search": "Suchen"
46
+ "Search by": "Suchen nach"
47
+ "{{model}} successfully updated": "{{model}} erfolgreich ge&auml;ndert"
48
+ "{{model}} successfully created": "{{model}} erfolgreich erstellt"
49
+ "{{model}} successfully removed": "{{model}} erfolgreich gel&ouml;scht"
50
+ "{{model}} {{attribute}} changed": "{{model}} {{attribute}} ge&auml;ndert"
51
+ "You're adding a new {{resource_from}} to {{resource_to}}": "Sie f&uuml;gen eine neue {{resource_from}} an {{resource_to}}"
52
+ "You're adding a new {{resource_from}}": "Sie erstellen eine neue {{resource_from}}"
53
+ "You're updating a {{resource_from}} for {{resource_to}}": "Sie bearbeiten eine {{resource_from}} f&uuml; {{resource_to}}"
54
+ "You're updating a {{resource_from}}": "Sie bearbeiten eine {{resource_from}}"
55
+ "Toggle is disabled": "Schalter ist deaktiviert"
56
+ "Record moved {{to}}": "Datensatz verschoben nach {{to}}"
57
+ "{{model_a}} related to {{model_b}}": "{{model_a}} ist verkn&uuml;pft mit {{model_b}}"
58
+ "{{model_a}} successfully assigned to {{model_b}}": "{{model_a}} erfolgreich an {{model_b}} zugewiesen"
59
+ "{{model_a}} unrelated from {{model_b}}": "{{model_a}} unverbunden mit {{model_b}}"
60
+ "{{model_a}} removed from {{model_b}}": "{{model_a}} erfolgreich von {{model_b}}entfernt"
61
+ "Your new password is {{password}}": "Ihr neues Passwort ist {{password}}"
62
+ "Add entry": "Eintrag erstellen"
63
+ "Go to": "Gehe zu"
64
+ "First name": "Vorname"
65
+ "Last name": "Nachname"
66
+ "Roles": "Rollen"
67
+ "Status": "Status"
68
+ "Typus User": "Typus Benutzer"
69
+ "System Users Administration": "System Benutzer Verwaltung"
70
+ "Resources": "Resourcen"
71
+ "Up": "Hoch"
72
+ "Down": "Runter"
73
+ "filter by": "filter nach"
74
+ "Checked if active": "Angekreuzt wenn activiert"
75
+ "As you're not the admin or the owner of this record you cannot edit it": "Nur der Administrator oder der Eigent7uuml;er des Datensates kann ihn bearbeiten"
76
+ "You can't change your role": "Sie k&ouml;nnen Ihre Rolle nicht &auml;ndern"
77
+ "Error! Typus User or role doesn't exist": "Fehler: Typus Benutzer oder Rolle existiert nicht"
78
+ "You can't toggle your status": "Sie k&ouml;nnen Ihren Status nicht umschalten"
79
+ "You're not allowed to toggle status": "Sie k&ouml;nnen den Status nicht umschalten"
80
+ "You can't remove yourself": "Sie k&ouml;nnen sich selbst nicht entfernen"
81
+ "You're not allowed to remove Typus Users": "Sie sind nicht berechtigt den Typus Benutzer zu entfernen"
82
+ "{{current_user_role}} can't perform action. ({{action}})": "{{current_user_role}} kann die Aktion nicht ausf&uuml;hren. ({{action}})"
83
+ "{{current_user_role}} can't go to {{action}} on {{controller}}": "{{current_user_role}} kann {{action}} von {{controller}} nicht asuf&uuml;hren"
84
+ "{{current_user_role}} can't delete this item": "{{current_user_role}} kann diesen Eintrag nicht l&ouml;schen"
85
+ "{{current_user_role}} can't perform action ({{action}})": "{{current_user_role}} kann diese Aktion nicht ausf&uuml;hren"
86
+ "{{current_user_role}} can't display items": "{{current_user_role}} kann Eintr&auml;ge nicht anzeigen"
87
+ "You can update your password at": "Sie k7ouml;nnen Ihr Passwort &auml;ndern unter"
88
+ "If you didn't request a password update, you can ignore this message": "Falls Sie keine Passwort &Auml;derung beantragt haben, k&ouml;nnen Sie diese nachricht ignorieren"
89
+ "Have a nice day": "Haben Sie einen guten Tag"
90
+ "Reset password": "Passwort zur&uuml;cksetzen"
91
+ "Add new": "Erstellen"
92
+ "Do you want to cancel it?": "Wollen Sie abbrechen?"
93
+ "Click here": "Hier klicken"
94
+ "Are you sure you want to leave this page?": "Sind Sie sicher, dass Sie diese Seite verlassen m&ouml;chten?"
95
+ "If you have made any changes to the fields without clicking the Save/Update entry button, your changes will be lost": "Wenn Sie &Auml;nderungen an Feldern vorgenommen haben, ohne den Speichern/Bearbeiten Knopf gedr7uuml;ckt zu haben, gehen diese &Auml;nderungen verloren"
96
+ "Click OK to continue, or click Cancel to stay on this page": "Klicken Sie OK zum Fortfahren oder Abbrechen um auf dieser Seite zu bleiben"
97
+ "Remove entry?": "Eintrag entfernen?"
98
+ "Unrelate {{unrelate_model}} from {{unrelate_model_from}}?": "Verkn&uuml;pfung zwischen {{unrelate_model}} und {{unrelate_model_from}}entfernen?"
99
+ "Change {{attribute}}?": "{{attribute}}&auml;ndern?"
100
+ "Set language": "Sprache einstellen"
101
+ "Today": "Heute"
102
+ "Past 7 days": "Letzten 7 Tage"
103
+ "This month": "Diesen Monat"
104
+ "This year": "Dieses Jahr"
105
+ "{{model}} filtered by {{filtered_by}}": "{{model}} gefiltert nach {{filtered_by}}"
106
+ "True": "Richtig"
107
+ "False": "Falsch"
108
+ "Set language to": "Sprache wechseln zu"
109
+ "Are you sure you want to sign out and end your session?": "Wollen Sie sich abmelden und die Sitzung beenden?"
@@ -104,8 +104,8 @@ pt-BR:
104
104
  "This year": "Este ano"
105
105
  "Created at": "Criado em"
106
106
  "Updated at": "Atualizado em"
107
- "{{model}} filtered by {{filtered_by}}":
108
- "True":
109
- "False":
110
- "Set language to":
111
- "Are you sure you want to sign out and end your session?":
107
+ "{{model}} filtered by {{filtered_by}}": "{{model}} filtrados por {{filtered_by}}"
108
+ "True": "Verdadeiro"
109
+ "False": "Falso"
110
+ "Set language to": "Idioma"
111
+ "Are you sure you want to sign out and end your session?": "Tem certeza que quer sair e encerrar sua sessão?"
@@ -83,7 +83,7 @@ class TypusGenerator < Rails::Generator::Base
83
83
 
84
84
  end
85
85
 
86
- Dir["#{Typus.path}/generators/typus/templates/config/typus/*"].each do |f|
86
+ Dir["#{Typus.root}/generators/typus/templates/config/typus/*"].each do |f|
87
87
  base = File.basename(f)
88
88
  m.template "config/typus/#{base}", "#{config_folder}/#{base}",
89
89
  :assigns => { :configuration => configuration }
@@ -105,7 +105,7 @@ class TypusGenerator < Rails::Generator::Base
105
105
  'public/stylesheets/admin/reset.css',
106
106
  'public/javascripts/admin/application.js' ].each { |f| m.file f, f }
107
107
 
108
- Dir["#{Typus.path}/generators/typus/templates/public/images/admin/*"].each do |f|
108
+ Dir["#{Typus.root}/generators/typus/templates/public/images/admin/*"].each do |f|
109
109
  file = "public/images/admin/#{File.basename(f)}"
110
110
  m.file file, file
111
111
  end
@@ -5,7 +5,7 @@ class TypusUpdateSchemaTo01Generator < Rails::Generator::Base
5
5
  record do |m|
6
6
 
7
7
  config_folder = Typus::Configuration.options[:config_folder]
8
- Dir["#{Typus.path}/generators/typus_update_schema_to_01/templates/config/*"].each do |f|
8
+ Dir["#{Typus.root}/generators/typus_update_schema_to_01/templates/config/*"].each do |f|
9
9
  base = File.basename(f)
10
10
  m.template "config/#{base}", "#{config_folder}/#{base}"
11
11
  end
data/lib/typus.rb CHANGED
@@ -1,25 +1,12 @@
1
- class ActionController::Routing::RouteSet
2
-
3
- def load_routes_with_typus!
4
- lib_path = File.dirname(__FILE__)
5
- typus_routes = File.join(lib_path, *%w[ .. config routes_hack.rb ])
6
- add_configuration_file(typus_routes) unless configuration_files.include?(typus_routes)
7
- load_routes_without_typus!
8
- end
9
-
10
- alias_method_chain :load_routes!, :typus
11
-
12
- end
13
-
14
1
  module Typus
15
2
 
16
3
  class << self
17
4
 
18
5
  def version
19
- @@version ||= File.read("#{path}/VERSION").strip
6
+ @@version ||= File.read("#{root}/VERSION").strip
20
7
  end
21
8
 
22
- def path
9
+ def root
23
10
  File.dirname(__FILE__) + '/../'
24
11
  end
25
12
 
@@ -80,8 +67,14 @@ module Typus
80
67
  File.exist?("#{Rails.root}/vendor/plugins/typus")
81
68
  end
82
69
 
83
- # Enable application. This is used at boot time.
84
- def enable
70
+ def boot!
71
+
72
+ # return unless File.exists?("#{Rails.root}/config/initializers/typus.rb") || testing?
73
+ return if %w( script/generate script/destroy ).include?($0)
74
+
75
+ if testing?
76
+ Typus::Configuration.options[:config_folder] = 'vendor/plugins/typus/test/config/working'
77
+ end
85
78
 
86
79
  # Ruby Extensions
87
80
  require 'typus/hash'
@@ -94,16 +87,17 @@ module Typus
94
87
 
95
88
  # Load translation files from the plugin or the gem.
96
89
  if plugin?
97
- I18n.load_path += Dir[File.join("#{Rails.root}/vendor/plugins/typus/config/locales/**/*.{rb,yml}")]
90
+ I18n.load_path += Dir[File.join(root, 'config', 'locales', '**', '*.{rb,yml}')]
98
91
  else
99
92
  Gem.path.each { |g| I18n.load_path += Dir[File.join("#{g}/gems/*typus-#{version}/config/locales/**/*.{rb,yml}")] }
100
93
  end
101
94
 
102
95
  # Require the test/models on when testing.
103
- require File.dirname(__FILE__) + '/../test/models' if Typus.testing?
96
+ require File.dirname(__FILE__) + '/../test/models' if testing?
104
97
 
105
98
  # Rails Extensions.
106
99
  require 'typus/active_record'
100
+ require 'typus/extensions/routes'
107
101
 
108
102
  # Mixins.
109
103
  require 'typus/authentication'
@@ -118,6 +112,9 @@ module Typus
118
112
  require 'vendor/active_record'
119
113
  require 'vendor/paginator'
120
114
 
115
+ # Run controllers generator ...
116
+ generator unless testing? || Rails.env.production?
117
+
121
118
  end
122
119
 
123
120
  end
@@ -0,0 +1,15 @@
1
+ if defined?(ActionController::Routing::RouteSet)
2
+
3
+ class ActionController::Routing::RouteSet
4
+
5
+ def load_routes_with_typus!
6
+ typus_routes = File.join(File.dirname(__FILE__), 'routes_hack.rb')
7
+ add_configuration_file(typus_routes) unless configuration_files.include?(typus_routes)
8
+ load_routes_without_typus!
9
+ end
10
+
11
+ alias_method_chain :load_routes!, :typus
12
+
13
+ end
14
+
15
+ end
@@ -1,9 +1,9 @@
1
+ require 'ftools'
2
+
1
3
  module Typus
2
4
 
3
5
  def self.generator
4
6
 
5
- logger = Logger.new("#{Rails.root}/log/#{Rails.env}.log")
6
-
7
7
  # Create app/controllers/admin if doesn't exist.
8
8
  admin_controllers_folder = "#{Rails.root}/app/controllers/admin"
9
9
  Dir.mkdir(admin_controllers_folder) unless File.directory?(admin_controllers_folder)
@@ -23,7 +23,7 @@ module Typus
23
23
  end
24
24
 
25
25
  # Get a list of functional tests under `test/functional/admin`.
26
- admin_controller_tests = Dir["#{Rails.root}/vendor/plugins/*/test/functional/admin/*.rb", "#{admin_controller_tests_folder}/*.rb"]
26
+ admin_controller_tests = Dir["#{admin_controller_tests_folder}/*.rb"]
27
27
  admin_controller_tests = admin_controller_tests.map { |i| File.basename(i) }
28
28
 
29
29
  # Generate controllers for tableless models.
@@ -33,28 +33,9 @@ module Typus
33
33
  controller_location = "#{admin_controllers_folder}/#{controller_filename}"
34
34
 
35
35
  if !admin_controllers.include?(controller_filename)
36
-
37
- content = <<-RAW
38
- # Controller generated by Typus, use it to extend admin functionality.
39
- class Admin::#{resource}Controller < TypusController
40
-
41
- ##
42
- # This controller was generated because you have defined a resource
43
- # on <tt>config/typus/XXXXXX_roles.yml</tt> which is a tableless model.
44
- #
45
- # admin:
46
- # #{resource}: index
47
- #
48
-
49
- def index
50
- end
51
-
52
- end
53
- RAW
54
-
36
+ template = File.read("#{File.dirname(__FILE__)}/templates/resource_controller.rb.erb")
37
+ content = ERB.new(template).result(binding)
55
38
  File.open(controller_location, "w+") { |f| f << content }
56
- logger.info "=> [typus] Admin::#{resource}Controller successfully created."
57
-
58
39
  end
59
40
 
60
41
  # And now we create the view.
@@ -63,106 +44,34 @@ end
63
44
 
64
45
  if !File.exist?("#{view_folder}/#{view_filename}")
65
46
  Dir.mkdir(view_folder) unless File.directory?(view_folder)
66
-
67
- content = <<-RAW
68
- <!-- Sidebar -->
69
-
70
- <% content_for :sidebar do %>
71
- <%= typus_block :location => 'dashboard', :partial => 'sidebar' %>
72
- <% end %>
73
-
74
- <!-- Content -->
75
-
76
- <h2>#{resource.humanize}</h2>
77
-
78
- <p>And here we do whatever we want to ...</p>
79
-
80
- RAW
81
-
82
- File.open("#{view_folder}/#{view_filename}", "w+") { |f| f << content}
83
- logger.info "=> [typus] app/views/admin/#{resource.underscore}/index.html.erb successfully created."
84
-
47
+ origin = "#{File.dirname(__FILE__)}/templates/index.html.erb"
48
+ destination = "#{view_folder}/#{view_filename}"
49
+ File.copy(origin, destination)
85
50
  end
86
51
 
87
52
  end
88
53
 
89
- # Generate unexisting controllers for resources which are tied to a
90
- # model.
54
+ # Generate:
55
+ # `app/controllers/admin/#{resource}_controller.rb`
56
+ # `test/functional/admin/#{resource}_controller_test.rb`
91
57
  models.each do |model|
92
58
 
93
- # Controller app/controllers/admin/*
94
59
  controller_filename = "#{model.tableize}_controller.rb"
95
60
  controller_location = "#{admin_controllers_folder}/#{controller_filename}"
96
61
 
97
62
  if !admin_controllers.include?(controller_filename)
98
-
99
- content = <<-RAW
100
- # Controller generated by Typus, use it to extend admin functionality.
101
- class Admin::#{model.pluralize}Controller < Admin::MasterController
102
-
103
- =begin
104
-
105
- ##
106
- # You can overwrite and extend Admin::MasterController with your methods.
107
- #
108
- # Actions have to be defined in <tt>config/typus/application.yml</tt>:
109
- #
110
- # #{model}:
111
- # actions:
112
- # index: custom_action
113
- # edit: custom_action_for_an_item
114
- #
115
- # And you have to add permissions on <tt>config/typus/application_roles.yml</tt>
116
- # to have access to them.
117
- #
118
- # admin:
119
- # #{model}: create, read, update, destroy, custom_action
120
- #
121
- # editor:
122
- # #{model}: create, read, update, custom_action_for_an_item
123
- #
124
-
125
- def index
126
- end
127
-
128
- def custom_action
129
- end
130
-
131
- def custom_action_for_an_item
132
- end
133
-
134
- =end
135
-
136
- end
137
- RAW
138
-
63
+ template = File.read("#{File.dirname(__FILE__)}/templates/resources_controller.rb.erb")
64
+ content = ERB.new(template).result(binding)
139
65
  File.open(controller_location, "w+") { |f| f << content }
140
- logger.info "=> [typus] Admin::#{model.pluralize}Controller successfully created."
141
-
142
66
  end
143
67
 
144
- # Test test/functional/admin/*_test.rb
145
68
  test_filename = "#{model.tableize}_controller_test.rb"
146
69
  test_location = "#{admin_controller_tests_folder}/#{test_filename}"
147
70
 
148
71
  if !admin_controller_tests.include?(test_filename) && File.directory?("#{Rails.root}/test")
149
-
150
- content = <<-RAW
151
- require 'test_helper'
152
-
153
- class Admin::#{model.pluralize}ControllerTest < ActionController::TestCase
154
-
155
- # Replace this with your real tests.
156
- test "the truth" do
157
- assert true
158
- end
159
-
160
- end
161
- RAW
162
-
72
+ template = File.read("#{File.dirname(__FILE__)}/templates/resource_controller_test.rb.erb")
73
+ content = ERB.new(template).result(binding)
163
74
  File.open(test_location, "w+") { |f| f << content }
164
- logger.info "=> [typus] Admin::#{model.pluralize}ControllerTest successfully created."
165
-
166
75
  end
167
76
 
168
77
  end
@@ -0,0 +1,11 @@
1
+ <!-- Sidebar -->
2
+
3
+ <% content_for :sidebar do %>
4
+ <%= typus_block :location => 'dashboard', :partial => 'sidebar' %>
5
+ <% end %>
6
+
7
+ <!-- Content -->
8
+
9
+ <h2>Resource#index</h2>
10
+
11
+ <p>Find me in app/views/<%= params[:controller] %>/index.html.erb</p>
@@ -0,0 +1,15 @@
1
+ # Controller generated by Typus, use it to extend admin functionality.
2
+ class Admin::<%= resource %>Controller < TypusController
3
+
4
+ ##
5
+ # This controller was generated because you have defined a resource
6
+ # on <tt>config/typus/XXXXXX_roles.yml</tt> which is a tableless model.
7
+ #
8
+ # admin:
9
+ # <%= resource %>: index
10
+ #
11
+
12
+ def index
13
+ end
14
+
15
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class Admin::<%= model.pluralize %>ControllerTest < ActionController::TestCase
4
+
5
+ # Replace this with your real tests.
6
+ test "the truth" do
7
+ assert true
8
+ end
9
+
10
+ end
@@ -0,0 +1,37 @@
1
+ # Controller generated by Typus, use it to extend admin functionality.
2
+ class Admin::<%= model.pluralize %>Controller < Admin::MasterController
3
+
4
+ =begin
5
+
6
+ ##
7
+ # You can overwrite and extend Admin::MasterController with your methods.
8
+ #
9
+ # Actions have to be defined in <tt>config/typus/application.yml</tt>:
10
+ #
11
+ # <%= model %>:
12
+ # actions:
13
+ # index: custom_action
14
+ # edit: custom_action_for_an_item
15
+ #
16
+ # And you have to add permissions on <tt>config/typus/application_roles.yml</tt>
17
+ # to have access to them.
18
+ #
19
+ # admin:
20
+ # <%= model %>: create, read, update, destroy, custom_action
21
+ #
22
+ # editor:
23
+ # <%= model %>: create, read, update, custom_action_for_an_item
24
+ #
25
+
26
+ def index
27
+ end
28
+
29
+ def custom_action
30
+ end
31
+
32
+ def custom_action_for_an_item
33
+ end
34
+
35
+ =end
36
+
37
+ end
data/rails/init.rb CHANGED
@@ -1,16 +1,3 @@
1
1
  require 'typus'
2
2
 
3
- if Typus.testing?
4
- Typus::Configuration.options[:config_folder] = 'vendor/plugins/typus/test/config/working'
5
- end
6
-
7
- ##
8
- # Do not Typus.enable or Typus.generate if we are running a generator.
9
- #
10
-
11
- scripts = %w( script/generate script/destroy )
12
-
13
- unless scripts.include?($0)
14
- Typus.enable
15
- Typus.generator unless Typus.testing?
16
- end
3
+ Typus.boot!
@@ -60,7 +60,7 @@ class Admin::PostsControllerTest < ActionController::TestCase
60
60
  assert_difference 'Post.count' do
61
61
  post :create, { :item => { :title => 'This is another title', :body => 'Body' } }
62
62
  assert_response :redirect
63
- assert_redirected_to :action => 'edit'
63
+ assert_redirected_to :controller => 'admin/posts', :action => 'edit', :id => Post.last
64
64
  end
65
65
 
66
66
  end
@@ -99,7 +99,7 @@ class Admin::PostsControllerTest < ActionController::TestCase
99
99
  post_ = posts(:published)
100
100
  post :update, { :id => post_.id, :title => 'Updated' }
101
101
  assert_response :redirect
102
- assert_redirected_to :action => 'edit', :id => post_.id
102
+ assert_redirected_to :controller => 'admin/posts', :action => 'edit', :id => post_.id
103
103
 
104
104
  end
105
105
 
data/test/helper.rb CHANGED
@@ -34,13 +34,13 @@ require File.dirname(__FILE__) + '/schema'
34
34
 
35
35
  ActiveSupport::Dependencies.load_paths = []
36
36
  %w( models controllers helpers ).each do |folder|
37
- ActiveSupport::Dependencies.load_paths << File.join(Rails.root, 'vendor/plugins/typus/app', folder)
38
- ActiveSupport::Dependencies.load_paths << File.join(Rails.root, 'vendor/plugins/typus/test/fixtures/app', folder)
37
+ ActiveSupport::Dependencies.load_paths << File.join(Typus.root, 'app', folder)
38
+ ActiveSupport::Dependencies.load_paths << File.join(Typus.root, 'test', 'fixtures', 'app', folder)
39
39
  end
40
40
 
41
41
  ActionController::Base.view_paths = []
42
42
  %w( app/views test/fixtures/app/views ).each do |folder|
43
- ActionController::Base.append_view_path(File.join(Rails.root, 'vendor/plugins/typus', folder))
43
+ ActionController::Base.append_view_path(File.join(Typus.root, folder))
44
44
  end
45
45
 
46
46
  class ActiveSupport::TestCase
@@ -58,15 +58,8 @@ class Admin::SidebarHelperTest < ActiveSupport::TestCase
58
58
 
59
59
  output = export
60
60
 
61
- # FIXME or OPTIMIZE
62
-
63
- begin
64
- expected = ["<a href=\"http://test.host/admin/custom_users.csv\">CSV</a>"]
65
- assert_equal expected, output
66
- rescue
67
- expected = ["<a href=\"http://test.host/admin/custom_users?format=csv\">CSV</a>"]
68
- assert_equal expected, output
69
- end
61
+ expected = ["<a href=\"http://test.host/admin/custom_users.csv\">CSV</a>"]
62
+ assert_equal expected, output
70
63
 
71
64
  end
72
65
 
@@ -9,7 +9,7 @@ class TypusTest < ActiveSupport::TestCase
9
9
 
10
10
  def test_should_return_path
11
11
  expected = Dir.pwd + '/lib/../'
12
- assert_equal expected, Typus.path
12
+ assert_equal expected, Typus.root
13
13
  end
14
14
 
15
15
  def test_should_return_locales
data/typus.gemspec CHANGED
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{typus}
5
- s.version = "0.9.16"
8
+ s.version = "0.9.17"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Francesc Esplugas"]
9
- s.date = %q{2009-07-09}
12
+ s.date = %q{2009-08-18}
10
13
  s.description = %q{Effortless backend interface for Ruby on Rails applications. (Admin scaffold generator.)}
11
14
  s.email = %q{francesc@intraducibles.com}
12
15
  s.extra_rdoc_files = [
@@ -43,12 +46,11 @@ Gem::Specification.new do |s|
43
46
  "app/views/typus/sign_in.html.erb",
44
47
  "app/views/typus/sign_up.html.erb",
45
48
  "app/views/typus_mailer/reset_password_link.erb",
49
+ "config/locales/typus/de.yml",
46
50
  "config/locales/typus/es.yml",
47
51
  "config/locales/typus/language.yml.template",
48
52
  "config/locales/typus/pt-BR.yml",
49
53
  "config/locales/typus/ru.yml",
50
- "config/routes.rb",
51
- "config/routes_hack.rb",
52
54
  "generators/typus/templates/config/initializers/typus.rb",
53
55
  "generators/typus/templates/config/typus/README",
54
56
  "generators/typus/templates/config/typus/application.yml",
@@ -73,6 +75,7 @@ Gem::Specification.new do |s|
73
75
  "lib/typus/active_record.rb",
74
76
  "lib/typus/authentication.rb",
75
77
  "lib/typus/configuration.rb",
78
+ "lib/typus/extensions/routes.rb",
76
79
  "lib/typus/format.rb",
77
80
  "lib/typus/generator.rb",
78
81
  "lib/typus/hash.rb",
@@ -81,6 +84,10 @@ Gem::Specification.new do |s|
81
84
  "lib/typus/quick_edit.rb",
82
85
  "lib/typus/reloader.rb",
83
86
  "lib/typus/string.rb",
87
+ "lib/typus/templates/index.html.erb",
88
+ "lib/typus/templates/resource_controller.rb.erb",
89
+ "lib/typus/templates/resource_controller_test.rb.erb",
90
+ "lib/typus/templates/resources_controller.rb.erb",
84
91
  "lib/typus/user.rb",
85
92
  "lib/vendor/active_record.rb",
86
93
  "lib/vendor/paginator.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fesplugas-typus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.16
4
+ version: 0.9.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesc Esplugas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-09 00:00:00 -07:00
12
+ date: 2009-08-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -52,12 +52,11 @@ files:
52
52
  - app/views/typus/sign_in.html.erb
53
53
  - app/views/typus/sign_up.html.erb
54
54
  - app/views/typus_mailer/reset_password_link.erb
55
+ - config/locales/typus/de.yml
55
56
  - config/locales/typus/es.yml
56
57
  - config/locales/typus/language.yml.template
57
58
  - config/locales/typus/pt-BR.yml
58
59
  - config/locales/typus/ru.yml
59
- - config/routes.rb
60
- - config/routes_hack.rb
61
60
  - generators/typus/templates/config/initializers/typus.rb
62
61
  - generators/typus/templates/config/typus/README
63
62
  - generators/typus/templates/config/typus/application.yml
@@ -82,6 +81,7 @@ files:
82
81
  - lib/typus/active_record.rb
83
82
  - lib/typus/authentication.rb
84
83
  - lib/typus/configuration.rb
84
+ - lib/typus/extensions/routes.rb
85
85
  - lib/typus/format.rb
86
86
  - lib/typus/generator.rb
87
87
  - lib/typus/hash.rb
@@ -90,6 +90,10 @@ files:
90
90
  - lib/typus/quick_edit.rb
91
91
  - lib/typus/reloader.rb
92
92
  - lib/typus/string.rb
93
+ - lib/typus/templates/index.html.erb
94
+ - lib/typus/templates/resource_controller.rb.erb
95
+ - lib/typus/templates/resource_controller_test.rb.erb
96
+ - lib/typus/templates/resources_controller.rb.erb
93
97
  - lib/typus/user.rb
94
98
  - lib/vendor/active_record.rb
95
99
  - lib/vendor/paginator.rb
@@ -173,6 +177,7 @@ files:
173
177
  - typus.gemspec
174
178
  has_rdoc: true
175
179
  homepage: http://intraducibles.com/projects/typus
180
+ licenses:
176
181
  post_install_message:
177
182
  rdoc_options:
178
183
  - --charset=UTF-8
@@ -193,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
198
  requirements: []
194
199
 
195
200
  rubyforge_project:
196
- rubygems_version: 1.2.0
201
+ rubygems_version: 1.3.5
197
202
  signing_key:
198
203
  specification_version: 2
199
204
  summary: Effortless backend interface for Ruby on Rails applications. (Admin scaffold generator.)
data/config/routes.rb DELETED
@@ -1,14 +0,0 @@
1
- ActionController::Routing::Routes.draw do |map|
2
-
3
- map.with_options :controller => 'typus', :path_prefix => 'admin' do |i|
4
- i.admin_quick_edit 'quick_edit', :action => 'quick_edit'
5
- i.admin_dashboard '', :action => 'dashboard'
6
- i.admin_sign_in 'sign_in', :action => 'sign_in'
7
- i.admin_sign_out 'sign_out', :action => 'sign_out'
8
- i.admin_sign_up 'sign_up', :action => 'sign_up'
9
- i.admin_recover_password 'recover_password', :action => 'recover_password'
10
- i.admin_reset_password 'reset_password', :action => 'reset_password'
11
- i.admin_set_locale 'set_locale', :action => 'set_locale'
12
- end
13
-
14
- end
@@ -1,9 +0,0 @@
1
- ActionController::Routing::Routes.draw do |map|
2
-
3
- begin
4
- ActionController::Routing::Routes.recognize_path '/admin/typus_users'
5
- rescue
6
- map.connect ':controller/:action/:id'
7
- end
8
-
9
- end