Permalink
Browse files

Revamped config system. Instead of the elaborate configuration screen…

… we now have a simple .yml file
  • Loading branch information...
jamesu committed Oct 2, 2011
1 parent 855a735 commit 3527f8ec4cafb3b0cd6d6b3f9bbb75736dce2fa9
Showing with 157 additions and 1,472 deletions.
  1. +0 −22 app/assets/stylesheets/admin/config.css
  2. +0 −12 app/assets/stylesheets/admin/massmailer.css
  3. +0 −36 app/config_handlers/bool_config_handler.rb
  4. +0 −46 app/config_handlers/config_handler.rb
  5. +0 −33 app/config_handlers/date_time_config_handler.rb
  6. +0 −38 app/config_handlers/day_config_handler.rb
  7. +0 −32 app/config_handlers/float_config_handler.rb
  8. +0 −32 app/config_handlers/integer_config_handler.rb
  9. +0 −35 app/config_handlers/notification_method_config_handler.rb
  10. +0 −40 app/config_handlers/notification_sendmail_config_handler.rb
  11. +0 −49 app/config_handlers/notification_smtp_config_handler.rb
  12. +0 −32 app/config_handlers/password_config_handler.rb
  13. +0 −32 app/config_handlers/string_config_handler.rb
  14. +0 −32 app/config_handlers/text_config_handler.rb
  15. +0 −41 app/config_handlers/text_list_config_handler.rb
  16. +0 −42 app/config_handlers/theme_config_handler.rb
  17. +0 −76 app/controllers/configurations_controller.rb
  18. +0 −40 app/helpers/configurations_helper.rb
  19. +1 −2 app/helpers/navigation_helper.rb
  20. +6 −12 app/models/company.rb
  21. +7 −13 app/models/project_file_revision.rb
  22. +8 −14 app/models/user.rb
  23. +0 −1 app/views/layouts/_user_box.html.erb
  24. +18 −0 config/application.rb
  25. +0 −176 config/config_schema.yml
  26. +1 −6 config/environment.rb
  27. +0 −20 config/example/config.yml
  28. +0 −19 config/example/database.yml
  29. +6 −0 config/initializers/amazon_s3.rb
  30. +1 −1 config/initializers/session_store.rb
  31. +0 −74 config/locales/en.yml
  32. +74 −4 config/railscollab.yml
  33. +0 −2 config/routes.rb
  34. +0 −30 db/default_config.rb
  35. +31 −0 db/migrate/20111002151122_nomoreconfig.rb
  36. +0 −3 db/{default_content.rb → seed.rb}
  37. +0 −113 lib/config_system.rb
  38. +4 −17 script/setup
  39. +0 −16 test/fixtures/config_categories.yml
  40. +0 −271 test/fixtures/config_options.yml
  41. +0 −8 test/functional/configurations_controller_test.rb
