No parents
ignore white space 6 line context
1
= redmine_default_group
2

	
3
Description goes here
1
<p>
2
  <%=content_tag(:label, l(:label_group) + ":") %>
3
  <%=text_field_tag "settings[group]", @settings["group"], :size=>25 %><br/>
4
</p>
ignore white space 6 line context
1
# English strings go here for Rails i18n
2
en:
3
  # my_label: "My label"
4
  label_group: "Default group name"
ignore white space 6 line context
1
# Plugin's routes
2
# See: http://guides.rubyonrails.org/routing.html
ignore white space 6 line context
1
require 'redmine'
2
require 'redmine_default_group/patch'
3

	
4

	
5
Redmine::Plugin.register :redmine_default_group do
6
  name 'Redmine Default Group plugin'
7
  author 'Arthur Zalevsky'
8
  description 'This plugin allows to set default group for new users.'
9
  version '0.0.1'
10
  url 'https://github.com/yourcelf/redmine_etherpad'
11
  author_url 'https://github.com/yourcelf'
12
  settings :partial => 'settings/default_group',
13
           :default => {
14
             'group' => false,
15
           }
16
   
17
  Rails.configuration.to_prepare do 
18
      # This tells the Redmine version's controller to include the module from the file above.
19
      AccountController.send(:include, RedmineDefaultGroup::AccountControllerPatch)
20
  end
21

	
22
#  settings = Setting.plugin_redmine_etherpad
23
#  unless settings['host'] and settings['key'] 
24
#    raise "Please define etherpad parameters in configuration.yml."
25
#  end
26

	
27
  # Set current user name.
28
  if User.current
29
  settings['userName'] = User.current.name
30
  #elsif conf.fetch('loginRequired', true)
31
  #  return "TODO: embed read-only."
32
  end
33

	
34
end
ignore white space 6 line context
1
module RedmineDefaultGroup
2
  module AccountControllerPatch
3
    def self.included(base)
4
      base.class_eval do
5
        # Insert overrides here, for example:
6
         def register_automatically_with_default_group(user, &block)
7
           register_automatically_without_default_group(user, &block)
8
           @group = Group.find(:first, :conditions => ["LOWER(lastname) = ?", Setting.plugin_redmine_default_group['group'].downcase])
9
           @group.users << user
10
         end
11

	
12
        alias_method_chain :register_automatically, :default_group # This tells Redmine to allow me to extend show by letting me call it via "show_without_plugin" above.
13
        # I can outright override it by just calling it "def show", at which case the original controller's method will be overridden instead of extended.
14
      end
15
    end
16
  end
17
end
ignore white space 6 line context
1
# Load the Redmine helper
2
require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')
0 comments (0 inline)