nisetegami 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,8 @@ require_dependency "nisetegami/application_controller"
|
|
2
2
|
|
3
3
|
module Nisetegami
|
4
4
|
class TemplatesController < ApplicationController
|
5
|
+
before_filter Nisetegami.auth_filter if Nisetegami.auth_filter
|
6
|
+
|
5
7
|
def index
|
6
8
|
@templates = Template.recent
|
7
9
|
params[:enabled] = params[:enabled] == 'true' ? true : false unless params[:enabled].blank?
|
@@ -4,11 +4,12 @@ Nisetegami.configure do |config|
|
|
4
4
|
# begin
|
5
5
|
# "#{klass}Decorator".constantize
|
6
6
|
# rescue
|
7
|
-
# klass
|
7
|
+
# klass
|
8
8
|
# end
|
9
9
|
# end
|
10
10
|
|
11
|
+
# config.auth_filter = -> { redirect_to main_app.root_path unless current_user && current_user.admin? }
|
12
|
+
|
11
13
|
# Mailers mapping
|
12
|
-
# config.register
|
13
|
-
# config.register 'UserMailer', :notice, user, notice, additional_attributes: 'Hash'
|
14
|
+
# config.register UserMailer, :user, :notice, post: Blog::Post, additional_attributes: Hash
|
14
15
|
end
|
data/lib/nisetegami.rb
CHANGED
@@ -22,6 +22,8 @@ module Nisetegami
|
|
22
22
|
mattr_reader :email_re
|
23
23
|
@@email_re = /[-a-z0-9_+\.]+@([-a-z0-9]+\.)+[a-z0-9]{2,}/
|
24
24
|
|
25
|
+
mattr_accessor :auth_filter
|
26
|
+
|
25
27
|
def self.configure
|
26
28
|
yield self
|
27
29
|
end
|
@@ -30,15 +32,13 @@ module Nisetegami
|
|
30
32
|
# into a class with liquid_methods
|
31
33
|
def self.cast(&block)
|
32
34
|
@@cast ||= ->(thing) do
|
33
|
-
|
34
|
-
thing
|
35
|
-
|
36
|
-
|
37
|
-
else
|
35
|
+
begin
|
36
|
+
thing = thing.to_s.constantize
|
37
|
+
block_given? ? yield(thing) : thing
|
38
|
+
rescue NameError
|
38
39
|
String
|
39
40
|
end
|
40
41
|
end
|
41
|
-
block_given? ? @@cast = block : @@cast
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.register(*args)
|
data/lib/nisetegami/version.rb
CHANGED