kryptonite 0.0.10 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/PUBLIC_VERSION.yml +2 -2
- data/app/controllers/kryptonite/kryptonite_controller.rb +5 -0
- data/app/helpers/kryptonite/kryptonite_helper.rb +35 -2
- data/app/models/kryptonite/user.rb +1 -1
- data/app/views/kryptonite/users/new.html.erb +2 -1
- data/app/views/kryptonite/users/show.html.erb +6 -4
- data/app/views/layouts/kryptonite_auth.html.erb +4 -4
- data/lib/generators/kryptonite/install/install_generator.rb +2 -2
- data/lib/generators/kryptonite/install/templates/db/migrate/kryptonite_create_users.rb +1 -0
- data/lib/generators/kryptonite/install/templates/public/kryptonite/javascripts/custom.js +5 -0
- data/lib/generators/kryptonite/install/templates/public/kryptonite/stylesheets/custom.css +7 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/stylesheets/screen.css +10 -0
- data/lib/generators/kryptonite/update/update_generator.rb +19 -19
- metadata +12 -12
data/PUBLIC_VERSION.yml
CHANGED
@@ -17,6 +17,7 @@ module Kryptonite
|
|
17
17
|
before_filter :authorise
|
18
18
|
before_filter :set_time_zone
|
19
19
|
before_filter :get_uploaded_file
|
20
|
+
before_filter :set_user_language
|
20
21
|
after_filter :destroy_uploaded_file
|
21
22
|
|
22
23
|
ActionView::Base.field_error_proc = proc { |input, instance| "<span class='formError'>#{input}</span>".html_safe }
|
@@ -58,6 +59,10 @@ module Kryptonite
|
|
58
59
|
def set_time_zone
|
59
60
|
Time.zone = current_user.time_zone if current_user
|
60
61
|
end
|
62
|
+
|
63
|
+
def set_user_language
|
64
|
+
I18n.locale = current_user.language if current_user
|
65
|
+
end
|
61
66
|
|
62
67
|
def current_user_session
|
63
68
|
return @current_user_session if defined?(@current_user_session)
|
@@ -40,8 +40,14 @@ module Kryptonite
|
|
40
40
|
def kryptonite_get_access_level_array
|
41
41
|
[["Administrator", $KRYPTONITE_USER_ACCESS_LEVEL_ADMIN], ["User", $KRYPTONITE_USER_ACCESS_LEVEL_USER], ["Frontend User", $KRYPTONITE_USER_ACCESS_LEVEL_FE_USER]]
|
42
42
|
end
|
43
|
+
|
44
|
+
def kryptonite_get_language_array
|
45
|
+
[['English', 'en'], ['Deutsch', 'de']]
|
46
|
+
end
|
43
47
|
|
44
48
|
def kryptonite_table_cell_link contents, link, options = {}
|
49
|
+
|
50
|
+
contents = strip_tags(contents.to_s)
|
45
51
|
|
46
52
|
if options.key? :kryptonite_truncate
|
47
53
|
contents = truncate(contents, :length => options[:kryptonite_truncate], :omission => "...")
|
@@ -52,6 +58,8 @@ module Kryptonite
|
|
52
58
|
|
53
59
|
def kryptonite_table_cell_no_link contents, options = {}
|
54
60
|
|
61
|
+
contents = strip_tags(contents.to_s)
|
62
|
+
|
55
63
|
if options.key? :kryptonite_truncate
|
56
64
|
contents = truncate(contents, :length => options[:kryptonite_truncate], :omission => "...")
|
57
65
|
end
|
@@ -60,14 +68,39 @@ module Kryptonite
|
|
60
68
|
end
|
61
69
|
|
62
70
|
def kryptonite_show_icon icon_name
|
63
|
-
"<div class='icon'><img src='/kryptonite/
|
71
|
+
"<div class='icon'><img src='/assets/kryptonite/icons/#{icon_name}.png' alt='' /></div>".html_safe
|
64
72
|
end
|
65
73
|
|
66
74
|
def kryptonite_show_row_icon icon_name
|
67
|
-
"<div class='iconRow'><img src='/kryptonite/
|
75
|
+
"<div class='iconRow'><img src='/assets/kryptonite/icons/#{icon_name}.png' alt='' /></div>".html_safe
|
68
76
|
end
|
69
77
|
|
70
78
|
# Styled form tag helpers
|
79
|
+
|
80
|
+
def kryptonite_assets_field form, obj, attribute, options = {}
|
81
|
+
content_key = eval("obj.#{attribute}")
|
82
|
+
content_key = "#{obj.class.name.demodulize.downcase}_#{attribute}_#{rand(36**8).to_s(36)}" if !content_key
|
83
|
+
path = upload_kryptonite_asset_path(content_key)
|
84
|
+
content = "<p><label>Dateiupload</label></p><p><div id=\"uploader\"></div></p>"
|
85
|
+
content += javascript_tag("var uploader = new qq.FileUploader({
|
86
|
+
element: $('#uploader')[0],
|
87
|
+
action: \"#{path}\",
|
88
|
+
multiple: #{options[:multiple] ? options[:multiple] : "false"},
|
89
|
+
allowedExtensions: [#{options[:extenstions] ? options[:extenstions] : "'jpg', 'jpeg', 'png'"}],
|
90
|
+
onSubmit: function(id, fileName) {uploader.setParams({ffmultiple: #{options[:multiple] ? options[:multiple] : "false"}, ffsize: '#{options[:size] ? options[:size] : "200x200#"}', authenticity_token: $('meta[name=\"csrf-token\"]').attr('content')}); },
|
91
|
+
onComplete: function(id, fileName, responseJSON) { }
|
92
|
+
});")
|
93
|
+
content += "<ul id=\"assets\">"
|
94
|
+
Asset.find_all_by_content_key(content_key).each do |asset|
|
95
|
+
content += "<li>"
|
96
|
+
content += link_to(asset.file_file_name, asset.file.url(:normal), :target=>"_blank")
|
97
|
+
content += link_to(kryptonite_show_row_icon("delete"), kryptonite_asset_path(asset), :method => :delete, :remote=>true, :onclick=>"$(this).parent().remove()", :class=>"delete") if @session_user.is_user? || @session_user.is_admin?
|
98
|
+
content += "</li>"
|
99
|
+
end
|
100
|
+
content += "</ul>"
|
101
|
+
content += hidden_field_tag("#{obj.class.name.demodulize.downcase}[#{attribute.to_s}]", content_key).html_safe
|
102
|
+
content.html_safe
|
103
|
+
end
|
71
104
|
|
72
105
|
def kryptonite_text_field form, obj, attribute, options = {}
|
73
106
|
kryptonite_form_tag_wrapper(form.text_field(attribute, strip_kryptonite_options(options_hash_with_merged_classes(options, 'kryptoniteTextField'))), form, obj, attribute, options).html_safe
|
@@ -15,7 +15,7 @@ module Kryptonite
|
|
15
15
|
|
16
16
|
attr_accessor :notify_of_new_password
|
17
17
|
|
18
|
-
attr_accessible :login, :name, :email, :time_zone, :access_level, :password, :password_confirmation
|
18
|
+
attr_accessible :login, :name, :email, :time_zone, :access_level, :password, :password_confirmation, :language
|
19
19
|
|
20
20
|
after_create :send_create_notification
|
21
21
|
after_update :send_update_notification
|
@@ -17,12 +17,13 @@
|
|
17
17
|
<div class="tfContainer tfContainerSecond">
|
18
18
|
<%= kryptonite_time_zone_select form, @kryptonite_user, :time_zone, ActiveSupport::TimeZone.us_zones %>
|
19
19
|
</div>
|
20
|
-
|
20
|
+
|
21
21
|
<div class="tfContainer">
|
22
22
|
<%= kryptonite_select form, @kryptonite_user, :access_level, kryptonite_get_access_level_array, {:kryptonite_label => t(:status)} %>
|
23
23
|
</div>
|
24
24
|
|
25
25
|
<div class="tfContainer tfContainerSecond">
|
26
|
+
<%= kryptonite_select f, f.object, :language, kryptonite_get_language_array %>
|
26
27
|
</div>
|
27
28
|
|
28
29
|
<div class="tfContainer">
|
@@ -18,13 +18,15 @@
|
|
18
18
|
<%= kryptonite_time_zone_select f, f.object, :time_zone, ActiveSupport::TimeZone.us_zones %>
|
19
19
|
</div>
|
20
20
|
|
21
|
+
<div class="tfContainer">
|
21
22
|
<% if @session_user.is_admin? && (@kryptonite_user.is_admin? == false || Kryptonite::User.has_more_than_one_admin) %>
|
22
|
-
<div class="tfContainer">
|
23
23
|
<%= kryptonite_select f, f.object, :access_level, kryptonite_get_access_level_array, {:kryptonite_label => t(:status)} %>
|
24
|
-
</div>
|
25
|
-
<div class="tfContainer tfContainerSecond">
|
26
|
-
</div>
|
27
24
|
<% end %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="tfContainer tfContainerSecond">
|
28
|
+
<%= kryptonite_select f, f.object, :language, kryptonite_get_language_array %>
|
29
|
+
</div>
|
28
30
|
|
29
31
|
<div class="clearer"></div>
|
30
32
|
|
@@ -5,19 +5,19 @@
|
|
5
5
|
<head>
|
6
6
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
7
|
<title><%=t "welcome_title", :website_name=>kryptonite_config_website_name %></title>
|
8
|
-
<%= stylesheet_link_tag "/kryptonite/
|
9
|
-
<%= javascript_include_tag "/
|
8
|
+
<%= stylesheet_link_tag "/assets/kryptonite/login" %>
|
9
|
+
<%= javascript_include_tag "/assets/jquery", "/assets/kryptonite/login", "/assets/kryptonite/rails" %>
|
10
10
|
<%= csrf_meta_tag %>
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
<div id="header">
|
14
|
-
|
14
|
+
<h1><%= image_tag(kryptonite_config_logo, :alt => kryptonite_config_website_name) %></h1>
|
15
15
|
</div>
|
16
16
|
<div id="content">
|
17
17
|
<%= yield %>
|
18
18
|
</div>
|
19
19
|
<div id="footer">
|
20
|
-
|
20
|
+
<p>Based on <%= link_to "Kryptoapp", "http://www.kryptoapp.com" %> <%= kryptonite_get_short_version_string %> technology.</p>
|
21
21
|
</div>
|
22
22
|
</body>
|
23
23
|
</html>
|
@@ -27,8 +27,8 @@ module Kryptonite
|
|
27
27
|
copy_file "public/robots.txt", "public/robots.txt"
|
28
28
|
|
29
29
|
#blank stylesheets and JavaScript files
|
30
|
-
copy_file "public/kryptonite/stylesheets/custom.css", "
|
31
|
-
copy_file "public/kryptonite/javascripts/custom.js", "
|
30
|
+
copy_file "public/kryptonite/stylesheets/custom.css", "app/assets/kryptonite/stylesheets/custom.css"
|
31
|
+
copy_file "public/kryptonite/javascripts/custom.js", "app/assets/kryptonite/javascripts/custom.js"
|
32
32
|
|
33
33
|
#migrations
|
34
34
|
migration_template 'db/migrate/kryptonite_create_users.rb', "db/migrate/kryptonite_create_users.rb"
|
@@ -5,6 +5,7 @@ class KryptoniteCreateUsers < ActiveRecord::Migration
|
|
5
5
|
t.string :login, :null => false
|
6
6
|
t.string :name
|
7
7
|
t.string :email
|
8
|
+
t.string :language
|
8
9
|
t.integer :access_level, :null => false, :default => 0
|
9
10
|
t.string :crypted_password, :null => false
|
10
11
|
t.string :password_salt, :null => false
|
@@ -7,35 +7,35 @@ module Kryptonite
|
|
7
7
|
puts "*** Updating Kryptonite public assets. These should not be modified as they may be overwritten in future updates. ***"
|
8
8
|
|
9
9
|
#stylesheets
|
10
|
-
copy_file "public/kryptonite/stylesheets/screen.css", "
|
11
|
-
copy_file "public/kryptonite/stylesheets/elements.css", "
|
12
|
-
copy_file "public/kryptonite/stylesheets/login.css", "
|
13
|
-
copy_file "public/kryptonite/stylesheets/fileuploader.css", "
|
10
|
+
copy_file "public/kryptonite/stylesheets/screen.css", "app/assets/kryptonite/stylesheets/screen.css"
|
11
|
+
copy_file "public/kryptonite/stylesheets/elements.css", "app/assets/kryptonite/stylesheets/elements.css"
|
12
|
+
copy_file "public/kryptonite/stylesheets/login.css", "app/assets/kryptonite/stylesheets/login.css"
|
13
|
+
copy_file "public/kryptonite/stylesheets/fileuploader.css", "app/assets/kryptonite/stylesheets/fileuploader.css"
|
14
14
|
|
15
15
|
#javascripts
|
16
|
-
copy_file "public/kryptonite/javascripts/kryptonite.js", "
|
17
|
-
copy_file "public/kryptonite/javascripts/login.js", "
|
18
|
-
copy_file "public/kryptonite/javascripts/jquery.js", "
|
19
|
-
copy_file "public/kryptonite/javascripts/rails.js", "
|
20
|
-
copy_file "public/kryptonite/javascripts/fileuploader.js", "
|
16
|
+
copy_file "public/kryptonite/javascripts/kryptonite.js", "app/assets/kryptonite/javascripts/kryptonite.js"
|
17
|
+
copy_file "public/kryptonite/javascripts/login.js", "app/assets/kryptonite/javascripts/login.js"
|
18
|
+
copy_file "public/kryptonite/javascripts/jquery.js", "app/assets/kryptonite/javascripts/jquery.js"
|
19
|
+
copy_file "public/kryptonite/javascripts/rails.js", "app/assets/kryptonite/javascripts/rails.js"
|
20
|
+
copy_file "public/kryptonite/javascripts/fileuploader.js", "app/assets/kryptonite/javascripts/fileuploader.js"
|
21
21
|
|
22
22
|
#images
|
23
|
-
copy_file "public/kryptonite/images/header.png", "
|
24
|
-
copy_file "public/kryptonite/images/nav.png", "
|
25
|
-
copy_file "public/kryptonite/images/rightNav.png", "
|
26
|
-
copy_file "public/kryptonite/images/rightNavButton.png", "
|
27
|
-
copy_file "public/kryptonite/images/kryptonite.png", "
|
28
|
-
copy_file "public/kryptonite/images/visitSiteNav.png", "
|
29
|
-
copy_file "public/kryptonite/images/login/top.png", "
|
30
|
-
copy_file "public/kryptonite/images/login/bottom.png", "
|
31
|
-
copy_file "public/kryptonite/images/loading.gif", "
|
23
|
+
copy_file "public/kryptonite/images/header.png", "app/assets/kryptonite/images/header.png"
|
24
|
+
copy_file "public/kryptonite/images/nav.png", "app/assets/kryptonite/images/nav.png"
|
25
|
+
copy_file "public/kryptonite/images/rightNav.png", "app/assets/kryptonite/images/rightNav.png"
|
26
|
+
copy_file "public/kryptonite/images/rightNavButton.png", "app/assets/kryptonite/images/rightNavButton.png"
|
27
|
+
copy_file "public/kryptonite/images/kryptonite.png", "app/assets/kryptonite/images/kryptonite.png"
|
28
|
+
copy_file "public/kryptonite/images/visitSiteNav.png", "app/assets/kryptonite/images/visitSiteNav.png"
|
29
|
+
copy_file "public/kryptonite/images/login/top.png", "app/assets/kryptonite/images/login/top.png"
|
30
|
+
copy_file "public/kryptonite/images/login/bottom.png", "app/assets/kryptonite/images/login/bottom.png"
|
31
|
+
copy_file "public/kryptonite/images/loading.gif", "app/assets/kryptonite/images/loading.gif"
|
32
32
|
|
33
33
|
#icons
|
34
34
|
all_icons = Dir.new(File.expand_path('../templates/public/kryptonite/images/icons/', __FILE__)).entries
|
35
35
|
|
36
36
|
for icon in all_icons
|
37
37
|
if File.extname(icon) == ".png"
|
38
|
-
copy_file "public/kryptonite/images/icons/#{icon}", "
|
38
|
+
copy_file "public/kryptonite/images/icons/#{icon}", "app/assets/kryptonite/images/icons/#{icon}"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kryptonite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-09-07 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: kryptonite
|
17
|
-
requirement: &
|
17
|
+
requirement: &70147323082280 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70147323082280
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: will_paginate
|
28
|
-
requirement: &
|
28
|
+
requirement: &70147323081660 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - =
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 3.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70147323081660
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: authlogic
|
39
|
-
requirement: &
|
39
|
+
requirement: &70147323072580 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - =
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 3.0.3
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70147323072580
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: best_in_place
|
50
|
-
requirement: &
|
50
|
+
requirement: &70147323071980 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - =
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 1.0.6
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70147323071980
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: paperclip
|
61
|
-
requirement: &
|
61
|
+
requirement: &70147323071420 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - =
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: 2.7.0
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70147323071420
|
70
70
|
description: Kryptonite is an open-source CMS for Ruby on Rails, originally developed
|
71
71
|
by Spoiled Milk. Extended by Alexander Feiglstorfer.
|
72
72
|
email: delooks@gmail.com
|