ucb_rails 0.0.7 → 0.0.8

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.
@@ -0,0 +1,20 @@
1
+ class UcbRails::Admin::EmailTestController < UcbRails::Admin::BaseController
2
+
3
+ def index
4
+ end
5
+
6
+ EMAIL_REGEXP = /\A[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\z/
7
+
8
+ def send_email
9
+ email = params[:email]
10
+
11
+ if email =~ EMAIL_REGEXP
12
+ @email_result = UcbRails::TestMailer.test(email).deliver
13
+ flash.now[:success] = 'Email sent.'
14
+ else
15
+ flash.now[:error] = 'Invalid email address'
16
+ end
17
+
18
+ render 'index'
19
+ end
20
+ end
@@ -37,10 +37,12 @@ module UcbRails::ControllerMethods
37
37
  end
38
38
 
39
39
  def log_request
40
+ UcbRails::UserSessionManager::Base.current_user = current_user
40
41
  user_session_manager.log_request(current_user)
41
42
  end
42
43
 
43
44
  def remove_user_settings
45
+ UcbRails::UserSessionManager::Base.current_user = nil
44
46
  end
45
47
 
46
48
  # Returns an instance of UCB::LDAP::Person if there is a logged in user
@@ -1,7 +1,9 @@
1
1
  module UcbRails::Admin::UsersHelper
2
2
 
3
3
  def link_to_new_user
4
- button('New User', :primary,
4
+ 'New User'
5
+ text = image_tag('ucb_rails/glyphicons_006_user_add.png', size: '14x14')
6
+ button(text, :primary,
5
7
  class: 'ldap-person-search',
6
8
  data: {
7
9
  search_url: ldap_search_ucb_rails_admin_users_path,
@@ -41,4 +41,14 @@ class UcbRails::UserSessionManager::Base
41
41
  def ldap_person_user_wrapper(ldap_person_entry)
42
42
  UcbRails::UserSessionManager::LdapPersonUserWrapper.new(ldap_person_entry)
43
43
  end
44
+
45
+ class << self
46
+ def current_user=(user)
47
+ Thread.current[:current_user] = user
48
+ end
49
+
50
+ def current_user
51
+ Thread.current[:current_user]
52
+ end
53
+ end
44
54
  end
@@ -1,5 +1,7 @@
1
1
  %h1 Configuration
2
-
2
+ = image_tag('ucb_rails/glyphicons_002_dog.png', size: '14x14')
3
+ = image_tag('ucb_rails/glyphicons_006_user_add.png')
4
+ = image_tag('ucb_rails/glyphicons_013_beach_umbrella.png')
3
5
  %h2 config/config.yml
4
6
 
5
7
  - config = UcbRails::Configuration::Configuration.new
@@ -44,4 +46,4 @@
44
46
  %h2 Exception Notifier
45
47
 
46
48
  %pre
47
- = config.for('exception_notifier')
49
+ = config.for('exception_notification')
@@ -0,0 +1,9 @@
1
+ %h1 Send Test Email
2
+
3
+ = form_tag(ucb_rails_admin_email_test_path) do
4
+ %p= text_field_tag :email, params[:email], placeholder: 'email@example.com', class: 'span3'
5
+ %p= submit_button_tag "Send"
6
+
7
+ - if @email_result.present?
8
+ %hr
9
+ %pre= @email_result
data/config/routes.rb CHANGED
@@ -19,7 +19,10 @@ Rails.application.routes.draw do
19
19
  namespace :admin do
20
20
  resources :announcements
21
21
  get 'configuration' => 'configuration#index'
22
+ get 'email_test' => 'email_test#index'
23
+ post 'email_test' => 'email_test#send_email'
22
24
  get 'force_exception' => 'force_exception#index'
25
+
23
26
  resources :users do
24
27
  get 'ldap_search', on: :collection
25
28
  get 'typeahead_search', on: :collection
@@ -1,5 +1,6 @@
1
1
  = nav_dropdown("Developer") do
2
2
  = dropdown_item(icon('cog', "Configuration"), ucb_rails_admin_configuration_path)
3
+ = dropdown_item(icon('envelope', "Test Email"), ucb_rails_admin_email_test_path)
3
4
  = dropdown_item(icon('picture', "Bootstrap Examples"), bvh_path)
4
5
  = dropdown_item(icon('exclamation-sign', "Force Exception"), ucb_rails_admin_force_exception_path)
5
6
 
@@ -1,3 +1,3 @@
1
1
  module UcbRails
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ucb_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-22 00:00:00.000000000 Z
12
+ date: 2013-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -562,8 +562,11 @@ executables: []
562
562
  extensions: []
563
563
  extra_rdoc_files: []
564
564
  files:
565
+ - app/assets/images/ucb_rails/glyphicons_002_dog.png
566
+ - app/assets/images/ucb_rails/glyphicons_006_user_add.png
565
567
  - app/controllers/ucb_rails/admin/base_controller.rb
566
568
  - app/controllers/ucb_rails/admin/configuration_controller.rb
569
+ - app/controllers/ucb_rails/admin/email_test_controller.rb
567
570
  - app/controllers/ucb_rails/admin/force_exception_controller.rb
568
571
  - app/controllers/ucb_rails/admin/users_controller.rb
569
572
  - app/controllers/ucb_rails/bootstrap_controller.rb
@@ -600,6 +603,7 @@ files:
600
603
  - app/models/ucb_rails/user_session_manager/ldap_person_user_wrapper.rb
601
604
  - app/models/ucb_rails/user_typeahead.rb
602
605
  - app/views/ucb_rails/admin/configuration/index.html.haml
606
+ - app/views/ucb_rails/admin/email_test/index.html.haml
603
607
  - app/views/ucb_rails/admin/users/_form.html.haml
604
608
  - app/views/ucb_rails/admin/users/_user.html.haml
605
609
  - app/views/ucb_rails/admin/users/edit.html.haml