@@ -1,22 +0,0 @@
-#configCategoryOptions .configCategoryOtpion {
- margin: 8px 0;
- padding: 5px;
-}
-
-#configCategoryOptions label {
- margin: 0;
- padding: 0;
-}
-
-#configCategoryOptions .configOptionInfo {
- float: left;
- width: 200px;
-}
-
-#configCategoryOptions .configOptionControl {
- margin-left: 210px;
-}
-
-#configCategoryOptions textarea {
- width: 300px;
-}
@@ -1,12 +0,0 @@
-#massMailer div.massmailercompanyLogo {
- float: right;
-}
-
-#massMailer div.massmailercompanyLogo img {
- border: 1px solid #ccc;
-}
-
-#massMailer div.massmailerRecipeints {
- padding-top: 5px;
- padding-left: 10px;
-}
@@ -1,36 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class BoolConfigHandler < ConfigHandler
-
- def value
- @rawValue.to_i == 1
- end
-
- def value=(val)
- if val.class == String
- @rawValue = val
- else
- @rawValue = val ? '1' : '0'
- end
- end
-
- def render(name, options)
- yesno_toggle_tag name, (self.rawValue == '1'), options.merge(:id => "#{name}", :class => 'yes_no')
- end
-end
@@ -1,46 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class ConfigHandler
- include ActionView::Helpers
- include ActionView::Helpers::FormTagHelper
- include ActionView::Helpers::FormOptionsHelper
- include ActionView::Helpers::TagHelper
-
- include ApplicationHelper
-
- attr_accessor :configOption, :rawValue
-
- def initialize
- @configOption = nil
- @rawValue = ""
- @value = ""
- end
-
- def value
- return @rawValue
- end
-
- def value=(val)
- @rawValue = val
- end
-
- def render(name, options)
- ""
- end
-end
@@ -1,33 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class DateTimeConfigHandler < ConfigHandler
-
- def value
- Date.parse(@rawValue)
- end
-
- def value=(val)
- @rawValue = val.strftime('%Y-%m-%d')
- end
-
- def render(name, options)
- # if only there was a date_select_tag...
- text_field_tag name, self.value, options.merge(:class => 'short')
- end
-end
@@ -1,38 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class DayConfigHandler < ConfigHandler
- def initialize
- super
- @days = (Date.today.beginning_of_week..Date.today.end_of_week).collect {|day| [I18n.l(day, :format => '%A'), day.cwday.to_s]}
- @days_values = Hash[*@days.flatten].values
- end
-
- def value
- @rawValue
- end
-
- def value=(val)
- @rawValue = val if @days_values.include?(val)
- end
-
- def render(name, options)
- opts = options_for_select(@days, self.value)
- select_tag name, opts, options
- end
-end
@@ -1,32 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class FloatConfigHandler < ConfigHandler
-
- def value
- @rawValue.to_f
- end
-
- def value=(val)
- @rawValue = val.to_f
- end
-
- def render(name, options)
- text_field_tag name, self.value, options.merge(:class => 'short')
- end
-end
@@ -1,32 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class IntegerConfigHandler < ConfigHandler
-
- def value
- @rawValue.to_i
- end
-
- def value=(val)
- @rawValue = val.to_i
- end
-
- def render(name, options)
- text_field_tag name, self.value, options.merge(:class => 'short')
- end
-end
@@ -1,35 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class NotificationMethodConfigHandler < ConfigHandler
-
- def value
- @rawValue
- end
-
- def value=(val)
- @rawValue = val unless !(['test', 'smtp', 'sendmail'].include?(val))
- end
-
- def render(name, options)
- opts = options_for_select({I18n.t('notification_method_test') => 'test',
- I18n.t('notification_method_smtp') => 'smtp',
- I18n.t('notification_method_sendmail') => 'sendmail'}, self.value)
- select_tag name, opts, options
- end
-end
@@ -1,40 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class NotificationSendmailConfigHandler < ConfigHandler
-
- def value
- res = YAML.load(@rawValue)
- return res.nil? ? {} : {:location => res['location'],
- :arguments => res['arguments']}
- end
-
- def value=(val)
- if val.class == String
- @rawValue = val
- else
- @rawValue = YAML.dump(val).to_s
- end
- end
-
- def render(name, options)
- values = self.value
- "<label for=\"#{name}[location]\">#{I18n.t('notification_sendmail_location')}</label>" + text_field_tag("#{name}[location]", values[:location], options.merge(:class => 'middle') )+
- "<label for=\"#{name}[arguments]\">#{I18n.t('notification_sendmail_arguments')}</label>" + text_field_tag("#{name}[arguments]", values[:arguments], options.merge(:class => 'middle'))
- end
-end
@@ -1,49 +0,0 @@
-#==
-# RailsCollab
-# Copyright (C) 2008 James S Urquhart
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#++
-
-class NotificationSMTPConfigHandler < ConfigHandler
-
- def value
- res = YAML.load(@rawValue)
- return res.nil? ? {} : {:address => res['address'],
- :port => res['port'],
- :user_name => res['user_name'],
- :password => res['password'],
- :authentication => res['authentication'],
- :domain => res['domain']}
- end
-
- def value=(val)
- if val.class == String
- @rawValue = val
- else
- @rawValue = YAML.dump(val).to_s
- end
- end
-
- def render(name, options)
- values = self.value
-
- "<label for=\"#{name}[address]\">#{I18n.t('notification_smtp_address')}</label>" + text_field_tag("#{name}[address]", values[:address], options.merge(:class => 'middle') ) +
- "<label for=\"#{name}[port]\">#{I18n.t('notification_smtp_port')}</label>" + text_field_tag("#{name}[port]", values[:port], options.merge(:class => 'middle')) +
- "<label for=\"#{name}[domain]\">#{I18n.t('notification_smtp_domain')}</label>" + text_field_tag("#{name}[domain]", values[:domain], options.merge(:class => 'middle')) +
- "<label for=\"#{name}[user_name]\">#{I18n.t('notification_smtp_username')}</label>" + text_field_tag("#{name}[user_name]", values[:user_name], options.merge(:class => 'middle')) +
- "<label for=\"#{name}[password]\">#{I18n.t('notification_smtp_password')}</label>" + text_field_tag("#{name}[password]", values[:password], options.merge(:class => 'middle')) +
- "<label for=\"#{name}[authentication]\">#{I18n.t('notification_smtp_authentication')}</label>" + text_field_tag("#{name}[authentication]", values[:authentication], options.merge(:class => 'middle'))
- end
-end
Oops, something went wrong.

0 comments on commit 3527f8e

Please sign in to comment.